@astryxdesign/cli 0.1.1-canary.b6827c4 → 0.1.1-canary.bdc7bd7

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.b6827c4",
3
+ "version": "0.1.1-canary.bdc7bd7",
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.b6827c4",
67
- "@astryxdesign/lab": "0.1.1-canary.b6827c4",
68
- "@astryxdesign/theme-neutral": "0.1.1-canary.b6827c4",
66
+ "@astryxdesign/core": "0.1.1-canary.bdc7bd7",
67
+ "@astryxdesign/lab": "0.1.1-canary.bdc7bd7",
68
+ "@astryxdesign/theme-neutral": "0.1.1-canary.bdc7bd7",
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.b6827c4",
84
- "@astryxdesign/lab": "0.1.1-canary.b6827c4",
85
- "@astryxdesign/theme-neutral": "0.1.1-canary.b6827c4",
83
+ "@astryxdesign/core": "0.1.1-canary.bdc7bd7",
84
+ "@astryxdesign/lab": "0.1.1-canary.bdc7bd7",
85
+ "@astryxdesign/theme-neutral": "0.1.1-canary.bdc7bd7",
86
86
  "gpt-tokenizer": "^2.0.0"
87
87
  },
88
88
  "scripts": {
@@ -79,8 +79,17 @@ export function hydrateRegistry(json: SerializedRegistry): object;
79
79
  export function serializeRegistry(registry: object): SerializedRegistry;
80
80
  export function parse(source: string, opts?: {form?: string}): unknown;
81
81
  export function detectForm(source: string): 'compact' | 'outline';
82
- export function validate(doc: unknown, registry: object, blocks?: XLEBlock[], opts?: {loose?: boolean}): {errors: XLEIssue[]; warnings: XLEIssue[]};
83
- export function expand(doc: unknown, registry: object, opts?: {componentName?: string}): {code: string; componentsUsed: string[]; states: number; todos: string[]};
82
+ export function validate(
83
+ doc: unknown,
84
+ registry: object,
85
+ blocks?: XLEBlock[],
86
+ opts?: {loose?: boolean},
87
+ ): {errors: XLEIssue[]; warnings: XLEIssue[]};
88
+ export function expand(
89
+ doc: unknown,
90
+ registry: object,
91
+ opts?: {componentName?: string},
92
+ ): {code: string; componentsUsed: string[]; states: number; todos: string[]};
84
93
  export function toCompact(doc: unknown): string;
85
94
  export function toOutline(doc: unknown): string;
86
95
  export const ALIAS_TABLE: Record<string, string>;
@@ -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
+ }