@astryxdesign/cli 0.1.1-canary.a21bfc3 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.1.1-canary.a21bfc3",
3
+ "version": "0.1.1-canary.ac73e47",
4
4
  "displayName": "CLI",
5
5
  "description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
6
6
  "author": "Meta Open Source",
@@ -63,9 +63,9 @@
63
63
  "zod": "^4.4.3"
64
64
  },
65
65
  "peerDependencies": {
66
- "@astryxdesign/core": "0.1.1-canary.a21bfc3",
67
- "@astryxdesign/lab": "0.1.1-canary.a21bfc3",
68
- "@astryxdesign/theme-neutral": "0.1.1-canary.a21bfc3",
66
+ "@astryxdesign/core": "0.1.1-canary.ac73e47",
67
+ "@astryxdesign/lab": "0.1.1-canary.ac73e47",
68
+ "@astryxdesign/theme-neutral": "0.1.1-canary.ac73e47",
69
69
  "gpt-tokenizer": "^2.0.0"
70
70
  },
71
71
  "peerDependenciesMeta": {
@@ -80,9 +80,9 @@
80
80
  }
81
81
  },
82
82
  "devDependencies": {
83
- "@astryxdesign/core": "0.1.1-canary.a21bfc3",
84
- "@astryxdesign/lab": "0.1.1-canary.a21bfc3",
85
- "@astryxdesign/theme-neutral": "0.1.1-canary.a21bfc3",
83
+ "@astryxdesign/core": "0.1.1-canary.ac73e47",
84
+ "@astryxdesign/lab": "0.1.1-canary.ac73e47",
85
+ "@astryxdesign/theme-neutral": "0.1.1-canary.ac73e47",
86
86
  "gpt-tokenizer": "^2.0.0"
87
87
  },
88
88
  "scripts": {
@@ -4,8 +4,8 @@
4
4
  export const doc = {
5
5
  type: 'block',
6
6
  exampleFor: 'DateInput',
7
- name: 'DateInput — Date Range',
8
- displayName: 'DateInput — Date Range',
7
+ name: 'DateInput — Min/Max Constraints',
8
+ displayName: 'DateInput — Min/Max Constraints',
9
9
  description:
10
10
  'Date input constrained to a min/max window. Use when only certain dates are valid, like booking availability or a fiscal quarter.',
11
11
  isReady: true,
@@ -2,8 +2,17 @@
2
2
 
3
3
  'use client';
4
4
 
5
+ import {useState} from 'react';
5
6
  import {Slider} from '@astryxdesign/core/Slider';
6
7
 
7
8
  export default function SliderShowcase() {
8
- return <Slider label="Volume" value={50} style={{width: 300}} />;
9
+ const [value, setValue] = useState(50);
10
+ return (
11
+ <Slider
12
+ label="Volume"
13
+ value={value}
14
+ onChange={setValue}
15
+ style={{width: 300}}
16
+ />
17
+ );
9
18
  }
@@ -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: 'useTableColumnResize',
7
+ name: 'useTableColumnResize — Draggable Columns',
8
+ displayName: 'useTableColumnResize — Draggable Columns',
9
+ description:
10
+ 'A Table using useTableColumnResize. Drag the right edge of any column header to resize; widths are committed on release. The last proportional column flexes to fill remaining space.',
11
+ isReady: true,
12
+ aspectRatio: 16 / 9,
13
+ componentsUsed: ['Table'],
14
+ };
@@ -0,0 +1,59 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ import {useState} from 'react';
6
+ import {
7
+ Table,
8
+ useTableColumnResize,
9
+ proportional,
10
+ pixel,
11
+ } from '@astryxdesign/core/Table';
12
+
13
+ interface User extends Record<string, unknown> {
14
+ id: string;
15
+ name: string;
16
+ email: string;
17
+ role: string;
18
+ }
19
+
20
+ const users: User[] = [
21
+ {
22
+ id: '1',
23
+ name: 'Alice Johnson',
24
+ email: 'alice@example.com',
25
+ role: 'Engineer',
26
+ },
27
+ {id: '2', name: 'Bob Smith', email: 'bob@example.com', role: 'Designer'},
28
+ {id: '3', name: 'Charlie Brown', email: 'charlie@example.com', role: 'PM'},
29
+ {id: '4', name: 'Diana Prince', email: 'diana@example.com', role: 'Engineer'},
30
+ {id: '5', name: 'Eve Davis', email: 'eve@example.com', role: 'Analyst'},
31
+ ];
32
+
33
+ const columns = [
34
+ {key: 'name', header: 'Name'},
35
+ {key: 'email', header: 'Email', width: proportional(2)},
36
+ {key: 'role', header: 'Role', width: pixel(120)},
37
+ ];
38
+
39
+ export default function ColumnResizeHookUsage() {
40
+ const [columnWidths, setColumnWidths] = useState<Record<string, number>>({});
41
+
42
+ const columnResize = useTableColumnResize({
43
+ columnWidths,
44
+ columns,
45
+ onColumnResizeEnd: updates => {
46
+ setColumnWidths(prev => ({...prev, ...updates}));
47
+ },
48
+ });
49
+
50
+ return (
51
+ <Table
52
+ data={users}
53
+ columns={columns}
54
+ idKey="id"
55
+ hasHover
56
+ plugins={{columnResize}}
57
+ />
58
+ );
59
+ }
@@ -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: 'useTableStickyColumns',
7
+ name: 'useTableStickyColumns — Pinned Columns',
8
+ displayName: 'useTableStickyColumns — Pinned Columns',
9
+ description:
10
+ 'A Table using useTableStickyColumns to pin the Name column to the start edge and Status to the end edge. Scroll horizontally — pinned columns stay in view with a soft shadow over the scrolling content.',
11
+ isReady: true,
12
+ aspectRatio: 16 / 9,
13
+ componentsUsed: ['Table'],
14
+ };
@@ -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: 'ToggleButton',
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
- }