An open source design system that's fully customizable and agent ready
TypeScript
feat(TextArea): expose theme targets for the control, slots and counter (#5418)
freddymetacd7fb740bcdd
diff --git a/.changeset/date-input-native-picker-option.md b/.changeset/date-input-native-picker-option.mdindex d8e85cf071..4178179507 100644--- a/.changeset/date-input-native-picker-option.md+++ b/.changeset/date-input-native-picker-option.md@@ -19,7 +19,7 @@ express: `weekStartsOn`, `numberOfMonths`, or `dateConstraints`.`format` and `placeholder` still apply in native mode — DateInput paints theclosed field's text itself, over the control, so a date reads the same on aphone as on a desktop. `min` and `max` are forwarded, but a native picker may-not *show* them: on iOS they are constraint-validation flags rather than+not _show_ them: on iOS they are constraint-validation flags rather thanclamps, so an out-of-range date can be selected, and it is refused on commitand announced rather than greyed out in the picker. Mouse-driven devices areunaffected.diff --git a/.changeset/textarea-theme-targets.md b/.changeset/textarea-theme-targets.mdnew file mode 100644index 0000000000..bbef5a44fa--- /dev/null+++ b/.changeset/textarea-theme-targets.md@@ -0,0 +1,11 @@+---+'@astryxdesign/core': patch+---++[feat] TextArea: the two painted elements inside the wrapper now carry stable theme targets — `astryx-text-area-control` (the `<textarea>` itself) and `astryx-text-area-counter` (the character counter). Only the wrapper was themeable before, so a theme restyling the control's own typography, placeholder or resize affordance, or the counter's supporting text, had to reach in with structural selectors like `.astryx-text-area > textarea`. Purely additive: no existing class, data attribute, or style changes.++Neither carries a `size` axis. `size` moves only the control's block padding (`sm` and `md` are empty; `lg` sets `paddingBlock`), and that is the axis a `padding` translation for this component takes over — so an axis here would be a second way to say the same thing, and the one that stops being true once the translation lands.++The start-icon and end-slot overlays are deliberately not targets. They paint nothing — each is `position: absolute; pointer-events: none; display: flex` — and they are placed off the wrapper's `--_textarea-inline-padding`, so a theme that moves the control's inset needs them to move with it rather than to be re-placed one at a time. That inset belongs in a `padding` translation for the component, which is tracked separately.++@freddymetadiff --git a/packages/core/src/TextArea/TextArea.doc.mjs b/packages/core/src/TextArea/TextArea.doc.mjsindex f4b8c95330..06b86aecb9 100644--- a/packages/core/src/TextArea/TextArea.doc.mjs+++ b/packages/core/src/TextArea/TextArea.doc.mjs@@ -187,6 +187,8 @@ export const docs = {theming: {targets: [{className: 'astryx-text-area', visualProps: ['size', 'status'], states: ['disabled', 'readonly']},+ {className: 'astryx-text-area-control'},+ {className: 'astryx-text-area-counter'},// Still emitted beside the names above, so themes written against// them keep working. Drop in the next major.{className: 'astryx-textarea', visualProps: ['size', 'status'], states: ['disabled', 'readonly'], deprecatedFor: 'text-area'},@@ -385,6 +387,8 @@ export const docsZh = {theming: {targets: [{className: 'astryx-text-area', visualProps: ['size', 'status'], states: ['disabled', 'readonly']},+ {className: 'astryx-text-area-control'},+ {className: 'astryx-text-area-counter'},// Still emitted beside the names above, so themes written against// them keep working. Drop in the next major.{className: 'astryx-textarea', visualProps: ['size', 'status'], states: ['disabled', 'readonly'], deprecatedFor: 'text-area'},diff --git a/packages/core/src/TextArea/TextArea.tsx b/packages/core/src/TextArea/TextArea.tsxindex 263cb6370d..0d1336b49a 100644--- a/packages/core/src/TextArea/TextArea.tsx+++ b/packages/core/src/TextArea/TextArea.tsx@@ -615,19 +615,22 @@ export function TextArea({: undefined}aria-busy={isBusy || undefined}- {...stylex.props(- styles.textarea,- textareaSizeStyles[size],- isDisabled && styles.textareaDisabled,- Boolean(startIcon) && styles.textareaWithStartIcon,- // Reserve trailing space only when the end slot actually renders- // something (spinner or on-field status icon). The `detached`- // status variant suppresses the on-field icon — its glyph lives in- // the message box below — so reserving here would inset the text- // for an icon that never appears.- (isBusy || statusIcon != null) && styles.textareaWithStatus,- isBusy && statusIcon != null && styles.textareaWithBusyStatus,- maxLength != null && styles.textareaWithCounter,+ {...mergeProps(+ themeProps('text-area-control'),+ stylex.props(+ styles.textarea,+ textareaSizeStyles[size],+ isDisabled && styles.textareaDisabled,+ Boolean(startIcon) && styles.textareaWithStartIcon,+ // Reserve trailing space only when the end slot actually renders+ // something (spinner or on-field status icon). The `detached`+ // status variant suppresses the on-field icon — its glyph lives+ // in the message box below — so reserving here would inset the+ // text for an icon that never appears.+ (isBusy || statusIcon != null) && styles.textareaWithStatus,+ isBusy && statusIcon != null && styles.textareaWithBusyStatus,+ maxLength != null && styles.textareaWithCounter,+ ),)}/>{(isBusy || statusIcon) && (@@ -639,9 +642,12 @@ export function TextArea({{maxLength != null && (<divid={counterID}- {...stylex.props(- styles.counter,- valueLength > maxLength && styles.counterError,+ {...mergeProps(+ themeProps('text-area-counter'),+ stylex.props(+ styles.counter,+ valueLength > maxLength && styles.counterError,+ ),)}>{valueLength > maxLength && (// Non-color cue so the over-limit state isn't conveyed by the red