@astryxdesign/core 0.7.2 → 0.7.3-canary.0bf23bd

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 (183) hide show
  1. package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
  2. package/dist/BottomSheet/BottomSheet.js +8 -4
  3. package/dist/BottomSheet/BottomSheetSwitcher.d.ts.map +1 -1
  4. package/dist/BottomSheet/BottomSheetSwitcher.js +7 -0
  5. package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
  6. package/dist/CheckboxInput/CheckboxInput.js +19 -24
  7. package/dist/ClickableCard/ClickableCard.d.ts +2 -2
  8. package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
  9. package/dist/ClickableCard/ClickableCard.js +11 -9
  10. package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
  11. package/dist/CodeBlock/CodeBlock.js +11 -1
  12. package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
  13. package/dist/ComplexSelector/ComplexSelector.js +23 -5
  14. package/dist/DateInput/DateInput.d.ts +4 -4
  15. package/dist/DateInput/DateInput.d.ts.map +1 -1
  16. package/dist/DateInput/DateInput.js +27 -20
  17. package/dist/DateInput/NativeDateField.d.ts.map +1 -1
  18. package/dist/DateInput/NativeDateField.js +14 -8
  19. package/dist/DateInput/TouchDateField.d.ts.map +1 -1
  20. package/dist/DateInput/TouchDateField.js +14 -10
  21. package/dist/Dialog/Dialog.d.ts.map +1 -1
  22. package/dist/Dialog/Dialog.js +9 -4
  23. package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  24. package/dist/DropdownMenu/DropdownMenu.js +52 -10
  25. package/dist/DropdownMenu/DropdownMenuContext.d.ts +34 -1
  26. package/dist/DropdownMenu/DropdownMenuContext.d.ts.map +1 -1
  27. package/dist/DropdownMenu/DropdownMenuContext.js +15 -0
  28. package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts +21 -2
  29. package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
  30. package/dist/DropdownMenu/DropdownMenuSubMenu.js +375 -42
  31. package/dist/DropdownMenu/menuRegionStops.d.ts +2 -2
  32. package/dist/DropdownMenu/menuRegionStops.js +2 -2
  33. package/dist/FileInput/FileInput.d.ts.map +1 -1
  34. package/dist/FileInput/FileInput.js +14 -12
  35. package/dist/Link/Link.d.ts +2 -3
  36. package/dist/Link/Link.d.ts.map +1 -1
  37. package/dist/Link/Link.js +11 -19
  38. package/dist/Markdown/Markdown.d.ts.map +1 -1
  39. package/dist/Markdown/Markdown.js +48 -15
  40. package/dist/MultiSelector/MultiSelector.d.ts +4 -4
  41. package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
  42. package/dist/MultiSelector/MultiSelector.disabledFocus.a11y.chromium.spec.d.ts +2 -0
  43. package/dist/MultiSelector/MultiSelector.disabledFocus.a11y.chromium.spec.d.ts.map +1 -0
  44. package/dist/MultiSelector/MultiSelector.disabledFocus.a11y.chromium.spec.js +48 -0
  45. package/dist/MultiSelector/MultiSelector.js +25 -18
  46. package/dist/Popover/Popover.d.ts.map +1 -1
  47. package/dist/Popover/Popover.js +8 -4
  48. package/dist/Selector/Selector.d.ts +4 -4
  49. package/dist/Selector/Selector.d.ts.map +1 -1
  50. package/dist/Selector/Selector.js +23 -14
  51. package/dist/Selector/SelectorOption.d.ts.map +1 -1
  52. package/dist/Selector/SelectorOption.js +1 -0
  53. package/dist/Slider/Slider.d.ts.map +1 -1
  54. package/dist/Slider/Slider.js +7 -14
  55. package/dist/Switch/Switch.d.ts.map +1 -1
  56. package/dist/Switch/Switch.js +25 -17
  57. package/dist/Switch/switch.markers.stylex.d.ts +2 -0
  58. package/dist/Switch/switch.markers.stylex.d.ts.map +1 -1
  59. package/dist/Switch/switch.markers.stylex.js +6 -0
  60. package/dist/TimeInput/TimeInput.d.ts +2 -1
  61. package/dist/TimeInput/TimeInput.d.ts.map +1 -1
  62. package/dist/Token/Token.d.ts.map +1 -1
  63. package/dist/Token/Token.js +8 -3
  64. package/dist/Tooltip/Tooltip.d.ts.map +1 -1
  65. package/dist/Tooltip/Tooltip.js +36 -14
  66. package/dist/Tooltip/useTooltip.d.ts.map +1 -1
  67. package/dist/Tooltip/useTooltip.js +11 -2
  68. package/dist/TopNav/TopNav.d.ts.map +1 -1
  69. package/dist/TopNav/TopNav.js +2 -2
  70. package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
  71. package/dist/TopNav/TopNavHeading.js +1 -0
  72. package/dist/Typeahead/Typeahead.d.ts.map +1 -1
  73. package/dist/Typeahead/Typeahead.js +14 -2
  74. package/dist/astryx.css +8 -2
  75. package/dist/hooks/useMenuPress.d.ts +11 -1
  76. package/dist/hooks/useMenuPress.d.ts.map +1 -1
  77. package/dist/hooks/useMenuPress.js +43 -5
  78. package/dist/utils/disabledInteraction.d.ts +21 -0
  79. package/dist/utils/disabledInteraction.d.ts.map +1 -0
  80. package/dist/utils/disabledInteraction.js +33 -0
  81. package/dist/utils/timeParser.d.ts +4 -0
  82. package/dist/utils/timeParser.d.ts.map +1 -1
  83. package/dist/utils/timeParser.js +9 -2
  84. package/package.json +4 -4
  85. package/scripts/agent-doc-state.mjs +35 -8
  86. package/src/Banner/Banner.spec.md +37 -32
  87. package/src/BottomSheet/BottomSheet.spec.md +13 -6
  88. package/src/BottomSheet/BottomSheet.test.tsx +29 -0
  89. package/src/BottomSheet/BottomSheet.tsx +8 -4
  90. package/src/BottomSheet/BottomSheetSwitcher.spec.md +121 -51
  91. package/src/BottomSheet/BottomSheetSwitcher.test.tsx +26 -0
  92. package/src/BottomSheet/BottomSheetSwitcher.tsx +6 -0
  93. package/src/CheckboxInput/CheckboxInput.test.tsx +44 -5
  94. package/src/CheckboxInput/CheckboxInput.tsx +16 -26
  95. package/src/CheckboxInput/__tests__/Checkbox.a11y.states.ts +3 -3
  96. package/src/CheckboxList/CheckboxList.test.tsx +9 -6
  97. package/src/ClickableCard/ClickableCard.doc.mjs +2 -2
  98. package/src/ClickableCard/ClickableCard.test.tsx +5 -4
  99. package/src/ClickableCard/ClickableCard.tsx +9 -9
  100. package/src/CodeBlock/CodeBlock.highlightStyles.test.tsx +87 -0
  101. package/src/CodeBlock/CodeBlock.tsx +11 -1
  102. package/src/ComplexSelector/ComplexSelector.focusableDisabled.test.tsx +76 -0
  103. package/src/ComplexSelector/ComplexSelector.tsx +21 -4
  104. package/src/ContextMenu/ContextMenu.test.tsx +41 -0
  105. package/src/DateInput/DateInput.doc.mjs +9 -8
  106. package/src/DateInput/DateInput.test.tsx +88 -13
  107. package/src/DateInput/DateInput.tsx +49 -21
  108. package/src/DateInput/DateInputTouch.test.tsx +22 -1
  109. package/src/DateInput/NativeDateField.test.tsx +29 -3
  110. package/src/DateInput/NativeDateField.tsx +20 -7
  111. package/src/DateInput/TouchDateField.tsx +24 -9
  112. package/src/DateRangeInput/DateRangeInput.spec.md +13 -13
  113. package/src/Dialog/Dialog.test.tsx +39 -0
  114. package/src/Dialog/Dialog.tsx +9 -4
  115. package/src/DropdownMenu/DropdownMenu.spec.md +33 -2
  116. package/src/DropdownMenu/DropdownMenu.tsx +79 -8
  117. package/src/DropdownMenu/DropdownMenuContext.public.test.ts +22 -0
  118. package/src/DropdownMenu/DropdownMenuContext.tsx +39 -1
  119. package/src/DropdownMenu/DropdownMenuSubMenu.doc.mjs +16 -1
  120. package/src/DropdownMenu/DropdownMenuSubMenu.test.tsx +623 -1
  121. package/src/DropdownMenu/DropdownMenuSubMenu.tsx +556 -99
  122. package/src/DropdownMenu/__tests__/SubMenuHeaderFooter.a11y.chromium.spec.ts +267 -0
  123. package/src/DropdownMenu/menuRegionStops.ts +2 -2
  124. package/src/DropdownMenu/modules/useMenuPress.spec.md +9 -0
  125. package/src/FieldStatus/FieldStatus.spec.md +3 -2
  126. package/src/FileInput/FileInput.test.tsx +30 -7
  127. package/src/FileInput/FileInput.tsx +21 -11
  128. package/src/Link/Link.test.tsx +21 -7
  129. package/src/Link/Link.tsx +16 -24
  130. package/src/Link/__tests__/Link.a11y.states.ts +1 -1
  131. package/src/Markdown/Markdown.rerender.test.tsx +143 -0
  132. package/src/Markdown/Markdown.tsx +89 -35
  133. package/src/MultiSelector/MultiSelector.disabledFocus.a11y.chromium.spec.ts +71 -0
  134. package/src/MultiSelector/MultiSelector.doc.mjs +5 -5
  135. package/src/MultiSelector/MultiSelector.focusableDisabled.test.tsx +121 -0
  136. package/src/MultiSelector/MultiSelector.test.tsx +49 -7
  137. package/src/MultiSelector/MultiSelector.tsx +53 -29
  138. package/src/Popover/Popover.test.tsx +15 -0
  139. package/src/Popover/Popover.tsx +19 -8
  140. package/src/PowerSearch/PowerSearchFilterEditor.test.tsx +3 -2
  141. package/src/PowerSearch/PowerSearchToken.test.tsx +7 -5
  142. package/src/Selector/Selector.doc.mjs +4 -4
  143. package/src/Selector/Selector.focusableDisabled.test.tsx +127 -0
  144. package/src/Selector/Selector.spec.md +11 -11
  145. package/src/Selector/Selector.test.tsx +64 -6
  146. package/src/Selector/Selector.tsx +51 -21
  147. package/src/Selector/SelectorOption.tsx +4 -0
  148. package/src/SideNav/SideNav.test.tsx +35 -0
  149. package/src/Slider/Slider.spec.md +11 -11
  150. package/src/Slider/Slider.test.tsx +3 -3
  151. package/src/Slider/Slider.tsx +8 -15
  152. package/src/Switch/Switch.test.tsx +85 -8
  153. package/src/Switch/Switch.tsx +26 -16
  154. package/src/Switch/__tests__/Switch.a11y.states.ts +2 -2
  155. package/src/Switch/switch.markers.stylex.ts +4 -0
  156. package/src/Table/Table.spec.md +2 -0
  157. package/src/Table/plugins/infiniteScroll/useTableInfiniteScroll.spec.md +244 -0
  158. package/src/Table/plugins/selection/useTableSelection.test.tsx +5 -3
  159. package/src/Table/plugins/virtualization/useTableVirtualization.spec.md +266 -0
  160. package/src/TimeInput/TimeInput.doc.mjs +5 -3
  161. package/src/TimeInput/TimeInput.test.tsx +20 -0
  162. package/src/TimeInput/TimeInput.tsx +2 -1
  163. package/src/Token/Token.test.tsx +26 -4
  164. package/src/Token/Token.tsx +6 -2
  165. package/src/Tokenizer/Tokenizer.spec.md +28 -28
  166. package/src/Tooltip/Tooltip.test.tsx +51 -6
  167. package/src/Tooltip/Tooltip.tsx +41 -18
  168. package/src/Tooltip/__tests__/Tooltip.a11y.chromium.spec.ts +129 -0
  169. package/src/Tooltip/__tests__/Tooltip.a11y.renders.tsx +86 -0
  170. package/src/Tooltip/__tests__/Tooltip.a11y.states.ts +132 -0
  171. package/src/Tooltip/__tests__/Tooltip.a11y.test.tsx +126 -0
  172. package/src/Tooltip/__tests__/TooltipHoverBridge.a11y.chromium.spec.ts +74 -0
  173. package/src/Tooltip/useTooltip.test.tsx +23 -0
  174. package/src/Tooltip/useTooltip.tsx +22 -9
  175. package/src/TopNav/TopNav.tsx +11 -1
  176. package/src/TopNav/TopNavHeading.tsx +1 -0
  177. package/src/TopNav/__tests__/TopNavMobileLongHeading.a11y.chromium.spec.ts +74 -0
  178. package/src/Typeahead/Typeahead.test.tsx +89 -0
  179. package/src/Typeahead/Typeahead.tsx +15 -2
  180. package/src/hooks/useMenuPress.ts +45 -7
  181. package/src/utils/disabledInteraction.ts +40 -0
  182. package/src/utils/timeParser.test.ts +11 -0
  183. package/src/utils/timeParser.ts +9 -2
