@astryxdesign/core 0.6.2-canary.bfee8a4 → 0.6.2-canary.c8d5849

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.
Files changed (261) hide show
  1. package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
  2. package/dist/Chat/ChatComposerInput.js +2 -2
  3. package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
  4. package/dist/CheckboxInput/CheckboxInput.js +12 -2
  5. package/dist/Collapsible/Collapsible.d.ts.map +1 -1
  6. package/dist/Collapsible/Collapsible.js +6 -1
  7. package/dist/CommandPalette/CommandPaletteInput.d.ts.map +1 -1
  8. package/dist/CommandPalette/CommandPaletteInput.js +1 -1
  9. package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
  10. package/dist/ComplexSelector/ComplexSelector.js +1 -1
  11. package/dist/DateInput/DateInput.d.ts.map +1 -1
  12. package/dist/DateInput/DateInput.js +4 -4
  13. package/dist/DateInput/NativeDateField.d.ts.map +1 -1
  14. package/dist/DateInput/NativeDateField.js +16 -16
  15. package/dist/DateInput/TouchDateField.d.ts.map +1 -1
  16. package/dist/DateInput/TouchDateField.js +2 -2
  17. package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
  18. package/dist/DateRangeInput/DateRangeInput.js +4 -4
  19. package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
  20. package/dist/DateTimeInput/DateTimeInput.js +8 -8
  21. package/dist/DateTimeInput/TouchDateTimeField.d.ts.map +1 -1
  22. package/dist/DateTimeInput/TouchDateTimeField.js +4 -4
  23. package/dist/DateTimeInput/nativePickerSegmentStyles.d.ts +9 -3
  24. package/dist/DateTimeInput/nativePickerSegmentStyles.d.ts.map +1 -1
  25. package/dist/DateTimeInput/nativePickerSegmentStyles.js +3 -3
  26. package/dist/Field/PanelSearchInput.d.ts.map +1 -1
  27. package/dist/Field/PanelSearchInput.js +1 -1
  28. package/dist/FileInput/FileInput.d.ts.map +1 -1
  29. package/dist/FileInput/FileInput.js +7 -7
  30. package/dist/Kbd/Kbd.d.ts +5 -3
  31. package/dist/Kbd/Kbd.d.ts.map +1 -1
  32. package/dist/Kbd/Kbd.js +36 -42
  33. package/dist/Link/Link.d.ts.map +1 -1
  34. package/dist/Link/Link.js +6 -2
  35. package/dist/Markdown/Markdown.d.ts +8 -2
  36. package/dist/Markdown/Markdown.d.ts.map +1 -1
  37. package/dist/Markdown/Markdown.fr23.bench.d.ts +2 -0
  38. package/dist/Markdown/Markdown.fr23.bench.d.ts.map +1 -0
  39. package/dist/Markdown/Markdown.fr23.bench.js +150 -0
  40. package/dist/Markdown/Markdown.fr23.sampling.d.ts +2 -0
  41. package/dist/Markdown/Markdown.fr23.sampling.d.ts.map +1 -0
  42. package/dist/Markdown/Markdown.fr23.sampling.js +43 -0
  43. package/dist/Markdown/Markdown.js +262 -109
  44. package/dist/Markdown/ast.d.ts +162 -0
  45. package/dist/Markdown/ast.d.ts.map +1 -0
  46. package/dist/Markdown/ast.js +74 -0
  47. package/dist/Markdown/index.d.ts +5 -3
  48. package/dist/Markdown/index.d.ts.map +1 -1
  49. package/dist/Markdown/index.js +3 -2
  50. package/dist/Markdown/parser/index.d.ts +10 -0
  51. package/dist/Markdown/parser/index.d.ts.map +1 -0
  52. package/dist/Markdown/parser/index.js +10 -0
  53. package/dist/Markdown/parser.d.ts +126 -58
  54. package/dist/Markdown/parser.d.ts.map +1 -1
  55. package/dist/Markdown/parser.js +716 -167
  56. package/dist/Markdown/plugins/frontmatter.d.ts +32 -0
  57. package/dist/Markdown/plugins/frontmatter.d.ts.map +1 -0
  58. package/dist/Markdown/plugins/frontmatter.js +132 -0
  59. package/dist/Markdown/plugins/index.d.ts +16 -0
  60. package/dist/Markdown/plugins/index.d.ts.map +1 -0
  61. package/dist/Markdown/plugins/index.js +13 -0
  62. package/dist/Markdown/plugins/protocol.d.ts +191 -0
  63. package/dist/Markdown/plugins/protocol.d.ts.map +1 -0
  64. package/dist/Markdown/plugins/protocol.js +957 -0
  65. package/dist/Markdown/plugins/semanticFence.d.ts +36 -0
  66. package/dist/Markdown/plugins/semanticFence.d.ts.map +1 -0
  67. package/dist/Markdown/plugins/semanticFence.js +213 -0
  68. package/dist/Markdown/plugins/sourceDecoration.d.ts +76 -0
  69. package/dist/Markdown/plugins/sourceDecoration.d.ts.map +1 -0
  70. package/dist/Markdown/plugins/sourceDecoration.js +393 -0
  71. package/dist/Markdown/plugins/textTransform.d.ts +30 -0
  72. package/dist/Markdown/plugins/textTransform.d.ts.map +1 -0
  73. package/dist/Markdown/plugins/textTransform.js +374 -0
  74. package/dist/Markdown/remark.d.ts +196 -0
  75. package/dist/Markdown/remark.d.ts.map +1 -0
  76. package/dist/Markdown/remark.js +1062 -0
  77. package/dist/Markdown/url.d.ts +4 -0
  78. package/dist/Markdown/url.d.ts.map +1 -0
  79. package/dist/Markdown/url.js +25 -0
  80. package/dist/Markdown/utils.d.ts +4 -2
  81. package/dist/Markdown/utils.d.ts.map +1 -1
  82. package/dist/Markdown/utils.js +2 -1
  83. package/dist/NumberInput/NumberInput.d.ts.map +1 -1
  84. package/dist/NumberInput/NumberInput.js +4 -4
  85. package/dist/Outline/index.d.ts +1 -0
  86. package/dist/Outline/index.d.ts.map +1 -1
  87. package/dist/Outline/parseOutlineFromMarkdown.d.ts +7 -1
  88. package/dist/Outline/parseOutlineFromMarkdown.d.ts.map +1 -1
  89. package/dist/Outline/parseOutlineFromMarkdown.js +14 -8
  90. package/dist/Outline/useOutlineFromMarkdown.d.ts +3 -1
  91. package/dist/Outline/useOutlineFromMarkdown.d.ts.map +1 -1
  92. package/dist/Outline/useOutlineFromMarkdown.js +8 -3
  93. package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
  94. package/dist/PowerSearch/PowerSearchEditPopover.js +46 -30
  95. package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
  96. package/dist/ProgressBar/ProgressBar.js +36 -31
  97. package/dist/RadioList/RadioListItem.d.ts.map +1 -1
  98. package/dist/RadioList/RadioListItem.js +13 -1
  99. package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
  100. package/dist/SegmentedControl/SegmentedControlItem.js +5 -5
  101. package/dist/Selector/Selector.d.ts.map +1 -1
  102. package/dist/Selector/Selector.js +1 -1
  103. package/dist/SideNav/SideNav.d.ts +2 -1
  104. package/dist/SideNav/SideNav.d.ts.map +1 -1
  105. package/dist/SideNav/SideNav.js +9 -3
  106. package/dist/Slider/Slider.d.ts.map +1 -1
  107. package/dist/Slider/Slider.js +14 -8
  108. package/dist/Spinner/Spinner.d.ts.map +1 -1
  109. package/dist/Spinner/Spinner.js +23 -7
  110. package/dist/Switch/Switch.d.ts.map +1 -1
  111. package/dist/Switch/Switch.js +11 -0
  112. package/dist/TabList/Tab.d.ts +1 -1
  113. package/dist/TabList/Tab.d.ts.map +1 -1
  114. package/dist/TabList/Tab.js +20 -7
  115. package/dist/Table/Table.d.ts +1 -0
  116. package/dist/Table/Table.d.ts.map +1 -1
  117. package/dist/Table/Table.js +29 -13
  118. package/dist/TextArea/TextArea.d.ts.map +1 -1
  119. package/dist/TextArea/TextArea.js +1 -1
  120. package/dist/TextInput/TextInput.d.ts.map +1 -1
  121. package/dist/TextInput/TextInput.js +2 -2
  122. package/dist/TimeInput/TimeInput.d.ts.map +1 -1
  123. package/dist/TimeInput/TimeInput.js +4 -4
  124. package/dist/ToggleButton/ToggleButton.d.ts +2 -1
  125. package/dist/ToggleButton/ToggleButton.d.ts.map +1 -1
  126. package/dist/ToggleButton/ToggleButton.js +7 -1
  127. package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
  128. package/dist/Typeahead/BaseTypeahead.js +16 -7
  129. package/dist/astryx.css +14 -6
  130. package/dist/utils/interactionOverlay.stylex.d.ts +8 -0
  131. package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
  132. package/dist/utils/interactionOverlay.stylex.js +9 -0
  133. package/package.json +18 -3
  134. package/src/Button/__tests__/Button.a11y.chromium.spec.ts +17 -1
  135. package/src/Button/__tests__/Button.a11y.known-failures.ts +0 -29
  136. package/src/Button/__tests__/Button.a11y.renders.tsx +9 -2
  137. package/src/Button/__tests__/Button.a11y.states.ts +9 -0
  138. package/src/Chat/ChatComposerInput.doc.mjs +3 -3
  139. package/src/Chat/ChatComposerInput.tsx +10 -2
  140. package/src/CheckboxInput/CheckboxInput.doc.mjs +11 -0
  141. package/src/CheckboxInput/CheckboxInput.test.tsx +34 -0
  142. package/src/CheckboxInput/CheckboxInput.tsx +21 -1
  143. package/src/ClickableCard/ClickableCard.test.tsx +102 -5
  144. package/src/Collapsible/Collapsible.doc.mjs +11 -0
  145. package/src/Collapsible/Collapsible.test.tsx +21 -0
  146. package/src/Collapsible/Collapsible.tsx +5 -0
  147. package/src/CommandPalette/CommandPaletteInput.tsx +6 -1
  148. package/src/ComplexSelector/ComplexSelector.tsx +6 -1
  149. package/src/DateInput/DateInput.tsx +6 -1
  150. package/src/DateInput/NativeDateField.tsx +24 -8
  151. package/src/DateInput/TouchDateField.tsx +6 -2
  152. package/src/DateRangeInput/DateRangeInput.tsx +6 -1
  153. package/src/DateTimeInput/DateTimeInput.tsx +6 -1
  154. package/src/DateTimeInput/TouchDateTimeField.tsx +6 -1
  155. package/src/DateTimeInput/nativePickerSegmentStyles.ts +24 -8
  156. package/src/Field/PanelSearchInput.tsx +5 -2
  157. package/src/FieldStatus/__tests__/StatusMessage.a11y.states.ts +1 -1
  158. package/src/FileInput/FileInput.tsx +11 -2
  159. package/src/Kbd/Kbd.doc.mjs +3 -3
  160. package/src/Kbd/Kbd.test.tsx +57 -1
  161. package/src/Kbd/Kbd.tsx +57 -37
  162. package/src/Layout/LayoutFooter.doc.mjs +17 -0
  163. package/src/Link/Link.doc.mjs +11 -0
  164. package/src/Link/Link.test.tsx +24 -0
  165. package/src/Link/Link.tsx +5 -0
  166. package/src/Markdown/Markdown.doc.mjs +272 -0
  167. package/src/Markdown/Markdown.fr23.bench.ts +174 -0
  168. package/src/Markdown/Markdown.fr23.perf.test.ts +249 -0
  169. package/src/Markdown/Markdown.fr23.sampling.ts +49 -0
  170. package/src/Markdown/Markdown.helpers.perf.test.ts +489 -0
  171. package/src/Markdown/Markdown.public.test.ts +126 -3
  172. package/src/Markdown/Markdown.spec.md +197 -44
  173. package/src/Markdown/Markdown.test.tsx +11 -0
  174. package/src/Markdown/Markdown.tsx +414 -135
  175. package/src/Markdown/ast.test.ts +307 -0
  176. package/src/Markdown/ast.ts +337 -0
  177. package/src/Markdown/incremental.test.ts +12 -0
  178. package/src/Markdown/index.ts +37 -1
  179. package/src/Markdown/modules/remark.spec.md +269 -0
  180. package/src/Markdown/parser/index.ts +64 -0
  181. package/src/Markdown/parser.public.test.ts +103 -0
  182. package/src/Markdown/parser.ts +1180 -235
  183. package/src/Markdown/plugins/frontmatter.test.tsx +125 -0
  184. package/src/Markdown/plugins/frontmatter.ts +198 -0
  185. package/src/Markdown/plugins/index.ts +53 -0
  186. package/src/Markdown/plugins/protocol.test.tsx +1022 -0
  187. package/src/Markdown/plugins/protocol.ts +1618 -0
  188. package/src/Markdown/plugins/semanticFence.test.tsx +546 -0
  189. package/src/Markdown/plugins/semanticFence.ts +424 -0
  190. package/src/Markdown/plugins/sourceDecoration.test.tsx +799 -0
  191. package/src/Markdown/plugins/sourceDecoration.ts +539 -0
  192. package/src/Markdown/plugins/textTransform.test.ts +467 -0
  193. package/src/Markdown/plugins/textTransform.ts +554 -0
  194. package/src/Markdown/remark.test.tsx +1877 -0
  195. package/src/Markdown/remark.ts +1574 -0
  196. package/src/Markdown/url.ts +30 -0
  197. package/src/Markdown/utils.ts +13 -1
  198. package/src/MultiSelector/MultiSelector.test.tsx +1 -35
  199. package/src/MultiSelector/__tests__/MultiSelector.listbox.a11y.test.tsx +128 -0
  200. package/src/NumberInput/NumberInput.tsx +6 -1
  201. package/src/Outline/Outline.doc.mjs +7 -5
  202. package/src/Outline/Outline.spec.md +1 -1
  203. package/src/Outline/index.ts +1 -0
  204. package/src/Outline/modules/parseOutlineFromMarkdown.spec.md +142 -0
  205. package/src/Outline/parseOutlineFromMarkdown.ts +40 -10
  206. package/src/Outline/useOutlineFromMarkdown.ts +15 -3
  207. package/src/PowerSearch/PowerSearch.doc.mjs +2 -2
  208. package/src/PowerSearch/PowerSearchEditPopover.test.tsx +150 -1
  209. package/src/PowerSearch/PowerSearchEditPopover.tsx +51 -28
  210. package/src/ProgressBar/ProgressBar.test.tsx +29 -11
  211. package/src/ProgressBar/ProgressBar.tsx +59 -72
  212. package/src/RadioList/RadioList.doc.mjs +11 -0
  213. package/src/RadioList/RadioList.test.tsx +32 -0
  214. package/src/RadioList/RadioListItem.tsx +25 -1
  215. package/src/SegmentedControl/SegmentedControl.doc.mjs +2 -2
  216. package/src/SegmentedControl/SegmentedControl.test.tsx +31 -0
  217. package/src/SegmentedControl/SegmentedControlItem.tsx +6 -9
  218. package/src/Selector/Selector.spec.md +12 -9
  219. package/src/Selector/Selector.tsx +6 -1
  220. package/src/Selector/__tests__/Listbox.a11y.chromium.spec.ts +130 -0
  221. package/src/Selector/__tests__/Listbox.a11y.dom.ts +38 -0
  222. package/src/Selector/__tests__/Listbox.a11y.inventory.test.ts +63 -0
  223. package/src/Selector/__tests__/Listbox.a11y.known-failures.ts +37 -0
  224. package/src/Selector/__tests__/Listbox.a11y.states.ts +232 -0
  225. package/src/Selector/__tests__/Selector.listbox.a11y.test.tsx +121 -0
  226. package/src/SideNav/SideNav.doc.mjs +1 -1
  227. package/src/SideNav/SideNav.test.tsx +10 -0
  228. package/src/SideNav/SideNav.tsx +14 -2
  229. package/src/Slider/Slider.doc.mjs +11 -0
  230. package/src/Slider/Slider.test.tsx +128 -0
  231. package/src/Slider/Slider.tsx +25 -7
  232. package/src/Spinner/Spinner.test.tsx +4 -0
  233. package/src/Spinner/Spinner.tsx +31 -18
  234. package/src/Switch/Switch.doc.mjs +11 -0
  235. package/src/Switch/Switch.test.tsx +16 -0
  236. package/src/Switch/Switch.tsx +28 -0
  237. package/src/TabList/Tab.tsx +35 -7
  238. package/src/TabList/TabList.doc.mjs +11 -0
  239. package/src/TabList/TabList.test.tsx +66 -0
  240. package/src/TabList/__tests__/Tabs.a11y.known-failures.ts +1 -34
  241. package/src/Table/Table.doc.mjs +1 -1
  242. package/src/Table/Table.spec.md +54 -40
  243. package/src/Table/Table.test.tsx +83 -10
  244. package/src/Table/Table.tsx +30 -22
  245. package/src/Table/__tests__/TableScroll.a11y.chromium.spec.ts +137 -0
  246. package/src/TextArea/TextArea.tsx +6 -1
  247. package/src/TextInput/TextInput.test.tsx +20 -1
  248. package/src/TextInput/TextInput.tsx +6 -1
  249. package/src/TimeInput/TimeInput.tsx +6 -1
  250. package/src/ToggleButton/ToggleButton.test.tsx +133 -0
  251. package/src/ToggleButton/ToggleButton.tsx +9 -2
  252. package/src/ToggleButton/__tests__/ToggleButton.a11y.chromium.spec.ts +209 -0
  253. package/src/Tokenizer/Tokenizer.spec.md +142 -75
  254. package/src/TreeList/TreeList.spec.md +123 -75
  255. package/src/Typeahead/BaseTypeahead.spec.md +4 -3
  256. package/src/Typeahead/BaseTypeahead.tsx +21 -7
  257. package/src/Typeahead/Typeahead.test.tsx +53 -0
  258. package/src/__tests__/PressedState.a11y.chromium.spec.ts +813 -0
  259. package/src/__tests__/pressState.ts +93 -0
  260. package/src/inputFontFloor.test.ts +106 -0
  261. package/src/utils/interactionOverlay.stylex.ts +20 -0
