@astryxdesign/cli 0.1.1-canary.a514b99 → 0.1.1-canary.a7d67d0

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 (77) hide show
  1. package/docs/working-with-ai.doc.mjs +6 -6
  2. package/package.json +19 -8
  3. package/src/api/discover.mjs +78 -26
  4. package/src/api/layout.mjs +301 -0
  5. package/src/api/layout.test.mjs +238 -0
  6. package/src/api/template.mjs +191 -50
  7. package/src/api/template.test.mjs +2 -0
  8. package/src/codemods/__tests__/registry.test.mjs +1 -0
  9. package/src/codemods/registry.mjs +1 -0
  10. package/src/codemods/transforms/v0.1.2/__tests__/rename-text-color-active-to-accent.test.mjs +120 -0
  11. package/src/codemods/transforms/v0.1.2/index.mjs +19 -0
  12. package/src/codemods/transforms/v0.1.2/rename-text-color-active-to-accent.mjs +136 -0
  13. package/src/commands/gap-report.mjs +17 -9
  14. package/src/commands/gap-report.test.mjs +21 -16
  15. package/src/commands/init.mjs +34 -8
  16. package/src/commands/init.next-steps.test.mjs +46 -0
  17. package/src/commands/layout.mjs +139 -0
  18. package/src/commands/swizzle.mjs +51 -23
  19. package/src/commands/upgrade.mjs +2 -71
  20. package/src/config.mjs +31 -0
  21. package/src/config.test.mjs +24 -0
  22. package/src/index.mjs +4 -0
  23. package/src/lib/config-schema.mjs +119 -0
  24. package/src/lib/config.mjs +34 -7
  25. package/src/lib/config.test.mjs +51 -2
  26. package/src/lib/error-codes.mjs +8 -0
  27. package/src/lib/integrations.mjs +155 -0
  28. package/src/lib/integrations.test.mjs +154 -0
  29. package/src/lib/levenshtein.mjs +29 -0
  30. package/src/lib/manifest.mjs +6 -0
  31. package/src/lib/package-scanner.mjs +31 -7
  32. package/src/lib/string-utils.mjs +5 -14
  33. package/src/lib/xle/browser.d.ts +100 -0
  34. package/src/lib/xle/browser.mjs +120 -0
  35. package/src/lib/xle/expand.mjs +622 -0
  36. package/src/lib/xle/parse.mjs +581 -0
  37. package/src/lib/xle/print.mjs +174 -0
  38. package/src/lib/xle/registry-core.mjs +170 -0
  39. package/src/lib/xle/registry.mjs +237 -0
  40. package/src/lib/xle/splice.mjs +137 -0
  41. package/src/lib/xle/validate.mjs +356 -0
  42. package/src/lib/xle/xle.test.mjs +333 -0
  43. package/src/types/config.d.ts +99 -0
  44. package/src/utils/github.mjs +12 -27
  45. package/templates/blocks/components/Card/ClickableCardWithNestedButton.doc.mjs +1 -1
  46. package/templates/blocks/components/Card/SelectableCardMulti.doc.mjs +1 -1
  47. package/templates/blocks/components/ChatDictationButton/ChatDictationButtonShowcase.tsx +3 -3
  48. package/templates/blocks/components/CommandPaletteEmpty/CommandPaletteEmptyShowcase.doc.mjs +15 -0
  49. package/templates/blocks/components/CommandPaletteEmpty/CommandPaletteEmptyShowcase.tsx +26 -0
  50. package/templates/blocks/components/DateInput/DateInputDateRange.doc.mjs +2 -2
  51. package/templates/blocks/components/FileInput/FileInputShowcase.tsx +4 -2
  52. package/templates/blocks/components/LinkProvider/LinkProviderCustomLink.doc.mjs +14 -0
  53. package/templates/blocks/components/LinkProvider/LinkProviderCustomLink.tsx +43 -0
  54. package/templates/blocks/components/MultiSelector/MultiSelectorShowcase.tsx +6 -2
  55. package/templates/blocks/components/NumberInput/NumberInputShowcase.tsx +6 -2
  56. package/templates/blocks/components/RadioList/RadioListShowcase.tsx +8 -1
  57. package/templates/blocks/components/SegmentedControl/SegmentedControlShowcase.tsx +3 -1
  58. package/templates/blocks/components/Selector/SelectorShowcase.tsx +4 -1
  59. package/templates/blocks/components/Slider/SliderShowcase.tsx +10 -1
  60. package/templates/blocks/components/Tab/TabShowcase.tsx +3 -1
  61. package/templates/blocks/components/TabList/TabListShowcase.tsx +3 -1
  62. package/templates/blocks/components/TabMenu/TabMenuShowcase.tsx +3 -1
  63. package/templates/blocks/components/Table/ColumnResizeHookUsage.doc.mjs +14 -0
  64. package/templates/blocks/components/Table/ColumnResizeHookUsage.tsx +59 -0
  65. package/templates/blocks/components/Table/StickyColumnsHookUsage.doc.mjs +14 -0
  66. package/templates/blocks/components/Table/StickyColumnsHookUsage.tsx +104 -0
  67. package/templates/blocks/components/Text/TextColors.tsx +20 -5
  68. package/templates/blocks/components/TextArea/TextAreaShowcase.tsx +4 -2
  69. package/templates/blocks/components/TextInput/TextInputShowcase.tsx +4 -2
  70. package/templates/blocks/components/Thumbnail/ThumbnailGallery.tsx +25 -5
  71. package/templates/blocks/components/Timestamp/TimestampColors.tsx +2 -2
  72. package/templates/blocks/components/ToggleButton/ToggleButtonGroup.doc.mjs +1 -1
  73. package/templates/blocks/components/Tokenizer/TokenizerShowcase.tsx +8 -6
  74. package/templates/blocks/components/Typeahead/TypeaheadShowcase.tsx +6 -2
  75. package/templates/pages/theme-showcase/page.tsx +8 -19
  76. package/templates/blocks/components/MoreMenu/MoreMenuInToolbar.doc.mjs +0 -14
  77. package/templates/blocks/components/MoreMenu/MoreMenuInToolbar.tsx +0 -57
