@astryxdesign/core 0.7.2-canary.f16dc9f → 0.7.2-canary.f2b60a0

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 (307) hide show
  1. package/dist/AppShell/AppShell.d.ts.map +1 -1
  2. package/dist/AppShell/AppShell.js +40 -1
  3. package/dist/AspectRatio/AspectRatio.d.ts +6 -8
  4. package/dist/AspectRatio/AspectRatio.d.ts.map +1 -1
  5. package/dist/AspectRatio/AspectRatio.js +44 -3
  6. package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
  7. package/dist/Breadcrumbs/BreadcrumbItem.js +5 -2
  8. package/dist/CheckboxInput/CheckboxInput.d.ts +1 -1
  9. package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
  10. package/dist/CheckboxInput/CheckboxInput.js +3 -1
  11. package/dist/CheckboxList/CheckboxListItem.d.ts +9 -1
  12. package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
  13. package/dist/CheckboxList/CheckboxListItem.js +4 -2
  14. package/dist/CommandPalette/CommandPaletteInput.d.ts +1 -1
  15. package/dist/CommandPalette/CommandPaletteInput.d.ts.map +1 -1
  16. package/dist/CommandPalette/CommandPaletteInput.js +37 -5
  17. package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
  18. package/dist/ContextMenu/ContextMenu.js +5 -2
  19. package/dist/Dialog/Dialog.d.ts.map +1 -1
  20. package/dist/Dialog/Dialog.js +20 -8
  21. package/dist/Drawer/Drawer.d.ts +191 -0
  22. package/dist/Drawer/Drawer.d.ts.map +1 -0
  23. package/dist/Drawer/Drawer.js +382 -0
  24. package/dist/Drawer/DrawerHeader.d.ts +85 -0
  25. package/dist/Drawer/DrawerHeader.d.ts.map +1 -0
  26. package/dist/Drawer/DrawerHeader.js +134 -0
  27. package/dist/Drawer/index.d.ts +11 -0
  28. package/dist/Drawer/index.d.ts.map +1 -0
  29. package/dist/Drawer/index.js +11 -0
  30. package/dist/Drawer/useDrawerDialogPresence.d.ts +42 -0
  31. package/dist/Drawer/useDrawerDialogPresence.d.ts.map +1 -0
  32. package/dist/Drawer/useDrawerDialogPresence.js +236 -0
  33. package/dist/DropdownMenu/DropdownMenu.d.ts +1 -1
  34. package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  35. package/dist/DropdownMenu/DropdownMenu.js +83 -11
  36. package/dist/DropdownMenu/DropdownMenuContext.d.ts +17 -0
  37. package/dist/DropdownMenu/DropdownMenuContext.d.ts.map +1 -1
  38. package/dist/DropdownMenu/DropdownMenuContext.js +21 -0
  39. package/dist/DropdownMenu/DropdownMenuDivider.d.ts +5 -3
  40. package/dist/DropdownMenu/DropdownMenuDivider.d.ts.map +1 -1
  41. package/dist/DropdownMenu/DropdownMenuDivider.js +7 -3
  42. package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
  43. package/dist/DropdownMenu/DropdownMenuSubMenu.js +19 -8
  44. package/dist/DropdownMenu/lazyMenuBottomSheet.d.ts +24 -0
  45. package/dist/DropdownMenu/lazyMenuBottomSheet.d.ts.map +1 -0
  46. package/dist/DropdownMenu/lazyMenuBottomSheet.js +46 -0
  47. package/dist/EmptyState/EmptyState.d.ts.map +1 -1
  48. package/dist/EmptyState/EmptyState.js +4 -10
  49. package/dist/Field/Field.d.ts +1 -1
  50. package/dist/Field/Field.d.ts.map +1 -1
  51. package/dist/Field/Field.js +8 -4
  52. package/dist/Grid/GridSpan.d.ts.map +1 -1
  53. package/dist/Grid/GridSpan.js +1 -0
  54. package/dist/Heading/Heading.d.ts.map +1 -1
  55. package/dist/Heading/Heading.js +4 -2
  56. package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
  57. package/dist/HoverCard/useHoverCard.js +10 -2
  58. package/dist/Item/Item.d.ts +6 -2
  59. package/dist/Item/Item.d.ts.map +1 -1
  60. package/dist/Item/Item.js +19 -4
  61. package/dist/Layer/layerViewportInset.stylex.d.ts +6 -2
  62. package/dist/Layer/layerViewportInset.stylex.d.ts.map +1 -1
  63. package/dist/Layer/layerViewportInset.stylex.js +6 -2
  64. package/dist/Layer/useLayer.d.ts.map +1 -1
  65. package/dist/Layer/useLayer.js +13 -7
  66. package/dist/Layer/useLayerDismissal.d.ts +1 -1
  67. package/dist/Layer/useLayerDismissal.js +1 -1
  68. package/dist/Layout/container.stylex.d.ts +5 -5
  69. package/dist/Layout/container.stylex.js +4 -4
  70. package/dist/List/List.d.ts +46 -19
  71. package/dist/List/List.d.ts.map +1 -1
  72. package/dist/List/List.js +28 -10
  73. package/dist/List/ListContext.d.ts +8 -3
  74. package/dist/List/ListContext.d.ts.map +1 -1
  75. package/dist/List/ListContext.js +7 -2
  76. package/dist/List/ListItem.d.ts +13 -5
  77. package/dist/List/ListItem.d.ts.map +1 -1
  78. package/dist/List/ListItem.js +21 -8
  79. package/dist/List/index.d.ts +1 -1
  80. package/dist/List/index.d.ts.map +1 -1
  81. package/dist/Markdown/Markdown.d.ts.map +1 -1
  82. package/dist/Markdown/Markdown.js +8 -1
  83. package/dist/Markdown/plugins/frontmatter.d.ts.map +1 -1
  84. package/dist/Markdown/plugins/frontmatter.js +7 -3
  85. package/dist/MetadataList/MetadataList.d.ts.map +1 -1
  86. package/dist/MetadataList/MetadataList.js +5 -1
  87. package/dist/MetadataList/MetadataListContext.d.ts +1 -1
  88. package/dist/MetadataList/MetadataListContext.d.ts.map +1 -1
  89. package/dist/MobileNav/MobileNav.d.ts +9 -0
  90. package/dist/MobileNav/MobileNav.d.ts.map +1 -1
  91. package/dist/MobileNav/MobileNav.js +30 -3
  92. package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
  93. package/dist/MultiSelector/MultiSelector.js +22 -8
  94. package/dist/MultiSelector/OptionActions.a11y.chromium.spec.js +100 -2
  95. package/dist/Popover/Popover.js +2 -2
  96. package/dist/RadioList/RadioList.d.ts +1 -1
  97. package/dist/RadioList/RadioList.d.ts.map +1 -1
  98. package/dist/RadioList/RadioList.js +6 -2
  99. package/dist/RadioList/RadioListItem.d.ts +9 -1
  100. package/dist/RadioList/RadioListItem.d.ts.map +1 -1
  101. package/dist/RadioList/RadioListItem.js +2 -0
  102. package/dist/SideNav/SideNavItem.d.ts +8 -1
  103. package/dist/SideNav/SideNavItem.d.ts.map +1 -1
  104. package/dist/SideNav/SideNavItem.js +71 -9
  105. package/dist/TabList/TabMenu.d.ts +2 -2
  106. package/dist/TabList/TabMenu.d.ts.map +1 -1
  107. package/dist/TabList/TabMenu.js +6 -3
  108. package/dist/Text/Text.d.ts.map +1 -1
  109. package/dist/Text/Text.js +4 -2
  110. package/dist/Text/useTruncation.d.ts +7 -5
  111. package/dist/Text/useTruncation.d.ts.map +1 -1
  112. package/dist/Text/useTruncation.js +16 -5
  113. package/dist/ToggleButton/ToggleButton.d.ts +3 -2
  114. package/dist/ToggleButton/ToggleButton.d.ts.map +1 -1
  115. package/dist/ToggleButton/ToggleButton.js +12 -1
  116. package/dist/TopNav/TopNavMegaMenu.d.ts.map +1 -1
  117. package/dist/TopNav/TopNavMegaMenu.js +3 -3
  118. package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
  119. package/dist/TopNav/TopNavMenu.js +3 -3
  120. package/dist/TreeList/TreeList.d.ts.map +1 -1
  121. package/dist/TreeList/TreeList.js +1 -0
  122. package/dist/TreeList/TreeListBranches.d.ts.map +1 -1
  123. package/dist/TreeList/TreeListBranches.js +2 -2
  124. package/dist/TreeList/TreeListItem.d.ts.map +1 -1
  125. package/dist/TreeList/TreeListItem.js +57 -9
  126. package/dist/astryx.css +46 -13
  127. package/dist/hooks/useEntryAnimation.d.ts +2 -1
  128. package/dist/hooks/useEntryAnimation.d.ts.map +1 -1
  129. package/dist/hooks/useEntryAnimation.js +14 -12
  130. package/dist/hooks/useIsHydrating.d.ts +6 -0
  131. package/dist/hooks/useIsHydrating.d.ts.map +1 -0
  132. package/dist/hooks/useIsHydrating.js +30 -0
  133. package/dist/hooks/useMenuHover.d.ts.map +1 -1
  134. package/dist/hooks/useMenuHover.js +18 -13
  135. package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
  136. package/dist/i18n/generated-locales/en.generated.js +93 -1
  137. package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
  138. package/dist/i18n/generated-locales/pseudo.generated.js +93 -1
  139. package/dist/index.d.ts +1 -0
  140. package/dist/index.d.ts.map +1 -1
  141. package/dist/index.js +1 -0
  142. package/dist/theme/derivedVarRegistry.d.ts.map +1 -1
  143. package/dist/theme/derivedVarRegistry.js +0 -3
  144. package/dist/utils/focusOutline.stylex.d.ts +4 -0
  145. package/dist/utils/focusOutline.stylex.d.ts.map +1 -1
  146. package/dist/utils/focusOutline.stylex.js +4 -0
  147. package/dist/utils/plainDate.d.ts.map +1 -1
  148. package/dist/utils/plainDate.js +15 -9
  149. package/dist/utils/sharedMutationObserver.d.ts +21 -0
  150. package/dist/utils/sharedMutationObserver.d.ts.map +1 -0
  151. package/dist/utils/sharedMutationObserver.js +69 -0
  152. package/locales/en.json +368 -0
  153. package/locales/pseudo.json +276 -0
  154. package/package.json +8 -3
  155. package/scripts/agent-doc-state.mjs +38 -0
  156. package/scripts/postinstall.mjs +1 -1
  157. package/src/AppShell/AppShell.tsx +45 -1
  158. package/src/AspectRatio/AspectRatio.test.tsx +44 -43
  159. package/src/AspectRatio/AspectRatio.tsx +38 -18
  160. package/src/AspectRatio/__tests__/AspectRatioFitLayers.a11y.browser.spec.ts +157 -0
  161. package/src/Avatar/Avatar.doc.mjs +5 -3
  162. package/src/AvatarGroup/AvatarGroup.doc.mjs +3 -2
  163. package/src/Breadcrumbs/BreadcrumbItem.tsx +4 -1
  164. package/src/Breadcrumbs/Breadcrumbs.test.tsx +30 -1
  165. package/src/Card/Card.doc.mjs +1 -1
  166. package/src/Chat/__tests__/ChatMessageMetadata.a11y.chromium.spec.ts +3 -1
  167. package/src/CheckboxInput/CheckboxInput.test.tsx +34 -0
  168. package/src/CheckboxInput/CheckboxInput.tsx +3 -1
  169. package/src/CheckboxList/CheckboxList.test.tsx +22 -0
  170. package/src/CheckboxList/CheckboxListItem.doc.mjs +16 -0
  171. package/src/CheckboxList/CheckboxListItem.tsx +10 -0
  172. package/src/CommandPalette/CommandPaletteInput.test.tsx +53 -4
  173. package/src/CommandPalette/CommandPaletteInput.tsx +33 -3
  174. package/src/CommandPalette/__tests__/CommandPaletteInputAudit.a11y.chromium.spec.ts +335 -0
  175. package/src/CommandPalette/__tests__/CommandPaletteItemAudit.a11y.chromium.spec.ts +292 -0
  176. package/src/ContextMenu/ContextMenu.doc.mjs +2 -3
  177. package/src/ContextMenu/ContextMenu.tsx +4 -1
  178. package/src/ContextMenu/__tests__/ContextMenuAudit.a11y.chromium.spec.ts +438 -0
  179. package/src/Dialog/Dialog.test.tsx +46 -0
  180. package/src/Dialog/Dialog.tsx +20 -7
  181. package/src/Dialog/__tests__/Dialog.a11y.known-failures.ts +0 -14
  182. package/src/Drawer/Drawer.doc.mjs +472 -0
  183. package/src/Drawer/Drawer.spec.md +357 -0
  184. package/src/Drawer/Drawer.test.tsx +1300 -0
  185. package/src/Drawer/Drawer.tsx +613 -0
  186. package/src/Drawer/DrawerDirection.test.tsx +127 -0
  187. package/src/Drawer/DrawerHeader.doc.mjs +293 -0
  188. package/src/Drawer/DrawerHeader.test.tsx +102 -0
  189. package/src/Drawer/DrawerHeader.tsx +235 -0
  190. package/src/Drawer/__tests__/DrawerAudit.a11y.chromium.spec.ts +401 -0
  191. package/src/Drawer/__tests__/DrawerHeaderAudit.a11y.chromium.spec.ts +297 -0
  192. package/src/Drawer/index.ts +13 -0
  193. package/src/Drawer/useDrawerDialogPresence.ts +284 -0
  194. package/src/DropdownMenu/DropdownMenu.ssr.test.tsx +57 -0
  195. package/src/DropdownMenu/DropdownMenu.test.tsx +76 -14
  196. package/src/DropdownMenu/DropdownMenu.tsx +83 -12
  197. package/src/DropdownMenu/DropdownMenuContext.tsx +24 -0
  198. package/src/DropdownMenu/DropdownMenuDivider.doc.mjs +2 -2
  199. package/src/DropdownMenu/DropdownMenuDivider.spec.md +192 -0
  200. package/src/DropdownMenu/DropdownMenuDivider.tsx +9 -5
  201. package/src/DropdownMenu/DropdownMenuLazySheet.test.tsx +126 -0
  202. package/src/DropdownMenu/DropdownMenuSubMenu.test.tsx +185 -0
  203. package/src/DropdownMenu/DropdownMenuSubMenu.tsx +19 -5
  204. package/src/DropdownMenu/__tests__/DropdownMenuDividerAudit.a11y.chromium.spec.ts +280 -0
  205. package/src/DropdownMenu/__tests__/Menu.a11y.chromium.spec.ts +145 -0
  206. package/src/DropdownMenu/__tests__/Menu.a11y.known-failures.ts +26 -0
  207. package/src/DropdownMenu/__tests__/Menu.a11y.renders.tsx +65 -0
  208. package/src/DropdownMenu/__tests__/Menu.a11y.states.ts +138 -0
  209. package/src/DropdownMenu/__tests__/Menu.a11y.test.tsx +136 -0
  210. package/src/DropdownMenu/__tests__/warmMenuBottomSheet.tsx +43 -0
  211. package/src/DropdownMenu/lazyMenuBottomSheet.ts +71 -0
  212. package/src/EmptyState/EmptyState.doc.mjs +3 -2
  213. package/src/EmptyState/EmptyState.spec.md +189 -0
  214. package/src/EmptyState/EmptyState.test.tsx +74 -3
  215. package/src/EmptyState/EmptyState.tsx +4 -8
  216. package/src/Field/Field.doc.mjs +14 -8
  217. package/src/Field/Field.spec.md +217 -0
  218. package/src/Field/Field.test.tsx +60 -2
  219. package/src/Field/Field.tsx +17 -8
  220. package/src/Grid/GridSpan.tsx +3 -0
  221. package/src/Heading/Heading.test.tsx +57 -0
  222. package/src/Heading/Heading.tsx +6 -2
  223. package/src/HoverCard/HoverCard.test.tsx +58 -0
  224. package/src/HoverCard/useHoverCard.tsx +10 -2
  225. package/src/Item/Item.doc.mjs +12 -8
  226. package/src/Item/Item.spec.md +226 -0
  227. package/src/Item/Item.test.tsx +61 -0
  228. package/src/Item/Item.tsx +40 -4
  229. package/src/Layer/layerViewportInset.source-build.test.mjs +90 -0
  230. package/src/Layer/layerViewportInset.stylex.ts +6 -2
  231. package/src/Layer/layerViewportInset.test.ts +1 -0
  232. package/src/Layer/useLayer.tsx +24 -13
  233. package/src/Layer/useLayerDismissal.ts +1 -1
  234. package/src/Layout/container.stylex.ts +6 -6
  235. package/src/List/List.doc.mjs +14 -1
  236. package/src/List/List.spec.md +129 -77
  237. package/src/List/List.test.tsx +163 -94
  238. package/src/List/List.tsx +74 -18
  239. package/src/List/ListContext.tsx +9 -3
  240. package/src/List/ListItem.doc.mjs +16 -0
  241. package/src/List/ListItem.tsx +56 -27
  242. package/src/List/index.ts +1 -1
  243. package/src/Markdown/Markdown.tsx +14 -1
  244. package/src/Markdown/plugins/frontmatter.test.tsx +25 -0
  245. package/src/Markdown/plugins/frontmatter.ts +7 -3
  246. package/src/MetadataList/MetadataList.doc.mjs +2 -2
  247. package/src/MetadataList/MetadataList.test.tsx +38 -0
  248. package/src/MetadataList/MetadataList.tsx +8 -1
  249. package/src/MetadataList/MetadataListContext.tsx +1 -1
  250. package/src/MobileNav/MobileNav.tsx +30 -3
  251. package/src/MobileNav/MobileNavCloseEdgeCases.test.tsx +173 -15
  252. package/src/MoreMenu/MoreMenu.test.tsx +5 -1
  253. package/src/MultiSelector/MultiSelector.test.tsx +159 -0
  254. package/src/MultiSelector/MultiSelector.tsx +40 -7
  255. package/src/MultiSelector/OptionActions.a11y.chromium.spec.ts +112 -2
  256. package/src/Popover/Popover.test.tsx +2 -2
  257. package/src/Popover/Popover.tsx +4 -4
  258. package/src/RadioList/RadioList.fr10.test.tsx +45 -2
  259. package/src/RadioList/RadioList.test.tsx +22 -0
  260. package/src/RadioList/RadioList.tsx +4 -1
  261. package/src/RadioList/RadioListItem.doc.mjs +16 -0
  262. package/src/RadioList/RadioListItem.tsx +10 -1
  263. package/src/SideNav/SideNav.test.tsx +179 -0
  264. package/src/SideNav/SideNavItem.doc.mjs +2 -2
  265. package/src/SideNav/SideNavItem.tsx +96 -17
  266. package/src/Slider/Slider.spec.md +39 -18
  267. package/src/TabList/TabList.spec.md +57 -44
  268. package/src/TabList/TabList.test.tsx +67 -0
  269. package/src/TabList/TabMenu.doc.mjs +4 -3
  270. package/src/TabList/TabMenu.tsx +7 -4
  271. package/src/Text/Text.test.tsx +57 -0
  272. package/src/Text/Text.tsx +6 -2
  273. package/src/Text/useTruncation.test.tsx +69 -0
  274. package/src/Text/useTruncation.ts +16 -5
  275. package/src/TimeInput/TimeInput.fr10.test.tsx +15 -0
  276. package/src/ToggleButton/ToggleButton.test.tsx +95 -0
  277. package/src/ToggleButton/ToggleButton.tsx +12 -1
  278. package/src/Tooltip/Tooltip.test.tsx +31 -0
  279. package/src/TopNav/TopNavMegaMenu.test.tsx +22 -0
  280. package/src/TopNav/TopNavMegaMenu.tsx +7 -3
  281. package/src/TopNav/TopNavMenu.test.tsx +19 -0
  282. package/src/TopNav/TopNavMenu.tsx +11 -3
  283. package/src/TreeList/TreeList.doc.mjs +1 -0
  284. package/src/TreeList/TreeList.spec.md +29 -17
  285. package/src/TreeList/TreeList.test.tsx +327 -6
  286. package/src/TreeList/TreeList.tsx +5 -1
  287. package/src/TreeList/TreeListBranches.tsx +6 -0
  288. package/src/TreeList/TreeListItem.tsx +88 -13
  289. package/src/docPropLiterals.test.ts +36 -10
  290. package/src/hooks/useEntryAnimation.doc.mjs +4 -4
  291. package/src/hooks/useEntryAnimation.ssr.test.tsx +143 -0
  292. package/src/hooks/useEntryAnimation.ts +15 -16
  293. package/src/hooks/useIsHydrating.test.tsx +70 -0
  294. package/src/hooks/useIsHydrating.ts +31 -0
  295. package/src/hooks/useMenuHover.ts +18 -13
  296. package/src/i18n/generated-locales/en.generated.ts +100 -0
  297. package/src/i18n/generated-locales/pseudo.generated.ts +100 -0
  298. package/src/index.ts +1 -0
  299. package/src/postinstall.test.mjs +46 -0
  300. package/src/reset.css +0 -29
  301. package/src/theme/derivedVarRegistry.test.ts +7 -3
  302. package/src/theme/derivedVarRegistry.ts +0 -3
  303. package/src/utils/focusOutline.stylex.ts +4 -0
  304. package/src/utils/plainDate.test.ts +37 -1
  305. package/src/utils/plainDate.ts +15 -5
  306. package/src/utils/sharedMutationObserver.test.ts +53 -0
  307. package/src/utils/sharedMutationObserver.ts +78 -0
