@astryxdesign/cli 0.1.4-canary.37c19d3 → 0.1.4-canary.39ffd21

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 (37) hide show
  1. package/CHANGELOG.md +1 -2
  2. package/package.json +9 -14
  3. package/src/api/component.mjs +1 -2
  4. package/src/api/doctor.mjs +2 -13
  5. package/src/api/template.mjs +3 -14
  6. package/src/codemods/__tests__/runner.test.mjs +0 -38
  7. package/src/codemods/runner.mjs +0 -2
  8. package/src/commands/agent-docs.mjs +1 -2
  9. package/src/commands/build-theme.mjs +13 -110
  10. package/src/commands/component-resolution.test.mjs +4 -4
  11. package/src/commands/doctor.test.mjs +0 -34
  12. package/src/lib/component-discovery.mjs +4 -8
  13. package/templates/blocks/components/CommandPaletteGroup/CommandPaletteGroupShowcase.tsx +48 -27
  14. package/templates/blocks/components/CommandPaletteItem/CommandPaletteItemShowcase.tsx +54 -31
  15. package/templates/pages/table-page-chart/page.tsx +13 -3
  16. package/templates/pages/table-page-shoe-store-heatmap/page.tsx +18 -4
  17. package/src/commands/build-theme.variants.test.mjs +0 -204
  18. package/templates/blocks/components/BaseTypeahead/BaseTypeaheadCustomSearch.doc.mjs +0 -14
  19. package/templates/blocks/components/BaseTypeahead/BaseTypeaheadCustomSearch.tsx +0 -58
  20. package/templates/blocks/components/CodeBlock/CodeBlockTerminal.doc.mjs +0 -14
  21. package/templates/blocks/components/CodeBlock/CodeBlockTerminal.tsx +0 -24
  22. package/templates/blocks/components/Collapsible/CollapsibleDividedAccordion.doc.mjs +0 -13
  23. package/templates/blocks/components/Collapsible/CollapsibleDividedAccordion.tsx +0 -33
  24. package/templates/blocks/components/CommandPaletteInput/CommandPaletteInputBasic.doc.mjs +0 -15
  25. package/templates/blocks/components/CommandPaletteInput/CommandPaletteInputBasic.tsx +0 -39
  26. package/templates/blocks/components/CommandPaletteInput/CommandPaletteInputShowcase.doc.mjs +0 -15
  27. package/templates/blocks/components/CommandPaletteInput/CommandPaletteInputShowcase.tsx +0 -39
  28. package/templates/blocks/components/CommandPaletteList/CommandPaletteListBasic.doc.mjs +0 -15
  29. package/templates/blocks/components/CommandPaletteList/CommandPaletteListBasic.tsx +0 -27
  30. package/templates/blocks/components/CommandPaletteList/CommandPaletteListShowcase.doc.mjs +0 -15
  31. package/templates/blocks/components/CommandPaletteList/CommandPaletteListShowcase.tsx +0 -38
  32. package/templates/blocks/components/ContextMenuItem/ContextMenuItemBasic.doc.mjs +0 -14
  33. package/templates/blocks/components/ContextMenuItem/ContextMenuItemBasic.tsx +0 -44
  34. package/templates/blocks/components/ContextMenuItem/ContextMenuItemShowcase.doc.mjs +0 -15
  35. package/templates/blocks/components/ContextMenuItem/ContextMenuItemShowcase.tsx +0 -107
  36. package/templates/blocks/components/NavHeadingMenu/NavHeadingMenuShowcase.doc.mjs +0 -15
  37. package/templates/blocks/components/NavHeadingMenu/NavHeadingMenuShowcase.tsx +0 -47
@@ -3,10 +3,16 @@
3
3
  'use client';
4
4
 
5
5
  import {useMemo, type CSSProperties} from 'react';
6
- import {CommandPalette} from '@astryxdesign/core/CommandPalette';
6
+ import {
7
+ CommandPalette,
8
+ CommandPaletteList,
9
+ CommandPaletteItem,
10
+ } from '@astryxdesign/core/CommandPalette';
7
11
  import {Text} from '@astryxdesign/core/Text';
8
12
  import {Kbd} from '@astryxdesign/core/Kbd';
13
+ import {Icon} from '@astryxdesign/core/Icon';
9
14
  import {createStaticSource} from '@astryxdesign/core/Typeahead';
