Skip to content

Commit

Permalink
fix(Input): readonly color contrast (#2621)
Browse files Browse the repository at this point in the history
Fixes #2604
Switch styling comes later in #2561
  • Loading branch information
eirikbacker authored Oct 16, 2024
1 parent 8a6ff15 commit 31c036d
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changeset/friendly-cups-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@digdir/designsystemet-css": patch
"@digdir/designsystemet-react": patch
---

Input: Sufficient color contrast for readonly
2 changes: 1 addition & 1 deletion packages/css/input.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
--dsc-input-border-width: 1px;
--dsc-input-color--checked: var(--ds-color-accent-contrast-default);
--dsc-input-color--invalid: var(--ds-color-danger-contrast-default);
--dsc-input-color--readonly: var(--ds-color-neutral-border-default);
--dsc-input-color--readonly: var(--ds-color-neutral-text-subtle);
--dsc-input-color: var(--ds-color-neutral-text-default);
--dsc-input-padding: var(--ds-spacing-2) var(--ds-spacing-3);
--dsc-input-size--switch: var(--ds-sizing-7);
Expand Down
42 changes: 42 additions & 0 deletions packages/react/src/components/form/Input/Input.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,20 @@ export const Switch: StoryFn<typeof Input> = (args) => (
<Input {...args} size='sm' name='sm-disabled' disabled defaultChecked />
Disabled checked
</Label>
{/* <Label weight='regular' size='sm'>
<Input {...args} size='sm' name='sm-invalid' aria-invalid='true' />
Invalid
</Label>
<Label weight='regular' size='sm'>
<Input
{...args}
size='sm'
name='sm-invalid'
aria-invalid='true'
defaultChecked
/>
Invalid checked
</Label> */}
<Label weight='regular' size='sm'>
<Input {...args} size='sm' name='sm-readonly' readOnly />
Read-only
Expand Down Expand Up @@ -723,6 +737,20 @@ export const Switch: StoryFn<typeof Input> = (args) => (
<Input {...args} size='md' name='md-disabled' disabled defaultChecked />
Disabled checked
</Label>
{/* <Label weight='regular' size='md'>
<Input {...args} size='md' name='md-invalid' aria-invalid='true' />
Invalid
</Label>
<Label weight='regular' size='md'>
<Input
{...args}
size='md'
name='md-invalid'
aria-invalid='true'
defaultChecked
/>
Invalid checked
</Label> */}
<Label weight='regular' size='md'>
<Input {...args} size='md' name='md-readonly' readOnly />
Read-only
Expand Down Expand Up @@ -750,6 +778,20 @@ export const Switch: StoryFn<typeof Input> = (args) => (
<Input {...args} size='lg' name='lg-disabled' disabled defaultChecked />
Disabled checked
</Label>
{/* <Label weight='regular' size='lg'>
<Input {...args} size='lg' name='lg-invalid' aria-invalid='true' />
Invalid
</Label>
<Label weight='regular' size='lg'>
<Input
{...args}
size='lg'
name='lg-invalid'
aria-invalid='true'
defaultChecked
/>
Invalid checked
</Label> */}
<Label weight='regular' size='lg'>
<Input {...args} size='lg' name='lg-readonly' readOnly />
Read-only
Expand Down

0 comments on commit 31c036d

Please sign in to comment.