@astryxdesign/cli 0.4.3 → 0.4.4-canary.0e8af82

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 (56) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +45 -43
  3. package/api/discover/_adapter.d.mts +5 -3
  4. package/api/discover/_adapter.mjs +6 -4
  5. package/api/template/cdn/cdn.d.mts +23 -0
  6. package/api/template/cdn/cdn.mjs +86 -0
  7. package/api/template/cdn/cdn.test.mjs +108 -0
  8. package/api/template/template.d.mts +2 -0
  9. package/api/template/template.doc.mjs +21 -3
  10. package/api/template/template.mjs +16 -2
  11. package/api/template/template.type.d.mts +19 -0
  12. package/api/template/template.type.mjs +12 -0
  13. package/api/theme/theme.type.d.mts +16 -0
  14. package/api/theme/theme.type.mjs +11 -0
  15. package/assets/cdn.template.html +124 -0
  16. package/assets/docs/theme.doc.dense.mjs +1 -1
  17. package/assets/docs/theme.doc.mjs +5 -4
  18. package/assets/docs/theme.doc.zh.mjs +1 -1
  19. package/assets/templates/blocks/components/BottomSheet/BottomSheetHeights.doc.mjs +21 -0
  20. package/assets/templates/blocks/components/BottomSheet/BottomSheetHeights.tsx +46 -0
  21. package/assets/templates/blocks/components/BottomSheet/BottomSheetMobileKeyboard.doc.mjs +23 -0
  22. package/assets/templates/blocks/components/BottomSheet/BottomSheetMobileKeyboard.tsx +100 -0
  23. package/assets/templates/blocks/components/BottomSheet/BottomSheetNoScrim.doc.mjs +22 -0
  24. package/assets/templates/blocks/components/BottomSheet/BottomSheetNoScrim.tsx +47 -0
  25. package/assets/templates/blocks/components/BottomSheet/BottomSheetShowcase.doc.mjs +22 -0
  26. package/assets/templates/blocks/components/BottomSheet/BottomSheetShowcase.tsx +51 -0
  27. package/assets/templates/blocks/components/BottomSheet/BottomSheetSnapPoints.doc.mjs +23 -0
  28. package/assets/templates/blocks/components/BottomSheet/BottomSheetSnapPoints.tsx +155 -0
  29. package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherShowcase.doc.mjs +26 -0
  30. package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherShowcase.tsx +221 -0
  31. package/assets/theme.template.ts +4 -3
  32. package/authoring/doctypes/base/type.ts +9 -0
  33. package/clients/cli/commands/build-theme.mjs +154 -65
  34. package/clients/cli/commands/build-theme.multi.test.mjs +148 -0
  35. package/clients/cli/commands/build-theme.watch.test.mjs +67 -0
  36. package/clients/cli/commands/discover.broken-integration.test.mjs +112 -0
  37. package/clients/cli/commands/discover.mjs +12 -0
  38. package/clients/cli/commands/search.mjs +9 -0
  39. package/clients/cli/commands/template-cdn.behavior.test.mjs +113 -0
  40. package/clients/cli/commands/template.doc.mjs +12 -2
  41. package/clients/cli/commands/template.mjs +24 -3
  42. package/clients/cli/commands/theme-build.doc.mjs +11 -5
  43. package/clients/cli/lib/json-shim.test.mjs +1 -1
  44. package/clients/cli/lib/manifest.mjs +3 -2
  45. package/clients/cli/lib/manifest.test.mjs +4 -2
  46. package/foundation/integrations/integration-warnings.test.mjs +17 -0
  47. package/foundation/integrations/validate-contributions.mjs +7 -0
  48. package/foundation/response/response-types.doc.mjs +11 -0
  49. package/foundation/text/copyright-header.mjs +11 -4
  50. package/package.json +12 -9
  51. package/assets/templates/pages/table-page-chart/page.tsx +0 -577
  52. package/assets/templates/pages/table-page-chart/template.doc.mjs +0 -13
  53. package/assets/templates/pages/table-page-heatmap-status/page.tsx +0 -467
  54. package/assets/templates/pages/table-page-heatmap-status/template.doc.mjs +0 -13
  55. package/assets/templates/pages/table-page-shoe-store-heatmap/page.tsx +0 -931
  56. package/assets/templates/pages/table-page-shoe-store-heatmap/template.doc.mjs +0 -13
