@astryxdesign/cli 0.4.6 → 0.4.7-canary.29be96d
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.
- package/CHANGELOG.md +4 -0
- package/README.md +1 -0
- package/api/index.d.mts +1 -1
- package/api/index.mjs +1 -1
- package/api/theme/build/build.mjs +8 -38
- package/api/theme/targets/targets.d.mts +18 -0
- package/api/theme/targets/targets.mjs +87 -0
- package/api/theme/targets/targets.test.mjs +65 -0
- package/api/theme/theme.d.mts +1 -0
- package/api/theme/theme.mjs +3 -1
- package/api/theme/theme.type.d.mts +23 -0
- package/api/theme/theme.type.mjs +21 -1
- package/api/theme/themeTargets.doc.d.mts +11 -0
- package/api/theme/themeTargets.doc.mjs +58 -0
- package/assets/docs/README.md +50 -0
- package/assets/docs/cli-integrations.doc.mjs +4 -4
- package/assets/docs/theme.doc.dense.mjs +1 -1
- package/assets/docs/theme.doc.mjs +1 -1
- package/assets/templates/blocks/components/Dialog/DialogAdaptivePresentation.doc.mjs +25 -0
- package/assets/templates/blocks/components/Dialog/DialogAdaptivePresentation.tsx +167 -0
- package/assets/templates/blocks/components/Dialog/DialogScrollingContent.tsx +1 -1
- package/assets/templates/blocks/components/Step/StepContent.doc.mjs +14 -0
- package/assets/templates/blocks/components/Step/StepContent.tsx +32 -0
- package/assets/templates/blocks/components/Step/StepIndicator.doc.mjs +14 -0
- package/assets/templates/blocks/components/Step/StepIndicator.tsx +60 -0
- package/assets/templates/blocks/components/Step/StepShowcase.doc.mjs +15 -0
- package/assets/templates/blocks/components/Step/StepShowcase.tsx +26 -0
- package/assets/templates/blocks/components/Step/StepStates.doc.mjs +14 -0
- package/assets/templates/blocks/components/Step/StepStates.tsx +46 -0
- package/assets/templates/blocks/components/Stepper/StepperCustomContent.doc.mjs +22 -0
- package/assets/templates/blocks/components/Stepper/StepperCustomContent.tsx +126 -0
- package/assets/templates/blocks/components/Stepper/StepperIndicatorModes.doc.mjs +1 -1
- package/assets/templates/blocks/components/Stepper/StepperIndicatorModes.tsx +17 -5
- package/assets/templates/blocks/components/Stepper/StepperOnTrackHorizontal.doc.mjs +14 -0
- package/assets/templates/blocks/components/Stepper/StepperOnTrackHorizontal.tsx +25 -0
- package/assets/templates/blocks/components/Stepper/StepperOnTrackVertical.doc.mjs +2 -2
- package/assets/templates/blocks/components/Stepper/StepperOnTrackVertical.tsx +1 -1
- package/assets/templates/blocks/components/Stepper/StepperShowcase.doc.mjs +1 -1
- package/assets/templates/blocks/components/Stepper/StepperShowcase.tsx +6 -7
- package/assets/templates/blocks/components/Stepper/StepperStatus.tsx +1 -1
- package/assets/templates/themes/neutral/neutralTheme.ts +13 -8
- package/clients/cli/commands/build-theme.mjs +85 -0
- package/clients/cli/commands/dialog-adaptive-template.test.mjs +24 -0
- package/clients/cli/commands/theme-targets.behavior.test.mjs +64 -0
- package/clients/cli/commands/theme-targets.doc.mjs +38 -0
- package/clients/cli/commands/theme.doc.mjs +4 -2
- package/clients/cli/index.mjs +1 -0
- package/clients/cli/lib/manifest.mjs +2 -0
- package/foundation/discovery/theming-targets.d.mts +48 -0
- package/foundation/discovery/theming-targets.mjs +135 -0
- package/foundation/discovery/theming-targets.test.mjs +127 -0
- package/foundation/response/response-types.doc.mjs +5 -0
- package/package.json +9 -9
- package/assets/templates/blocks/components/Stepper/StepperHorizontal.doc.mjs +0 -14
- package/assets/templates/blocks/components/Stepper/StepperHorizontal.tsx +0 -24
- package/assets/templates/blocks/components/Stepper/StepperMultiStepForm.doc.mjs +0 -14
- package/assets/templates/blocks/components/Stepper/StepperMultiStepForm.tsx +0 -92
- package/assets/templates/blocks/components/Stepper/StepperVerticalOnboarding.doc.mjs +0 -14
- package/assets/templates/blocks/components/Stepper/StepperVerticalOnboarding.tsx +0 -40
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {useState, type ReactNode} from 'react';
|
|
6
|
+
import {BottomSheet} from '@astryxdesign/core/BottomSheet';
|
|
7
|
+
import {Button} from '@astryxdesign/core/Button';
|
|
8
|
+
import {
|
|
9
|
+
Dialog,
|
|
10
|
+
DialogHeader,
|
|
11
|
+
type DialogPurpose,
|
|
12
|
+
} from '@astryxdesign/core/Dialog';
|
|
13
|
+
import {Heading} from '@astryxdesign/core/Heading';
|
|
14
|
+
import {
|
|
15
|
+
HStack,
|
|
16
|
+
Layout,
|
|
17
|
+
LayoutContent,
|
|
18
|
+
LayoutFooter,
|
|
19
|
+
VStack,
|
|
20
|
+
} from '@astryxdesign/core/Layout';
|
|
21
|
+
import {Text} from '@astryxdesign/core/Text';
|
|
22
|
+
import {TextArea} from '@astryxdesign/core/TextArea';
|
|
23
|
+
import {TextInput} from '@astryxdesign/core/TextInput';
|
|
24
|
+
import {useMediaQuery} from '@astryxdesign/core/hooks';
|
|
25
|
+
|
|
26
|
+
const TOUCH_ORIENTED_LG_QUERY =
|
|
27
|
+
'(max-width: 1024px) and (pointer: coarse) and (hover: none)';
|
|
28
|
+
|
|
29
|
+
type AdaptivePresentation = 'dialog' | 'fullscreen' | 'bottom-sheet';
|
|
30
|
+
|
|
31
|
+
type AdaptiveDialogProps = {
|
|
32
|
+
isOpen: boolean;
|
|
33
|
+
onOpenChange: (isOpen: boolean) => void;
|
|
34
|
+
title: string;
|
|
35
|
+
children: ReactNode;
|
|
36
|
+
footer?: ReactNode;
|
|
37
|
+
purpose?: DialogPurpose;
|
|
38
|
+
width?: number | string;
|
|
39
|
+
maxHeight?: number | string;
|
|
40
|
+
touchPresentation?: AdaptivePresentation;
|
|
41
|
+
presentation?: AdaptivePresentation;
|
|
42
|
+
bottomSheetHeight?: 'hug' | 'capped' | 'tall' | number | string;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
function AdaptiveDialog({
|
|
46
|
+
isOpen,
|
|
47
|
+
onOpenChange,
|
|
48
|
+
title,
|
|
49
|
+
children,
|
|
50
|
+
footer,
|
|
51
|
+
purpose = 'info',
|
|
52
|
+
width = 480,
|
|
53
|
+
maxHeight = '75dvh',
|
|
54
|
+
touchPresentation = 'dialog',
|
|
55
|
+
presentation,
|
|
56
|
+
bottomSheetHeight = 'capped',
|
|
57
|
+
}: AdaptiveDialogProps) {
|
|
58
|
+
const isTouchOrientedLargeOrBelow = useMediaQuery(TOUCH_ORIENTED_LG_QUERY);
|
|
59
|
+
const resolvedPresentation =
|
|
60
|
+
presentation ??
|
|
61
|
+
(isTouchOrientedLargeOrBelow ? touchPresentation : 'dialog');
|
|
62
|
+
|
|
63
|
+
if (resolvedPresentation === 'bottom-sheet') {
|
|
64
|
+
return (
|
|
65
|
+
<BottomSheet
|
|
66
|
+
isOpen={isOpen}
|
|
67
|
+
onOpenChange={onOpenChange}
|
|
68
|
+
label={title}
|
|
69
|
+
purpose={purpose}
|
|
70
|
+
height={bottomSheetHeight}>
|
|
71
|
+
<VStack gap={4} style={{padding: 'var(--spacing-4)'}}>
|
|
72
|
+
<Heading level={3}>{title}</Heading>
|
|
73
|
+
{children}
|
|
74
|
+
{footer}
|
|
75
|
+
</VStack>
|
|
76
|
+
</BottomSheet>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const dialogContent = (
|
|
81
|
+
<Layout
|
|
82
|
+
header={<DialogHeader title={title} onOpenChange={onOpenChange} />}
|
|
83
|
+
content={<LayoutContent>{children}</LayoutContent>}
|
|
84
|
+
footer={footer ? <LayoutFooter>{footer}</LayoutFooter> : undefined}
|
|
85
|
+
/>
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<Dialog
|
|
90
|
+
isOpen={isOpen}
|
|
91
|
+
onOpenChange={onOpenChange}
|
|
92
|
+
purpose={purpose}
|
|
93
|
+
width={width}
|
|
94
|
+
maxHeight={maxHeight}
|
|
95
|
+
variant={
|
|
96
|
+
resolvedPresentation === 'fullscreen' ? 'fullscreen' : 'standard'
|
|
97
|
+
}>
|
|
98
|
+
{dialogContent}
|
|
99
|
+
</Dialog>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export default function DialogAdaptivePresentation() {
|
|
104
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
105
|
+
const [name, setName] = useState('Ruby Cheung');
|
|
106
|
+
const [email, setEmail] = useState('ruby@example.com');
|
|
107
|
+
const [notes, setNotes] = useState('');
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<>
|
|
111
|
+
<Button label="Edit profile" onClick={() => setIsOpen(true)} />
|
|
112
|
+
{/*
|
|
113
|
+
touchPresentation examples:
|
|
114
|
+
- "dialog" keeps Dialog even in touch-oriented <=lg contexts.
|
|
115
|
+
- "fullscreen" uses fullscreen Dialog there.
|
|
116
|
+
- "bottom-sheet" uses BottomSheet there.
|
|
117
|
+
presentation="dialog" | "fullscreen" | "bottom-sheet" overrides
|
|
118
|
+
the media query for tests and unusual environments.
|
|
119
|
+
*/}
|
|
120
|
+
<AdaptiveDialog
|
|
121
|
+
isOpen={isOpen}
|
|
122
|
+
onOpenChange={setIsOpen}
|
|
123
|
+
title="Edit profile"
|
|
124
|
+
purpose="form"
|
|
125
|
+
touchPresentation="bottom-sheet"
|
|
126
|
+
bottomSheetHeight="tall"
|
|
127
|
+
footer={
|
|
128
|
+
<HStack gap={2} hAlign="end" wrap="wrap">
|
|
129
|
+
<Button
|
|
130
|
+
label="Cancel"
|
|
131
|
+
variant="secondary"
|
|
132
|
+
onClick={() => setIsOpen(false)}
|
|
133
|
+
/>
|
|
134
|
+
<Button
|
|
135
|
+
label="Save profile"
|
|
136
|
+
variant="primary"
|
|
137
|
+
onClick={() => setIsOpen(false)}
|
|
138
|
+
/>
|
|
139
|
+
</HStack>
|
|
140
|
+
}>
|
|
141
|
+
<VStack gap={4}>
|
|
142
|
+
<Text type="supporting" color="secondary">
|
|
143
|
+
Dialog remains the default presentation. This example explicitly
|
|
144
|
+
opts into a Bottom Sheet only at lg and below when the device has a
|
|
145
|
+
coarse pointer and no hover. Pass the presentation prop to make
|
|
146
|
+
tests or unusual environments deterministic.
|
|
147
|
+
</Text>
|
|
148
|
+
<Text type="supporting" color="secondary">
|
|
149
|
+
In Bottom Sheet presentation, purpose="form" blocks scrim clicks and
|
|
150
|
+
swipe dismissal while preserving Escape. Use this opt-in only when
|
|
151
|
+
that contract is acceptable; keep AlertDialog/destructive
|
|
152
|
+
confirmations on Dialog unless a product deliberately chooses
|
|
153
|
+
otherwise.
|
|
154
|
+
</Text>
|
|
155
|
+
<TextInput label="Name" value={name} onChange={setName} />
|
|
156
|
+
<TextInput
|
|
157
|
+
label="Email"
|
|
158
|
+
type="email"
|
|
159
|
+
value={email}
|
|
160
|
+
onChange={setEmail}
|
|
161
|
+
/>
|
|
162
|
+
<TextArea label="Notes" rows={6} value={notes} onChange={setNotes} />
|
|
163
|
+
</VStack>
|
|
164
|
+
</AdaptiveDialog>
|
|
165
|
+
</>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
@@ -69,7 +69,7 @@ function Content({onClose}: {onClose: () => void}) {
|
|
|
69
69
|
|
|
70
70
|
// Remove isInline for production — dialogs should be modal.
|
|
71
71
|
export default function DialogScrollingContent() {
|
|
72
|
-
const dialog = useImperativeDialog({maxHeight: '
|
|
72
|
+
const dialog = useImperativeDialog({maxHeight: '50dvh'});
|
|
73
73
|
|
|
74
74
|
return (
|
|
75
75
|
<>
|
|
@@ -0,0 +1,14 @@
|
|
|
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: 'Step',
|
|
7
|
+
name: 'Step — Content Slot',
|
|
8
|
+
displayName: 'Step — Content Slot',
|
|
9
|
+
description:
|
|
10
|
+
'Children passed to a Step render below its description, indented to line up with the label rather than the indicator, and stay outside the clickable label area so buttons inside remain their own targets. In a full flow you gate the slot on the step being active — that is what turns a vertical stepper into an expanding one.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
aspectRatio: 4 / 3,
|
|
13
|
+
componentsUsed: ['Stepper', 'Step', 'TextInput', 'Button'],
|
|
14
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {Stepper, Step} from '@astryxdesign/core/Stepper';
|
|
6
|
+
import {TextInput} from '@astryxdesign/core/TextInput';
|
|
7
|
+
import {Button} from '@astryxdesign/core/Button';
|
|
8
|
+
|
|
9
|
+
export default function StepContent() {
|
|
10
|
+
// Anything passed as children renders below the description, indented to line
|
|
11
|
+
// up with the label rather than the indicator. In a full flow you would gate
|
|
12
|
+
// this on the step being active; here it is a single Step so the slot is
|
|
13
|
+
// always shown.
|
|
14
|
+
return (
|
|
15
|
+
<div style={{width: 400}}>
|
|
16
|
+
<Stepper activeStep={1} orientation="vertical">
|
|
17
|
+
<Step
|
|
18
|
+
step={1}
|
|
19
|
+
label="Billing address"
|
|
20
|
+
description="Used for invoices and tax calculation">
|
|
21
|
+
<div style={{display: 'flex', flexDirection: 'column', gap: 12}}>
|
|
22
|
+
<TextInput label="Street" placeholder="1 Hacker Way" value="" />
|
|
23
|
+
<TextInput label="City" placeholder="Menlo Park" value="" />
|
|
24
|
+
<div>
|
|
25
|
+
<Button label="Save address" variant="primary" />
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</Step>
|
|
29
|
+
</Stepper>
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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: 'Step',
|
|
7
|
+
name: 'Step — Indicator',
|
|
8
|
+
displayName: 'Step — Indicator',
|
|
9
|
+
description:
|
|
10
|
+
'Everything the indicator prop accepts: the auto default, an always-number badge, a custom ReactNode, and none — each on its own completed Step so the prop is the only difference between them. Every variant occupies the same 16px box, so a step swapping its number for a check as it completes never shifts the label beside it. The last cell shows that a custom node can be live rather than static: a Spinner on a step that is in progress, shaded `inherit` so it picks up the step\u2019s own tint like any other glyph.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
aspectRatio: 4 / 3,
|
|
13
|
+
componentsUsed: ['Stepper', 'Step', 'Icon', 'Spinner', 'Text'],
|
|
14
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {Stepper, Step} from '@astryxdesign/core/Stepper';
|
|
6
|
+
import {Text} from '@astryxdesign/core/Text';
|
|
7
|
+
import {Icon} from '@astryxdesign/core/Icon';
|
|
8
|
+
import {Spinner} from '@astryxdesign/core/Spinner';
|
|
9
|
+
|
|
10
|
+
export default function StepIndicator() {
|
|
11
|
+
// The first four steps are all completed — same progress, so the indicator
|
|
12
|
+
// prop is the only difference between them. `auto` is the one that reacts to
|
|
13
|
+
// progress: a numbered badge until the step is reached, then a check. The
|
|
14
|
+
// last step is in progress instead, because the node it passes to `indicator`
|
|
15
|
+
// is a spinner and a spinner only makes sense on work that is running.
|
|
16
|
+
return (
|
|
17
|
+
<div style={{display: 'flex', flexWrap: 'wrap', gap: 24}}>
|
|
18
|
+
<div style={{width: 190}}>
|
|
19
|
+
<Text type="label">auto (default)</Text>
|
|
20
|
+
<Stepper activeStep={1} orientation="vertical">
|
|
21
|
+
<Step step={0} label="Verify email" />
|
|
22
|
+
</Stepper>
|
|
23
|
+
</div>
|
|
24
|
+
<div style={{width: 190}}>
|
|
25
|
+
<Text type="label">number</Text>
|
|
26
|
+
<Stepper activeStep={1} orientation="vertical">
|
|
27
|
+
<Step step={0} label="Verify email" indicator="number" />
|
|
28
|
+
</Stepper>
|
|
29
|
+
</div>
|
|
30
|
+
<div style={{width: 190}}>
|
|
31
|
+
<Text type="label">Custom node</Text>
|
|
32
|
+
<Stepper activeStep={1} orientation="vertical">
|
|
33
|
+
<Step
|
|
34
|
+
step={0}
|
|
35
|
+
label="Verify email"
|
|
36
|
+
indicator={<Icon icon="wrench" size="sm" />}
|
|
37
|
+
/>
|
|
38
|
+
</Stepper>
|
|
39
|
+
</div>
|
|
40
|
+
<div style={{width: 190}}>
|
|
41
|
+
<Text type="label">none</Text>
|
|
42
|
+
<Stepper activeStep={1} orientation="vertical">
|
|
43
|
+
<Step step={0} label="Verify email" indicator="none" />
|
|
44
|
+
</Stepper>
|
|
45
|
+
</div>
|
|
46
|
+
<div style={{width: 190}}>
|
|
47
|
+
<Text type="label">Spinner (in progress)</Text>
|
|
48
|
+
<Stepper activeStep={0} orientation="vertical">
|
|
49
|
+
<Step
|
|
50
|
+
step={0}
|
|
51
|
+
label="Verify email"
|
|
52
|
+
// `inherit` picks up the indicator's own tint, so the spinner is
|
|
53
|
+
// colored by the step's progress and status like any other glyph.
|
|
54
|
+
indicator={<Spinner size="md" shade="inherit" />}
|
|
55
|
+
/>
|
|
56
|
+
</Stepper>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
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: 'Step',
|
|
7
|
+
name: 'Step',
|
|
8
|
+
displayName: 'Step',
|
|
9
|
+
description:
|
|
10
|
+
'A single Step, with every part it can render: the indicator, the label with its optional marker and trailing endContent, and the description beneath. A Step never sets its own completed/current state — it declares its index and derives the rest from the parent Stepper, so one Step in one Stepper is a complete example.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
isShowcase: true,
|
|
13
|
+
aspectRatio: 16 / 9,
|
|
14
|
+
componentsUsed: ['Stepper', 'Step', 'Text'],
|
|
15
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {Stepper, Step} from '@astryxdesign/core/Stepper';
|
|
6
|
+
import {Text} from '@astryxdesign/core/Text';
|
|
7
|
+
|
|
8
|
+
export default function StepShowcase() {
|
|
9
|
+
// One Step, and every part it renders: the indicator, the label with its
|
|
10
|
+
// optional marker and trailing slot, and the description beneath. A Step is
|
|
11
|
+
// always wrapped in a Stepper — that is where it reads its progress from —
|
|
12
|
+
// so a single Step in a single Stepper is the smallest complete example.
|
|
13
|
+
return (
|
|
14
|
+
<div style={{width: 380}}>
|
|
15
|
+
<Stepper activeStep={1} orientation="vertical">
|
|
16
|
+
<Step
|
|
17
|
+
step={1}
|
|
18
|
+
label="Connect a repository"
|
|
19
|
+
description="Astryx reads your build settings from the default branch"
|
|
20
|
+
endContent={<Text type="supporting">2 min</Text>}
|
|
21
|
+
isOptional
|
|
22
|
+
/>
|
|
23
|
+
</Stepper>
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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: 'Step',
|
|
7
|
+
name: 'Step — States',
|
|
8
|
+
displayName: 'Step — States',
|
|
9
|
+
description:
|
|
10
|
+
'Every state a single Step can land in, each shown as one Step in its own Stepper. Completed, current, and upcoming are derived by comparing the step index against the parent activeStep, so they are never set directly; isDisabled and status are the two a step declares itself. Status is a separate axis from progress, which is why a completed step can still carry a warning.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
aspectRatio: 4 / 3,
|
|
13
|
+
componentsUsed: ['Stepper', 'Step', 'Text'],
|
|
14
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {Stepper, Step} from '@astryxdesign/core/Stepper';
|
|
6
|
+
import {Text} from '@astryxdesign/core/Text';
|
|
7
|
+
|
|
8
|
+
export default function StepStates() {
|
|
9
|
+
// A Step holds no state of its own — it compares its `step` index against the
|
|
10
|
+
// Stepper's `activeStep`. Each state below is therefore one Step in its own
|
|
11
|
+
// Stepper, with activeStep placed on one side of it or the other.
|
|
12
|
+
return (
|
|
13
|
+
<div style={{display: 'flex', flexWrap: 'wrap', gap: 32}}>
|
|
14
|
+
<div style={{width: 220}}>
|
|
15
|
+
<Text type="label">Completed</Text>
|
|
16
|
+
<Stepper activeStep={1} orientation="vertical">
|
|
17
|
+
<Step step={0} label="Verify email" />
|
|
18
|
+
</Stepper>
|
|
19
|
+
</div>
|
|
20
|
+
<div style={{width: 220}}>
|
|
21
|
+
<Text type="label">Current</Text>
|
|
22
|
+
<Stepper activeStep={0} orientation="vertical">
|
|
23
|
+
<Step step={0} label="Verify email" />
|
|
24
|
+
</Stepper>
|
|
25
|
+
</div>
|
|
26
|
+
<div style={{width: 220}}>
|
|
27
|
+
<Text type="label">Upcoming</Text>
|
|
28
|
+
<Stepper activeStep={0} orientation="vertical">
|
|
29
|
+
<Step step={1} label="Add a payment method" />
|
|
30
|
+
</Stepper>
|
|
31
|
+
</div>
|
|
32
|
+
<div style={{width: 220}}>
|
|
33
|
+
<Text type="label">Disabled</Text>
|
|
34
|
+
<Stepper activeStep={0} orientation="vertical" onStepClick={() => {}}>
|
|
35
|
+
<Step step={1} label="Add a payment method" isDisabled />
|
|
36
|
+
</Stepper>
|
|
37
|
+
</div>
|
|
38
|
+
<div style={{width: 220}}>
|
|
39
|
+
<Text type="label">Completed, with a status</Text>
|
|
40
|
+
<Stepper activeStep={1} orientation="vertical">
|
|
41
|
+
<Step step={0} label="Verify email" status="warning" />
|
|
42
|
+
</Stepper>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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: 'Stepper',
|
|
7
|
+
name: 'Stepper — Custom Content',
|
|
8
|
+
displayName: 'Stepper — Custom Content',
|
|
9
|
+
description:
|
|
10
|
+
'A vertical stepper where each step owns a slice of the page. The content slot takes any node — form fields, a summary panel, a banner — so a stepper is not limited to multi-step forms. Rendering the slot only for the active step is what makes the flow expand one step at a time.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
aspectRatio: 4 / 3,
|
|
13
|
+
componentsUsed: [
|
|
14
|
+
'Stepper',
|
|
15
|
+
'TextInput',
|
|
16
|
+
'Button',
|
|
17
|
+
'Text',
|
|
18
|
+
'Card',
|
|
19
|
+
'Badge',
|
|
20
|
+
'Banner',
|
|
21
|
+
],
|
|
22
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {useState} from 'react';
|
|
6
|
+
import {Stepper, Step} from '@astryxdesign/core/Stepper';
|
|
7
|
+
import {TextInput} from '@astryxdesign/core/TextInput';
|
|
8
|
+
import {Button} from '@astryxdesign/core/Button';
|
|
9
|
+
import {Text} from '@astryxdesign/core/Text';
|
|
10
|
+
import {Card} from '@astryxdesign/core/Card';
|
|
11
|
+
import {Badge} from '@astryxdesign/core/Badge';
|
|
12
|
+
import {Banner} from '@astryxdesign/core/Banner';
|
|
13
|
+
|
|
14
|
+
export default function StepperCustomContent() {
|
|
15
|
+
const [active, setActive] = useState(0);
|
|
16
|
+
// The content slot takes any node, not just form fields — a panel, a summary,
|
|
17
|
+
// a notice. Gating it on `active` is what makes the flow expand a step at a
|
|
18
|
+
// time.
|
|
19
|
+
return (
|
|
20
|
+
<div style={{width: 680}}>
|
|
21
|
+
<Stepper
|
|
22
|
+
activeStep={active}
|
|
23
|
+
orientation="vertical"
|
|
24
|
+
onStepClick={setActive}>
|
|
25
|
+
<Step
|
|
26
|
+
step={0}
|
|
27
|
+
label="Project details"
|
|
28
|
+
description="Name it and point us at the source"
|
|
29
|
+
indicator="number">
|
|
30
|
+
{active === 0 && (
|
|
31
|
+
<div style={{display: 'flex', flexDirection: 'column', gap: 12}}>
|
|
32
|
+
<div style={{display: 'flex', gap: 12}}>
|
|
33
|
+
<TextInput
|
|
34
|
+
label="Project name"
|
|
35
|
+
placeholder="My awesome project"
|
|
36
|
+
value=""
|
|
37
|
+
width="100%"
|
|
38
|
+
/>
|
|
39
|
+
<TextInput
|
|
40
|
+
label="Repository URL"
|
|
41
|
+
placeholder="https://github.com/..."
|
|
42
|
+
value=""
|
|
43
|
+
width="100%"
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
46
|
+
<div>
|
|
47
|
+
<Button
|
|
48
|
+
label="Continue"
|
|
49
|
+
variant="primary"
|
|
50
|
+
onClick={() => setActive(1)}
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
)}
|
|
55
|
+
</Step>
|
|
56
|
+
<Step
|
|
57
|
+
step={1}
|
|
58
|
+
label="Review the build"
|
|
59
|
+
description="What we detected from your default branch"
|
|
60
|
+
indicator="number">
|
|
61
|
+
{active === 1 && (
|
|
62
|
+
<div style={{display: 'flex', flexDirection: 'column', gap: 12}}>
|
|
63
|
+
<Card variant="muted" padding={3}>
|
|
64
|
+
<div style={{display: 'flex', flexDirection: 'column', gap: 8}}>
|
|
65
|
+
<div
|
|
66
|
+
style={{
|
|
67
|
+
display: 'flex',
|
|
68
|
+
alignItems: 'center',
|
|
69
|
+
gap: 8,
|
|
70
|
+
}}>
|
|
71
|
+
<Text type="label">Next.js 15</Text>
|
|
72
|
+
<Badge variant="success" label="Detected" />
|
|
73
|
+
</div>
|
|
74
|
+
<Text type="supporting">
|
|
75
|
+
Build command <code>next build</code> · Output{' '}
|
|
76
|
+
<code>.next</code> · Node 20
|
|
77
|
+
</Text>
|
|
78
|
+
</div>
|
|
79
|
+
</Card>
|
|
80
|
+
<div style={{display: 'flex', gap: 8}}>
|
|
81
|
+
<Button
|
|
82
|
+
label="Back"
|
|
83
|
+
variant="secondary"
|
|
84
|
+
onClick={() => setActive(0)}
|
|
85
|
+
/>
|
|
86
|
+
<Button
|
|
87
|
+
label="Looks right"
|
|
88
|
+
variant="primary"
|
|
89
|
+
onClick={() => setActive(2)}
|
|
90
|
+
/>
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
)}
|
|
94
|
+
</Step>
|
|
95
|
+
<Step
|
|
96
|
+
step={2}
|
|
97
|
+
label="Deploy"
|
|
98
|
+
description="Ships to production"
|
|
99
|
+
indicator="number">
|
|
100
|
+
{active === 2 && (
|
|
101
|
+
<div style={{display: 'flex', flexDirection: 'column', gap: 12}}>
|
|
102
|
+
<Banner
|
|
103
|
+
status="info"
|
|
104
|
+
title="First deploy takes a few minutes"
|
|
105
|
+
description="Later deploys reuse the build cache and finish in under a minute."
|
|
106
|
+
/>
|
|
107
|
+
<div style={{display: 'flex', gap: 8}}>
|
|
108
|
+
<Button
|
|
109
|
+
label="Back"
|
|
110
|
+
variant="secondary"
|
|
111
|
+
onClick={() => setActive(1)}
|
|
112
|
+
/>
|
|
113
|
+
<Button
|
|
114
|
+
label="Deploy now"
|
|
115
|
+
variant="primary"
|
|
116
|
+
onClick={() => setActive(3)}
|
|
117
|
+
/>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
)}
|
|
121
|
+
</Step>
|
|
122
|
+
<Step step={3} label="Live" indicator="number" />
|
|
123
|
+
</Stepper>
|
|
124
|
+
</div>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
@@ -7,7 +7,7 @@ export const doc = {
|
|
|
7
7
|
name: 'Stepper — Indicator Modes',
|
|
8
8
|
displayName: 'Stepper — Indicator Modes',
|
|
9
9
|
description:
|
|
10
|
-
'The indicator prop side by side: auto (check when done, ring when current, number ahead), always-number, and a custom icon per step.',
|
|
10
|
+
'The indicator prop side by side: none (the bar and label carry the progress on their own), auto (check when done, ring when current, number ahead), always-number, and a custom icon per step.',
|
|
11
11
|
isReady: true,
|
|
12
12
|
aspectRatio: 4 / 3,
|
|
13
13
|
componentsUsed: ['Stepper', 'Text', 'Icon'],
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
'use client';
|
|
4
4
|
|
|
5
5
|
import {useState} from 'react';
|
|
6
|
-
import {Stepper, Step} from '@astryxdesign/
|
|
6
|
+
import {Stepper, Step} from '@astryxdesign/core/Stepper';
|
|
7
7
|
import {Text} from '@astryxdesign/core/Text';
|
|
8
8
|
import {Icon} from '@astryxdesign/core/Icon';
|
|
9
9
|
|
|
@@ -11,6 +11,18 @@ export default function StepperIndicatorModes() {
|
|
|
11
11
|
const [active, setActive] = useState(2);
|
|
12
12
|
return (
|
|
13
13
|
<div style={{display: 'flex', gap: 48, flexWrap: 'wrap'}}>
|
|
14
|
+
<div style={{maxWidth: 220}}>
|
|
15
|
+
<Text type="label">None</Text>
|
|
16
|
+
<Stepper
|
|
17
|
+
activeStep={active}
|
|
18
|
+
orientation="vertical"
|
|
19
|
+
onStepClick={setActive}>
|
|
20
|
+
<Step step={0} label="Account" indicator="none" />
|
|
21
|
+
<Step step={1} label="Profile" indicator="none" />
|
|
22
|
+
<Step step={2} label="Settings" indicator="none" />
|
|
23
|
+
<Step step={3} label="Review" indicator="none" />
|
|
24
|
+
</Stepper>
|
|
25
|
+
</div>
|
|
14
26
|
<div style={{maxWidth: 220}}>
|
|
15
27
|
<Text type="label">Auto</Text>
|
|
16
28
|
<Stepper
|
|
@@ -44,22 +56,22 @@ export default function StepperIndicatorModes() {
|
|
|
44
56
|
<Step
|
|
45
57
|
step={0}
|
|
46
58
|
label="Account"
|
|
47
|
-
|
|
59
|
+
indicator={<Icon icon="info" size="sm" />}
|
|
48
60
|
/>
|
|
49
61
|
<Step
|
|
50
62
|
step={1}
|
|
51
63
|
label="Profile"
|
|
52
|
-
|
|
64
|
+
indicator={<Icon icon="search" size="sm" />}
|
|
53
65
|
/>
|
|
54
66
|
<Step
|
|
55
67
|
step={2}
|
|
56
68
|
label="Settings"
|
|
57
|
-
|
|
69
|
+
indicator={<Icon icon="wrench" size="sm" />}
|
|
58
70
|
/>
|
|
59
71
|
<Step
|
|
60
72
|
step={3}
|
|
61
73
|
label="Review"
|
|
62
|
-
|
|
74
|
+
indicator={<Icon icon="check" size="sm" />}
|
|
63
75
|
/>
|
|
64
76
|
</Stepper>
|
|
65
77
|
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
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: 'Stepper',
|
|
7
|
+
name: 'Stepper — On-Track Horizontal',
|
|
8
|
+
displayName: 'Stepper — On-Track Horizontal',
|
|
9
|
+
description:
|
|
10
|
+
'The on-track layout in horizontal orientation: instead of sitting beside the label, each indicator is slotted into the connector itself, so the numbered nodes read as beads on one continuous line. Labels center under their node.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
aspectRatio: 16 / 9,
|
|
13
|
+
componentsUsed: ['Stepper'],
|
|
14
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {useState} from 'react';
|
|
6
|
+
import {Stepper, Step} from '@astryxdesign/core/Stepper';
|
|
7
|
+
|
|
8
|
+
export default function StepperOnTrackHorizontal() {
|
|
9
|
+
const [active, setActive] = useState(2);
|
|
10
|
+
return (
|
|
11
|
+
<div style={{width: 560}}>
|
|
12
|
+
<Stepper
|
|
13
|
+
activeStep={active}
|
|
14
|
+
orientation="horizontal"
|
|
15
|
+
indicatorPosition="on-track"
|
|
16
|
+
onStepClick={setActive}>
|
|
17
|
+
<Step step={0} label="Workspace" indicator="number" />
|
|
18
|
+
<Step step={1} label="Team" indicator="number" />
|
|
19
|
+
<Step step={2} label="Integrations" indicator="number" />
|
|
20
|
+
<Step step={3} label="Import" indicator="number" />
|
|
21
|
+
<Step step={4} label="Launch" indicator="number" />
|
|
22
|
+
</Stepper>
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
}
|