Skip to content

Commit 2bb07ee

Browse files
authored
chore: Update SelectDropdown Multi select to use logical properties (#3331)
* fix selectdropdown multi-select tags, using logical props * sorted props alphabetically and add back fontSize
1 parent 6efbb0b commit 2bb07ee

1 file changed

Lines changed: 22 additions & 17 deletions

File tree

  • packages/gamut/src/Form/SelectDropdown

packages/gamut/src/Form/SelectDropdown/styles.ts

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ export const getMemoizedStyles = (
140140
input: (provided) => ({
141141
...provided,
142142
...textColor({ theme }),
143-
padding: '0',
144143
margin: '0',
144+
padding: '0',
145145
}),
146146
menu: (provided, state: BaseSelectComponentProps) => {
147147
const { dropdownWidth, menuAlignment } = state.selectProps;
@@ -152,8 +152,8 @@ export const getMemoizedStyles = (
152152
...dropdownBorderStates({ error: state.selectProps.error, theme }),
153153
...(dropdownWidth
154154
? {
155-
width: dropdownWidth,
156155
minWidth: dropdownWidth,
156+
width: dropdownWidth,
157157
}
158158
: {}),
159159
...(menuAlignment === 'right'
@@ -177,18 +177,20 @@ export const getMemoizedStyles = (
177177
multiValue: (provided, state) => ({
178178
...provided,
179179
...tagBaseStyles,
180-
height: '24px',
181-
cursor: state.isDisabled ? 'not-allowed' : 'pointer',
182-
color: theme.colors.background,
183180
backgroundColor: 'transparent',
184-
borderRadius: theme.borderRadii.md,
181+
color: theme.colors.background,
182+
cursor: state.isDisabled ? 'not-allowed' : 'pointer',
183+
height: '24px',
185184
}),
186185
multiValueLabel: (provided) => ({
187186
...provided,
188-
color: theme.colors.background,
189187
backgroundColor: theme.colors['text-secondary'],
190-
borderRadius: `${theme.borderRadii.md} 0 0 ${theme.borderRadii.md}`,
191-
fontSize: `${tagLabelFontSize}px`,
188+
borderEndEndRadius: 0,
189+
borderEndStartRadius: theme.borderRadii.md,
190+
borderStartEndRadius: 0,
191+
borderStartStartRadius: theme.borderRadii.md,
192+
color: theme.colors.background,
193+
fontSize: tagLabelFontSize,
192194
height: '100%',
193195
padding: `0 ${tagLabelPadding}px`,
194196
paddingLeft: `${tagLabelPadding}px`, // default label has an explicit rule for padding left so we need this to override it
@@ -197,35 +199,38 @@ export const getMemoizedStyles = (
197199
multiValueRemove: (provided, state) => ({
198200
...provided,
199201
...dismissSharedStyles,
200-
cursor: state.isDisabled ? 'not-allowed' : 'pointer',
201-
pointerEvents: state.isDisabled ? 'none' : 'visible',
202202
backgroundColor: theme.colors['text-secondary'],
203-
borderRadius: `0 ${theme.borderRadii.md} ${theme.borderRadii.md} 0`,
203+
borderEndEndRadius: theme.borderRadii.md,
204+
borderEndStartRadius: 0,
205+
borderStartEndRadius: theme.borderRadii.md,
206+
borderStartStartRadius: 0,
207+
cursor: state.isDisabled ? 'not-allowed' : 'pointer',
204208
padding: 0, // default remove has padding left and right that we don't need
209+
pointerEvents: state.isDisabled ? 'none' : 'visible',
205210
':hover': {
206211
backgroundColor: theme.colors['secondary-hover'],
207212
},
208213
}),
209214
option: (provided, state: OptionState) => ({
210-
padding: state.selectProps.size === 'small' ? '3px 14px' : '11px 14px',
211-
cursor: state.isDisabled ? 'not-allowed' : 'pointer',
212215
...getOptionBackground(state.isSelected, state.isFocused)({ theme }),
213-
display: 'flex',
214216
alignItems: 'center',
215217
color: state.isDisabled ? 'text-disabled' : 'default',
218+
cursor: state.isDisabled ? 'not-allowed' : 'pointer',
219+
display: 'flex',
220+
padding: state.selectProps.size === 'small' ? '3px 14px' : '11px 14px',
216221
}),
217222
placeholder: (provided) => ({
218223
...provided,
219224
...placeholderColor({ theme }),
220-
whiteSpace: 'nowrap',
221225
overflow: 'hidden',
222226
textOverflow: 'ellipsis',
227+
whiteSpace: 'nowrap',
223228
}),
224229
singleValue: (provided) => ({
225230
...provided,
226231
...textColor({ theme }),
227-
display: 'flex',
228232
alignItems: 'center',
233+
display: 'flex',
229234
marginLeft: 0,
230235
}),
231236
valueContainer: (provided) => ({

0 commit comments

Comments
 (0)