@astryxdesign/cli 0.1.2 → 0.1.3

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 (238) hide show
  1. package/CHANGELOG.md +64 -1
  2. package/README.md +49 -55
  3. package/docs/layout.doc.dense.mjs +90 -0
  4. package/docs/layout.doc.mjs +160 -0
  5. package/docs/principles.doc.dense.mjs +2 -2
  6. package/docs/principles.doc.mjs +4 -0
  7. package/docs/principles.doc.zh.mjs +2 -2
  8. package/docs/theme.doc.mjs +2 -2
  9. package/package.json +13 -1
  10. package/src/api/blog.mjs +192 -0
  11. package/src/api/blog.test.mjs +144 -0
  12. package/src/api/component.mjs +253 -12
  13. package/src/api/discover.mjs +14 -7
  14. package/src/api/doctor.mjs +10 -25
  15. package/src/api/index.mjs +1 -0
  16. package/src/api/layout.mjs +11 -10
  17. package/src/api/layout.test.mjs +4 -1
  18. package/src/api/template-integration.test.mjs +225 -0
  19. package/src/api/template.mjs +242 -84
  20. package/src/api/validate-integration.mjs +370 -0
  21. package/src/api/validate-integration.test.mjs +222 -0
  22. package/src/codemod.mjs +93 -0
  23. package/src/codemod.test.mjs +134 -0
  24. package/src/codemods/__tests__/registry.test.mjs +1 -0
  25. package/src/codemods/__tests__/runner.test.mjs +103 -0
  26. package/src/codemods/integration-discovery.mjs +168 -0
  27. package/src/codemods/integration-discovery.test.mjs +234 -0
  28. package/src/codemods/integration-runner.mjs +109 -0
  29. package/src/codemods/registry.mjs +1 -0
  30. package/src/codemods/run-codemod.mjs +207 -0
  31. package/src/codemods/runner.mjs +73 -96
  32. package/src/codemods/transforms/v0.0.15/index.mjs +0 -13
  33. package/src/codemods/transforms/v0.1.0/__tests__/migrate-xds-css-surfaces.test.mjs +67 -0
  34. package/src/codemods/transforms/v0.1.0/__tests__/migrate-xds-declare-module.test.mjs +61 -0
  35. package/src/codemods/transforms/v0.1.0/__tests__/v0.1.0-ordering.test.mjs +104 -0
  36. package/src/codemods/transforms/{v0.0.15 → v0.1.0}/drop-xds-prefix-imports.mjs +15 -4
  37. package/src/codemods/transforms/v0.1.0/index.mjs +43 -6
  38. package/src/codemods/transforms/v0.1.0/migrate-xds-css-surfaces.mjs +77 -0
  39. package/src/codemods/transforms/v0.1.0/migrate-xds-declare-module.mjs +78 -0
  40. package/src/codemods/transforms/v0.1.3/__tests__/migrate-layout-components-to-experimental.test.mjs +360 -0
  41. package/src/codemods/transforms/v0.1.3/index.mjs +19 -0
  42. package/src/codemods/transforms/v0.1.3/migrate-layout-components-to-experimental.mjs +260 -0
  43. package/src/commands/agent-docs.mjs +4 -1
  44. package/src/commands/blog.mjs +60 -0
  45. package/src/commands/build-theme.import-path.test.mjs +2 -12
  46. package/src/commands/build-theme.mjs +117 -0
  47. package/src/commands/build-theme.prose.test.mjs +5 -15
  48. package/src/commands/build-theme.watch.test.mjs +149 -0
  49. package/src/commands/component/index.mjs +44 -10
  50. package/src/commands/component-ownership.test.mjs +227 -0
  51. package/src/commands/discover.mjs +5 -16
  52. package/src/commands/doctor.test.mjs +3 -3
  53. package/src/commands/ensure-core-built.mjs +120 -0
  54. package/src/commands/json-contract.test.mjs +0 -32
  55. package/src/commands/swizzle.mjs +224 -235
  56. package/src/commands/swizzle.path-safety.test.mjs +3 -3
  57. package/src/commands/swizzle.routing.test.mjs +279 -0
  58. package/src/commands/template.mjs +33 -37
  59. package/src/commands/upgrade.config-ordering.test.mjs +273 -0
  60. package/src/commands/upgrade.integration-policy.test.mjs +204 -0
  61. package/src/commands/upgrade.mjs +349 -170
  62. package/src/commands/validate-integration.mjs +110 -0
  63. package/src/commands/validate-integration.test.mjs +124 -0
  64. package/src/config.mjs +7 -20
  65. package/src/config.test.mjs +89 -13
  66. package/src/index.mjs +8 -3
  67. package/src/integration.mjs +19 -0
  68. package/src/lib/component-discovery.mjs +177 -0
  69. package/src/lib/config-cache.mjs +91 -0
  70. package/src/lib/config-cache.test.mjs +83 -0
  71. package/src/lib/config-schema.mjs +41 -55
  72. package/src/lib/error-codes.mjs +15 -12
  73. package/src/lib/integration-warnings.mjs +62 -0
  74. package/src/lib/integration-warnings.test.mjs +102 -0
  75. package/src/lib/integrations.mjs +92 -115
  76. package/src/lib/integrations.test.mjs +88 -107
  77. package/src/lib/manifest.mjs +5 -2
  78. package/src/lib/module-loader.mjs +80 -0
  79. package/src/lib/module-loader.test.mjs +106 -0
  80. package/src/lib/project.mjs +502 -0
  81. package/src/lib/project.test.mjs +308 -0
  82. package/src/lib/site.mjs +20 -0
  83. package/src/template.mjs +73 -0
  84. package/src/template.test.mjs +127 -0
  85. package/src/types/api.d.ts +2 -6
  86. package/src/types/base.d.ts +3 -9
  87. package/src/types/codemod.d.ts +81 -0
  88. package/src/types/component.d.ts +27 -2
  89. package/src/types/config.d.ts +56 -85
  90. package/src/types/error-codes.d.ts +5 -3
  91. package/src/types/index.d.ts +0 -1
  92. package/src/types/integration.d.ts +29 -0
  93. package/src/types/swizzle.d.ts +9 -2
  94. package/src/types/template-api.d.ts +54 -0
  95. package/src/types/template.d.ts +10 -7
  96. package/src/types/upgrade.d.ts +29 -0
  97. package/src/types/validate-integration.d.ts +24 -0
  98. package/src/utils/github.mjs +0 -237
  99. package/src/utils/interactive.mjs +2 -2
  100. package/templates/blocks/components/AvatarStatusDot/AvatarStatusDotVariants.doc.mjs +14 -0
  101. package/templates/blocks/components/AvatarStatusDot/AvatarStatusDotVariants.tsx +28 -0
  102. package/templates/blocks/components/Blockquote/BlockquoteTestimonials.doc.mjs +14 -0
  103. package/templates/blocks/components/Blockquote/BlockquoteTestimonials.tsx +34 -0
  104. package/templates/blocks/components/Blockquote/BlockquoteWithCite.doc.mjs +14 -0
  105. package/templates/blocks/components/Blockquote/BlockquoteWithCite.tsx +21 -0
  106. package/templates/blocks/components/BreadcrumbItem/BreadcrumbItemBasic.doc.mjs +14 -0
  107. package/templates/blocks/components/BreadcrumbItem/BreadcrumbItemBasic.tsx +15 -0
  108. package/templates/blocks/components/ButtonGroup/ButtonGroupBasic.doc.mjs +14 -0
  109. package/templates/blocks/components/ButtonGroup/ButtonGroupBasic.tsx +16 -0
  110. package/templates/blocks/components/ChatDictationButton/ChatDictationButtonBasic.doc.mjs +19 -0
  111. package/templates/blocks/components/ChatDictationButton/ChatDictationButtonBasic.tsx +34 -0
  112. package/templates/blocks/components/CheckboxListItem/CheckboxListItemBasic.doc.mjs +14 -0
  113. package/templates/blocks/components/CheckboxListItem/CheckboxListItemBasic.tsx +30 -0
  114. package/templates/blocks/components/CollapsibleGroup/CollapsibleGroupAccordion.doc.mjs +14 -0
  115. package/templates/blocks/components/CollapsibleGroup/CollapsibleGroupAccordion.tsx +31 -0
  116. package/templates/blocks/components/CommandPaletteEmpty/CommandPaletteEmptyBasic.doc.mjs +14 -0
  117. package/templates/blocks/components/CommandPaletteEmpty/CommandPaletteEmptyBasic.tsx +26 -0
  118. package/templates/blocks/components/CommandPaletteFooter/CommandPaletteFooterBasic.doc.mjs +14 -0
  119. package/templates/blocks/components/CommandPaletteFooter/CommandPaletteFooterBasic.tsx +32 -0
  120. package/templates/blocks/components/CommandPaletteGroup/CommandPaletteGroupBasic.doc.mjs +18 -0
  121. package/templates/blocks/components/CommandPaletteGroup/CommandPaletteGroupBasic.tsx +32 -0
  122. package/templates/blocks/components/CommandPaletteItem/CommandPaletteItemBasic.doc.mjs +14 -0
  123. package/templates/blocks/components/CommandPaletteItem/CommandPaletteItemBasic.tsx +27 -0
  124. package/templates/blocks/components/ContextMenu/ContextMenuBasic.doc.mjs +14 -0
  125. package/templates/blocks/components/ContextMenu/ContextMenuBasic.tsx +32 -0
  126. package/templates/blocks/components/DateRangeInput/DateRangeInputWithPresets.doc.mjs +14 -0
  127. package/templates/blocks/components/DateRangeInput/DateRangeInputWithPresets.tsx +46 -0
  128. package/templates/blocks/components/DateRangeInput/DateRangeInputWithValidation.doc.mjs +14 -0
  129. package/templates/blocks/components/DateRangeInput/DateRangeInputWithValidation.tsx +52 -0
  130. package/templates/blocks/components/DateTimeInput/DateTimeInputWithValidation.doc.mjs +14 -0
  131. package/templates/blocks/components/DateTimeInput/DateTimeInputWithValidation.tsx +43 -0
  132. package/templates/blocks/components/DialogHeader/DialogHeaderBasic.doc.mjs +14 -0
  133. package/templates/blocks/components/DialogHeader/DialogHeaderBasic.tsx +30 -0
  134. package/templates/blocks/components/DropdownMenu/DropdownMenuShowcase.tsx +0 -6
  135. package/templates/blocks/components/DropdownMenuItem/DropdownMenuItemBasic.doc.mjs +14 -0
  136. package/templates/blocks/components/DropdownMenuItem/DropdownMenuItemBasic.tsx +27 -0
  137. package/templates/blocks/components/DropdownMenuItem/DropdownMenuItemShowcase.tsx +1 -5
  138. package/templates/blocks/components/FieldLabel/FieldLabelBasic.doc.mjs +14 -0
  139. package/templates/blocks/components/FieldLabel/FieldLabelBasic.tsx +20 -0
  140. package/templates/blocks/components/FieldStatus/FieldStatusBasic.doc.mjs +14 -0
  141. package/templates/blocks/components/FieldStatus/FieldStatusBasic.tsx +23 -0
  142. package/templates/blocks/components/FileInput/FileInputBasic.doc.mjs +14 -0
  143. package/templates/blocks/components/FileInput/FileInputBasic.tsx +22 -0
  144. package/templates/blocks/components/GridSpan/GridSpanColumns.doc.mjs +14 -0
  145. package/templates/blocks/components/GridSpan/GridSpanColumns.tsx +38 -0
  146. package/templates/blocks/components/HStack/HStackBasic.doc.mjs +14 -0
  147. package/templates/blocks/components/HStack/HStackBasic.tsx +16 -0
  148. package/templates/blocks/components/Hooks/useKeyboardHintHookUsage.doc.mjs +14 -0
  149. package/templates/blocks/components/Hooks/useKeyboardHintHookUsage.tsx +57 -0
  150. package/templates/blocks/components/HoverCard/HoverCardInteractiveContent.doc.mjs +1 -1
  151. package/templates/blocks/components/HoverCard/HoverCardInteractiveContent.tsx +9 -4
  152. package/templates/blocks/components/InputGroup/InputGroupBasic.doc.mjs +14 -0
  153. package/templates/blocks/components/InputGroup/InputGroupBasic.tsx +27 -0
  154. package/templates/blocks/components/LayoutContent/LayoutContentBasic.doc.mjs +23 -0
  155. package/templates/blocks/components/LayoutContent/LayoutContentBasic.tsx +40 -0
  156. package/templates/blocks/components/LayoutFooter/LayoutFooterActions.doc.mjs +22 -0
  157. package/templates/blocks/components/LayoutFooter/LayoutFooterActions.tsx +41 -0
  158. package/templates/blocks/components/LayoutHeader/LayoutHeaderWithActions.doc.mjs +23 -0
  159. package/templates/blocks/components/LayoutHeader/LayoutHeaderWithActions.tsx +40 -0
  160. package/templates/blocks/components/LayoutPanel/LayoutPanelNavigation.doc.mjs +22 -0
  161. package/templates/blocks/components/LayoutPanel/LayoutPanelNavigation.tsx +37 -0
  162. package/templates/blocks/components/Lightbox/LightboxGallery.doc.mjs +14 -0
  163. package/templates/blocks/components/Lightbox/LightboxGallery.tsx +53 -0
  164. package/templates/blocks/components/Lightbox/LightboxShowcase.tsx +4 -3
  165. package/templates/blocks/components/Lightbox/LightboxVideo.doc.mjs +14 -0
  166. package/templates/blocks/components/Lightbox/LightboxVideo.tsx +27 -0
  167. package/templates/blocks/components/Lightbox/LightboxZoom.doc.mjs +14 -0
  168. package/templates/blocks/components/Lightbox/LightboxZoom.tsx +33 -0
  169. package/templates/blocks/components/LinkProvider/LinkProviderCustomLink.doc.mjs +1 -1
  170. package/templates/blocks/components/MetadataListItem/MetadataListItemBasic.doc.mjs +14 -0
  171. package/templates/blocks/components/MetadataListItem/MetadataListItemBasic.tsx +19 -0
  172. package/templates/blocks/components/MobileNavToggle/MobileNavToggleBasic.doc.mjs +23 -0
  173. package/templates/blocks/components/MobileNavToggle/MobileNavToggleBasic.tsx +42 -0
  174. package/templates/blocks/components/MoreMenu/MoreMenuShowcase.tsx +0 -6
  175. package/templates/blocks/components/NavIcon/NavIconBasic.doc.mjs +14 -0
  176. package/templates/blocks/components/NavIcon/NavIconBasic.tsx +16 -0
  177. package/templates/blocks/components/RadioListItem/RadioListItemBasic.doc.mjs +14 -0
  178. package/templates/blocks/components/RadioListItem/RadioListItemBasic.tsx +30 -0
  179. package/templates/blocks/components/Resizable/ResizableSidebar.doc.mjs +25 -0
  180. package/templates/blocks/components/Resizable/ResizableSidebar.tsx +67 -0
  181. package/templates/blocks/components/SegmentedControlItem/SegmentedControlItemBasic.doc.mjs +14 -0
  182. package/templates/blocks/components/SegmentedControlItem/SegmentedControlItemBasic.tsx +21 -0
  183. package/templates/blocks/components/SelectorOption/SelectorOptionBasic.doc.mjs +14 -0
  184. package/templates/blocks/components/SelectorOption/SelectorOptionBasic.tsx +39 -0
  185. package/templates/blocks/components/SideNavCollapseButton/SideNavCollapseButtonBasic.doc.mjs +14 -0
  186. package/templates/blocks/components/SideNavCollapseButton/SideNavCollapseButtonBasic.tsx +55 -0
  187. package/templates/blocks/components/SideNavHeading/SideNavHeadingBasic.doc.mjs +14 -0
  188. package/templates/blocks/components/SideNavHeading/SideNavHeadingBasic.tsx +38 -0
  189. package/templates/blocks/components/SideNavItem/SideNavItemBasic.doc.mjs +14 -0
  190. package/templates/blocks/components/SideNavItem/SideNavItemBasic.tsx +49 -0
  191. package/templates/blocks/components/SideNavSection/SideNavSectionBasic.doc.mjs +14 -0
  192. package/templates/blocks/components/SideNavSection/SideNavSectionBasic.tsx +71 -0
  193. package/templates/blocks/components/StackItem/StackItemFill.doc.mjs +14 -0
  194. package/templates/blocks/components/StackItem/StackItemFill.tsx +28 -0
  195. package/templates/blocks/components/Tab/TabWithSelectedIcon.doc.mjs +13 -0
  196. package/templates/blocks/components/Tab/TabWithSelectedIcon.tsx +39 -0
  197. package/templates/blocks/components/TabMenu/TabMenuBasic.doc.mjs +14 -0
  198. package/templates/blocks/components/TabMenu/TabMenuBasic.tsx +23 -0
  199. package/templates/blocks/components/Table/StickyColumnsHookUsage.doc.mjs +1 -1
  200. package/templates/blocks/components/ToggleButtonGroup/ToggleButtonGroupVertical.doc.mjs +14 -0
  201. package/templates/blocks/components/ToggleButtonGroup/ToggleButtonGroupVertical.tsx +47 -0
  202. package/templates/blocks/components/TopNavHeading/TopNavHeadingBasic.doc.mjs +14 -0
  203. package/templates/blocks/components/TopNavHeading/TopNavHeadingBasic.tsx +22 -0
  204. package/templates/blocks/components/TopNavItem/TopNavItemBasic.doc.mjs +14 -0
  205. package/templates/blocks/components/TopNavItem/TopNavItemBasic.tsx +21 -0
  206. package/templates/blocks/components/TopNavMegaMenu/TopNavMegaMenuBasic.doc.mjs +20 -0
  207. package/templates/blocks/components/TopNavMegaMenu/TopNavMegaMenuBasic.tsx +46 -0
  208. package/templates/blocks/components/TopNavMegaMenuFeaturedCard/TopNavMegaMenuFeaturedCardBasic.doc.mjs +14 -0
  209. package/templates/blocks/components/TopNavMegaMenuFeaturedCard/TopNavMegaMenuFeaturedCardBasic.tsx +16 -0
  210. package/templates/blocks/components/TopNavMegaMenuItem/TopNavMegaMenuItemBasic.doc.mjs +14 -0
  211. package/templates/blocks/components/TopNavMegaMenuItem/TopNavMegaMenuItemBasic.tsx +26 -0
  212. package/templates/blocks/components/TopNavMenu/TopNavMenuBasic.doc.mjs +14 -0
  213. package/templates/blocks/components/TopNavMenu/TopNavMenuBasic.tsx +43 -0
  214. package/templates/blocks/components/TypeaheadItem/TypeaheadItemBasic.doc.mjs +14 -0
  215. package/templates/blocks/components/TypeaheadItem/TypeaheadItemBasic.tsx +43 -0
  216. package/templates/blocks/components/VStack/VStackBasic.doc.mjs +14 -0
  217. package/templates/blocks/components/VStack/VStackBasic.tsx +20 -0
  218. package/templates/pages/kanban-board/page.tsx +729 -0
  219. package/templates/pages/kanban-board/template.doc.mjs +12 -0
  220. package/templates/pages/shell-nav/page.tsx +321 -0
  221. package/templates/pages/shell-nav/template.doc.mjs +12 -0
  222. package/templates/pages/shell-side-nav/page.tsx +241 -0
  223. package/templates/pages/shell-side-nav/template.doc.mjs +12 -0
  224. package/templates/pages/shell-top-nav/page.tsx +224 -0
  225. package/templates/pages/shell-top-nav/template.doc.mjs +12 -0
  226. package/src/codemods/transforms/v0.1.0/__tests__/migrate-xds-config-surfaces.test.mjs +0 -116
  227. package/src/codemods/transforms/v0.1.0/migrate-xds-config-surfaces.mjs +0 -230
  228. package/src/commands/gap-report.mjs +0 -464
  229. package/src/commands/gap-report.test.mjs +0 -168
  230. package/src/commands/swizzle-gap-safety.test.mjs +0 -273
  231. package/src/lib/config.mjs +0 -113
  232. package/src/lib/config.test.mjs +0 -91
  233. package/src/types/gap-report.d.ts +0 -29
  234. package/templates/blocks/components/TreeListBranches/TreeListBranchesShowcase.doc.mjs +0 -14
  235. package/templates/blocks/components/TreeListBranches/TreeListBranchesShowcase.tsx +0 -64
  236. package/templates/blocks/components/TreeListItem/TreeListItemShowcase.doc.mjs +0 -14
  237. package/templates/blocks/components/TreeListItem/TreeListItemShowcase.tsx +0 -60
  238. /package/src/codemods/transforms/{v0.0.15 → v0.1.0}/__tests__/drop-xds-prefix-imports.test.mjs +0 -0
