@astryxdesign/cli 0.1.3 → 0.1.4-canary.01e5b29
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 +29 -1
- package/docs/browser-support.doc.mjs +200 -0
- package/docs/getting-started.doc.mjs +4 -0
- package/docs/layout.doc.mjs +2 -2
- package/docs/migration.doc.mjs +134 -0
- package/docs/styling.doc.mjs +53 -0
- package/docs/theme.doc.mjs +2 -2
- package/docs/working-with-ai.doc.mjs +1 -1
- package/package.json +15 -10
- package/src/api/component.mjs +2 -1
- package/src/api/doctor.mjs +13 -2
- package/src/api/template.mjs +14 -3
- package/src/codemods/__tests__/registry.test.mjs +1 -0
- package/src/codemods/__tests__/runner.test.mjs +38 -0
- package/src/codemods/registry.mjs +1 -0
- package/src/codemods/runner.mjs +2 -0
- package/src/codemods/transforms/v0.1.0/__tests__/drop-xds-prefix-imports.test.mjs +43 -0
- package/src/codemods/transforms/v0.1.0/__tests__/migrate-xds-css-surfaces.test.mjs +36 -0
- package/src/codemods/transforms/v0.1.0/__tests__/migrate-xds-module-specifiers.test.mjs +41 -0
- package/src/codemods/transforms/v0.1.0/drop-xds-prefix-imports.mjs +65 -13
- package/src/codemods/transforms/v0.1.0/migrate-xds-css-surfaces.mjs +43 -3
- package/src/codemods/transforms/v0.1.0/migrate-xds-module-specifiers.mjs +45 -0
- package/src/codemods/transforms/v0.1.5/__tests__/rename-switch-label-spacing-default-to-hug.test.mjs +93 -0
- package/src/codemods/transforms/v0.1.5/index.mjs +19 -0
- package/src/codemods/transforms/v0.1.5/rename-switch-label-spacing-default-to-hug.mjs +140 -0
- package/src/commands/agent-docs.mjs +9 -6
- package/src/commands/agent-docs.test.mjs +33 -0
- package/src/commands/build-theme.color-scheme.test.mjs +153 -0
- package/src/commands/build-theme.mjs +118 -14
- package/src/commands/build-theme.variants.test.mjs +193 -0
- package/src/commands/component-resolution.test.mjs +4 -4
- package/src/commands/doctor.test.mjs +38 -3
- package/src/commands/init.mjs +1 -1
- package/src/commands/swizzle.mjs +34 -0
- package/src/commands/swizzle.routing.test.mjs +67 -0
- package/src/lib/component-discovery.mjs +8 -4
- package/src/lib/component-format.mjs +13 -2
- package/src/lib/component-format.test.mjs +42 -0
- package/src/utils/paths.test.mjs +2 -2
- package/templates/blocks/components/BaseTypeahead/BaseTypeaheadCustomSearch.doc.mjs +14 -0
- package/templates/blocks/components/BaseTypeahead/BaseTypeaheadCustomSearch.tsx +58 -0
- package/templates/blocks/components/CodeBlock/CodeBlockTerminal.doc.mjs +14 -0
- package/templates/blocks/components/CodeBlock/CodeBlockTerminal.tsx +24 -0
- package/templates/blocks/components/Collapsible/CollapsibleDividedAccordion.doc.mjs +13 -0
- package/templates/blocks/components/Collapsible/CollapsibleDividedAccordion.tsx +33 -0
- package/templates/blocks/components/Collapsible/CollapsibleWithoutCard.tsx +25 -23
- package/templates/blocks/components/CommandPaletteGroup/CommandPaletteGroupShowcase.tsx +27 -48
- package/templates/blocks/components/CommandPaletteInput/CommandPaletteInputBasic.doc.mjs +15 -0
- package/templates/blocks/components/CommandPaletteInput/CommandPaletteInputBasic.tsx +39 -0
- package/templates/blocks/components/CommandPaletteInput/CommandPaletteInputShowcase.doc.mjs +15 -0
- package/templates/blocks/components/CommandPaletteInput/CommandPaletteInputShowcase.tsx +39 -0
- package/templates/blocks/components/CommandPaletteItem/CommandPaletteItemShowcase.tsx +31 -54
- package/templates/blocks/components/CommandPaletteList/CommandPaletteListBasic.doc.mjs +15 -0
- package/templates/blocks/components/CommandPaletteList/CommandPaletteListBasic.tsx +27 -0
- package/templates/blocks/components/CommandPaletteList/CommandPaletteListShowcase.doc.mjs +15 -0
- package/templates/blocks/components/CommandPaletteList/CommandPaletteListShowcase.tsx +38 -0
- package/templates/blocks/components/ContextMenuItem/ContextMenuItemBasic.doc.mjs +14 -0
- package/templates/blocks/components/ContextMenuItem/ContextMenuItemBasic.tsx +44 -0
- package/templates/blocks/components/ContextMenuItem/ContextMenuItemShowcase.doc.mjs +15 -0
- package/templates/blocks/components/ContextMenuItem/ContextMenuItemShowcase.tsx +107 -0
- package/templates/blocks/components/MetadataListItem/MetadataListItemBasic.doc.mjs +1 -1
- package/templates/blocks/components/NavHeadingMenu/NavHeadingMenuShowcase.doc.mjs +15 -0
- package/templates/blocks/components/NavHeadingMenu/NavHeadingMenuShowcase.tsx +47 -0
- package/templates/blocks/components/TabList/TabListTabsWithActions.doc.mjs +1 -1
- package/templates/blocks/components/Table/TableRowExpansionTable.doc.mjs +14 -0
- package/templates/blocks/components/Table/TableRowExpansionTable.tsx +99 -0
- package/templates/blocks/components/ToggleButtonGroup/ToggleButtonGroupVertical.doc.mjs +1 -1
- package/templates/pages/classic-gallery/page.tsx +1 -1
- package/templates/pages/dashboard/page.tsx +1 -1
- package/templates/pages/documentation/page.tsx +1 -1
- package/templates/pages/incident-console/page.tsx +580 -0
- package/templates/pages/incident-console/template.doc.mjs +12 -0
- package/templates/pages/messaging-shell/page.tsx +676 -0
- package/templates/pages/messaging-shell/template.doc.mjs +12 -0
- package/templates/pages/mixed-gallery/page.tsx +1 -1
- package/templates/pages/payment-form/page.tsx +2 -6
- package/templates/pages/product-detail/page.tsx +3 -11
- package/templates/pages/product-gallery/page.tsx +1 -1
- package/templates/pages/settings/page.tsx +1 -1
- package/templates/pages/side-gallery/page.tsx +1 -1
- package/templates/pages/table-page/page.tsx +1 -1
- package/templates/pages/table-page-chart/page.tsx +4 -14
- package/templates/pages/table-page-heatmap-status/page.tsx +1 -1
- package/templates/pages/table-page-shoe-store-heatmap/page.tsx +5 -19
- package/templates/themes/stone/stoneTheme.ts +6 -6
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {ContextMenu, ContextMenuItem} from '@astryxdesign/core/ContextMenu';
|
|
6
|
+
|
|
7
|
+
const PencilIcon = (props: React.SVGProps<SVGSVGElement>) => (
|
|
8
|
+
<svg
|
|
9
|
+
viewBox="0 0 24 24"
|
|
10
|
+
fill="none"
|
|
11
|
+
stroke="currentColor"
|
|
12
|
+
strokeWidth={1.5}
|
|
13
|
+
strokeLinecap="round"
|
|
14
|
+
strokeLinejoin="round"
|
|
15
|
+
{...props}>
|
|
16
|
+
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" />
|
|
17
|
+
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" />
|
|
18
|
+
</svg>
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const CopyIcon = (props: React.SVGProps<SVGSVGElement>) => (
|
|
22
|
+
<svg
|
|
23
|
+
viewBox="0 0 24 24"
|
|
24
|
+
fill="none"
|
|
25
|
+
stroke="currentColor"
|
|
26
|
+
strokeWidth={1.5}
|
|
27
|
+
strokeLinecap="round"
|
|
28
|
+
strokeLinejoin="round"
|
|
29
|
+
{...props}>
|
|
30
|
+
<rect x="9" y="9" width="13" height="13" rx="2" />
|
|
31
|
+
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" />
|
|
32
|
+
</svg>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const ShareIcon = (props: React.SVGProps<SVGSVGElement>) => (
|
|
36
|
+
<svg
|
|
37
|
+
viewBox="0 0 24 24"
|
|
38
|
+
fill="none"
|
|
39
|
+
stroke="currentColor"
|
|
40
|
+
strokeWidth={1.5}
|
|
41
|
+
strokeLinecap="round"
|
|
42
|
+
strokeLinejoin="round"
|
|
43
|
+
{...props}>
|
|
44
|
+
<circle cx="18" cy="5" r="3" />
|
|
45
|
+
<circle cx="6" cy="12" r="3" />
|
|
46
|
+
<circle cx="18" cy="19" r="3" />
|
|
47
|
+
<line x1="8.59" y1="13.51" x2="15.42" y2="17.49" />
|
|
48
|
+
<line x1="15.41" y1="6.51" x2="8.59" y2="10.49" />
|
|
49
|
+
</svg>
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
const TrashIcon = (props: React.SVGProps<SVGSVGElement>) => (
|
|
53
|
+
<svg
|
|
54
|
+
viewBox="0 0 24 24"
|
|
55
|
+
fill="none"
|
|
56
|
+
stroke="currentColor"
|
|
57
|
+
strokeWidth={1.5}
|
|
58
|
+
strokeLinecap="round"
|
|
59
|
+
strokeLinejoin="round"
|
|
60
|
+
{...props}>
|
|
61
|
+
<polyline points="3 6 5 6 21 6" />
|
|
62
|
+
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />
|
|
63
|
+
</svg>
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
export default function ContextMenuItemShowcase() {
|
|
67
|
+
return (
|
|
68
|
+
<ContextMenu
|
|
69
|
+
menuContent={
|
|
70
|
+
<>
|
|
71
|
+
<ContextMenuItem
|
|
72
|
+
icon={PencilIcon}
|
|
73
|
+
label="Edit"
|
|
74
|
+
description="Modify this item"
|
|
75
|
+
onClick={() => {}}
|
|
76
|
+
/>
|
|
77
|
+
<ContextMenuItem
|
|
78
|
+
icon={CopyIcon}
|
|
79
|
+
label="Duplicate"
|
|
80
|
+
description="Create a copy"
|
|
81
|
+
onClick={() => {}}
|
|
82
|
+
/>
|
|
83
|
+
<ContextMenuItem icon={ShareIcon} label="Share" onClick={() => {}} />
|
|
84
|
+
<ContextMenuItem
|
|
85
|
+
icon={TrashIcon}
|
|
86
|
+
label="Delete"
|
|
87
|
+
description="This action cannot be undone"
|
|
88
|
+
onClick={() => {}}
|
|
89
|
+
/>
|
|
90
|
+
</>
|
|
91
|
+
}>
|
|
92
|
+
<div
|
|
93
|
+
style={{
|
|
94
|
+
padding: '48px',
|
|
95
|
+
borderWidth: '2px',
|
|
96
|
+
borderStyle: 'dashed',
|
|
97
|
+
borderColor: 'var(--color-border)',
|
|
98
|
+
borderRadius: '8px',
|
|
99
|
+
textAlign: 'center',
|
|
100
|
+
color: 'var(--color-text-secondary)',
|
|
101
|
+
userSelect: 'none',
|
|
102
|
+
}}>
|
|
103
|
+
Right-click this area
|
|
104
|
+
</div>
|
|
105
|
+
</ContextMenu>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
@@ -7,7 +7,7 @@ export const doc = {
|
|
|
7
7
|
name: 'MetadataListItem — Basic',
|
|
8
8
|
displayName: 'MetadataListItem — Basic',
|
|
9
9
|
description:
|
|
10
|
-
'Labeled key
|
|
10
|
+
'Labeled key-value rows inside a MetadataList. Values accept any content, from plain text to components like Badge.',
|
|
11
11
|
isReady: true,
|
|
12
12
|
aspectRatio: 16 / 9,
|
|
13
13
|
componentsUsed: ['MetadataList', 'MetadataListItem', 'Badge'],
|
|
@@ -0,0 +1,15 @@
|
|
|
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: 'NavHeadingMenu',
|
|
7
|
+
name: 'NavHeadingMenu',
|
|
8
|
+
displayName: 'Nav Heading Menu',
|
|
9
|
+
description:
|
|
10
|
+
'NavHeadingMenu passed as the menu prop of SideNavHeading, letting the heading act as a product switcher popover trigger.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
isShowcase: true,
|
|
13
|
+
aspectRatio: 4 / 3,
|
|
14
|
+
componentsUsed: ['SideNav', 'SideNavHeading', 'NavHeadingMenu', 'NavHeadingMenuItem'],
|
|
15
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {SideNav, SideNavHeading} from '@astryxdesign/core/SideNav';
|
|
6
|
+
import {NavHeadingMenu, NavHeadingMenuItem} from '@astryxdesign/core/NavMenu';
|
|
7
|
+
|
|
8
|
+
function AppIcon() {
|
|
9
|
+
return (
|
|
10
|
+
<svg
|
|
11
|
+
width="20"
|
|
12
|
+
height="20"
|
|
13
|
+
viewBox="0 0 24 24"
|
|
14
|
+
fill="none"
|
|
15
|
+
stroke="currentColor"
|
|
16
|
+
strokeWidth="1.5">
|
|
17
|
+
<path
|
|
18
|
+
strokeLinecap="round"
|
|
19
|
+
strokeLinejoin="round"
|
|
20
|
+
d="M3.75 6A2.25 2.25 0 0 1 6 3.75h2.25A2.25 2.25 0 0 1 10.5 6v2.25a2.25 2.25 0 0 1-2.25 2.25H6a2.25 2.25 0 0 1-2.25-2.25V6ZM3.75 15.75A2.25 2.25 0 0 1 6 13.5h2.25a2.25 2.25 0 0 1 2.25 2.25V18a2.25 2.25 0 0 1-2.25 2.25H6A2.25 2.25 0 0 1 3.75 18v-2.25ZM13.5 6a2.25 2.25 0 0 1 2.25-2.25H18A2.25 2.25 0 0 1 20.25 6v2.25A2.25 2.25 0 0 1 18 10.5h-2.25a2.25 2.25 0 0 1-2.25-2.25V6ZM13.5 15.75a2.25 2.25 0 0 1 2.25-2.25H18a2.25 2.25 0 0 1 2.25 2.25V18A2.25 2.25 0 0 1 18 20.25h-2.25a2.25 2.25 0 0 1-2.25-2.25v-2.25Z"
|
|
21
|
+
/>
|
|
22
|
+
</svg>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default function NavHeadingMenuShowcase() {
|
|
27
|
+
return (
|
|
28
|
+
<div style={{height: 100}}>
|
|
29
|
+
<SideNav
|
|
30
|
+
header={
|
|
31
|
+
<SideNavHeading
|
|
32
|
+
heading="Acme Platform"
|
|
33
|
+
icon={<AppIcon />}
|
|
34
|
+
menu={
|
|
35
|
+
<NavHeadingMenu size="lg">
|
|
36
|
+
<NavHeadingMenuItem label="Dashboard" href="/dashboard" />
|
|
37
|
+
<NavHeadingMenuItem label="Analytics" href="/analytics" />
|
|
38
|
+
<NavHeadingMenuItem label="Settings" href="/settings" />
|
|
39
|
+
</NavHeadingMenu>
|
|
40
|
+
}
|
|
41
|
+
/>
|
|
42
|
+
}>
|
|
43
|
+
{null}
|
|
44
|
+
</SideNav>
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -7,7 +7,7 @@ export const doc = {
|
|
|
7
7
|
name: 'TabList — With Actions',
|
|
8
8
|
displayName: 'TabList — With Actions',
|
|
9
9
|
description:
|
|
10
|
-
'Page header pattern with tabs on the left and action buttons pushed to the right. When hasDivider is true, pair with a smaller button size (sm) so actions don\
|
|
10
|
+
'Page header pattern with tabs on the left and action buttons pushed to the right. When hasDivider is true, pair with a smaller button size (sm) so actions don\'t overpower the tab row.',
|
|
11
11
|
isReady: true,
|
|
12
12
|
aspectRatio: 4 / 3,
|
|
13
13
|
componentsUsed: ['TabList', 'Tab', 'Button'],
|
|
@@ -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: 'useTableRowExpansion',
|
|
7
|
+
name: 'useTableRowExpansion — Tree Table',
|
|
8
|
+
displayName: 'useTableRowExpansion — Tree Table',
|
|
9
|
+
description:
|
|
10
|
+
'A tree table using useTableRowExpansion with inherited columns. Child rows use the same columns as parents, indented by depth. Click the chevron or right-click to expand/collapse.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
aspectRatio: 16 / 9,
|
|
13
|
+
componentsUsed: ['Table'],
|
|
14
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {useState} from 'react';
|
|
6
|
+
import {
|
|
7
|
+
Table,
|
|
8
|
+
useTableRowExpansion,
|
|
9
|
+
useTableRowExpansionState,
|
|
10
|
+
proportional,
|
|
11
|
+
pixel,
|
|
12
|
+
} from '@astryxdesign/core/Table';
|
|
13
|
+
|
|
14
|
+
interface FileNode extends Record<string, unknown> {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
type: 'folder' | 'file';
|
|
18
|
+
size: string;
|
|
19
|
+
children?: FileNode[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const fileTree: FileNode[] = [
|
|
23
|
+
{
|
|
24
|
+
id: 'src',
|
|
25
|
+
name: 'src',
|
|
26
|
+
type: 'folder',
|
|
27
|
+
size: '—',
|
|
28
|
+
children: [
|
|
29
|
+
{
|
|
30
|
+
id: 'src/components',
|
|
31
|
+
name: 'components',
|
|
32
|
+
type: 'folder',
|
|
33
|
+
size: '—',
|
|
34
|
+
children: [
|
|
35
|
+
{
|
|
36
|
+
id: 'src/components/Button.tsx',
|
|
37
|
+
name: 'Button.tsx',
|
|
38
|
+
type: 'file',
|
|
39
|
+
size: '4.2 KB',
|
|
40
|
+
children: [],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: 'src/components/Table.tsx',
|
|
44
|
+
name: 'Table.tsx',
|
|
45
|
+
type: 'file',
|
|
46
|
+
size: '12.8 KB',
|
|
47
|
+
children: [],
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: 'src/index.ts',
|
|
53
|
+
name: 'index.ts',
|
|
54
|
+
type: 'file',
|
|
55
|
+
size: '0.4 KB',
|
|
56
|
+
children: [],
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: 'package.json',
|
|
62
|
+
name: 'package.json',
|
|
63
|
+
type: 'file',
|
|
64
|
+
size: '1.8 KB',
|
|
65
|
+
children: [],
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
const columns = [
|
|
70
|
+
{key: 'name', header: 'Name', width: proportional(2)},
|
|
71
|
+
{key: 'type', header: 'Type', width: pixel(80)},
|
|
72
|
+
{key: 'size', header: 'Size', width: pixel(90)},
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
export default function TableRowExpansionTable() {
|
|
76
|
+
const [expandedKeys, setExpandedKeys] = useState<Set<string>>(
|
|
77
|
+
new Set(['src']),
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const {data, expansionConfig} = useTableRowExpansionState<FileNode>({
|
|
81
|
+
baseData: fileTree,
|
|
82
|
+
getChildren: item => item.children ?? [],
|
|
83
|
+
getRowKey: item => item.id,
|
|
84
|
+
expandedKeys,
|
|
85
|
+
setExpandedKeys,
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const expansion = useTableRowExpansion(expansionConfig);
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<Table
|
|
92
|
+
data={data}
|
|
93
|
+
columns={columns}
|
|
94
|
+
idKey="id"
|
|
95
|
+
hasHover
|
|
96
|
+
plugins={{expansion}}
|
|
97
|
+
/>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
@@ -7,7 +7,7 @@ export const doc = {
|
|
|
7
7
|
name: 'ToggleButtonGroup — Vertical',
|
|
8
8
|
displayName: 'ToggleButtonGroup — Vertical',
|
|
9
9
|
description:
|
|
10
|
-
'A vertically stacked ToggleButtonGroup using the vertical orientation, shown with both single-select and multi-select behavior
|
|
10
|
+
'A vertically stacked ToggleButtonGroup using the vertical orientation, shown with both single-select and multi-select behavior, ideal for sidebar-style option lists and vertical toolbars.',
|
|
11
11
|
isReady: true,
|
|
12
12
|
aspectRatio: 3 / 4,
|
|
13
13
|
componentsUsed: ['ToggleButton', 'ToggleButtonGroup', 'Layout', 'Text'],
|