@@ -0,0 +1,121 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file Selector.listbox.a11y.test.tsx
5
+ * @input Uses Selector, its explicit part/state inventory, and the Listbox contract
6
+ * @output DOM evidence for real single-select listbox, group, and option parts
7
+ * @position Component-facing binding; keyboard, callbacks, forms, and styles stay local.
8
+ */
9
+
10
+ import {cleanup, render, screen, within} from '@testing-library/react';
11
+ import userEvent from '@testing-library/user-event';
12
+ import {describe, expect, it} from 'vitest';
13
+ import {
14
+ expectAccessibilitySpec,
15
+ LISTBOX_PATTERN,
16
+ } from '@astryxdesign/a11y-spec';
17
+ import {Selector} from '../Selector';
18
+ import {LISTBOX_SCENARIOS, listboxParts} from './Listbox.a11y.states';
19
+ import {installListboxDialogStubs} from './Listbox.a11y.dom';
20
+
21
+ installListboxDialogStubs();
22
+
23
+ const scenarios = LISTBOX_SCENARIOS.filter(
24
+ scenario => scenario.component === 'Selector',
25
+ );
26
+
27
+ describe('Selector Listbox semantic binding', () => {
28
+ it.each(scenarios)('$id', async scenario => {
29
+ for (const part of listboxParts(scenario)) {
30
+ await expectAccessibilitySpec({
31
+ spec: LISTBOX_PATTERN,
32
+ binding: `Selector.${part.role}`,
33
+ state: part.state,
34
+ facts: part.facts,
35
+ render: async () => {
36
+ render(
37
+ <div dir={scenario.direction ?? 'ltr'}>
38
+ <Selector
39
+ label="Fruit"
40
+ options={scenario.options}
41
+ value={scenario.values[0]}
42
+ onChange={() => {}}
43
+ hasSearch={scenario.hasSearch}
44
+ presentation={scenario.presentation}
45
+ isLoading={scenario.isLoading}
46
+ isLabelHidden={scenario.hiddenLabel}
47
+ renderOption={
48
+ scenario.customContent
49
+ ? option => <span>{option.label} details</span>
50
+ : undefined
51
+ }
52
+ isDefaultOpen
53
+ />
54
+ </div>,
55
+ );
56
+ await screen.findByRole('listbox', {hidden: true});
57
+ if (scenario.query != null) {
58
+ await userEvent
59
+ .setup()
60
+ .type(
61
+ screen.getByRole('combobox', {hidden: true}),
62
+ scenario.query,
63
+ );
64
+ }
65
+ },
66
+ subject: () =>
67
+ part.role === 'listbox'
68
+ ? screen.getByRole('listbox', {hidden: true})
69
+ : part.role === 'group'
70
+ ? within(
71
+ screen.getByRole('listbox', {hidden: true}),
72
+ ).getAllByRole('group', {hidden: true})[
73
+ scenario.groups.indexOf(part.name ?? '')
74
+ ]
75
+ : within(screen.getByRole('listbox', {hidden: true})).getByRole(
76
+ 'option',
77
+ {name: part.name, hidden: true},
78
+ ),
79
+ related: () => {
80
+ const listbox = screen.getByRole('listbox', {hidden: true});
81
+ expect(
82
+ within(listbox).getAllByRole('option', {hidden: true}),
83
+ ).toHaveLength(scenario.expectedOptions.length);
84
+ return {
85
+ listbox,
86
+ ...Object.fromEntries(
87
+ scenario.expectedOptions.map(option => [
88
+ `option:${option.value}`,
89
+ within(listbox).getByRole('option', {
90
+ name: option.name,
91
+ hidden: true,
92
+ }),
93
+ ]),
94
+ ),
95
+ ...Object.fromEntries(
96
+ scenario.groups.map((name, index) => [
97
+ `group:${name}`,
98
+ within(listbox).getAllByRole('group', {hidden: true})[index],
99
+ ]),
100
+ ),
101
+ };
102
+ },
103
+ cleanup,
104
+ });
105
+ }
106
+ });
107
+
108
+ it('keeps the bounded state matrix explicit', () => {
109
+ expect(scenarios.map(scenario => scenario.id)).toEqual([
110
+ 'single-unset',
111
+ 'single-selected',
112
+ 'single-disabled-selected',
113
+ 'single-grouped',
114
+ 'single-filtered',
115
+ 'single-custom-rtl',
116
+ 'single-sheet',
117
+ 'single-sheet-search',
118
+ 'single-loading',
119
+ ]);
120
+ });
121
+ });
@@ -25,7 +25,7 @@ export const docs = {
25
25
  {className: 'astryx-side-nav-section'},
26
26
  ],