@@ -0,0 +1,28 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {HStack, StackItem} from '@astryxdesign/core/Layout';
6
+ import {Card} from '@astryxdesign/core/Card';
7
+ import {Text} from '@astryxdesign/core/Text';
8
+
9
+ export default function StackItemFill() {
10
+ return (
11
+ <HStack gap={3} vAlign="center" width="100%" style={{maxWidth: 400}}>
12
+ <StackItem size="static">
13
+ <Card padding={3}>
14
+ <Text type="supporting" color="secondary">
15
+ Static
16
+ </Text>
17
+ </Card>
18
+ </StackItem>
19
+ <StackItem size="fill">
20
+ <Card padding={3}>
21
+ <Text type="supporting" color="secondary">
22
+ Fills remaining space
23
+ </Text>
24
+ </Card>
25
+ </StackItem>
26
+ </HStack>
27
+ );
28
+ }
@@ -0,0 +1,13 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
4
+ export const doc = {
5
+ type: 'block',
6
+ exampleFor: 'Tab',
7
+ name: 'Tab — Selected Icon',
8
+ displayName: 'Tab — Selected Icon',
9
+ description: 'A tab that changes its icon when selected.',
10
+ isReady: true,
11
+ aspectRatio: 4 / 3,
12
+ componentsUsed: ['TabList', 'Tab'],
13
+ };
@@ -0,0 +1,39 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {useState} from 'react';
6
+ import {TabList, Tab} from '@astryxdesign/core/TabList';
7
+
8
+ const StarIcon = (
9
+ <svg
10
+ viewBox="0 0 16 16"
11
+ fill="none"
12
+ stroke="currentColor"
13
+ width="100%"
14
+ height="100%">
15
+ <path d="m8 1.5 2 4.1 4.5.7-3.3 3.2.8 4.5-4-2.1L4 14l.8-4.5-3.3-3.2 4.5-.7L8 1.5Z" />
16
+ </svg>
17
+ );
18
+
19
+ const SelectedStarIcon = (
20
+ <svg viewBox="0 0 16 16" fill="currentColor" width="100%" height="100%">
21
+ <path d="m8 1.5 2 4.1 4.5.7-3.3 3.2.8 4.5-4-2.1L4 14l.8-4.5-3.3-3.2 4.5-.7L8 1.5Z" />
22
+ </svg>
23
+ );
24
+
25
+ export default function TabWithSelectedIcon() {
26
+ const [value, setValue] = useState('favorites');
27
+
28
+ return (
29
+ <TabList value={value} onChange={setValue}>
30
+ <Tab
31
+ value="favorites"
32
+ label="Favorites"
33
+ icon={StarIcon}
34
+ selectedIcon={SelectedStarIcon}
35
+ />
36
+ <Tab value="recent" label="Recent" />
37
+ </TabList>
38
+ );
39
+ }
@@ -0,0 +1,14 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
4
+ export const doc = {
5
+ type: 'block',
6
+ exampleFor: 'TabMenu',
7
+ name: 'TabMenu — Basic',
8
+ displayName: 'TabMenu — Basic',
9
+ description:
10
+ 'An overflow menu at the end of a TabList that collects secondary tabs behind a dropdown. Use it when there are more tabs than fit comfortably inline.',
11
+ isReady: true,
12
+ aspectRatio: 16 / 9,
13
+ componentsUsed: ['TabList', 'Tab', 'TabMenu'],
14
+ };
@@ -0,0 +1,23 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {useState} from 'react';
6
+ import {TabList, Tab, TabMenu} from '@astryxdesign/core/TabList';
7
+
8
+ export default function TabMenuBasic() {
9
+ const [value, setValue] = useState('overview');
10
+ return (
11
+ <TabList value={value} onChange={setValue}>
12
+ <Tab value="overview" label="Overview" />
13
+ <Tab value="activity" label="Activity" />
14
+ <TabMenu
15
+ label="More"
16
+ options={[
17
+ {value: 'settings', label: 'Settings'},
18
+ {value: 'billing', label: 'Billing'},
19
+ ]}
20
+ />
21
+ </TabList>
22
+ );
23
+ }
@@ -7,7 +7,7 @@ export const doc = {
7
7
  name: 'useTableStickyColumns — Pinned Columns',
8
8
  displayName: 'useTableStickyColumns — Pinned Columns',
9
9
  description:
10
- 'A Table using useTableStickyColumns to pin the Name column to the start edge and Status to the end edge. Scroll horizontally pinned columns stay in view with a soft shadow over the scrolling content.',
10
+ 'A Table using useTableStickyColumns to pin the Name column to the start edge and Status to the end edge. Scroll horizontally; pinned columns stay in view with a soft shadow over the scrolling content.',
11
11
  isReady: true,
12
12
  aspectRatio: 16 / 9,
13
13
  componentsUsed: ['Table'],
@@ -0,0 +1,14 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
4
+ export const doc = {
5
+ type: 'block',
6
+ exampleFor: 'ToggleButtonGroup',
7
+ name: 'ToggleButtonGroup — Vertical',
8
+ displayName: 'ToggleButtonGroup — Vertical',
9
+ description:
10
+ 'A vertically stacked ToggleButtonGroup using the vertical orientation, shown with both single-select and multi-select behavior — ideal for sidebar-style option lists and vertical toolbars.',
11
+ isReady: true,
12
+ aspectRatio: 3 / 4,
13
+ componentsUsed: ['ToggleButton', 'ToggleButtonGroup', 'Layout', 'Text'],
14
+ };
@@ -0,0 +1,47 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {useState} from 'react';
6
+ import {ToggleButton, ToggleButtonGroup} from '@astryxdesign/core/ToggleButton';
7
+ import {VStack} from '@astryxdesign/core/Layout';
8
+ import {Text} from '@astryxdesign/core/Text';
9
+
10
+ export default function ToggleButtonGroupVertical() {
11
+ const [view, setView] = useState<string | null>('grid');
12
+ const [filters, setFilters] = useState<string[]>(['active']);
13
+
14
+ return (
15
+ <VStack gap={4}>
16
+ <VStack gap={1}>
17
+ <Text type="label" color="secondary">
18
+ Single select
19
+ </Text>
20
+ <ToggleButtonGroup
21
+ orientation="vertical"
22
+ value={view}
23
+ onChange={setView}
24
+ label="View mode">
25
+ <ToggleButton value="list" label="List" />
26
+ <ToggleButton value="grid" label="Grid" />
27
+ <ToggleButton value="board" label="Board" />
28
+ </ToggleButtonGroup>
29
+ </VStack>
30
+ <VStack gap={1}>
31
+ <Text type="label" color="secondary">
32
+ Multi select
33
+ </Text>
34
+ <ToggleButtonGroup
35
+ orientation="vertical"
36
+ type="multiple"
37
+ value={filters}
38
+ onChange={setFilters}
39
+ label="Status filters">
40
+ <ToggleButton value="active" label="Active" />
41
+ <ToggleButton value="pending" label="Pending" />
42
+ <ToggleButton value="closed" label="Closed" />
43
+ </ToggleButtonGroup>
44
+ </VStack>
45
+ </VStack>
46
+ );
47
+ }
@@ -0,0 +1,14 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
4
+ export const doc = {
5
+ type: 'block',
6
+ exampleFor: 'TopNavHeading',
7
+ name: 'TopNavHeading — Basic',
8
+ displayName: 'TopNavHeading — Basic',
9
+ description:
10
+ 'A product heading with a logo inside a TopNav, linked to the home page. Use as the leading brand element of a top navigation bar.',
11
+ isReady: true,
12
+ aspectRatio: 16 / 9,
13
+ componentsUsed: ['TopNav', 'TopNavHeading', 'NavIcon', 'Icon'],
14
+ };
@@ -0,0 +1,22 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {TopNav, TopNavHeading} from '@astryxdesign/core/TopNav';
6
+ import {NavIcon} from '@astryxdesign/core/NavIcon';
7
+ import {Icon} from '@astryxdesign/core/Icon';
8
+
9
+ export default function TopNavHeadingBasic() {
10
+ return (
11
+ <TopNav
12
+ label="Product navigation"
13
+ heading={
14
+ <TopNavHeading
15
+ heading="Acme Platform"
16
+ logo={<NavIcon icon={<Icon icon="viewColumns" />} />}
17
+ headingHref="/"
18
+ />
19
+ }
20
+ />
21
+ );
22
+ }
@@ -0,0 +1,14 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
4
+ export const doc = {
5
+ type: 'block',
6
+ exampleFor: 'TopNavItem',
7
+ name: 'TopNavItem — Basic',
8
+ displayName: 'TopNavItem — Basic',
9
+ description:
10
+ 'Navigation links inside a TopNav with one item marked as selected. Use for top-level pages of an application.',
11
+ isReady: true,
12
+ aspectRatio: 3,
13
+ componentsUsed: ['TopNav', 'TopNavHeading', 'TopNavItem'],
14
+ };
@@ -0,0 +1,21 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {TopNav, TopNavHeading, TopNavItem} from '@astryxdesign/core/TopNav';
6
+
7
+ export default function TopNavItemBasic() {
8
+ return (
9
+ <TopNav
10
+ label="Main navigation"
11
+ heading={<TopNavHeading heading="App" />}
12
+ startContent={
13
+ <>
14
+ <TopNavItem label="Dashboard" href="#" isSelected />
15
+ <TopNavItem label="Projects" href="#" />
16
+ <TopNavItem label="Reports" href="#" />
17
+ </>
18
+ }
19
+ />
20
+ );
21
+ }
@@ -0,0 +1,20 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
4
+ export const doc = {
5
+ type: 'block',
6
+ exampleFor: 'TopNavMegaMenu',
7
+ name: 'TopNavMegaMenu — Basic',
8
+ displayName: 'TopNavMegaMenu — Basic',
9
+ description:
10
+ 'A mega menu trigger inside a TopNav that opens a panel of rich link items. Use when a navigation section has multiple destinations worth describing.',
11
+ isReady: true,
12
+ aspectRatio: 16 / 9,
13
+ componentsUsed: [
14
+ 'TopNav',
15
+ 'TopNavHeading',
16
+ 'TopNavItem',
17
+ 'TopNavMegaMenu',
18
+ 'TopNavMegaMenuItem',
19
+ ],
20
+ };
@@ -0,0 +1,46 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {
6
+ TopNav,
7
+ TopNavHeading,
8
+ TopNavItem,
9
+ TopNavMegaMenu,
10
+ TopNavMegaMenuItem,
11
+ } from '@astryxdesign/core/TopNav';
12
+ import {RocketLaunchIcon, BookOpenIcon} from '@heroicons/react/24/outline';
13
+
14
+ export default function TopNavMegaMenuBasic() {
15
+ return (
16
+ <TopNav
17
+ style={{width: 600}}
18
+ label="Main navigation"
19
+ heading={<TopNavHeading heading="DevTools" />}
20
+ startContent={
21
+ <>
22
+ <TopNavItem label="Overview" href="#" isSelected />
23
+ <TopNavMegaMenu
24
+ label="Products"
25
+ items={
26
+ <>
27
+ <TopNavMegaMenuItem
28
+ title="Deploy"
29
+ description="Ship to production in seconds"
30
+ icon={<RocketLaunchIcon width={20} height={20} />}
31
+ href="#deploy"
32
+ />
33
+ <TopNavMegaMenuItem
34
+ title="Documentation"
35
+ description="Guides, references, and tutorials"
36
+ icon={<BookOpenIcon width={20} height={20} />}
37
+ href="#docs"
38
+ />
39
+ </>
40
+ }
41
+ />
42
+ </>
43
+ }
44
+ />
45
+ );
46
+ }
@@ -0,0 +1,14 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
4
+ export const doc = {
5
+ type: 'block',
6
+ exampleFor: 'TopNavMegaMenuFeaturedCard',
7
+ name: 'TopNavMegaMenuFeaturedCard — Basic',
8
+ displayName: 'TopNavMegaMenuFeaturedCard — Basic',
9
+ description:
10
+ 'A promotional card with a title, description, and call-to-action link. Pass it to the featured slot of a TopNavMegaMenu to highlight announcements.',
11
+ isReady: true,
12
+ aspectRatio: 16 / 9,
13
+ componentsUsed: ['TopNavMegaMenuFeaturedCard'],
14
+ };
@@ -0,0 +1,16 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {TopNavMegaMenuFeaturedCard} from '@astryxdesign/core/TopNav';
6
+
7
+ export default function TopNavMegaMenuFeaturedCardBasic() {
8
+ return (
9
+ <TopNavMegaMenuFeaturedCard
10
+ title="What's New"
11
+ description="Check out the latest features and improvements in the Q2 release."
12
+ linkLabel="Read the changelog"
13
+ linkHref="#changelog"
14
+ />
15
+ );
16
+ }
@@ -0,0 +1,14 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
4
+ export const doc = {
5
+ type: 'block',
6
+ exampleFor: 'TopNavMegaMenuItem',
7
+ name: 'TopNavMegaMenuItem — Basic',
8
+ displayName: 'TopNavMegaMenuItem — Basic',
9
+ description:
10
+ 'Rich link items with an icon, title, and description. Use inside the items slot of a TopNavMegaMenu to describe each destination.',
11
+ isReady: true,
12
+ aspectRatio: 16 / 9,
13
+ componentsUsed: ['TopNavMegaMenuItem', 'Grid'],
14
+ };
@@ -0,0 +1,26 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {TopNavMegaMenuItem} from '@astryxdesign/core/TopNav';
6
+ import {Grid} from '@astryxdesign/core/Grid';
7
+ import {BoltIcon, CircleStackIcon} from '@heroicons/react/24/outline';
8
+
9
+ export default function TopNavMegaMenuItemBasic() {
10
+ return (
11
+ <Grid columns={2} gap={2}>
12
+ <TopNavMegaMenuItem
13
+ title="Edge Functions"
14
+ description="Run serverless code at the network edge"
15
+ icon={<BoltIcon width={20} height={20} />}
16
+ href="#edge"
17
+ />
18
+ <TopNavMegaMenuItem
19
+ title="Storage"
20
+ description="Object and file storage for your application"
21
+ icon={<CircleStackIcon width={20} height={20} />}
22
+ href="#storage"
23
+ />
24
+ </Grid>
25
+ );
26
+ }
@@ -0,0 +1,14 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
4
+ export const doc = {
5
+ type: 'block',
6
+ exampleFor: 'TopNavMenu',
7
+ name: 'TopNavMenu — Basic',
8
+ displayName: 'TopNavMenu — Basic',
9
+ description:
10
+ 'A dropdown menu inside a TopNav built from an items array with icons and descriptions. Use to group related destinations under a single trigger.',
11
+ isReady: true,
12
+ aspectRatio: 16 / 9,
13
+ componentsUsed: ['TopNav', 'TopNavHeading', 'TopNavItem', 'TopNavMenu'],
14
+ };
@@ -0,0 +1,43 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {
6
+ TopNav,
7
+ TopNavHeading,
8
+ TopNavItem,
9
+ TopNavMenu,
10
+ } from '@astryxdesign/core/TopNav';
11
+ import {ChartBarIcon, Cog6ToothIcon} from '@heroicons/react/24/outline';
12
+
13
+ export default function TopNavMenuBasic() {
14
+ return (
15
+ <TopNav
16
+ style={{width: 600}}
17
+ label="Main navigation"
18
+ heading={<TopNavHeading heading="Platform" />}
19
+ startContent={
20
+ <>
21
+ <TopNavItem label="Home" href="#" isSelected />
22
+ <TopNavMenu
23
+ label="Tools"
24
+ items={[
25
+ {
26
+ title: 'Analytics',
27
+ description: 'View traffic and engagement metrics',
28
+ icon: <ChartBarIcon />,
29
+ href: '#analytics',
30
+ },
31
+ {
32
+ title: 'Settings',
33
+ description: 'Configure your workspace',
34
+ icon: <Cog6ToothIcon />,
35
+ href: '#settings',
36
+ },
37
+ ]}
38
+ />
39
+ </>
40
+ }
41
+ />
42
+ );
43
+ }
@@ -0,0 +1,14 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
4
+ export const doc = {
5
+ type: 'block',
6
+ exampleFor: 'TypeaheadItem',
7
+ name: 'TypeaheadItem — Basic',
8
+ displayName: 'TypeaheadItem — Basic',
9
+ description:
10
+ 'A typeahead whose results are rendered with TypeaheadItem, adding a secondary description below each label. Use inside renderItem to keep custom results visually consistent.',
11
+ isReady: true,
12
+ aspectRatio: 16 / 9,
13
+ componentsUsed: ['Typeahead', 'TypeaheadItem', 'Center'],
14
+ };
@@ -0,0 +1,43 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {useState} from 'react';
6
+ import {Typeahead, TypeaheadItem} from '@astryxdesign/core/Typeahead';
7
+ import type {SearchableItem, SearchSource} from '@astryxdesign/core/Typeahead';
8
+ import {Center} from '@astryxdesign/core/Center';
9
+
10
+ interface PersonItem extends SearchableItem {
11
+ auxiliaryData: {role: string};
12
+ }
13
+
14
+ const people: PersonItem[] = [
15
+ {id: '1', label: 'Alice Johnson', auxiliaryData: {role: 'Engineer'}},
16
+ {id: '2', label: 'Bob Smith', auxiliaryData: {role: 'Designer'}},
17
+ {id: '3', label: 'Charlie Brown', auxiliaryData: {role: 'Product Manager'}},
18
+ ];
19
+
20
+ const peopleSource: SearchSource<PersonItem> = {
21
+ search: (query: string) =>
22
+ people.filter(p => p.label.toLowerCase().includes(query.toLowerCase())),
23
+ bootstrap: () => people,
24
+ };
25
+
26
+ export default function TypeaheadItemBasic() {
27
+ const [value, setValue] = useState<PersonItem | null>(null);
28
+
29
+ return (
30
+ <Center width={320}>
31
+ <Typeahead
32
+ label="Assignee"
33
+ placeholder="Search people..."
34
+ searchSource={peopleSource}
35
+ value={value}
36
+ onChange={setValue}
37
+ renderItem={(item: PersonItem) => (
38
+ <TypeaheadItem item={item} description={item.auxiliaryData.role} />
39
+ )}
40
+ />
41
+ </Center>
42
+ );
43
+ }
@@ -0,0 +1,14 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
4
+ export const doc = {
5
+ type: 'block',
6
+ exampleFor: 'VStack',
7
+ name: 'VStack — Basic',
8
+ displayName: 'VStack — Basic',
9
+ description:
10
+ 'A heading and paragraphs stacked vertically with a consistent gap. Use VStack whenever siblings should flow top to bottom with even spacing.',
11
+ isReady: true,
12
+ aspectRatio: 16 / 9,
13
+ componentsUsed: ['VStack', 'Text', 'Heading'],
14
+ };
@@ -0,0 +1,20 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {VStack} from '@astryxdesign/core/Layout';
6
+ import {Text, Heading} from '@astryxdesign/core/Text';
7
+
8
+ export default function VStackBasic() {
9
+ return (
10
+ <VStack gap={3}>
11
+ <Heading level={5}>Weekly Report</Heading>
12
+ <Text type="body" color="secondary">
13
+ VStack arranges its children in a vertical column.
14
+ </Text>
15
+ <Text type="body" color="secondary">
16
+ The gap prop controls the spacing between each item.
17
+ </Text>
18
+ </VStack>
19
+ );
20
+ }