@@ -36,7 +36,9 @@
36
36
  *
37
37
  * The menu root is marked `data-astryx-menu-press` so a nested flyout (a DOM
38
38
  * descendant of its parent menu) can tell which level owns a press, and so a
39
- * surface can be recognised as carrying this model.
39
+ * surface can be recognised as carrying this model. A menu the root renders
40
+ * beside itself names the root with `data-astryx-menu-press-surface` and counts
41
+ * as nested in it.
40
42
  *
41
43
  * SYNC: When modified, update:
42
44
  * - /packages/core/src/hooks/index.ts
@@ -52,6 +54,14 @@ import { useLongPress } from "./useLongPress.js";
52
54
  /** Marks a menu root that carries this press model. */
53
55
  export const MENU_PRESS_MARKER = 'data-astryx-menu-press';
54
56
  const MENU_PRESS_ROOT_SELECTOR = `[${MENU_PRESS_MARKER}]`;
57
+ /**
58
+ * Carried by a menu root that another root renders beside itself rather than
59
+ * inside it, naming that root's `id`: the menu of a sub-menu with a header or
60
+ * footer, in a dialog beside the root's menu, is nested in that root for the
61
+ * press model, as a flyout inside the root's DOM is. Nothing else beside the
62
+ * root carries it, so a picker placed in a header or footer stays its own root.
63
+ */
64
+ export const MENU_PRESS_SURFACE_ATTR = 'data-astryx-menu-press-surface';
55
65
 
