Skip to content

Commit ef9f2f6

Browse files
committed
Fix disabled checkbox color in Select
1 parent e7b4c07 commit ef9f2f6

File tree

6 files changed

+36
-8
lines changed

6 files changed

+36
-8
lines changed

packages/components/src/components/Input/__tests__/__snapshots__/index.browser.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ exports[`Input > should pass className prop to error message component 1`] = `
6363
>
6464
<input
6565
aria-label="input"
66-
class=" color-0-var(--inputDisabledText,light-dark(#D6D7DE,#373737))-7704306251139592248-1 background-0-var(--inputDisabledBg,light-dark(#F0F0F3,#414244))-14172363753176421546-1 border-0-1px solid var(--border,light-dark(#E4E4E4,#434343))-14172363753176421546-1 color-0-var(--inputDisabledText,light-dark(#D6D7DE,#373737))-14172363753176421546-1 background-0-var(--primaryBg,light-dark(#F4F3FA,#F4F3FA0D))-16231282139879731451-1 border-0-1px solid var(--primary,light-dark(#674DC7,#8163E1))-16231282139879731451-1 outline-0-none-16231282139879731451-1 border-0-1px solid var(--primary,light-dark(#674DC7,#8163E1))-8380715471663921674-1 color-0-var(--inputPlaceholder,light-dark(#A9A8AB,#CBCBCB))-15878565022192187906-1 background-0-var(--inputBg,light-dark(#FFF,#2E2E2E))--1 border-radius-0-8px--1 border-style-0-solid--1 border-width-0-1px--1 padding-bottom-0-12px--1 padding-top-0-12px--1 transition-0-all .1s ease-in-out--1 border-color-0-var(--border,light-dark(#E4E4E4,#434343))--1 padding-left-0-12px--1 padding-right-0-36px--1 "
66+
class=" color-0-var(--inputDisabledText,light-dark(#D6D7DE,#373737))-7704306251139592248-1 background-0-var(--inputDisabledBg,light-dark(#F0F0F3,#414244))-14172363753176421546-1 border-0-1px solid var(--border,light-dark(#E4E4E4,#434343))-14172363753176421546-1 color-0-var(--inputDisabledText,light-dark(#D6D7DE,#373737))-14172363753176421546-1 background-0-var(--primaryBg,light-dark(#F4F3FA,#F4F3FA0D))-16231282139879731451-1 border-0-1px solid var(--primary,light-dark(#674DC7,#8163E1))-16231282139879731451-1 outline-0-none-16231282139879731451-1 border-0-1px solid var(--primary,light-dark(#674DC7,#8163E1))-8380715471663921674-1 color-0-var(--inputPlaceholder,light-dark(#A9A8AB,#CBCBCB))-15878565022192187906-1 background-0-var(--inputBg,light-dark(#FFF,#2E2E2E))--1 border-radius-0-8px--1 border-style-0-solid--1 border-width-0-1px--1 padding-bottom-0-12px--1 padding-top-0-12px--1 transition-0-all .1s ease-in-out--1 border-color-0-var(--error,light-dark(#D52B2E,#FF5B5E))--1 padding-left-0-12px--1 padding-right-0-36px--1 "
6767
value=""
6868
/>
6969
<span

packages/components/src/components/Input/__tests__/index.browser.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ describe('Input', () => {
7272
})
7373

7474
it('should be able to render with error message', () => {
75-
const { container } = render(<Input errorMessage="Error message" />)
75+
const { container } = render(<Input error errorMessage="Error message" />)
7676
expect(
7777
container.querySelector('[aria-label="error-message"]'),
7878
).toBeInTheDocument()
@@ -110,6 +110,7 @@ describe('Input', () => {
110110
classNames={{
111111
errorMessage: 'error-message',
112112
}}
113+
error
113114
errorMessage="Error message"
114115
/>,
115116
)

packages/components/src/components/Select/IconCheck.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { ComponentProps } from 'react'
33
export function IconCheck({ ...props }: ComponentProps<'svg'>) {
44
return (
55
<svg
6-
color="white"
76
fill="none"
87
height="10"
98
viewBox="0 0 12 10"

packages/components/src/components/Select/Select.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function DefaultComponent(
4949
props: Omit<ComponentProps<typeof Select>, 'children'>,
5050
) {
5151
return (
52-
<Select {...props} onValueChange={() => {}}>
52+
<Select {...props} defaultValue={['Option 1']} onValueChange={() => {}}>
5353
<SelectTrigger>Select</SelectTrigger>
5454
<SelectContainer>
5555
<SelectOption disabled value="Option 1">

packages/components/src/components/Select/__tests__/index.browser.test.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,25 @@ describe('Select', () => {
260260
})
261261
})
262262

263+
it('should have disabled check color when type is checkbox and the option is disabled', () => {
264+
const { container } = render(
265+
<Select defaultValue={['Option 1']} type="checkbox">
266+
<SelectTrigger>Select</SelectTrigger>
267+
<SelectContainer>
268+
<SelectOption disabled value="Option 1">
269+
Option 1
270+
</SelectOption>
271+
</SelectContainer>
272+
</Select>,
273+
)
274+
const selectToggle = container.querySelector('[aria-label="Select toggle"]')
275+
fireEvent.click(selectToggle!)
276+
const option1 = container.querySelector('[data-value="Option 1"]')
277+
expect(option1?.querySelector('svg')).toHaveClass(
278+
'color-0-var(--inputDisabledText,light-dark(#E5E5E5,#373737))--255',
279+
)
280+
})
281+
263282
it('should show confirm button when type is checkbox and showConfirmButton is true', () => {
264283
const { container } = render(
265284
<Select type="checkbox">

packages/components/src/components/Select/index.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ interface SelectProps extends ComponentProps<'div'> {
5050
primary?: string
5151
border?: string
5252
inputBackground?: string
53+
inputDisabledBackground?: string
54+
inputDisabledText?: string
5355
base10?: string
5456
title?: string
5557
selectDisabled?: string
@@ -134,6 +136,8 @@ export function Select({
134136
title: colors?.title,
135137
selectDisabled: colors?.selectDisabled,
136138
primaryBg: colors?.primaryBg,
139+
inputDisabledBackground: colors?.inputDisabledBackground,
140+
inputDisabledText: colors?.inputDisabledText,
137141
}}
138142
typography={typography}
139143
{...props}
@@ -302,7 +306,7 @@ export function SelectOption({
302306
}
303307
}
304308
alignItems="center"
305-
borderRadius="8px"
309+
borderRadius="6px"
306310
color={
307311
disabled
308312
? 'var(--selectDisabled, light-dark(#C4C5D1, #45464D))'
@@ -332,9 +336,11 @@ export function SelectOption({
332336
checkbox: (
333337
<Box
334338
bg={
335-
isSelected
336-
? 'var(--primary, light-dark(#674DC7, #8163E1)'
337-
: 'var(--border, light-dark(#E4E4E4, #434343))'
339+
disabled
340+
? 'var(--inputDisabledBackground, light-dark(#F0F0F3, #414244))'
341+
: isSelected
342+
? 'var(--primary, light-dark(#674DC7, #8163E1)'
343+
: 'var(--border, light-dark(#E4E4E4, #434343))'
338344
}
339345
borderRadius="4px"
340346
boxSize="18px"
@@ -344,6 +350,9 @@ export function SelectOption({
344350
{isSelected && (
345351
<IconCheck
346352
className={css({
353+
color: disabled
354+
? 'var(--inputDisabledText, light-dark(#E5E5E5, #373737))'
355+
: '#FFF',
347356
position: 'absolute',
348357
top: '55%',
349358
left: '50%',

0 commit comments

Comments
 (0)