An open source design system that's fully customizable and agent ready
TypeScript
feat(Slider): expose the interactive control target (#6225)
freddymetaf48d468e751e
diff --git a/.changeset/expose-the-slider-interactive-control-as-a-theme-mez1.md b/.changeset/expose-the-slider-interactive-control-as-a-theme-mez1.mdnew file mode 100644index 0000000000..409f51edb9--- /dev/null+++ b/.changeset/expose-the-slider-interactive-control-as-a-theme-mez1.md@@ -0,0 +1,6 @@+---+'@astryxdesign/core': patch+---++[feat] Expose the Slider interactive control as a theme target+@freddymetadiff --git a/apps/storybook/stories/Slider.stories.tsx b/apps/storybook/stories/Slider.stories.tsxindex ef78d34916..bd68607387 100644--- a/apps/storybook/stories/Slider.stories.tsx+++ b/apps/storybook/stories/Slider.stories.tsx@@ -145,6 +145,17 @@ export const Disabled: Story = {},};+export const DisabledWithTextValue: Story = {+ tags: ['visual-theme-matrix'],+ render: args => <Slider {...(args as any)} />,+ args: {+ label: 'Volume',+ value: 50,+ valueDisplay: 'text',+ isDisabled: true,+ },+};+export const VerticalOrientation: Story = {render: args => {const [value, setValue] = useState(50);diff --git a/packages/core/src/Slider/Slider.doc.mjs b/packages/core/src/Slider/Slider.doc.mjsindex 49349e2c5d..8d2f4a4ca4 100644--- a/packages/core/src/Slider/Slider.doc.mjs+++ b/packages/core/src/Slider/Slider.doc.mjs@@ -19,6 +19,12 @@ const anatomy = [description:'Control row containing the track, thumb or thumbs, and optional text value.',},+ {+ name: 'Interactive control',+ required: true,+ description:+ 'Pointer and keyboard interaction surface containing the rail, fill, marks, and thumbs.',+ },{name: 'Track',required: true,@@ -235,6 +241,11 @@ export const docs = {visualProps: ['orientation'],states: ['disabled'],},+ {+ className: 'astryx-slider-control',+ visualProps: ['orientation'],+ states: ['disabled'],+ },{className: 'astryx-slider-track', visualProps: ['orientation']},{className: 'astryx-slider-thumb',@@ -416,6 +427,11 @@ export const docsZh = {visualProps: ['orientation'],states: ['disabled'],},+ {+ className: 'astryx-slider-control',+ visualProps: ['orientation'],+ states: ['disabled'],+ },{className: 'astryx-slider-track', visualProps: ['orientation']},{className: 'astryx-slider-thumb',diff --git a/packages/core/src/Slider/Slider.spec.md b/packages/core/src/Slider/Slider.spec.mdindex 01b7b4400d..92dee4bc09 100644--- a/packages/core/src/Slider/Slider.spec.md+++ b/packages/core/src/Slider/Slider.spec.md@@ -1,13 +1,13 @@---schema_version: 3-template_version: 3+template_version: 4kind: componentid: component:Slider-authority: draft+authority: currentarchive_reason: nullsuperseded_by: null-approved_by: null-approved_at: null+approved_by: cixzhang+approved_at: 2026-09-14owners: [cixzhang]review_triggers: [theming]verified_by:@@ -29,14 +29,14 @@ system_specs: []## IntentSlider presents a labeled control for selecting one numeric value or a bounded-range. This draft records its current consumer anatomy and theming ownership-without changing runtime behavior, styling, targets, or public API.+range. This contract records its consumer anatomy and theming ownership, including+an additive target for the interactive control surface.## Compatibility and migration- Released default preserved: `yes`-- Compatibility class: additive documentation only; runtime, DOM, styling,- targets, and public API remain unchanged+- Compatibility class: additive target and state reflection only; runtime,+ default styling, DOM semantics, and public props remain unchanged- Controlled/uncontrolled behavior: unchanged; Slider remains controlled- Migration decision: none@@ -48,7 +48,8 @@ Consumer migration instructions belong in consumer docs and release notes.- The current slider row, background track, filled range, tick marks and labels,thumbs, and adjacent text value presentation.-- The existing `slider`, `slider-track`, and `slider-thumb` public targets.+- The `slider`, `slider-control`, `slider-track`, and `slider-thumb` public+ targets.**Does not own / non-goals**@@ -61,24 +62,26 @@ Consumer migration instructions belong in consumer docs and release notes.## Public concepts-No new public concept is introduced. Consumer props, modes, states, and usage-remain documented in `Slider.doc.mjs`.+This adds one public theming target without adding or changing a component prop,+value domain, or behavior. Consumer props, modes, states, and usage remain+documented in `Slider.doc.mjs`.## Behavioral and layout contract-| ID | Candidate invariant | Basis | Draft review state |-| --- | ----------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- | -------------------------------------------------- |-| FR1 | The current render places a filled range, one or two thumbs, and optional tick marks over the background track. | Current source, docs, and focused tests | Verified current behavior; no new behavior decided |-| FR2 | `Slider`, `Track`, and `Thumb` carry the existing `slider`, `slider-track`, and `slider-thumb` targets respectively. | Current source and public docs | Verified current behavior; no target change |-| FR3 | Filled range, tick marks, mark labels, and adjacent text value display are stable rendered parts without their own current Slider target. | Current source and public docs | Verified current asymmetry; not ratified as policy |-| FR4 | Label and status presentation continue to use Field and FieldStatus; value tooltips continue to use Tooltip. | Current source and focused tests | Verified composition boundary |+| ID | Candidate invariant | Basis | Review state |+| --- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- | -------------------------------------------------- |+| FR1 | The current render places a filled range, one or two thumbs, and optional tick marks over the background track. | Current source, docs, and focused tests | Verified current behavior; no new behavior decided |+| FR2 | `Slider`, `Interactive control`, `Track`, and `Thumb` carry the `slider`, `slider-control`, `slider-track`, and `slider-thumb` targets respectively. | Current source, public docs, and #6224 | Approved additive target contract |+| FR3 | Filled range, tick marks, mark labels, and adjacent text value display are stable rendered parts without their own current Slider target. | Current source and public docs | Verified current asymmetry; not ratified as policy |+| FR4 | Label and status presentation continue to use Field and FieldStatus; value tooltips continue to use Tooltip. | Current source and focused tests | Verified composition boundary |### Observed current target asymmetryProgressBar currently exposes targets for its fill and marks, while Slider-exposes targets for its root row, background track, and thumbs but not its-filled range, tick marks, mark labels, or adjacent text value display. This is-implementation evidence for a joint audit, not approval of either target shape.+exposes targets for its root row, interactive control, background track, and+thumbs but not its filled range, tick marks, mark labels, or adjacent text value+display. This is implementation evidence for a joint audit, not approval of+either component's remaining target shape.### Allowed variation@@ -108,20 +111,21 @@ implementation evidence for a joint audit, not approval of either target shape.## Accessibility contract-This draft does not change or extend Slider's existing accessible name, value,+This contract does not change or extend Slider's existing accessible name, value,range-thumb naming, description/status association, keyboard behavior, disabledbehavior, or value-tooltip behavior.## Design relationships-| Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract |-| ----------------------- | ------------------------------------------------------------- | ------------------------------- | -------------- | ------------------ |-| Label and description | Identify and explain the numeric setting. | Current shared-component source | Supporting | FR4 |-| Slider and track | Arrange the current interactive range control and rail. | Current source and public docs | Prominent | FR1, FR2 |-| Filled range and thumbs | Show the selected value or interval over the available range. | Current source and public docs | Prominent | FR1, FR2, FR3 |-| Tick marks and labels | Show optional supplied positions and their text. | Current source and public docs | Supporting | FR1, FR3 |-| Value presentation | Shows the formatted value as text or a shared Tooltip. | Current source and public docs | Supporting | FR3, FR4 |-| Status message | Presents shared validation feedback below the slider. | Current shared-component source | Supporting | FR4 |+| Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract |+| ------------------------------ | ---------------------------------------------------------------------------------------------- | ------------------------------- | -------------- | ------------------ |+| Label and description | Identify and explain the numeric setting. | Current shared-component source | Supporting | FR4 |+| Slider and interactive control | Separate the outer row from the pointer/keyboard surface and its composite disabled treatment. | Current source and public docs | Prominent | FR1, FR2 |+| Track | Shows the available range behind the fill. | Current source and public docs | Prominent | FR1, FR2 |+| Filled range and thumbs | Show the selected value or interval over the available range. | Current source and public docs | Prominent | FR1, FR2, FR3 |+| Tick marks and labels | Show optional supplied positions and their text. | Current source and public docs | Supporting | FR1, FR3 |+| Value presentation | Shows the formatted value as text or a shared Tooltip. | Current source and public docs | Supporting | FR3, FR4 |+| Status message | Presents shared validation feedback below the slider. | Current shared-component source | Supporting | FR4 |### Theming anatomy@@ -138,6 +142,7 @@ behavior, or value-tooltip behavior.}},"Slider": {"target": "slider"},+ "Interactive control": {"target": "slider-control"},"Track": {"target": "slider-track"},"Filled range": {"none": {@@ -172,10 +177,12 @@ behavior, or value-tooltip behavior.}```-`Filled range`, `Tick mark`, `Mark label`, and `Value display` remain stable-consumer anatomy, but no current Slider target reaches them. The map records-those gaps without making their absence intentional. `Value display` names the-adjacent text mode; the separately listed value tooltip retains Tooltip's target.+`Interactive control` names the pointer/keyboard hit surface and the composite+opacity boundary around the rail, fill, marks, and thumbs. `Filled range`, `Tick+mark`, `Mark label`, and `Value display` remain stable consumer anatomy, but no+current Slider target reaches them. The map records those gaps without making+their absence intentional. `Value display` names the adjacent text mode; the+separately listed value tooltip retains Tooltip's target.## Family and system relationships@@ -191,24 +198,31 @@ adjacent text mode; the separately listed value tooltip retains Tooltip's target## Verification map-| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |-| ------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | ---------------------- |-| FR1 | `Slider.test.tsx` structure, range, and marks suites | Single, range, horizontal, vertical, marks | Removing or misaligning stable parts breaks existing role, position, or mark assertions. | `audit:Slider/anatomy` |-| FR2 | `themingTargets.test.ts` | Root, track, and thumb target call sites | Source and public target metadata drift fails the target guard. | `audit:Slider/theming` |-| FR3 | Source and consumer-doc review | Filled range, marks, labels, adjacent text value | A missing target is inaccurately documented as present or intentionally permanent. | `audit:Slider/theming` |-| FR4 | Source inspection; focused tests cover label, status, and disabled-reason Tooltip only | Label, status, value tooltip, disabled reason | Shared composition or its accessible association disappears; value-tooltip composition still lacks focused coverage. | `audit:Slider/anatomy` |-| Theming anatomy map | `scripts/check-knowledge.mjs` | Canonical anatomy and three current local targets | Missing, extra, prefixed, stale, or unclaimed mappings fail repository validation. | `audit:Slider/theming` |+| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |+| ------------------- | -------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | ---------------------- |+| FR1 | `Slider.test.tsx` structure, range, and marks suites | Single, range, horizontal, vertical, marks | Removing or misaligning stable parts breaks existing role, position, or mark assertions. | `audit:Slider/anatomy` |+| FR2 | `Slider.test.tsx`, `themingTargets.test.ts`, generated probe theme, and Chromium | Root, horizontal/vertical control, disabled control, track, and thumb | A target class/state is missing, undocumented, or placed outside its owning anatomy. | `audit:Slider/theming` |+| FR3 | Source and consumer-doc review | Filled range, marks, labels, adjacent text value | A missing target is inaccurately documented as present or intentionally permanent. | `audit:Slider/theming` |+| FR4 | Source inspection; focused tests cover label, status, and disabled-reason Tooltip only | Label, status, value tooltip, disabled reason | Shared composition or its accessible association disappears; value-tooltip composition still lacks focused coverage. | `audit:Slider/anatomy` |+| Theming anatomy map | `scripts/check-knowledge.mjs` | Canonical anatomy and four current local targets | Missing, extra, prefixed, stale, or unclaimed mappings fail repository validation. | `audit:Slider/theming` |-The focused Slider suite does not separately assert the exact `slider`,-`slider-track`, or `slider-thumb` class placement. The source/metadata target-guard covers those declarations. It also covers only the disabled-reason-Tooltip path, not the `valueDisplay="tooltip"` composition; that anatomy is-source-inspected and remains missing focused test coverage.+The focused Slider suite asserts the `slider-control` target's orientation and+disabled state. Source/metadata guards cover all four target declarations. The+suite covers only the disabled-reason Tooltip path, not the+`valueDisplay="tooltip"` composition; that anatomy is source-inspected and+remains missing focused test coverage.## Decision log-None. This draft records current facts and introduces no component-local design,-family, theming, or API decision.+### DEC-1 — Interactive control is public Slider anatomy++**Reference:** `component:Slider/DEC-1`+**Decider:** cixzhang, 2026-09-14++The stable pointer/keyboard interaction and compositing surface is a+consumer-recognizable part, so it carries `slider-control`. `Thumb` remains+separate anatomy and continues to carry `slider-thumb`. This adds no default+behavior or styling change.## Open questionsdiff --git a/packages/core/src/Slider/Slider.test.tsx b/packages/core/src/Slider/Slider.test.tsxindex e458af68d4..4535627f7d 100644--- a/packages/core/src/Slider/Slider.test.tsx+++ b/packages/core/src/Slider/Slider.test.tsx@@ -137,6 +137,24 @@ describe('Slider', () => {},);+ it('reflects orientation and disabled state on the interactive control target', () => {+ render(+ <Slider+ label="Volume"+ value={50}+ orientation="vertical"+ valueDisplay="text"+ isDisabled+ />,+ );+ const control = screen.getByRole('slider').parentElement;+ expect(control).not.toBeNull();+ expect(control).toHaveClass('astryx-slider-control');+ expect(control).toHaveAttribute('data-orientation', 'vertical');+ expect(control).toHaveAttribute('data-disabled', 'disabled');+ expect(control).not.toContainElement(screen.getByText('50'));+ });+it('range mode sets correct aria values on both thumbs', () => {render(<Sliderdiff --git a/packages/core/src/Slider/Slider.tsx b/packages/core/src/Slider/Slider.tsxindex 24e869d5ce..fe57dea652 100644--- a/packages/core/src/Slider/Slider.tsx+++ b/packages/core/src/Slider/Slider.tsx@@ -1029,12 +1029,18 @@ export function Slider({ref, ...props}: SliderProps) {onPointerMove={handlePointerMove}onPointerUp={handlePointerUp}onPointerCancel={handlePointerUp}- {...stylex.props(- styles.trackContainer,- isHorizontal- ? styles.trackContainerHorizontal- : styles.trackContainerVertical,- isDisabled && styles.trackContainerDisabled,+ {...mergeProps(+ themeProps('slider-control', {+ orientation,+ disabled: isDisabled ? 'disabled' : null,+ }),+ stylex.props(+ styles.trackContainer,+ isHorizontal+ ? styles.trackContainerHorizontal+ : styles.trackContainerVertical,+ isDisabled && styles.trackContainerDisabled,+ ),)}>{/* Background track */}<divdiff --git a/packages/themes/probe/src/probeTheme.ts b/packages/themes/probe/src/probeTheme.tsindex 49fd142399..e67c09d5fa 100644--- a/packages/themes/probe/src/probeTheme.ts+++ b/packages/themes/probe/src/probeTheme.ts@@ -6,7 +6,7 @@// test fixture. Regenerate with: pnpm visual:probe-theme//// defineTheme takes six things and this covers all six:-// components 277 targets, 898 selectors (generated from the docs)+// components 278 targets, 906 selectors (generated from the docs)// tokens custom properties, read back off the themed element// icons every registry entry swapped for a marked glyph// indicators check / radio / checkbox swapped — the swap that reaches furthest@@ -2503,6 +2503,30 @@ export const probeTheme = defineTheme({borderColor: 'hsl(7.6 84% 25%)',outlineColor: 'hsl(104.9 82% 25%)',},+ 'weight:normal': {+ backgroundColor: 'hsl(152.0 86% 62%)',+ color: 'hsl(175.8 91% 12%)',+ borderColor: 'hsl(343.2 81% 25%)',+ outlineColor: 'hsl(43.4 72% 25%)',+ },+ 'weight:medium': {+ backgroundColor: 'hsl(79.7 86% 58%)',+ color: 'hsl(290.3 72% 12%)',+ borderColor: 'hsl(214.5 73% 25%)',+ outlineColor: 'hsl(358.0 74% 25%)',+ },+ 'weight:semibold': {+ backgroundColor: 'hsl(359.7 75% 51%)',+ color: 'hsl(105.3 74% 12%)',+ borderColor: 'hsl(60.8 74% 25%)',+ outlineColor: 'hsl(274.4 70% 25%)',+ },+ 'weight:bold': {+ backgroundColor: 'hsl(129.8 91% 64%)',+ color: 'hsl(277.1 87% 12%)',+ borderColor: 'hsl(266.7 92% 25%)',+ outlineColor: 'hsl(341.8 86% 25%)',+ },},'hover-card': {base: {@@ -4379,6 +4403,32 @@ export const probeTheme = defineTheme({outlineColor: 'hsl(151.6 92% 25%)',},},+ 'slider-control': {+ base: {+ backgroundColor: 'hsl(131.2 86% 51%)',+ color: 'hsl(136.5 77% 12%)',+ borderColor: 'hsl(91.2 84% 25%)',+ outlineColor: 'hsl(331.5 83% 25%)',+ },+ 'orientation:horizontal': {+ backgroundColor: 'hsl(274.4 77% 64%)',+ color: 'hsl(239.8 78% 12%)',+ borderColor: 'hsl(30.5 82% 25%)',+ outlineColor: 'hsl(251.4 72% 25%)',+ },+ 'orientation:vertical': {+ backgroundColor: 'hsl(114.7 85% 46%)',+ color: 'hsl(341.5 93% 12%)',+ borderColor: 'hsl(2.2 77% 25%)',+ outlineColor: 'hsl(266.1 87% 25%)',+ },+ disabled: {+ backgroundColor: 'hsl(214.9 85% 53%)',+ color: 'hsl(356.2 83% 12%)',+ borderColor: 'hsl(65.6 76% 25%)',+ outlineColor: 'hsl(234.4 93% 25%)',+ },+ },'slider-thumb': {base: {backgroundColor: 'hsl(331.6 76% 55%)',