56
66
  /** How long after a tracked release the browser's click is still swallowed. */
57
67
  export const MENU_PRESS_STRAY_CLICK_MS = 400;
@@ -153,13 +163,41 @@ function isRowFocusable(row) {
153
163
  function getOutermostRoot(menu) {
154
164
  let root = menu;
155
165
  for (;;) {
156
- const parent = root.parentElement?.closest(MENU_PRESS_ROOT_SELECTOR);
157
- if (parent == null) {
166
+ const parent = root.parentElement?.closest(MENU_PRESS_ROOT_SELECTOR) ?? getSurfaceOwner(root);
167
+ if (parent == null || parent === root) {
158
168
  return root;
159
169
  }
160
170
  root = parent;
161
171
  }
162
172
  }
173
+
174
+ /**
175
+ * The menu root that renders `menu` beside itself, if any (see
176
+ * `MENU_PRESS_SURFACE_ATTR`). Read off the menu itself, never an ancestor, so
177
+ * a root placed in a region of that surface is not adopted.
178
+ */
179
+ function getSurfaceOwner(menu) {
180
+ const ownerId = menu.getAttribute(MENU_PRESS_SURFACE_ATTR);
181
+ if (!ownerId) {
182
+ return null;
183
+ }
184
+ const owner = menu.ownerDocument.getElementById(ownerId);
185
+ return owner?.matches(MENU_PRESS_ROOT_SELECTOR) === true ? owner : null;
186
+ }
187
+
188
+ /**
189
+ * Whether `element` is inside the menu tree whose outermost root is `root`:
190
+ * inside the root itself, or inside a menu nested in it through a surface
191
+ * the root renders beside itself. Anything else in such a surface (a header
192
+ * field, say) is outside the menu, as the root's own regions are.
193
+ */
194
+ function isInMenuTree(element, root) {
195
+ if (root.contains(element)) {
196
+ return true;
197
+ }
198
+ const owner = element.closest(MENU_PRESS_ROOT_SELECTOR);
199
+ return owner != null && getOutermostRoot(owner) === root;
200
+ }
163
201
  // =============================================================================
164
202
  // Hook
165
203
  // =============================================================================
@@ -223,13 +261,13 @@ export function useMenuPress(options) {
223
261
  element = event.target instanceof Element ? event.target : null;
224
262
  }
225
263
  const root = menu == null ? null : getOutermostRoot(menu);
226
- const isInMenu = root != null && element != null && root.contains(element);
264
+ const isInMenu = root != null && element != null && isInMenuTree(element, root);
227
265
  const trigger = triggerRef?.current ?? null;
228
266
  const isOnTrigger = trigger != null && element != null && trigger.contains(element);
229
267
  let row = null;
230
268
  if (isInMenu && element != null) {
231
269
  row = element.closest(itemSelector);
232
- if (row != null && !root.contains(row)) {
270
+ if (row != null && !isInMenuTree(row, root)) {
233
271
  row = null;
234
272
  }
235
273
  }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @file disabledInteraction.ts
3
+ * @input An optional caller keydown handler
4
+ * @output Event props that keep a focusable, aria-disabled control inert
5
+ * @position Shared by controls that replace native `disabled` with
6
+ * `aria-disabled` under spec:AST-085 (FR1, FR2)
7
+ */
8
+ import type { KeyboardEvent, KeyboardEventHandler, MouseEvent } from 'react';
9
+ /**
10
+ * Event props for a disabled control that stays focusable. Native `disabled`
11
+ * dispatched no click at all; without it, Enter and Space still synthesize a
12
+ * click that native listeners on the element (a wrapping Popover's trigger)
13
+ * receive. Cancelling those keys keeps the click from existing, and the click
14
+ * handler cancels pointer clicks and keeps them from reaching ancestors. Other
15
+ * keys still reach the caller's handler.
16
+ */
17
+ export declare function disabledInteractionProps<T extends HTMLElement>(onKeyDown?: KeyboardEventHandler<T>): {
18
+ onClick: (event: MouseEvent<T>) => void;
19
+ onKeyDown: (event: KeyboardEvent<T>) => void;
20
+ };
21
+ //# sourceMappingURL=disabledInteraction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disabledInteraction.d.ts","sourceRoot":"","sources":["../../src/utils/disabledInteraction.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,aAAa,EAAE,oBAAoB,EAAE,UAAU,EAAC,MAAM,OAAO,CAAC;AAE3E;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,WAAW,EAC5D,SAAS,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAClC;IACD,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IACxC,SAAS,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;CAC9C,CAcA"}
@@ -0,0 +1,33 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file disabledInteraction.ts
5
+ * @input An optional caller keydown handler
6
+ * @output Event props that keep a focusable, aria-disabled control inert
7
+ * @position Shared by controls that replace native `disabled` with
8
+ * `aria-disabled` under spec:AST-085 (FR1, FR2)
9
+ */
10
+
11
+ /**
12
+ * Event props for a disabled control that stays focusable. Native `disabled`
13
+ * dispatched no click at all; without it, Enter and Space still synthesize a
14
+ * click that native listeners on the element (a wrapping Popover's trigger)
15
+ * receive. Cancelling those keys keeps the click from existing, and the click
16
+ * handler cancels pointer clicks and keeps them from reaching ancestors. Other
17
+ * keys still reach the caller's handler.
18
+ */
19
+ export function disabledInteractionProps(onKeyDown) {
20
+ return {
21
+ onClick: event => {
22
+ event.preventDefault();
23
+ event.stopPropagation();
24
+ },
25
+ onKeyDown: event => {
26
+ if (event.key === 'Enter' || event.key === ' ') {
27
+ event.preventDefault();
28
+ } else {
29
+ onKeyDown?.(event);
30
+ }
31
+ }
32
+ };
33
+ }
@@ -70,6 +70,10 @@ export declare function isTimeInRange(time: ISOTimeString, min?: ISOTimeString,
70
70
  export declare function clampTime(time: ISOTimeString, min?: ISOTimeString, max?: ISOTimeString, includeSeconds?: boolean): ISOTimeString;
71
71
  /**
72
72
  * Adjusts a time by adding/subtracting minutes.
73
+ *
74
+ * `deltaMinutes` is a whole number of minutes. A fractional delta leaves the
75
+ * time unchanged rather than returning a value that is no longer a time —
76
+ * `HH:MM` has no place for a fraction of a minute.
73
77
  */
74
78
  export declare function adjustTime(time: ISOTimeString, deltaMinutes: number, includeSeconds?: boolean): ISOTimeString;
75
79
  //# sourceMappingURL=timeParser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"timeParser.d.ts","sourceRoot":"","sources":["../../src/utils/timeParser.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG;IAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAA;CAAC,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAMvE;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CA6B5D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,UAAU,EAChB,cAAc,GAAE,OAAe,GAC9B,aAAa,CAUf;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,aAAa,GAAG,SAAS,EAC/B,cAAc,GAAE,OAAe,GAC9B,MAAM,CAqBR;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,aAAa,GAAG,SAAS,EAC/B,cAAc,GAAE,OAAe,GAC9B,MAAM,CAmBR;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,cAAc,GAAE,OAAe,GAC9B,aAAa,GAAG,IAAI,CA6HtB;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,CAAC,EAAE,aAAa,GAAG,SAAS,EAC5B,CAAC,EAAE,aAAa,GAAG,SAAS,GAC3B,MAAM,CA4BR;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,aAAa,EACnB,GAAG,CAAC,EAAE,aAAa,EACnB,GAAG,CAAC,EAAE,aAAa,GAClB,OAAO,CAQT;AAED;;GAEG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,aAAa,EACnB,GAAG,CAAC,EAAE,aAAa,EACnB,GAAG,CAAC,EAAE,aAAa,EACnB,cAAc,GAAE,OAAe,GAC9B,aAAa,CAoBf;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,aAAa,EACnB,YAAY,EAAE,MAAM,EACpB,cAAc,GAAE,OAAe,GAC9B,aAAa,CAwBf"}
1
+ {"version":3,"file":"timeParser.d.ts","sourceRoot":"","sources":["../../src/utils/timeParser.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG;IAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAA;CAAC,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAMvE;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CA6B5D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,UAAU,EAChB,cAAc,GAAE,OAAe,GAC9B,aAAa,CAUf;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,aAAa,GAAG,SAAS,EAC/B,cAAc,GAAE,OAAe,GAC9B,MAAM,CAqBR;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,aAAa,GAAG,SAAS,EAC/B,cAAc,GAAE,OAAe,GAC9B,MAAM,CAmBR;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,cAAc,GAAE,OAAe,GAC9B,aAAa,GAAG,IAAI,CA6HtB;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,CAAC,EAAE,aAAa,GAAG,SAAS,EAC5B,CAAC,EAAE,aAAa,GAAG,SAAS,GAC3B,MAAM,CA4BR;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,aAAa,EACnB,GAAG,CAAC,EAAE,aAAa,EACnB,GAAG,CAAC,EAAE,aAAa,GAClB,OAAO,CAQT;AAED;;GAEG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,aAAa,EACnB,GAAG,CAAC,EAAE,aAAa,EACnB,GAAG,CAAC,EAAE,aAAa,EACnB,cAAc,GAAE,OAAe,GAC9B,aAAa,CAoBf;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,aAAa,EACnB,YAAY,EAAE,MAAM,EACpB,cAAc,GAAE,OAAe,GAC9B,aAAa,CA2Bf"}
@@ -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.0bf23bd",
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.0bf23bd",
796
+ "@astryxdesign/cli": "0.7.3-canary.0bf23bd",
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 {
@@ -42,29 +42,29 @@ separately targetable surface. The status and content targets remain unchanged.
42
42
  - Released default preserved: `no` — Banner no longer derives a live-region role from visual status
43
43
  - Compatibility class: breaking accessibility-semantic correction; visual output, DOM structure, props, theming targets, and interaction behavior are unchanged
44
44
  - Controlled/uncontrolled behavior: unchanged
45
- - Migration decision: announce async outcomes in their transition handler with `useAnnounce`; add an explicit `role="status"` only for a persistent semantic mirror, and reserve `role="alert"` for genuinely urgent interruption
45
+ - Migration decision: announce async outcomes in their transition handler with `useAnnounce`; add an explicit `role="status"` only for a persistent semantic mirror, and reserve `role="alert"` for genuinely urgent interruption. Inside a mounted live container, `spec:AST-086` FR4 applies instead.
46
46
 
47
47
  Consumer migration instructions belong in consumer docs and release notes.
48
48
 
49
49
  ### DEP-0007 — Deprecate live-region roles derived from `status`
50
50
 
51
- | Field | Value |
52
- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
53
- | id | `DEP-0007` |
54
- | cleanup | `CLN-0015` |
55
- | package | `@astryxdesign/core` |
56
- | surface | Default ARIA role of `Banner`: `role="alert"` for `warning` and `error`, `role="status"` for `info` and `success`, derived from `status` when the caller passes no `role` |
57
- | old contract | Visual `status` selects the live-region role of the Banner root |
58
- | replacement | A caller that announces an async outcome calls `useAnnounce` from the transition that produced it. A caller whose Banner is a persistent semantic mirror passes `role="status"`; genuinely urgent content passes `role="alert"`. Both explicit roles already reach the Banner root |
59
- | direct authority | `component:Banner`. Owners: `cixzhang`, `imdreamrunner` |
60
- | warning | Consumer docs and the release notes name `DEP-0007` and the explicit `role` that keeps the released semantics. No runtime warning (`spec:AST-017` FR29) |
61
- | migration | Non-mechanical: a caller that announces an async outcome calls `useAnnounce` from the transition that produced it; a caller whose Banner is a persistent mirror or urgent content passes `role="status"` or `role="alert"` |
62
- | codemod | None: whether a Banner needs an announcement, and when, depends on the transition that renders it, which only the caller knows; adding the released role everywhere would restore the coupling this cleanup removes |
63
- | downstream | Maintained docs teach `useAnnounce` for async outcomes and explicit `role` for persistent mirrors |
64
- | transition | no prior transition |
65
- | state | `proposed` |
66
- | open decision | Banner FR and DEC entries that make `status` visual-only |
67
- | target plan | `CLN-0015` in the next minor release |
51
+ | Field | Value |
52
+ | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
53
+ | id | `DEP-0007` |
54
+ | cleanup | `CLN-0015` |
55
+ | package | `@astryxdesign/core` |
56
+ | surface | Default ARIA role of `Banner`: `role="alert"` for `warning` and `error`, `role="status"` for `info` and `success`, derived from `status` when the caller passes no `role` |
57
+ | old contract | Visual `status` selects the live-region role of the Banner root |
58
+ | replacement | A caller that announces an async outcome calls `useAnnounce` from the transition that produced it. A caller whose Banner is a persistent semantic mirror passes `role="status"`; genuinely urgent content passes `role="alert"`. Both explicit roles already reach the Banner root. Inside a mounted live container, `spec:AST-086` FR4 applies instead. |
59
+ | direct authority | `component:Banner`. Owners: `cixzhang`, `imdreamrunner` |
60
+ | warning | Consumer docs and the release notes name `DEP-0007` and the explicit `role` that keeps the released semantics. No runtime warning (`spec:AST-017` FR29) |
61
+ | migration | Non-mechanical: a caller that announces an async outcome calls `useAnnounce` from the transition that produced it; a caller whose Banner is a persistent mirror or urgent content passes `role="status"` or `role="alert"`. Inside a mounted live container, `spec:AST-086` FR4 applies instead. |
62
+ | codemod | None: whether a Banner needs an announcement, and when, depends on the transition that renders it, which only the caller knows; adding the released role everywhere would restore the coupling this cleanup removes |
63
+ | downstream | Maintained docs teach `useAnnounce` for async outcomes and explicit `role` for persistent mirrors. Inside a mounted live container, `spec:AST-086` FR4 applies instead. |
64
+ | transition | no prior transition |
65
+ | state | `proposed` |
66
+ | open decision | Banner FR and DEC entries that make `status` visual-only |
67
+ | target plan | `CLN-0015` in the next minor release |
68
68
 
69
69
  ### CLN-0015 — Banner renders no live-region role by default
70
70
 
@@ -105,16 +105,16 @@ prop vocabulary or extensibility rule changes.
105
105
  The requirements below describe the current implementation and its additive
106
106
  frame target contract.
107
107
 
108
- | ID | Invariant | Basis | Contract state |
109
- | --- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | ------------------------ |
110
- | FR1 | The current render places `banner` on the colored status surface, which is Banner's primary painted surface and reflects `container` and `status`. | Current source, public docs, and tests | Current behavior |
111
- | FR2 | The Banner frame receives the public ref, role, supported DOM props, `xstyle`, `className`, and `style`; it also paints the selected `boxShadow`. | Current source and tests | Current behavior |
112
- | FR3 | An elevated `card` frame also paints the whole-banner radius. A `section` frame remains square. A non-elevated frame does not receive the frame-radius style. | Current source and elevation tests | Current behavior |
113
- | FR4 | Card shape is split across surface owners: the status surface owns all corners without visible content or the top corners with visible content; the content surface owns the bottom corners. | Current source | Current behavior |
114
- | FR5 | Theme-authored `borderRadius` on `banner` currently writes the private `--_banner-radius` variable on the Status surface only. CSS inheritance does not carry that value upward to the frame or sideways to the Content surface, so both keep their fallback radius. | Current compiler output and CSS inheritance | Current reachability gap |
115
- | FR6 | The Banner frame exposes `banner-frame` and reflects `container` and `elevation`. The existing `banner` target remains on the Status surface rather than moving to the outermost DOM element. | Owner decision; current source and tests | Current behavior |
116
- | FR7 | `banner-frame` is additive. The existing `banner`, `banner-icon`, `banner-description`, and `banner-content` targets and their current axes remain unchanged. | Current target inventory; compatibility policy | Current behavior |
117
- | FR8 | `status` controls visual meaning only and MUST NOT derive `role`, `aria-live`, or an announcement. Standard DOM props MAY provide an explicit persistent role. Async outcomes MUST announce from the transition handler through `useAnnounce`; `role="alert"` is reserved for genuinely urgent interruptive content. | Accessibility Checklist §Announcements; owner decision | Current behavior |
108
+ | ID | Invariant | Basis | Contract state |
109
+ | --- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | ------------------------ |
110
+ | FR1 | The current render places `banner` on the colored status surface, which is Banner's primary painted surface and reflects `container` and `status`. | Current source, public docs, and tests | Current behavior |
111
+ | FR2 | The Banner frame receives the public ref, role, supported DOM props, `xstyle`, `className`, and `style`; it also paints the selected `boxShadow`. | Current source and tests | Current behavior |
112
+ | FR3 | An elevated `card` frame also paints the whole-banner radius. A `section` frame remains square. A non-elevated frame does not receive the frame-radius style. | Current source and elevation tests | Current behavior |
113
+ | FR4 | Card shape is split across surface owners: the status surface owns all corners without visible content or the top corners with visible content; the content surface owns the bottom corners. | Current source | Current behavior |
114
+ | FR5 | Theme-authored `borderRadius` on `banner` currently writes the private `--_banner-radius` variable on the Status surface only. CSS inheritance does not carry that value upward to the frame or sideways to the Content surface, so both keep their fallback radius. | Current compiler output and CSS inheritance | Current reachability gap |
115
+ | FR6 | The Banner frame exposes `banner-frame` and reflects `container` and `elevation`. The existing `banner` target remains on the Status surface rather than moving to the outermost DOM element. | Owner decision; current source and tests | Current behavior |
116
+ | FR7 | `banner-frame` is additive. The existing `banner`, `banner-icon`, `banner-description`, and `banner-content` targets and their current axes remain unchanged. | Current target inventory; compatibility policy | Current behavior |
117
+ | FR8 | `status` controls visual meaning only and MUST NOT derive `role`, `aria-live`, or an announcement. Standard DOM props MAY provide an explicit persistent role, except on a Banner added inside a mounted live container (`spec:AST-086` FR4). Async outcomes MUST announce from the transition handler through `useAnnounce`, except inside a mounted live container, where `spec:AST-086` FR4 applies; `role="alert"` is reserved for genuinely urgent interruptive content. | Accessibility Checklist §Announcements; owner decision | Current behavior |
118
118
 
119
119
  ### Allowed variation
120
120
 
@@ -154,11 +154,15 @@ runtime work.
154
154
  `status` communicates visual category through color and icon; it does not choose
155
155
  announcement urgency. Banner renders no live-region role by default. A caller may
156
156
  provide `role="status"` through the standard DOM surface when the visible banner
157
- is intentionally a persistent semantic mirror. Async outcomes use `useAnnounce`
157
+ is intentionally a persistent semantic mirror, except on a Banner added inside a
158
+ mounted live container. Async outcomes use `useAnnounce`
158
159
  from the transition handler, which writes into a previously mounted live region;
160
+ inside a mounted live container, that container delivers them
161
+ (`spec:AST-086` FR4);
159
162
  a Banner mounted together with its message is not a reliable announcement.
160
163
  `role="alert"` remains available as an explicit native role, but is reserved for
161
- genuinely urgent content that should interrupt current speech.
164
+ genuinely urgent content that should interrupt current speech; it is not used on
165
+ a Banner added inside a mounted live container.
162
166
 
163
167
  Dismissal focus handoff, disclosure controls, and accessible control names remain
164
168
  unchanged.
@@ -247,8 +251,9 @@ placement and would imply that the target must remain on the outermost element.
247
251
  Banner status selects color and icon only. It does not assign `role="status"` or
248
252
  `role="alert"`. Async outcomes announce through `useAnnounce` from the transition
249
253
  handler so the message reaches a persistent live region rather than one mounted
250
- with its content. An explicit native role remains available through BaseProps for
251
- a persistent semantic mirror or the rare genuinely urgent alert.
254
+ with its content; inside a mounted live container, `spec:AST-086` FR4 applies. An explicit native role remains available through BaseProps for
255
+ a persistent semantic mirror or the rare genuinely urgent alert, except on a
256
+ Banner added inside a mounted live container.
252
257
 
253
258
  Rejected: deriving alert urgency from `warning` or `error`. Severity and urgency
254
259
  are independent, and a static error present on first paint is not an event that
@@ -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
 
@@ -498,6 +498,35 @@ describe('BottomSheet', () => {
498
498
  expect(dialog).toHaveStyle({'--_sheet-scrim-opacity': '1'});
499
499
  });
500
500
 
501
+ it('stays open when a file picker inside it is dismissed, and still closes on its own close request', () => {
502
+ // A file input fires a bubbling `cancel` at itself when its picker is
503
+ // dismissed. It reaches the <dialog> like a close request but is not one.
504
+ const onOpenChange = vi.fn();
505
+ render(
506
+ <BottomSheet
507
+ isOpen
508
+ purpose="form"
509
+ onOpenChange={onOpenChange}
510
+ label="Upload">
511
+ <input type="file" aria-label="Picture" />
512
+ </BottomSheet>,
513
+ );
514
+
515
+ const fromPicker = new Event('cancel', {bubbles: true, cancelable: true});
516
+ fireEvent(screen.getByLabelText('Picture'), fromPicker);
517
+
518
+ expect(onOpenChange).not.toHaveBeenCalled();
519
+ expect(fromPicker.defaultPrevented).toBe(false);
520
+
521
+ fireEvent(
522
+ screen.getByRole('dialog'),
523
+ new Event('cancel', {cancelable: true}),
524
+ );
525
+
526
+ expect(onOpenChange).toHaveBeenCalledTimes(1);
527
+ expect(onOpenChange).toHaveBeenCalledWith(false);
528
+ });
529
+
501
530
  it('keeps a standalone modal sheet presented through its exit animation', () => {
502
531
  render(<ExitHarness />);
503
532
  const dialog = screen.getByRole('dialog', {name: 'Filters'});
@@ -361,12 +361,16 @@ function StandaloneBottomSheet({
361
361
  });
362
362
 
363
363
  // The native `cancel` event is a close request the stack never saw a press
364
- // for (Android back, the platform close watcher). Always preventDefault so
365
- // the browser cannot close the controlled <dialog>, then answer with the
366
- // stack's rules: only the top-most layer dismisses, and nothing dismisses
367
- // during an IME composition.
364
+ // for (Android back, the platform close watcher). One that bubbles up from
365
+ // inside is not: a file input fires it when its picker is dismissed, so it is
366
+ // left alone. Otherwise always preventDefault so the browser cannot close the
367
+ // controlled <dialog>, then answer with the stack's rules: only the top-most
368
+ // layer dismisses, and nothing dismisses during an IME composition.
368
369
  const handleCancel = useCallback(
369
370
  (event: React.SyntheticEvent<HTMLDialogElement>) => {
371
+ if (event.target !== event.currentTarget) {
372
+ return;
373
+ }
370
374
  event.preventDefault();
371
375
  if (shouldDismissOnCloseRequest()) {
372
376
  dismissOnEscape();