@@ -0,0 +1,155 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {useState} from 'react';
6
+ import {
7
+ BottomSheet,
8
+ type BottomSheetSnapPoint,
9
+ } from '@astryxdesign/core/BottomSheet';
10
+ import {Button} from '@astryxdesign/core/Button';
11
+ import {Divider} from '@astryxdesign/core/Divider';
12
+ import {Heading} from '@astryxdesign/core/Heading';
13
+ import {Icon} from '@astryxdesign/core/Icon';
14
+ import {Item} from '@astryxdesign/core/Item';
15
+ import {HStack, VStack} from '@astryxdesign/core/Stack';
16
+ import {Text} from '@astryxdesign/core/Text';
17
+ import {
18
+ ArrowLeftIcon,
19
+ ArrowRightIcon,
20
+ ArrowUpIcon,
21
+ ArrowUturnLeftIcon,
22
+ FlagIcon,
23
+ MapPinIcon,
24
+ } from '@heroicons/react/24/outline';
25
+
26
+ // Half the viewport is a working surface — the sheet lays its content out at
27
+ // that height and keeps a full scrim. The 96px stop is a peek: a sliver, so the
28
+ // sheet slides away rather than reflowing into it, and the scrim thins.
29
+ const SNAP_POINTS: ReadonlyArray<BottomSheetSnapPoint> = ['96px', '50%'];
30
+
31
+ const steps = [
32
+ {
33
+ icon: MapPinIcon,
34
+ label: 'Head northeast on Mission St',
35
+ detail: 'Toward 3rd St',
36
+ distance: '350 ft',
37
+ },
38
+ {
39
+ icon: ArrowRightIcon,
40
+ label: 'Turn right onto 3rd St',
41
+ detail: 'Pass Yerba Buena Gardens on your left',
42
+ distance: '0.2 mi',
43
+ },
44
+ {
45
+ icon: ArrowUpIcon,
46
+ label: 'Continue onto Kearny St',
47
+ detail: 'Stay in the right lane',
48
+ distance: '0.4 mi',
49
+ },
50
+ {
51
+ icon: ArrowLeftIcon,
52
+ label: 'Turn left onto Market St',
53
+ detail: 'Cable car crossing ahead',
54
+ distance: '0.6 mi',
55
+ },
56
+ {
57
+ icon: ArrowRightIcon,
58
+ label: 'Bear right onto Sutter St',
59
+ detail: 'Toward the Financial District',
60
+ distance: '0.3 mi',
61
+ },
62
+ {
63
+ icon: ArrowUpIcon,
64
+ label: 'Continue on Sansome St',
65
+ detail: 'Four blocks, past Pine St',
66
+ distance: '0.5 mi',
67
+ },
68
+ {
69
+ icon: ArrowUturnLeftIcon,
70
+ label: 'Make a U-turn at Washington St',
71
+ detail: 'Construction detour until March',
72
+ distance: '150 ft',
73
+ },
74
+ {
75
+ icon: ArrowRightIcon,
76
+ label: 'Turn right onto Battery St',
77
+ detail: 'Follow signs for the Embarcadero',
78
+ distance: '0.4 mi',
79
+ },
80
+ {
81
+ icon: ArrowLeftIcon,
82
+ label: 'Turn left onto Sacramento St',
83
+ detail: 'Toward the waterfront',
84
+ distance: '0.2 mi',
85
+ },
86
+ {
87
+ icon: ArrowRightIcon,
88
+ label: 'Turn right onto The Embarcadero',
89
+ detail: 'Bay Bridge on your right',
90
+ distance: '0.5 mi',
91
+ },
92
+ {
93
+ icon: ArrowUpIcon,
94
+ label: 'Continue past Pier 14',
95
+ detail: 'Ferry terminal signage begins here',
96
+ distance: '0.3 mi',
97
+ },
98
+ {
99
+ icon: FlagIcon,
100
+ label: 'Arrive at the Ferry Building',
101
+ detail: 'Parking garage entrance on Washington St',
102
+ distance: '—',
103
+ },
104
+ ];
105
+
106
+ export default function BottomSheetSnapPoints() {
107
+ const [isOpen, setIsOpen] = useState(false);
108
+
109
+ return (
110
+ <>
111
+ <VStack gap={3} align="start">
112
+ <Text type="body">
113
+ This sheet has two extra stops: half the viewport, and a 96px peek.
114
+ Drag the handle down to collapse it, then back up — it rests at each
115
+ stop instead of following your finger.
116
+ </Text>
117
+ <Button label="Show directions" onClick={() => setIsOpen(true)} />
118
+ </VStack>
119
+ <BottomSheet
120
+ isOpen={isOpen}
121
+ onOpenChange={setIsOpen}
122
+ label="Directions to the Ferry Building"
123
+ height="tall"
124
+ snapPoints={SNAP_POINTS}>
125
+ <VStack gap={4} padding={4}>
126
+ <VStack gap={1}>
127
+ <Heading level={3}>Ferry Building</Heading>
128
+ <HStack gap={2}>
129
+ <Text type="label">18 min</Text>
130
+ <Text type="supporting">3.7 mi · arrive 9:41 AM</Text>
131
+ </HStack>
132
+ </VStack>
133
+ <Divider />
134
+ <VStack gap={0}>
135
+ {steps.map(step => (
136
+ <Item
137
+ key={step.label}
138
+ startContent={<Icon icon={step.icon} size="sm" />}
139
+ label={step.label}
140
+ description={step.detail}
141
+ endContent={<Text type="supporting">{step.distance}</Text>}
142
+ />
143
+ ))}
144
+ </VStack>
145
+ <Divider />
146
+ <Button
147
+ label="Start"
148
+ onClick={() => setIsOpen(false)}
149
+ variant="primary"
150
+ />
151
+ </VStack>
152
+ </BottomSheet>
153
+ </>
154
+ );
155
+ }
@@ -0,0 +1,26 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
4
+ export const doc = {
5
+ type: 'block',
6
+ exampleFor: 'BottomSheetSwitcher',
7
+ name: 'Bottom Sheet Switcher',
8
+ displayName: 'Bottom Sheet Switcher',
9
+ description:
10
+ 'A three-step flow that transitions between content-hugging sheets of different heights inside one shared dialog.',
11
+ isReady: true,
12
+ isShowcase: true,
13
+ aspectRatio: 3 / 4,
14
+ componentsUsed: [
15
+ 'BottomSheet',
16
+ 'BottomSheetSwitcher',
17
+ 'Button',
18
+ 'CheckboxInput',
19
+ 'Divider',
20
+ 'Heading',
21
+ 'RadioList',
22
+ 'Section',
23
+ 'Stack',
24
+ 'Text',
25
+ ],
26
+ };
@@ -0,0 +1,221 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {useState} from 'react';
6
+ import {BottomSheet, BottomSheetSwitcher} from '@astryxdesign/core/BottomSheet';
7
+ import {Button} from '@astryxdesign/core/Button';
8
+ import {CheckboxInput} from '@astryxdesign/core/CheckboxInput';
9
+ import {Divider} from '@astryxdesign/core/Divider';
10
+ import {Heading} from '@astryxdesign/core/Heading';
11
+ import {Section} from '@astryxdesign/core/Section';
12
+ import {HStack, VStack} from '@astryxdesign/core/Stack';
13
+ import {Text} from '@astryxdesign/core/Text';
14
+ import {RadioList, RadioListItem} from '@astryxdesign/core/RadioList';
15
+
16
+ type NotificationSheetHeight = 'hug' | 'capped';
17
+
18
+ interface NotificationOverviewSheetProps {
19
+ height: NotificationSheetHeight;
20
+ onCancel: () => void;
21
+ onContinue: () => void;
22
+ }
23
+
24
+ function NotificationOverviewSheet({
25
+ height,
26
+ onCancel,
27
+ onContinue,
28
+ }: NotificationOverviewSheetProps) {
29
+ return (
30
+ <BottomSheet
31
+ sheetId="overview"
32
+ label="Set up notifications"
33
+ height={height}>
34
+ <Section padding={4}>
35
+ <VStack gap={4}>
36
+ <VStack gap={1}>
37
+ <Heading level={3}>Set up notifications</Heading>
38
+ <Text type="supporting" color="secondary">
39
+ Step 1 of 3
40
+ </Text>
41
+ </VStack>
42
+ <Divider />
43
+ <Text type="supporting" color="secondary">
44
+ Stay informed about activity that matters without checking back
45
+ throughout the day.
46
+ </Text>
47
+ <VStack gap={3}>
48
+ <VStack gap={1}>
49
+ <Text type="label">Important activity</Text>
50
+ <Text type="supporting" color="secondary">
51
+ Know when someone mentions you or needs your attention.
52
+ </Text>
53
+ </VStack>
54
+ <VStack gap={1}>
55
+ <Text type="label">Timely reminders</Text>
56
+ <Text type="supporting" color="secondary">
57
+ Get a reminder before work reaches its due date.
58
+ </Text>
59
+ </VStack>
60
+ <VStack gap={1}>
61
+ <Text type="label">Useful summaries</Text>
62
+ <Text type="supporting" color="secondary">
63
+ Catch up on anything you may have missed.
64
+ </Text>
65
+ </VStack>
66
+ </VStack>
67
+ <HStack gap={2} hAlign="end">
68
+ <Button label="Cancel" variant="secondary" onClick={onCancel} />
69
+ <Button label="Continue" onClick={onContinue} />
70
+ </HStack>
71
+ </VStack>
72
+ </Section>
73
+ </BottomSheet>
74
+ );
75
+ }
76
+
77
+ interface NotificationFrequencySheetProps {
78
+ height: NotificationSheetHeight;
79
+ onBack: () => void;
80
+ onContinue: () => void;
81
+ }
82
+
83
+ function NotificationFrequencySheet({
84
+ height,
85
+ onBack,
86
+ onContinue,
87
+ }: NotificationFrequencySheetProps) {
88
+ const [frequency, setFrequency] = useState('daily');
89
+
90
+ return (
91
+ <BottomSheet
92
+ sheetId="frequency"
93
+ label="Notification frequency"
94
+ height={height}>
95
+ <Section padding={4}>
96
+ <VStack gap={4}>
97
+ <VStack gap={1}>
98
+ <Heading level={3}>How often?</Heading>
99
+ <Text type="supporting" color="secondary">
100
+ Step 2 of 3
101
+ </Text>
102
+ </VStack>
103
+ <Divider />
104
+ <RadioList
105
+ label="Notification frequency"
106
+ isLabelHidden
107
+ value={frequency}
108
+ onChange={setFrequency}>
109
+ <RadioListItem label="Immediately" value="immediately" />
110
+ <RadioListItem label="Daily" value="daily" />
111
+ <RadioListItem label="Weekly" value="weekly" />
112
+ </RadioList>
113
+ <HStack gap={2} hAlign="end">
114
+ <Button label="Back" variant="secondary" onClick={onBack} />
115
+ <Button label="Continue" onClick={onContinue} />
116
+ </HStack>
117
+ </VStack>
118
+ </Section>
119
+ </BottomSheet>
120
+ );
121
+ }
122
+
123
+ interface NotificationChannelsSheetProps {
124
+ height: NotificationSheetHeight;
125
+ onBack: () => void;
126
+ onFinish: () => void;
127
+ }
128
+
129
+ function NotificationChannelsSheet({
130
+ height,
131
+ onBack,
132
+ onFinish,
133
+ }: NotificationChannelsSheetProps) {
134
+ const [email, setEmail] = useState(true);
135
+ const [pushNotifications, setPushNotifications] = useState(true);
136
+ const [textMessages, setTextMessages] = useState(false);
137
+
138
+ return (
139
+ <BottomSheet
140
+ sheetId="channels"
141
+ label="Notification channels"
142
+ height={height}>
143
+ <Section padding={4}>
144
+ <VStack gap={4}>
145
+ <VStack gap={1}>
146
+ <Heading level={3}>Where should we notify you?</Heading>
147
+ <Text type="supporting" color="secondary">
148
+ Step 3 of 3
149
+ </Text>
150
+ </VStack>
151
+ <Divider />
152
+ <Text type="supporting" color="secondary">
153
+ Choose any combination. You can change these preferences later.
154
+ </Text>
155
+ <VStack gap={2}>
156
+ <CheckboxInput label="Email" value={email} onChange={setEmail} />
157
+ <CheckboxInput
158
+ label="Push notifications"
159
+ value={pushNotifications}
160
+ onChange={setPushNotifications}
161
+ />
162
+ <CheckboxInput
163
+ label="Text messages"
164
+ value={textMessages}
165
+ onChange={setTextMessages}
166
+ />
167
+ </VStack>
168
+ <HStack gap={2} hAlign="end">
169
+ <Button label="Back" variant="secondary" onClick={onBack} />
170
+ <Button label="Finish" onClick={onFinish} />
171
+ </HStack>
172
+ </VStack>
173
+ </Section>
174
+ </BottomSheet>
175
+ );
176
+ }
177
+
178
+ interface MultiStepSwitcherExampleProps {
179
+ height: NotificationSheetHeight;
180
+ hasScrim?: boolean;
181
+ }
182
+
183
+ function MultiStepSwitcherExample({
184
+ height,
185
+ hasScrim = true,
186
+ }: MultiStepSwitcherExampleProps) {
187
+ const [activeSheet, setActiveSheet] = useState<string | null>(null);
188
+
189
+ return (
190
+ <>
191
+ <Button
192
+ label="Set up notifications"
193
+ onClick={() => setActiveSheet('overview')}
194
+ />
195
+ <BottomSheetSwitcher
196
+ activeSheet={activeSheet}
197
+ onActiveSheetChange={setActiveSheet}
198
+ hasScrim={hasScrim}>
199
+ <NotificationOverviewSheet
200
+ height={height}
201
+ onCancel={() => setActiveSheet(null)}
202
+ onContinue={() => setActiveSheet('frequency')}
203
+ />
204
+ <NotificationFrequencySheet
205
+ height={height}
206
+ onBack={() => setActiveSheet('overview')}
207
+ onContinue={() => setActiveSheet('channels')}
208
+ />
209
+ <NotificationChannelsSheet
210
+ height={height}
211
+ onBack={() => setActiveSheet('frequency')}
212
+ onFinish={() => setActiveSheet(null)}
213
+ />
214
+ </BottomSheetSwitcher>
215
+ </>
216
+ );
217
+ }
218
+
219
+ export default function BottomSheetSwitcherShowcase() {
220
+ return <MultiStepSwitcherExample height="hug" />;
221
+ }
@@ -105,12 +105,13 @@ export const myTheme = defineTheme({
105
105
  // ───────────────────────────────────────────────────────────────────────
106
106
 
107
107
  /**
108
- * Generates the neutral ramp and the accent tokens from one seed colour
108
+ * Generates the neutral ramp and the accent tokens from a seed colour
109
109
  * using the HCT perceptual model: surfaces, text, icons, borders, muted
110
110
  * fills, hover and pressed overlays — light and dark both.
111
111
  *
112
- * accent seed hex; omit to keep the default accent and re-tone only
113
- * the neutrals
112
+ * accent seed hex, or a [light, dark] pair to seed each scheme's
113
+ * palette from its own colour; omit to keep the default
114
+ * accent and re-tone only the neutrals
114
115
  * neutralStyle 'warm' | 'cool' | 'neutral' — the temperature of the greys
115
116
  * contrast 'standard' | 'high' — 'high' widens the text/surface tone
116
117
  * gap, for dense data UI or bright and clinical screens
@@ -117,6 +117,15 @@ export interface ComponentPlaygroundConfig {
117
117
  * the component is visible on load and knobs stay usable, whereas a real
118
118
  * top-layer modal makes the rest of the page inert (#3657). */
119
119
  overlay?: boolean;
120
+ /** Override the controlled prop and open value used by an overlay preview.
121
+ * Use with `overlay: true` when the component does not use `isOpen: true`
122
+ * to represent its open state. */
123
+ overlayControl?: {
124
+ /** Controlled prop that determines whether the overlay is open. */
125
+ stateProp: string;
126
+ /** Value assigned to stateProp when the preview's open button is used. */
127
+ openValue: unknown;
128
+ };
120
129
  /** The component reads AppShell mobile context and renders nothing
121
130
  * without it (e.g. `MobileNavToggle` returns null unless the context
122
131
  * reports an enabled mobile viewport — the default value outside