15
+ import {Stack} from '@astryxdesign/core/Layout';
10
16
  import type {SearchableItem} from '@astryxdesign/core/Typeahead';
11
17
 
12
18
  const itemLabel: CSSProperties = {
@@ -17,21 +23,9 @@ type CommandItem = SearchableItem<{shortcut?: string}>;
17
23
 
18
24
  const commands: CommandItem[] = [
19
25
  {id: 'save', label: 'Save File', auxiliaryData: {shortcut: 'mod+s'}},
20
- {
21
- id: 'find',
22
- label: 'Find in Files',
23
- auxiliaryData: {shortcut: 'mod+shift+f'},
24
- },
25
- {
26
- id: 'palette',
27
- label: 'Command Palette',
28
- auxiliaryData: {shortcut: 'mod+shift+p'},
29
- },
30
- {
31
- id: 'terminal',
32
- label: 'Toggle Terminal',
33
- auxiliaryData: {shortcut: 'ctrl+`'},
34
- },
26
+ {id: 'find', label: 'Find in Files', auxiliaryData: {shortcut: 'mod+shift+f'}},
27
+ {id: 'palette', label: 'Command Palette', auxiliaryData: {shortcut: 'mod+shift+p'}},
28
+ {id: 'terminal', label: 'Toggle Terminal', auxiliaryData: {shortcut: 'ctrl+`'}},
35
29
  {id: 'sidebar', label: 'Toggle Sidebar', auxiliaryData: {shortcut: 'mod+b'}},
36
30
  ];
37
31
 
@@ -39,21 +33,50 @@ export default function CommandPaletteItemShowcase() {
39
33
  const source = useMemo(() => createStaticSource(commands), []);
40
34
 
41
35
  return (
42
- <CommandPalette
43
- isOpen
44
- isInline
45
- onOpenChange={() => {}}
46
- searchSource={source}
47
- renderItem={(item: CommandItem) => (
48
- <>
49
- <Text type="body" style={itemLabel}>
50
- {item.label}
51
- </Text>
52
- {item.auxiliaryData?.shortcut && (
53
- <Kbd keys={item.auxiliaryData.shortcut} />
36
+ <Stack direction="vertical" gap={4}>
37
+ <Stack direction="vertical" gap={1}>
38
+ <Text type="supporting" color="secondary">
39
+ Custom renderItem with keyboard shortcuts
40
+ </Text>
41
+ <CommandPalette
42
+ isOpen
43
+ isInline
44
+ onOpenChange={() => {}}
45
+ searchSource={source}
46
+ renderItem={(item: CommandItem) => (
47
+ <>
48
+ <Text type="body" style={itemLabel}>
49
+ {item.label}
50
+ </Text>
51
+ {item.auxiliaryData?.shortcut && (
52
+ <Kbd keys={item.auxiliaryData.shortcut} />
53
+ )}
54
+ </>
54
55
  )}
55
- </>
56
- )}
57
- />
56
+ />
57
+ </Stack>
58
+ <Stack direction="vertical" gap={1}>
59
+ <Text type="supporting" color="secondary">
60
+ Composed items with icons and states
61
+ </Text>
62
+ <CommandPaletteList>
63
+ <CommandPaletteItem value="home" onSelect={() => {}}>
64
+ <Icon icon="externalLink" size="sm" />
65
+ <Text type="body" style={itemLabel}>Home</Text>
66
+ </CommandPaletteItem>
67
+ <CommandPaletteItem value="search" isHighlighted onSelect={() => {}}>
68
+ <Icon icon="search" size="sm" />
69
+ <Text type="body" style={itemLabel}>Search (highlighted)</Text>
70
+ </CommandPaletteItem>
71
+ <CommandPaletteItem value="selected" isSelected onSelect={() => {}}>
72
+ <Icon icon="check" size="sm" />
73
+ <Text type="body" style={itemLabel}>Selected item</Text>
74
+ </CommandPaletteItem>
75
+ <CommandPaletteItem value="disabled" isDisabled>
76
+ <Text type="body" style={itemLabel}>Disabled item</Text>
77
+ </CommandPaletteItem>
78
+ </CommandPaletteList>
79
+ </Stack>
80
+ </Stack>
58
81
  );
59
82
  }
@@ -19,7 +19,13 @@ import {Link} from '@astryxdesign/core/Link';
19
19
  import {Thumbnail} from '@astryxdesign/core/Thumbnail';
20
20
  import {Table, proportional, pixel} from '@astryxdesign/core/Table';
21
21
  import type {TableColumn} from '@astryxdesign/core/Table';
22
- import {Chart, ChartGrid, ChartAxis, area, line} from '@astryxdesign/charts';
22
+ import {
23
+ ChartV2 as Chart,
24
+ ChartGrid,
25
+ ChartAxis,
26
+ area,
27
+ line,
28
+ } from '@astryxdesign/lab';
23
29
  import {
24
30
  FunnelIcon,
25
31
  ArrowDownTrayIcon,
@@ -475,13 +481,17 @@ const columns: TableColumn<OrderRow>[] = [
475
481
  key: 'amount',
476
482
  header: 'Amount',
477
483
  width: pixel(90),
478
- renderCell: (item: OrderRow) => <Text type="body">${item.amount}</Text>,
484
+ renderCell: (item: OrderRow) => (
485
+ <Text type="body">${item.amount}</Text>
486
+ ),
479
487
  },
480
488
  {
481
489
  key: 'customer',
482
490
  header: 'Customer',
483
491
  width: proportional(2),
484
- renderCell: (item: OrderRow) => <Text type="body">{item.customer}</Text>,
492
+ renderCell: (item: OrderRow) => (
493
+ <Text type="body">{item.customer}</Text>
494
+ ),
485
495
  },
486
496
  {
487
497
  key: 'email',
@@ -19,7 +19,13 @@ import {Link} from '@astryxdesign/core/Link';
19
19
  import {Thumbnail} from '@astryxdesign/core/Thumbnail';
20
20
  import {Table, proportional, pixel} from '@astryxdesign/core/Table';
21
21
  import type {TableColumn} from '@astryxdesign/core/Table';
22
- import {Chart, ChartGrid, ChartAxis, area, line} from '@astryxdesign/charts';
22
+ import {
23
+ ChartV2 as Chart,
24
+ ChartGrid,
25
+ ChartAxis,
26
+ area,
27
+ line,
28
+ } from '@astryxdesign/lab';
23
29
  import {
24
30
  FunnelIcon,
25
31
  ArrowDownTrayIcon,
@@ -29,7 +35,11 @@ import {
29
35
  // ============= DATA =============
30
36
 
31
37
  type ProductCategory =
32
- 'Running' | 'Lifestyle' | 'Basketball' | 'Training' | 'Skateboarding';
38
+ | 'Running'
39
+ | 'Lifestyle'
40
+ | 'Basketball'
41
+ | 'Training'
42
+ | 'Skateboarding';
33
43
 
34
44
  function shoeSvg(bg: string, accent: string) {
35
45
  const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><rect width="100" height="100" rx="12" fill="${bg}"/><g transform="translate(22.5, 22.5) scale(2.29)" fill="none" stroke="${accent}" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m15 10.42 4.8-5.07"/><path d="M19 18h3"/><path d="M9.5 22 21.414 9.415A2 2 0 0 0 21.2 6.4l-5.61-4.208A1 1 0 0 0 14 3v2a2 2 0 0 1-1.394 1.906L8.677 8.053A1 1 0 0 0 8 9c-.155 6.393-2.082 9-4 9a2 2 0 0 0 0 4h14"/></g></svg>`;
@@ -829,13 +839,17 @@ const columns: TableColumn<OrderRow>[] = [
829
839
  key: 'amount',
830
840
  header: 'Amount',
831
841
  width: pixel(90),
832
- renderCell: (item: OrderRow) => <Text type="body">${item.amount}</Text>,
842
+ renderCell: (item: OrderRow) => (
843
+ <Text type="body">${item.amount}</Text>
844
+ ),
833
845
  },
834
846
  {
835
847
  key: 'customer',
836
848
  header: 'Customer',
837
849
  width: proportional(2),
838
- renderCell: (item: OrderRow) => <Text type="body">{item.customer}</Text>,
850
+ renderCell: (item: OrderRow) => (
851
+ <Text type="body">{item.customer}</Text>
852
+ ),
839
853
  },
840
854
  {
841
855
  key: 'email',
@@ -1,204 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- /**
4
- * @file Regression test for the custom-variant type augmentations emitted by
5
- * `astryx theme build` (#3391 companion: #3371).
6
- *
7
- * When a theme declares a custom component prop value (e.g.
8
- * `button['variant:accentOutline']`), the build emits a `<name>.variants.d.ts`
9
- * with a module augmentation so the custom value type-checks. This suite pins
10
- * the two bugs that made that augmentation dead code:
11
- *
12
- * 1. The augmentation targeted a non-existent, `XDS`-prefixed interface
13
- * (`XDSButtonVariantMap`) instead of core's real `ButtonVariantMap`, so it
14
- * created a new unused interface and never widened the prop union.
15
- * 2. Props with no augmentation point (closed literal-union types such as
16
- * Button `size` or Heading `type`/`level`) still got a `declare module`
17
- * block against a `*Map` interface that doesn't exist.
18
- * 3. The generated `.variants.d.ts` was never referenced by the main
19
- * `<name>.d.ts`, so even a correct augmentation never loaded.
20
- *
21
- * Building `astryx theme build` requires a compiled @astryxdesign/core, so this
22
- * suite builds core once in beforeAll (mirrors build-theme.prose.test.mjs).
23
- */
24
-
25
- import {describe, it, expect, beforeAll, beforeEach, afterEach} from 'vitest';
26
- import {execFileSync} from 'node:child_process';
27
- import * as fs from 'node:fs';
28
- import * as path from 'node:path';
29
- import * as os from 'node:os';
30
- import {fileURLToPath} from 'node:url';
31
-
32
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
33
- const CLI_BIN = path.resolve(__dirname, '../../bin/astryx.mjs');
34
- const REPO_ROOT = path.resolve(__dirname, '../../../..');
35
- const CORE_THEME_ENTRY = path.join(
36
- REPO_ROOT,
37
- 'packages/core/dist/theme/index.js',
38
- );
39
- // The fix reads core's shipped component declarations to decide whether an
40
- // interface is augmentable; those .d.ts files come from the same core build.
41
- const CORE_BUTTON_DTS = path.join(
42
- REPO_ROOT,
43
- 'packages/core/dist/Button/index.d.ts',
44
- );
45
-
46
- function runCli(args, cwd) {
47
- try {
48
- const out = execFileSync('node', [CLI_BIN, ...args], {
49
- cwd,
50
- encoding: 'utf-8',
51
- stdio: ['ignore', 'pipe', 'pipe'],
52
- env: {...process.env, FORCE_COLOR: '0'},
53
- });
54
- return {code: 0, stdout: out, stderr: ''};
55
- } catch (e) {
56
- return {
57
- code: e.status ?? 1,
58
- stdout: e.stdout?.toString() ?? '',
59
- stderr: e.stderr?.toString() ?? '',
60
- };
61
- }
62
- }
63
-
64
- function writeTheme(dir, contents) {
65
- fs.mkdirSync(dir, {recursive: true});
66
- const file = path.join(dir, 'variants-theme.mjs');
67
- fs.writeFileSync(file, contents);
68
- return file;
69
- }
70
-
71
- beforeAll(() => {
72
- if (!fs.existsSync(CORE_THEME_ENTRY) || !fs.existsSync(CORE_BUTTON_DTS)) {
73
- execFileSync('pnpm', ['-F', '@astryxdesign/core', 'build'], {
74
- cwd: REPO_ROOT,
75
- stdio: 'pipe',
76
- timeout: 180_000,
77
- });
78
- }
79
- }, 200_000);
80
-
81
- let tmpDir;
82
- beforeEach(() => {
83
- tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-build-theme-variants-'));
84
- });
85
- afterEach(() => {
86
- fs.rmSync(tmpDir, {recursive: true, force: true});
87
- });
88
-
89
- describe('theme build custom-variant augmentations', () => {
90
- it('targets the real (un-prefixed) core interface for a custom variant', () => {
91
- const themeFile = writeTheme(
92
- tmpDir,
93
- `export default {
94
- name: 'variants-theme',
95
- tokens: { '--color-bg': '#fff' },
96
- components: {
97
- button: { 'variant:accentOutline': { backgroundColor: 'transparent' } },
98
- },
99
- };\n`,
100
- );
101
-
102
- const result = runCli(
103
- ['theme', 'build', path.relative(tmpDir, themeFile)],
104
- tmpDir,
105
- );
106
- expect(result.code).toBe(0);
107
-
108
- const variantsPath = path.join(tmpDir, 'variants-theme.variants.d.ts');
109
- expect(fs.existsSync(variantsPath)).toBe(true);
110
- const dts = fs.readFileSync(variantsPath, 'utf-8');
111
-
112
- // Targets core's actual augmentation point…
113
- expect(dts).toContain("declare module '@astryxdesign/core/Button'");
114
- expect(dts).toMatch(/interface ButtonVariantMap\b/);
115
- expect(dts).toContain("'accentOutline': true;");
116
- // …and NOT the old, non-existent XDS-prefixed interface.
117
- expect(dts).not.toMatch(/XDSButtonVariantMap/);
118
- });
119
-
120
- it('skips props with no augmentation point (Button size, Heading type)', () => {
121
- const themeFile = writeTheme(
122
- tmpDir,
123
- `export default {
124
- name: 'variants-theme',
125
- tokens: { '--color-bg': '#fff' },
126
- components: {
127
- button: {
128
- 'variant:accentOutline': { backgroundColor: 'transparent' },
129
- 'size:jumbo': { paddingBlock: '40px' },
130
- },
131
- heading: { 'type:hero': { fontSize: '80px' } },
132
- },
133
- };\n`,
134
- );
135
-
136
- const result = runCli(
137
- ['theme', 'build', path.relative(tmpDir, themeFile)],
138
- tmpDir,
139
- );
140
- expect(result.code).toBe(0);
141
-
142
- const variantsPath = path.join(tmpDir, 'variants-theme.variants.d.ts');
143
- expect(fs.existsSync(variantsPath)).toBe(true);
144
- const dts = fs.readFileSync(variantsPath, 'utf-8');
145
-
146
- // The augmentable variant is emitted…
147
- expect(dts).toMatch(/interface ButtonVariantMap\b/);
148
- // …but closed literal-union props get no dead augmentation.
149
- expect(dts).not.toMatch(/ButtonSizeMap/);
150
- expect(dts).not.toMatch(/HeadingTypeMap/);
151
- expect(dts).not.toContain("declare module '@astryxdesign/core/Heading'");
152
- });
153
-
154
- it('does not emit a .variants.d.ts when every custom value is non-augmentable', () => {
155
- const themeFile = writeTheme(
156
- tmpDir,
157
- `export default {
158
- name: 'variants-theme',
159
- tokens: { '--color-bg': '#fff' },
160
- components: {
161
- button: { 'size:jumbo': { paddingBlock: '40px' } },
162
- },
163
- };\n`,
164
- );
165
-
166
- const result = runCli(
167
- ['theme', 'build', path.relative(tmpDir, themeFile)],
168
- tmpDir,
169
- );
170
- expect(result.code).toBe(0);
171
- expect(
172
- fs.existsSync(path.join(tmpDir, 'variants-theme.variants.d.ts')),
173
- ).toBe(false);
174
- });
175
-
176
- it('references the variants file from the main .d.ts so the augmentation loads', () => {
177
- const themeFile = writeTheme(
178
- tmpDir,
179
- `export default {
180
- name: 'variants-theme',
181
- tokens: { '--color-bg': '#fff' },
182
- components: {
183
- button: { 'variant:accentOutline': { backgroundColor: 'transparent' } },
184
- },
185
- };\n`,
186
- );
187
-
188
- const result = runCli(
189
- ['theme', 'build', path.relative(tmpDir, themeFile)],
190
- tmpDir,
191
- );
192
- expect(result.code).toBe(0);
193
-
194
- const dts = fs.readFileSync(
195
- path.join(tmpDir, 'variants-theme.d.ts'),
196
- 'utf-8',
197
- );
198
- // A triple-slash reference to the variants file, so importing the theme's
199
- // types also loads the module augmentation.
200
- expect(dts).toMatch(
201
- /\/\/\/\s*<reference path="\.\/variants-theme\.variants\.d\.ts"\s*\/>/,
202
- );
203
- });
204
- });
@@ -1,14 +0,0 @@
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: 'BaseTypeahead',
7
- name: 'BaseTypeahead — Custom Search Bar',
8
- displayName: 'BaseTypeahead — Custom Search Bar',
9
- description:
10
- 'BaseTypeahead embedded inside a custom-styled wrapper. The wrapper provides its own border and icon chrome; anchorRef positions the dropdown relative to it. Use this pattern when Typeahead\'s built-in field layout does not fit your composition.',
11
- isReady: true,
12
- aspectRatio: 16 / 9,
13
- componentsUsed: ['BaseTypeahead', 'Icon', 'Layout', 'Text'],
14
- };
@@ -1,58 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- 'use client';
4
-
5
- import {useRef, useState} from 'react';
6
- import {BaseTypeahead, createStaticSource} from '@astryxdesign/core/Typeahead';
7
- import type {SearchableItem} from '@astryxdesign/core/Typeahead';
8
- import {Icon} from '@astryxdesign/core/Icon';
9
- import {HStack, VStack} from '@astryxdesign/core/Layout';
10
- import {Text} from '@astryxdesign/core/Text';
11
- import {MagnifyingGlassIcon} from '@heroicons/react/24/outline';
12
-
13
- const frameworks: SearchableItem[] = [
14
- {id: 'react', label: 'React'},
15
- {id: 'vue', label: 'Vue'},
16
- {id: 'angular', label: 'Angular'},
17
- {id: 'svelte', label: 'Svelte'},
18
- {id: 'solid', label: 'SolidJS'},
19
- {id: 'remix', label: 'Remix'},
20
- {id: 'next', label: 'Next.js'},
21
- {id: 'nuxt', label: 'Nuxt'},
22
- ];
23
-
24
- const source = createStaticSource(frameworks);
25
-
26
- export default function BaseTypeaheadCustomSearch() {
27
- const [value, setValue] = useState<SearchableItem | null>(null);
28
- const wrapperRef = useRef<HTMLElement>(null);
29
-
30
- return (
31
- <VStack gap={3} style={{width: 320}}>
32
- <HStack
33
- ref={wrapperRef}
34
- gap={2}
35
- vAlign="center"
36
- style={{
37
- border: '1px solid var(--color-border)',
38
- borderRadius: 'var(--radius-control)',
39
- padding: '6px 10px',
40
- background: 'var(--color-surface)',
41
- }}>
42
- <Icon icon={MagnifyingGlassIcon} size="sm" color="secondary" />
43
- <BaseTypeahead
44
- searchSource={source}
45
- value={value}
46
- onChange={setValue}
47
- anchorRef={wrapperRef}
48
- placeholder="Search frameworks…"
49
- hasEntriesOnFocus
50
- debounceMs={0}
51
- />
52
- </HStack>
53
- <Text type="supporting" color="secondary">
54
- {value != null ? `Selected: ${value.label}` : 'No selection'}
55
- </Text>
56
- </VStack>
57
- );
58
- }
@@ -1,14 +0,0 @@
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: 'CodeBlock',
7
- name: 'Code — Terminal',
8
- displayName: 'Code — Terminal',
9
- description:
10
- 'A dark terminal-style command block: a bash CodeBlock wrapped in SyntaxTheme with the GitHub Dark preset, copy button on, and no line numbers. Use for shell sessions or CLI output that should read as a terminal even on light pages. Reach for a dark syntax preset instead of hand-rolling a dark box with custom CSS.',
11
- isReady: true,
12
- aspectRatio: 16 / 9,
13
- componentsUsed: ['CodeBlock', 'SyntaxTheme'],
14
- };
@@ -1,24 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- 'use client';
4
-
5
- import {SyntaxTheme} from '@astryxdesign/core/theme';
6
- import {githubDark} from '@astryxdesign/core/theme/syntax';
7
- import {CodeBlock} from '@astryxdesign/core/CodeBlock';
8
-
9
- const commands = `$ astryx init --features agents
10
- ✓ AI agent docs installed → .claude/CLAUDE.md
11
- $ pnpm astryx component CodeBlock --dense`;
12
-
13
- export default function CodeBlockTerminal() {
14
- return (
15
- <SyntaxTheme theme={githubDark}>
16
- <CodeBlock
17
- code={commands}
18
- language="bash"
19
- hasCopyButton
20
- style={{width: '100%', maxWidth: 480}}
21
- />
22
- </SyntaxTheme>
23
- );
24
- }
@@ -1,13 +0,0 @@
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: 'Collapsible',
7
- name: 'Collapsible — Divided Accordion',
8
- displayName: 'Collapsible — Divided Accordion',
9
- description: 'FAQ-style accordion using the dividers prop on CollapsibleGroup: built-in row hairlines and density padding with zero custom CSS. Use for FAQs, settings lists, and nav sections.',
10
- isReady: true,
11
- aspectRatio: 4 / 3,
12
- componentsUsed: ['Collapsible', 'CollapsibleGroup', 'Text'],
13
- };
@@ -1,33 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- 'use client';
4
-
5
- import {Collapsible, CollapsibleGroup} from '@astryxdesign/core/Collapsible';
6
- import {Text} from '@astryxdesign/core/Text';
7
-
8
- export default function CollapsibleDividedAccordion() {
9
- return (
10
- <div style={{width: '100%', maxWidth: 400}}>
11
- <CollapsibleGroup type="single" dividers="between" defaultValue="reset">
12
- <Collapsible trigger="How do I reset my password?" value="reset">
13
- <Text type="body">
14
- Go to Settings → Security → Change Password. You'll receive a
15
- confirmation email within a few minutes.
16
- </Text>
17
- </Collapsible>
18
- <Collapsible trigger="Can I change my username?" value="username">
19
- <Text type="body">
20
- Usernames can be changed once every 30 days from your profile
21
- settings.
22
- </Text>
23
- </Collapsible>
24
- <Collapsible trigger="How do I delete my account?" value="delete">
25
- <Text type="body">
26
- Account deletion is permanent. Your data will be removed within 30
27
- days.
28
- </Text>
29
- </Collapsible>
30
- </CollapsibleGroup>
31
- </div>
32
- );
33
- }
@@ -1,15 +0,0 @@
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: 'CommandPaletteInput',
7
- name: 'CommandPaletteInput — With End Content',
8
- displayName: 'CommandPaletteInput — With End Content',
9
- description:
10
- 'Custom placeholder and a keyboard shortcut badge in the trailing slot via endContent.',
11
- isReady: true,
12
- isShowcase: false,
13
- aspectRatio: 4 / 3,
14
- componentsUsed: ['CommandPalette', 'CommandPaletteInput', 'Kbd'],
15
- };
@@ -1,39 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- 'use client';
4
-
5
- import {useMemo} from 'react';
6
- import {
7
- CommandPalette,
8
- CommandPaletteInput,
9
- } from '@astryxdesign/core/CommandPalette';
10
- import {Kbd} from '@astryxdesign/core/Kbd';
11
- import {createStaticSource} from '@astryxdesign/core/Typeahead';
12
-
13
- export default function CommandPaletteInputBasic() {
14
- const source = useMemo(
15
- () =>
16
- createStaticSource([
17
- {id: 'home', label: 'Home'},
18
- {id: 'settings', label: 'Settings'},
19
- {id: 'profile', label: 'Profile'},
20
- {id: 'help', label: 'Help'},
21
- ]),
22
- [],
23
- );
24
-
25
- return (
26
- <CommandPalette
27
- isOpen
28
- isInline
29
- onOpenChange={() => {}}
30
- searchSource={source}
31
- input={
32
- <CommandPaletteInput
33
- placeholder="Search commands, files, or actions..."
34
- endContent={<Kbd keys="mod+k" />}
35
- />
36
- }
37
- />
38
- );
39
- }
@@ -1,15 +0,0 @@
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: 'CommandPaletteInput',
7
- name: 'CommandPaletteInput',
8
- displayName: 'Command Palette Input',
9
- description:
10
- 'Command palette search input with a custom placeholder and a keyboard shortcut hint in the endContent slot.',
11
- isReady: true,
12
- isShowcase: true,
13
- aspectRatio: 4 / 3,
14
- componentsUsed: ['CommandPalette', 'CommandPaletteInput', 'Kbd'],
15
- };
@@ -1,39 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- 'use client';
4
-
5
- import {useMemo} from 'react';
6
- import {
7
- CommandPalette,
8
- CommandPaletteInput,
9
- } from '@astryxdesign/core/CommandPalette';
10
- import {Kbd} from '@astryxdesign/core/Kbd';
11
- import {createStaticSource} from '@astryxdesign/core/Typeahead';
12
-
13
- export default function CommandPaletteInputShowcase() {
14
- const source = useMemo(
15
- () =>
16
- createStaticSource([
17
- {id: 'home', label: 'Home'},
18
- {id: 'settings', label: 'Settings'},
19
- {id: 'profile', label: 'Profile'},
20
- {id: 'help', label: 'Help'},
21
- ]),
22
- [],
23
- );
24
-
25
- return (
26
- <CommandPalette
27
- isOpen
28
- isInline
29
- onOpenChange={() => {}}
30
- searchSource={source}
31
- input={
32
- <CommandPaletteInput
33
- placeholder="Search commands, files, or actions..."
34
- endContent={<Kbd keys="mod+k" />}
35
- />
36
- }
37
- />
38
- );
39
- }