Skip to content

Commit

Permalink
fix: disabled prop on Input component is not being respected
Browse files Browse the repository at this point in the history
`disabled` is on input props but the “Input Wrapper” type elements need to set `data-variant: ‘disabled’`.
  • Loading branch information
SimeonC committed May 31, 2024
1 parent b479374 commit 1ff7b9f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion system/react-css/src/structuredComponents/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const Input = React.forwardRef<HTMLInputElement, Props>(
onInput,
style,
className,
disabled: isDisabled,
iconBefore = null,
iconAfter = null,
suffix = null,
Expand Down Expand Up @@ -66,7 +67,7 @@ export const Input = React.forwardRef<HTMLInputElement, Props>(
<Component
style={style}
className={className}
data-variant={variant}
data-variant={isDisabled ? 'disabled' : variant}
data-stretch={isStretched}
data-size={size}
data-with-icon={withIcon}
Expand Down
3 changes: 2 additions & 1 deletion system/react/src/structuredComponents/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const Input = React.forwardRef<HTMLInputElement, Props>(
iconAfter = null,
suffix = null,
prefix = null,
disabled: isDisabled,
'data-stretch': isStretched,
'data-variant': variant,
'data-pseudo': pseudoDebugger,
Expand All @@ -66,7 +67,7 @@ export const Input = React.forwardRef<HTMLInputElement, Props>(
<Component
style={style}
className={className}
data-variant={variant}
data-variant={isDisabled ? 'disabled' : variant}
data-stretch={isStretched}
data-size={size}
data-with-icon={withIcon}
Expand Down
4 changes: 2 additions & 2 deletions system/stories/src/Input.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ const contentVariants = [
{ title: 'Default' },
{ title: 'With Value', defaultValue: 'Some Content' },
{ title: 'Focus', 'data-pseudo': 'focus' },
{ title: 'Disabled', 'data-variant': 'disabled' as const },
{ title: 'Disabled', disabled: true },
{
title: 'Disabled With Value',
'data-variant': 'disabled' as const,
disabled: true,
defaultValue: 'Some Content'
},
{ title: 'Error', 'data-variant': 'error' as const },
Expand Down

0 comments on commit 1ff7b9f

Please sign in to comment.