@ttoss/fsl-ui 0.2.5 → 0.2.6

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.
@@ -0,0 +1,248 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+ const require_focusRing = require('../../tokens/focusRing.cjs');
3
+ const require_resolveInteractiveStyle = require('../../tokens/resolveInteractiveStyle.cjs');
4
+ const require_Icon = require('../Icon/Icon.cjs');
5
+ let _ttoss_fsl_theme_vars = require("@ttoss/fsl-theme/vars");
6
+ let react_jsx_runtime = require("react/jsx-runtime");
7
+ let react_aria_components = require("react-aria-components");
8
+
9
+ //#region src/components/Table/Table.tsx
10
+ /** Formal semantic identity — Table root (Collection entity, surface). */
11
+ var tableMeta = {
12
+ displayName: "Table",
13
+ entity: "Collection",
14
+ structure: "root"
15
+ };
16
+ /** Formal semantic identity — TableColumn header (Collection `title` role). */
17
+ var tableColumnMeta = {
18
+ displayName: "TableColumn",
19
+ entity: "Collection",
20
+ structure: "title"
21
+ };
22
+ /** Formal semantic identity — TableRow (Selection entity, selectable row). */
23
+ var tableRowMeta = {
24
+ displayName: "TableRow",
25
+ entity: "Selection",
26
+ structure: "item",
27
+ composition: "selection"
28
+ };
29
+ /** Formal semantic identity — TableCell (Collection `content` role). */
30
+ var tableCellMeta = {
31
+ displayName: "TableCell",
32
+ entity: "Collection",
33
+ structure: "content"
34
+ };
35
+ /**
36
+ * A semantic data table built on React Aria's `Table` — column headers,
37
+ * keyboard grid navigation, sorting, and row selection.
38
+ *
39
+ * Per ADR-007 the CONTAINER is Entity = Collection (an `informational`
40
+ * surface) and each `TableRow` is Entity = Selection (`input` chrome, the
41
+ * `selected` State). Compose `TableHeader` + `TableColumn` for the header
42
+ * and `TableBody` + `TableRow` + `TableCell` for the data. Sorting is
43
+ * controlled via `sortDescriptor`/`onSortChange` with `allowsSorting` on the
44
+ * sortable columns. Row selection uses React Aria's `selectionMode`;
45
+ * clicking a row toggles it (there is no checkbox column yet — it ships
46
+ * when a consumer demands bulk actions).
47
+ *
48
+ * @example
49
+ * ```tsx
50
+ * <Table aria-label="Team" sortDescriptor={sort} onSortChange={setSort}>
51
+ * <TableHeader>
52
+ * <TableColumn id="name" isRowHeader allowsSorting>Name</TableColumn>
53
+ * <TableColumn id="role">Role</TableColumn>
54
+ * </TableHeader>
55
+ * <TableBody>
56
+ * <TableRow id="ada">
57
+ * <TableCell>Ada Lovelace</TableCell>
58
+ * <TableCell>Admin</TableCell>
59
+ * </TableRow>
60
+ * </TableBody>
61
+ * </Table>
62
+ * ```
63
+ */
64
+ var Table = props => {
65
+ const surface = _ttoss_fsl_theme_vars.vars.colors.informational.primary;
66
+ return /* @__PURE__ */(0, react_jsx_runtime.jsx)(react_aria_components.Table, {
67
+ ...props,
68
+ "data-scope": "table",
69
+ "data-part": "root",
70
+ style: {
71
+ boxSizing: "border-box",
72
+ inlineSize: "100%",
73
+ borderCollapse: "separate",
74
+ borderSpacing: 0,
75
+ borderRadius: _ttoss_fsl_theme_vars.vars.radii.surface,
76
+ borderWidth: _ttoss_fsl_theme_vars.vars.border.outline.surface.width,
77
+ borderStyle: _ttoss_fsl_theme_vars.vars.border.outline.surface.style,
78
+ borderColor: surface?.border?.default ?? "transparent",
79
+ backgroundColor: surface?.background?.default,
80
+ color: surface?.text?.default
81
+ }
82
+ });
83
+ };
84
+ Table.displayName = tableMeta.displayName;
85
+ /**
86
+ * The header row group. An internal frame part — place `TableColumn`s
87
+ * inside it.
88
+ */
89
+ var TableHeader = props => {
90
+ return /* @__PURE__ */(0, react_jsx_runtime.jsx)(react_aria_components.TableHeader, {
91
+ ...props,
92
+ "data-scope": "table",
93
+ "data-part": "header"
94
+ });
95
+ };
96
+ TableHeader.displayName = "TableHeader";
97
+ /**
98
+ * A column header (Collection `title` role). With `allowsSorting`, React
99
+ * Aria makes it a keyboard-operable sort control (`aria-sort` included) and
100
+ * the current direction renders as an arrow Icon
101
+ * (`action.sortAscending` / `action.sortDescending`).
102
+ *
103
+ * Set `isRowHeader` on the column whose cells name the row for assistive
104
+ * technology.
105
+ */
106
+ var TableColumn = ({
107
+ children,
108
+ ...props
109
+ }) => {
110
+ const colors = _ttoss_fsl_theme_vars.vars.colors.informational.muted;
111
+ return /* @__PURE__ */(0, react_jsx_runtime.jsx)(react_aria_components.Column, {
112
+ ...props,
113
+ "data-scope": "table",
114
+ "data-part": "title",
115
+ style: ({
116
+ allowsSorting,
117
+ isHovered,
118
+ isFocusVisible
119
+ }) => {
120
+ return {
121
+ boxSizing: "border-box",
122
+ textAlign: "start",
123
+ paddingBlock: _ttoss_fsl_theme_vars.vars.spacing.inset.control.sm,
124
+ paddingInline: _ttoss_fsl_theme_vars.vars.spacing.inset.control.md,
125
+ ..._ttoss_fsl_theme_vars.vars.text.label.sm,
126
+ cursor: allowsSorting ? "pointer" : void 0,
127
+ transitionProperty: "color",
128
+ transitionDuration: _ttoss_fsl_theme_vars.vars.motion.feedback.duration,
129
+ transitionTimingFunction: _ttoss_fsl_theme_vars.vars.motion.feedback.easing,
130
+ color: allowsSorting ? require_resolveInteractiveStyle.resolveInteractiveStyle(colors?.text, {
131
+ isHovered
132
+ }) : colors?.text?.default,
133
+ borderBlockEndWidth: _ttoss_fsl_theme_vars.vars.border.divider.width,
134
+ borderBlockEndStyle: _ttoss_fsl_theme_vars.vars.border.divider.style,
135
+ borderBlockEndColor: colors?.border?.default ?? "transparent",
136
+ outline: require_focusRing.focusRingOutline(isFocusVisible),
137
+ outlineOffset: "-2px"
138
+ };
139
+ },
140
+ children: ({
141
+ allowsSorting,
142
+ sortDirection
143
+ }) => {
144
+ return /* @__PURE__ */(0, react_jsx_runtime.jsxs)("span", {
145
+ style: {
146
+ display: "inline-flex",
147
+ alignItems: "center",
148
+ gap: _ttoss_fsl_theme_vars.vars.spacing.gap.inline.sm
149
+ },
150
+ children: [children, allowsSorting && sortDirection && /* @__PURE__ */(0, react_jsx_runtime.jsx)(require_Icon.Icon, {
151
+ intent: sortDirection === "ascending" ? "action.sortAscending" : "action.sortDescending",
152
+ size: "sm"
153
+ })]
154
+ });
155
+ }
156
+ });
157
+ };
158
+ TableColumn.displayName = tableColumnMeta.displayName;
159
+ /** The data row group. An internal frame part — place `TableRow`s inside. */
160
+ var TableBody = props => {
161
+ return /* @__PURE__ */(0, react_jsx_runtime.jsx)(react_aria_components.TableBody, {
162
+ ...props,
163
+ "data-scope": "table",
164
+ "data-part": "body"
165
+ });
166
+ };
167
+ TableBody.displayName = "TableBody";
168
+ /**
169
+ * A single data row. Entity = Selection → reads `vars.colors.input.*` and
170
+ * surfaces the `selected` State when the parent Table has a `selectionMode`.
171
+ */
172
+ var TableRow = props => {
173
+ const c = _ttoss_fsl_theme_vars.vars.colors.input.primary;
174
+ return /* @__PURE__ */(0, react_jsx_runtime.jsx)(react_aria_components.Row, {
175
+ ...props,
176
+ "data-scope": "table",
177
+ "data-part": "item",
178
+ style: ({
179
+ isSelected,
180
+ isHovered,
181
+ isFocusVisible,
182
+ isDisabled,
183
+ selectionMode
184
+ }) => {
185
+ return {
186
+ boxSizing: "border-box",
187
+ blockSize: _ttoss_fsl_theme_vars.vars.sizing.hit,
188
+ cursor: selectionMode === "none" ? void 0 : isDisabled ? "not-allowed" : "pointer",
189
+ opacity: isDisabled ? _ttoss_fsl_theme_vars.vars.opacity.disabled : void 0,
190
+ transitionProperty: "background-color, color",
191
+ transitionDuration: _ttoss_fsl_theme_vars.vars.motion.feedback.duration,
192
+ transitionTimingFunction: _ttoss_fsl_theme_vars.vars.motion.feedback.easing,
193
+ backgroundColor: require_resolveInteractiveStyle.resolveInteractiveStyle(c?.background, {
194
+ isDisabled,
195
+ isSelected,
196
+ isHovered: isHovered && selectionMode !== "none"
197
+ }),
198
+ color: require_resolveInteractiveStyle.resolveInteractiveStyle(c?.text, {
199
+ isDisabled,
200
+ isSelected
201
+ }),
202
+ outline: require_focusRing.focusRingOutline(isFocusVisible),
203
+ outlineOffset: "-2px"
204
+ };
205
+ }
206
+ });
207
+ };
208
+ TableRow.displayName = tableRowMeta.displayName;
209
+ /**
210
+ * A data cell (Collection `content` role). Focusable during keyboard grid
211
+ * navigation; typography and color inherit from the row.
212
+ */
213
+ var TableCell = props => {
214
+ const colors = _ttoss_fsl_theme_vars.vars.colors.informational.muted;
215
+ return /* @__PURE__ */(0, react_jsx_runtime.jsx)(react_aria_components.Cell, {
216
+ ...props,
217
+ "data-scope": "table",
218
+ "data-part": "content",
219
+ style: ({
220
+ isFocusVisible
221
+ }) => {
222
+ return {
223
+ boxSizing: "border-box",
224
+ paddingBlock: _ttoss_fsl_theme_vars.vars.spacing.inset.control.sm,
225
+ paddingInline: _ttoss_fsl_theme_vars.vars.spacing.inset.control.md,
226
+ ..._ttoss_fsl_theme_vars.vars.text.body.sm,
227
+ borderBlockEndWidth: _ttoss_fsl_theme_vars.vars.border.divider.width,
228
+ borderBlockEndStyle: _ttoss_fsl_theme_vars.vars.border.divider.style,
229
+ borderBlockEndColor: colors?.border?.default ?? "transparent",
230
+ outline: require_focusRing.focusRingOutline(isFocusVisible),
231
+ outlineOffset: "-2px"
232
+ };
233
+ }
234
+ });
235
+ };
236
+ TableCell.displayName = tableCellMeta.displayName;
237
+
238
+ //#endregion
239
+ exports.Table = Table;
240
+ exports.TableBody = TableBody;
241
+ exports.TableCell = TableCell;
242
+ exports.TableColumn = TableColumn;
243
+ exports.TableHeader = TableHeader;
244
+ exports.TableRow = TableRow;
245
+ exports.tableCellMeta = tableCellMeta;
246
+ exports.tableColumnMeta = tableColumnMeta;
247
+ exports.tableMeta = tableMeta;
248
+ exports.tableRowMeta = tableRowMeta;
@@ -0,0 +1,128 @@
1
+
2
+ import * as React from "react";
3
+ import { CellProps, ColumnProps, RowProps, SortDescriptor, SortDirection, TableBodyProps, TableHeaderProps, TableProps } from "react-aria-components";
4
+
5
+ //#region src/components/Table/Table.d.ts
6
+ /** Formal semantic identity — Table root (Collection entity, surface). */
7
+ declare const tableMeta: {
8
+ readonly displayName: "Table";
9
+ readonly entity: "Collection";
10
+ readonly structure: "root";
11
+ };
12
+ /** Formal semantic identity — TableColumn header (Collection `title` role). */
13
+ declare const tableColumnMeta: {
14
+ readonly displayName: "TableColumn";
15
+ readonly entity: "Collection";
16
+ readonly structure: "title";
17
+ };
18
+ /** Formal semantic identity — TableRow (Selection entity, selectable row). */
19
+ declare const tableRowMeta: {
20
+ readonly displayName: "TableRow";
21
+ readonly entity: "Selection";
22
+ readonly structure: "item";
23
+ readonly composition: "selection";
24
+ };
25
+ /** Formal semantic identity — TableCell (Collection `content` role). */
26
+ declare const tableCellMeta: {
27
+ readonly displayName: "TableCell";
28
+ readonly entity: "Collection";
29
+ readonly structure: "content";
30
+ };
31
+ /** Props for the Table component. */
32
+ type TableProps$1 = Omit<TableProps, 'style' | 'className'>;
33
+ /**
34
+ * A semantic data table built on React Aria's `Table` — column headers,
35
+ * keyboard grid navigation, sorting, and row selection.
36
+ *
37
+ * Per ADR-007 the CONTAINER is Entity = Collection (an `informational`
38
+ * surface) and each `TableRow` is Entity = Selection (`input` chrome, the
39
+ * `selected` State). Compose `TableHeader` + `TableColumn` for the header
40
+ * and `TableBody` + `TableRow` + `TableCell` for the data. Sorting is
41
+ * controlled via `sortDescriptor`/`onSortChange` with `allowsSorting` on the
42
+ * sortable columns. Row selection uses React Aria's `selectionMode`;
43
+ * clicking a row toggles it (there is no checkbox column yet — it ships
44
+ * when a consumer demands bulk actions).
45
+ *
46
+ * @example
47
+ * ```tsx
48
+ * <Table aria-label="Team" sortDescriptor={sort} onSortChange={setSort}>
49
+ * <TableHeader>
50
+ * <TableColumn id="name" isRowHeader allowsSorting>Name</TableColumn>
51
+ * <TableColumn id="role">Role</TableColumn>
52
+ * </TableHeader>
53
+ * <TableBody>
54
+ * <TableRow id="ada">
55
+ * <TableCell>Ada Lovelace</TableCell>
56
+ * <TableCell>Admin</TableCell>
57
+ * </TableRow>
58
+ * </TableBody>
59
+ * </Table>
60
+ * ```
61
+ */
62
+ declare const Table: {
63
+ (props: TableProps$1): import("react/jsx-runtime").JSX.Element;
64
+ displayName: "Table";
65
+ };
66
+ /** Props for the TableHeader frame. */
67
+ type TableHeaderProps$1<T extends object = object> = Omit<TableHeaderProps<T>, 'style' | 'className'>;
68
+ /**
69
+ * The header row group. An internal frame part — place `TableColumn`s
70
+ * inside it.
71
+ */
72
+ declare const TableHeader: {
73
+ <T extends object = object>(props: TableHeaderProps$1<T>): import("react/jsx-runtime").JSX.Element;
74
+ displayName: string;
75
+ };
76
+ /** Props for a TableColumn header cell. */
77
+ type TableColumnProps = Omit<ColumnProps, 'style' | 'className' | 'children'> & {
78
+ /**
79
+ * Column header content. Plain nodes only — the column owns its render
80
+ * prop internally (label + sort-direction indicator).
81
+ */
82
+ children?: React.ReactNode;
83
+ };
84
+ /**
85
+ * A column header (Collection `title` role). With `allowsSorting`, React
86
+ * Aria makes it a keyboard-operable sort control (`aria-sort` included) and
87
+ * the current direction renders as an arrow Icon
88
+ * (`action.sortAscending` / `action.sortDescending`).
89
+ *
90
+ * Set `isRowHeader` on the column whose cells name the row for assistive
91
+ * technology.
92
+ */
93
+ declare const TableColumn: {
94
+ ({
95
+ children,
96
+ ...props
97
+ }: TableColumnProps): import("react/jsx-runtime").JSX.Element;
98
+ displayName: "TableColumn";
99
+ };
100
+ /** Props for the TableBody frame. */
101
+ type TableBodyProps$1<T extends object = object> = Omit<TableBodyProps<T>, 'style' | 'className'>;
102
+ /** The data row group. An internal frame part — place `TableRow`s inside. */
103
+ declare const TableBody: {
104
+ <T extends object = object>(props: TableBodyProps$1<T>): import("react/jsx-runtime").JSX.Element;
105
+ displayName: string;
106
+ };
107
+ /** Props for a TableRow. */
108
+ type TableRowProps<T extends object = object> = Omit<RowProps<T>, 'style' | 'className'>;
109
+ /**
110
+ * A single data row. Entity = Selection → reads `vars.colors.input.*` and
111
+ * surfaces the `selected` State when the parent Table has a `selectionMode`.
112
+ */
113
+ declare const TableRow: {
114
+ <T extends object = object>(props: TableRowProps<T>): import("react/jsx-runtime").JSX.Element;
115
+ displayName: "TableRow";
116
+ };
117
+ /** Props for a TableCell. */
118
+ type TableCellProps = Omit<CellProps, 'style' | 'className'>;
119
+ /**
120
+ * A data cell (Collection `content` role). Focusable during keyboard grid
121
+ * navigation; typography and color inherit from the row.
122
+ */
123
+ declare const TableCell: {
124
+ (props: TableCellProps): import("react/jsx-runtime").JSX.Element;
125
+ displayName: "TableCell";
126
+ };
127
+ //#endregion
128
+ export { type SortDescriptor, type SortDirection, Table, TableBody, TableBodyProps$1 as TableBodyProps, TableCell, TableCellProps, TableColumn, TableColumnProps, TableHeader, TableHeaderProps$1 as TableHeaderProps, TableProps$1 as TableProps, TableRow, TableRowProps, tableCellMeta, tableColumnMeta, tableMeta, tableRowMeta };
@@ -0,0 +1,128 @@
1
+
2
+ import { CellProps, ColumnProps, RowProps, SortDescriptor, SortDirection, TableBodyProps, TableHeaderProps, TableProps } from "react-aria-components";
3
+ import * as React from "react";
4
+
5
+ //#region src/components/Table/Table.d.ts
6
+ /** Formal semantic identity — Table root (Collection entity, surface). */
7
+ declare const tableMeta: {
8
+ readonly displayName: "Table";
9
+ readonly entity: "Collection";
10
+ readonly structure: "root";
11
+ };
12
+ /** Formal semantic identity — TableColumn header (Collection `title` role). */
13
+ declare const tableColumnMeta: {
14
+ readonly displayName: "TableColumn";
15
+ readonly entity: "Collection";
16
+ readonly structure: "title";
17
+ };
18
+ /** Formal semantic identity — TableRow (Selection entity, selectable row). */
19
+ declare const tableRowMeta: {
20
+ readonly displayName: "TableRow";
21
+ readonly entity: "Selection";
22
+ readonly structure: "item";
23
+ readonly composition: "selection";
24
+ };
25
+ /** Formal semantic identity — TableCell (Collection `content` role). */
26
+ declare const tableCellMeta: {
27
+ readonly displayName: "TableCell";
28
+ readonly entity: "Collection";
29
+ readonly structure: "content";
30
+ };
31
+ /** Props for the Table component. */
32
+ type TableProps$1 = Omit<TableProps, 'style' | 'className'>;
33
+ /**
34
+ * A semantic data table built on React Aria's `Table` — column headers,
35
+ * keyboard grid navigation, sorting, and row selection.
36
+ *
37
+ * Per ADR-007 the CONTAINER is Entity = Collection (an `informational`
38
+ * surface) and each `TableRow` is Entity = Selection (`input` chrome, the
39
+ * `selected` State). Compose `TableHeader` + `TableColumn` for the header
40
+ * and `TableBody` + `TableRow` + `TableCell` for the data. Sorting is
41
+ * controlled via `sortDescriptor`/`onSortChange` with `allowsSorting` on the
42
+ * sortable columns. Row selection uses React Aria's `selectionMode`;
43
+ * clicking a row toggles it (there is no checkbox column yet — it ships
44
+ * when a consumer demands bulk actions).
45
+ *
46
+ * @example
47
+ * ```tsx
48
+ * <Table aria-label="Team" sortDescriptor={sort} onSortChange={setSort}>
49
+ * <TableHeader>
50
+ * <TableColumn id="name" isRowHeader allowsSorting>Name</TableColumn>
51
+ * <TableColumn id="role">Role</TableColumn>
52
+ * </TableHeader>
53
+ * <TableBody>
54
+ * <TableRow id="ada">
55
+ * <TableCell>Ada Lovelace</TableCell>
56
+ * <TableCell>Admin</TableCell>
57
+ * </TableRow>
58
+ * </TableBody>
59
+ * </Table>
60
+ * ```
61
+ */
62
+ declare const Table$1: {
63
+ (props: TableProps$1): import("react/jsx-runtime").JSX.Element;
64
+ displayName: "Table";
65
+ };
66
+ /** Props for the TableHeader frame. */
67
+ type TableHeaderProps$1<T extends object = object> = Omit<TableHeaderProps<T>, 'style' | 'className'>;
68
+ /**
69
+ * The header row group. An internal frame part — place `TableColumn`s
70
+ * inside it.
71
+ */
72
+ declare const TableHeader$1: {
73
+ <T extends object = object>(props: TableHeaderProps$1<T>): import("react/jsx-runtime").JSX.Element;
74
+ displayName: string;
75
+ };
76
+ /** Props for a TableColumn header cell. */
77
+ type TableColumnProps = Omit<ColumnProps, 'style' | 'className' | 'children'> & {
78
+ /**
79
+ * Column header content. Plain nodes only — the column owns its render
80
+ * prop internally (label + sort-direction indicator).
81
+ */
82
+ children?: React.ReactNode;
83
+ };
84
+ /**
85
+ * A column header (Collection `title` role). With `allowsSorting`, React
86
+ * Aria makes it a keyboard-operable sort control (`aria-sort` included) and
87
+ * the current direction renders as an arrow Icon
88
+ * (`action.sortAscending` / `action.sortDescending`).
89
+ *
90
+ * Set `isRowHeader` on the column whose cells name the row for assistive
91
+ * technology.
92
+ */
93
+ declare const TableColumn: {
94
+ ({
95
+ children,
96
+ ...props
97
+ }: TableColumnProps): import("react/jsx-runtime").JSX.Element;
98
+ displayName: "TableColumn";
99
+ };
100
+ /** Props for the TableBody frame. */
101
+ type TableBodyProps$1<T extends object = object> = Omit<TableBodyProps<T>, 'style' | 'className'>;
102
+ /** The data row group. An internal frame part — place `TableRow`s inside. */
103
+ declare const TableBody$1: {
104
+ <T extends object = object>(props: TableBodyProps$1<T>): import("react/jsx-runtime").JSX.Element;
105
+ displayName: string;
106
+ };
107
+ /** Props for a TableRow. */
108
+ type TableRowProps<T extends object = object> = Omit<RowProps<T>, 'style' | 'className'>;
109
+ /**
110
+ * A single data row. Entity = Selection → reads `vars.colors.input.*` and
111
+ * surfaces the `selected` State when the parent Table has a `selectionMode`.
112
+ */
113
+ declare const TableRow: {
114
+ <T extends object = object>(props: TableRowProps<T>): import("react/jsx-runtime").JSX.Element;
115
+ displayName: "TableRow";
116
+ };
117
+ /** Props for a TableCell. */
118
+ type TableCellProps = Omit<CellProps, 'style' | 'className'>;
119
+ /**
120
+ * A data cell (Collection `content` role). Focusable during keyboard grid
121
+ * navigation; typography and color inherit from the row.
122
+ */
123
+ declare const TableCell: {
124
+ (props: TableCellProps): import("react/jsx-runtime").JSX.Element;
125
+ displayName: "TableCell";
126
+ };
127
+ //#endregion
128
+ export { type SortDescriptor, type SortDirection, Table$1 as Table, TableBody$1 as TableBody, TableBodyProps$1 as TableBodyProps, TableCell, TableCellProps, TableColumn, TableColumnProps, TableHeader$1 as TableHeader, TableHeaderProps$1 as TableHeaderProps, TableProps$1 as TableProps, TableRow, TableRowProps, tableCellMeta, tableColumnMeta, tableMeta, tableRowMeta };