From 371efbc8466cd4424d6d7eaa5901a4fb5b97be16 Mon Sep 17 00:00:00 2001 From: yue Date: Wed, 13 Nov 2024 13:45:53 +0900 Subject: [PATCH 1/5] fix: update design token usage --- .../react/src/components/Button/index.css | 14 ++++++------- .../Checkbox/CheckboxInput/index.css | 17 +++++++++++++++- .../react/src/components/Checkbox/index.css | 2 +- .../__snapshots__/index.story.storyshot | 10 ++++++++++ .../src/components/Clickable/index.story.tsx | 20 +++++++++++++++++-- .../DropdownSelector/Popover/index.css | 2 +- .../__snapshots__/index.story.storyshot | 10 +++++++--- .../src/components/DropdownSelector/index.css | 11 +++++----- .../DropdownSelector/index.story.tsx | 2 ++ .../react/src/components/IconButton/index.css | 16 +++++++-------- .../src/components/LoadingSpinner/index.css | 1 + .../src/components/Modal/ModalPlumbing.css | 1 + .../Modal/__snapshots__/index.story.storyshot | 5 ----- .../src/components/Modal/index.story.tsx | 1 - .../src/components/Radio/RadioInput/index.css | 6 +++--- .../Radio/__snapshots__/index.story.storyshot | 8 ++++---- packages/react/src/components/Radio/index.css | 2 +- .../src/components/Radio/index.story.tsx | 10 +++++++--- .../src/components/SegmentedControl/index.css | 2 +- .../components/Switch/SwitchInput/index.css | 8 ++++---- .../react/src/components/Switch/index.css | 2 +- .../react/src/components/TextArea/index.css | 4 ++-- .../TextField/AssistiveText/index.css | 2 +- .../react/src/components/TextField/index.css | 4 ++-- 24 files changed, 104 insertions(+), 56 deletions(-) diff --git a/packages/react/src/components/Button/index.css b/packages/react/src/components/Button/index.css index 70bb644b2..f3b2072f0 100644 --- a/packages/react/src/components/Button/index.css +++ b/packages/react/src/components/Button/index.css @@ -24,8 +24,8 @@ font-size: 14px; line-height: 22px; font-weight: bold; - color: var(--charcoal-color-text-secondary-default); - background-color: var(--charcoal-color-container-secondary-default); + color: var(--charcoal-color-text-default); + background-color: var(--charcoal-color-container-secondary-default-a); transition: 0.2s color, 0.2s background-color, 0.2s box-shadow; height: 40px; } @@ -42,14 +42,14 @@ } .charcoal-button:not(:disabled):hover { - color: var(--charcoal-color-text-secondary-hover); - background-color: var(--charcoal-color-container-secondary-hover); + color: var(--charcoal-color-text-hover); + background-color: var(--charcoal-color-container-secondary-hover-a); } .charcoal-button:not(:disabled):active, -.charcoal-button[data-active='true'] { - color: var(--charcoal-color-text-secondary-press); - background-color: var(--charcoal-color-container-secondary-press); +.charcoal-button:not(:disabled)[data-active='true'] { + color: var(--charcoal-color-text-press); + background-color: var(--charcoal-color-container-secondary-press-a); } .charcoal-button[data-variant='Primary'] { diff --git a/packages/react/src/components/Checkbox/CheckboxInput/index.css b/packages/react/src/components/Checkbox/CheckboxInput/index.css index 75a9ca3ae..de692504f 100644 --- a/packages/react/src/components/Checkbox/CheckboxInput/index.css +++ b/packages/react/src/components/Checkbox/CheckboxInput/index.css @@ -9,8 +9,15 @@ transition: 0.2s box-shadow, 0.2s background-color; position: relative; box-sizing: border-box; + background-color: var(--charcoal-color-container-default); } +.charcoal-checkbox-input:hover { + background-color: var(--charcoal-color-container-hover); +} +.charcoal-checkbox-input:active { + background-color: var(--charcoal-color-container-press); +} .charcoal-checkbox-input:disabled, .charcoal-checkbox-input[readonly] { cursor: default; @@ -23,7 +30,7 @@ .charcoal-checkbox-input:checked::after { content: ''; - background-color: white; + background-color: var(--charcoal-color-icon-on-primary-default); display: flex; margin: auto; width: 16px; @@ -33,6 +40,14 @@ ); } +.charcoal-checkbox-input:checked:hover::after { + background-color: var(--charcoal-color-icon-on-primary-hover); +} + +.charcoal-checkbox-input:checked:active::after { + background-color: var(--charcoal-color-icon-on-primary-press); +} + .charcoal-checkbox-input:not(:checked) { border-width: 2px; border-style: solid; diff --git a/packages/react/src/components/Checkbox/index.css b/packages/react/src/components/Checkbox/index.css index 674650fcd..aeafa43a9 100644 --- a/packages/react/src/components/Checkbox/index.css +++ b/packages/react/src/components/Checkbox/index.css @@ -3,7 +3,7 @@ cursor: pointer; display: flex; gap: 4px; - color: var(--charcoal-color-text-secondary-default); + color: var(--charcoal-color-text-default); } .charcoal-checkbox__label[aria-disabled='true'] { diff --git a/packages/react/src/components/Clickable/__snapshots__/index.story.storyshot b/packages/react/src/components/Clickable/__snapshots__/index.story.storyshot index d87b6c950..bcc9b2c8d 100644 --- a/packages/react/src/components/Clickable/__snapshots__/index.story.storyshot +++ b/packages/react/src/components/Clickable/__snapshots__/index.story.storyshot @@ -7,6 +7,11 @@ exports[`Storybook Tests > react/Clickable > Button 1`] = ` @@ -21,6 +26,11 @@ exports[`Storybook Tests > react/Clickable > Link 1`] = ` className="charcoal-clickable" href="#" onClick={[Function]} + style={ + Object { + "color": "var(--charcoal-color-text-secondary-default)", + } + } > link diff --git a/packages/react/src/components/Clickable/index.story.tsx b/packages/react/src/components/Clickable/index.story.tsx index d7bb4b8da..b4afa0ec6 100644 --- a/packages/react/src/components/Clickable/index.story.tsx +++ b/packages/react/src/components/Clickable/index.story.tsx @@ -8,12 +8,28 @@ export default { } as Meta export const Button: StoryObj = { - render: () => button, + render: () => ( + + button + + ), } export const Link: StoryObj = { render: () => ( - + link ), diff --git a/packages/react/src/components/DropdownSelector/Popover/index.css b/packages/react/src/components/DropdownSelector/Popover/index.css index 87bb66a1f..0788d10e4 100644 --- a/packages/react/src/components/DropdownSelector/Popover/index.css +++ b/packages/react/src/components/DropdownSelector/Popover/index.css @@ -4,7 +4,7 @@ overflow: auto; max-height: inherit; background-color: var(--charcoal-color-background-default); - border: solid 1px var(--charcoal-color-border-default); + border: solid 1px var(--charcoal-color-border-secondary); border-radius: 8px; padding-top: 8px; padding-bottom: 8px; diff --git a/packages/react/src/components/DropdownSelector/__snapshots__/index.story.storyshot b/packages/react/src/components/DropdownSelector/__snapshots__/index.story.storyshot index e113646f2..a90e8f637 100644 --- a/packages/react/src/components/DropdownSelector/__snapshots__/index.story.storyshot +++ b/packages/react/src/components/DropdownSelector/__snapshots__/index.story.storyshot @@ -260,7 +260,9 @@ exports[`Storybook Tests > react/DropdownSelector > Default 1`] = `
@@ -315,8 +317,10 @@ exports[`Storybook Tests > react/DropdownSelector > Default 1`] = ` > + data-placeholder={true} + > + Placeholder + = { {...args} onChange={setSelected} value={args.value ? args.value : selected} + placeholder="Placeholder" + label="Label" > Option 1 Option 2 diff --git a/packages/react/src/components/IconButton/index.css b/packages/react/src/components/IconButton/index.css index a6e0b5ed0..9a1b6441d 100644 --- a/packages/react/src/components/IconButton/index.css +++ b/packages/react/src/components/IconButton/index.css @@ -51,54 +51,54 @@ } .charcoal-icon-button[data-variant='Default'] { - color: var(--charcoal-color-text-tertiary-default); + color: var(--charcoal-color-icon-tertiary-default); background-color: rgba(0, 0, 0, 0); } .charcoal-icon-button[data-variant='Default'][data-active='true']:not( :disabled ):not([aria-disabled]), .charcoal-icon-button[data-variant='Default'][data-active='true'][aria-disabled='false'] { - color: var(--charcoal-color-text-tertiary-press); + color: var(--charcoal-color-icon-tertiary-press); background-color: var(--charcoal-color-container-press-a); } .charcoal-icon-button[data-variant='Default'][data-active='false']:not( :disabled ):not([aria-disabled]):hover, .charcoal-icon-button[data-variant='Default'][data-active='false'][aria-disabled='false']:hover { - color: var(--charcoal-color-text-tertiary-hover); + color: var(--charcoal-color-icon-tertiary-hover); background-color: var(--charcoal-color-container-hover-a); } .charcoal-icon-button[data-variant='Default'][data-active='false']:not( :disabled ):not([aria-disabled]):active, .charcoal-icon-button[data-variant='Default'][data-active='false'][aria-disabled='false']:active { - color: var(--charcoal-color-text-tertiary-press); + color: var(--charcoal-color-icon-tertiary-press); background-color: var(--charcoal-color-container-press-a); } .charcoal-icon-button[data-variant='Overlay'] { - color: var(--charcoal-color-text-on-primary-default); + color: var(--charcoal-color-icon-on-on-img-default); background-color: var(--charcoal-color-container-on-img-default); } .charcoal-icon-button[data-variant='Overlay'][data-active='true']:not( :disabled ):not([aria-disabled]), .charcoal-icon-button[data-variant='Overlay'][data-active='true'][aria-disabled='false'] { - color: var(--charcoal-color-text-on-primary-press); + color: var(--charcoal-color-icon-on-on-img-press); background-color: var(--charcoal-color-container-on-img-press); } .charcoal-icon-button[data-variant='Overlay'][data-active='false']:not( :disabled ):not([aria-disabled]):hover, .charcoal-icon-button[data-variant='Overlay'][data-active='false'][aria-disabled='false']:hover { - color: var(--charcoal-color-text-on-primary-hover); + color: var(--charcoal-color-icon-on-on-img-hover); background-color: var(--charcoal-color-container-on-img-hover); } .charcoal-icon-button[data-variant='Overlay'][data-active='false']:not( :disabled ):not([aria-disabled]):active, .charcoal-icon-button[data-variant='Overlay'][data-active='false'][aria-disabled='false']:active { - color: var(--charcoal-color-text-on-primary-press); + color: var(--charcoal-color-icon-on-on-img-press); background-color: var(--charcoal-color-container-on-img-press); } diff --git a/packages/react/src/components/LoadingSpinner/index.css b/packages/react/src/components/LoadingSpinner/index.css index c9e99c6a6..86e61acdd 100644 --- a/packages/react/src/components/LoadingSpinner/index.css +++ b/packages/react/src/components/LoadingSpinner/index.css @@ -10,6 +10,7 @@ width: var(--charcoal-loading-spinner-size); height: var(--charcoal-loading-spinner-size); opacity: 0.84; + color: var(--charcoal-color-icon-tertiary-default); background-color: var(--charcoal-color-background-default); } .charcoal-loading-spinner[data-transparent='true'] { diff --git a/packages/react/src/components/Modal/ModalPlumbing.css b/packages/react/src/components/Modal/ModalPlumbing.css index 389ac16da..b5fab43ef 100644 --- a/packages/react/src/components/Modal/ModalPlumbing.css +++ b/packages/react/src/components/Modal/ModalPlumbing.css @@ -27,6 +27,7 @@ .charcoal-modal-body { padding-bottom: 40px; + color: var(--charcoal-color-text-default); } .charcoal-modal-buttons { diff --git a/packages/react/src/components/Modal/__snapshots__/index.story.storyshot b/packages/react/src/components/Modal/__snapshots__/index.story.storyshot index 8115c99cf..3fde158b7 100644 --- a/packages/react/src/components/Modal/__snapshots__/index.story.storyshot +++ b/packages/react/src/components/Modal/__snapshots__/index.story.storyshot @@ -66,7 +66,6 @@ exports[`Storybook Tests > react/Modal > BackgroundScroll 1`] = `
react/Modal > BottomSheet 1`] = `
react/Modal > Default 1`] = `
react/Modal > FullBottomSheet 1`] = `
react/Modal > NotDismmissableStory 1`] = `
, 'style'>) => { fontSize: 14, lineHeight: '22px', padding: '0 16px', - color: 'var(--charcoal-color-text-secondary-default)', }} {...props} /> diff --git a/packages/react/src/components/Radio/RadioInput/index.css b/packages/react/src/components/Radio/RadioInput/index.css index 238c51d92..af3b69693 100644 --- a/packages/react/src/components/Radio/RadioInput/index.css +++ b/packages/react/src/components/Radio/RadioInput/index.css @@ -24,7 +24,7 @@ width: 8px; height: 8px; pointer-events: none; - background-color: var(--charcoal-color-text-on-primary-default); + background-color: var(--charcoal-color-icon-on-primary-default); border-radius: 999999px; transition: 0.2s background-color, 0.2s box-shadow; } @@ -70,7 +70,7 @@ } .charcoal-radio-input:checked:not(:disabled):hover::after { - background-color: var(--charcoal-color-text-on-primary-hover); + background-color: var(--charcoal-color-icon-on-primary-hover); } .charcoal-radio-input:checked:not(:disabled):active { @@ -78,5 +78,5 @@ } .charcoal-radio-input:checked:not(:disabled):active::after { - background-color: var(--charcoal-color-text-on-primary-press); + background-color: var(--charcoal-color-icon-on-primary-press); } diff --git a/packages/react/src/components/Radio/__snapshots__/index.story.storyshot b/packages/react/src/components/Radio/__snapshots__/index.story.storyshot index bee3fedd9..61e709276 100644 --- a/packages/react/src/components/Radio/__snapshots__/index.story.storyshot +++ b/packages/react/src/components/Radio/__snapshots__/index.story.storyshot @@ -14,7 +14,7 @@ exports[`Storybook Tests > react/Radio > Default 1`] = ` } >
react/Radio > Default 1`] = ` checked={true} className="charcoal-radio-input" disabled={false} - name="default_story" + name="default_story_test-id" onChange={[Function]} type="radio" value="1" @@ -49,7 +49,7 @@ exports[`Storybook Tests > react/Radio > Default 1`] = ` checked={false} className="charcoal-radio-input" disabled={false} - name="default_story" + name="default_story_test-id" onChange={[Function]} type="radio" value="2" @@ -70,7 +70,7 @@ exports[`Storybook Tests > react/Radio > Default 1`] = ` checked={false} className="charcoal-radio-input" disabled={false} - name="default_story" + name="default_story_test-id" onChange={[Function]} type="radio" value="3" diff --git a/packages/react/src/components/Radio/index.css b/packages/react/src/components/Radio/index.css index 32932bde1..72b5a6cfc 100644 --- a/packages/react/src/components/Radio/index.css +++ b/packages/react/src/components/Radio/index.css @@ -14,5 +14,5 @@ .charcoal-radio__label_div { font-size: 14px; line-height: 22px; - color: var(--charcoal-color-text-secondary-default); + color: var(--charcoal-color-text-default); } diff --git a/packages/react/src/components/Radio/index.story.tsx b/packages/react/src/components/Radio/index.story.tsx index 2069a6fd8..b939e15ad 100644 --- a/packages/react/src/components/Radio/index.story.tsx +++ b/packages/react/src/components/Radio/index.story.tsx @@ -1,3 +1,4 @@ +import { useId } from '@react-aria/utils' import Radio from '.' import { RadioGroup } from './RadioGroup' import { StoryObj } from '@storybook/react' @@ -29,14 +30,17 @@ const LayoutDiv = (props: { children: React.ReactNode }) => { } export const Default: StoryObj = { + argTypes: { + disabled: { type: 'boolean', defaultValue: false }, + }, render: function Render(args) { const [value, setValue] = useState
`; +exports[`Storybook Tests > react/IconButton > Disabled 1`] = ` +
+ +
+`; + exports[`Storybook Tests > react/IconButton > IsActive 1`] = `
= { return }, } + +export const Disabled: StoryObj = { + render: () => { + return + }, +} diff --git a/packages/react/src/components/Radio/index.css b/packages/react/src/components/Radio/index.css index 72b5a6cfc..8960fcecf 100644 --- a/packages/react/src/components/Radio/index.css +++ b/packages/react/src/components/Radio/index.css @@ -8,7 +8,7 @@ .charcoal-radio__label[aria-disabled]:not([aria-disabled='false']) { cursor: default; - color: var(--charcoal-color-text-disable); + opacity: 0.32; } .charcoal-radio__label_div { diff --git a/packages/react/src/components/SegmentedControl/index.css b/packages/react/src/components/SegmentedControl/index.css index 022e5d026..528ec49f8 100644 --- a/packages/react/src/components/SegmentedControl/index.css +++ b/packages/react/src/components/SegmentedControl/index.css @@ -26,7 +26,7 @@ [aria-disabled='false'] ) { cursor: default; - color: var(--charcoal-color-text-disable); + opacity: 0.32; } .charcoal-segmented-control-radio__label[data-checked='true'] { diff --git a/packages/react/src/components/Switch/SwitchInput/index.css b/packages/react/src/components/Switch/SwitchInput/index.css index c9b37b17d..6e9f59876 100644 --- a/packages/react/src/components/Switch/SwitchInput/index.css +++ b/packages/react/src/components/Switch/SwitchInput/index.css @@ -20,8 +20,6 @@ .charcoal-switch-input:disabled, .charcoal-switch-input[readonly] { cursor: default; - color: var(--charcoal-color-icon-disable); - background-color: var(--charcoal-color-container-disable); } .charcoal-switch-input::after { diff --git a/packages/react/src/components/Switch/index.css b/packages/react/src/components/Switch/index.css index 489a62334..cb67bced8 100644 --- a/packages/react/src/components/Switch/index.css +++ b/packages/react/src/components/Switch/index.css @@ -9,11 +9,7 @@ .charcoal-switch__label[aria-disabled='true'] { cursor: default; - color: var(--charcoal-color-text-disable); -} - -.charcoal-switch__label[aria-disabled='true'] > input { - opacity: 1; + opacity: 0.32; } .charcoal-switch__label_div { diff --git a/packages/react/src/components/TagItem/index.css b/packages/react/src/components/TagItem/index.css index 34b8aa251..b344ff2fc 100644 --- a/packages/react/src/components/TagItem/index.css +++ b/packages/react/src/components/TagItem/index.css @@ -54,8 +54,7 @@ .charcoal-tag-item:disabled, .charcoal-tag-item[aria-disabled]:not([aria-disabled='false']) { cursor: default; - color: var(--charcoal-color-text-disable); - background-color: var(--charcoal-color-container-disable); + opacity: 0.32; } .charcoal-tag-item:not(:disabled):not([aria-disabled]):focus-visible, .charcoal-tag-item[aria-disabled='false']:focus-visible { diff --git a/packages/react/src/components/TextArea/index.css b/packages/react/src/components/TextArea/index.css index 77463f765..d216974b5 100644 --- a/packages/react/src/components/TextArea/index.css +++ b/packages/react/src/components/TextArea/index.css @@ -5,6 +5,10 @@ grid-gap: 4px; } +.charcoal-text-area-root[aria-disabled='true'] { + opacity: 0.32; +} + .charcoal-text-area-container { position: relative; overflow: hidden; @@ -25,14 +29,6 @@ box-shadow: var(--charcoal-color-custom-focus-effect); } -.charcoal-text-area-container[aria-disabled='true'] { - background-color: var(--charcoal-color-container-disable); -} - -.charcoal-text-area-container:not([aria-disabled='true']):hover { - background-color: var(--charcoal-color-container-secondary-hover-a); -} - .charcoal-text-area-container[aria-invalid='true']:focus-within { box-shadow: var(--charcoal-color-custom-error-effect); } @@ -64,10 +60,6 @@ height: calc(22px / 0.875 * (var(--charcoal-text-area-rows) - 1) + 9px); } -.charcoal-text-area-textarea[aria-disabled='true'] { - color: var(--charcoal-color-text-disable); -} - .charcoal-text-area-textarea::placeholder { color: var(--charcoal-color-text-placeholder-default); } diff --git a/packages/react/src/components/TextField/index.css b/packages/react/src/components/TextField/index.css index 6e7491938..07e731a23 100644 --- a/packages/react/src/components/TextField/index.css +++ b/packages/react/src/components/TextField/index.css @@ -4,6 +4,11 @@ grid-gap: 4px; } +.charcoal-text-field-root[aria-disabled='true'] { + cursor: default; + opacity: 0.32; +} + .charcoal-text-field-container { display: flex; height: 40px; @@ -20,23 +25,16 @@ box-shadow: var(--charcoal-color-custom-error-effect); } -.charcoal-text-field-container[aria-disabled='true'] { - background-color: var(--charcoal-color-container-disable); -} - -.charcoal-text-field-container:not([aria-disabled='true']):hover { - background-color: var(--charcoal-color-container-secondary-hover-a); -} - -.charcoal-text-field-container:not([aria-disabled='true']):focus-within { +.charcoal-text-field-container:not( + [aria-disabled='true'], + [data-invalid='true'] + ):focus-within { outline: none; box-shadow: var(--charcoal-color-custom-focus-effect); } -.charcoal-text-field-container:not( - [aria-disabled='true'] - )[data-invalid='true']:focus-within { - box-shadow: var(--charcoal-color-custom-focus-effect); +.charcoal-text-field-container:not([aria-disabled='true']):hover { + background-color: var(--charcoal-color-container-secondary-hover-a); } .charcoal-text-field-prefix { @@ -77,7 +75,7 @@ } .charcoal-text-field-input[aria-disabled='true'] { - color: var(--charcoal-color-text-disable); + opacity: 0.32; } .charcoal-text-field-input::placeholder { From df4f644ce004c18484a7e5b98ba48e7ac5a48345 Mon Sep 17 00:00:00 2001 From: yue Date: Wed, 20 Nov 2024 15:39:50 +0900 Subject: [PATCH 5/5] fix: use input[readonly] --- packages/react/src/components/Checkbox/CheckboxInput/index.css | 2 +- packages/react/src/components/Checkbox/index.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react/src/components/Checkbox/CheckboxInput/index.css b/packages/react/src/components/Checkbox/CheckboxInput/index.css index cfa91e4ef..2667b4788 100644 --- a/packages/react/src/components/Checkbox/CheckboxInput/index.css +++ b/packages/react/src/components/Checkbox/CheckboxInput/index.css @@ -21,7 +21,7 @@ .charcoal-checkbox-input:disabled { cursor: default; } -.charcoal-checkbox-input:read-only { +.charcoal-checkbox-input[readonly] { cursor: default; opacity: 0.32; } diff --git a/packages/react/src/components/Checkbox/index.css b/packages/react/src/components/Checkbox/index.css index 631bc0e77..79fe730b1 100644 --- a/packages/react/src/components/Checkbox/index.css +++ b/packages/react/src/components/Checkbox/index.css @@ -11,7 +11,7 @@ opacity: 0.32; } -.charcoal-checkbox__label:has(input:read-only) { +.charcoal-checkbox__label:has(input[readonly]) { cursor: default; }