Skip to content

Commit 7a8a7fe

Browse files
authored
fix: select component hide label style (#552)
* feat: add hideLabel property on experimental Select * fix: hide label style on select component * fix: bring back stylelint-disable comment
1 parent b7f22ce commit 7a8a7fe

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
11
import styled from 'styled-components';
22
import { Label } from './Label';
33

4-
export const InnerWrapper = styled.div`
4+
export const InnerWrapper = styled.div<{ hideLabel?: boolean }>`
55
position: relative;
66
overflow: hidden;
77
88
box-sizing: border-box;
99
width: 100%;
1010
11+
${props =>
12+
!props.hideLabel &&
13+
`
14+
padding-top: var(--wave-exp-typescale-label-2-line-height);
15+
`}
16+
17+
/* For browsers that support :has(), we use this as a fallback */
1118
/* stylelint-disable selector-type-case, selector-type-no-unknown */
12-
&:has(${Label}) {
19+
&:has(${Label}:not(.visually-hidden)) {
1320
padding-top: var(--wave-exp-typescale-label-2-line-height);
1421
}
1522
`;

src/components/experimental/Select/Select.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function SelectTriggerWithRef<T extends object>(
5656
return (
5757
<FakeButton $isVisuallyFocused={state?.isOpen} ref={forwardedRef} onClick={() => buttonRef.current?.click()}>
5858
{leadingIcon}
59-
<InnerWrapper>
59+
<InnerWrapper hideLabel={hideLabel}>
6060
{hideLabel ? (
6161
<VisuallyHidden>
6262
<Label>{label}</Label>

0 commit comments

Comments
 (0)