@techsio/ui-kit 0.37.1 → 0.38.0
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/dist/organisms/data-table.fields.js +720 -0
- package/dist/organisms/data-table.helpers.js +168 -0
- package/dist/organisms/data-table.js +1736 -0
- package/dist/organisms/table.js +7 -3
- package/dist/src/molecules/switch.d.ts +3 -3
- package/dist/src/molecules/toast.d.ts +3 -3
- package/dist/src/organisms/data-table.d.ts +357 -0
- package/dist/src/organisms/data-table.d.ts.map +1 -0
- package/dist/src/organisms/data-table.fields.d.ts +119 -0
- package/dist/src/organisms/data-table.fields.d.ts.map +1 -0
- package/dist/src/organisms/data-table.helpers.d.ts +240 -0
- package/dist/src/organisms/data-table.helpers.d.ts.map +1 -0
- package/dist/src/organisms/table.d.ts +15 -7
- package/dist/src/organisms/table.d.ts.map +1 -1
- package/dist/stories/changelog/changelog.stories.d.ts.map +1 -1
- package/dist/stories/organisms/data-table.stories.d.ts +145 -0
- package/dist/stories/organisms/data-table.stories.d.ts.map +1 -0
- package/dist/stories/organisms/table.stories.d.ts +7 -0
- package/dist/stories/organisms/table.stories.d.ts.map +1 -1
- package/package.json +7 -1
- package/src/tokens/components/components.css +1 -0
- package/src/tokens/components/organisms/_data-table.css +51 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DataTable helpers — types, conditional filter operators and pin styling.
|
|
3
|
+
*
|
|
4
|
+
* Kept separate from `data-table.tsx` so the component file stays focused on
|
|
5
|
+
* rendering. Re-exported through `data-table.tsx` for consumers.
|
|
6
|
+
*/
|
|
7
|
+
import { type CellData, type ColumnSizingState, type ReactTable, type RowData, type TableFeatures, type Cell as TanstackCell, type CellContext as TanstackCellContext, type Column as TanstackColumn, type ColumnDef as TanstackColumnDef, type FilterFn as TanstackFilterFn, type Header as TanstackHeader, type Row as TanstackRow } from "@tanstack/react-table";
|
|
8
|
+
import type { CSSProperties, ReactNode } from "react";
|
|
9
|
+
/** The feature set every DataTable type is parameterised by. */
|
|
10
|
+
export type DataTableFeatures = typeof dataTableFeatures;
|
|
11
|
+
export type Cell<T extends RowData, V extends CellData = CellData> = TanstackCell<DataTableFeatures, T, V>;
|
|
12
|
+
export type CellContext<T extends RowData, V extends CellData = CellData> = TanstackCellContext<DataTableFeatures, T, V>;
|
|
13
|
+
export type Column<T extends RowData, V extends CellData = CellData> = TanstackColumn<DataTableFeatures, T, V>;
|
|
14
|
+
export type ColumnDef<T extends RowData, V extends CellData = CellData> = TanstackColumnDef<DataTableFeatures, T, V>;
|
|
15
|
+
export type Row<T extends RowData> = TanstackRow<DataTableFeatures, T>;
|
|
16
|
+
/**
|
|
17
|
+
* The instance `useTable` hands back. It is the React wrapper rather than the
|
|
18
|
+
* core table: only the wrapper carries `table.state` and `table.Subscribe`,
|
|
19
|
+
* and both are part of what DataTable hands to `onReady`/`renderToolbar`.
|
|
20
|
+
*/
|
|
21
|
+
export type TanstackTable<T extends RowData> = ReactTable<DataTableFeatures, T>;
|
|
22
|
+
export type Header<T extends RowData, V extends CellData = CellData> = TanstackHeader<DataTableFeatures, T, V>;
|
|
23
|
+
export type FilterFn<T extends RowData> = TanstackFilterFn<DataTableFeatures, T>;
|
|
24
|
+
import type { DataTableColumnType, DataTableEditorContext, DataTableFilterContext, DataTableOption } from "./data-table.fields";
|
|
25
|
+
/**
|
|
26
|
+
* Signature for the filter functions DataTable registers on its own feature
|
|
27
|
+
* set. `TFeatures` is left as `any` on purpose: the feature set is defined in
|
|
28
|
+
* terms of these functions, so naming it here would make the type circular.
|
|
29
|
+
* TanStack widens an `any` feature set to the full API surface, so nothing is
|
|
30
|
+
* lost inside the function body.
|
|
31
|
+
*/
|
|
32
|
+
type AnyFilterFn = TanstackFilterFn<any, any>;
|
|
33
|
+
declare module "@tanstack/react-table" {
|
|
34
|
+
interface ColumnMeta<TFeatures extends TableFeatures, TData extends RowData, TValue> {
|
|
35
|
+
/**
|
|
36
|
+
* Horizontal alignment of the column's header and cells. Purely a
|
|
37
|
+
* presentation choice — nothing is inferred from the column type, so a
|
|
38
|
+
* boolean/icon column is centered and a number right-aligned only if you
|
|
39
|
+
* say so. Defaults to `"start"`.
|
|
40
|
+
*/
|
|
41
|
+
align?: "start" | "center" | "end";
|
|
42
|
+
/**
|
|
43
|
+
* Fixed column width. A number is treated as `px`; a string is used as-is,
|
|
44
|
+
* so design tokens (`"var(--dimension-120)"`), percentages and `ch` all
|
|
45
|
+
* work. Widths are only honoured exactly with `tableLayout="fixed"`.
|
|
46
|
+
*/
|
|
47
|
+
width?: DataTableColumnWidth;
|
|
48
|
+
/** Lower bound for the column width (same units as `width`). */
|
|
49
|
+
minWidth?: DataTableColumnWidth;
|
|
50
|
+
/** Upper bound for the column width (same units as `width`). */
|
|
51
|
+
maxWidth?: DataTableColumnWidth;
|
|
52
|
+
/**
|
|
53
|
+
* Declared data type. Drives which ui-kit control DataTable renders in the
|
|
54
|
+
* header filter row and in the inline row editor. Use `"custom"` (or omit)
|
|
55
|
+
* together with `renderFilter`/`renderEditor` for non-standard columns.
|
|
56
|
+
*/
|
|
57
|
+
type?: DataTableColumnType;
|
|
58
|
+
/** Choices for `enum` / `multiEnum` columns (filter + editor). */
|
|
59
|
+
options?: DataTableOption[];
|
|
60
|
+
/** Enable inline editing for this column's cells. */
|
|
61
|
+
editable?: boolean;
|
|
62
|
+
/** Reject an empty value on commit. */
|
|
63
|
+
required?: boolean;
|
|
64
|
+
/** Per-field validation run on commit; return a message to block it. */
|
|
65
|
+
validate?: (value: unknown, draft: Record<string, unknown>) => string | undefined;
|
|
66
|
+
/** Escape hatch: render this column's header filter yourself. */
|
|
67
|
+
renderFilter?: (ctx: DataTableFilterContext<TData>) => ReactNode;
|
|
68
|
+
/** Escape hatch: render this column's inline editor yourself. */
|
|
69
|
+
renderEditor?: (ctx: DataTableEditorContext<TData>) => ReactNode;
|
|
70
|
+
/** @deprecated use `type` — kept so existing columns keep working. */
|
|
71
|
+
filterVariant?: "text" | "number" | "range" | "select";
|
|
72
|
+
/** @deprecated use `options`. */
|
|
73
|
+
filterOptions?: DataTableOption[];
|
|
74
|
+
}
|
|
75
|
+
interface TableMeta<TFeatures extends TableFeatures, TData extends RowData> {
|
|
76
|
+
/** Commit an inline cell edit; wired by DataTable to `onCellEditCommit`. */
|
|
77
|
+
updateData?: (rowId: string, columnId: string, value: unknown) => void;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The single source of truth for "what type is this column", shared by the
|
|
82
|
+
* filter-row control that renders `meta.type` (or its deprecated
|
|
83
|
+
* `filterVariant` alias) and the `typed` filter function that matches
|
|
84
|
+
* against it. The two resolving `type` independently — as they briefly did —
|
|
85
|
+
* is how a `filterVariant`-only column ends up with a number control writing
|
|
86
|
+
* `{ operator: "gt", value, to }` while the matcher still treats it as
|
|
87
|
+
* `"string"` and reads that object through `matchText`.
|
|
88
|
+
*/
|
|
89
|
+
export declare function resolveColumnType(meta?: {
|
|
90
|
+
type?: DataTableColumnType;
|
|
91
|
+
filterVariant?: "text" | "number" | "range" | "select";
|
|
92
|
+
}): DataTableColumnType;
|
|
93
|
+
export declare const typedFilterFn: AnyFilterFn;
|
|
94
|
+
export type DataTableFilterOperator = "contains" | "notContains" | "equals" | "notEquals" | "startsWith" | "endsWith" | "gt" | "gte" | "lt" | "lte" | "between" | "empty" | "notEmpty";
|
|
95
|
+
/** Value shape stored in `columnFilters` when using `conditionalFilterFn`. */
|
|
96
|
+
export type DataTableConditionalFilterValue = {
|
|
97
|
+
operator: DataTableFilterOperator;
|
|
98
|
+
value?: unknown;
|
|
99
|
+
/** Upper bound for the `between` operator. */
|
|
100
|
+
to?: unknown;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* TanStack `filterFn` implementing operator-based ("with conditions") column
|
|
104
|
+
* filtering. Register on a column via `filterFn: conditionalFilterFn` and store
|
|
105
|
+
* `{ operator, value, to? }` as the filter value.
|
|
106
|
+
*
|
|
107
|
+
* The operator set (contains/equals/startsWith/gt/between/…) only has
|
|
108
|
+
* meaning for `"string"`/`"number"`/`"int"` columns. The `enum`, `multiEnum`,
|
|
109
|
+
* `boolean` and date/time controls never write an `operator` at all — they
|
|
110
|
+
* store `{ values }`, `{ value }` or `{ from, to }` — so an operator-less
|
|
111
|
+
* value is handed to the typed matcher rather than treated as "no filter".
|
|
112
|
+
* Returning `true` for those (as this used to) made any such column opting
|
|
113
|
+
* into `"conditional"` match every row while `autoRemove` kept the entry, so
|
|
114
|
+
* the UI and `onColumnFiltersChange` both reported an active filter that did
|
|
115
|
+
* nothing.
|
|
116
|
+
*/
|
|
117
|
+
export declare const conditionalFilterFn: AnyFilterFn;
|
|
118
|
+
/** A column width: a number (px) or any CSS length, including `var(--token)`. */
|
|
119
|
+
export type DataTableColumnWidth = number | string;
|
|
120
|
+
/**
|
|
121
|
+
* Fills in the column defaults DataTable's own controls depend on.
|
|
122
|
+
*
|
|
123
|
+
* **`filterFn`.** Every column in the filter row renders one of the typed
|
|
124
|
+
* controls — `meta.type` defaults to `"string"`, so this is true even for a
|
|
125
|
+
* column that declares no type at all — and those controls write an
|
|
126
|
+
* `{ operator, value }` object. TanStack's default `auto` comparator has no
|
|
127
|
+
* idea what to do with that object and matches nothing, so a column that
|
|
128
|
+
* forgot `filterFn: "typed"` silently emptied the table the moment anyone
|
|
129
|
+
* filtered it. Defaulting it here is what the docs always claimed happened.
|
|
130
|
+
* An explicit `filterFn`, string or function, always wins.
|
|
131
|
+
*
|
|
132
|
+
* **Sizes.** Mirrors numeric `meta.width` / `meta.minWidth` / `meta.maxWidth`
|
|
133
|
+
* into TanStack's own `size` / `minSize` / `maxSize`.
|
|
134
|
+
*
|
|
135
|
+
* Without this the two disagree: sticky offsets for pinned columns come from
|
|
136
|
+
* `column.getStart()`, which sums `getSize()`, so a frozen column rendered at
|
|
137
|
+
* `meta.width: 80` would push its neighbour by TanStack's default 150 and the
|
|
138
|
+
* frozen block would be misaligned. Resizing would drift the same way.
|
|
139
|
+
*
|
|
140
|
+
* CSS-string widths (`"15%"`, `"var(--dimension-120)"`) cannot be resolved to
|
|
141
|
+
* pixels here, so they stay CSS-only — see `getColumnSizeStyles`.
|
|
142
|
+
*/
|
|
143
|
+
export declare function applyColumnDefaults<T extends RowData>(columns: ColumnDef<T, unknown>[]): ColumnDef<T, unknown>[];
|
|
144
|
+
/**
|
|
145
|
+
* Resolves the inline sizing styles for a column.
|
|
146
|
+
*
|
|
147
|
+
* `meta.width` is the declarative API. `columnDef.size` is deliberately *not*
|
|
148
|
+
* read as a fallback: TanStack merges `size: 150` into every column def, so it
|
|
149
|
+
* cannot distinguish a declared width from the default. Numeric widths are
|
|
150
|
+
* mirrored into `size` by `applyColumnDefaults`, so `getSize()` is the
|
|
151
|
+
* authority for them and the rendered width always matches the sticky offsets.
|
|
152
|
+
*
|
|
153
|
+
* A CSS-string width (`"15%"`, `"var(--dimension-120)"`) has no pixel value to
|
|
154
|
+
* mirror, so it stays CSS-only — including while resizing is enabled, where
|
|
155
|
+
* `getSize()` would otherwise report the 150px default and collapse the
|
|
156
|
+
* declared width the moment the feature is switched on. Once the user actually
|
|
157
|
+
* drags such a column its id appears in `columnSizing` and the dragged size
|
|
158
|
+
* takes over; `resetSize()` drops the entry and the declared width returns.
|
|
159
|
+
*/
|
|
160
|
+
export declare function getColumnSizeStyles<T extends RowData>(column: Column<T>, enableColumnResizing?: boolean, columnSizing?: ColumnSizingState): CSSProperties;
|
|
161
|
+
/**
|
|
162
|
+
* Sticky-positioning styles for a pinned (frozen) column. Applied inline
|
|
163
|
+
* because the offsets are data-driven (`getStart`/`getAfter`). The visual
|
|
164
|
+
* treatment (shadow at the frozen edge) is done via `data-pinned` + tokens.
|
|
165
|
+
*/
|
|
166
|
+
/**
|
|
167
|
+
* Stacking order for sticky cells. A pinned header cell must beat both the
|
|
168
|
+
* sticky header row (z-10 from the Table organism) and pinned body cells,
|
|
169
|
+
* otherwise a frozen column's header is painted over while scrolling.
|
|
170
|
+
*/
|
|
171
|
+
export declare const DATA_TABLE_Z: {
|
|
172
|
+
readonly pinnedCell: 1;
|
|
173
|
+
/**
|
|
174
|
+
* The sticky actions cell sits one level above pinned body cells. Both
|
|
175
|
+
* freeze at the trailing edge (`getAfter("end")` is 0 for the last
|
|
176
|
+
* end-pinned column, and the actions cell is `end-0`), and the actions
|
|
177
|
+
* column is not part of TanStack's column model so `getAfter` cannot
|
|
178
|
+
* account for its width. At equal z-index the winner came down to DOM
|
|
179
|
+
* order; this at least makes the actions cell deterministically on top.
|
|
180
|
+
* The overlap itself is a known limitation — see the dev warning in
|
|
181
|
+
* DataTable for the `enableColumnPinning` + `stickyActions` combination.
|
|
182
|
+
*/
|
|
183
|
+
readonly stickyActionsCell: 2;
|
|
184
|
+
/**
|
|
185
|
+
* Any sticky header-area cell that is not pinned — notably the filter row,
|
|
186
|
+
* whose `<td>`s are raw elements and so never pick up the `sticky top-0
|
|
187
|
+
* z-10` the `Table` organism puts on real header cells. Without a level of
|
|
188
|
+
* their own they sat at `z-index: auto` while pinned *body* cells carry
|
|
189
|
+
* `pinnedCell`, so scrolling painted a frozen column straight over the
|
|
190
|
+
* sticky filter row. Above every body level, below the pinned header ones.
|
|
191
|
+
*/
|
|
192
|
+
readonly stickyHeaderCell: 10;
|
|
193
|
+
readonly pinnedHeaderCell: 20;
|
|
194
|
+
readonly stickyActionsHeaderCell: 21;
|
|
195
|
+
};
|
|
196
|
+
export declare function getPinningStyles<T extends RowData>(column: Column<T>, kind?: "header" | "body"): CSSProperties;
|
|
197
|
+
/** True when this column is the last of the start-pinned group (edge shadow). */
|
|
198
|
+
export declare function isLastStartPinned<T extends RowData>(column: Column<T>): boolean;
|
|
199
|
+
/** True when this column is the first of the end-pinned group (edge shadow). */
|
|
200
|
+
export declare function isFirstEndPinned<T extends RowData>(column: Column<T>): boolean;
|
|
201
|
+
export type DataTableCellSpan = {
|
|
202
|
+
colSpan?: number;
|
|
203
|
+
rowSpan?: number;
|
|
204
|
+
hidden?: boolean;
|
|
205
|
+
};
|
|
206
|
+
export type DataTableGetCellSpan<T extends RowData> = (cell: Cell<T, unknown>, context: {
|
|
207
|
+
row: Row<T>;
|
|
208
|
+
rows: Row<T>[];
|
|
209
|
+
rowIndex: number;
|
|
210
|
+
}) => DataTableCellSpan | undefined;
|
|
211
|
+
export type DataTableInstance<T extends RowData> = TanstackTable<T>;
|
|
212
|
+
export declare const dataTableFeatures: {
|
|
213
|
+
columnFilteringFeature: import("@tanstack/react-table").TableFeature;
|
|
214
|
+
columnOrderingFeature: import("@tanstack/react-table").TableFeature;
|
|
215
|
+
columnPinningFeature: import("@tanstack/react-table").TableFeature;
|
|
216
|
+
columnResizingFeature: import("@tanstack/react-table").TableFeature;
|
|
217
|
+
columnSizingFeature: import("@tanstack/react-table").TableFeature;
|
|
218
|
+
columnVisibilityFeature: import("@tanstack/react-table").TableFeature;
|
|
219
|
+
globalFilteringFeature: import("@tanstack/react-table").TableFeature;
|
|
220
|
+
rowExpandingFeature: import("@tanstack/react-table").TableFeature;
|
|
221
|
+
rowPaginationFeature: import("@tanstack/react-table").TableFeature;
|
|
222
|
+
rowSelectionFeature: import("@tanstack/react-table").TableFeature;
|
|
223
|
+
rowSortingFeature: import("@tanstack/react-table").TableFeature;
|
|
224
|
+
expandedRowModel: (table: import("@tanstack/react-table").Table<any, any>) => () => import("@tanstack/react-table").RowModel<any, any>;
|
|
225
|
+
filteredRowModel: (table: import("@tanstack/react-table").Table<any, any>) => () => import("@tanstack/react-table").RowModel<any, any>;
|
|
226
|
+
paginatedRowModel: (table: import("@tanstack/react-table").Table<any, any>) => () => import("@tanstack/react-table").RowModel<any, any>;
|
|
227
|
+
sortedRowModel: (table: import("@tanstack/react-table").Table<any, any>) => () => import("@tanstack/react-table").RowModel<any, any>;
|
|
228
|
+
filterFns: {
|
|
229
|
+
conditional: AnyFilterFn;
|
|
230
|
+
includesString: import("@tanstack/react-table").CreatedFilterFn<any, any>;
|
|
231
|
+
typed: AnyFilterFn;
|
|
232
|
+
};
|
|
233
|
+
sortFns: {
|
|
234
|
+
alphanumeric: import("@tanstack/react-table").CreatedSortFn<any, any>;
|
|
235
|
+
datetime: import("@tanstack/react-table").CreatedSortFn<any, any>;
|
|
236
|
+
text: import("@tanstack/react-table").CreatedSortFn<any, any>;
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
export {};
|
|
240
|
+
//# sourceMappingURL=data-table.helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-table.helpers.d.ts","sourceRoot":"","sources":["../../../src/organisms/data-table.helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,iBAAiB,EAatB,KAAK,UAAU,EACf,KAAK,OAAO,EAQZ,KAAK,aAAa,EAClB,KAAK,IAAI,IAAI,YAAY,EACzB,KAAK,WAAW,IAAI,mBAAmB,EACvC,KAAK,MAAM,IAAI,cAAc,EAC7B,KAAK,SAAS,IAAI,iBAAiB,EACnC,KAAK,QAAQ,IAAI,gBAAgB,EACjC,KAAK,MAAM,IAAI,cAAc,EAC7B,KAAK,GAAG,IAAI,WAAW,EAExB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAErD,gEAAgE;AAChE,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAA;AAMxD,MAAM,MAAM,IAAI,CACd,CAAC,SAAS,OAAO,EACjB,CAAC,SAAS,QAAQ,GAAG,QAAQ,IAC3B,YAAY,CAAC,iBAAiB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;AACzC,MAAM,MAAM,WAAW,CACrB,CAAC,SAAS,OAAO,EACjB,CAAC,SAAS,QAAQ,GAAG,QAAQ,IAC3B,mBAAmB,CAAC,iBAAiB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;AAChD,MAAM,MAAM,MAAM,CAChB,CAAC,SAAS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EAAE,MAAM,CAAC,CAAC,CAAC,GAChB,OAAO,CAIT;AAED,gFAAgF;AAChF,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,OAAO,EAChD,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAChB,OAAO,CAIT;AAMD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,OAAO,IAAI,CACpD,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,EACtB,OAAO,EAAE;IAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,KACvD,iBAAiB,GAAG,SAAS,CAAA;AAGlC,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,OAAO,IAAI,aAAa,CAAC,CAAC,CAAC,CAAA;AAYnE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;CAqC5B,CAAA"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Table — @techsio/ui-kit organism.
|
|
3
3
|
*
|
|
4
4
|
* @component Table
|
|
5
|
-
* @componentVersion v1.
|
|
5
|
+
* @componentVersion v1.1.0
|
|
6
6
|
* @skill table-usage
|
|
7
7
|
* @changelog libs/ui/stories/changelog/changelog.stories.tsx
|
|
8
8
|
*
|
|
@@ -229,8 +229,8 @@ export declare namespace Table {
|
|
|
229
229
|
var Body: ({ children, ref, className, ...props }: TableBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
230
230
|
var Footer: ({ children, ref, className, ...props }: TableFooterProps) => import("react/jsx-runtime").JSX.Element;
|
|
231
231
|
var Row: ({ children, ref, className, selected, ...props }: TableRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
232
|
-
var ColumnHeader: ({ children, ref, className, numeric, ...props }: TableColumnHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
233
|
-
var Cell: ({ children, ref, className, numeric, ...props }: TableCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
232
|
+
var ColumnHeader: ({ children, ref, className, numeric, align, ...props }: TableColumnHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
233
|
+
var Cell: ({ children, ref, className, numeric, align, ...props }: TableCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
234
234
|
var displayName: string;
|
|
235
235
|
}
|
|
236
236
|
interface TableCaptionProps extends ComponentPropsWithoutRef<"caption"> {
|
|
@@ -249,13 +249,21 @@ interface TableRowProps extends ComponentPropsWithoutRef<"tr"> {
|
|
|
249
249
|
ref?: RefObject<HTMLTableRowElement>;
|
|
250
250
|
selected?: boolean;
|
|
251
251
|
}
|
|
252
|
-
|
|
252
|
+
/**
|
|
253
|
+
* Horizontal alignment of a header or body cell. Typed so a misspelling like
|
|
254
|
+
* `"centre"` fails the build instead of silently rendering unaligned — passing
|
|
255
|
+
* `data-align` through the prop spread still works for existing call sites.
|
|
256
|
+
*/
|
|
257
|
+
export type TableAlign = "start" | "center" | "end";
|
|
258
|
+
type TableColumnHeaderProps = Omit<ComponentPropsWithoutRef<"th">, "align"> & {
|
|
253
259
|
ref?: RefObject<HTMLTableCellElement>;
|
|
254
260
|
numeric?: boolean;
|
|
255
|
-
|
|
256
|
-
|
|
261
|
+
align?: TableAlign;
|
|
262
|
+
};
|
|
263
|
+
type TableCellProps = Omit<ComponentPropsWithoutRef<"td">, "align"> & {
|
|
257
264
|
ref?: RefObject<HTMLTableCellElement>;
|
|
258
265
|
numeric?: boolean;
|
|
259
|
-
|
|
266
|
+
align?: TableAlign;
|
|
267
|
+
};
|
|
260
268
|
export {};
|
|
261
269
|
//# sourceMappingURL=table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/organisms/table.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,KAAK,wBAAwB,EAE7B,KAAK,SAAS,EAEf,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAGrD,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/organisms/table.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,KAAK,wBAAwB,EAE7B,KAAK,SAAS,EAEf,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAGrD,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAmGjB,CAAA;AAyBF,UAAU,UACR,SAAQ,YAAY,CAAC,OAAO,aAAa,CAAC,EACxC,wBAAwB,CAAC,OAAO,CAAC;IACnC,GAAG,CAAC,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAA;CAClC;AAED,wBAAgB,KAAK,CAAC,EACpB,OAAO,EACP,IAAI,EACJ,WAA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,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,GAAG;IACpE,GAAG,CAAC,EAAE,SAAS,CAAC,oBAAoB,CAAC,CAAA;IACrC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,UAAU,CAAA;CACnB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changelog.stories.d.ts","sourceRoot":"","sources":["../../../stories/changelog/changelog.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"changelog.stories.d.ts","sourceRoot":"","sources":["../../../stories/changelog/changelog.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAiKtD,iBAAS,SAAS,4CAUjB;AAED,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,SAAS,CAKhC,CAAA;AAED,eAAe,IAAI,CAAA;AAEnB,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,OAAO,SAAS,CAAM,CAAA"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react";
|
|
2
|
+
import { type ComponentType } from "react";
|
|
3
|
+
import { type DataTableProps } from "../../src/organisms/data-table";
|
|
4
|
+
type Person = {
|
|
5
|
+
id: string;
|
|
6
|
+
firstName: string;
|
|
7
|
+
lastName: string;
|
|
8
|
+
email: string;
|
|
9
|
+
role: string;
|
|
10
|
+
status: "active" | "invited" | "suspended";
|
|
11
|
+
age: number;
|
|
12
|
+
visits: number;
|
|
13
|
+
};
|
|
14
|
+
declare const meta: {
|
|
15
|
+
title: string;
|
|
16
|
+
component: ComponentType<DataTableProps<Person>>;
|
|
17
|
+
parameters: {
|
|
18
|
+
layout: string;
|
|
19
|
+
};
|
|
20
|
+
tags: string[];
|
|
21
|
+
argTypes: {
|
|
22
|
+
variant: {
|
|
23
|
+
control: "select";
|
|
24
|
+
options: string[];
|
|
25
|
+
};
|
|
26
|
+
size: {
|
|
27
|
+
control: "select";
|
|
28
|
+
options: string[];
|
|
29
|
+
};
|
|
30
|
+
stickyHeader: {
|
|
31
|
+
control: "boolean";
|
|
32
|
+
};
|
|
33
|
+
striped: {
|
|
34
|
+
control: "boolean";
|
|
35
|
+
};
|
|
36
|
+
hideHeader: {
|
|
37
|
+
control: "boolean";
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export default meta;
|
|
42
|
+
type Story = StoryObj<DataTableProps<Person>>;
|
|
43
|
+
export declare const Playground: Story;
|
|
44
|
+
export declare const Sorting: Story;
|
|
45
|
+
export declare const ColumnFiltersWithConditions: Story;
|
|
46
|
+
export declare const HeaderFilterTemplate: Story;
|
|
47
|
+
export declare const GlobalSearch: Story;
|
|
48
|
+
export declare const ToolbarActions: Story;
|
|
49
|
+
/**
|
|
50
|
+
* Toolbar actions on their own, with no global search and no column-visibility
|
|
51
|
+
* cog. The toolbar has to render for these alone — it used to be gated on the
|
|
52
|
+
* other two, so a table configured this way silently dropped its actions.
|
|
53
|
+
*/
|
|
54
|
+
export declare const ToolbarActionsOnly: Story;
|
|
55
|
+
export declare const EmptyState: Story;
|
|
56
|
+
export declare const RowActions: Story;
|
|
57
|
+
export declare const ColumnWidthsAndAlignment: Story;
|
|
58
|
+
/**
|
|
59
|
+
* A numeric `meta.width` must also reach TanStack's size model, otherwise the
|
|
60
|
+
* sticky offset of the next pinned column is computed from the default 150 and
|
|
61
|
+
* the frozen block drifts out of alignment.
|
|
62
|
+
*/
|
|
63
|
+
export declare const FrozenColumnWidths: Story;
|
|
64
|
+
export declare const FrozenColumns: Story;
|
|
65
|
+
export declare const StickyHeader: Story;
|
|
66
|
+
/**
|
|
67
|
+
* Grouped headers stack two label rows above the filter row. Each row needs its
|
|
68
|
+
* own sticky offset — `Table.ColumnHeader` sticks them all at `top: 0` by
|
|
69
|
+
* default, which piles them on top of each other — and the filter row has to
|
|
70
|
+
* clear both. Scroll the body to check nothing overlaps.
|
|
71
|
+
*/
|
|
72
|
+
export declare const GroupedStickyHeader: Story;
|
|
73
|
+
export declare const HiddenHeader: Story;
|
|
74
|
+
export declare const StripedRows: Story;
|
|
75
|
+
export declare const StripedOutlined: Story;
|
|
76
|
+
export declare const InfiniteScrollVirtualized: Story;
|
|
77
|
+
/**
|
|
78
|
+
* Without `maxHeight`, `onReachEnd` watches the *page* scroll instead of an
|
|
79
|
+
* internal container. A second, unrelated effect used to force-measure the
|
|
80
|
+
* (always unbounded, so always "at the bottom") scroll container on every
|
|
81
|
+
* appended page — re-arming the "already reported" latch the instant new rows
|
|
82
|
+
* landed, regardless of where the page had actually scrolled to. On a fast,
|
|
83
|
+
* continuous scroll (no incidental upward wobble to reset it first) the next
|
|
84
|
+
* real reach-end went silently missing. Both existing infinite-scroll stories
|
|
85
|
+
* set `maxHeight`, which is exactly why this went unnoticed.
|
|
86
|
+
*/
|
|
87
|
+
export declare const WindowScrollInfiniteLoad: Story;
|
|
88
|
+
/**
|
|
89
|
+
* `enableVirtualization` without `maxHeight` has no bounded scroll container
|
|
90
|
+
* to measure, so windowing falls back to rendering every row — this asserts
|
|
91
|
+
* that fallback rather than a truncated table. Check the browser console for
|
|
92
|
+
* the accompanying dev warning.
|
|
93
|
+
*/
|
|
94
|
+
export declare const VirtualizationWithoutMaxHeight: Story;
|
|
95
|
+
export declare const ColSpanRowSpan: Story;
|
|
96
|
+
export declare const RowClick: Story;
|
|
97
|
+
export declare const RowSelection: Story;
|
|
98
|
+
export declare const ColumnReorder: Story;
|
|
99
|
+
export declare const RowReorder: Story;
|
|
100
|
+
export declare const ColumnVisibility: Story;
|
|
101
|
+
export declare const CustomCellTemplate: Story;
|
|
102
|
+
export declare const TreeStructure: Story;
|
|
103
|
+
export declare const TreeStructureTinted: Story;
|
|
104
|
+
export declare const ExpandedRowDetail: Story;
|
|
105
|
+
export declare const InlineEdit: Story;
|
|
106
|
+
export declare const InlineEditCancel: Story;
|
|
107
|
+
export declare const InlineEditCustomCell: Story;
|
|
108
|
+
export declare const Pagination: Story;
|
|
109
|
+
type Employee = {
|
|
110
|
+
id: string;
|
|
111
|
+
name: string;
|
|
112
|
+
department: string;
|
|
113
|
+
skills: string[];
|
|
114
|
+
active: boolean;
|
|
115
|
+
salary: number;
|
|
116
|
+
startDate: string;
|
|
117
|
+
shiftStart: string;
|
|
118
|
+
};
|
|
119
|
+
/** The Employee stories are typed against their own row shape rather than
|
|
120
|
+
* being cast through `Person`, so a `meta` that does not match the column-meta
|
|
121
|
+
* contract this component introduces fails the build. */
|
|
122
|
+
type EmployeeStory = StoryObj<DataTableProps<Employee>>;
|
|
123
|
+
export declare const TypedColumnFilters: EmployeeStory;
|
|
124
|
+
/**
|
|
125
|
+
* A column declaring only the deprecated `meta.filterVariant` — no
|
|
126
|
+
* `meta.type`, no explicit `filterFn` — is what `applyColumnDefaults` and
|
|
127
|
+
* `resolveColumnType` exist to keep working: the default `filterFn: "typed"`
|
|
128
|
+
* and the number control both have to resolve the same type from
|
|
129
|
+
* `filterVariant` alone, or the control writes an operator object the
|
|
130
|
+
* matcher reads as plain text.
|
|
131
|
+
*/
|
|
132
|
+
export declare const DeprecatedFilterVariant: Story;
|
|
133
|
+
export declare const CustomFilterTemplate: EmployeeStory;
|
|
134
|
+
export declare const InlineEditByColumnType: EmployeeStory;
|
|
135
|
+
export declare const EditModeLocksInteractions: EmployeeStory;
|
|
136
|
+
export declare const SizeSynchronised: EmployeeStory;
|
|
137
|
+
export declare const SingleRowSelection: Story;
|
|
138
|
+
export declare const MaxTwoRowsSelectable: Story;
|
|
139
|
+
export declare const ConditionalRowSelection: Story;
|
|
140
|
+
export declare const PerRowActionPermissions: Story;
|
|
141
|
+
export declare const LoadingSkeletons: Story;
|
|
142
|
+
export declare const LoadingMore: Story;
|
|
143
|
+
export declare const DragAffordances: Story;
|
|
144
|
+
export declare const AccessibleSemantics: Story;
|
|
145
|
+
//# sourceMappingURL=data-table.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-table.stories.d.ts","sourceRoot":"","sources":["../../../stories/organisms/data-table.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,KAAK,aAAa,EAAY,MAAM,OAAO,CAAA;AAMpD,OAAO,EAOL,KAAK,cAAc,EACpB,MAAM,gCAAgC,CAAA;AAUvC,KAAK,MAAM,GAAG;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,WAAW,CAAA;IAC1C,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAoFD,QAAA,MAAM,IAAI;;eAEgB,aAAa,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;CAUvB,CAAA;AAExC,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAA;AAM7C,eAAO,MAAM,UAAU,EAAE,KAcxB,CAAA;AAID,eAAO,MAAM,OAAO,EAAE,KAOrB,CAAA;AAID,eAAO,MAAM,2BAA2B,EAAE,KAQzC,CAAA;AAID,eAAO,MAAM,oBAAoB,EAAE,KAsBlC,CAAA;AAID,eAAO,MAAM,YAAY,EAAE,KAO1B,CAAA;AAID,eAAO,MAAM,cAAc,EAAE,KA6C5B,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAmBhC,CAAA;AAID,eAAO,MAAM,UAAU,EAAE,KAkBxB,CAA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QAAQ,GAAG;IACd,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,MAAM,EAAE,OAAO,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AA6ED;;yDAEyD;AACzD,KAAK,aAAa,GAAG,QAAQ,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAA;AAOvD,eAAO,MAAM,kBAAkB,EAAE,aAchC,CAAA;AAID;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,EAAE,KA0BrC,CAAA;AAID,eAAO,MAAM,oBAAoB,EAAE,aA2DlC,CAAA;AAID,eAAO,MAAM,sBAAsB,EAAE,aAmBpC,CAAA;AAID,eAAO,MAAM,yBAAyB,EAAE,aAoBvC,CAAA;AAID,eAAO,MAAM,gBAAgB,EAAE,aAU9B,CAAA;AAID,eAAO,MAAM,kBAAkB,EAAE,KAgBhC,CAAA;AAID,eAAO,MAAM,oBAAoB,EAAE,KAmBlC,CAAA;AAID,eAAO,MAAM,uBAAuB,EAAE,KAarC,CAAA;AAOD,eAAO,MAAM,uBAAuB,EAAE,KAwCrC,CAAA;AAID,eAAO,MAAM,gBAAgB,EAAE,KAQ9B,CAAA;AAID,eAAO,MAAM,WAAW,EAAE,KAQzB,CAAA;AAID,eAAO,MAAM,eAAe,EAAE,KAkB7B,CAAA;AAID,eAAO,MAAM,mBAAmB,EAAE,KA4BjC,CAAA"}
|
|
@@ -53,4 +53,11 @@ export declare const CaptionBottom: Story;
|
|
|
53
53
|
export declare const WithStickyColumn: Story;
|
|
54
54
|
export declare const WithSelection: Story;
|
|
55
55
|
export declare const WithSelectionAndActions: Story;
|
|
56
|
+
/**
|
|
57
|
+
* Per-cell horizontal alignment via `data-align` (`start | center | end`).
|
|
58
|
+
* Unlike `numeric` — which says "this value is a number" — `data-align` is a
|
|
59
|
+
* pure presentation choice, so an icon or boolean column can be centred without
|
|
60
|
+
* claiming to be numeric.
|
|
61
|
+
*/
|
|
62
|
+
export declare const Alignment: Story;
|
|
56
63
|
//# sourceMappingURL=table.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.stories.d.ts","sourceRoot":"","sources":["../../../stories/organisms/table.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAEtD,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AAKjD,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCoB,CAAA;AAE9B,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA;AA2ClC,eAAO,MAAM,KAAK,EAAE,KA4BnB,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,KA4BrB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAgCzB,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,KA4BrB,CAAA;AAID,eAAO,MAAM,KAAK,EAAE,KAiCnB,CAAA;AAKD,eAAO,MAAM,UAAU,EAAE,KA8CxB,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KA0C1B,CAAA;AAID,eAAO,MAAM,YAAY,EAAE,KA0E1B,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KAmB1B,CAAA;AAID,eAAO,MAAM,iBAAiB,EAAE,KA6B/B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KA2B3B,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KA4C9B,CAAA;AAID,eAAO,MAAM,aAAa,EAAE,KAmF3B,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,KAyGrC,CAAA"}
|
|
1
|
+
{"version":3,"file":"table.stories.d.ts","sourceRoot":"","sources":["../../../stories/organisms/table.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAEtD,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AAKjD,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCoB,CAAA;AAE9B,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA;AA2ClC,eAAO,MAAM,KAAK,EAAE,KA4BnB,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,KA4BrB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAgCzB,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,KA4BrB,CAAA;AAID,eAAO,MAAM,KAAK,EAAE,KAiCnB,CAAA;AAKD,eAAO,MAAM,UAAU,EAAE,KA8CxB,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KA0C1B,CAAA;AAID,eAAO,MAAM,YAAY,EAAE,KA0E1B,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KAmB1B,CAAA;AAID,eAAO,MAAM,iBAAiB,EAAE,KA6B/B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KA2B3B,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KA4C9B,CAAA;AAID,eAAO,MAAM,aAAa,EAAE,KAmF3B,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,KAyGrC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,SAAS,EAAE,KA6BvB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@techsio/ui-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -78,10 +78,16 @@
|
|
|
78
78
|
"semantic-release": "semantic-release"
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
|
+
"@dnd-kit/core": "^6.3.1",
|
|
82
|
+
"@dnd-kit/modifiers": "^9.0.0",
|
|
83
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
84
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
81
85
|
"@iconify-json/mdi": "^1.2.3",
|
|
82
86
|
"@iconify-json/mdi-light": "^1.2.2",
|
|
83
87
|
"@iconify-json/svg-spinners": "^1.2.4",
|
|
84
88
|
"@iconify/tailwind4": "^1.1.0",
|
|
89
|
+
"@tanstack/react-table": "^9.1.2",
|
|
90
|
+
"@tanstack/react-virtual": "^3.14.8",
|
|
85
91
|
"@zag-js/accordion": "^1.41.2",
|
|
86
92
|
"@zag-js/carousel": "^1.41.2",
|
|
87
93
|
"@zag-js/checkbox": "^1.41.2",
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* DataTable — nested-row tint.
|
|
3
|
+
*
|
|
4
|
+
* `tintNestedRows` shades a row by `row.depth` as an inset box-shadow rather
|
|
5
|
+
* than a background, so it composes with `striped`'s zebra background instead
|
|
6
|
+
* of losing the Tailwind-merge conflict against it (two `bg-*` utilities on
|
|
7
|
+
* one element can't both render; a shadow layers on top of whichever
|
|
8
|
+
* background is already there). Reuses `--color-table-row-bg-hover`, an
|
|
9
|
+
* existing Figma-exported Table token, rather than a raw semantic token or a
|
|
10
|
+
* new one added ahead of the Figma sync this component's other colors are
|
|
11
|
+
* still waiting on (see the "PROTOTYPE styling" note in data-table.tsx).
|
|
12
|
+
*/
|
|
13
|
+
/*
|
|
14
|
+
* Verified: box-shadow on a `<tr>` *does* paint under `border-collapse` in
|
|
15
|
+
* Blink (Chromium 149) — a differential screenshot of a plain vs tinted row in
|
|
16
|
+
* a collapsed table measures 255,255,255 vs 178,178,178. This has been
|
|
17
|
+
* reported several times as a no-op; it is not one in Chrome. Not verified in
|
|
18
|
+
* WebKit/Safari, so if the tint is ever confirmed missing there, the fix is a
|
|
19
|
+
* `background-image` gradient layer (as `data-table-frozen-cell` uses), which
|
|
20
|
+
* composes with `striped` without the Tailwind-merge conflict a `background`
|
|
21
|
+
* would cause.
|
|
22
|
+
*/
|
|
23
|
+
@utility data-table-row-nested-tint {
|
|
24
|
+
box-shadow: inset 0 0 0 9999px var(--color-table-row-bg-hover);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/*
|
|
28
|
+
* DataTable — frozen (pinned / sticky-actions) cell surface.
|
|
29
|
+
*
|
|
30
|
+
* A frozen cell must be opaque, or the horizontally-scrolled content passes
|
|
31
|
+
* straight under it. It must *also* show the row's own colour, or striping and
|
|
32
|
+
* selection stop dead at the frozen column.
|
|
33
|
+
*
|
|
34
|
+
* `background: inherit` gives the second without the first: every row-level
|
|
35
|
+
* tint in this system is an alpha overlay meant to composite over a surface
|
|
36
|
+
* (`--color-table-row-striped-secondary` is literally `oklch(0 0 0 / 0)`), so
|
|
37
|
+
* inheriting it yields a see-through cell.
|
|
38
|
+
*
|
|
39
|
+
* Compositing solves both at once — the same trick `OPAQUE_HEADER_BG` uses for
|
|
40
|
+
* the header. The opaque table surface is the background-*color*; the row tint
|
|
41
|
+
* is painted over it as a gradient image, read from a custom property the row
|
|
42
|
+
* sets. Custom properties inherit, so the row can drive its cells' tint
|
|
43
|
+
* without either knowing about the other.
|
|
44
|
+
*/
|
|
45
|
+
@utility data-table-frozen-cell {
|
|
46
|
+
background-color: var(--color-table-bg);
|
|
47
|
+
background-image: linear-gradient(
|
|
48
|
+
var(--dt-row-tint, transparent),
|
|
49
|
+
var(--dt-row-tint, transparent)
|
|
50
|
+
);
|
|
51
|
+
}
|