Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

feat(input): reflect disabled state on input theming targets (#4794)

freddymetac96f4dc09f6d
diff --git a/.changeset/input-disabled-theme-state.md b/.changeset/input-disabled-theme-state.md
new file mode 100644
index 0000000000..e660cf7d02
--- /dev/null
+++ b/.changeset/input-disabled-theme-state.md
@@ -0,0 +1,7 @@
+---
+'@astryxdesign/core': patch
+---
+
+[feat] The input family (TextInput, NumberInput, DateInput, DateRangeInput, DateTimeInput, TimeInput, TextArea, Tokenizer) now reflects its disabled state on the root theming target as `data-disabled="disabled"` plus a `.disabled` variant (only when disabled), so a theme can gate its own hover/border treatment on the disabled state — mirroring the existing `status`/`size` reflection — instead of relying on structural `:has(input:disabled)` CSS. This closes a documented theming gap for downstream consumers.
+
+@freddymeta
diff --git a/packages/core/src/DateInput/DateInput.doc.mjs b/packages/core/src/DateInput/DateInput.doc.mjs
index e043eb8fbb..229a661c6e 100644
--- a/packages/core/src/DateInput/DateInput.doc.mjs
+++ b/packages/core/src/DateInput/DateInput.doc.mjs
@@ -171,7 +171,7 @@ export const docs = {
],
theming: {
targets: [
- {className: 'astryx-date-input', visualProps: ['size', 'status']},
+ {className: 'astryx-date-input', visualProps: ['size', 'status'], states: ['disabled']},
{className: 'astryx-date-input-toggle-icon', states: ['state']},
{className: 'astryx-date-input-clear-icon'},
],
@@ -449,6 +449,7 @@ export const docsZh = {
{
className: 'astryx-date-input',
visualProps: ['size', 'status'],
+ states: ['disabled'],
},
{className: 'astryx-date-input-toggle-icon', states: ['state']},
{className: 'astryx-date-input-clear-icon'},
diff --git a/packages/core/src/DateInput/DateInput.test.tsx b/packages/core/src/DateInput/DateInput.test.tsx
index 305247876c..db7bde05a2 100644
--- a/packages/core/src/DateInput/DateInput.test.tsx
+++ b/packages/core/src/DateInput/DateInput.test.tsx
@@ -1232,3 +1232,20 @@ describe('DateInput calendar-toggle icon theme target', () => {
expect(css).toContain('color: var(--color-icon-primary)');
});
});
+
+describe('DateInput disabled theme state', () => {
+ it('reflects disabled on the root target so themes can gate paint on it', () => {
+ const {container} = render(
+ <DateInput label="Date" onChange={() => {}} isDisabled />,
+ );
+ const root = container.querySelector('.astryx-date-input');
+ expect(root).toHaveAttribute('data-disabled', 'disabled');
+ expect(root).toHaveClass('disabled');
+ });
+
+ it('omits data-disabled when enabled, like status does', () => {
+ const {container} = render(<DateInput label="Date" onChange={() => {}} />);
+ const root = container.querySelector('.astryx-date-input');
+ expect(root).not.toHaveAttribute('data-disabled');
+ });
+});
diff --git a/packages/core/src/DateInput/DateInput.tsx b/packages/core/src/DateInput/DateInput.tsx
index c652c9aafc..240eb5cc02 100644
--- a/packages/core/src/DateInput/DateInput.tsx
+++ b/packages/core/src/DateInput/DateInput.tsx
@@ -650,7 +650,11 @@ export function DateInput({
}}
{...rest}
{...mergeProps(
- themeProps('date-input', {size, status: status?.type ?? null}),
+ themeProps('date-input', {
+ size,
+ status: status?.type ?? null,
+ disabled: isDisabled ? 'disabled' : null,
+ }),
stylex.props(
inputWrapperStyles.base,
sizeStyles[size],
diff --git a/packages/core/src/DateRangeInput/DateRangeInput.doc.mjs b/packages/core/src/DateRangeInput/DateRangeInput.doc.mjs
index 396fbc3857..d86ea35644 100644
--- a/packages/core/src/DateRangeInput/DateRangeInput.doc.mjs
+++ b/packages/core/src/DateRangeInput/DateRangeInput.doc.mjs
@@ -166,7 +166,7 @@ export const docs = {
],
theming: {
targets: [
- {className: 'astryx-date-range-input', visualProps: ['size', 'status']},
+ {className: 'astryx-date-range-input', visualProps: ['size', 'status'], states: ['disabled']},
{className: 'astryx-date-range-input-toggle-icon', states: ['state']},
{className: 'astryx-date-range-input-clear-icon'},
],
diff --git a/packages/core/src/DateRangeInput/DateRangeInput.test.tsx b/packages/core/src/DateRangeInput/DateRangeInput.test.tsx
index 21c6a34562..71dc54f4d6 100644
--- a/packages/core/src/DateRangeInput/DateRangeInput.test.tsx
+++ b/packages/core/src/DateRangeInput/DateRangeInput.test.tsx
@@ -682,3 +682,27 @@ describe('DateRangeInput icon theme targets', () => {
expect(css).toContain('14px');
});
});
+
+describe('DateRangeInput disabled theme state', () => {
+ it('reflects disabled on the root target so themes can gate paint on it', () => {
+ const {container} = render(
+ <DateRangeInput
+ label="Range"
+ value={null}
+ onChange={() => {}}
+ isDisabled
+ />,
+ );
+ const root = container.querySelector('.astryx-date-range-input');
+ expect(root).toHaveAttribute('data-disabled', 'disabled');
+ expect(root).toHaveClass('disabled');
+ });
+
+ it('omits data-disabled when enabled, like status does', () => {
+ const {container} = render(
+ <DateRangeInput label="Range" value={null} onChange={() => {}} />,
+ );
+ const root = container.querySelector('.astryx-date-range-input');
+ expect(root).not.toHaveAttribute('data-disabled');
+ });
+});
diff --git a/packages/core/src/DateRangeInput/DateRangeInput.tsx b/packages/core/src/DateRangeInput/DateRangeInput.tsx
index bddb89fa4a..660163b35a 100644
--- a/packages/core/src/DateRangeInput/DateRangeInput.tsx
+++ b/packages/core/src/DateRangeInput/DateRangeInput.tsx
@@ -563,6 +563,7 @@ export function DateRangeInput({
themeProps('date-range-input', {
size,
status: status?.type ?? null,
+ disabled: isDisabled ? 'disabled' : null,
}),
stylex.props(
inputWrapperStyles.base,
diff --git a/packages/core/src/DateTimeInput/DateTimeInput.doc.mjs b/packages/core/src/DateTimeInput/DateTimeInput.doc.mjs
index 252861cbcb..ef0003e637 100644
--- a/packages/core/src/DateTimeInput/DateTimeInput.doc.mjs
+++ b/packages/core/src/DateTimeInput/DateTimeInput.doc.mjs
@@ -195,7 +195,7 @@ export const docs = {
],
theming: {
targets: [
- {className: 'astryx-date-time-input', visualProps: ['size', 'status']},
+ {className: 'astryx-date-time-input', visualProps: ['size', 'status'], states: ['disabled']},
{
className: 'astryx-date-time-input-date-segment',
visualProps: ['size', 'status'],
@@ -499,7 +499,7 @@ export const docsZh = {
],
theming: {
targets: [
- {className: 'astryx-date-time-input', visualProps: ['size', 'status']},
+ {className: 'astryx-date-time-input', visualProps: ['size', 'status'], states: ['disabled']},
{
className: 'astryx-date-time-input-date-segment',
visualProps: ['size', 'status'],
diff --git a/packages/core/src/DateTimeInput/DateTimeInput.test.tsx b/packages/core/src/DateTimeInput/DateTimeInput.test.tsx
index 9157c910be..13ef45ba73 100644
--- a/packages/core/src/DateTimeInput/DateTimeInput.test.tsx
+++ b/packages/core/src/DateTimeInput/DateTimeInput.test.tsx
@@ -987,3 +987,22 @@ describe('DateTimeInput', () => {
});
});
});
+
+describe('DateTimeInput disabled theme state', () => {
+ it('reflects disabled on the root target so themes can gate paint on it', () => {
+ const {container} = render(
+ <DateTimeInput label="Meeting" onChange={() => {}} isDisabled />,
+ );
+ const root = container.querySelector('.astryx-date-time-input');
+ expect(root).toHaveAttribute('data-disabled', 'disabled');
+ expect(root).toHaveClass('disabled');
+ });
+
+ it('omits data-disabled when enabled, like status does', () => {
+ const {container} = render(
+ <DateTimeInput label="Meeting" onChange={() => {}} />,
+ );
+ const root = container.querySelector('.astryx-date-time-input');
+ expect(root).not.toHaveAttribute('data-disabled');
+ });
+});
diff --git a/packages/core/src/DateTimeInput/DateTimeInput.tsx b/packages/core/src/DateTimeInput/DateTimeInput.tsx
index d82018677b..d7968dfa27 100644
--- a/packages/core/src/DateTimeInput/DateTimeInput.tsx
+++ b/packages/core/src/DateTimeInput/DateTimeInput.tsx
@@ -892,6 +892,7 @@ export function DateTimeInput({
themeProps('date-time-input', {
size,
status: status?.type ?? null,
+ disabled: isDisabled ? 'disabled' : null,
}),
stylex.props(styles.row, xstyle),
className,
diff --git a/packages/core/src/NumberInput/NumberInput.doc.mjs b/packages/core/src/NumberInput/NumberInput.doc.mjs
index 42b141edc1..f6bf4e1d94 100644
--- a/packages/core/src/NumberInput/NumberInput.doc.mjs
+++ b/packages/core/src/NumberInput/NumberInput.doc.mjs
@@ -174,7 +174,7 @@ export const docs = {
],
theming: {
targets: [
- {className: 'astryx-number-input', visualProps: ['size', 'status']},
+ {className: 'astryx-number-input', visualProps: ['size', 'status'], states: ['disabled']},
],
},
usage: {
@@ -360,7 +360,7 @@ export const docsZh = {
],
theming: {
targets: [
- {className: 'astryx-number-input', visualProps: ['size', 'status']},
+ {className: 'astryx-number-input', visualProps: ['size', 'status'], states: ['disabled']},
],
},
usage: {
diff --git a/packages/core/src/NumberInput/NumberInput.test.tsx b/packages/core/src/NumberInput/NumberInput.test.tsx
index 68e65106da..af80473df6 100644
--- a/packages/core/src/NumberInput/NumberInput.test.tsx
+++ b/packages/core/src/NumberInput/NumberInput.test.tsx
@@ -1022,3 +1022,27 @@ describe('NumberInput statusVariant forwarding', () => {
expect(onScrollableWheel).toHaveBeenCalledTimes(1);
});
});
+
+describe('NumberInput disabled theme state', () => {
+ it('reflects disabled on the root target so themes can gate paint on it', () => {
+ const {container} = render(
+ <NumberInput
+ label="Quantity"
+ value={null}
+ onChange={() => {}}
+ isDisabled
+ />,
+ );
+ const root = container.querySelector('.astryx-number-input');
+ expect(root).toHaveAttribute('data-disabled', 'disabled');
+ expect(root).toHaveClass('disabled');
+ });
+
+ it('omits data-disabled when enabled, like status does', () => {
+ const {container} = render(
+ <NumberInput label="Quantity" value={null} onChange={() => {}} />,
+ );
+ const root = container.querySelector('.astryx-number-input');
+ expect(root).not.toHaveAttribute('data-disabled');
+ });
+});
diff --git a/packages/core/src/NumberInput/NumberInput.tsx b/packages/core/src/NumberInput/NumberInput.tsx
index 14956b789b..0a53eb0511 100644
--- a/packages/core/src/NumberInput/NumberInput.tsx
+++ b/packages/core/src/NumberInput/NumberInput.tsx
@@ -630,7 +630,11 @@ export function NumberInput({
onClick={handleWrapperClick}
onMouseUp={handleWrapperMouseUp}
{...mergeProps(
- themeProps('number-input', {size, status: status?.type ?? null}),
+ themeProps('number-input', {
+ size,
+ status: status?.type ?? null,
+ disabled: isDisabled ? 'disabled' : null,
+ }),
stylex.props(
inputWrapperStyles.base,
styles.wrapper,
diff --git a/packages/core/src/TextArea/TextArea.doc.mjs b/packages/core/src/TextArea/TextArea.doc.mjs
index 0ae7cbd568..fe8a609669 100644
--- a/packages/core/src/TextArea/TextArea.doc.mjs
+++ b/packages/core/src/TextArea/TextArea.doc.mjs
@@ -179,7 +179,7 @@ export const docs = {
],
theming: {
targets: [
- {className: 'astryx-textarea', visualProps: ['size', 'status']},
+ {className: 'astryx-textarea', visualProps: ['size', 'status'], states: ['disabled']},
],
},
usage: {
@@ -355,7 +355,7 @@ export const docsZh = {
],
theming: {
targets: [
- {className: 'astryx-textarea', visualProps: ['size', 'status']},
+ {className: 'astryx-textarea', visualProps: ['size', 'status'], states: ['disabled']},
],
},
usage: {
diff --git a/packages/core/src/TextArea/TextArea.test.tsx b/packages/core/src/TextArea/TextArea.test.tsx
index e018a65bb6..e65e3f7d44 100644
--- a/packages/core/src/TextArea/TextArea.test.tsx
+++ b/packages/core/src/TextArea/TextArea.test.tsx
@@ -864,3 +864,22 @@ describe('TextArea statusVariant forwarding', () => {
);
});
});
+
+describe('TextArea disabled theme state', () => {
+ it('reflects disabled on the root target so themes can gate paint on it', () => {
+ const {container} = render(
+ <TextArea label="Description" value="" onChange={() => {}} isDisabled />,
+ );
+ const root = container.querySelector('.astryx-textarea');
+ expect(root).toHaveAttribute('data-disabled', 'disabled');
+ expect(root).toHaveClass('disabled');
+ });
+
+ it('omits data-disabled when enabled, like status does', () => {
+ const {container} = render(
+ <TextArea label="Description" value="" onChange={() => {}} />,
+ );
+ const root = container.querySelector('.astryx-textarea');
+ expect(root).not.toHaveAttribute('data-disabled');
+ });
+});
diff --git a/packages/core/src/TextArea/TextArea.tsx b/packages/core/src/TextArea/TextArea.tsx
index 2519cb68ef..51fe4d25ca 100644
--- a/packages/core/src/TextArea/TextArea.tsx
+++ b/packages/core/src/TextArea/TextArea.tsx
@@ -518,7 +518,11 @@ export function TextArea({
onClick={handleWrapperClick}
onMouseUp={handleWrapperMouseUp}
{...mergeProps(
- themeProps('textarea', {size, status: status?.type ?? null}),
+ themeProps('textarea', {
+ size,
+ status: status?.type ?? null,
+ disabled: isDisabled ? 'disabled' : null,
+ }),
stylex.props(
inputWrapperStyles.base,
styles.wrapper,
diff --git a/packages/core/src/TextInput/TextInput.doc.mjs b/packages/core/src/TextInput/TextInput.doc.mjs
index 9e768e66f2..9e8168182d 100644
--- a/packages/core/src/TextInput/TextInput.doc.mjs
+++ b/packages/core/src/TextInput/TextInput.doc.mjs
@@ -149,7 +149,7 @@ export const docs = {
],
theming: {
targets: [
- {className: 'astryx-text-input', visualProps: ['size', 'status']},
+ {className: 'astryx-text-input', visualProps: ['size', 'status'], states: ['disabled']},
],
},
usage: {
@@ -315,7 +315,7 @@ export const docsZh = {
],
theming: {
targets: [
- {className: 'astryx-text-input', visualProps: ['size', 'status']},
+ {className: 'astryx-text-input', visualProps: ['size', 'status'], states: ['disabled']},
],
},
usage: {
diff --git a/packages/core/src/TextInput/TextInput.test.tsx b/packages/core/src/TextInput/TextInput.test.tsx
index 74c060db1a..e6f014ba60 100644
--- a/packages/core/src/TextInput/TextInput.test.tsx
+++ b/packages/core/src/TextInput/TextInput.test.tsx
@@ -809,3 +809,25 @@ describe('TextInput statusVariant forwarding', () => {
expect(statusButton.getAttribute('aria-describedby')).toContain(tooltip.id);
});
});
+
+describe('TextInput disabled theme state', () => {
+ // Reflecting isDisabled on the root theming target lets a theme gate its own
+ // hover/border treatment on disabled (data-disabled + a .disabled variant),
+ // mirroring how status is reflected — without structural :has() CSS.
+ it('reflects disabled on the root target so themes can gate paint on it', () => {
+ const {container} = render(
+ <TextInput label="Name" value="" onChange={() => {}} isDisabled />,
+ );
+ const root = container.querySelector('.astryx-text-input');
+ expect(root).toHaveAttribute('data-disabled', 'disabled');
+ expect(root).toHaveClass('disabled');
+ });
+
+ it('omits data-disabled when enabled, like status does', () => {
+ const {container} = render(
+ <TextInput label="Name" value="" onChange={() => {}} />,
+ );
+ const root = container.querySelector('.astryx-text-input');
+ expect(root).not.toHaveAttribute('data-disabled');
+ });
+});
diff --git a/packages/core/src/TextInput/TextInput.tsx b/packages/core/src/TextInput/TextInput.tsx
index 851691f9af..e9df6a5dd7 100644
--- a/packages/core/src/TextInput/TextInput.tsx
+++ b/packages/core/src/TextInput/TextInput.tsx
@@ -404,7 +404,11 @@ export function TextInput({
onClick={handleWrapperClick}
onMouseUp={handleWrapperMouseUp}
{...mergeProps(
- themeProps('text-input', {size, status: status?.type ?? null}),
+ themeProps('text-input', {
+ size,
+ status: status?.type ?? null,
+ disabled: isDisabled ? 'disabled' : null,
+ }),
stylex.props(
inputWrapperStyles.base,
sizeStyles[size],
diff --git a/packages/core/src/TimeInput/TimeInput.doc.mjs b/packages/core/src/TimeInput/TimeInput.doc.mjs
index a9f2e115e8..cf953683c1 100644
--- a/packages/core/src/TimeInput/TimeInput.doc.mjs
+++ b/packages/core/src/TimeInput/TimeInput.doc.mjs
@@ -257,7 +257,7 @@ export const docs = {
],
theming: {
targets: [
- {className: 'astryx-time-input', visualProps: ['size', 'status']},
+ {className: 'astryx-time-input', visualProps: ['size', 'status'], states: ['disabled']},
],
},
};
@@ -406,7 +406,7 @@ export const docsZh = {
],
theming: {
targets: [
- {className: 'astryx-time-input', visualProps: ['size', 'status']},
+ {className: 'astryx-time-input', visualProps: ['size', 'status'], states: ['disabled']},
],
},
usage: {
diff --git a/packages/core/src/TimeInput/TimeInput.test.tsx b/packages/core/src/TimeInput/TimeInput.test.tsx
index f909c4cb49..d89c03ef00 100644
--- a/packages/core/src/TimeInput/TimeInput.test.tsx
+++ b/packages/core/src/TimeInput/TimeInput.test.tsx
@@ -572,11 +572,15 @@ describe('TimeInput', () => {
});
});
-
describe('TimeInput statusVariant forwarding', () => {
it('defaults to attached (status renders with data-variant="attached")', () => {
const {container} = render(
- <TimeInput label="Start" value={undefined} onChange={() => {}} status={{type: 'error', message: 'Required'}} />,
+ <TimeInput
+ label="Start"
+ value={undefined}
+ onChange={() => {}}
+ status={{type: 'error', message: 'Required'}}
+ />,
);
expect(container.querySelector('.astryx-field-status')).toHaveAttribute(
'data-variant',
@@ -586,7 +590,13 @@ describe('TimeInput statusVariant forwarding', () => {
it('forwards statusVariant="detached" to the underlying Field status', () => {
const {container} = render(
- <TimeInput label="Start" value={undefined} onChange={() => {}} status={{type: 'error', message: 'Required'}} statusVariant="detached" />,
+ <TimeInput
+ label="Start"
+ value={undefined}
+ onChange={() => {}}
+ status={{type: 'error', message: 'Required'}}
+ statusVariant="detached"
+ />,
);
expect(container.querySelector('.astryx-field-status')).toHaveAttribute(
'data-variant',
@@ -594,3 +604,20 @@ describe('TimeInput statusVariant forwarding', () => {
);
});
});
+
+describe('TimeInput disabled theme state', () => {
+ it('reflects disabled on the root target so themes can gate paint on it', () => {
+ const {container} = render(
+ <TimeInput label="Time" onChange={() => {}} isDisabled />,
+ );
+ const root = container.querySelector('.astryx-time-input');
+ expect(root).toHaveAttribute('data-disabled', 'disabled');
+ expect(root).toHaveClass('disabled');
+ });
+
+ it('omits data-disabled when enabled, like status does', () => {
+ const {container} = render(<TimeInput label="Time" onChange={() => {}} />);
+ const root = container.querySelector('.astryx-time-input');
+ expect(root).not.toHaveAttribute('data-disabled');
+ });
+});
diff --git a/packages/core/src/TimeInput/TimeInput.tsx b/packages/core/src/TimeInput/TimeInput.tsx
index 3b0851e9ee..88edc40dd4 100644
--- a/packages/core/src/TimeInput/TimeInput.tsx
+++ b/packages/core/src/TimeInput/TimeInput.tsx
@@ -608,7 +608,11 @@ export function TimeInput({
onClick={handleWrapperClick}
onMouseUp={handleWrapperMouseUp}
{...mergeProps(
- themeProps('time-input', {size, status: status?.type ?? null}),
+ themeProps('time-input', {
+ size,
+ status: status?.type ?? null,
+ disabled: isDisabled ? 'disabled' : null,
+ }),
stylex.props(
inputWrapperStyles.base,
sizeStyles[size],
diff --git a/packages/core/src/Tokenizer/Tokenizer.doc.mjs b/packages/core/src/Tokenizer/Tokenizer.doc.mjs
index e057082ff2..f9779566b8 100644
--- a/packages/core/src/Tokenizer/Tokenizer.doc.mjs
+++ b/packages/core/src/Tokenizer/Tokenizer.doc.mjs
@@ -210,7 +210,7 @@ export const docs = {
],
theming: {
targets: [
- {className: 'astryx-tokenizer', visualProps: ['size', 'status']},
+ {className: 'astryx-tokenizer', visualProps: ['size', 'status'], states: ['disabled']},
],
},
usage: {
@@ -424,7 +424,7 @@ export const docsZh = {
],
theming: {
targets: [
- {className: 'astryx-tokenizer', visualProps: ['size', 'status']},
+ {className: 'astryx-tokenizer', visualProps: ['size', 'status'], states: ['disabled']},
],
},
usage: {
diff --git a/packages/core/src/Tokenizer/Tokenizer.test.tsx b/packages/core/src/Tokenizer/Tokenizer.test.tsx
index 82b7e857bd..af82af4f9f 100644
--- a/packages/core/src/Tokenizer/Tokenizer.test.tsx
+++ b/packages/core/src/Tokenizer/Tokenizer.test.tsx
@@ -1137,11 +1137,16 @@ describe('Tokenizer', () => {
});
});
-
describe('Tokenizer statusVariant forwarding', () => {
it('defaults to attached (status renders with data-variant="attached")', () => {
const {container} = render(
- <Tokenizer label="Members" searchSource={userSource} value={[]} onChange={() => {}} status={{type: 'error', message: 'Required'}} />,
+ <Tokenizer
+ label="Members"
+ searchSource={userSource}
+ value={[]}
+ onChange={() => {}}
+ status={{type: 'error', message: 'Required'}}
+ />,
);
expect(container.querySelector('.astryx-field-status')).toHaveAttribute(
'data-variant',
@@ -1151,7 +1156,14 @@ describe('Tokenizer statusVariant forwarding', () => {
it('forwards statusVariant="detached" to the underlying Field status', () => {
const {container} = render(
- <Tokenizer label="Members" searchSource={userSource} value={[]} onChange={() => {}} status={{type: 'error', message: 'Required'}} statusVariant="detached" />,
+ <Tokenizer
+ label="Members"
+ searchSource={userSource}
+ value={[]}
+ onChange={() => {}}
+ status={{type: 'error', message: 'Required'}}
+ statusVariant="detached"
+ />,
);
expect(container.querySelector('.astryx-field-status')).toHaveAttribute(
'data-variant',
@@ -1159,3 +1171,33 @@ describe('Tokenizer statusVariant forwarding', () => {
);
});
});
+
+describe('Tokenizer disabled theme state', () => {
+ it('reflects disabled on the root target so themes can gate paint on it', () => {
+ const {container} = render(
+ <Tokenizer
+ label="Members"
+ searchSource={userSource}
+ value={[]}
+ onChange={() => {}}
+ isDisabled
+ />,
+ );
+ const root = container.querySelector('.astryx-tokenizer');
+ expect(root).toHaveAttribute('data-disabled', 'disabled');
+ expect(root).toHaveClass('disabled');
+ });
+
+ it('omits data-disabled when enabled, like status does', () => {
+ const {container} = render(
+ <Tokenizer
+ label="Members"
+ searchSource={userSource}
+ value={[]}
+ onChange={() => {}}
+ />,
+ );
+ const root = container.querySelector('.astryx-tokenizer');
+ expect(root).not.toHaveAttribute('data-disabled');
+ });
+});
diff --git a/packages/core/src/Tokenizer/Tokenizer.tsx b/packages/core/src/Tokenizer/Tokenizer.tsx
index c81db9639d..b33ef271ca 100644
--- a/packages/core/src/Tokenizer/Tokenizer.tsx
+++ b/packages/core/src/Tokenizer/Tokenizer.tsx
@@ -730,7 +730,11 @@ export function Tokenizer<T extends SearchableItem>({
onBlurCapture={handleBlurCapture}
data-testid={testId}
{...mergeProps(
- themeProps('tokenizer', {size, status: status?.type}),
+ themeProps('tokenizer', {
+ size,
+ status: status?.type,
+ disabled: isDisabled ? 'disabled' : null,
+ }),
stylex.props(
inputWrapperStyles.base,
styles.wrapper,
@@ -828,7 +832,11 @@ export function Tokenizer<T extends SearchableItem>({
ref={placeholderRef}
onClick={handleWrapperClick}
{...mergeProps(
- themeProps('tokenizer', {size, status: status?.type}),
+ themeProps('tokenizer', {
+ size,
+ status: status?.type,
+ disabled: isDisabled ? 'disabled' : null,
+ }),
stylex.props(
inputWrapperStyles.base,
styles.wrapper,