27
27
  },
28
- description: 'Container with five zones: header, topContent, children (scrollable), footer, and footerIcons. Supports collapsible mode.',
28
+ description: 'Container with five zones: header, topContent, children (scrollable), footer, and footerIcons. Supports collapsible and resizable modes.',
29
29
  props: [
30
30
  {
31
31
  name: 'header',
@@ -989,6 +989,16 @@ describe('SideNav resizable', () => {
989
989
  ).toBeInTheDocument();
990
990
  });
991
991
 
992
+ it('clips the overlay drag handle within the resizable nav bounds', () => {
993
+ render(<SideNav resizable>Content</SideNav>);
994
+ const nav = screen.getByRole('navigation');
995
+ const container = nav.parentElement;
996
+ const handle = screen.getByTestId('astryx-sidenav-resize-handle');
997
+
998
+ expect(container).toContainElement(handle);
999
+ expect(getComputedStyle(container!).overflow).toBe('clip');
1000
+ });
1001
+
992
1002
  it('does not render drag handle without resizable', () => {
993
1003
  render(<SideNav>Content</SideNav>);
994
1004
  expect(
@@ -11,7 +11,8 @@
11
11
  * Sidebar navigation container with five zones: header + topContent (sticky together),
12
12
  * children (scrollable), footer, and footerIcons (sticky bottom).
13
13
  *
14
- * Supports optional resize via drag handle at the inline-end edge.
14
+ * Supports optional resize via a drag handle at the inline-end edge. The
15
+ * resizable wrapper clips handle overflow while keeping its focus ring inside.
15
16
  *
16
17
  * SYNC: When modified, update these files to stay in sync:
17
18
  * - /packages/core/src/SideNav/SideNav.doc.mjs
@@ -25,7 +26,7 @@ import {useCallback, useImperativeHandle, useRef, type ReactNode} from 'react';
25
26
  import type {BaseProps} from '../BaseProps';
26
27
  import * as stylex from '@stylexjs/stylex';
27
28
  import type {StyleXStyles} from '@stylexjs/stylex';
28
- import {spacingVars} from '../theme/tokens.stylex';
29
+ import {focusVars, spacingVars} from '../theme/tokens.stylex';
29
30
  import {mergeProps} from '../utils';
30
31
  import {
31
32
  SideNavCollapseContext,
@@ -241,6 +242,16 @@ const styles = stylex.create({
241
242
  display: 'flex',
242
243
  flexShrink: 0,
243
244
  height: '100%',
245
+ overflow: 'clip',
246
+ },
247
+ resizableHandle: {
248
+ // Keep the shared ring inside the clipping boundary. The wrapper cannot
249
+ // use overflow-clip-margin: that paint allowance also contributes the
250
+ // overlay's half-pixel spill to AppShell's scrollable overflow.
251
+ outlineOffset: {
252
+ default: '0',
253
+ ':focus-visible': `calc(0px - ${focusVars['--focus-outline-width']})`,
254
+ },
244
255
  },
245
256
  // Topbar mode — horizontal layout for mobile top bar
246
257
  topbar: {
@@ -658,6 +669,7 @@ export function SideNav({
658
669
  position="overlay"
659
670
  pillPlacement="end"
660
671
  isAlwaysVisible={false}
672
+ xstyle={styles.resizableHandle}
661
673
  resizable={resizableHook.props}
662
674
  label={t('@astryx.sideNav.resizeSidebar')}
663
675
  />
@@ -255,6 +255,17 @@ export const docs = {
255
255
  ],
256
256
  },
257
257
  usage: {
258
+ accessibility: [
259
+ {
260
+ name: 'Thumb',
261
+ category: 'Color contrast',
262
+ criterion: '1.4.11 Non-text Contrast',
263
+ requirement: '3:1',
264
+ states: ['Rest', 'Hover', 'Pointer down'],
265
+ description:
266
+ 'The thumb must have at least 3:1 contrast with the track and the surface behind it. Pointer down is the whole drag: measure the thumb with the pressed overlay applied.',
267
+ },
268
+ ],
258
269
  anatomy,
259
270
  description:
260
271
  'A draggable control for selecting a numeric value or range within defined bounds. Supports single value and range selection, tick marks, custom value formatting, and vertical orientation. Use it when users need to explore a continuous range, such as volume, price, or percentage.',
@@ -13,6 +13,7 @@ import {useState} from 'react';
13
13
  import {describe, it, expect, vi, beforeEach} from 'vitest';
14
14
  import {render, screen, act, fireEvent, waitFor} from '@testing-library/react';
15
15
  import userEvent from '@testing-library/user-event';
16
+ import {declaresPressedOverlay} from '../__tests__/pressState';
16
17
  import * as stylex from '@stylexjs/stylex';
17
18
  import {Slider} from './Slider';
18
19
  import {focusOutlineStyles} from '../utils/focusOutline.stylex';
@@ -1101,3 +1102,130 @@ describe('Slider', () => {
1101
1102
  });
1102
1103
  });
1103
1104
  });
1105
+
1106
+ describe('pressed state', () => {
1107
+ it('paints the pressed overlay on the thumb for as long as it is dragged, from wherever the press lands', () => {
1108
+ render(
1109
+ <Slider label="Volume" value={50} min={0} max={100} onChange={vi.fn()} />,
1110
+ );
1111
+ const thumb = screen.getByRole('slider');
1112
+ const trackContainer = thumb.parentElement!;
1113
+ trackContainer.getBoundingClientRect = () => ({
1114
+ left: 0,
1115
+ top: 0,
1116
+ right: 200,
1117
+ bottom: 20,
1118
+ width: 200,
1119
+ height: 20,
1120
+ x: 0,
1121
+ y: 0,
1122
+ toJSON: () => {},
1123
+ });
1124
+
1125
+ expect(declaresPressedOverlay(thumb)).toBe(false);
1126
+ // A slider is a drag: the press lands on the track, not the thumb, and
1127
+ // the thumb follows it. The pressed paint follows the drag.
1128
+ fireEvent.pointerDown(trackContainer, {
1129
+ clientX: 20,
1130
+ clientY: 10,
1131
+ pointerId: 1,
1132
+ });
1133
+ expect(declaresPressedOverlay(thumb)).toBe(true);
1134
+ fireEvent.pointerMove(trackContainer, {
1135
+ clientX: 120,
1136
+ clientY: 10,
1137
+ pointerId: 1,
1138
+ });
1139
+ expect(declaresPressedOverlay(thumb)).toBe(true);
1140
+ fireEvent.pointerUp(trackContainer, {
1141
+ clientX: 120,
1142
+ clientY: 10,
1143
+ pointerId: 1,
1144
+ });
1145
+ expect(declaresPressedOverlay(thumb)).toBe(false);
1146
+ });
1147
+
1148
+ it('paints only the thumb being dragged in a range slider', () => {
1149
+ render(
1150
+ <Slider
1151
+ label="Price"
1152
+ value={[20, 80] as [number, number]}
1153
+ min={0}
1154
+ max={100}
1155
+ onChange={vi.fn()}
1156
+ />,
1157
+ );
1158
+ const [start, end] = screen.getAllByRole('slider');
1159
+ // In range mode the control is the group; each thumb sits in its own
1160
+ // value-tooltip wrapper.
1161
+ const trackContainer = screen.getByRole('group');
1162
+ trackContainer.getBoundingClientRect = () => ({
1163
+ left: 0,
1164
+ top: 0,
1165
+ right: 200,
1166
+ bottom: 20,
1167
+ width: 200,
1168
+ height: 20,
1169
+ x: 0,
1170
+ y: 0,
1171
+ toJSON: () => {},
1172
+ });
1173
+ fireEvent.pointerDown(trackContainer, {
1174
+ clientX: 170,
1175
+ clientY: 10,
1176
+ pointerId: 1,
1177
+ });
1178
+ expect(declaresPressedOverlay(end)).toBe(true);
1179
+ expect(declaresPressedOverlay(start)).toBe(false);
1180
+ fireEvent.pointerUp(trackContainer, {
1181
+ clientX: 170,
1182
+ clientY: 10,
1183
+ pointerId: 1,
1184
+ });
1185
+ expect(declaresPressedOverlay(end)).toBe(false);
1186
+ });
1187
+
1188
+ it('keeps a direct press on the visible upper thumb when range values coincide', () => {
1189
+ render(
1190
+ <Slider
1191
+ label="Price"
1192
+ value={[50, 50] as [number, number]}
1193
+ min={0}
1194
+ max={100}
1195
+ onChange={vi.fn()}
1196
+ />,
1197
+ );
1198
+ const [start, end] = screen.getAllByRole('slider');
1199
+ const trackContainer = screen.getByRole('group');
1200
+ trackContainer.getBoundingClientRect = () => ({
1201
+ left: 0,
1202
+ top: 0,
1203
+ right: 200,
1204
+ bottom: 20,
1205
+ width: 200,
1206
+ height: 20,
1207
+ x: 0,
1208
+ y: 0,
1209
+ toJSON: () => {},
1210
+ });
1211
+
1212
+ fireEvent.pointerDown(end, {
1213
+ clientX: 100,
1214
+ clientY: 10,
1215
+ pointerId: 1,
1216
+ });
1217
+ expect(declaresPressedOverlay(end)).toBe(true);
1218
+ expect(declaresPressedOverlay(start)).toBe(false);
1219
+ });
1220
+
1221
+ it('does not press a disabled slider', () => {
1222
+ render(<Slider label="Volume" value={50} isDisabled onChange={vi.fn()} />);
1223
+ const thumb = screen.getByRole('slider');
1224
+ fireEvent.pointerDown(thumb.parentElement!, {
1225
+ clientX: 20,
1226
+ clientY: 10,
1227
+ pointerId: 1,
1228
+ });
1229
+ expect(declaresPressedOverlay(thumb)).toBe(false);
1230
+ });
1231
+ });
@@ -288,6 +288,15 @@ const styles = stylex.create({
288
288
  },
289
289
  },
290
290
  },
291
+ // Pressed: the system's pressed overlay over the thumb's fill for as long
292
+ // as the thumb is being dragged. A slider is a drag, not a tap — the finger
293
+ // lands anywhere on the track and the thumb follows it — so the pressed
294
+ // paint follows the drag state the pointer handlers already keep, on a
295
+ // mouse and on a finger alike, rather than `:active` on the thumb itself
296
+ // (which a press on the track never activates).
297
+ thumbPressed: {
298
+ backgroundImage: `linear-gradient(${colorVars['--color-overlay-pressed']}, ${colorVars['--color-overlay-pressed']})`,
299
+ },
291
300
  thumbDisabled: {
292
301
  backgroundColor: colorVars['--color-background-muted'],
293
302
  cursor: 'default',
@@ -701,17 +710,25 @@ export function Slider({ref, ...props}: SliderProps) {
701
710
  const newVal = markEl
702
711
  ? Number(markEl.dataset.markValue)
703
712
  : getValueFromPosition(e.clientX, e.clientY);
704
- const thumbIndex = getClosestThumb(newVal);
713
+ const track = trackRef.current;
714
+ const thumbs = track?.querySelectorAll<HTMLElement>('[role="slider"]');
715
+ const pressedThumb = (e.target as Element).closest<HTMLElement>(
716
+ '[role="slider"]',
717
+ );
718
+ const pressedThumbIndex =
719
+ pressedThumb == null || thumbs == null
720
+ ? -1
721
+ : Array.from(thumbs).indexOf(pressedThumb);
722
+ // A direct thumb press owns that thumb even when range values coincide.
723
+ // Track and mark presses still choose the nearest value.
724
+ const thumbIndex =
725
+ pressedThumbIndex >= 0 ? pressedThumbIndex : getClosestThumb(newVal);
705
726
  draggingThumbRef.current = thumbIndex;
706
727
  setDraggingThumb(thumbIndex);
707
728
  updateValue(thumbIndex, newVal);
708
729
 
709
- // Focus the closest thumb
710
- const track = trackRef.current;
711
- if (track) {
712
- const thumbs = track.querySelectorAll<HTMLElement>('[role="slider"]');
713
- thumbs[thumbIndex]?.focus();
714
- }
730
+ // Focus the thumb that owns this drag.
731
+ thumbs?.[thumbIndex]?.focus();
715
732
  // Also clear it explicitly: focusing an already-focused thumb fires no
716
733
  // focus event, so a thumb the user had tabbed to would keep its ring
717
734
  // through the drag.
@@ -908,6 +925,7 @@ export function Slider({ref, ...props}: SliderProps) {
908
925
  ? styles.thumbHorizontal
909
926
  : rtlStyles.centerInline('50%'),
910
927
  !isDisabled && styles.thumbHover,
928
+ !isDisabled && draggingThumb === thumbIndex && styles.thumbPressed,
911
929
  !isDisabled &&
912
930
  keyboardFocusThumb === thumbIndex &&
913
931
  focusOutlineStyles.focusVisible,
@@ -404,6 +404,10 @@ describe('Spinner ring', () => {
404
404
  frames.forEach(cb => cb(0));
405
405
  expect(animations).toHaveLength(5);
406
406
  expect(animations.every(a => a.startTime === 0)).toBe(true);
407
+ // The dash animation lives on the arc <circle>, a descendant of the
408
+ // <svg> this ref sits on, not the <svg> itself (#6253) — subtree:true
409
+ // is what lets getAnimations() find it from here.
410
+ expect(getAnimations).toHaveBeenCalledWith({subtree: true});
407
411
  // The pin runs on the branch the other shade cases cannot reach, so the
408
412
  // no-read assertion is made here too.
409
413
  expect(
@@ -147,13 +147,14 @@ function registerSpinnerVars(): void {
147
147
  registerSpinnerVars();
148
148
 
149
149
  /**
150
- * Pin every ring's rotation to the document timeline's origin instead of its
151
- * own start time, so spinners mounted seconds apart turn in phase.
150
+ * Pin every ring's dash motion to the document timeline's origin instead of
151
+ * its own start time, so spinners mounted seconds apart stay in phase.
152
152
  *
153
153
  * Setting `startTime` is exact where arithmetic on a clock read is not: a
154
154
  * negative `animation-delay` computed at mount is only as good as the gap
155
155
  * between reading the clock and the frame the animation starts in, which at
156
- * 10x CPU throttling measured 116deg of drift.
156
+ * 10x CPU throttling measured 116deg of drift (from when this animated a
157
+ * literal rotation; the same drift risk applies to the dash offset now).
157
158
  *
158
159
  * Rings are collected and pinned in one frame because `getAnimations()`
159
160
  * resolves style and `startTime` dirties it again, so pinning them one at a
@@ -167,7 +168,9 @@ function pinRingsToTimelineOrigin(): void {
167
168
  flushScheduled = false;
168
169
  const animations: Animation[] = [];
169
170
  for (const svg of pendingRings) {
170
- animations.push(...svg.getAnimations());
171
+ // The animation now runs on the arc <circle>, a descendant of the ring
172
+ // this ref sits on (#6253), so it needs subtree:true to be found here.
173
+ animations.push(...svg.getAnimations({subtree: true}));
171
174
  }
172
175
  pendingRings.clear();
173
176
  for (const animation of animations) {
@@ -205,9 +208,20 @@ function syncRotationPhase(
205
208
  // Animation
206
209
  // =============================================================================
207
210
 
208
- const rotation = stylex.keyframes({
209
- '0%': {transform: 'rotate(0deg)'},
210
- '100%': {transform: 'rotate(360deg)'},
211
+ /**
212
+ * Moves the dash around a stationary circle instead of rotating the whole
213
+ * ring. WebKit re-antialiases a rotating stroked shape's rounded cap
214
+ * (`strokeLinecap: 'round'`, below) slightly differently at each intermediate
215
+ * angle, which reads as a visible wobble on iOS Safari independent of
216
+ * compositing (#6253) — confirmed by a real-device test against this exact
217
+ * fix, since `willChange`/layer promotion alone (the earlier fix for #3617)
218
+ * only smooths the rotation's motion, not the per-frame stroke rasterization.
219
+ * A static circle with an animated `stroke-dashoffset` never rotates, so
220
+ * WebKit never re-rasterizes the cap at an intermediate angle at all.
221
+ */
222
+ const dashMotion = stylex.keyframes({
223
+ '0%': {strokeDashoffset: '0px'},
224
+ '100%': {strokeDashoffset: `calc(var(${RESOLVED_DIAMETER}) * -${PI})`},
211
225
  });
212
226
 
213
227
  // =============================================================================
@@ -271,7 +285,6 @@ const styles = stylex.create({
271
285
  // One expression, one source of truth, resolves in any layout.
272
286
  width: `var(${BOX_SIZE})`,
273
287
  height: `var(${BOX_SIZE})`,
274
- willChange: 'transform',
275
288
  // The svg is sized in CSS (100% of the span) rather than from the size
276
289
  // constant, so one user unit is one CSS pixel AND the frame follows a
277
290
  // themed diameter: the span's box is `diameter + 2 x stroke`, both public
@@ -280,16 +293,6 @@ const styles = stylex.create({
280
293
  // diameter — an overflowing grid item aligns to start rather than centre,
281
294
  // which put the ring 1.5-3.3px off across the four sizes.
282
295
  overflow: 'visible',
283
- // Slow the rotation dramatically under reduced-motion rather than freezing
284
- // it (a frozen spinner reads as broken), matching ProgressBar's approach.
285
- // The role="status" + "Loading" label still convey busy state (obs-6).
286
- animationDuration: {
287
- default: durationVars['--duration-slow-min'],
288
- '@media (prefers-reduced-motion: reduce)': '3s',
289
- },
290
- animationIterationCount: 'infinite',
291
- animationName: rotation,
292
- animationTimingFunction: 'linear',
293
296
  },
294
297
  circle: {
295
298
  fill: 'none',
@@ -327,6 +330,16 @@ const styles = stylex.create({
327
330
  // `0` the way the registered length pair guards against, so it needs no
328
331
  // registration.
329
332
  arc: {
333
+ // Slow the motion dramatically under reduced-motion rather than freezing
334
+ // it (a frozen spinner reads as broken), matching ProgressBar's approach.
335
+ // The role="status" + "Loading" label still convey busy state (obs-6).
336
+ animationDuration: {
337
+ default: durationVars['--duration-slow-min'],
338
+ '@media (prefers-reduced-motion: reduce)': '3s',
339
+ },
340
+ animationIterationCount: 'infinite',
341
+ animationName: dashMotion,
342
+ animationTimingFunction: 'linear',
330
343
  stroke: 'var(--spinner-color)',
331
344
  transform: 'rotate(-90deg)',
332
345
  strokeDasharray: `calc(var(${RESOLVED_DIAMETER}) * ${PI} * var(--spinner-arc-fraction)) calc(var(${RESOLVED_DIAMETER}) * ${PI} * (1 - var(--spinner-arc-fraction)))`,
@@ -210,6 +210,17 @@ export const docs = {
210
210
  ],
211
211
  },
212
212
  usage: {
213
+ accessibility: [
214
+ {
215
+ name: 'Track and thumb',
216
+ category: 'Color contrast',
217
+ criterion: '1.4.11 Non-text Contrast',
218
+ requirement: '3:1',
219
+ states: ['Rest', 'Hover', 'Pointer down'],
220
+ description:
221
+ 'The on and off tracks must each have at least 3:1 contrast with the surface behind them, and the thumb with its track. For Hover and Pointer down, measure the final colors after the tint and the pressed overlay are applied.',
222
+ },
223
+ ],
213
224
  anatomy,
214
225
  description:
215
226
  'A toggle control for on/off states that take effect immediately. Supports labels, descriptions, loading states, and validation. Use it for settings or preferences that apply instantly. For changes requiring a form submission, use a checkbox instead.',
@@ -30,6 +30,7 @@ import {
30
30
  getAllInjectedCss,
31
31
  getForcedColorsRules,
32
32
  } from '../__tests__/forcedColors';
33
+ import {hasPressedArm} from '../__tests__/pressState';
33
34
  import {__resetLiveRegionsForTest} from '../hooks/useAnnounce';
34
35
 
35
36
  afterEach(() => {
@@ -755,6 +756,21 @@ describe('Switch', () => {
755
756
  });
756
757
  });
757
758
 
759
+ describe('pressed state', () => {
760
+ it('paints the pressed overlay on the track and the thumb while the row is pressed', () => {
761
+ const {container} = render(
762
+ <Switch label="Notifications" value={false} onChange={() => {}} />,
763
+ );
764
+ const track = container.querySelector('.astryx-switch');
765
+ const thumb = container.querySelector('.astryx-switch-thumb');
766
+ if (track == null || thumb == null) {
767
+ throw new Error('the switch has no track or thumb to press');
768
+ }
769
+ expect(hasPressedArm(track)).toBe(true);
770
+ expect(hasPressedArm(thumb)).toBe(true);
771
+ });
772
+ });
773
+
758
774
  describe('coarse pointer and RTL hit-target positioning', () => {
759
775
  it.each([
760
776
  ['sm', 'ltr'],
@@ -122,6 +122,15 @@ const thumbOnSizeStyles = stylex.create({
122
122
  },
123
123
  });
124
124
 
125
+ // The pressed overlay, painted as a gradient layer OVER the track's and
126
+ // thumb's own fills so it composes with the on/off colors and the hover tint
127
+ // instead of replacing them. Same token Button's overlay paints with. The
128
+ // switch is a two-part control whose focusable input sits beside the track,
129
+ // so the press is read off the shared scope marker (the row), the way the
130
+ // hover tint already is: pressing the input, the track or the label all
131
+ // activate the row.
132
+ const pressedImage = `linear-gradient(${colorVars['--color-overlay-pressed']}, ${colorVars['--color-overlay-pressed']})`;
133
+
125
134
  const labelWrapperSizeStyles = stylex.create({
126
135
  sm: {
127
136
  minHeight: 20,
@@ -207,6 +216,15 @@ const styles = stylex.create({
207
216
  default: null,
208
217
  '@media (forced-colors: active)': 'CanvasText',
209
218
  },
219
+ // Pressed: the overlay rides on top of the on/off fill. Gated like the
220
+ // hover tint so forced colors keeps its system-color track.
221
+ backgroundImage: {
222
+ default: null,
223
+ [stylex.when.ancestor(':active', switchScope)]: {
224
+ default: null,
225
+ '@media (forced-colors: none)': pressedImage,
226
+ },
227
+ },
210
228
  },
211
229
  // The one ring in the system not drawn by focusOutlineStyles. The focusable
212
230
  // input is a sibling of the track, so the condition has to reach the shared
@@ -278,6 +296,16 @@ const styles = stylex.create({
278
296
  '@media (prefers-reduced-motion: reduce)': '0s',
279
297
  },
280
298
  transitionTimingFunction: easeVars['--ease-standard'],
299
+ // Pressed: the same overlay as the track, so the whole control darkens
300
+ // under the finger rather than the thumb standing out against a darker
301
+ // track.
302
+ backgroundImage: {
303
+ default: null,
304
+ [stylex.when.ancestor(':active', switchScope)]: {
305
+ default: null,
306
+ '@media (forced-colors: none)': pressedImage,
307
+ },
308
+ },
281
309
  },
282
310
  // The thumb fill lives on the on/off styles (not the shared thumb style)
283
311
  // because forced colors needs a per-state system color: CanvasText on the