@astryxdesign/cli 0.1.5-canary.c4c1f5b → 0.1.5
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 +9 -9
- package/templates/blocks/components/Table/TableGroupedRowsTable.doc.mjs +0 -14
- package/templates/blocks/components/Table/TableGroupedRowsTable.tsx +0 -66
- package/templates/blocks/components/Table/TableRowIndexTable.doc.mjs +0 -14
- package/templates/blocks/components/Table/TableRowIndexTable.tsx +0 -47
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/cli",
|
|
3
|
-
"version": "0.1.5
|
|
3
|
+
"version": "0.1.5",
|
|
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",
|
|
@@ -75,10 +75,10 @@
|
|
|
75
75
|
"zod": "^4.4.3"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"@astryxdesign/charts": "
|
|
79
|
-
"@astryxdesign/core": "
|
|
80
|
-
"@astryxdesign/lab": "
|
|
81
|
-
"@astryxdesign/theme-neutral": "
|
|
78
|
+
"@astryxdesign/charts": "*",
|
|
79
|
+
"@astryxdesign/core": "*",
|
|
80
|
+
"@astryxdesign/lab": "*",
|
|
81
|
+
"@astryxdesign/theme-neutral": "*",
|
|
82
82
|
"gpt-tokenizer": "^3.4.0"
|
|
83
83
|
},
|
|
84
84
|
"peerDependenciesMeta": {
|
|
@@ -96,10 +96,10 @@
|
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
|
-
"@astryxdesign/charts": "
|
|
100
|
-
"@astryxdesign/core": "
|
|
101
|
-
"@astryxdesign/lab": "
|
|
102
|
-
"@astryxdesign/theme-neutral": "
|
|
99
|
+
"@astryxdesign/charts": "*",
|
|
100
|
+
"@astryxdesign/core": "*",
|
|
101
|
+
"@astryxdesign/lab": "*",
|
|
102
|
+
"@astryxdesign/theme-neutral": "*",
|
|
103
103
|
"gpt-tokenizer": "^3.4.0"
|
|
104
104
|
},
|
|
105
105
|
"scripts": {
|
|
@@ -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: 'useTableGroupedRows',
|
|
7
|
-
name: 'useTableGroupedRows — Collapsible Groups',
|
|
8
|
-
displayName: 'useTableGroupedRows — Collapsible Groups',
|
|
9
|
-
description:
|
|
10
|
-
'A table grouped into collapsible sections with useTableGroupedRows. Each group gets a full-width header with a chevron, label, and member count; click to collapse/expand.',
|
|
11
|
-
isReady: true,
|
|
12
|
-
aspectRatio: 16 / 9,
|
|
13
|
-
componentsUsed: ['Table'],
|
|
14
|
-
};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
'use client';
|
|
4
|
-
|
|
5
|
-
import {useState, useCallback} from 'react';
|
|
6
|
-
import {
|
|
7
|
-
Table,
|
|
8
|
-
useTableGroupedRows,
|
|
9
|
-
proportional,
|
|
10
|
-
pixel,
|
|
11
|
-
} from '@astryxdesign/core/Table';
|
|
12
|
-
import type {TableColumn} from '@astryxdesign/core/Table';
|
|
13
|
-
|
|
14
|
-
interface Person extends Record<string, unknown> {
|
|
15
|
-
id: string;
|
|
16
|
-
name: string;
|
|
17
|
-
team: string;
|
|
18
|
-
role: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const people: Person[] = [
|
|
22
|
-
{id: '1', name: 'Ava Chen', team: 'Design Systems', role: 'Staff Eng'},
|
|
23
|
-
{id: '2', name: 'Liam Park', team: 'Design Systems', role: 'Engineer'},
|
|
24
|
-
{id: '3', name: 'Zoe Vega', team: 'Design Systems', role: 'Manager'},
|
|
25
|
-
{id: '4', name: 'Max Ross', team: 'Infra', role: 'Senior Eng'},
|
|
26
|
-
{id: '5', name: 'Mia Cole', team: 'Infra', role: 'Engineer'},
|
|
27
|
-
{id: '6', name: 'Leo Nash', team: 'Growth', role: 'PM'},
|
|
28
|
-
];
|
|
29
|
-
|
|
30
|
-
const columns: TableColumn<Person>[] = [
|
|
31
|
-
{key: 'name', header: 'Name', width: proportional(2)},
|
|
32
|
-
{key: 'role', header: 'Role', width: pixel(140)},
|
|
33
|
-
];
|
|
34
|
-
|
|
35
|
-
export default function TableGroupedRowsTable() {
|
|
36
|
-
const [collapsedGroups, setCollapsed] = useState<Set<string>>(new Set());
|
|
37
|
-
const onToggleGroup = useCallback((key: string) => {
|
|
38
|
-
setCollapsed(prev => {
|
|
39
|
-
const next = new Set(prev);
|
|
40
|
-
if (next.has(key)) {
|
|
41
|
-
next.delete(key);
|
|
42
|
-
} else {
|
|
43
|
-
next.add(key);
|
|
44
|
-
}
|
|
45
|
-
return next;
|
|
46
|
-
});
|
|
47
|
-
}, []);
|
|
48
|
-
|
|
49
|
-
const grouped = useTableGroupedRows<Person>({
|
|
50
|
-
data: people,
|
|
51
|
-
groupBy: p => p.team,
|
|
52
|
-
collapsedGroups,
|
|
53
|
-
onToggleGroup,
|
|
54
|
-
getRowKey: p => p.id,
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<Table
|
|
59
|
-
data={grouped.data}
|
|
60
|
-
columns={columns}
|
|
61
|
-
idKey={grouped.idKey}
|
|
62
|
-
hasHover
|
|
63
|
-
plugins={{grouped: grouped.plugin}}
|
|
64
|
-
/>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
@@ -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: 'useTableRowIndex',
|
|
7
|
-
name: 'useTableRowIndex — Numbered Rows',
|
|
8
|
-
displayName: 'useTableRowIndex — Numbered Rows',
|
|
9
|
-
description:
|
|
10
|
-
'A table with a prepended row-number column via useTableRowIndex. Numbering is monospaced, right-aligned, and follows the rendered data order.',
|
|
11
|
-
isReady: true,
|
|
12
|
-
aspectRatio: 16 / 9,
|
|
13
|
-
componentsUsed: ['Table'],
|
|
14
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
'use client';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
Table,
|
|
7
|
-
useTableRowIndex,
|
|
8
|
-
proportional,
|
|
9
|
-
pixel,
|
|
10
|
-
} from '@astryxdesign/core/Table';
|
|
11
|
-
import type {TableColumn} from '@astryxdesign/core/Table';
|
|
12
|
-
|
|
13
|
-
interface Track extends Record<string, unknown> {
|
|
14
|
-
id: string;
|
|
15
|
-
title: string;
|
|
16
|
-
artist: string;
|
|
17
|
-
plays: number;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const tracks: Track[] = [
|
|
21
|
-
{id: 't1', title: 'Nightfall', artist: 'Ava Chen', plays: 1820},
|
|
22
|
-
{id: 't2', title: 'Ember', artist: 'Liam Park', plays: 942},
|
|
23
|
-
{id: 't3', title: 'Tidal', artist: 'Zoe Vega', plays: 3310},
|
|
24
|
-
{id: 't4', title: 'Cinder', artist: 'Max Ross', plays: 604},
|
|
25
|
-
{id: 't5', title: 'Halcyon', artist: 'Mia Cole', plays: 2075},
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
const columns: TableColumn<Track>[] = [
|
|
29
|
-
{key: 'title', header: 'Title', width: proportional(2)},
|
|
30
|
-
{key: 'artist', header: 'Artist', width: proportional(2)},
|
|
31
|
-
{key: 'plays', header: 'Plays', width: pixel(90), align: 'end'},
|
|
32
|
-
];
|
|
33
|
-
|
|
34
|
-
export default function TableRowIndexTable() {
|
|
35
|
-
// Pass the rendered data array — numbering follows its order.
|
|
36
|
-
const rowIndex = useTableRowIndex<Track>({data: tracks});
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<Table
|
|
40
|
-
data={tracks}
|
|
41
|
-
columns={columns}
|
|
42
|
-
idKey="id"
|
|
43
|
-
hasHover
|
|
44
|
-
plugins={{rowIndex}}
|
|
45
|
-
/>
|
|
46
|
-
);
|
|
47
|
-
}
|