@astryxdesign/core 0.6.1 → 0.6.2-canary.2b2113d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/dist/BottomSheet/BottomSheet.d.ts +1 -1
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +3 -1
- package/dist/BottomSheet/BottomSheetPanel.d.ts +7 -5
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +56 -19
- package/dist/DateRangeInput/DateRangeInput.d.ts +3 -0
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +16 -9
- package/dist/Dialog/DialogHeader.d.ts +1 -1
- package/dist/Dialog/DialogHeader.d.ts.map +1 -1
- package/dist/Dialog/DialogHeader.js +10 -7
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +9 -3
- package/dist/Markdown/Markdown.d.ts +10 -2
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +58 -14
- package/dist/Markdown/index.d.ts +1 -1
- package/dist/Markdown/index.d.ts.map +1 -1
- package/dist/Markdown/parser.d.ts +126 -12
- package/dist/Markdown/parser.d.ts.map +1 -1
- package/dist/Markdown/parser.js +369 -34
- package/dist/Markdown/utils.d.ts +1 -1
- package/dist/Markdown/utils.d.ts.map +1 -1
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +5 -2
- package/dist/Spinner/Spinner.d.ts +1 -1
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +23 -15
- package/dist/astryx.css +5 -2
- package/dist/hooks/scrollKeyboardDelegation.d.ts +3 -0
- package/dist/hooks/scrollKeyboardDelegation.d.ts.map +1 -0
- package/dist/hooks/scrollKeyboardDelegation.js +146 -0
- package/dist/hooks/useScrollableArea.d.ts +6 -2
- package/dist/hooks/useScrollableArea.d.ts.map +1 -1
- package/dist/hooks/useScrollableArea.js +17 -5
- package/locales/en.json +16 -0
- package/locales/pseudo.json +12 -0
- package/package.json +7 -5
- package/scripts/agent-doc-state.mjs +1 -1
- package/src/BottomSheet/BottomSheet.doc.mjs +8 -1
- package/src/BottomSheet/BottomSheet.spec.md +46 -20
- package/src/BottomSheet/BottomSheet.test.tsx +6 -3
- package/src/BottomSheet/BottomSheet.tsx +3 -1
- package/src/BottomSheet/BottomSheetKeyboard.test.tsx +195 -0
- package/src/BottomSheet/BottomSheetPanel.test.tsx +11 -1
- package/src/BottomSheet/BottomSheetPanel.tsx +49 -16
- package/src/BottomSheet/__tests__/BottomSheetKeyboard.a11y.browser.spec.ts +344 -0
- package/src/DateRangeInput/DateRangeInput.doc.mjs +35 -7
- package/src/DateRangeInput/DateRangeInput.spec.md +203 -0
- package/src/DateRangeInput/DateRangeInput.test.tsx +100 -4
- package/src/DateRangeInput/DateRangeInput.tsx +29 -20
- package/src/Dialog/Dialog.doc.mjs +3 -0
- package/src/Dialog/Dialog.spec.md +1 -1
- package/src/Dialog/DialogHeader.doc.mjs +38 -0
- package/src/Dialog/DialogHeader.test.tsx +49 -0
- package/src/Dialog/DialogHeader.tsx +23 -4
- package/src/Dialog/modules/DialogHeader.spec.md +152 -0
- package/src/FileInput/FileInput.doc.mjs +2 -0
- package/src/FileInput/FileInput.spec.md +199 -0
- package/src/FileInput/FileInput.test.tsx +14 -0
- package/src/FileInput/FileInput.tsx +13 -3
- package/src/Markdown/Markdown.doc.mjs +167 -42
- package/src/Markdown/Markdown.public.test.ts +157 -0
- package/src/Markdown/Markdown.spec.md +149 -70
- package/src/Markdown/Markdown.test.tsx +107 -3
- package/src/Markdown/Markdown.tsx +116 -35
- package/src/Markdown/incremental.test.ts +175 -7
- package/src/Markdown/index.ts +6 -0
- package/src/Markdown/parser.perf.test.ts +3 -1
- package/src/Markdown/parser.test.ts +122 -0
- package/src/Markdown/parser.ts +609 -81
- package/src/Markdown/utils.ts +6 -0
- package/src/ScrollableArea/modules/useScrollableArea.spec.md +50 -22
- package/src/Slider/Slider.doc.mjs +16 -0
- package/src/Slider/Slider.spec.md +61 -47
- package/src/Slider/Slider.test.tsx +18 -0
- package/src/Slider/Slider.tsx +12 -6
- package/src/Spinner/Spinner.doc.mjs +6 -3
- package/src/Spinner/Spinner.test.tsx +37 -0
- package/src/Spinner/Spinner.tsx +31 -14
- package/src/hooks/scrollKeyboardDelegation.test.ts +155 -0
- package/src/hooks/scrollKeyboardDelegation.ts +233 -0
- package/src/hooks/useScrollableArea.doc.mjs +15 -3
- package/src/hooks/useScrollableArea.test.tsx +59 -1
- package/src/hooks/useScrollableArea.ts +34 -10
- package/src/theme/derivedVarRegistry.test.ts +6 -4
package/src/Markdown/utils.ts
CHANGED
|
@@ -16,9 +16,15 @@ export {
|
|
|
16
16
|
|
|
17
17
|
export type {
|
|
18
18
|
InlineNode,
|
|
19
|
+
InlineNodeWithMath,
|
|
20
|
+
MathInlineNode,
|
|
19
21
|
BlockNode,
|
|
22
|
+
BlockNodeWithMath,
|
|
23
|
+
MathBlockNode,
|
|
20
24
|
ListItemNode,
|
|
21
25
|
TableCellNode,
|
|
22
26
|
TableAlignment,
|
|
27
|
+
ParseOptions,
|
|
28
|
+
MathParseOptions,
|
|
23
29
|
IncrementalState,
|
|
24
30
|
} from './parser';
|
|
@@ -10,7 +10,12 @@ approved_by: cixzhang
|
|
|
10
10
|
approved_at: 2026-09-11
|
|
11
11
|
owners: [cixzhang]
|
|
12
12
|
review_triggers: [public-api, behavior, accessibility]
|
|
13
|
-
verified_by:
|
|
13
|
+
verified_by:
|
|
14
|
+
[
|
|
15
|
+
packages/core/src/hooks/useScrollableArea.test.tsx,
|
|
16
|
+
packages/core/src/hooks/scrollKeyboardDelegation.test.ts,
|
|
17
|
+
packages/core/src/BottomSheet/__tests__/BottomSheetKeyboard.a11y.browser.spec.ts,
|
|
18
|
+
]
|
|
14
19
|
parent_component: component:ScrollableArea
|
|
15
20
|
references: [architecture:public-component-api, spec:AST-025/DEC-1]
|
|
16
21
|
---
|
|
@@ -47,24 +52,25 @@ and scroll chaining without inserting structure.
|
|
|
47
52
|
|
|
48
53
|
## Public API and concepts
|
|
49
54
|
|
|
50
|
-
| Concept | Closed values or states
|
|
51
|
-
| -------------- |
|
|
52
|
-
| axis | `inline`, `block`, `both`
|
|
53
|
-
| keyboard owner | `content`, named `viewport`
|
|
54
|
-
| overscroll | `allow`, `contain`
|
|
55
|
-
| axis state | `isScrollable`, `atStart`, `atEnd`
|
|
55
|
+
| Concept | Closed values or states | Meaning | Default | Owner | Stability |
|
|
56
|
+
| -------------- | ------------------------------------------------------ | --------------------------------------- | ------------------------- | ----------------------------------------- | --------- |
|
|
57
|
+
| axis | `inline`, `block`, `both` | requested logical scroll intent | required | `spec:AST-025` | stable |
|
|
58
|
+
| keyboard owner | `content`, named `viewport`, named `contentOrViewport` | fixed or automatic keyboard scroll path | required | `spec:AST-025` | stable |
|
|
59
|
+
| overscroll | `allow`, `contain` | edge propagation on effective axes | `allow` | `spec:AST-025` | stable |
|
|
60
|
+
| axis state | `isScrollable`, `atStart`, `atEnd` | effective ownership and logical edges | inactive, both edges true | `module:ScrollableArea/useScrollableArea` | stable |
|
|
56
61
|
|
|
57
62
|
## Behavioral contract
|
|
58
63
|
|
|
59
|
-
| ID | Invariant
|
|
60
|
-
| --- |
|
|
61
|
-
| FR1 | An axis MUST be effective only when requested, computed overflow is scroll-capable, and geometry exceeds 1px.
|
|
62
|
-
| FR2 | Viewport and content geometry MUST be observed; invalidations MUST coalesce and preserve the last valid state while unmeasurable.
|
|
63
|
-
| FR3 | Logical edges and behavior-owned physical overflow MUST map through direction and horizontal, vertical, or sideways writing modes without requiring adopters to recreate the mapping.
|
|
64
|
-
| FR4 | The nearest registered effective owner MUST win independently by axis.
|
|
65
|
-
| FR5 | Viewport keyboard props and overscroll containment MUST appear only while applicable requested axes are effective.
|
|
66
|
-
| FR6 | Prop getters MUST compose refs and preserve caller handlers/classes/styles/ARIA while behavior-owned accessibility and non-cancellable behavior win conflicts.
|
|
67
|
-
| FR7 | The viewport prop getter MUST consume caller `xstyle` and internally compose geometry-driven `clip`/`auto`/`hidden` overflow plus explicit fitting Sticky containment.
|
|
64
|
+
| ID | Invariant | Basis | Acceptance and implementation state |
|
|
65
|
+
| --- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- | --------------------------------------- |
|
|
66
|
+
| FR1 | An axis MUST be effective only when requested, computed overflow is scroll-capable, and geometry exceeds 1px. | `spec:AST-025` FR1–FR4 | implemented |
|
|
67
|
+
| FR2 | Viewport and content geometry MUST be observed; invalidations MUST coalesce and preserve the last valid state while unmeasurable. | `spec:AST-025` FR5–FR9 | implemented |
|
|
68
|
+
| FR3 | Logical edges and behavior-owned physical overflow MUST map through direction and horizontal, vertical, or sideways writing modes without requiring adopters to recreate the mapping. | `spec:AST-025` FR1, FR3–FR4 | implemented |
|
|
69
|
+
| FR4 | The nearest registered effective owner MUST win independently by axis. | `spec:AST-025` FR10, FR18 | implemented privately for future Sticky |
|
|
70
|
+
| FR5 | Viewport keyboard props and overscroll containment MUST appear only while applicable requested axes are effective. | `spec:AST-025` FR12–FR14 | implemented |
|
|
71
|
+
| FR6 | Prop getters MUST compose refs and preserve caller handlers/classes/styles/ARIA while behavior-owned accessibility and non-cancellable behavior win conflicts. | `spec:AST-025` IR4 | implemented |
|
|
72
|
+
| FR7 | The viewport prop getter MUST consume caller `xstyle` and internally compose geometry-driven `clip`/`auto`/`hidden` overflow plus explicit fitting Sticky containment. | `spec:AST-025` FR21 | implemented |
|
|
73
|
+
| FR8 | `contentOrViewport` MUST retain the named overflowing viewport, inspect the first sequential descendant on forward Tab entry, and delegate only to a native link/button outside navigation-key-owning surfaces. Reverse traversal from the delegated first child skips the viewport. Pointer/programmatic focus never delegates; eligibility is checked again on the next entry. | `spec:AST-025` FR12–FR13 | implemented |
|
|
68
74
|
|
|
69
75
|
### Transformation and precedence order
|
|
70
76
|
|
|
@@ -82,9 +88,20 @@ and scroll chaining without inserting structure.
|
|
|
82
88
|
|
|
83
89
|
## Accessibility contract
|
|
84
90
|
|
|
85
|
-
- **AR1 — Named viewport owner.**
|
|
86
|
-
|
|
87
|
-
|
|
91
|
+
- **AR1 — Named viewport owner.** Fixed viewport and automatic access require a
|
|
92
|
+
label and retain `tabIndex=0` while effectively scrollable. Automatic access
|
|
93
|
+
delegates only on forward keyboard entry; the descendant retains its own name
|
|
94
|
+
inside the named viewport group/region.
|
|
95
|
+
- **AR2 — Focus continuity.** Content, eligibility, and geometry changes never
|
|
96
|
+
move or blur focus. A viewport losing overflow while focused remains
|
|
97
|
+
programmatically focusable. Reverse traversal from the delegated first child
|
|
98
|
+
skips the viewport, including after visiting later descendants.
|
|
99
|
+
- **AR3 — Conservative eligibility.** Inspect the first sequential target; do not
|
|
100
|
+
search past an excluded one for a link/button. Composite roles, editable
|
|
101
|
+
surfaces, native or registered nested scroll owners, positive tab ordering,
|
|
102
|
+
popup triggers, and unproven interactive roles retain the viewport path.
|
|
103
|
+
- **AR4 — Native scrolling.** Delegation MUST preserve Arrow/Page access to both
|
|
104
|
+
scroll edges without implementing JavaScript scrolling.
|
|
88
105
|
|
|
89
106
|
## Design relationships
|
|
90
107
|
|
|
@@ -97,9 +114,9 @@ No visual representation is owned by this hook.
|
|
|
97
114
|
|
|
98
115
|
## Verification map
|
|
99
116
|
|
|
100
|
-
| Contract | Verification
|
|
101
|
-
| ---------------- |
|
|
102
|
-
| FR1–
|
|
117
|
+
| Contract | Verification | Representative states | Mutation or failure expectation |
|
|
118
|
+
| ---------------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
119
|
+
| FR1–FR8, AR1–AR4 | `useScrollableArea.test.tsx`, `scrollKeyboardDelegation.test.ts`, and `BottomSheetKeyboard.a11y.browser.spec.ts` | horizontal/vertical/sideways, LTR/RTL, fit/overflow/edge, fixed/automatic keyboard owners, dynamic descendant eligibility, nested owners, focused loss | style-only or geometry-only ownership, physical-edge leakage, duplicate/missing keyboard path, stale state, ref loss, or dead containment fails |
|
|
103
120
|
|
|
104
121
|
## Decision log
|
|
105
122
|
|
|
@@ -111,6 +128,17 @@ No visual representation is owned by this hook.
|
|
|
111
128
|
One returned prop object per owned element keeps refs, accessibility, handlers,
|
|
112
129
|
and behavior together without making consumer spread order part of correctness.
|
|
113
130
|
|
|
131
|
+
### DEC-2 — Automatic ownership is shared behavior
|
|
132
|
+
|
|
133
|
+
**Reference:** `module:ScrollableArea/useScrollableArea/DEC-2`
|
|
134
|
+
**Decider:** cixzhang, 2026-09-13
|
|
135
|
+
|
|
136
|
+
`contentOrViewport` retains the named overflowing viewport and delegates only on
|
|
137
|
+
forward Tab entry to a safe first sequential native link/button. This replaces
|
|
138
|
+
continuous keyboard-eligibility observation. Geometry observation is unchanged;
|
|
139
|
+
keyboard eligibility adds no subtree or ancestor observers and is inspected anew
|
|
140
|
+
at each entry. BottomSheet is a proving composition of this shared behavior.
|
|
141
|
+
|
|
114
142
|
## Open questions
|
|
115
143
|
|
|
116
144
|
None.
|
|
@@ -19,6 +19,12 @@ const anatomy = [
|
|
|
19
19
|
description:
|
|
20
20
|
'Control row containing the track, thumb or thumbs, and optional text value.',
|
|
21
21
|
},
|
|
22
|
+
{
|
|
23
|
+
name: 'Interactive control',
|
|
24
|
+
required: true,
|
|
25
|
+
description:
|
|
26
|
+
'Pointer and keyboard interaction surface containing the rail, fill, marks, and thumbs.',
|
|
27
|
+
},
|
|
22
28
|
{
|
|
23
29
|
name: 'Track',
|
|
24
30
|
required: true,
|
|
@@ -235,6 +241,11 @@ export const docs = {
|
|
|
235
241
|
visualProps: ['orientation'],
|
|
236
242
|
states: ['disabled'],
|
|
237
243
|
},
|
|
244
|
+
{
|
|
245
|
+
className: 'astryx-slider-control',
|
|
246
|
+
visualProps: ['orientation'],
|
|
247
|
+
states: ['disabled'],
|
|
248
|
+
},
|
|
238
249
|
{className: 'astryx-slider-track', visualProps: ['orientation']},
|
|
239
250
|
{
|
|
240
251
|
className: 'astryx-slider-thumb',
|
|
@@ -416,6 +427,11 @@ export const docsZh = {
|
|
|
416
427
|
visualProps: ['orientation'],
|
|
417
428
|
states: ['disabled'],
|
|
418
429
|
},
|
|
430
|
+
{
|
|
431
|
+
className: 'astryx-slider-control',
|
|
432
|
+
visualProps: ['orientation'],
|
|
433
|
+
states: ['disabled'],
|
|
434
|
+
},
|
|
419
435
|
{className: 'astryx-slider-track', visualProps: ['orientation']},
|
|
420
436
|
{
|
|
421
437
|
className: 'astryx-slider-thumb',
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
schema_version: 3
|
|
3
|
-
template_version:
|
|
3
|
+
template_version: 4
|
|
4
4
|
kind: component
|
|
5
5
|
id: component:Slider
|
|
6
|
-
authority:
|
|
6
|
+
authority: current
|
|
7
7
|
archive_reason: null
|
|
8
8
|
superseded_by: null
|
|
9
|
-
approved_by:
|
|
10
|
-
approved_at:
|
|
9
|
+
approved_by: cixzhang
|
|
10
|
+
approved_at: 2026-09-14
|
|
11
11
|
owners: [cixzhang]
|
|
12
12
|
review_triggers: [theming]
|
|
13
13
|
verified_by:
|
|
@@ -29,14 +29,14 @@ system_specs: []
|
|
|
29
29
|
## Intent
|
|
30
30
|
|
|
31
31
|
Slider presents a labeled control for selecting one numeric value or a bounded
|
|
32
|
-
range. This
|
|
33
|
-
|
|
32
|
+
range. This contract records its consumer anatomy and theming ownership, including
|
|
33
|
+
an additive target for the interactive control surface.
|
|
34
34
|
|
|
35
35
|
## Compatibility and migration
|
|
36
36
|
|
|
37
37
|
- Released default preserved: `yes`
|
|
38
|
-
- Compatibility class: additive
|
|
39
|
-
|
|
38
|
+
- Compatibility class: additive target and state reflection only; runtime,
|
|
39
|
+
default styling, DOM semantics, and public props remain unchanged
|
|
40
40
|
- Controlled/uncontrolled behavior: unchanged; Slider remains controlled
|
|
41
41
|
- Migration decision: none
|
|
42
42
|
|
|
@@ -48,7 +48,8 @@ Consumer migration instructions belong in consumer docs and release notes.
|
|
|
48
48
|
|
|
49
49
|
- The current slider row, background track, filled range, tick marks and labels,
|
|
50
50
|
thumbs, and adjacent text value presentation.
|
|
51
|
-
- The
|
|
51
|
+
- The `slider`, `slider-control`, `slider-track`, and `slider-thumb` public
|
|
52
|
+
targets.
|
|
52
53
|
|
|
53
54
|
**Does not own / non-goals**
|
|
54
55
|
|
|
@@ -61,24 +62,26 @@ Consumer migration instructions belong in consumer docs and release notes.
|
|
|
61
62
|
|
|
62
63
|
## Public concepts
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
This adds one public theming target without adding or changing a component prop,
|
|
66
|
+
value domain, or behavior. Consumer props, modes, states, and usage remain
|
|
67
|
+
documented in `Slider.doc.mjs`.
|
|
66
68
|
|
|
67
69
|
## Behavioral and layout contract
|
|
68
70
|
|
|
69
|
-
| ID | Candidate invariant
|
|
70
|
-
| --- |
|
|
71
|
-
| FR1 | The current render places a filled range, one or two thumbs, and optional tick marks over the background track.
|
|
72
|
-
| FR2 | `Slider`, `Track`, and `Thumb` carry the
|
|
73
|
-
| FR3 | Filled range, tick marks, mark labels, and adjacent text value display are stable rendered parts without their own current Slider target.
|
|
74
|
-
| FR4 | Label and status presentation continue to use Field and FieldStatus; value tooltips continue to use Tooltip.
|
|
71
|
+
| ID | Candidate invariant | Basis | Review state |
|
|
72
|
+
| --- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- | -------------------------------------------------- |
|
|
73
|
+
| 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 |
|
|
74
|
+
| 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 |
|
|
75
|
+
| 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 |
|
|
76
|
+
| 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 |
|
|
75
77
|
|
|
76
78
|
### Observed current target asymmetry
|
|
77
79
|
|
|
78
80
|
ProgressBar currently exposes targets for its fill and marks, while Slider
|
|
79
|
-
exposes targets for its root row, background track, and
|
|
80
|
-
filled range, tick marks, mark labels, or adjacent text value
|
|
81
|
-
implementation evidence for a joint audit, not approval of
|
|
81
|
+
exposes targets for its root row, interactive control, background track, and
|
|
82
|
+
thumbs but not its filled range, tick marks, mark labels, or adjacent text value
|
|
83
|
+
display. This is implementation evidence for a joint audit, not approval of
|
|
84
|
+
either component's remaining target shape.
|
|
82
85
|
|
|
83
86
|
### Allowed variation
|
|
84
87
|
|
|
@@ -108,20 +111,21 @@ implementation evidence for a joint audit, not approval of either target shape.
|
|
|
108
111
|
|
|
109
112
|
## Accessibility contract
|
|
110
113
|
|
|
111
|
-
This
|
|
114
|
+
This contract does not change or extend Slider's existing accessible name, value,
|
|
112
115
|
range-thumb naming, description/status association, keyboard behavior, disabled
|
|
113
116
|
behavior, or value-tooltip behavior.
|
|
114
117
|
|
|
115
118
|
## Design relationships
|
|
116
119
|
|
|
117
|
-
| Anatomy or state
|
|
118
|
-
|
|
|
119
|
-
| Label and description
|
|
120
|
-
| Slider and
|
|
121
|
-
|
|
|
122
|
-
|
|
|
123
|
-
|
|
|
124
|
-
|
|
|
120
|
+
| Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract |
|
|
121
|
+
| ------------------------------ | ---------------------------------------------------------------------------------------------- | ------------------------------- | -------------- | ------------------ |
|
|
122
|
+
| Label and description | Identify and explain the numeric setting. | Current shared-component source | Supporting | FR4 |
|
|
123
|
+
| 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 |
|
|
124
|
+
| Track | Shows the available range behind the fill. | Current source and public docs | Prominent | FR1, FR2 |
|
|
125
|
+
| Filled range and thumbs | Show the selected value or interval over the available range. | Current source and public docs | Prominent | FR1, FR2, FR3 |
|
|
126
|
+
| Tick marks and labels | Show optional supplied positions and their text. | Current source and public docs | Supporting | FR1, FR3 |
|
|
127
|
+
| Value presentation | Shows the formatted value as text or a shared Tooltip. | Current source and public docs | Supporting | FR3, FR4 |
|
|
128
|
+
| Status message | Presents shared validation feedback below the slider. | Current shared-component source | Supporting | FR4 |
|
|
125
129
|
|
|
126
130
|
### Theming anatomy
|
|
127
131
|
|
|
@@ -138,6 +142,7 @@ behavior, or value-tooltip behavior.
|
|
|
138
142
|
}
|
|
139
143
|
},
|
|
140
144
|
"Slider": {"target": "slider"},
|
|
145
|
+
"Interactive control": {"target": "slider-control"},
|
|
141
146
|
"Track": {"target": "slider-track"},
|
|
142
147
|
"Filled range": {
|
|
143
148
|
"none": {
|
|
@@ -172,10 +177,12 @@ behavior, or value-tooltip behavior.
|
|
|
172
177
|
}
|
|
173
178
|
```
|
|
174
179
|
|
|
175
|
-
`
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
180
|
+
`Interactive control` names the pointer/keyboard hit surface and the composite
|
|
181
|
+
opacity boundary around the rail, fill, marks, and thumbs. `Filled range`, `Tick
|
|
182
|
+
mark`, `Mark label`, and `Value display` remain stable consumer anatomy, but no
|
|
183
|
+
current Slider target reaches them. The map records those gaps without making
|
|
184
|
+
their absence intentional. `Value display` names the adjacent text mode; the
|
|
185
|
+
separately listed value tooltip retains Tooltip's target.
|
|
179
186
|
|
|
180
187
|
## Family and system relationships
|
|
181
188
|
|
|
@@ -191,24 +198,31 @@ adjacent text mode; the separately listed value tooltip retains Tooltip's target
|
|
|
191
198
|
|
|
192
199
|
## Verification map
|
|
193
200
|
|
|
194
|
-
| Contract | Verification | Representative states
|
|
195
|
-
| ------------------- | -------------------------------------------------------------------------------------- |
|
|
196
|
-
| FR1 | `Slider.test.tsx` structure, range, and marks suites | Single, range, horizontal, vertical, marks
|
|
197
|
-
| FR2 | `themingTargets.test.ts
|
|
198
|
-
| FR3 | Source and consumer-doc review | Filled range, marks, labels, adjacent text value
|
|
199
|
-
| FR4 | Source inspection; focused tests cover label, status, and disabled-reason Tooltip only | Label, status, value tooltip, disabled reason
|
|
200
|
-
| Theming anatomy map | `scripts/check-knowledge.mjs` | Canonical anatomy and
|
|
201
|
+
| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
|
|
202
|
+
| ------------------- | -------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | ---------------------- |
|
|
203
|
+
| 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` |
|
|
204
|
+
| 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` |
|
|
205
|
+
| 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` |
|
|
206
|
+
| 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` |
|
|
207
|
+
| 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` |
|
|
201
208
|
|
|
202
|
-
The focused Slider suite
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
209
|
+
The focused Slider suite asserts the `slider-control` target's orientation and
|
|
210
|
+
disabled state. Source/metadata guards cover all four target declarations. The
|
|
211
|
+
suite covers only the disabled-reason Tooltip path, not the
|
|
212
|
+
`valueDisplay="tooltip"` composition; that anatomy is source-inspected and
|
|
213
|
+
remains missing focused test coverage.
|
|
207
214
|
|
|
208
215
|
## Decision log
|
|
209
216
|
|
|
210
|
-
|
|
211
|
-
|
|
217
|
+
### DEC-1 — Interactive control is public Slider anatomy
|
|
218
|
+
|
|
219
|
+
**Reference:** `component:Slider/DEC-1`
|
|
220
|
+
**Decider:** cixzhang, 2026-09-14
|
|
221
|
+
|
|
222
|
+
The stable pointer/keyboard interaction and compositing surface is a
|
|
223
|
+
consumer-recognizable part, so it carries `slider-control`. `Thumb` remains
|
|
224
|
+
separate anatomy and continues to carry `slider-thumb`. This adds no default
|
|
225
|
+
behavior or styling change.
|
|
212
226
|
|
|
213
227
|
## Open questions
|
|
214
228
|
|
|
@@ -137,6 +137,24 @@ describe('Slider', () => {
|
|
|
137
137
|
},
|
|
138
138
|
);
|
|
139
139
|
|
|
140
|
+
it('reflects orientation and disabled state on the interactive control target', () => {
|
|
141
|
+
render(
|
|
142
|
+
<Slider
|
|
143
|
+
label="Volume"
|
|
144
|
+
value={50}
|
|
145
|
+
orientation="vertical"
|
|
146
|
+
valueDisplay="text"
|
|
147
|
+
isDisabled
|
|
148
|
+
/>,
|
|
149
|
+
);
|
|
150
|
+
const control = screen.getByRole('slider').parentElement;
|
|
151
|
+
expect(control).not.toBeNull();
|
|
152
|
+
expect(control).toHaveClass('astryx-slider-control');
|
|
153
|
+
expect(control).toHaveAttribute('data-orientation', 'vertical');
|
|
154
|
+
expect(control).toHaveAttribute('data-disabled', 'disabled');
|
|
155
|
+
expect(control).not.toContainElement(screen.getByText('50'));
|
|
156
|
+
});
|
|
157
|
+
|
|
140
158
|
it('range mode sets correct aria values on both thumbs', () => {
|
|
141
159
|
render(
|
|
142
160
|
<Slider
|
package/src/Slider/Slider.tsx
CHANGED
|
@@ -1029,12 +1029,18 @@ export function Slider({ref, ...props}: SliderProps) {
|
|
|
1029
1029
|
onPointerMove={handlePointerMove}
|
|
1030
1030
|
onPointerUp={handlePointerUp}
|
|
1031
1031
|
onPointerCancel={handlePointerUp}
|
|
1032
|
-
{...
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
?
|
|
1036
|
-
|
|
1037
|
-
|
|
1032
|
+
{...mergeProps(
|
|
1033
|
+
themeProps('slider-control', {
|
|
1034
|
+
orientation,
|
|
1035
|
+
disabled: isDisabled ? 'disabled' : null,
|
|
1036
|
+
}),
|
|
1037
|
+
stylex.props(
|
|
1038
|
+
styles.trackContainer,
|
|
1039
|
+
isHorizontal
|
|
1040
|
+
? styles.trackContainerHorizontal
|
|
1041
|
+
: styles.trackContainerVertical,
|
|
1042
|
+
isDisabled && styles.trackContainerDisabled,
|
|
1043
|
+
),
|
|
1038
1044
|
)}>
|
|
1039
1045
|
{/* Background track */}
|
|
1040
1046
|
<div
|
|
@@ -30,7 +30,7 @@ export const docs = {
|
|
|
30
30
|
name: 'aria-label',
|
|
31
31
|
type: 'string',
|
|
32
32
|
description:
|
|
33
|
-
'Accessible name for screen readers. Defaults to label (if string) or "Loading".',
|
|
33
|
+
'Accessible name for screen readers. Defaults to label (if string) or a translated "Loading" from the i18n catalog.',
|
|
34
34
|
default: "'Loading'",
|
|
35
35
|
},
|
|
36
36
|
{
|
|
@@ -48,6 +48,7 @@ export const docs = {
|
|
|
48
48
|
{name: '--spinner-stroke-width', description: 'Stroke width of both circles the ring is drawn from: the moving arc and the track behind it. Set it per size alongside the diameter. One stroke width drives both, so 0 is honoured as a zero-width stroke and paints nothing at all rather than falling back to the default; for an arc with no track behind it, set --spinner-track-color to transparent instead.', default: '2px (sm), 3px (md), 3px (lg), 4px (xl)'},
|
|
49
49
|
{name: '--spinner-color', description: "Color of the moving arc. Defaults to the shade's token, so set it on a shade-variant target to retheme one shade (spinner: { 'shade:subtle': { '--spinner-color': 'var(--color-text-tertiary)' } }), or on the base target to retheme all four. Accepts any color notation, including var(), color-mix() and currentColor.", default: 'var(--color-accent) (default), var(--color-text-secondary) (subtle), var(--color-on-dark) (onMedia), currentColor (inherit)'},
|
|
50
50
|
{name: '--spinner-track-color', description: 'Color of the track the arc travels on. Set it to `transparent` for an arc with no track. The onMedia and inherit shades draw the track at reduced alpha (30%) so it reads against an arbitrary backdrop; that fade applies to a themed color too.', default: 'var(--color-track) (default, subtle), var(--color-on-dark) (onMedia), currentColor (inherit)'},
|
|
51
|
+
{name: '--spinner-arc-fraction', description: "Fraction of the ring the moving arc covers, as a plain number (not a percentage or angle). Set it on a size-variant target the same way as --spinner-diameter, e.g. spinner: { 'size:xl': { '--spinner-arc-fraction': '0.75' } } for a 270deg sweep. Only takes effect once the stylesheet loads; a render with no CSS (SSR, no-JS) always draws the default 135deg arc.", default: '0.375 (135deg), same for every size'},
|
|
51
52
|
],
|
|
52
53
|
},
|
|
53
54
|
usage: {
|
|
@@ -87,7 +88,7 @@ export const docsZh = {
|
|
|
87
88
|
{
|
|
88
89
|
name: 'aria-label',
|
|
89
90
|
type: 'string',
|
|
90
|
-
description: '屏幕阅读器的无障碍名称。默认为 label
|
|
91
|
+
description: '屏幕阅读器的无障碍名称。默认为 label(如果是字符串)或来自 i18n 词条的已翻译 "Loading"。',
|
|
91
92
|
default: "'Loading'",
|
|
92
93
|
},
|
|
93
94
|
{
|
|
@@ -106,6 +107,7 @@ export const docsZh = {
|
|
|
106
107
|
{name: '--spinner-stroke-width', description: '绘制环的两个圆——移动圆弧与其后的轨道——的描边宽度。与直径一起按尺寸设置。同一个描边宽度同时驱动两者,因此 0 会被采纳为零宽描边——什么都不绘制,而不会回退到默认值;若想要没有轨道的圆弧,请改将 --spinner-track-color 设为 transparent。', default: '2px (sm), 3px (md), 3px (lg), 4px (xl)'},
|
|
107
108
|
{name: '--spinner-color', description: "运动圆弧的颜色。默认取所在 shade 的令牌,因此可在 shade 变体目标上设置以重新定义单个 shade——spinner: { 'shade:subtle': { '--spinner-color': 'var(--color-text-tertiary)' } }——或在 base 目标上设置以覆盖全部四种。接受任意颜色写法,包括 var()、color-mix() 与 currentColor。", default: 'var(--color-accent)(default)、var(--color-text-secondary)(subtle)、var(--color-on-dark)(onMedia)、currentColor(inherit)'},
|
|
108
109
|
{name: '--spinner-track-color', description: '圆弧所在轨道的颜色。设为 `transparent` 可得到无轨道的圆弧。onMedia 与 inherit 两种 shade 会以降低的透明度(30%)绘制轨道,以便在任意背景上可辨;该淡化同样作用于主题化的颜色。', default: 'var(--color-track)(default、subtle)、var(--color-on-dark)(onMedia)、currentColor(inherit)'},
|
|
110
|
+
{name: '--spinner-arc-fraction', description: "运动圆弧覆盖圆环的比例,为纯数字(非百分比或角度)。在尺寸变体目标上设置,方式与 --spinner-diameter 相同,例如 spinner: { 'size:xl': { '--spinner-arc-fraction': '0.75' } } 可得到 270 度的圆弧。仅在样式表加载后生效;无 CSS 的渲染(SSR、无 JS)始终绘制默认的 135 度圆弧。", default: '0.375(135 度),各尺寸相同'},
|
|
109
111
|
],
|
|
110
112
|
},
|
|
111
113
|
usage: {
|
|
@@ -136,7 +138,8 @@ export const docsDense = {
|
|
|
136
138
|
size: 'Spinner size: ring diameter (10px, 14px, 18px, 28px).',
|
|
137
139
|
shade: 'Color shade for light or dark backgrounds.',
|
|
138
140
|
label: 'Visible content below spinner. String auto-sets aria-label.',
|
|
139
|
-
'aria-label':
|
|
141
|
+
'aria-label':
|
|
142
|
+
'A11y name for screen readers. Defaults to label or a translated "Loading".',
|
|
140
143
|
xstyle: 'StyleX styles for layout customization. Must be stylex.create() value, not inline style.',
|
|
141
144
|
},
|
|
142
145
|
};
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import {describe, it, expect, vi, afterEach} from 'vitest';
|
|
13
13
|
import {render, screen} from '@testing-library/react';
|
|
14
14
|
import {Spinner} from './Spinner';
|
|
15
|
+
import {InternationalizationProvider} from '../i18n';
|
|
15
16
|
import {defineTheme} from '../theme/defineTheme';
|
|
16
17
|
import {generateThemeCSS} from '../theme/generateThemeRules';
|
|
17
18
|
|
|
@@ -72,6 +73,34 @@ describe('Spinner', () => {
|
|
|
72
73
|
expect(spinner).toHaveAttribute('data-shade', 'inherit');
|
|
73
74
|
});
|
|
74
75
|
|
|
76
|
+
it('localizes the default assistive label through the i18n catalog', () => {
|
|
77
|
+
render(
|
|
78
|
+
<InternationalizationProvider
|
|
79
|
+
locale="fr"
|
|
80
|
+
overrides={{fr: {'@astryx.spinner.loading': 'Chargement'}}}>
|
|
81
|
+
<Spinner data-testid="spinner" />
|
|
82
|
+
</InternationalizationProvider>,
|
|
83
|
+
);
|
|
84
|
+
expect(screen.getByTestId('spinner')).toHaveAttribute(
|
|
85
|
+
'aria-label',
|
|
86
|
+
'Chargement',
|
|
87
|
+
);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('keeps an explicit aria-label over the localized default', () => {
|
|
91
|
+
render(
|
|
92
|
+
<InternationalizationProvider
|
|
93
|
+
locale="fr"
|
|
94
|
+
overrides={{fr: {'@astryx.spinner.loading': 'Chargement'}}}>
|
|
95
|
+
<Spinner aria-label="Veuillez patienter" data-testid="spinner" />
|
|
96
|
+
</InternationalizationProvider>,
|
|
97
|
+
);
|
|
98
|
+
expect(screen.getByTestId('spinner')).toHaveAttribute(
|
|
99
|
+
'aria-label',
|
|
100
|
+
'Veuillez patienter',
|
|
101
|
+
);
|
|
102
|
+
});
|
|
103
|
+
|
|
75
104
|
it('does not duplicate a visible string label as aria-label', () => {
|
|
76
105
|
render(<Spinner label="Fetching data" data-testid="spinner" />);
|
|
77
106
|
const status = screen.getByRole('status');
|
|
@@ -204,6 +233,14 @@ describe('Spinner', () => {
|
|
|
204
233
|
'.astryx-spinner {\n --spinner-color: var(--color-brand);',
|
|
205
234
|
);
|
|
206
235
|
});
|
|
236
|
+
|
|
237
|
+
it('scopes a themed arc fraction to that size variant (#5819)', () => {
|
|
238
|
+
expect(
|
|
239
|
+
cssFor({spinner: {'size:xl': {'--spinner-arc-fraction': '0.75'}}}),
|
|
240
|
+
).toContain(
|
|
241
|
+
'.astryx-spinner[data-size="xl"] {\n --spinner-arc-fraction: 0.75;',
|
|
242
|
+
);
|
|
243
|
+
});
|
|
207
244
|
});
|
|
208
245
|
});
|
|
209
246
|
|