@@ -0,0 +1,43 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import type {AnchorHTMLAttributes} from 'react';
6
+ import {Link, LinkProvider} from '@astryxdesign/core/Link';
7
+
8
+ /**
9
+ * A stand-in for a framework router link (e.g. Next.js `Link` or React
10
+ * Router `Link`). Instead of letting the browser do a full-page navigation,
11
+ * it intercepts the click and hands the destination to a custom handler —
12
+ * the same hook real routers use for client-side navigation. Here it just
13
+ * announces the target so the behavior swap is observable in the preview.
14
+ */
15
+ function RouterLink({
16
+ href,
17
+ onClick,
18
+ children,
19
+ ...props
20
+ }: AnchorHTMLAttributes<HTMLAnchorElement>) {
21
+ return (
22
+ <a
23
+ href={href}
24
+ onClick={e => {
25
+ e.preventDefault();
26
+ onClick?.(e);
27
+ alert(`RouterLink intercepted navigation to: ${href}`);
28
+ }}
29
+ {...props}>
30
+ {children}
31
+ </a>
32
+ );
33
+ }
34
+
35
+ export default function LinkProviderCustomLink() {
36
+ return (
37
+ <LinkProvider component={RouterLink}>
38
+ <Link href="/dashboard" isStandalone>
39
+ Go to dashboard
40
+ </Link>
41
+ </LinkProvider>
42
+ );
43
+ }
@@ -1,15 +1,19 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
+ 'use client';
4
+
5
+ import {useState} from 'react';
3
6
  import {MultiSelector} from '@astryxdesign/core/MultiSelector';
4
7
 
