@astryxdesign/core 0.7.2 → 0.7.3-canary.06872b4

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 (100) hide show
  1. package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
  2. package/dist/CheckboxInput/CheckboxInput.js +19 -24
  3. package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  4. package/dist/DropdownMenu/DropdownMenu.js +52 -10
  5. package/dist/DropdownMenu/DropdownMenuContext.d.ts +34 -1
  6. package/dist/DropdownMenu/DropdownMenuContext.d.ts.map +1 -1
  7. package/dist/DropdownMenu/DropdownMenuContext.js +15 -0
  8. package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts +21 -2
  9. package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
  10. package/dist/DropdownMenu/DropdownMenuSubMenu.js +375 -42
  11. package/dist/DropdownMenu/menuRegionStops.d.ts +2 -2
  12. package/dist/DropdownMenu/menuRegionStops.js +2 -2
  13. package/dist/FileInput/FileInput.d.ts.map +1 -1
  14. package/dist/FileInput/FileInput.js +14 -12
  15. package/dist/Selector/SelectorOption.d.ts.map +1 -1
  16. package/dist/Selector/SelectorOption.js +1 -0
  17. package/dist/Slider/Slider.d.ts.map +1 -1
  18. package/dist/Slider/Slider.js +7 -14
  19. package/dist/Switch/Switch.d.ts.map +1 -1
  20. package/dist/Switch/Switch.js +12 -14
  21. package/dist/Switch/switch.markers.stylex.d.ts +2 -0
  22. package/dist/Switch/switch.markers.stylex.d.ts.map +1 -1
  23. package/dist/Switch/switch.markers.stylex.js +6 -0
  24. package/dist/TimeInput/TimeInput.d.ts +2 -1
  25. package/dist/TimeInput/TimeInput.d.ts.map +1 -1
  26. package/dist/Tooltip/Tooltip.d.ts.map +1 -1
  27. package/dist/Tooltip/Tooltip.js +36 -14
  28. package/dist/Tooltip/useTooltip.d.ts.map +1 -1
  29. package/dist/Tooltip/useTooltip.js +11 -2
  30. package/dist/TopNav/TopNav.d.ts.map +1 -1
  31. package/dist/TopNav/TopNav.js +2 -2
  32. package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
  33. package/dist/TopNav/TopNavHeading.js +1 -0
  34. package/dist/Typeahead/Typeahead.d.ts.map +1 -1
  35. package/dist/Typeahead/Typeahead.js +14 -2
  36. package/dist/astryx.css +4 -2
  37. package/dist/hooks/useMenuPress.d.ts +11 -1
  38. package/dist/hooks/useMenuPress.d.ts.map +1 -1
  39. package/dist/hooks/useMenuPress.js +43 -5
  40. package/dist/utils/timeParser.d.ts +4 -0
  41. package/dist/utils/timeParser.d.ts.map +1 -1
  42. package/dist/utils/timeParser.js +9 -2
  43. package/package.json +4 -4
  44. package/scripts/agent-doc-state.mjs +35 -8
  45. package/src/BottomSheet/BottomSheet.spec.md +13 -6
  46. package/src/BottomSheet/BottomSheetSwitcher.spec.md +121 -51
  47. package/src/CheckboxInput/CheckboxInput.test.tsx +44 -5
  48. package/src/CheckboxInput/CheckboxInput.tsx +16 -26
  49. package/src/CheckboxInput/__tests__/Checkbox.a11y.states.ts +3 -3
  50. package/src/CheckboxList/CheckboxList.test.tsx +9 -6
  51. package/src/ContextMenu/ContextMenu.test.tsx +41 -0
  52. package/src/DateRangeInput/DateRangeInput.spec.md +13 -13
  53. package/src/DropdownMenu/DropdownMenu.spec.md +33 -2
  54. package/src/DropdownMenu/DropdownMenu.tsx +79 -8
  55. package/src/DropdownMenu/DropdownMenuContext.public.test.ts +22 -0
  56. package/src/DropdownMenu/DropdownMenuContext.tsx +39 -1
  57. package/src/DropdownMenu/DropdownMenuSubMenu.doc.mjs +16 -1
  58. package/src/DropdownMenu/DropdownMenuSubMenu.test.tsx +623 -1
  59. package/src/DropdownMenu/DropdownMenuSubMenu.tsx +556 -99
  60. package/src/DropdownMenu/__tests__/SubMenuHeaderFooter.a11y.chromium.spec.ts +267 -0
  61. package/src/DropdownMenu/menuRegionStops.ts +2 -2
  62. package/src/DropdownMenu/modules/useMenuPress.spec.md +9 -0
  63. package/src/FileInput/FileInput.test.tsx +30 -7
  64. package/src/FileInput/FileInput.tsx +21 -11
  65. package/src/Selector/Selector.spec.md +11 -11
  66. package/src/Selector/Selector.test.tsx +16 -0
  67. package/src/Selector/SelectorOption.tsx +4 -0
  68. package/src/SideNav/SideNav.test.tsx +35 -0
  69. package/src/Slider/Slider.spec.md +11 -11
  70. package/src/Slider/Slider.test.tsx +3 -3
  71. package/src/Slider/Slider.tsx +8 -15
  72. package/src/Switch/Switch.test.tsx +29 -8
  73. package/src/Switch/Switch.tsx +13 -14
  74. package/src/Switch/__tests__/Switch.a11y.states.ts +2 -2
  75. package/src/Switch/switch.markers.stylex.ts +4 -0
  76. package/src/Table/Table.spec.md +2 -0
  77. package/src/Table/plugins/infiniteScroll/useTableInfiniteScroll.spec.md +244 -0
  78. package/src/Table/plugins/selection/useTableSelection.test.tsx +5 -3
  79. package/src/Table/plugins/virtualization/useTableVirtualization.spec.md +266 -0
  80. package/src/TimeInput/TimeInput.doc.mjs +5 -3
  81. package/src/TimeInput/TimeInput.test.tsx +20 -0
  82. package/src/TimeInput/TimeInput.tsx +2 -1
  83. package/src/Tokenizer/Tokenizer.spec.md +28 -28
  84. package/src/Tooltip/Tooltip.test.tsx +51 -6
  85. package/src/Tooltip/Tooltip.tsx +41 -18
  86. package/src/Tooltip/__tests__/Tooltip.a11y.chromium.spec.ts +129 -0
  87. package/src/Tooltip/__tests__/Tooltip.a11y.renders.tsx +86 -0
  88. package/src/Tooltip/__tests__/Tooltip.a11y.states.ts +132 -0
  89. package/src/Tooltip/__tests__/Tooltip.a11y.test.tsx +126 -0
  90. package/src/Tooltip/__tests__/TooltipHoverBridge.a11y.chromium.spec.ts +74 -0
  91. package/src/Tooltip/useTooltip.test.tsx +23 -0
  92. package/src/Tooltip/useTooltip.tsx +22 -9
  93. package/src/TopNav/TopNav.tsx +11 -1
  94. package/src/TopNav/TopNavHeading.tsx +1 -0
  95. package/src/TopNav/__tests__/TopNavMobileLongHeading.a11y.chromium.spec.ts +74 -0
  96. package/src/Typeahead/Typeahead.test.tsx +89 -0
  97. package/src/Typeahead/Typeahead.tsx +15 -2
  98. package/src/hooks/useMenuPress.ts +45 -7
  99. package/src/utils/timeParser.test.ts +11 -0
  100. package/src/utils/timeParser.ts +9 -2
