Skip to content

Commit

Permalink
Merge pull request #3900 from kiwicom/fix/select-label
Browse files Browse the repository at this point in the history
Fix/select label
  • Loading branch information
DSil committed Jun 26, 2023
2 parents 54f2eec + 6dccd7a commit fb3d12a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/orbit-components/src/Select/Select.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,26 @@ WithCountryFlagPrefix.story = {
},
};

export const WithLongLabel = () => {
const inlineLabel = boolean("inlineLabel", true);
return (
<Select
label="Select box (with long label)"
options={objectOptions}
onChange={action("onChange")}
inlineLabel={inlineLabel}
/>
);
};

WithLongLabel.story = {
name: "With long label",

parameters: {
info: "Long labels truncate automatically when inline.",
},
};

export const WithPlaceholder = () => {
const placeholder = text("Placeholder", "Select value from list");
return (
Expand Down
12 changes: 12 additions & 0 deletions packages/orbit-components/src/Select/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@ const StyledInlineLabel = styled.div<{ hasFeedback?: boolean }>`
)};
${FormLabel} {
display: inline-block;
margin-bottom: 0;
font-size: ${theme.orbit.fontSizeInputNormal};
line-height: ${theme.orbit.lineHeightTextNormal};
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
max-width: 20ch;
}
`}
`;
Expand Down Expand Up @@ -201,6 +205,14 @@ export const SelectContainer = styled.div<{ disabled?: boolean; error?: boolean
error ? theme.orbit.borderColorInputErrorHover : theme.orbit.borderColorInputHover
}`};
}
&:focus-within {
outline: none;
${FakeInput} {
${formElementFocus}
}
}
`}
`;

Expand Down

0 comments on commit fb3d12a

Please sign in to comment.