5
8
  export default function MultiSelectorShowcase() {
9
+ const [value, setValue] = useState<string[]>([]);
6
10
  return (
7
11
  <div style={{width: 300}}>
8
12
  <MultiSelector
9
13
  label="Columns"
10
14
  options={['Name', 'Email', 'Role', 'Status', 'Created']}
11
- value={[]}
12
- onChange={() => {}}
15
+ value={value}
16
+ onChange={setValue}
13
17
  placeholder="Select columns..."
14
18
  />
15
19
  </div>
@@ -1,15 +1,19 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
+ 'use client';
4
+
5
+ import {useState} from 'react';
3
6
  import {NumberInput} from '@astryxdesign/core/NumberInput';
4
7
 
5
8
  export default function NumberInputShowcase() {
9
+ const [value, setValue] = useState<number | null>(0);
6
10
  return (
7
11
  <div style={{width: 300}}>
8
12
  <NumberInput
9
13
  label="Quantity"
10
14
  placeholder="Enter quantity"
11
- value={0}
12
- onChange={() => {}}
15
+ value={value}
16
+ onChange={setValue}
13
17
  />
14
18
  </div>
15
19
  );
@@ -1,10 +1,17 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
+ 'use client';
4
+
5
+ import {useState} from 'react';
3
6
  import {RadioList, RadioListItem} from '@astryxdesign/core/RadioList';
4
7
 
5
8
  export default function RadioListShowcase() {
9
+ const [value, setValue] = useState('');
6
10
  return (
7
- <RadioList label="Notification preference" value="" onChange={() => {}}>
11
+ <RadioList
12
+ label="Notification preference"
13
+ value={value}
14
+ onChange={setValue}>
8
15
  <RadioListItem label="Email" value="email" />
9
16
  <RadioListItem label="SMS" value="sms" />
10
17
  <RadioListItem label="Push notification" value="push" />
@@ -2,14 +2,16 @@
2
2
 
3
3
  'use client';
4
4
 
5
+ import {useState} from 'react';
5
6
  import {
6
7
  SegmentedControl,
7
8
  SegmentedControlItem,
8
9
  } from '@astryxdesign/core/SegmentedControl';
9
10
 
10
11
  export default function SegmentedControlShowcase() {
12
+ const [value, setValue] = useState('grid');
11
13
  return (
12
- <SegmentedControl value="grid" onChange={() => {}} label="View mode">
14
+ <SegmentedControl value={value} onChange={setValue} label="View mode">
13
15
  <SegmentedControlItem value="grid" label="Grid" />
14
16
  <SegmentedControlItem value="list" label="List" />
15
17
  <SegmentedControlItem value="table" label="Table" />
@@ -2,16 +2,19 @@
2
2
 
3
3
  'use client';
4
4
 
5
+ import {useState} from 'react';
5
6
  import {Selector} from '@astryxdesign/core/Selector';
6
7
 
7
8
  export default function SelectorShowcase() {
9
+ const [value, setValue] = useState<string | undefined>();
8
10
  return (
9
11
  <Selector
10
12
  style={{width: 300}}
11
13
  label="Fruit"
12
14
  options={['Apple', 'Banana', 'Orange', 'Mango', 'Pineapple']}
13
15
  placeholder="Select a fruit..."
14
- onChange={() => {}}
16
+ value={value}
17
+ onChange={setValue}
15
18
  />
16
19
  );
17
20
  }
@@ -2,8 +2,17 @@
2
2
 
3
3
  'use client';
4
4
 
5
+ import {useState} from 'react';
5
6
  import {Slider} from '@astryxdesign/core/Slider';
6
7
 
7
8
  export default function SliderShowcase() {
8
- return <Slider label="Volume" value={50} style={{width: 300}} />;
9
+ const [value, setValue] = useState(50);
10
+ return (
11
+ <Slider
12
+ label="Volume"
13
+ value={value}
14
+ onChange={setValue}
15
+ style={{width: 300}}
16
+ />
17
+ );
9
18
  }
@@ -2,12 +2,14 @@
2
2
 
3
3
  'use client';
4
4
 
5
+ import {useState} from 'react';
5
6
  import {TabList, Tab} from '@astryxdesign/core/TabList';
6
7
  import {Badge} from '@astryxdesign/core/Badge';
7
8
 
8
9
  export default function TabShowcase() {
10
+ const [value, setValue] = useState('inbox');
9
11
  return (
10
- <TabList value="inbox" onChange={() => {}}>
12
+ <TabList value={value} onChange={setValue}>
11
13
  <Tab
12
14
  value="inbox"
13
15
  label="Inbox"
@@ -2,11 +2,13 @@
2
2
 
3
3
  'use client';
4
4
 
5
+ import {useState} from 'react';
5
6
  import {TabList, Tab} from '@astryxdesign/core/TabList';
6
7
 
7
8
  export default function TabListShowcase() {
9
+ const [value, setValue] = useState('home');
8
10
  return (
9
- <TabList value="home" onChange={() => {}}>
11
+ <TabList value={value} onChange={setValue}>
10
12
  <Tab value="home" label="Home" />
11
13
  <Tab value="projects" label="Projects" />
12
14
  <Tab value="settings" label="Settings" />
@@ -2,11 +2,13 @@
2
2
 
3
3
  'use client';
4
4
 
5
+ import {useState} from 'react';
5
6
  import {TabList, Tab, TabMenu} from '@astryxdesign/core/TabList';
6
7
 
7
8
  export default function TabMenuShowcase() {
9
+ const [value, setValue] = useState('settings');
8
10
  return (
9
- <TabList value="settings" onChange={() => {}}>
11
+ <TabList value={value} onChange={setValue}>
10
12
  <Tab value="overview" label="Overview" />
11
13
  <Tab value="activity" label="Activity" />
12
14
  <TabMenu
@@ -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: 'useTableColumnResize',
7
+ name: 'useTableColumnResize — Draggable Columns',
8
+ displayName: 'useTableColumnResize — Draggable Columns',
9
+ description:
10
+ 'A Table using useTableColumnResize. Drag the right edge of any column header to resize; widths are committed on release. The last proportional column flexes to fill remaining space.',
11
+ isReady: true,
12
+ aspectRatio: 16 / 9,
13
+ componentsUsed: ['Table'],
14
+ };
@@ -0,0 +1,59 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {useState} from 'react';
6
+ import {
7
+ Table,
8
+ useTableColumnResize,
9
+ proportional,
10
+ pixel,
11
+ } from '@astryxdesign/core/Table';
12
+
13
+ interface User extends Record<string, unknown> {
14
+ id: string;
15
+ name: string;
16
+ email: string;
17
+ role: string;
18
+ }
19
+
20
+ const users: User[] = [
21
+ {
22
+ id: '1',
23
+ name: 'Alice Johnson',
24
+ email: 'alice@example.com',
25
+ role: 'Engineer',
26
+ },
27
+ {id: '2', name: 'Bob Smith', email: 'bob@example.com', role: 'Designer'},
28
+ {id: '3', name: 'Charlie Brown', email: 'charlie@example.com', role: 'PM'},
29
+ {id: '4', name: 'Diana Prince', email: 'diana@example.com', role: 'Engineer'},
30
+ {id: '5', name: 'Eve Davis', email: 'eve@example.com', role: 'Analyst'},
31
+ ];
32
+
33
+ const columns = [
34
+ {key: 'name', header: 'Name'},
35
+ {key: 'email', header: 'Email', width: proportional(2)},
36
+ {key: 'role', header: 'Role', width: pixel(120)},
37
+ ];
38
+
39
+ export default function ColumnResizeHookUsage() {
40
+ const [columnWidths, setColumnWidths] = useState<Record<string, number>>({});
41
+
42
+ const columnResize = useTableColumnResize({
43
+ columnWidths,
44
+ columns,
45
+ onColumnResizeEnd: updates => {
46
+ setColumnWidths(prev => ({...prev, ...updates}));
47
+ },
48
+ });
49
+
50
+ return (
51
+ <Table
52
+ data={users}
53
+ columns={columns}
54
+ idKey="id"
55
+ hasHover
56
+ plugins={{columnResize}}
57
+ />
58
+ );
59
+ }
@@ -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: 'useTableStickyColumns',
7
+ name: 'useTableStickyColumns — Pinned Columns',
8
+ displayName: 'useTableStickyColumns — Pinned Columns',
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.',
11
+ isReady: true,
12
+ aspectRatio: 16 / 9,
13
+ componentsUsed: ['Table'],
14
+ };
@@ -0,0 +1,104 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {Table, useTableStickyColumns, pixel} from '@astryxdesign/core/Table';
6
+
7
+ interface Employee extends Record<string, unknown> {
8
+ id: string;
9
+ name: string;
10
+ email: string;
11
+ team: string;
12
+ role: string;
13
+ location: string;
14
+ startDate: string;
15
+ status: string;
16
+ }
17
+
18
+ const employees: Employee[] = [
19
+ {
20
+ id: '1',
21
+ name: 'Alice Johnson',
22
+ email: 'alice@example.com',
23
+ team: 'Design Systems',
24
+ role: 'Staff Engineer',
25
+ location: 'San Francisco',
26
+ startDate: '2019-03-12',
27
+ status: 'Active',
28
+ },
29
+ {
30
+ id: '2',
31
+ name: 'Bob Smith',
32
+ email: 'bob@example.com',
33
+ team: 'Design Systems',
34
+ role: 'Senior Designer',
35
+ location: 'New York',
36
+ startDate: '2020-07-01',
37
+ status: 'Active',
38
+ },
39
+ {
40
+ id: '3',
41
+ name: 'Charlie Brown',
42
+ email: 'charlie@example.com',
43
+ team: 'Platform',
44
+ role: 'Engineering Manager',
45
+ location: 'London',
46
+ startDate: '2017-11-20',
47
+ status: 'On leave',
48
+ },
49
+ {
50
+ id: '4',
51
+ name: 'Diana Prince',
52
+ email: 'diana@example.com',
53
+ team: 'Platform',
54
+ role: 'Staff Engineer',
55
+ location: 'Remote',
56
+ startDate: '2021-01-15',
57
+ status: 'Active',
58
+ },
59
+ {
60
+ id: '5',
61
+ name: 'Eve Davis',
62
+ email: 'eve@example.com',
63
+ team: 'Growth',
64
+ role: 'Product Engineer',
65
+ location: 'Berlin',
66
+ startDate: '2022-05-30',
67
+ status: 'Active',
68
+ },
69
+ ];
70
+
71
+ // Wide fixed-width columns so the table overflows and scrolls horizontally,
72
+ // keeping the pinned Name (start) and Status (end) columns in view.
73
+ const columns = [
74
+ {key: 'name', header: 'Name', width: pixel(180)},
75
+ {key: 'email', header: 'Email', width: pixel(220)},
76
+ {key: 'team', header: 'Team', width: pixel(180)},
77
+ {key: 'role', header: 'Role', width: pixel(200)},
78
+ {key: 'location', header: 'Location', width: pixel(160)},
79
+ {key: 'startDate', header: 'Start date', width: pixel(140)},
80
+ {key: 'status', header: 'Status', width: pixel(140)},
81
+ ];
82
+
83
+ export default function StickyColumnsHookUsage() {
84
+ const stickyColumns = useTableStickyColumns<Employee>({
85
+ startKeys: ['name'],
86
+ endKeys: ['status'],
87
+ });
88
+
89
+ return (
90
+ // Constrain the width so the Table's own horizontal scroll container is
91
+ // narrower than its columns — that scroll container is what sticky columns
92
+ // pin against. Without a width cap the table renders full-width and never
93
+ // scrolls internally, so nothing sticks.
94
+ <div style={{width: 560, maxWidth: '100%'}}>
95
+ <Table
96
+ data={employees}
97
+ columns={columns}
98
+ idKey="id"
99
+ hasHover
100
+ plugins={{stickyColumns}}
101
+ />
102
+ </div>
103
+ );
104
+ }
@@ -6,11 +6,26 @@ import {Text} from '@astryxdesign/core/Text';
6
6
  import {Stack} from '@astryxdesign/core/Stack';
7
7
 
8
8
  const COLORS = [
9
- {color: 'primary' as const, description: 'Primary — Default for headings and body text'},
10
- {color: 'secondary' as const, description: 'Secondary — Supporting details and metadata'},
11
- {color: 'active' as const, description: 'Active — Links, success states, and emphasis'},
12
- {color: 'disabled' as const, description: 'Disabled — Unavailable or inactive content'},
13
- {color: 'placeholder' as const, description: 'Placeholder — Empty field hints'},
9
+ {
10
+ color: 'primary' as const,
11
+ description: 'Primary — Default for headings and body text',
12
+ },
13
+ {
14
+ color: 'secondary' as const,
15
+ description: 'Secondary — Supporting details and metadata',
16
+ },
17
+ {
18
+ color: 'accent' as const,
19
+ description: 'Accent — Links, emphasis, and accent-colored text',
20
+ },
21
+ {
22
+ color: 'disabled' as const,
23
+ description: 'Disabled — Unavailable or inactive content',
24
+ },
25
+ {
26
+ color: 'placeholder' as const,
27
+ description: 'Placeholder — Empty field hints',
28
+ },
14
29
  ];
15
30
 
16
31
  export default function TextColors() {
@@ -2,15 +2,17 @@
2
2
 
3
3
  'use client';
4
4
 
5
+ import {useState} from 'react';
5
6
  import {TextArea} from '@astryxdesign/core/TextArea';
6
7
 
7
8
  export default function TextAreaShowcase() {
9
+ const [value, setValue] = useState('');
8
10
  return (
9
11
  <div style={{width: 400}}>
10
12
  <TextArea
11
13
  label="Description"
12
- value=""
13
- onChange={() => {}}
14
+ value={value}
15
+ onChange={setValue}
14
16
  placeholder="Enter a description..."
15
17
  />
16
18
  </div>
@@ -2,15 +2,17 @@
2
2
 
3
3
  'use client';
4
4
 
5
+ import {useState} from 'react';
5
6
  import {TextInput} from '@astryxdesign/core/TextInput';
6
7
 
7
8
  export default function TextInputShowcase() {
9
+ const [value, setValue] = useState('');
8
10
  return (
9
11
  <div style={{width: 300}}>
10
12
  <TextInput
11
13
  label="Name"
12
- value=""
13
- onChange={() => {}}
14
+ value={value}
15
+ onChange={setValue}
14
16
  placeholder="Enter your name"
15
17
  />
16
18
  </div>
@@ -8,10 +8,30 @@ import {Stack} from '@astryxdesign/core/Layout';
8
8
  import {Text} from '@astryxdesign/core/Text';
9
9
 
10
10
  const ATTACHMENTS = [
11
- {id: 1, src: 'https://lookaside.facebook.com/assets/astryx/illustrative-vertical-1.png', alt: 'River through a valley', label: 'valley.jpg'},
12
- {id: 2, src: 'https://lookaside.facebook.com/assets/astryx/illustrative-vertical-2.png', alt: 'Foggy mountain peak', label: 'mountain.jpg'},
13
- {id: 3, src: 'https://lookaside.facebook.com/assets/astryx/illustrative-vertical-3.png', alt: 'Golden retriever puppy', label: 'puppy.jpg'},
14
- {id: 4, src: 'https://lookaside.facebook.com/assets/astryx/illustrative-vertical-4.png', alt: 'Bridge at sunset', label: 'bridge.jpg'},
11
+ {
12
+ id: 1,
13
+ src: 'https://lookaside.facebook.com/assets/astryx/illustrative-vertical-1.png',
14
+ alt: 'River through a valley',
15
+ label: 'valley.jpg',
16
+ },
17
+ {
18
+ id: 2,
19
+ src: 'https://lookaside.facebook.com/assets/astryx/illustrative-vertical-2.png',
20
+ alt: 'Foggy mountain peak',
21
+ label: 'mountain.jpg',
22
+ },
23
+ {
24
+ id: 3,
25
+ src: 'https://lookaside.facebook.com/assets/astryx/illustrative-vertical-3.png',
26
+ alt: 'Golden retriever puppy',
27
+ label: 'puppy.jpg',
28
+ },
29
+ {
30
+ id: 4,
31
+ src: 'https://lookaside.facebook.com/assets/astryx/illustrative-vertical-4.png',
32
+ alt: 'Bridge at sunset',
33
+ label: 'bridge.jpg',
34
+ },
15
35
  ];
16
36
 
17
37
  export default function ThumbnailGallery() {
@@ -38,7 +58,7 @@ export default function ThumbnailGallery() {
38
58
  ))}
39
59
  </Stack>
40
60
  {selected != null && (
41
- <Text type="supporting" color="active">
61
+ <Text type="supporting" color="accent">
42
62
  Previewing: {selected}
43
63
  </Text>
44
64
  )}
@@ -31,9 +31,9 @@ export default function TimestampColors() {
31
31
  </Stack>
32
32
  <Stack direction="vertical" gap={1}>
33
33
  <Text type="supporting" color="secondary">
34
- Active
34
+ Accent
35
35
  </Text>
36
- <Timestamp value={DATE} format="date_time" color="active" />
36
+ <Timestamp value={DATE} format="date_time" color="accent" />
37
37
  </Stack>
38
38
  </Stack>
39
39
  );
@@ -3,7 +3,7 @@
3
3
  /** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
4
4
  export const doc = {
5
5
  type: 'block',
6
- exampleFor: 'ToggleButton',
6
+ exampleFor: 'ToggleButtonGroup',
7
7
  name: 'ToggleButton — Group',
8
8
  displayName: 'ToggleButton — Group',
9
9
  description: 'Toggle button groups in single-select and multi-select modes. Single selection acts as a view mode switcher; multiple selection forms a formatting toolbar.',
@@ -2,8 +2,9 @@
2
2
 
3
3
  'use client';
4
4
 
5
+ import {useState} from 'react';
5
6
  import {Tokenizer} from '@astryxdesign/core/Tokenizer';
6
- import type {SearchSource} from '@astryxdesign/core/Typeahead';
7
+ import type {SearchableItem, SearchSource} from '@astryxdesign/core/Typeahead';
7
8
 
8
9
  const source: SearchSource = {
9
10
  search: () => [],
@@ -11,16 +12,17 @@ const source: SearchSource = {
11
12
  };
12
13
 
13
14
  export default function TokenizerShowcase() {
15
+ const [value, setValue] = useState<SearchableItem[]>([
16
+ {id: '1', label: 'Design'},
17
+ {id: '2', label: 'Engineering'},
18
+ ]);
14
19
  return (
15
20
  <Tokenizer
16
21
  label="Tags"
17
22
  placeholder="Search..."
18
23
  searchSource={source}
19
- value={[
20
- {id: '1', label: 'Design'},
21
- {id: '2', label: 'Engineering'},
22
- ]}
23
- onChange={() => {}}
24
+ value={value}
25
+ onChange={setValue}
24
26
  style={{width: 400}}
25
27
  />
26
28
  );
@@ -1,5 +1,8 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
+ 'use client';
4
+
5
+ import {useState} from 'react';
3
6
  import {Typeahead} from '@astryxdesign/core/Typeahead';
4
7
  import type {SearchableItem, SearchSource} from '@astryxdesign/core/Typeahead';
5
8
 
@@ -21,14 +24,15 @@ const fruitSource: SearchSource = {
21
24
  };
22
25
 
23
26
  export default function TypeaheadShowcase() {
27
+ const [value, setValue] = useState<SearchableItem | null>(null);
24
28
  return (
25
29
  <div style={{width: 320}}>
26
30
  <Typeahead
27
31
  label="Fruit"
28
32
  placeholder="Search fruits..."
29
33
  searchSource={fruitSource}
30
- value={null}
31
- onChange={() => {}}
34
+ value={value}
35
+ onChange={setValue}
32
36
  />
33
37
  </div>
34
38
  );