@astryxdesign/cli 0.1.7 → 0.1.8-canary.0c4d8d7
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 +40 -0
- package/README.md +115 -19
- package/docs/cli-integrations.doc.mjs +150 -0
- package/docs/elevation.doc.mjs +79 -1
- package/docs/getting-started.doc.mjs +9 -9
- package/docs/migration.doc.mjs +18 -18
- package/docs/principles.doc.dense.mjs +1 -1
- package/docs/principles.doc.mjs +6 -6
- package/docs/principles.doc.zh.mjs +1 -1
- package/docs/styling-libraries.doc.mjs +3 -3
- package/docs/styling.doc.mjs +4 -4
- package/docs/theme.doc.dense.mjs +2 -2
- package/docs/theme.doc.mjs +7 -7
- package/docs/theme.doc.zh.mjs +1 -1
- package/docs/tokens.doc.mjs +1 -1
- package/docs/working-with-ai.doc.mjs +19 -19
- package/package.json +13 -11
- package/scripts/postinstall.mjs +74 -0
- package/src/api/doctor.mjs +3 -3
- package/src/api/error.mjs +2 -2
- package/src/codemods/__tests__/registry.test.mjs +1 -0
- package/src/codemods/ensure-jscodeshift.mjs +11 -27
- package/src/codemods/registry.mjs +1 -0
- package/src/codemods/run-codemod.mjs +1 -1
- package/src/codemods/runner.mjs +2 -2
- package/src/codemods/transforms/v0.1.0/__tests__/drop-xds-prefix-imports.test.mjs +42 -7
- package/src/codemods/transforms/v0.1.0/__tests__/migrate-xds-module-specifiers.test.mjs +43 -0
- package/src/codemods/transforms/v0.1.0/drop-xds-prefix-imports.mjs +102 -3
- package/src/codemods/transforms/v0.1.0/migrate-xds-module-specifiers.mjs +72 -6
- package/src/codemods/transforms/v0.1.8/__tests__/rename-avatar-size-scale.test.mjs +161 -0
- package/src/codemods/transforms/v0.1.8/index.mjs +19 -0
- package/src/codemods/transforms/v0.1.8/rename-avatar-size-scale.mjs +234 -0
- package/src/commands/agent-docs.mjs +136 -20
- package/src/commands/agent-docs.test.mjs +123 -10
- package/src/commands/build-theme.mjs +10 -71
- package/src/commands/build.mjs +15 -15
- package/src/commands/cli-postinstall.test.mjs +42 -0
- package/src/commands/component/index.mjs +4 -4
- package/src/commands/discover.mjs +7 -5
- package/src/commands/docs.mjs +4 -4
- package/src/commands/hook/index.mjs +4 -4
- package/src/commands/init.mjs +48 -152
- package/src/commands/init.next-steps.test.mjs +1 -1
- package/src/commands/interactive-guard.test.mjs +19 -22
- package/src/commands/json-contract.test.mjs +2 -2
- package/src/commands/layout.mjs +1 -1
- package/src/commands/search.mjs +4 -4
- package/src/commands/setup-nudge.test.mjs +108 -0
- package/src/commands/swizzle.mjs +12 -35
- package/src/commands/template.mjs +11 -31
- package/src/commands/upgrade.mjs +138 -32
- package/src/commands/upgrade.test.mjs +155 -1
- package/src/index.mjs +40 -6
- package/src/lib/cli-error.mjs +2 -2
- package/src/lib/component-format.mjs +2 -1
- package/src/lib/json-shim.mjs +1 -1
- package/src/lib/json.mjs +3 -3
- package/src/lib/term-log.mjs +48 -0
- package/src/types/api.d.ts +4 -9
- package/src/types/base.d.ts +24 -3
- package/src/types/build.d.ts +23 -0
- package/src/types/index.d.ts +1 -0
- package/src/types/swizzle.d.ts +4 -0
- package/src/types/template-api.d.ts +4 -1
- package/src/types/upgrade.d.ts +39 -2
- package/src/utils/package-manager.mjs +108 -4
- package/src/utils/package-manager.test.mjs +108 -1
- package/src/utils/path-safety.mjs +0 -18
- package/src/utils/update-check.mjs +5 -4
- package/src/utils/update-check.test.mjs +3 -3
- package/templates/blocks/components/Avatar/AvatarFallbackChain.tsx +4 -4
- package/templates/blocks/components/Avatar/AvatarGroup.tsx +2 -2
- package/templates/blocks/components/Avatar/AvatarInitialsFallback.tsx +1 -1
- package/templates/blocks/components/Avatar/AvatarShowcase.tsx +4 -4
- package/templates/blocks/components/Avatar/AvatarUserCard.tsx +1 -1
- package/templates/blocks/components/Avatar/AvatarWithImage.tsx +4 -4
- package/templates/blocks/components/Avatar/AvatarWithStatus.tsx +3 -3
- package/templates/blocks/components/AvatarGroup/AvatarGroupShowcase.tsx +2 -2
- package/templates/blocks/components/AvatarGroupOverflow/AvatarGroupOverflowCustomText.tsx +1 -1
- package/templates/blocks/components/AvatarGroupOverflow/AvatarGroupOverflowDefault.tsx +1 -1
- package/templates/blocks/components/AvatarGroupOverflow/AvatarGroupOverflowShowcase.tsx +2 -2
- package/templates/blocks/components/AvatarStatusDot/AvatarStatusDotShowcase.tsx +3 -3
- package/templates/blocks/components/AvatarStatusDot/AvatarStatusDotVariants.tsx +3 -3
- package/templates/blocks/components/Banner/BannerFloating.doc.mjs +14 -0
- package/templates/blocks/components/Banner/BannerFloating.tsx +16 -0
- package/templates/blocks/components/Button/ButtonFloating.doc.mjs +14 -0
- package/templates/blocks/components/Button/ButtonFloating.tsx +37 -0
- package/templates/blocks/components/ButtonGroup/ButtonGroupFloating.doc.mjs +14 -0
- package/templates/blocks/components/ButtonGroup/ButtonGroupFloating.tsx +23 -0
- package/templates/blocks/components/Card/CardElevations.doc.mjs +14 -0
- package/templates/blocks/components/Card/CardElevations.tsx +32 -0
- package/templates/blocks/components/Card/ClickableCardElevated.doc.mjs +14 -0
- package/templates/blocks/components/Card/ClickableCardElevated.tsx +21 -0
- package/templates/blocks/components/Card/SelectableCardElevated.doc.mjs +14 -0
- package/templates/blocks/components/Card/SelectableCardElevated.tsx +37 -0
- package/templates/blocks/components/Carousel/CarouselSnap.tsx +1 -1
- package/templates/blocks/components/ChatComposer/ChatComposerFlat.doc.mjs +14 -0
- package/templates/blocks/components/ChatComposer/ChatComposerFlat.tsx +75 -0
- package/templates/blocks/components/ChatMessage/ChatMessageAvatarName.tsx +2 -2
- package/templates/blocks/components/ChatMessage/ChatMessageMultiBubble.tsx +1 -1
- package/templates/blocks/components/ChatMessageBubble/ChatMessageBubbleGrouping.tsx +1 -1
- package/templates/blocks/components/ChatMessageBubble/ChatMessageBubbleMetadata.tsx +1 -1
- package/templates/blocks/components/ChatMessageList/ChatMessageListDensity.tsx +5 -9
- package/templates/blocks/components/ChatMessageList/ChatMessageListFullFeatured.tsx +1 -1
- package/templates/blocks/components/CodeBlock/CodeBlockTerminal.tsx +1 -1
- package/templates/blocks/components/HoverCard/HoverCardShowcase.tsx +1 -1
- package/templates/blocks/components/IconButton/IconButtonFloating.doc.mjs +14 -0
- package/templates/blocks/components/IconButton/IconButtonFloating.tsx +37 -0
- package/templates/blocks/components/Item/ItemWithMedia.tsx +2 -2
- package/templates/blocks/components/ListItem/ListItemWithMedia.tsx +2 -2
- package/templates/blocks/components/OverflowList/OverflowListCappedToolbar.doc.mjs +14 -0
- package/templates/blocks/components/OverflowList/OverflowListCappedToolbar.tsx +39 -0
- package/templates/blocks/components/OverflowList/OverflowListMultiRowTags.doc.mjs +14 -0
- package/templates/blocks/components/OverflowList/OverflowListMultiRowTags.tsx +44 -0
- package/templates/blocks/components/Pagination/PaginationDotsCarousel.tsx +2 -6
- package/templates/blocks/components/Stack/StackFillItem.tsx +2 -6
- package/templates/blocks/components/TabList/TabListTabsWithActions.doc.mjs +1 -1
- package/templates/blocks/components/TabList/TabListTabsWithActions.tsx +2 -7
- package/templates/blocks/components/Table/TableRowStatusTable.doc.mjs +14 -0
- package/templates/blocks/components/Table/TableRowStatusTable.tsx +59 -0
- package/templates/blocks/components/Thumbnail/ThumbnailElevated.doc.mjs +14 -0
- package/templates/blocks/components/Thumbnail/ThumbnailElevated.tsx +31 -0
- package/templates/blocks/components/TypeaheadItem/TypeaheadItemShowcase.tsx +1 -1
- package/templates/pages/ai-chat/page.tsx +4 -4
- package/templates/pages/dashboard-portfolio/page.tsx +3 -11
- package/templates/pages/detail-page/page.tsx +5 -12
- package/templates/pages/documentation-design/page.tsx +1 -1
- package/templates/pages/messaging-shell/page.tsx +6 -8
- package/templates/pages/table-grouped/page.tsx +9 -14
- package/templates/pages/table-page/page.tsx +7 -9
- package/templates/pages/table-page-heatmap-status/page.tsx +5 -13
- package/docs/integration-authoring.md +0 -105
- package/src/utils/interactive.mjs +0 -76
- package/src/utils/interactive.test.mjs +0 -70
|
@@ -13,7 +13,7 @@ export default function AvatarFallbackChain() {
|
|
|
13
13
|
<Avatar
|
|
14
14
|
src="https://lookaside.facebook.com/assets/astryx/DATA-Daniela-Gimenez.png"
|
|
15
15
|
name="Daniela Gimenez"
|
|
16
|
-
size="
|
|
16
|
+
size="lg"
|
|
17
17
|
/>
|
|
18
18
|
<Text type="supporting">Valid src</Text>
|
|
19
19
|
</HStack>
|
|
@@ -22,7 +22,7 @@ export default function AvatarFallbackChain() {
|
|
|
22
22
|
src="https://lookaside.facebook.com/assets/astryx/does-not-exist-primary.jpg"
|
|
23
23
|
fallbackSrc="https://lookaside.facebook.com/assets/astryx/DATA-Ami-Pena.png"
|
|
24
24
|
name="Invalid User"
|
|
25
|
-
size="
|
|
25
|
+
size="lg"
|
|
26
26
|
/>
|
|
27
27
|
<Text type="supporting">Invalid src, valid fallbackSrc</Text>
|
|
28
28
|
</HStack>
|
|
@@ -31,14 +31,14 @@ export default function AvatarFallbackChain() {
|
|
|
31
31
|
src="https://lookaside.facebook.com/assets/astryx/does-not-exist-primary.jpg"
|
|
32
32
|
fallbackSrc="https://lookaside.facebook.com/assets/astryx/does-not-exist-fallback.jpg"
|
|
33
33
|
name="Test User"
|
|
34
|
-
size="
|
|
34
|
+
size="lg"
|
|
35
35
|
/>
|
|
36
36
|
<Text type="supporting">Both invalid, has name</Text>
|
|
37
37
|
</HStack>
|
|
38
38
|
<HStack gap={3} vAlign="center">
|
|
39
39
|
<Avatar
|
|
40
40
|
src="https://lookaside.facebook.com/assets/astryx/does-not-exist-primary.jpg"
|
|
41
|
-
size="
|
|
41
|
+
size="lg"
|
|
42
42
|
/>
|
|
43
43
|
<Text type="supporting">All invalid, no name</Text>
|
|
44
44
|
</HStack>
|
|
@@ -37,7 +37,7 @@ export default function AvatarGroupBlock() {
|
|
|
37
37
|
<Text type="supporting" color="secondary">
|
|
38
38
|
Team members
|
|
39
39
|
</Text>
|
|
40
|
-
<AvatarGroup size="
|
|
40
|
+
<AvatarGroup size="lg">
|
|
41
41
|
{USERS.map(user => (
|
|
42
42
|
<Avatar key={user.name} src={user.src} name={user.name} />
|
|
43
43
|
))}
|
|
@@ -48,7 +48,7 @@ export default function AvatarGroupBlock() {
|
|
|
48
48
|
<Text type="supporting" color="secondary">
|
|
49
49
|
Larger group
|
|
50
50
|
</Text>
|
|
51
|
-
<AvatarGroup size="
|
|
51
|
+
<AvatarGroup size="lg">
|
|
52
52
|
{USERS.slice(0, 3).map(user => (
|
|
53
53
|
<Avatar key={user.name} src={user.src} name={user.name} />
|
|
54
54
|
))}
|
|
@@ -18,7 +18,7 @@ export default function AvatarInitialsFallback() {
|
|
|
18
18
|
<Stack direction="horizontal" gap={6} vAlign="center">
|
|
19
19
|
{NAMES.map(({name, note}) => (
|
|
20
20
|
<Stack key={name} direction="vertical" gap={2} hAlign="center">
|
|
21
|
-
<Avatar name={name} size="
|
|
21
|
+
<Avatar name={name} size="lg" />
|
|
22
22
|
<Text type="supporting" color="secondary">
|
|
23
23
|
{note}
|
|
24
24
|
</Text>
|
|
@@ -11,23 +11,23 @@ export default function AvatarShowcase() {
|
|
|
11
11
|
<Avatar
|
|
12
12
|
src="https://lookaside.facebook.com/assets/astryx/DATA-Ana-Thomas.png"
|
|
13
13
|
name="Ana Thomas"
|
|
14
|
-
size="
|
|
14
|
+
size="xl"
|
|
15
15
|
status={<AvatarStatusDot variant="success" label="Online" />}
|
|
16
16
|
/>
|
|
17
17
|
<Avatar
|
|
18
18
|
src="https://lookaside.facebook.com/assets/astryx/DATA-Drew-Young.png"
|
|
19
19
|
name="Drew Young"
|
|
20
|
-
size="
|
|
20
|
+
size="xl"
|
|
21
21
|
/>
|
|
22
22
|
<Avatar
|
|
23
23
|
src="https://lookaside.facebook.com/assets/astryx/DATA-Jihoo-Song.png"
|
|
24
24
|
name="Jihoo Song"
|
|
25
|
-
size="
|
|
25
|
+
size="xl"
|
|
26
26
|
/>
|
|
27
27
|
<Avatar
|
|
28
28
|
src="https://lookaside.facebook.com/assets/astryx/DATA-Nam-Tran.png"
|
|
29
29
|
name="Nam Tran"
|
|
30
|
-
size="
|
|
30
|
+
size="xl"
|
|
31
31
|
status={<AvatarStatusDot variant="error" label="Online" />}
|
|
32
32
|
/>
|
|
33
33
|
</Stack>
|
|
@@ -11,22 +11,22 @@ export default function AvatarWithImage() {
|
|
|
11
11
|
<Avatar
|
|
12
12
|
src="https://lookaside.facebook.com/assets/astryx/DATA-Ami-Pena.png"
|
|
13
13
|
name="Ami Pena"
|
|
14
|
-
size="
|
|
14
|
+
size="xsm"
|
|
15
15
|
/>
|
|
16
16
|
<Avatar
|
|
17
17
|
src="https://lookaside.facebook.com/assets/astryx/DATA-Ana-Thomas.png"
|
|
18
18
|
name="Ana Thomas"
|
|
19
|
-
size="
|
|
19
|
+
size="md"
|
|
20
20
|
/>
|
|
21
21
|
<Avatar
|
|
22
22
|
src="https://lookaside.facebook.com/assets/astryx/DATA-Daniela-Gimenez.png"
|
|
23
23
|
name="Daniela Gimenez"
|
|
24
|
-
size="
|
|
24
|
+
size="lg"
|
|
25
25
|
/>
|
|
26
26
|
<Avatar
|
|
27
27
|
src="https://lookaside.facebook.com/assets/astryx/DATA-Gabriela-Fernandez.png"
|
|
28
28
|
name="Gabriela Fernandez"
|
|
29
|
-
size="
|
|
29
|
+
size="xl"
|
|
30
30
|
/>
|
|
31
31
|
</Stack>
|
|
32
32
|
);
|
|
@@ -11,19 +11,19 @@ export default function AvatarWithStatus() {
|
|
|
11
11
|
<Avatar
|
|
12
12
|
src="https://lookaside.facebook.com/assets/astryx/DATA-Itai-Jordaan.png"
|
|
13
13
|
name="Itai Jordaan"
|
|
14
|
-
size="
|
|
14
|
+
size="xl"
|
|
15
15
|
status={<AvatarStatusDot variant="success" label="Online" />}
|
|
16
16
|
/>
|
|
17
17
|
<Avatar
|
|
18
18
|
src="https://lookaside.facebook.com/assets/astryx/DATA-Margot-Schroder.png"
|
|
19
19
|
name="Margot Schroder"
|
|
20
|
-
size="
|
|
20
|
+
size="xl"
|
|
21
21
|
status={<AvatarStatusDot variant="neutral" label="Offline" />}
|
|
22
22
|
/>
|
|
23
23
|
<Avatar
|
|
24
24
|
src="https://lookaside.facebook.com/assets/astryx/DATA-Pablo-Morales.png"
|
|
25
25
|
name="Pablo Morales"
|
|
26
|
-
size="
|
|
26
|
+
size="xl"
|
|
27
27
|
status={<AvatarStatusDot variant="error" label="Busy" />}
|
|
28
28
|
/>
|
|
29
29
|
</Stack>
|
|
@@ -36,7 +36,7 @@ export default function AvatarGroupShowcase() {
|
|
|
36
36
|
<Text type="supporting" color="secondary">
|
|
37
37
|
Team members
|
|
38
38
|
</Text>
|
|
39
|
-
<AvatarGroup size="
|
|
39
|
+
<AvatarGroup size="lg">
|
|
40
40
|
{USERS.map(u => (
|
|
41
41
|
<Avatar key={u.key} name={u.name} />
|
|
42
42
|
))}
|
|
@@ -46,7 +46,7 @@ export default function AvatarGroupShowcase() {
|
|
|
46
46
|
<Text type="supporting" color="secondary">
|
|
47
47
|
With overflow
|
|
48
48
|
</Text>
|
|
49
|
-
<AvatarGroup size="
|
|
49
|
+
<AvatarGroup size="lg">
|
|
50
50
|
{USERS.slice(0, 3).map(u => (
|
|
51
51
|
<Avatar key={u.key} name={u.name} />
|
|
52
52
|
))}
|
|
@@ -24,7 +24,7 @@ export default function AvatarGroupOverflowCustomText() {
|
|
|
24
24
|
<Text type="supporting" color="secondary">
|
|
25
25
|
Team members
|
|
26
26
|
</Text>
|
|
27
|
-
<AvatarGroup size="
|
|
27
|
+
<AvatarGroup size="lg">
|
|
28
28
|
{TEAM.map(member => (
|
|
29
29
|
<Avatar key={member.name} name={member.name} />
|
|
30
30
|
))}
|
|
@@ -24,7 +24,7 @@ export default function AvatarGroupOverflowDefault() {
|
|
|
24
24
|
<Text type="supporting" color="secondary">
|
|
25
25
|
Reviewers
|
|
26
26
|
</Text>
|
|
27
|
-
<AvatarGroup size="
|
|
27
|
+
<AvatarGroup size="lg">
|
|
28
28
|
{REVIEWERS.map(reviewer => (
|
|
29
29
|
<Avatar key={reviewer.name} name={reviewer.name} />
|
|
30
30
|
))}
|
|
@@ -25,7 +25,7 @@ export default function AvatarGroupOverflowShowcase() {
|
|
|
25
25
|
<Text type="supporting" color="secondary">
|
|
26
26
|
Default overflow
|
|
27
27
|
</Text>
|
|
28
|
-
<AvatarGroup size="
|
|
28
|
+
<AvatarGroup size="lg">
|
|
29
29
|
{USERS.map(user => (
|
|
30
30
|
<Avatar key={user.name} name={user.name} />
|
|
31
31
|
))}
|
|
@@ -36,7 +36,7 @@ export default function AvatarGroupOverflowShowcase() {
|
|
|
36
36
|
<Text type="supporting" color="secondary">
|
|
37
37
|
Custom count text
|
|
38
38
|
</Text>
|
|
39
|
-
<AvatarGroup size="
|
|
39
|
+
<AvatarGroup size="lg">
|
|
40
40
|
{USERS.slice(0, 2).map(user => (
|
|
41
41
|
<Avatar key={user.name} name={user.name} />
|
|
42
42
|
))}
|
|
@@ -10,17 +10,17 @@ export default function AvatarStatusDotShowcase() {
|
|
|
10
10
|
<HStack gap={4} vAlign="center">
|
|
11
11
|
<Avatar
|
|
12
12
|
name="Online User"
|
|
13
|
-
size="
|
|
13
|
+
size="xl"
|
|
14
14
|
status={<AvatarStatusDot variant="success" label="Online" />}
|
|
15
15
|
/>
|
|
16
16
|
<Avatar
|
|
17
17
|
name="Away User"
|
|
18
|
-
size="
|
|
18
|
+
size="xl"
|
|
19
19
|
status={<AvatarStatusDot variant="neutral" label="Away" />}
|
|
20
20
|
/>
|
|
21
21
|
<Avatar
|
|
22
22
|
name="Busy User"
|
|
23
|
-
size="
|
|
23
|
+
size="xl"
|
|
24
24
|
status={<AvatarStatusDot variant="error" label="Busy" />}
|
|
25
25
|
/>
|
|
26
26
|
</HStack>
|
|
@@ -10,17 +10,17 @@ export default function AvatarStatusDotVariants() {
|
|
|
10
10
|
<HStack gap={4} vAlign="center">
|
|
11
11
|
<Avatar
|
|
12
12
|
name="Ana Silva"
|
|
13
|
-
size="
|
|
13
|
+
size="xl"
|
|
14
14
|
status={<AvatarStatusDot variant="success" label="Online" />}
|
|
15
15
|
/>
|
|
16
16
|
<Avatar
|
|
17
17
|
name="Ben Okafor"
|
|
18
|
-
size="
|
|
18
|
+
size="xl"
|
|
19
19
|
status={<AvatarStatusDot variant="neutral" label="Away" />}
|
|
20
20
|
/>
|
|
21
21
|
<Avatar
|
|
22
22
|
name="Cleo Marsh"
|
|
23
|
-
size="
|
|
23
|
+
size="xl"
|
|
24
24
|
status={<AvatarStatusDot variant="error" label="Do not disturb" />}
|
|
25
25
|
/>
|
|
26
26
|
</HStack>
|
|
@@ -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: 'Banner',
|
|
7
|
+
name: 'Banner — Floating',
|
|
8
|
+
displayName: 'Banner — Floating',
|
|
9
|
+
description:
|
|
10
|
+
'A floating banner raised with `elevation="med"`. Banners are inline by default; raise one when it should read as an overlay above content.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
aspectRatio: 16 / 9,
|
|
13
|
+
componentsUsed: ['Banner'],
|
|
14
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {Banner} from '@astryxdesign/core/Banner';
|
|
6
|
+
|
|
7
|
+
export default function BannerFloating() {
|
|
8
|
+
return (
|
|
9
|
+
<Banner
|
|
10
|
+
status="info"
|
|
11
|
+
title="You have unsaved changes"
|
|
12
|
+
description="A raised banner reads as an overlay floating above the page."
|
|
13
|
+
elevation="med"
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
|
|
4
|
+
export const doc = {
|
|
5
|
+
type: 'block',
|
|
6
|
+
exampleFor: 'Button',
|
|
7
|
+
name: 'Button — Floating',
|
|
8
|
+
displayName: 'Button — Floating',
|
|
9
|
+
description:
|
|
10
|
+
'A floating action button raised with `elevation="med"`. Use elevation for buttons that hover above content, like a FAB.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
aspectRatio: 16 / 9,
|
|
13
|
+
componentsUsed: ['Button', 'Icon', 'Layout', 'Text'],
|
|
14
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {Button} from '@astryxdesign/core/Button';
|
|
6
|
+
import {Icon} from '@astryxdesign/core/Icon';
|
|
7
|
+
import {Stack} from '@astryxdesign/core/Layout';
|
|
8
|
+
import {Text} from '@astryxdesign/core/Text';
|
|
9
|
+
import {PlusIcon} from '@heroicons/react/24/outline';
|
|
10
|
+
|
|
11
|
+
const VARIANTS = [
|
|
12
|
+
{variant: 'primary' as const, label: 'Primary'},
|
|
13
|
+
{variant: 'secondary' as const, label: 'Secondary'},
|
|
14
|
+
{variant: 'ghost' as const, label: 'Ghost'},
|
|
15
|
+
{variant: 'destructive' as const, label: 'Destructive'},
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
export default function ButtonFloating() {
|
|
19
|
+
return (
|
|
20
|
+
<Stack direction="vertical" gap={4}>
|
|
21
|
+
<Text type="supporting" color="secondary">
|
|
22
|
+
Floating action buttons — raised above content with `elevation="med"`
|
|
23
|
+
</Text>
|
|
24
|
+
<Stack direction="horizontal" gap={3} vAlign="center">
|
|
25
|
+
{VARIANTS.map(({variant, label}) => (
|
|
26
|
+
<Button
|
|
27
|
+
key={variant}
|
|
28
|
+
label={label}
|
|
29
|
+
variant={variant}
|
|
30
|
+
icon={<Icon icon={PlusIcon} />}
|
|
31
|
+
elevation="med"
|
|
32
|
+
/>
|
|
33
|
+
))}
|
|
34
|
+
</Stack>
|
|
35
|
+
</Stack>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -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: 'ButtonGroup',
|
|
7
|
+
name: 'ButtonGroup — Floating',
|
|
8
|
+
displayName: 'ButtonGroup — Floating',
|
|
9
|
+
description:
|
|
10
|
+
'A grouped action bar raised with `elevation="med"`. The connected buttons share one surface, so the shadow lifts them as a unit.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
aspectRatio: 16 / 9,
|
|
13
|
+
componentsUsed: ['ButtonGroup', 'Button', 'Layout', 'Text'],
|
|
14
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {ButtonGroup} from '@astryxdesign/core/ButtonGroup';
|
|
6
|
+
import {Button} from '@astryxdesign/core/Button';
|
|
7
|
+
import {Stack} from '@astryxdesign/core/Layout';
|
|
8
|
+
import {Text} from '@astryxdesign/core/Text';
|
|
9
|
+
|
|
10
|
+
export default function ButtonGroupFloating() {
|
|
11
|
+
return (
|
|
12
|
+
<Stack direction="vertical" gap={3} hAlign="start">
|
|
13
|
+
<Text type="supporting" color="secondary">
|
|
14
|
+
The whole group shares one raised surface — a floating action bar
|
|
15
|
+
</Text>
|
|
16
|
+
<ButtonGroup label="Zoom controls" elevation="med">
|
|
17
|
+
<Button label="Zoom out" />
|
|
18
|
+
<Button label="Reset" />
|
|
19
|
+
<Button label="Zoom in" />
|
|
20
|
+
</ButtonGroup>
|
|
21
|
+
</Stack>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -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: 'Card',
|
|
7
|
+
name: 'Card — Elevations',
|
|
8
|
+
displayName: 'Card — Elevations',
|
|
9
|
+
description:
|
|
10
|
+
'The four elevation levels side by side. Cards are flat by default; raise a card with `elevation` only when it needs to float above surrounding content.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
aspectRatio: 16 / 9,
|
|
13
|
+
componentsUsed: ['Card', 'Layout', 'Text'],
|
|
14
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {Card} from '@astryxdesign/core/Card';
|
|
6
|
+
import {Stack} from '@astryxdesign/core/Layout';
|
|
7
|
+
import {Grid} from '@astryxdesign/core/Grid';
|
|
8
|
+
import {Text, Heading} from '@astryxdesign/core/Text';
|
|
9
|
+
|
|
10
|
+
const LEVELS = [
|
|
11
|
+
{elevation: 'none' as const, caption: 'Flat — sits on the page (default)'},
|
|
12
|
+
{elevation: 'low' as const, caption: 'Low — lifts off slightly'},
|
|
13
|
+
{elevation: 'med' as const, caption: 'Med — clearly raised'},
|
|
14
|
+
{elevation: 'high' as const, caption: 'High — floats well above'},
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
export default function CardElevations() {
|
|
18
|
+
return (
|
|
19
|
+
<Grid columns={2} gap={4} width={520}>
|
|
20
|
+
{LEVELS.map(({elevation, caption}) => (
|
|
21
|
+
<Card key={elevation} elevation={elevation}>
|
|
22
|
+
<Stack direction="vertical" gap={1}>
|
|
23
|
+
<Heading level={4}>elevation="{elevation}"</Heading>
|
|
24
|
+
<Text type="supporting" color="secondary">
|
|
25
|
+
{caption}
|
|
26
|
+
</Text>
|
|
27
|
+
</Stack>
|
|
28
|
+
</Card>
|
|
29
|
+
))}
|
|
30
|
+
</Grid>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -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: 'ClickableCard',
|
|
7
|
+
name: 'ClickableCard — Elevated',
|
|
8
|
+
displayName: 'Clickable Card — Elevated',
|
|
9
|
+
description:
|
|
10
|
+
'A clickable card raised with `elevation="med"` so the shadow signals the whole surface is interactive.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
aspectRatio: 1,
|
|
13
|
+
componentsUsed: ['ClickableCard', 'Layout', 'Text'],
|
|
14
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {ClickableCard} from '@astryxdesign/core/ClickableCard';
|
|
6
|
+
import {Stack} from '@astryxdesign/core/Layout';
|
|
7
|
+
import {Text, Heading} from '@astryxdesign/core/Text';
|
|
8
|
+
|
|
9
|
+
export default function ClickableCardElevated() {
|
|
10
|
+
return (
|
|
11
|
+
<ClickableCard label="Open report" href="#" elevation="med" width={320}>
|
|
12
|
+
<Stack direction="vertical" gap={2}>
|
|
13
|
+
<Heading level={4}>Quarterly report</Heading>
|
|
14
|
+
<Text type="body" color="secondary">
|
|
15
|
+
A raised shadow signals the whole card is clickable, lifting it above
|
|
16
|
+
the surrounding content.
|
|
17
|
+
</Text>
|
|
18
|
+
</Stack>
|
|
19
|
+
</ClickableCard>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -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: 'SelectableCard',
|
|
7
|
+
name: 'SelectableCard — Elevated',
|
|
8
|
+
displayName: 'Selectable Card — Elevated',
|
|
9
|
+
description:
|
|
10
|
+
'Raised selectable cards with `elevation="low"`. The inset selection ring composes on top of the shadow, so a selected card keeps its elevation.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
aspectRatio: 2,
|
|
13
|
+
componentsUsed: ['SelectableCard', 'Layout', 'Text'],
|
|
14
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {useState} from 'react';
|
|
6
|
+
import {SelectableCard} from '@astryxdesign/core/SelectableCard';
|
|
7
|
+
import {Grid} from '@astryxdesign/core/Grid';
|
|
8
|
+
import {Text} from '@astryxdesign/core/Text';
|
|
9
|
+
|
|
10
|
+
const PLANS = [
|
|
11
|
+
{id: 'starter', name: 'Starter'},
|
|
12
|
+
{id: 'pro', name: 'Pro'},
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
export default function SelectableCardElevated() {
|
|
16
|
+
const [selected, setSelected] = useState('pro');
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<Grid columns={2} gap={3} width={420}>
|
|
20
|
+
{PLANS.map(plan => (
|
|
21
|
+
<SelectableCard
|
|
22
|
+
key={plan.id}
|
|
23
|
+
label={plan.name}
|
|
24
|
+
isSelected={selected === plan.id}
|
|
25
|
+
onChange={() => setSelected(plan.id)}
|
|
26
|
+
elevation="low">
|
|
27
|
+
<Text type="body" weight="bold">
|
|
28
|
+
{plan.name}
|
|
29
|
+
</Text>
|
|
30
|
+
<Text type="supporting" color="secondary">
|
|
31
|
+
The resting shadow stays put — the selection ring layers on top.
|
|
32
|
+
</Text>
|
|
33
|
+
</SelectableCard>
|
|
34
|
+
))}
|
|
35
|
+
</Grid>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -27,7 +27,7 @@ export default function CarouselSnap() {
|
|
|
27
27
|
{TEAM.map(person => (
|
|
28
28
|
<Card key={person.name} width={180} minHeight={140}>
|
|
29
29
|
<Stack direction="vertical" gap={3} hAlign="center">
|
|
30
|
-
<Avatar name={person.name} size="
|
|
30
|
+
<Avatar name={person.name} size="lg" />
|
|
31
31
|
<Stack direction="vertical" gap={1} hAlign="center">
|
|
32
32
|
<Text type="body" weight="bold">
|
|
33
33
|
{person.name}
|
|
@@ -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: 'ChatComposer',
|
|
7
|
+
name: 'ChatComposer — Flat',
|
|
8
|
+
displayName: 'ChatComposer — Flat',
|
|
9
|
+
description:
|
|
10
|
+
'The composer is raised by default (`elevation="low"`). Set `elevation="none"` to flatten it — it then draws a border with the same rest / hover / focus treatment as a text input.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
aspectRatio: 16 / 9,
|
|
13
|
+
componentsUsed: ['ChatComposer', 'Layout', 'Text'],
|
|
14
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {ChatComposer} from '@astryxdesign/core/Chat';
|
|
6
|
+
import {Button} from '@astryxdesign/core/Button';
|
|
7
|
+
import {DropdownMenu} from '@astryxdesign/core/DropdownMenu';
|
|
8
|
+
import {Icon} from '@astryxdesign/core/Icon';
|
|
9
|
+
import {Stack} from '@astryxdesign/core/Layout';
|
|
10
|
+
import {Text} from '@astryxdesign/core/Text';
|
|
11
|
+
import {
|
|
12
|
+
Cog6ToothIcon,
|
|
13
|
+
MicrophoneIcon,
|
|
14
|
+
SparklesIcon,
|
|
15
|
+
} from '@heroicons/react/24/outline';
|
|
16
|
+
|
|
17
|
+
export default function ChatComposerFlat() {
|
|
18
|
+
return (
|
|
19
|
+
<Stack direction="vertical" gap={2} style={{width: '100%', maxWidth: 450}}>
|
|
20
|
+
<Text type="supporting" color="secondary">
|
|
21
|
+
elevation="none" — flat, with a text-input-style border and
|
|
22
|
+
focus ring
|
|
23
|
+
</Text>
|
|
24
|
+
<ChatComposer
|
|
25
|
+
elevation="none"
|
|
26
|
+
onSubmit={value => {
|
|
27
|
+
console.log('Sent:', value);
|
|
28
|
+
}}
|
|
29
|
+
footerActions={
|
|
30
|
+
<>
|
|
31
|
+
<DropdownMenu
|
|
32
|
+
button={{
|
|
33
|
+
label: 'Auto',
|
|
34
|
+
variant: 'ghost',
|
|
35
|
+
size: 'md',
|
|
36
|
+
icon: <Icon icon={SparklesIcon} size="sm" />,
|
|
37
|
+
children: 'Auto',
|
|
38
|
+
}}
|
|
39
|
+
menuWidth={200}
|
|
40
|
+
items={[
|
|
41
|
+
{label: 'Auto', onClick: () => {}},
|
|
42
|
+
{label: 'Model A', onClick: () => {}},
|
|
43
|
+
{label: 'Model B', onClick: () => {}},
|
|
44
|
+
]}
|
|
45
|
+
/>
|
|
46
|
+
<DropdownMenu
|
|
47
|
+
button={{
|
|
48
|
+
label: 'Settings',
|
|
49
|
+
variant: 'ghost',
|
|
50
|
+
size: 'md',
|
|
51
|
+
icon: <Icon icon={Cog6ToothIcon} size="sm" />,
|
|
52
|
+
children: 'Settings',
|
|
53
|
+
}}
|
|
54
|
+
menuWidth={200}
|
|
55
|
+
items={[
|
|
56
|
+
{label: 'Preferences', onClick: () => {}},
|
|
57
|
+
{label: 'Keyboard shortcuts', onClick: () => {}},
|
|
58
|
+
{label: 'About', onClick: () => {}},
|
|
59
|
+
]}
|
|
60
|
+
/>
|
|
61
|
+
</>
|
|
62
|
+
}
|
|
63
|
+
sendActions={
|
|
64
|
+
<Button
|
|
65
|
+
label="Microphone"
|
|
66
|
+
variant="ghost"
|
|
67
|
+
size="md"
|
|
68
|
+
icon={<Icon icon={MicrophoneIcon} />}
|
|
69
|
+
isIconOnly
|
|
70
|
+
/>
|
|
71
|
+
}
|
|
72
|
+
/>
|
|
73
|
+
</Stack>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
@@ -17,7 +17,7 @@ export default function ChatMessageAvatarName() {
|
|
|
17
17
|
<ChatMessageList style={{maxWidth: 500}}>
|
|
18
18
|
<ChatMessage
|
|
19
19
|
sender="assistant"
|
|
20
|
-
avatar={<Avatar name="Agent" size="
|
|
20
|
+
avatar={<Avatar name="Agent" size="md" />}>
|
|
21
21
|
<ChatMessageBubble
|
|
22
22
|
name={
|
|
23
23
|
<Text type="supporting" weight="semibold" color="secondary">
|
|
@@ -50,7 +50,7 @@ export default function ChatMessageAvatarName() {
|
|
|
50
50
|
</ChatMessage>
|
|
51
51
|
<ChatMessage
|
|
52
52
|
sender="assistant"
|
|
53
|
-
avatar={<Avatar name="Agent" size="
|
|
53
|
+
avatar={<Avatar name="Agent" size="md" />}>
|
|
54
54
|
<ChatMessageBubble
|
|
55
55
|
name={
|
|
56
56
|
<Text type="supporting" weight="semibold" color="secondary">
|