@@ -395,7 +395,9 @@ test('captures narrow touch reflow in both modes', async ({browser}) => {
395
395
  try {
396
396
  const page = await context.newPage();
397
397
  const scenario = CASES.find(item => item.name === 'narrow-overflow');
398
- if (!scenario) {throw new Error('Narrow metadata fixture is missing');}
398
+ if (!scenario) {
399
+ throw new Error('Narrow metadata fixture is missing');
400
+ }
399
401
  const failures: string[] = [];
400
402
  for (const mode of ['light', 'dark'] as const) {
401
403
  failures.push(
@@ -209,6 +209,40 @@ describe('CheckboxInput', () => {
209
209
  );
210
210
  });
211
211
 
212
+ it('preserves a caller-provided id on the input and its label', () => {
213
+ render(
214
+ <CheckboxInput
215
+ id="accept-terms"
216
+ label="Accept terms"
217
+ value={false}
218
+ onChange={() => {}}
219
+ />,
220
+ );
221
+
222
+ const checkbox = screen.getByRole('checkbox');
223
+ expect(checkbox).toHaveAttribute('id', 'accept-terms');
224
+ expect(screen.getByText('Accept terms').closest('label')).toHaveAttribute(
225
+ 'for',
226
+ 'accept-terms',
227
+ );
228
+ expect(screen.getByLabelText('Accept terms')).toBe(checkbox);
229
+ });
230
+
231
+ it('generates an id the label resolves when the caller passes an empty id', () => {
232
+ render(
233
+ <CheckboxInput
234
+ id=""
235
+ label="Accept terms"
236
+ value={false}
237
+ onChange={() => {}}
238
+ />,
239
+ );
240
+
241
+ const checkbox = screen.getByRole('checkbox');
242
+ expect(checkbox.id).not.toBe('');
243
+ expect(screen.getByLabelText('Accept terms')).toBe(checkbox);
244
+ });
245
+
212
246
  it('forwards arbitrary data-* attributes to the input', () => {
213
247
  render(
214
248
  <CheckboxInput
@@ -311,6 +311,7 @@ const dynamicWidthStyles = stylex.create({
311
311
  * ```
312
312
  */
313
313
  export function CheckboxInput({
314
+ id: idProp,
314
315
  label,
315
316
  isLabelHidden = false,
316
317
  description,
@@ -340,7 +341,8 @@ export function CheckboxInput({
340
341
  // The row is the pressable: the overlay's pressed arm reads the row's
341
342
  // scope marker, the way the indicator's hover tint does.
342
343
  const pressable = usePressFeedback();
343
- const id = useId();
344
+ const generatedId = useId();
345
+ const id = idProp || generatedId;
344
346
  const descriptionID = useId();
345
347
  const statusMessageID = useId();
346
348
  // Announce the effective required state (form default included) while the
@@ -59,6 +59,28 @@ beforeEach(() => {
59
59
  });
60
60
 
61
61
  describe('CheckboxList', () => {
62
+ it('forwards CheckboxListItem align to its Item row unchanged', () => {
63
+ render(
64
+ <CheckboxList label="Toppings" value={[]} onChange={() => {}}>
65
+ <CheckboxListItem label="Cheese" value="cheese" data-testid="cheese" />
66
+ <CheckboxListItem
67
+ label="Olives"
68
+ value="olives"
69
+ align="first-line"
70
+ data-testid="olives"
71
+ />
72
+ </CheckboxList>,
73
+ );
74
+ expect(screen.getByTestId('cheese')).toHaveAttribute(
75
+ 'data-align',
76
+ 'center',
77
+ );
78
+ expect(screen.getByTestId('olives')).toHaveAttribute(
79
+ 'data-align',
80
+ 'first-line',
81
+ );
82
+ });
83
+
62
84
  it('renders with label', () => {
63
85
  render(
64
86
  <CheckboxList label="Preferences" value={[]} onChange={() => {}}>
@@ -55,6 +55,13 @@ export const docs = {
55
55
  },
56
56
  ],
57
57
  },
58
+ {
59
+ name: 'align',
60
+ type: "'center' | 'start' | 'first-line'",
61
+ description:
62
+ 'Vertical alignment of the start and end content against the label, passed through to Item unchanged. `first-line` keeps a small mark (a checkbox) level with the first line of a wrapped label. See Item.align.',
63
+ default: "'center'",
64
+ },
58
65
  {
59
66
  name: 'isDisabled',
60
67
  type: 'boolean',
@@ -130,6 +137,13 @@ export const docsZh = {
130
137
  type: 'ReactNode',
131
138
  description: '在标签区域后渲染的内容。',
132
139
  },
140
+ {
141
+ name: 'align',
142
+ type: "'center' | 'start' | 'first-line'",
143
+ description:
144
+ '起始和结束内容相对于标签的垂直对齐方式,原样传递给 Item。`first-line` 让小标记(复选框)与换行标签的第一行保持水平。参见 Item.align。',
145
+ default: "'center'",
146
+ },
133
147
  {
134
148
  name: 'isDisabled',
135
149
  type: 'boolean',
@@ -165,6 +179,8 @@ export const docsDense = {
165
179
  description:
166
180
  'Individual checkbox item w/ label, description, end content slot. Collection mode inside CheckboxList with value; standalone inside List or CheckboxList without value.',
167
181
  propDescriptions: {
182
+ align:
183
+ "Start/end content alignment, passed to Item: 'center' (default), 'start', or 'first-line' (centered on the label's first line).",
168
184
  label:
169
185
  'Primary label. String or ReactNode; nested controls keep their behavior. A ReactNode names the checkbox from its visible text.',
170
186
  'aria-label':
@@ -29,6 +29,7 @@ import {ListContext} from '../List/ListContext';
29
29
  import {CheckboxListContext} from './CheckboxListContext';
30
30
  import {useTranslator} from '../i18n';
31
31
  import {ItemDescriptionContext} from '../Item/ItemDescriptionContext';
32
+ import type {ItemAlign} from '../Item';
32
33
 
33
34
  // =============================================================================
34
35
  // Styles
@@ -45,6 +46,13 @@ const styles = stylex.create({
45
46
  // =============================================================================
46
47
 
47
48
  export interface CheckboxListItemProps extends BaseProps<HTMLLIElement> {
49
+ /**
50
+ * Vertical alignment of the start and end content against the label,
51
+ * forwarded to Item. Use `first-line` to keep the checkbox level with the
52
+ * first line of a wrapped label.
53
+ * @default 'center'
54
+ */
55
+ align?: ItemAlign;
48
56
  /**
49
57
  * Primary text label for the item.
50
58
  *
@@ -192,6 +200,7 @@ export function CheckboxListItem({
192
200
  className,
193
201
  style,
194
202
  onClick: onClickProp,
203
+ align,
195
204
  ...restProps
196
205
  }: CheckboxListItemProps) {
197
206
  const t = useTranslator();
@@ -297,6 +306,7 @@ export function CheckboxListItem({
297
306
  label={namesFromVisibleLabel ? <span id={labelID}>{label}</span> : label}
298
307
  description={description}
299
308
  endContent={endContent}
309
+ align={align}
300
310
  isDisabled={effectiveDisabled}
301
311
  // Delegate row clicks to the checkbox instead of wiring onClick (which
302
312
  // would add an invisible row button = a second tab stop). The checkbox
@@ -8,12 +8,19 @@
8
8
  */
9
9
 
10
10
  import {createRef} from 'react';
11
- import {describe, it, expect, vi} from 'vitest';
12
- import {render, screen, fireEvent} from '@testing-library/react';
11
+ import {describe, it, expect, vi, beforeEach} from 'vitest';
12
+ import {render, screen, fireEvent, act} from '@testing-library/react';
13
+ import * as stylex from '@stylexjs/stylex';
13
14
  import {CommandPaletteInput} from './CommandPaletteInput';
14
15
  import {CommandPaletteContext} from './CommandPaletteContext';
15
16
  import {Dialog} from '../Dialog';
16
17
  import type {CommandPaletteContextValue} from './CommandPaletteContext';
18
+ import {focusOutlineStyles} from '../utils/focusOutline.stylex';
19
+ import {__resetInteractionModalityForTest} from '../utils/interactionModality';
20
+
21
+ beforeEach(() => {
22
+ __resetInteractionModalityForTest();
23
+ });
17
24
 
18
25
  function makeContext(
19
26
  overrides: Partial<CommandPaletteContextValue> = {},
@@ -279,6 +286,45 @@ describe('CommandPaletteInput', () => {
279
286
  },
280
287
  );
281
288
 
289
+ it('draws the shared ring only when keyboard navigation acquired focus', () => {
290
+ render(<CommandPaletteInput hasAutoFocus={false} />);
291
+ const input = screen.getByRole('searchbox');
292
+ const ringClasses = stylex
293
+ .props(focusOutlineStyles.focusVisible)
294
+ .className!.split(' ');
295
+ const isRinged = () =>
296
+ ringClasses.every(className => input.classList.contains(className));
297
+
298
+ fireEvent.pointerDown(input);
299
+ fireEvent.focus(input);
300
+ expect(isRinged()).toBe(false);
301
+
302
+ fireEvent.blur(input);
303
+ fireEvent.keyDown(input, {key: 'Tab'});
304
+ fireEvent.focus(input);
305
+ expect(isRinged()).toBe(true);
306
+ });
307
+
308
+ it('preserves caller focus and blur handlers while tracking modality', () => {
309
+ const onFocus = vi.fn();
310
+ const onBlur = vi.fn();
311
+ render(
312
+ <CommandPaletteInput
313
+ hasAutoFocus={false}
314
+ onFocus={onFocus}
315
+ onBlur={onBlur}
316
+ />,
317
+ );
318
+ const input = screen.getByRole('searchbox');
319
+
320
+ fireEvent.keyDown(input, {key: 'Tab'});
321
+ fireEvent.focus(input);
322
+ fireEvent.blur(input);
323
+
324
+ expect(onFocus).toHaveBeenCalledTimes(1);
325
+ expect(onBlur).toHaveBeenCalledTimes(1);
326
+ });
327
+
282
328
  it('does not schedule focus when hasAutoFocus is false', async () => {
283
329
  const focusSpy = vi.spyOn(HTMLElement.prototype, 'focus');
284
330
  render(<CommandPaletteInput hasAutoFocus={false} />);
@@ -481,8 +527,11 @@ describe('CommandPaletteInput popup context', () => {
481
527
  </CommandPaletteContext>,
482
528
  );
483
529
 
484
- await vi.waitFor(() => {
485
- expect(screen.getByRole('combobox')).toHaveFocus();
530
+ await act(async () => {
531
+ await new Promise<void>(resolve =>
532
+ requestAnimationFrame(() => resolve()),
533
+ );
486
534
  });
535
+ expect(screen.getByRole('combobox')).toHaveFocus();
487
536
  });
488
537
  });
@@ -13,7 +13,7 @@
13
13
  * - /packages/cli/assets/templates/blocks/components/CommandPalette/ (showcase blocks)
14
14
  */
15
15
 
16
- import {useCallback, useEffect, useRef, type ReactNode} from 'react';
16
+ import {useCallback, useEffect, useRef, useState, type ReactNode} from 'react';
17
17
  import * as stylex from '@stylexjs/stylex';
18
18
  import {Icon} from '../Icon';
19
19
  import {Spinner} from '../Spinner';
@@ -28,6 +28,11 @@ import {useCommandPaletteContext} from './CommandPaletteContext';
28
28
  import {useDialogContext} from '../Dialog/DialogContext';
29
29
  import type {BaseProps} from '../BaseProps';
30
30
  import {themeProps} from '../utils/themeProps';
31
+ import {focusOutlineProps} from '../utils/focusOutline.stylex';
32
+ import {
33
+ getInteractionModality,
34
+ useInteractionModalityTracking,
35
+ } from '../utils/interactionModality';
31
36
  import {useTranslator} from '../i18n';
32
37
 
33
38
  import {useMergedRefs} from '../hooks/useMergedRefs';
@@ -71,7 +76,6 @@ const styles = stylex.create({
71
76
  minWidth: 0,
72
77
  borderWidth: 0,
73
78
  borderStyle: 'none',
74
- outline: 'none',
75
79
  backgroundColor: 'transparent',
76
80
  color: colorVars['--color-text-primary'],
77
81
  fontFamily: typographyVars['--font-family-body'],
@@ -169,6 +173,8 @@ export function CommandPaletteInput({
169
173
  endContent,
170
174
  onChange,
171
175
  onKeyDown,
176
+ onFocus,
177
+ onBlur,
172
178
  ref,
173
179
  xstyle,
174
180
  className,
@@ -184,6 +190,26 @@ export function CommandPaletteInput({
184
190
  const hasListbox = ctx ? ctx.selectableItems.length > 0 : true;
185
191
  const dialogContext = useDialogContext();
186
192
  const inputRef = useRef<HTMLInputElement>(null);
193
+ const [isKeyboardFocus, setIsKeyboardFocus] = useState(false);
194
+
195
+ // Text-entry controls match :focus-visible after pointer focus in Chromium.
196
+ // Keep the shared selector, but narrow its ring to focus acquired through
197
+ // keyboard navigation so a click or pointer-opened palette stays unringed.
198
+ useInteractionModalityTracking();
199
+ const handleFocus = useCallback(
200
+ (event: React.FocusEvent<HTMLInputElement>) => {
201
+ setIsKeyboardFocus(getInteractionModality() === 'keyboard');
202
+ onFocus?.(event);
203
+ },
204
+ [onFocus],
205
+ );
206
+ const handleBlur = useCallback(
207
+ (event: React.FocusEvent<HTMLInputElement>) => {
208
+ setIsKeyboardFocus(false);
209
+ onBlur?.(event);
210
+ },
211
+ [onBlur],
212
+ );
187
213
 
188
214
  // Use context values as fallback
189
215
  const value = controlledValue ?? ctx?.search;
@@ -259,7 +285,9 @@ export function CommandPaletteInput({
259
285
  <input
260
286
  {...props}
261
287
  ref={useMergedRefs(ref, inputRef)}
262
- {...stylex.props(styles.input)}
288
+ {...(isKeyboardFocus
289
+ ? focusOutlineProps.focusVisible(styles.input)
290
+ : focusOutlineProps.suppressed(styles.input))}
263
291
  type="text"
264
292
  role={ctx ? 'combobox' : standaloneRole}
265
293
  aria-expanded={
@@ -300,6 +328,8 @@ export function CommandPaletteInput({
300
328
  onChange?.(e);
301
329
  }}
302
330
  onKeyDown={handleKeyDown}
331
+ onFocus={handleFocus}
332
+ onBlur={handleBlur}
303
333
  />
304
334
  {(ctx?.isBusy || hasEndContent) && (
305
335
  <span {...stylex.props(styles.end)}>
@@ -0,0 +1,335 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file CommandPaletteInputAudit.a11y.chromium.spec.ts
5
+ * @input Exact-head CommandPaletteInput stories across semantic, theme, direction, viewport, and focus states
6
+ * @output Screenshots and fail-closed sensor receipts for the CommandPaletteInput whole-component audit
7
+ * @position Component-owned Night Watch browser evidence; CI runs it only for a CommandPaletteInput audit pull request
8
+ */
9
+
10
+ import {createHash} from 'node:crypto';
11
+ import {execFileSync} from 'node:child_process';
12
+ import * as fs from 'node:fs';
13
+ import * as path from 'node:path';
14
+ import {expect, test, type Locator, type Page} from '@playwright/test';
15
+ import {holdMotionStill} from '@astryxdesign/a11y-spec/chromium';
16
+ import {
17
+ DEFAULT_STORYBOOK_DIR,
18
+ serveStorybook,
19
+ type StaticServer,
20
+ } from '@astryxdesign/a11y-spec/storybook';
21
+
22
+ const OUTPUT = path.resolve('command-palette-input-audit-evidence');
23
+ const WIDE = {width: 1024, height: 768};
24
+ const NARROW = {width: 320, height: 720};
25
+
26
+ type Mode = 'light' | 'dark';
27
+ type Direction = 'ltr' | 'rtl';
28
+ type Theme = 'neutral' | 'butter';
29
+ type Story = 'standalone' | 'popup-context' | 'aggregate-matrix';
30
+ type State = 'rest' | 'keyboard-focus' | 'pointer-focus' | 'context-matrix';
31
+
32
+ type AuditReceipt = {
33
+ passed: boolean;
34
+ expected: Record<string, unknown>;
35
+ };
36
+
37
+ type AuditCase = {
38
+ key: string;
39
+ story: Story;
40
+ mode: Mode;
41
+ direction: Direction;
42
+ theme: Theme;
43
+ state: State;
44
+ viewport: {width: number; height: number};
45
+ };
46
+
47
+ const cases: AuditCase[] = [];
48
+ function addPair(
49
+ key: string,
50
+ options: Partial<Omit<AuditCase, 'key' | 'mode'>> = {},
51
+ ) {
52
+ for (const mode of ['light', 'dark'] as const) {
53
+ cases.push({
54
+ key: `${key}-${mode}`,
55
+ story: options.story ?? 'standalone',
56
+ mode,
57
+ direction: options.direction ?? 'ltr',
58
+ theme: options.theme ?? 'neutral',
59
+ state: options.state ?? 'rest',
60
+ viewport: options.viewport ?? WIDE,
61
+ });
62
+ }
63
+ }
64
+
65
+ addPair('standalone-rest');
66
+ addPair('standalone-keyboard-focus', {state: 'keyboard-focus'});
67
+ addPair('standalone-pointer-focus', {state: 'pointer-focus'});
68
+ addPair('standalone-keyboard-focus-custom-theme', {
69
+ state: 'keyboard-focus',
70
+ theme: 'butter',
71
+ });
72
+ addPair('standalone-keyboard-focus-rtl', {
73
+ state: 'keyboard-focus',
74
+ direction: 'rtl',
75
+ });
76
+ addPair('standalone-keyboard-focus-narrow', {
77
+ state: 'keyboard-focus',
78
+ viewport: NARROW,
79
+ });
80
+ addPair('popup-rest', {story: 'popup-context'});
81
+ addPair('popup-keyboard-focus', {
82
+ story: 'popup-context',
83
+ state: 'keyboard-focus',
84
+ });
85
+ addPair('popup-pointer-focus', {
86
+ story: 'popup-context',
87
+ state: 'pointer-focus',
88
+ });
89
+ addPair('context-matrix', {
90
+ story: 'aggregate-matrix',
91
+ state: 'context-matrix',
92
+ });
93
+
94
+ test.describe.configure({mode: 'serial', retries: 0});
95
+ let server: StaticServer;
96
+ let checkoutSha: string;
97
+ let storybookSha: string;
98
+
99
+ function storyId(item: AuditCase) {
100
+ return item.story === 'aggregate-matrix'
101
+ ? 'core-commandpalette--audit-matrix'
102
+ : `core-commandpaletteinput--${item.story}`;
103
+ }
104
+
105
+ function storyUrl(item: AuditCase) {
106
+ return `${server.origin}/iframe.html?id=${storyId(item)}&viewMode=story&globals=colorMode:${item.mode};astryxTheme:${item.theme};direction:${item.direction}`;
107
+ }
108
+
109
+ async function settle(page: Page) {
110
+ await holdMotionStill(page);
111
+ await page.evaluate(async () => document.fonts.ready);
112
+ await page.waitForTimeout(40);
113
+ }
114
+
115
+ async function focusFromKeyboard(page: Page, input: Locator) {
116
+ await page.keyboard.press('Tab');
117
+ if (!(await input.evaluate(element => element === document.activeElement))) {
118
+ await input.focus();
119
+ }
120
+ await expect(input).toBeFocused();
121
+ expect(
122
+ await input.evaluate(element => element.matches(':focus-visible')),
123
+ ).toBe(true);
124
+ }
125
+
126
+ async function focusFromPointer(input: Locator) {
127
+ // PopupContext is already focused by Dialog's open-time focus management.
128
+ // Move focus away first so the click acquires focus and runs the component's
129
+ // pointer-modality gate rather than merely clicking an existing keyboard focus.
130
+ await input.blur();
131
+ await expect(input).not.toBeFocused();
132
+ await input.click();
133
+ await expect(input).toBeFocused();
134
+ // CSS Selectors 4 deliberately keeps text-entry controls focus-visible after
135
+ // a pointer click. The component's shared modality gate must still withhold
136
+ // its keyboard-only ring.
137
+ expect(
138
+ await input.evaluate(element => element.matches(':focus-visible')),
139
+ ).toBe(true);
140
+ }
141
+
142
+ test.beforeAll(async () => {
143
+ fs.rmSync(OUTPUT, {recursive: true, force: true});
144
+ fs.mkdirSync(OUTPUT, {recursive: true});
145
+ checkoutSha = execFileSync('git', ['rev-parse', 'HEAD'], {
146
+ encoding: 'utf8',
147
+ }).trim();
148
+ const expected = process.env.ASTRYX_HEAD_SHA;
149
+ if (expected && expected !== checkoutSha) {
150
+ throw new Error(
151
+ `checkout ${checkoutSha} does not match expected head ${expected}`,
152
+ );
153
+ }
154
+ server = await serveStorybook(
155
+ process.env.ASTRYX_STORYBOOK_DIR ?? DEFAULT_STORYBOOK_DIR,
156
+ );
157
+ const response = await fetch(`${server.origin}/astryx-build-sha.txt`);
158
+ if (!response.ok) {
159
+ throw new Error(`Storybook build has no SHA stamp (${response.status})`);
160
+ }
161
+ storybookSha = (await response.text()).trim();
162
+ if (storybookSha !== checkoutSha) {
163
+ throw new Error(
164
+ `Storybook ${storybookSha} does not match checkout ${checkoutSha}`,
165
+ );
166
+ }
167
+ });
168
+
169
+ test.afterAll(async () => {
170
+ await server?.close();
171
+ });
172
+
173
+ for (const item of cases) {
174
+ test(item.key, async ({browser}) => {
175
+ const context = await browser.newContext({
176
+ viewport: item.viewport,
177
+ colorScheme: item.mode,
178
+ reducedMotion: 'reduce',
179
+ });
180
+ const page = await context.newPage();
181
+ const pageErrors: string[] = [];
182
+ page.on('pageerror', error => pageErrors.push(String(error)));
183
+ await page.goto(storyUrl(item), {waitUntil: 'load'});
184
+ await page.locator('#storybook-root').waitFor();
185
+
186
+ let input: Locator;
187
+ if (item.story === 'aggregate-matrix') {
188
+ const matrix = page.locator('[data-command-palette-audit-matrix]');
189
+ await expect(matrix).toBeVisible();
190
+ await expect(matrix.getByRole('combobox')).toHaveCount(3);
191
+ await expect(matrix.locator('.astryx-spinner')).toHaveCount(1);
192
+ await expect(matrix.getByRole('option')).not.toHaveCount(0);
193
+ input = matrix
194
+ .getByRole('region', {name: 'Grouped command palette'})
195
+ .getByRole('combobox');
196
+ } else if (item.story === 'popup-context') {
197
+ input = page.getByRole('combobox', {name: 'Search commands'});
198
+ await expect(input).toHaveAttribute('aria-expanded', 'true');
199
+ await expect(input).toHaveAttribute('aria-controls', /.+/);
200
+ } else {
201
+ input = page.getByRole('searchbox', {name: 'Search documentation'});
202
+ await expect(input).not.toHaveAttribute('aria-expanded');
203
+ await expect(input).not.toHaveAttribute('aria-controls');
204
+ await expect(page.getByTestId('input-end-content')).toBeVisible();
205
+ }
206
+
207
+ await expect(input).toBeVisible();
208
+ if (item.state === 'keyboard-focus') {
209
+ await focusFromKeyboard(page, input);
210
+ } else if (item.state === 'pointer-focus') {
211
+ await focusFromPointer(input);
212
+ }
213
+ await settle(page);
214
+
215
+ const inputBox = await input.boundingBox();
216
+ if (inputBox == null) {
217
+ throw new Error(`${item.key}: the visible input has no geometry`);
218
+ }
219
+ const observed = await page.evaluate(() => ({
220
+ theme: document
221
+ .querySelector('[data-astryx-theme]')
222
+ ?.getAttribute('data-astryx-theme'),
223
+ mode: document.documentElement.getAttribute('data-theme'),
224
+ direction: getComputedStyle(
225
+ document.querySelector('.astryx-command-palette-input') as HTMLElement,
226
+ ).direction,
227
+ viewport: {width: innerWidth, height: innerHeight},
228
+ reducedMotion: matchMedia('(prefers-reduced-motion: reduce)').matches,
229
+ horizontalOverflow: document.documentElement.scrollWidth > innerWidth + 1,
230
+ fonts: document.fonts.status,
231
+ }));
232
+ const focus = await input.evaluate(element => {
233
+ const style = getComputedStyle(element);
234
+ return {
235
+ focused: element === document.activeElement,
236
+ focusVisible: element.matches(':focus-visible'),
237
+ outlineWidth: style.outlineWidth,
238
+ outlineStyle: style.outlineStyle,
239
+ outlineColor: style.outlineColor,
240
+ outlineOffset: style.outlineOffset,
241
+ };
242
+ });
243
+ const ringVisible =
244
+ focus.outlineStyle !== 'none' &&
245
+ Number.parseFloat(focus.outlineWidth) >= 2;
246
+ const focusIndicatorPass =
247
+ item.state === 'keyboard-focus'
248
+ ? focus.focused && focus.focusVisible && ringVisible
249
+ : item.state === 'pointer-focus'
250
+ ? focus.focused && focus.focusVisible && !ringVisible
251
+ : true;
252
+
253
+ const png = await page.screenshot({animations: 'disabled', fullPage: true});
254
+ const image = `${item.key}.png`;
255
+ const receipt = {
256
+ schemaVersion: 1,
257
+ expected: {
258
+ build: checkoutSha,
259
+ storyId: storyId(item),
260
+ mode: item.mode,
261
+ direction: item.direction,
262
+ theme: item.theme,
263
+ state: item.state,
264
+ viewport: item.viewport,
265
+ },
266
+ observed: {
267
+ build: storybookSha,
268
+ ...observed,
269
+ role: await input.getAttribute('role'),
270
+ name: await input.getAttribute('aria-label'),
271
+ geometry: inputBox,
272
+ focus,
273
+ pageErrors,
274
+ },
275
+ image: {
276
+ file: image,
277
+ sha256: createHash('sha256').update(png).digest('hex'),
278
+ width: png.readUInt32BE(16),
279
+ height: png.readUInt32BE(20),
280
+ },
281
+ checks: {focusIndicatorPass},
282
+ passed:
283
+ storybookSha === checkoutSha &&
284
+ pageErrors.length === 0 &&
285
+ observed.theme === item.theme &&
286
+ observed.mode === item.mode &&
287
+ observed.direction === item.direction &&
288
+ observed.viewport.width === item.viewport.width &&
289
+ observed.viewport.height === item.viewport.height &&
290
+ observed.reducedMotion &&
291
+ !observed.horizontalOverflow &&
292
+ observed.fonts === 'loaded' &&
293
+ focusIndicatorPass,
294
+ };
295
+ fs.writeFileSync(path.join(OUTPUT, image), png);
296
+ fs.writeFileSync(
297
+ path.join(OUTPUT, `${item.key}.sensors.json`),
298
+ `${JSON.stringify(receipt, null, 2)}\n`,
299
+ );
300
+
301
+ await context.close();
302
+ });
303
+ }
304
+
305
+ test('manifest is complete', async () => {
306
+ const receiptFiles = fs
307
+ .readdirSync(OUTPUT)
308
+ .filter(file => file.endsWith('.sensors.json'));
309
+ const receipts = receiptFiles.map(
310
+ (file): AuditReceipt =>
311
+ JSON.parse(
312
+ fs.readFileSync(path.join(OUTPUT, file), 'utf8'),
313
+ ) as AuditReceipt,
314
+ );
315
+ const manifest = {
316
+ schemaVersion: 1,
317
+ component: 'core/CommandPaletteInput',
318
+ build: checkoutSha,
319
+ frames: cases.map(item => ({
320
+ key: item.key,
321
+ image: `${item.key}.png`,
322
+ receipt: `${item.key}.sensors.json`,
323
+ })),
324
+ };
325
+ fs.writeFileSync(
326
+ path.join(OUTPUT, 'manifest.json'),
327
+ `${JSON.stringify(manifest, null, 2)}\n`,
328
+ );
329
+ expect(receiptFiles).toHaveLength(cases.length);
330
+ expect(
331
+ receipts
332
+ .filter(receipt => !receipt.passed)
333
+ .map(receipt => receipt.expected),
334
+ ).toEqual([]);
335
+ });