@astryxdesign/cli 0.1.1-canary.a514b99 → 0.1.1-canary.ac73e47
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/package.json +19 -8
- package/src/api/discover.mjs +78 -26
- package/src/api/layout.mjs +301 -0
- package/src/api/layout.test.mjs +238 -0
- package/src/api/template.mjs +191 -50
- package/src/api/template.test.mjs +2 -0
- package/src/commands/gap-report.mjs +17 -9
- package/src/commands/gap-report.test.mjs +21 -16
- package/src/commands/init.mjs +34 -8
- package/src/commands/init.next-steps.test.mjs +46 -0
- package/src/commands/layout.mjs +139 -0
- package/src/commands/swizzle.mjs +51 -23
- package/src/commands/upgrade.mjs +1 -70
- package/src/config.mjs +31 -0
- package/src/config.test.mjs +24 -0
- package/src/index.mjs +4 -0
- package/src/lib/config-schema.mjs +119 -0
- package/src/lib/config.mjs +34 -7
- package/src/lib/config.test.mjs +51 -2
- package/src/lib/error-codes.mjs +8 -0
- package/src/lib/integrations.mjs +155 -0
- package/src/lib/integrations.test.mjs +154 -0
- package/src/lib/levenshtein.mjs +29 -0
- package/src/lib/manifest.mjs +6 -0
- package/src/lib/package-scanner.mjs +31 -7
- package/src/lib/string-utils.mjs +5 -14
- package/src/lib/xle/browser.d.ts +91 -0
- package/src/lib/xle/browser.mjs +120 -0
- package/src/lib/xle/expand.mjs +622 -0
- package/src/lib/xle/parse.mjs +581 -0
- package/src/lib/xle/print.mjs +174 -0
- package/src/lib/xle/registry-core.mjs +170 -0
- package/src/lib/xle/registry.mjs +237 -0
- package/src/lib/xle/splice.mjs +137 -0
- package/src/lib/xle/validate.mjs +356 -0
- package/src/lib/xle/xle.test.mjs +333 -0
- package/src/types/config.d.ts +99 -0
- package/src/utils/github.mjs +12 -27
- package/templates/blocks/components/CommandPaletteEmpty/CommandPaletteEmptyShowcase.doc.mjs +15 -0
- package/templates/blocks/components/CommandPaletteEmpty/CommandPaletteEmptyShowcase.tsx +26 -0
- package/templates/blocks/components/DateInput/DateInputDateRange.doc.mjs +2 -2
- package/templates/blocks/components/Slider/SliderShowcase.tsx +10 -1
- package/templates/blocks/components/Table/ColumnResizeHookUsage.doc.mjs +14 -0
- package/templates/blocks/components/Table/ColumnResizeHookUsage.tsx +59 -0
- package/templates/blocks/components/Table/StickyColumnsHookUsage.doc.mjs +14 -0
- package/templates/blocks/components/Table/StickyColumnsHookUsage.tsx +104 -0
- package/templates/blocks/components/ToggleButton/ToggleButtonGroup.doc.mjs +1 -1
- package/templates/blocks/components/MoreMenu/MoreMenuInToolbar.doc.mjs +0 -14
- package/templates/blocks/components/MoreMenu/MoreMenuInToolbar.tsx +0 -57
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {Table, useTableStickyColumns, pixel} from '@astryxdesign/core/Table';
|
|
6
|
+
|
|
7
|
+
interface Employee extends Record<string, unknown> {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
email: string;
|
|
11
|
+
team: string;
|
|
12
|
+
role: string;
|
|
13
|
+
location: string;
|
|
14
|
+
startDate: string;
|
|
15
|
+
status: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const employees: Employee[] = [
|
|
19
|
+
{
|
|
20
|
+
id: '1',
|
|
21
|
+
name: 'Alice Johnson',
|
|
22
|
+
email: 'alice@example.com',
|
|
23
|
+
team: 'Design Systems',
|
|
24
|
+
role: 'Staff Engineer',
|
|
25
|
+
location: 'San Francisco',
|
|
26
|
+
startDate: '2019-03-12',
|
|
27
|
+
status: 'Active',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: '2',
|
|
31
|
+
name: 'Bob Smith',
|
|
32
|
+
email: 'bob@example.com',
|
|
33
|
+
team: 'Design Systems',
|
|
34
|
+
role: 'Senior Designer',
|
|
35
|
+
location: 'New York',
|
|
36
|
+
startDate: '2020-07-01',
|
|
37
|
+
status: 'Active',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: '3',
|
|
41
|
+
name: 'Charlie Brown',
|
|
42
|
+
email: 'charlie@example.com',
|
|
43
|
+
team: 'Platform',
|
|
44
|
+
role: 'Engineering Manager',
|
|
45
|
+
location: 'London',
|
|
46
|
+
startDate: '2017-11-20',
|
|
47
|
+
status: 'On leave',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: '4',
|
|
51
|
+
name: 'Diana Prince',
|
|
52
|
+
email: 'diana@example.com',
|
|
53
|
+
team: 'Platform',
|
|
54
|
+
role: 'Staff Engineer',
|
|
55
|
+
location: 'Remote',
|
|
56
|
+
startDate: '2021-01-15',
|
|
57
|
+
status: 'Active',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: '5',
|
|
61
|
+
name: 'Eve Davis',
|
|
62
|
+
email: 'eve@example.com',
|
|
63
|
+
team: 'Growth',
|
|
64
|
+
role: 'Product Engineer',
|
|
65
|
+
location: 'Berlin',
|
|
66
|
+
startDate: '2022-05-30',
|
|
67
|
+
status: 'Active',
|
|
68
|
+
},
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
// Wide fixed-width columns so the table overflows and scrolls horizontally,
|
|
72
|
+
// keeping the pinned Name (start) and Status (end) columns in view.
|
|
73
|
+
const columns = [
|
|
74
|
+
{key: 'name', header: 'Name', width: pixel(180)},
|
|
75
|
+
{key: 'email', header: 'Email', width: pixel(220)},
|
|
76
|
+
{key: 'team', header: 'Team', width: pixel(180)},
|
|
77
|
+
{key: 'role', header: 'Role', width: pixel(200)},
|
|
78
|
+
{key: 'location', header: 'Location', width: pixel(160)},
|
|
79
|
+
{key: 'startDate', header: 'Start date', width: pixel(140)},
|
|
80
|
+
{key: 'status', header: 'Status', width: pixel(140)},
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
export default function StickyColumnsHookUsage() {
|
|
84
|
+
const stickyColumns = useTableStickyColumns<Employee>({
|
|
85
|
+
startKeys: ['name'],
|
|
86
|
+
endKeys: ['status'],
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
// Constrain the width so the Table's own horizontal scroll container is
|
|
91
|
+
// narrower than its columns — that scroll container is what sticky columns
|
|
92
|
+
// pin against. Without a width cap the table renders full-width and never
|
|
93
|
+
// scrolls internally, so nothing sticks.
|
|
94
|
+
<div style={{width: 560, maxWidth: '100%'}}>
|
|
95
|
+
<Table
|
|
96
|
+
data={employees}
|
|
97
|
+
columns={columns}
|
|
98
|
+
idKey="id"
|
|
99
|
+
hasHover
|
|
100
|
+
plugins={{stickyColumns}}
|
|
101
|
+
/>
|
|
102
|
+
</div>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
|
|
4
4
|
export const doc = {
|
|
5
5
|
type: 'block',
|
|
6
|
-
exampleFor: '
|
|
6
|
+
exampleFor: 'ToggleButtonGroup',
|
|
7
7
|
name: 'ToggleButton — Group',
|
|
8
8
|
displayName: 'ToggleButton — Group',
|
|
9
9
|
description: 'Toggle button groups in single-select and multi-select modes. Single selection acts as a view mode switcher; multiple selection forms a formatting toolbar.',
|
|
@@ -1,14 +0,0 @@
|
|
|
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: 'MoreMenu',
|
|
7
|
-
name: 'MoreMenu — In Toolbar',
|
|
8
|
-
displayName: 'MoreMenu — In Toolbar',
|
|
9
|
-
description:
|
|
10
|
-
'A three-dot menu alongside icon buttons in a card header toolbar.',
|
|
11
|
-
isReady: true,
|
|
12
|
-
aspectRatio: 16 / 9,
|
|
13
|
-
componentsUsed: ['MoreMenu', 'Button', 'Icon', 'Toolbar', 'Text', 'Card', 'Section'],
|
|
14
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
'use client';
|
|
4
|
-
|
|
5
|
-
import {MoreMenu} from '@astryxdesign/core/MoreMenu';
|
|
6
|
-
import {Button} from '@astryxdesign/core/Button';
|
|
7
|
-
import {Icon} from '@astryxdesign/core/Icon';
|
|
8
|
-
import {Toolbar} from '@astryxdesign/core/Toolbar';
|
|
9
|
-
import {Heading} from '@astryxdesign/core/Text';
|
|
10
|
-
import {Card} from '@astryxdesign/core/Card';
|
|
11
|
-
import {Section} from '@astryxdesign/core/Section';
|
|
12
|
-
import {
|
|
13
|
-
ArrowLeftIcon,
|
|
14
|
-
ArrowDownTrayIcon,
|
|
15
|
-
ShareIcon,
|
|
16
|
-
TrashIcon,
|
|
17
|
-
} from '@heroicons/react/24/outline';
|
|
18
|
-
|
|
19
|
-
export default function MoreMenuInToolbar() {
|
|
20
|
-
return (
|
|
21
|
-
<Card width="100%" height="100%" style={{marginTop: 100}}>
|
|
22
|
-
<Toolbar
|
|
23
|
-
label="Project actions"
|
|
24
|
-
size="sm"
|
|
25
|
-
dividers={['bottom']}
|
|
26
|
-
startContent={
|
|
27
|
-
<Button
|
|
28
|
-
label="Back"
|
|
29
|
-
variant="ghost"
|
|
30
|
-
icon={<Icon icon={ArrowLeftIcon} />}
|
|
31
|
-
isIconOnly
|
|
32
|
-
/>
|
|
33
|
-
}
|
|
34
|
-
centerContent={<Heading level={5}>Title</Heading>}
|
|
35
|
-
endContent={
|
|
36
|
-
<>
|
|
37
|
-
<div style={{marginInlineEnd: 8}}>
|
|
38
|
-
<MoreMenu
|
|
39
|
-
label="More actions"
|
|
40
|
-
size="sm"
|
|
41
|
-
items={[
|
|
42
|
-
{label: 'Export', icon: ArrowDownTrayIcon, onClick: () => {}},
|
|
43
|
-
{label: 'Share', icon: ShareIcon, onClick: () => {}},
|
|
44
|
-
{type: 'divider'},
|
|
45
|
-
{label: 'Delete', icon: TrashIcon, onClick: () => {}},
|
|
46
|
-
]}
|
|
47
|
-
/>
|
|
48
|
-
</div>
|
|
49
|
-
<Button label="Discard" variant="secondary" size="sm" />
|
|
50
|
-
<Button label="Save" variant="primary" size="sm" />
|
|
51
|
-
</>
|
|
52
|
-
}
|
|
53
|
-
/>
|
|
54
|
-
<Section />
|
|
55
|
-
</Card>
|
|
56
|
-
);
|
|
57
|
-
}
|