@@ -313,6 +313,10 @@ export function clampTime(time, min, max, includeSeconds = false) {
313
313
 
314
314
  /**
315
315
  * Adjusts a time by adding/subtracting minutes.
316
+ *
317
+ * `deltaMinutes` is a whole number of minutes. A fractional delta leaves the
318
+ * time unchanged rather than returning a value that is no longer a time —
319
+ * `HH:MM` has no place for a fraction of a minute.
316
320
  */
317
321
  export function adjustTime(time, deltaMinutes, includeSeconds = false) {
318
322
  const parsed = parseISOTime(time);
@@ -321,8 +325,11 @@ export function adjustTime(time, deltaMinutes, includeSeconds = false) {
321
325
  }
322
326
 
323
327
  // A non-finite delta would spin the wrap-around forever (-Infinity) or
324
- // produce "NaN:NaN" (NaN) — return the input unchanged instead.
325
- if (!Number.isFinite(deltaMinutes)) {
328
+ // produce "NaN:NaN" (NaN), and a fractional one is never rounded on the way
329
+ // out — formatISOTime pads "30.5" to two characters and leaves it, so the
330
+ // caller gets back a value that is no longer a time. Steps are whole
331
+ // minutes: return the input unchanged instead.
332
+ if (!Number.isInteger(deltaMinutes)) {
326
333
  return time;
327
334
  }
328
335
  let totalMinutes = parsed.hour * 60 + parsed.minute + deltaMinutes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/core",
3
- "version": "0.7.2",
3
+ "version": "0.7.3-canary.06872b4",
4
4
  "displayName": "Astryx Core",
5
5
  "description": "The component library. Accessible, themeable React components with built-in spacing, dark mode, and StyleX styling.",
6
6
  "author": "Meta Open Source",
@@ -792,6 +792,8 @@
792
792
  "react-dom": ">=19.0.0"
793
793
  },
794
794
  "devDependencies": {
795
+ "@astryxdesign/a11y-spec": "0.7.3-canary.06872b4",
796
+ "@astryxdesign/cli": "0.7.3-canary.06872b4",
795
797
  "@babel/cli": "^7.29.7",
796
798
  "@babel/core": "^7.29.7",
797
799
  "@babel/preset-react": "^7.29.7",
@@ -802,9 +804,7 @@
802
804
  "@testing-library/jest-dom": "^6.6.0",
803
805
  "@testing-library/react": "^16.3.2",
804
806
  "@types/babel__core": "^7.20.5",
805
- "tailwindcss": "^4.3.2",
806
- "@astryxdesign/a11y-spec": "0.0.0",
807
- "@astryxdesign/cli": "0.7.2"
807
+ "tailwindcss": "^4.3.2"
808
808
  },
809
809
  "dependencies": {
810
810
  "intl-messageformat": "^11.2.9"
@@ -39,6 +39,7 @@ import * as path from 'node:path';
39
39
  export const AGENTS_MD = 'AGENTS.md';
40
40
  export const CLAUDE_MD = 'CLAUDE.md';
41
41
  export const CLAUDE_DIR_MD = '.claude/CLAUDE.md'; // cross-platform literal
42
+ export const GEMINI_MD = 'GEMINI.md';
42
43
  export const CURSOR_RULES = '.cursorrules';
43
44
  export const HERMES_DOT_MD = '.hermes.md';
44
45
  export const HERMES_MD = 'HERMES.md';
@@ -51,15 +52,18 @@ export const LEGACY_MARKER_END = '<!-- XDS:END -->';
51
52
 
52
53
  /**
53
54
  * The canonical set of EVERY location an --agent preset (or the default) can
54
- * write the Astryx block. SINGLE SOURCE OF TRUTH: discovery, removal, and the
55
- * `isAstryxInitialized` predicate all derive from this list, so "where init
56
- * writes" and "where we look" can never drift. (Explicit --agent-docs-path
57
- * targets are user-chosen and not enumerable here.)
55
+ * write a managed Astryx block — the full block, or the one-line import of
56
+ * AGENTS.md that the default writes to GEMINI.md. SINGLE
57
+ * SOURCE OF TRUTH: discovery, removal, and the `isAstryxInitialized` predicate
58
+ * all derive from this list, so "where init writes" and "where we look" can
59
+ * never drift. (Explicit --agent-docs-path targets are user-chosen and not
60
+ * enumerable here.)
58
61
  */
59
62
  export const AGENT_DOC_PATHS = [
60
63
  AGENTS_MD, // Codex / ChatGPT / Muse / generic
61
64
  CLAUDE_MD, // Claude Code (root)
62
65
  CLAUDE_DIR_MD, // Claude Code (.claude/CLAUDE.md)
66
+ GEMINI_MD, // Gemini CLI
63
67
  CURSOR_RULES, // Cursor
64
68
  HERMES_DOT_MD, // Hermes
65
69
  HERMES_MD, // Hermes
@@ -74,7 +78,7 @@ export const INIT_MARKERS = [MARKER_START, LEGACY_MARKER_START];
74
78
  /**
75
79
  * Find all existing agent doc files in a directory, across EVERY location any
76
80
  * preset can write (see {@link AGENT_DOC_PATHS}: AGENTS.md, CLAUDE.md,
77
- * .claude/CLAUDE.md, .cursorrules, .hermes.md, HERMES.md).
81
+ * .claude/CLAUDE.md, GEMINI.md, .cursorrules, .hermes.md, HERMES.md).
78
82
  * @param {string} targetDir
79
83
  * @returns {string[]} Relative paths of existing agent doc files
80
84
  */
@@ -82,10 +86,33 @@ export function discoverAgentDocs(targetDir) {
82
86
  return AGENT_DOC_PATHS.filter(p => fs.existsSync(path.join(targetDir, p)));
83
87
  }
84
88
 
89
+ /**
90
+ * Whether `content` holds an Astryx block. A managed block that only imports
91
+ * another file (the one-line `@./AGENTS.md` that init writes to GEMINI.md) does
92
+ * not count: it holds nothing once that file has lost its block. A malformed
93
+ * block still counts, so a half-written file reads as set up.
94
+ *
95
+ * @param {string} content
96
+ * @returns {boolean}
97
+ */
98
+ export function holdsAstryxBlock(content) {
99
+ for (const marker of INIT_MARKERS) {
100
+ let at = content.indexOf(marker);
101
+ while (at !== -1) {
102
+ const from = at + marker.length;
103
+ const end = content.indexOf('<!--', from);
104
+ const inner = (end === -1 ? content.slice(from) : content.slice(from, end)).trim();
105
+ if (!/^@\S+$/.test(inner)) return true;
106
+ at = content.indexOf(marker, from);
107
+ }
108
+ }
109
+ return false;
110
+ }
111
+
85
112
  /**
86
113
  * Single source of truth for "is Astryx set up in this project?" — true when any
87
- * agent-doc file already carries the Astryx marker, i.e. `init` / `agent-docs`
88
- * has run. Reused by the init & upgrade commands, the per-command setup nudge
114
+ * agent-doc file already holds an Astryx block, i.e. `init` / `agent-docs` has
115
+ * run. Reused by the init & upgrade commands, the per-command setup nudge
89
116
  * (enforcement layer 3), and the cli postinstall nudge (layer 2). Core's
90
117
  * postinstall (separate package, layer 1) mirrors the same marker contract.
91
118
  *
@@ -96,7 +123,7 @@ export function isAstryxInitialized(targetDir = process.cwd()) {
96
123
  for (const rel of discoverAgentDocs(targetDir)) {
97
124
  try {
98
125
  const content = fs.readFileSync(path.join(targetDir, rel), 'utf-8');
99
- if (INIT_MARKERS.some(m => content.includes(m))) {
126
+ if (holdsAstryxBlock(content)) {
100
127
  return true;
101
128
  }
102
129
  } catch {
@@ -15,6 +15,7 @@ verified_by:
15
15
  packages/core/src/BottomSheet/BottomSheet.test.tsx,
16
16
  packages/core/src/BottomSheet/BottomSheetPanel.test.tsx,
17
17
  packages/core/src/BottomSheet/BottomSheetKeyboard.test.tsx,
18
+ packages/core/src/BottomSheet/__tests__/BottomSheetNativeModal.a11y.browser.spec.ts,
18
19
  packages/core/src/BottomSheet/__tests__/BottomSheetKeyboard.a11y.browser.spec.ts,
19
20
  apps/storybook/stories/BottomSheet.stories.tsx,
20
21
  scripts/check-knowledge.mjs,
@@ -93,14 +94,17 @@ Consumer migration instructions belong in consumer docs and release notes.
93
94
  - The Content area's container padding, published per
94
95
  `architecture:container-padding`.
95
96
  - Standalone sheet presentation, including its optional native-dialog Scrim.
97
+ - The native dialog every sheet renders, standalone or switcher-managed
98
+ (`component:BottomSheetSwitcher` DEC-1's decided structure).
96
99
 
97
100
  **Does not own / non-goals**
98
101
 
99
102
  - Caller-provided content rendered inside the Content area.
100
103
  - A separate target for Content area, Handle, or Scrim; none exists on current
101
104
  `main`.
102
- - A shared switcher dialog or scrim — owned by BottomSheetSwitcher when the sheet
103
- participates in that host.
105
+ - The presentation lifecycle of its dialog and the flow's scrim ownership when
106
+ the sheet participates in a BottomSheetSwitcher — owned by BottomSheetSwitcher
107
+ (`component:BottomSheetSwitcher` DEC-1's decided structure).
104
108
  - Shared layer hosting or dismissal policy.
105
109
 
106
110
  ## Public concepts
@@ -128,8 +132,10 @@ in `BottomSheet.doc.mjs`.
128
132
  - A standalone modal sheet renders Sheet panel, Content area, Handle, and Scrim.
129
133
  - A standalone non-modal sheet renders Sheet panel, Content area, and Handle
130
134
  without a Scrim.
131
- - A switcher-managed sheet renders the same panel anatomy while
132
- BottomSheetSwitcher owns the shared dialog and optional Scrim.
135
+ - A switcher-managed sheet renders the same panel anatomy in its own dialog while
136
+ BottomSheetSwitcher coordinates that dialog's lifecycle and the flow's one Scrim
137
+ (`component:BottomSheetSwitcher` DEC-1's decided structure, not shipped
138
+ anatomy).
133
139
 
134
140
  ### Transformation and precedence order
135
141
 
@@ -184,7 +190,7 @@ a decision that they must remain unthemeable.
184
190
  },
185
191
  "Scrim": {
186
192
  "none": {
187
- "reason": "reachability-gap: No BottomSheet public target reaches the native dialog backdrop or switcher-owned scrim."
193
+ "reason": "reachability-gap: No BottomSheet public target reaches the native dialog backdrop, standalone or switcher-coordinated."
188
194
  }
189
195
  }
190
196
  }
@@ -210,7 +216,8 @@ a decision that they must remain unthemeable.
210
216
  | ------------------- | -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------- | --------------------------------- |
211
217
  | FR1 | `BottomSheet.test.tsx` render, content, Handle, and scrim behavior suites | Modal, non-modal, and switcher presentations | Removing a documented part fails existing content, structure, or dismissal assertions. | `audit:BottomSheet/anatomy` |
212
218
  | FR2 | Panel target assertion, source inspection, and theming target inventories | Sheet panel, Content area, Handle, and Scrim | Removing the panel target or documenting an unshipped child target fails evidence or inventory. | `audit:BottomSheet/theming` |
213
- | FR3, AR1–AR2 | `BottomSheetKeyboard.test.tsx`; `BottomSheetKeyboard.a11y.browser.spec.ts`; open Storybook stories | fitting/overflow, plain text, usable/unusable/dynamic descendants, focus | Missing/duplicate keyboard access, stale ownership, focus movement, or broken content-box layout fails. | `audit:BottomSheet/accessibility` | | Layout evidence | `BottomSheetPanel.test.tsx` | Floating Handle and scrolling Content area | Reordering or merging the stable parts fails existing panel structure and style assertions. | `audit:BottomSheet/anatomy` |
219
+ | FR3, AR1–AR2 | `BottomSheetKeyboard.test.tsx`; `BottomSheetKeyboard.a11y.browser.spec.ts`; open Storybook stories | fitting/overflow, plain text, usable/unusable/dynamic descendants, focus | Missing/duplicate keyboard access, stale ownership, focus movement, or broken content-box layout fails. | `audit:BottomSheet/accessibility` |
220
+ | Layout evidence | `BottomSheetPanel.test.tsx` | Floating Handle and scrolling Content area | Reordering or merging the stable parts fails existing panel structure and style assertions. | `audit:BottomSheet/anatomy` |
214
221
  | FR4 | `BottomSheetPanel.test.tsx` container padding tests; `derivedVarRegistry.test.ts` | default, `padding` prop, theme `padding`, lone padded Section child | The published inset differs from the applied padding, or a lone padded Section changes geometry. | `audit:BottomSheet/anatomy` |
215
222
  | Theming anatomy map | `scripts/check-knowledge.mjs` | Canonical anatomy and current target inventory | Missing, extra, prefixed, stale, or multiply assigned mappings fail repository validation. | `audit:BottomSheet/theming` |
216
223
 
@@ -13,6 +13,7 @@ review_triggers: [public-api, behavior, layout, theming, accessibility]
13
13
  verified_by:
14
14
  [
15
15
  packages/core/src/BottomSheet/BottomSheetSwitcher.test.tsx,
16
+ packages/core/src/BottomSheet/__tests__/BottomSheetNativeModal.a11y.browser.spec.ts,
16
17
  apps/storybook/stories/BottomSheetSwitcher.stories.tsx,
17
18
  scripts/check-knowledge.mjs,
18
19
  ]
@@ -34,16 +35,21 @@ system_specs: [spec:AST-002, spec:AST-027]
34
35
  ## Intent
35
36
 
36
37
  BottomSheetSwitcher coordinates a mutually exclusive sequence of BottomSheet
37
- children inside one shared native dialog. This draft records verified shipped and
38
- remediated behavior without adding a prop, changing a default, or settling the
39
- open modality, hosting, identifier, or theming decisions below.
38
+ children. This draft records verified shipped and remediated behavior, and the
39
+ hosting requirements its decision log decides — each child presented in its own
40
+ native dialog — without adding a prop, changing a default, or settling the
41
+ open modality, identifier, or theming decisions below. A row whose review state
42
+ is "Owner decision" is the decided requirement, not shipped behavior; the
43
+ representative states that name a sheet's own dialog, the retained dialog, or
44
+ the flow wrapper describe DEC-1's decided structure in the same way.
40
45
 
41
46
  ## Compatibility and migration
42
47
 
43
48
  - Released default preserved: `yes`
44
- - Compatibility class: observational backfill plus a shared-dismissal conformance
45
- fix; public props, defaults, exports, DOM ownership, and transition behavior stay
46
- unchanged
49
+ - Compatibility class: nonbreaking; public props, defaults, exports, visual
50
+ output, and transition behavior stay unchanged. The element the `ref` resolves
51
+ to, and that it changes on a handoff, is implementation rather than public
52
+ contract (DEC-2)
47
53
  - Controlled/uncontrolled behavior: `activeSheet` remains fully controlled
48
54
  - Migration decision: none
49
55
 
@@ -53,10 +59,16 @@ Consumer migration instructions belong in consumer docs and release notes.
53
59
 
54
60
  **Owns**
55
61
 
56
- - One shared native dialog for all directly nested BottomSheet children.
62
+ - The presentation lifecycle of every directly nested BottomSheet child's native
63
+ dialog: which is presented, retained during a handoff, or closed.
57
64
  - Which child sheet is active, retained during a handoff, or hidden.
58
- - Shared scrim, focus containment, scroll lock, Escape/platform-close routing,
59
- and final focus return for the flow.
65
+ - Which sheet dialog hosts the flow (its ref, `id`, and dismissal
66
+ registration) and which paints the flow's one scrim, plus
67
+ Escape/platform-close routing and final focus return for the flow. Focus
68
+ containment is the native modal dialog's; the flow's one page scroll lock is
69
+ held for the whole modal flow (DEC-1).
70
+ - The flow wrapper: the isolated surface that orders non-modal sheet dialogs
71
+ locally (`spec:AST-027` FR2).
60
72
 
61
73
  **Does not own / non-goals**
62
74
 
@@ -69,30 +81,30 @@ Consumer migration instructions belong in consumer docs and release notes.
69
81
 
70
82
  ## Public concepts
71
83
 
72
- | Concept | Closed values or states | Meaning | Availability by variant/orientation/state | Default | Owner | Stability | Invalid-value behavior |
73
- | ------------------- | ---------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ | -------------------------------------- | ------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------ |
74
- | Active sheet | `null` or one nested BottomSheet `sheetId` | Selects the only interactive child, or closes the flow | All presentations | `null` is closed; the prop is required | `component:BottomSheetSwitcher` | released | A non-matching or duplicate id is not given a safe public fallback by the current contract |
75
- | Shared presentation | `true` / `false` through `hasScrim` | Selects the current modal scrim-backed host or non-modal no-scrim host | Entire flow | `true` | `component:BottomSheetSwitcher` | released | Boolean only |
76
- | Child identity | Non-empty `sheetId` on each direct BottomSheet child | Associates controlled selection, labeling, purpose, and transition state with a child | Direct nested BottomSheet children | none | `component:BottomSheet` | released | Empty ids warn and stay hidden; duplicate-id behavior is not specified |
77
- | Dismissal request | `onActiveSheetChange(null)` | Reports an allowed implicit close without taking control from the caller | Escape/platform close, scrim click, or swipe according to active child purpose | none | `component:BottomSheetSwitcher`; `family:overlay-dismissal` owns ordering | released | The caller may retain its controlled value |
78
- | Dialog surface | inherited dialog props plus `ref` and `onCancel` | Reaches the one shared native dialog | Entire flow | none | `component:BottomSheetSwitcher` | released | Component-owned semantics and handlers retain precedence |
84
+ | Concept | Closed values or states | Meaning | Availability by variant/orientation/state | Default | Owner | Stability | Invalid-value behavior |
85
+ | ------------------- | ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ | -------------------------------------- | ------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------ |
86
+ | Active sheet | `null` or one nested BottomSheet `sheetId` | Selects the only interactive child, or closes the flow | All presentations | `null` is closed; the prop is required | `component:BottomSheetSwitcher` | released | A non-matching or duplicate id is not given a safe public fallback by the current contract |
87
+ | Shared presentation | `true` / `false` through `hasScrim` | Selects the current modal scrim-backed host or non-modal no-scrim host | Entire flow | `true` | `component:BottomSheetSwitcher` | released | Boolean only |
88
+ | Child identity | Non-empty `sheetId` on each direct BottomSheet child | Associates controlled selection, labeling, purpose, and transition state with a child | Direct nested BottomSheet children | none | `component:BottomSheet` | released | Empty ids warn and stay hidden; duplicate-id behavior is not specified |
89
+ | Dismissal request | `onActiveSheetChange(null)` | Reports an allowed implicit close without taking control from the caller | Escape/platform close, scrim click, or swipe according to active child purpose | none | `component:BottomSheetSwitcher`; `family:overlay-dismissal` owns ordering | released | The caller may retain its controlled value |
90
+ | Dialog surface | inherited dialog props plus `ref` and `onCancel` | Dialog props and handlers, `onCancel` included, reach every sheet dialog; `ref`, `id`, and `data-testid` resolve to the host dialog, which is never null for an object ref while a sheet is mounted (owner decision, DEC-2) | Entire flow | none | `component:BottomSheetSwitcher` | released | Component-owned semantics and handlers retain precedence |
79
91
 
80
92
  ## Behavioral and layout contract
81
93
 
82
94
  Draft requirements identify their basis so observed code is not mistaken for an
83
95
  intentional decision. This draft cannot clear the gaps it records.
84
96
 
85
- | ID | Candidate invariant | Basis | Draft review state |
86
- | --- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------------------------------------- |
87
- | FR1 | Zero or one child sheet is interactive for each controlled `activeSheet` value; all other children are hidden or retained inert and `aria-hidden` during a transition. | Current source, docs, and tests | Verified shipped behavior |
88
- | FR2 | All child sheets share one native dialog. Opening the first sheet opens that dialog once; handoffs do not replace it. | Current source, docs, and tests | Verified shipped behavior |
89
- | FR3 | During a handoff, the entering sheet is above the retained sheet. A taller retained sheet aligns down to a shorter entering sheet, and the retained sheet fades only after required transform motion completes. | Current source and transition tests | Verified shipped behavior; exact visual treatment remains human-reviewed |
90
- | FR4 | Closing retains the outgoing sheet through its exit, then closes the dialog. A modal flow restores focus to the element captured when that modal flow opened. | Current source and focus tests | Verified shipped behavior |
91
- | FR5 | `hasScrim=true` uses `showModal()`, a native backdrop, focus containment, and page scroll lock. `hasScrim=false` uses `show()` without a backdrop or scroll lock and leaves the page interactive. | Current source, docs, tests, and Chromium evidence | Verified shipped behavior; the non-modal host remains a `spec:AST-027` conformance gap |
92
- | FR6 | The active child purpose governs implicit dismissal: `info` allows Escape, scrim click, and swipe; `form` allows Escape; `required` blocks all three and exposes `alertdialog`. | Current BottomSheet docs and switcher tests | Verified shipped behavior |
93
- | FR7 | While visible, the switcher participates in `family:overlay-dismissal`; one Escape or platform close request reaches only the topmost present layer, and descendants receive a deeper logical layer scope. | `family:overlay-dismissal` and the audit regression test | Settled remediation in this audit |
94
- | FR8 | A stale gesture from an outgoing sheet cannot change the shared scrim, and unmounting a retained sheet cannot keep the shared dialog open. | Current tests | Verified shipped behavior |
95
- | FR9 | The switcher forwards its ref, neutral dialog attributes, styling inputs, and composed handlers to the shared dialog while preserving its owned ARIA and dismissal behavior. | Current source, public API architecture, and tests | Verified shipped behavior |
97
+ | ID | Candidate invariant | Basis | Draft review state |
98
+ | --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
99
+ | FR1 | Zero or one child sheet is interactive for each controlled `activeSheet` value; all other children are hidden or retained inert and `aria-hidden` during a transition. | Current source, docs, and tests | Verified shipped behavior |
100
+ | FR2 | Each child sheet owns one native dialog. Opening a sheet presents its dialog once; a handoff presents the entering sheet's dialog above the retained one and closes the retained dialog only after its panel has faded. Returning to a sheet whose dialog is still open beneath a newer one re-presents it so the interactive sheet is the topmost layer. | DEC-1 | Owner decision |
101
+ | FR3 | During a handoff, the entering sheet is above the retained sheet. A taller retained sheet aligns down to a shorter entering sheet, and the retained sheet fades only after required transform motion completes. | Current source and transition tests | Verified shipped behavior; exact visual treatment remains human-reviewed |
102
+ | FR4 | Closing retains the outgoing sheet through its exit, then closes the dialog. A modal flow restores focus to the element captured when that modal flow opened. | Current source and focus tests | Verified shipped behavior |
103
+ | FR5 | `hasScrim=true` uses `showModal()`, a native backdrop, and native focus containment, and locks page scroll: the page does not scroll while a modal flow is presented; the lock is held continuously across a handoff, never released and re-acquired between steps; it still holds beneath a `Dialog` opened from a step; it is released after the flow's exit (owner decision, DEC-1). `hasScrim=false` uses `show()` without a backdrop or scroll lock and leaves the page interactive (verified current behavior). In a non-modal flow the sheet dialogs order themselves with local values inside the switcher's isolated flow wrapper (owner decision, DEC-1); the page-level value that wrapper carries remains a `spec:AST-027` conformance gap. | DEC-1; `spec:AST-027` FR2, FR4, FR8 | Modal host and the wrapper's local ordering: owner decision. Non-modal `show()` host: verified current behavior. The wrapper's page-level value remains a `spec:AST-027` conformance gap |
104
+ | FR6 | The active child purpose governs implicit dismissal: `info` allows Escape, scrim click, and swipe; `form` allows Escape; `required` blocks all three and exposes `alertdialog`. | Current BottomSheet docs and switcher tests | Verified shipped behavior |
105
+ | FR7 | While visible, the switcher participates in `family:overlay-dismissal`; one Escape or platform close request reaches only the topmost present layer, and descendants receive a deeper logical layer scope. | `family:overlay-dismissal` and the audit regression test | Settled remediation in this audit |
106
+ | FR8 | One backdrop paints the flow's scrim at a time: the retained sheet's dialog keeps it through a handoff and the entering dialog takes it over without a fade when the retained dialog closes. A stale gesture from an outgoing sheet cannot change the flow's scrim, and unmounting a retained sheet cannot keep its dialog open or the flow's modal layer held. | DEC-1; current tests | Owner decision |
107
+ | FR9 | The switcher forwards neutral dialog attributes, styling inputs, and composed handlers, `onCancel` included, to every sheet dialog, so a handler fires for whichever sheet dialog raises the event; renders `id` and `data-testid` on the host dialog only, so each appears once in the document; attaches its ref to the host dialog; and preserves its owned ARIA and dismissal behavior. An object ref's `current` is never `null` while a sheet is mounted. A callback ref follows React's semantics on a handoff: a cleanup it returned runs when it detaches from the old host; a callback ref without a cleanup is called with `null` on detach, then with the new host. | DEC-1, DEC-2; `architecture:public-component-api` INV8 | Owner decision |
96
108
 
97
109
  ### Allowed variation
98
110
 
@@ -104,14 +116,17 @@ intentional decision. This draft cannot clear the gaps it records.
104
116
 
105
117
  ### Representative states
106
118
 
107
- | State | Required invariant | Allowed variation |
108
- | ---------- | --------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
109
- | Closed | Shared dialog is closed and no child is interactive. | Child panels may remain mounted but hidden. |
110
- | First open | Matching child is visible and interactive in one shared dialog. | Child-owned height and content. |
111
- | Handoff | Entering child is interactive; retained child is visible but inert and hidden from accessibility APIs until it fades. | Alignment offset depends on measured panel geometry. |
112
- | Closing | Outgoing child is retained inert while exit motion completes; modal focus and scroll ownership remain until close. | Theme-controlled duration. |
113
- | Modal | Native modal host, backdrop, focus containment, and scroll lock are active. | Active child's `purpose` controls implicit dismissal. |
114
- | Non-modal | Native non-modal host has no backdrop or scroll lock and background content remains interactive. | The current clipping/stacking limitation is a conformance gap, not an allowed exception. |
119
+ The states below describe DEC-1's decided structure where they name a sheet's
120
+ own dialog, the retained dialog, or the flow wrapper.
121
+
122
+ | State | Required invariant | Allowed variation |
123
+ | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
124
+ | Closed | Every sheet dialog is closed and no child is interactive. | Child panels may remain mounted but hidden. |
125
+ | First open | Matching child is visible and interactive in its own dialog. | Child-owned height and content. |
126
+ | Handoff | Entering child is interactive in its own dialog; retained child's dialog stays open, inert, and hidden from accessibility APIs until it fades, and keeps painting the one scrim. | Alignment offset depends on measured panel geometry. |
127
+ | Closing | Outgoing child is retained inert while exit motion completes; modal focus and scroll ownership remain until close. | Theme-controlled duration. |
128
+ | Modal | Native modal host, backdrop, native focus containment, and the page scroll lock are active. | Active child's `purpose` controls implicit dismissal. |
129
+ | Non-modal | Native non-modal host has no backdrop or scroll lock and background content remains interactive. | The current clipping/stacking limitation is a conformance gap, not an allowed exception. |
115
130
 
116
131
  ### Transformation and precedence order
117
132
 
@@ -124,8 +139,12 @@ intentional decision. This draft cannot clear the gaps it records.
124
139
 
125
140
  ### Performance and resources
126
141
 
127
- - **PR1 — One shared host.** A flow keeps one dialog, focus boundary, scroll lock,
128
- and backdrop across child handoffs rather than mounting a host for every child.
142
+ - **PR1 — One painted scrim.** In a modal flow, at rest exactly one sheet
143
+ dialog is presented; during a handoff two are, with one backdrop painted.
144
+ Native modality holds across a modal flow's child handoffs because a sheet
145
+ dialog is modal throughout, and the one page scroll lock is held for the
146
+ whole flow rather than per step. A non-modal flow paints no backdrop and
147
+ holds no lock.
129
148
  - **PR2 — Stable child registration.** Parent rerenders and changing consumer ref
130
149
  identities do not unregister a mounted child or cancel an active handoff.
131
150
 
@@ -141,11 +160,11 @@ intentional decision. This draft cannot clear the gaps it records.
141
160
 
142
161
  ## Design relationships
143
162
 
144
- | Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract |
145
- | ---------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------ | -------------- | ------------------ |
146
- | Shared dialog | Transparent host for the flow's interaction and accessibility boundary | Current source and public docs | Structural | FR2, FR5, AR1 |
147
- | Sheet panels | Delegate visible panel, content, handle, and gesture presentation to BottomSheet | `component:BottomSheet` draft as observational context | Prominent | FR1, FR3 |
148
- | Scrim | Optional native backdrop that dims and blocks the page in modal presentation | Current source and public docs | Supporting | FR5 |
163
+ | Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract |
164
+ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | -------------- | ------------------ |
165
+ | Shared dialog | Transparent host for the flow's interaction and accessibility boundary; DEC-1 decides one such host per child sheet | Current source and public docs; DEC-1 for the per-sheet clause | Structural | FR2, FR5, AR1 |
166
+ | Sheet panels | Delegate visible panel, content, handle, and gesture presentation to BottomSheet | `component:BottomSheet` draft as observational context | Prominent | FR1, FR3 |
167
+ | Scrim | Optional native backdrop that dims and blocks the page in modal presentation; DEC-1 decides that one sheet dialog paints it at a time | Current source and public docs; DEC-1 for the one-painter clause | Supporting | FR5, FR8 |
149
168
 
150
169
  ### Theming anatomy
151
170
 
@@ -163,7 +182,7 @@ intentional decision. This draft cannot clear the gaps it records.
163
182
  },
164
183
  "Scrim": {
165
184
  "none": {
166
- "reason": "reachability-gap: The switcher-owned native backdrop paints the scrim but has no current public theming target."
185
+ "reason": "reachability-gap: The switcher-coordinated native backdrop paints the scrim but has no current public theming target."
167
186
  }
168
187
  }
169
188
  }
@@ -183,17 +202,68 @@ intentional decision. This draft cannot clear the gaps it records.
183
202
 
184
203
  ## Verification map
185
204
 
186
- | Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
187
- | ---------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- |
188
- | FR1–FR4, FR8 | `BottomSheetSwitcher.test.tsx` | closed, first open, handoffs in either completion order, rapid replacement, unmount, close | A child becomes interactive at the wrong time, a retained child disappears early, or the shared host lifecycle breaks. | `audit:BottomSheetSwitcher/behavior` |
189
- | FR5–FR7, AR1–AR3 | `BottomSheetSwitcher.test.tsx`; Chromium evidence | modal/non-modal, info/form/required, nested layer, IME, focus return | Modality, dismissal order, naming, inertness, scroll lock, or focus behavior diverges. | `audit:BottomSheetSwitcher/accessibility` |
190
- | FR9 | `BottomSheetSwitcher.test.tsx`; export checks | ref, DOM/ARIA/data/events, class, style, xstyle | A supported input is dropped or overrides component-owned semantics accidentally. | `audit:BottomSheetSwitcher/api` |
191
- | Theming anatomy | `scripts/check-knowledge.mjs`; theming tests | dialog, delegated sheet panel, scrim | A non-painting host gains a target, a delegated panel loses its owner, or the scrim gap disappears without review. | `audit:BottomSheetSwitcher/theming` |
205
+ | Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
206
+ | ---------------- | ----------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- |
207
+ | FR1–FR4, FR8 | `BottomSheetSwitcher.test.tsx` | closed, first open, handoffs in either completion order, rapid replacement, unmount, close | A child becomes interactive at the wrong time, a retained child disappears early, a second backdrop paints, or a sheet dialog's lifecycle breaks. | `audit:BottomSheetSwitcher/behavior` |
208
+ | FR5–FR7, AR1–AR3 | `BottomSheetSwitcher.test.tsx`; `BottomSheetNativeModal.a11y.browser.spec.ts` | modal/non-modal, info/form/required, nested layer, IME, focus return, scroll lock in engines, non-modal local ordering | Modality, dismissal order, naming, inertness, scroll lock, or focus behavior diverges, or a sheet dialog takes a page-level z-index. | `audit:BottomSheetSwitcher/accessibility` |
209
+ | FR9 | `BottomSheetSwitcher.test.tsx`; export checks | ref across open/handoff/close/unmount, callback-ref cleanup, `id` once, DOM/ARIA/data/events, class, style, xstyle | A supported input is dropped or duplicated, an object ref is null while a sheet is mounted or skips a cleanup, or an input overrides component-owned semantics accidentally. | `audit:BottomSheetSwitcher/api` |
210
+ | Theming anatomy | `scripts/check-knowledge.mjs`; theming tests | dialog, delegated sheet panel, scrim | A non-painting host gains a target, a delegated panel loses its owner, or the scrim gap disappears without review. | `audit:BottomSheetSwitcher/theming` |
192
211
 
193
212
  ## Decision log
194
213
 
195
- None. This draft records observed behavior and one remediation already required by
196
- current shared authority; it introduces no component-local design or API decision.
214
+ ### DEC-1 — Each step owns its native dialog; the switcher coordinates
215
+
216
+ **Reference:** `component:BottomSheetSwitcher/DEC-1`
217
+ **Decider:** imdreamrunner, 2026-10-20
218
+
219
+ A switcher step is a BottomSheet with its own native dialog, presented and
220
+ closed like a standalone sheet, so one DOM shape serves standalone sheets and
221
+ switcher steps alike and the browser supplies modality per step: an inert
222
+ page, focus containment, `cancel` for Escape and the platform close, and the
223
+ backdrop. The switcher owns only what no single dialog can decide: which dialog
224
+ is presented, retained, or closed; the one scrim handed from the retained
225
+ dialog to the entering one without a fade; re-presenting a sheet that is still
226
+ open beneath a newer one when the flow returns to it; focus kept in the active
227
+ sheet when a retained dialog closes; focus returned to the flow's opener;
228
+ `cancel` gated by the active step's `purpose` through the shared dismissal
229
+ stack; and the flow's one page scroll lock, held from the moment a modal flow
230
+ is presented until after its exit, so a handoff between two open dialogs never
231
+ releases and re-acquires it. The switcher's one element is a flow wrapper with
232
+ no box in a modal flow and, in a non-modal flow, the isolated surface inside
233
+ which the sheet dialogs order themselves with local values.
234
+ Rejected: one switcher-owned dialog hosting every step as a panel, because a
235
+ step is then not a sheet and every standalone-sheet mechanism needs a second,
236
+ switcher-only implementation.
237
+ Rejected: a script focus trap on top of native containment, because the
238
+ browser already contains focus in a modal dialog and the trap fights its
239
+ inertness.
240
+ Rejected: a page-level `z-index` on a non-modal step's dialog, because
241
+ `spec:AST-027` FR4 forbids a new page band; the wrapper is the isolation owner.
242
+
243
+ ### DEC-2 — The host dialog's identity is implementation, not contract
244
+
245
+ **Reference:** `component:BottomSheetSwitcher/DEC-2`
246
+ **Decider:** imdreamrunner, 2026-10-20
247
+
248
+ The `ref`, `id`, and `data-testid` of the switcher reach the dialog hosting
249
+ the flow: the active sheet's, the exiting sheet's through its exit, and, while
250
+ the flow is closed, the dialog that hosted it last or the first mounted
251
+ sheet's, so an object ref is never `null` while a sheet is mounted and the
252
+ identifying attributes appear once. Which element that is, and that it changes
253
+ on a handoff, is implementation. The released documentation (v0.7.1
254
+ `BottomSheetSwitcher.doc.mjs`) describes the ref as "Ref forwarded to the one
255
+ shared native dialog." and the switcher as "Its ref and shared DOM props
256
+ target that dialog." Code that copies `ref.current` once at mount keeps a
257
+ real `<dialog>`, but after a handoff that element may no longer be the host;
258
+ read `ref.current` at use time, or use a callback ref, to follow the flow. DOM
259
+ props and handlers given to the switcher (`className`, `style`, `onCancel`,
260
+ `onToggle`, `aria-*`, and the rest) reach every sheet dialog, with `id` and
261
+ `data-testid` on the host only, so a handler fires for whichever sheet dialog
262
+ raises the event. The owner rules this hosting — the moving host and the
263
+ per-dialog props alike — nonbreaking under `spec:AST-017` FR3 because no
264
+ visual output and no public API surface changes.
265
+ Rejected: classifying the moving ref as a breaking change, because no public
266
+ API, documented interaction, or visual output changes.
197
267
 
198
268
  ## Open questions
199
269
 
@@ -278,7 +278,7 @@ describe('CheckboxInput', () => {
278
278
  );
279
279
  const checkbox = screen.getByRole('checkbox');
280
280
  expect(checkbox).toBeChecked();
281
- expect(checkbox).toBeDisabled();
281
+ expect(checkbox).toHaveAttribute('aria-disabled', 'true');
282
282
  expect(checkbox).toHaveAttribute('type', 'checkbox');
283
283
  });
284
284
 
@@ -588,16 +588,55 @@ describe('CheckboxInput', () => {
588
588
  expect(checkbox).not.toBeChecked();
589
589
  });
590
590
 
591
- it('remains natively disabled when disabled without a reason', () => {
591
+ it('stays focusable via aria-disabled when disabled without a reason', async () => {
592
+ const user = userEvent.setup();
593
+ const onChange = vi.fn();
594
+ const onClick = vi.fn();
595
+ render(
596
+ <form>
597
+ <CheckboxInput
598
+ label="Accept terms"
599
+ value={false}
600
+ onChange={onChange}
601
+ onClick={onClick}
602
+ htmlName="terms"
603
+ isRequired
604
+ isDisabled
605
+ />
606
+ </form>,
607
+ );
608
+ const checkbox = screen.getByRole('checkbox');
609
+ expect(checkbox).not.toHaveAttribute('disabled');
610
+ expect(checkbox).toHaveAttribute('aria-disabled', 'true');
611
+ await user.tab();
612
+ expect(checkbox).toHaveFocus();
613
+ await user.keyboard(' ');
614
+ await user.click(checkbox);
615
+ expect(onChange).not.toHaveBeenCalled();
616
+ expect(onClick).not.toHaveBeenCalled();
617
+ expect(checkbox).not.toBeChecked();
618
+ const form = checkbox.closest('form')!;
619
+ expect(form.checkValidity()).toBe(true);
620
+ expect([...new FormData(form).keys()]).toEqual([]);
621
+ });
622
+
623
+ it('keeps a disabled indeterminate checkbox mixed after Space or a click', async () => {
624
+ const user = userEvent.setup();
592
625
  render(
593
626
  <CheckboxInput
594
- label="Accept terms"
595
- value={false}
627
+ label="Select all"
628
+ value="indeterminate"
596
629
  onChange={() => {}}
597
630
  isDisabled
598
631
  />,
599
632
  );
600
- expect(screen.getByRole('checkbox')).toBeDisabled();
633
+ const checkbox = screen.getByRole<HTMLInputElement>('checkbox');
634
+ expect(checkbox.indeterminate).toBe(true);
635
+ await user.tab();
636
+ await user.keyboard(' ');
637
+ fireEvent.click(checkbox);
638
+ expect(checkbox.indeterminate).toBe(true);
639
+ expect(checkbox).not.toBeChecked();
601
640
  });
602
641
  });
603
642
  describe('form participation', () => {