@rovula/ui 0.1.28 → 0.1.30
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/cjs/bundle.css +522 -67
- package/dist/cjs/bundle.js +589 -589
- package/dist/cjs/bundle.js.map +1 -1
- package/dist/cjs/types/components/DataTable/DataTable.d.ts +195 -4
- package/dist/cjs/types/components/DataTable/DataTable.editing.d.ts +20 -0
- package/dist/cjs/types/components/DataTable/DataTable.editing.types.d.ts +145 -0
- package/dist/cjs/types/components/DataTable/DataTable.stories.d.ts +294 -6
- package/dist/cjs/types/components/Dropdown/Dropdown.d.ts +22 -0
- package/dist/cjs/types/components/Dropdown/Dropdown.stories.d.ts +4 -0
- package/dist/cjs/types/components/ScrollArea/ScrollArea.d.ts +3 -3
- package/dist/cjs/types/components/ScrollArea/ScrollArea.stories.d.ts +4 -0
- package/dist/cjs/types/components/Table/Table.d.ts +33 -3
- package/dist/cjs/types/components/Table/Table.stories.d.ts +86 -4
- package/dist/cjs/types/components/TextInput/TextInput.stories.d.ts +8 -0
- package/dist/cjs/types/components/TextInput/TextInput.styles.d.ts +1 -0
- package/dist/components/DataTable/DataTable.editing.js +385 -0
- package/dist/components/DataTable/DataTable.editing.types.js +1 -0
- package/dist/components/DataTable/DataTable.js +993 -50
- package/dist/components/DataTable/DataTable.stories.js +1137 -25
- package/dist/components/Dropdown/Dropdown.js +8 -6
- package/dist/components/ScrollArea/ScrollArea.js +2 -2
- package/dist/components/ScrollArea/ScrollArea.stories.js +68 -2
- package/dist/components/Table/Table.js +103 -13
- package/dist/components/Table/Table.stories.js +226 -9
- package/dist/components/TextInput/TextInput.js +6 -4
- package/dist/components/TextInput/TextInput.stories.js +8 -0
- package/dist/components/TextInput/TextInput.styles.js +7 -1
- package/dist/esm/bundle.css +522 -67
- package/dist/esm/bundle.js +1545 -1545
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/types/components/DataTable/DataTable.d.ts +195 -4
- package/dist/esm/types/components/DataTable/DataTable.editing.d.ts +20 -0
- package/dist/esm/types/components/DataTable/DataTable.editing.types.d.ts +145 -0
- package/dist/esm/types/components/DataTable/DataTable.stories.d.ts +294 -6
- package/dist/esm/types/components/Dropdown/Dropdown.d.ts +22 -0
- package/dist/esm/types/components/Dropdown/Dropdown.stories.d.ts +4 -0
- package/dist/esm/types/components/ScrollArea/ScrollArea.d.ts +3 -3
- package/dist/esm/types/components/ScrollArea/ScrollArea.stories.d.ts +4 -0
- package/dist/esm/types/components/Table/Table.d.ts +33 -3
- package/dist/esm/types/components/Table/Table.stories.d.ts +86 -4
- package/dist/esm/types/components/TextInput/TextInput.stories.d.ts +8 -0
- package/dist/esm/types/components/TextInput/TextInput.styles.d.ts +1 -0
- package/dist/index.d.ts +493 -122
- package/dist/src/theme/global.css +775 -96
- package/package.json +14 -2
- package/src/components/DataTable/DataTable.editing.tsx +861 -0
- package/src/components/DataTable/DataTable.editing.types.ts +192 -0
- package/src/components/DataTable/DataTable.stories.tsx +2310 -31
- package/src/components/DataTable/DataTable.test.tsx +696 -0
- package/src/components/DataTable/DataTable.tsx +2275 -94
- package/src/components/Dropdown/Dropdown.tsx +22 -6
- package/src/components/ScrollArea/ScrollArea.stories.tsx +146 -3
- package/src/components/ScrollArea/ScrollArea.tsx +6 -6
- package/src/components/Table/Table.stories.tsx +789 -44
- package/src/components/Table/Table.tsx +306 -28
- package/src/components/TextInput/TextInput.stories.tsx +80 -0
- package/src/components/TextInput/TextInput.styles.ts +7 -1
- package/src/components/TextInput/TextInput.tsx +21 -14
- package/src/test/setup.ts +50 -0
- package/src/theme/global.css +81 -42
- package/src/theme/presets/colors.js +12 -0
- package/src/theme/themes/variable.css +27 -28
- package/src/theme/tokens/baseline.css +2 -1
- package/src/theme/tokens/components/scrollbar.css +9 -4
- package/src/theme/tokens/components/table.css +63 -0
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { StoryObj } from "@storybook/react";
|
|
3
|
+
import { ColumnDef, Row } from "@tanstack/react-table";
|
|
1
4
|
import { DataTable } from "./DataTable";
|
|
2
|
-
import {
|
|
5
|
+
import type { EditableColumnDef } from "./DataTable.editing.types";
|
|
3
6
|
declare const meta: {
|
|
4
7
|
title: string;
|
|
5
8
|
component: typeof DataTable;
|
|
@@ -7,16 +10,301 @@ declare const meta: {
|
|
|
7
10
|
parameters: {
|
|
8
11
|
layout: string;
|
|
9
12
|
};
|
|
13
|
+
argTypes: {
|
|
14
|
+
bordered: {
|
|
15
|
+
control: "boolean";
|
|
16
|
+
};
|
|
17
|
+
surface: {
|
|
18
|
+
control: "radio";
|
|
19
|
+
options: string[];
|
|
20
|
+
};
|
|
21
|
+
divided: {
|
|
22
|
+
control: "boolean";
|
|
23
|
+
};
|
|
24
|
+
striped: {
|
|
25
|
+
control: "boolean";
|
|
26
|
+
};
|
|
27
|
+
fetchingMore: {
|
|
28
|
+
control: "boolean";
|
|
29
|
+
};
|
|
30
|
+
loading: {
|
|
31
|
+
control: "boolean";
|
|
32
|
+
};
|
|
33
|
+
};
|
|
10
34
|
decorators: ((Story: import("@storybook/csf").PartialStoryFn<import("@storybook/react").ReactRenderer, {
|
|
11
|
-
columns: ColumnDef<unknown, unknown>[];
|
|
35
|
+
columns: (ColumnDef<unknown, unknown> | EditableColumnDef<unknown, unknown>)[];
|
|
12
36
|
data: unknown[];
|
|
13
37
|
manualSorting?: boolean | undefined;
|
|
14
38
|
onSorting?: ((sorting: import("@tanstack/react-table").SortingState) => void) | undefined;
|
|
39
|
+
paginationMode?: import("./DataTable").DataTablePaginationMode | undefined;
|
|
40
|
+
totalCount?: number | undefined;
|
|
41
|
+
pageIndex?: number | undefined;
|
|
42
|
+
pageSize?: number | undefined;
|
|
43
|
+
onPaginationChange?: ((state: import("@tanstack/react-table").PaginationState) => void) | undefined;
|
|
44
|
+
pageSizeOptions?: number[] | undefined;
|
|
15
45
|
fetchMoreData?: (() => void) | undefined;
|
|
46
|
+
fetchMoreOffset?: number | undefined;
|
|
47
|
+
fetchingMore?: boolean | undefined;
|
|
48
|
+
fetchingMoreLabel?: string | undefined;
|
|
49
|
+
loading?: boolean | undefined;
|
|
50
|
+
loadingLabel?: string | undefined;
|
|
51
|
+
virtualized?: boolean | undefined;
|
|
52
|
+
virtualRowEstimate?: number | undefined;
|
|
53
|
+
highlightRowId?: string | string[] | undefined;
|
|
54
|
+
scrollToHighlightOnMouseLeave?: boolean | undefined;
|
|
55
|
+
selectable?: boolean | undefined;
|
|
56
|
+
onRowSelectionChange?: ((rows: import("@tanstack/react-table").RowSelectionState) => void) | undefined;
|
|
57
|
+
rowActions?: ((row: Row<unknown>) => React.ReactNode) | undefined;
|
|
58
|
+
reorderable?: boolean | undefined;
|
|
59
|
+
getRowId?: ((row: unknown) => string) | undefined;
|
|
60
|
+
onRowReorder?: ((data: unknown[]) => void) | undefined;
|
|
61
|
+
isRowReorderLocked?: ((row: Row<unknown>) => boolean) | undefined;
|
|
62
|
+
onRowClick?: ((row: Row<unknown>, event: React.MouseEvent) => void) | undefined;
|
|
63
|
+
onCellClick?: ((cell: import("@tanstack/react-table").Cell<unknown, unknown>, row: Row<unknown>, event: React.MouseEvent) => void) | undefined;
|
|
64
|
+
getSubRows?: ((row: unknown) => unknown[] | undefined) | undefined;
|
|
65
|
+
defaultExpanded?: (import("@tanstack/react-table").ExpandedState | boolean) | undefined;
|
|
66
|
+
expanded?: import("@tanstack/react-table").ExpandedState | undefined;
|
|
67
|
+
onExpandedChange?: ((expanded: import("@tanstack/react-table").ExpandedState) => void) | undefined;
|
|
68
|
+
bordered?: boolean | undefined;
|
|
69
|
+
surface?: "default" | "panel" | undefined;
|
|
70
|
+
striped?: boolean | undefined;
|
|
71
|
+
divided?: boolean | undefined;
|
|
72
|
+
rowClassName?: string | ((row: Row<unknown>, index: number) => string | undefined) | undefined;
|
|
73
|
+
cellClassName?: string | ((cell: import("@tanstack/react-table").Cell<unknown, unknown>, row: Row<unknown>) => string | undefined) | undefined;
|
|
74
|
+
headerCellClassName?: string | ((header: import("@tanstack/react-table").Header<unknown, unknown>) => string | undefined) | undefined;
|
|
75
|
+
headerClassName?: string | undefined;
|
|
76
|
+
headerRowClassName?: string | undefined;
|
|
77
|
+
sortIndicatorVisibility?: "always" | "hover" | undefined;
|
|
78
|
+
tableLayout?: "auto" | "fixed" | "equal" | undefined;
|
|
79
|
+
columnManagement?: (boolean | import("./DataTable").ColumnManagementOptions) | undefined;
|
|
80
|
+
resizable?: boolean | undefined;
|
|
81
|
+
columnMinSize?: number | undefined;
|
|
82
|
+
columnMaxSize?: number | undefined;
|
|
83
|
+
className?: string | undefined;
|
|
84
|
+
testId?: string | undefined;
|
|
85
|
+
enableEditing?: boolean | undefined;
|
|
86
|
+
editDisplayMode?: import("./DataTable.editing.types").EditDisplayMode | undefined;
|
|
87
|
+
editTrigger?: import("./DataTable.editing.types").EditTrigger | undefined;
|
|
88
|
+
onCellCommit?: ((rowId: string, columnId: string, patch: Partial<unknown>) => void) | undefined;
|
|
89
|
+
alwaysEditing?: ((row: Row<unknown>) => boolean) | undefined;
|
|
90
|
+
enableCellTabTraversal?: boolean | undefined;
|
|
91
|
+
editableColumnIds?: string[] | undefined;
|
|
16
92
|
}>) => import("react/jsx-runtime").JSX.Element)[];
|
|
17
93
|
};
|
|
18
94
|
export default meta;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
95
|
+
/** Default — striped rows + column dividers, all columns sortable. */
|
|
96
|
+
export declare const Default: StoryObj;
|
|
97
|
+
/**
|
|
98
|
+
* Matches the Figma "Projects" page design — striped alternating rows,
|
|
99
|
+
* column dividers, row actions (more + navigate), client pagination,
|
|
100
|
+
* and a rounded bordered frame.
|
|
101
|
+
*
|
|
102
|
+
* Design ref: Xspector-New / node 11786-14865
|
|
103
|
+
*/
|
|
104
|
+
export declare const FigmaProjectsPage: StoryObj;
|
|
105
|
+
/** Empty state — displayed when `data` is an empty array. */
|
|
106
|
+
export declare const Empty: StoryObj;
|
|
107
|
+
/** Non-striped with column dividers only. */
|
|
108
|
+
export declare const Divided: StoryObj;
|
|
109
|
+
/**
|
|
110
|
+
* DataTable inside a panel — matches modal spec: horizontal row separators only
|
|
111
|
+
* (no vertical column rules), compact height without a stretched empty body.
|
|
112
|
+
*/
|
|
113
|
+
export declare const OnPanelSurface: StoryObj;
|
|
114
|
+
/** Panel + client pagination — footer sits in the same surface scope as the table body. */
|
|
115
|
+
export declare const OnPanelSurfaceWithPagination: StoryObj;
|
|
116
|
+
/** Client-side pagination — DataTable manages page index & size internally. */
|
|
117
|
+
export declare const WithClientPagination: StoryObj;
|
|
118
|
+
/**
|
|
119
|
+
* Server-side pagination — the caller controls `pageIndex` / `pageSize` and
|
|
120
|
+
* slices data accordingly. `totalCount` drives the page-count calculation.
|
|
121
|
+
*/
|
|
122
|
+
export declare const WithServerPagination: StoryObj;
|
|
123
|
+
/**
|
|
124
|
+
* Infinite mode (default) — no pagination bar; the table body scrolls inside a
|
|
125
|
+
* fixed height. Use when the caller already passes the full (or windowed) dataset.
|
|
126
|
+
*/
|
|
127
|
+
export declare const WithInfiniteScrollStatic: StoryObj;
|
|
128
|
+
/**
|
|
129
|
+
* Infinite scroll + load more — DataTable calls{" "}
|
|
130
|
+
* <code className="typography-mono">fetchMoreData</code> when the scroll position
|
|
131
|
+
* is within 10px of the bottom (see <code className="typography-mono">DataTable</code>{" "}
|
|
132
|
+
* <code className="typography-mono">useEffect</code> on <code className="typography-mono">scrollRef</code>).
|
|
133
|
+
* This story simulates an async page append.
|
|
134
|
+
*/
|
|
135
|
+
export declare const WithInfiniteScrollLoadMore: StoryObj;
|
|
136
|
+
/**
|
|
137
|
+
* Initial load — pass `loading={true}` with `data={[]}` until the first page
|
|
138
|
+
* arrives; then set `loading={false}` and pass rows. Infinite `fetchMoreData`
|
|
139
|
+
* does not run while `loading` is true.
|
|
140
|
+
*/
|
|
141
|
+
export declare const WithInfiniteScrollInitialLoading: StoryObj;
|
|
142
|
+
/**
|
|
143
|
+
* **What this library does *not* do:** `DataTable` has **no built-in row
|
|
144
|
+
* virtualization** — every row in `data` is rendered in the DOM (TanStack
|
|
145
|
+
* `getRowModel`). Very large `data.length` will cost more paint/layout work.
|
|
146
|
+
*
|
|
147
|
+
* **What to use instead:**
|
|
148
|
+
* - `paginationMode="client"` or `"server"` to cap rows per page
|
|
149
|
+
* - `paginationMode="infinite"` + `fetchMoreData` and **slice/window data in the parent**
|
|
150
|
+
* - Or wrap your own virtualizer (e.g. `@tanstack/react-virtual`) if you need
|
|
151
|
+
* millions of rows in one scroll view
|
|
152
|
+
*
|
|
153
|
+
* This story mounts **800** synthetic rows so you can feel scroll/render cost
|
|
154
|
+
* in Storybook (dev builds are slower than production).
|
|
155
|
+
*/
|
|
156
|
+
export declare const PerformanceLargeDataset: StoryObj;
|
|
157
|
+
/**
|
|
158
|
+
* Built-in **`virtualized`** — only a vertical window of rows is mounted; the
|
|
159
|
+
* rest are represented by spacer rows. Tune **`virtualRowEstimate`** (px) to
|
|
160
|
+
* match your row height so scroll position stays aligned.
|
|
161
|
+
*
|
|
162
|
+
* Limitations: fixed-height assumption; incompatible with **`reorderable`** in
|
|
163
|
+
* the virtualized path (use non-virtualized mode for drag-reorder).
|
|
164
|
+
*/
|
|
165
|
+
export declare const WithVirtualizedRows: StoryObj;
|
|
166
|
+
/** Checkbox selection — header checkbox selects all; row checkboxes select individually. */
|
|
167
|
+
export declare const WithSelection: StoryObj;
|
|
168
|
+
/**
|
|
169
|
+
* Row highlight + scroll — use `highlightRowId` to visually mark important rows
|
|
170
|
+
* (uses the same token as selected rows) and automatically scroll them into view.
|
|
171
|
+
*/
|
|
172
|
+
export declare const WithRowHighlightAndScroll: StoryObj;
|
|
173
|
+
/**
|
|
174
|
+
* Censor-style list — large, virtualized table where `highlightRowId` moves
|
|
175
|
+
* automatically over time (e.g. matching the latest event / time).
|
|
176
|
+
*/
|
|
177
|
+
export declare const WithVirtualizedCensorTimeline: StoryObj;
|
|
178
|
+
/** Fixed actions column at the far right — rendered via `rowActions` prop. */
|
|
179
|
+
export declare const WithRowActions: StoryObj;
|
|
180
|
+
/**
|
|
181
|
+
* Uncontrolled tree rows — `defaultExpanded={true}` opens all nodes on mount.
|
|
182
|
+
* The user can collapse/expand rows freely; state is managed internally.
|
|
183
|
+
*/
|
|
184
|
+
export declare const WithExpandableRows: StoryObj;
|
|
185
|
+
/**
|
|
186
|
+
* Controlled expand — the caller owns `expanded` state via `expanded` +
|
|
187
|
+
* `onExpandedChange`. Collapsing a row in the table calls `onExpandedChange`;
|
|
188
|
+
* if the parent doesn't update the state, the row "springs back" open.
|
|
189
|
+
*/
|
|
190
|
+
export declare const WithControlledExpand: StoryObj;
|
|
191
|
+
/**
|
|
192
|
+
* Column management panel — click ⋮ on any column header.
|
|
193
|
+
* - Toggle per-column visibility with the Switch
|
|
194
|
+
* - "Hide all" hides everything except one column
|
|
195
|
+
* - "Show all" restores all columns
|
|
196
|
+
* - Drag the ⠿ grip to reorder columns
|
|
197
|
+
*/
|
|
198
|
+
export declare const WithColumnManagement: StoryObj;
|
|
199
|
+
/**
|
|
200
|
+
* Column management with restricted options:
|
|
201
|
+
* - `reorder: false` — drag handle hidden, column order is fixed
|
|
202
|
+
* - `hideAll: false` — "Hide all" button removed
|
|
203
|
+
*
|
|
204
|
+
* Pass any subset of `ColumnManagementOptions` to tailor the panel.
|
|
205
|
+
*/
|
|
206
|
+
export declare const WithColumnManagementOptions: StoryObj;
|
|
207
|
+
/**
|
|
208
|
+
* Resizable columns — drag the right edge of any column header.
|
|
209
|
+
*
|
|
210
|
+
* Global bounds via `columnMinSize` / `columnMaxSize`.
|
|
211
|
+
* Per-column overrides in the column def (`minSize`, `maxSize`):
|
|
212
|
+
* - "Asset name": `minSize: 120`
|
|
213
|
+
* - "KPI (%)": `maxSize: 160`
|
|
214
|
+
*/
|
|
215
|
+
export declare const WithColumnResize: StoryObj;
|
|
216
|
+
/**
|
|
217
|
+
* All features combined:
|
|
218
|
+
* - Checkbox selection
|
|
219
|
+
* - Sortable columns
|
|
220
|
+
* - Client-side pagination
|
|
221
|
+
* - Column management (visibility + reorder)
|
|
222
|
+
* - Column resize
|
|
223
|
+
* - Row actions
|
|
224
|
+
*/
|
|
225
|
+
export declare const KitchenSink: StoryObj;
|
|
226
|
+
/**
|
|
227
|
+
* Drag-to-reorder rows — a grip handle is prepended automatically.
|
|
228
|
+
* `onRowReorder` fires with the new data array after a drop.
|
|
229
|
+
*/
|
|
230
|
+
export declare const WithRowReorder: StoryObj;
|
|
231
|
+
/** Row click — clicking any row fires `onRowClick`. Rows show `cursor-pointer`. */
|
|
232
|
+
export declare const WithRowClick: StoryObj;
|
|
233
|
+
/**
|
|
234
|
+
* Cell click — `onCellClick` fires for individual cells.
|
|
235
|
+
* Use `event.stopPropagation()` to prevent `onRowClick` from also firing.
|
|
236
|
+
*/
|
|
237
|
+
export declare const WithCellClick: StoryObj;
|
|
238
|
+
/**
|
|
239
|
+
* Sort indicator always visible — `sortIndicatorVisibility="always"` shows the
|
|
240
|
+
* sort icon on every sortable column, not just on hover.
|
|
241
|
+
*/
|
|
242
|
+
export declare const SortIndicatorAlwaysVisible: StoryObj;
|
|
243
|
+
/**
|
|
244
|
+
* Side-by-side comparison of `tableLayout="auto"` vs `"fixed"` vs `"equal"`.
|
|
245
|
+
*
|
|
246
|
+
* - **auto** — browser distributes width based on cell content; `size` is ignored.
|
|
247
|
+
* - **fixed** — `size` is used as px per column; the last non-exact column grows
|
|
248
|
+
* so the table stays full-width (here: Status absorbs the remainder).
|
|
249
|
+
* - **equal** — all columns without `meta.exactWidth` share the remaining width equally.
|
|
250
|
+
* With `resizable`, drag handles are off for this row so equal widths are preserved.
|
|
251
|
+
*/
|
|
252
|
+
export declare const TableLayoutComparison: StoryObj;
|
|
253
|
+
/**
|
|
254
|
+
* `rowClassName` and `cellClassName` let you style individual rows and cells
|
|
255
|
+
* based on their data.
|
|
256
|
+
*
|
|
257
|
+
* - Rows with status **"Completed"** get a green-tinted background.
|
|
258
|
+
* - Rows with status **"To do"** get a subtle white/opacity background.
|
|
259
|
+
* - The **"Status"** column cells are bold.
|
|
260
|
+
* - The **"Type"** cells for ROV are highlighted with an info tint.
|
|
261
|
+
*/
|
|
262
|
+
export declare const WithCustomRowAndCellClassName: StoryObj;
|
|
263
|
+
/**
|
|
264
|
+
* Showcase overriding header and body row heights via className props.
|
|
265
|
+
*
|
|
266
|
+
* The base `TableHead` uses `h-[44px] typography-body2` and `TableCell`
|
|
267
|
+
* uses `h-[42px] typography-body3`.
|
|
268
|
+
*
|
|
269
|
+
* `cn()` is configured with a custom `typography` class-group so
|
|
270
|
+
* `tailwind-merge` correctly deduplicates conflicting `typography-*`
|
|
271
|
+
* utilities (e.g. `typography-small2` replaces `typography-body2`).
|
|
272
|
+
*
|
|
273
|
+
* **Note:** `<th>` / `<td>` elements treat `height` as a minimum —
|
|
274
|
+
* to go smaller than the default, internal content (sort icon, badges)
|
|
275
|
+
* must also fit. Compact swaps to `typography-small2` (12px) text and
|
|
276
|
+
* reduces padding to reclaim space.
|
|
277
|
+
*
|
|
278
|
+
* Three sizes: **Compact**, **Default**, **Comfortable**.
|
|
279
|
+
*/
|
|
280
|
+
export declare const CustomRowAndHeaderSize: StoryObj;
|
|
281
|
+
/**
|
|
282
|
+
* Data management table — Figma **Xspector-New**:
|
|
283
|
+
* [full frame](https://www.figma.com/design/99rq6FbfPx6hgPS0VCvHJh/Xspector-New?node-id=11965-17125),
|
|
284
|
+
* [row / field spec](https://www.figma.com/design/99rq6FbfPx6hgPS0VCvHJh/Xspector-New?node-id=11965-17883).
|
|
285
|
+
*
|
|
286
|
+
* Uses the **DataTable editing API** (`enableEditing` + `editDisplayMode` +
|
|
287
|
+
* `editVariant` per column). Edit scope and trigger are toggleable via the
|
|
288
|
+
* toolbar at the top of the story.
|
|
289
|
+
*/
|
|
290
|
+
export declare const DataManagement: StoryObj;
|
|
291
|
+
/** Data Management — empty state when no columns have been configured yet. */
|
|
292
|
+
export declare const DataManagementEmpty: StoryObj;
|
|
293
|
+
/**
|
|
294
|
+
* **Editing Field Showcase** — demonstrates every editing feature:
|
|
295
|
+
*
|
|
296
|
+
* | Feature | Where |
|
|
297
|
+
* |---|---|
|
|
298
|
+
* | `editVariant: "text"` | Product name, Notes |
|
|
299
|
+
* | `editVariant: "select"` | Category |
|
|
300
|
+
* | `editVariant: "number"` | Quantity, Price |
|
|
301
|
+
* | `editVariant: "checkbox"` | Active |
|
|
302
|
+
* | `editVariant: "custom"` + `editCustomCell` | Priority (inline button picker → Badge display) |
|
|
303
|
+
* | `editError` | Name (required + min length), Category (required), Price (> 0) |
|
|
304
|
+
* | `displayCell` | Price (formatted), Active (badge), Notes (italic placeholder) |
|
|
305
|
+
* | `testId` | Root container has `data-testid="edit-showcase"` |
|
|
306
|
+
* | Row / Cell mode toggle | Toolbar radio buttons |
|
|
307
|
+
* | Click / Double-click trigger | Toolbar radio buttons |
|
|
308
|
+
* | Tab traversal | Tab/Shift+Tab moves between editable fields |
|
|
309
|
+
*/
|
|
310
|
+
export declare const EditingFieldShowcase: StoryObj;
|
|
@@ -41,6 +41,17 @@ export type DropdownProps = {
|
|
|
41
41
|
selectedOption: Options | null | undefined;
|
|
42
42
|
onClick: (option: Options) => void;
|
|
43
43
|
}) => ReactNode;
|
|
44
|
+
/**
|
|
45
|
+
* When `true`, keep focus on the input after selecting an option so the
|
|
46
|
+
* menu stays open (useful for inline row-editing where the user may Tab
|
|
47
|
+
* to the next field instead of closing the dropdown).
|
|
48
|
+
*/
|
|
49
|
+
keepOpenAfterSelect?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Render the options list via a React portal so it escapes containers
|
|
52
|
+
* with `overflow: hidden/auto` (e.g. DataTable scroll wrappers).
|
|
53
|
+
*/
|
|
54
|
+
portal?: boolean;
|
|
44
55
|
} & Omit<InputProps, "value" | "onSelect">;
|
|
45
56
|
declare const Dropdown: React.ForwardRefExoticComponent<{
|
|
46
57
|
id?: string;
|
|
@@ -71,5 +82,16 @@ declare const Dropdown: React.ForwardRefExoticComponent<{
|
|
|
71
82
|
selectedOption: Options | null | undefined;
|
|
72
83
|
onClick: (option: Options) => void;
|
|
73
84
|
}) => ReactNode;
|
|
85
|
+
/**
|
|
86
|
+
* When `true`, keep focus on the input after selecting an option so the
|
|
87
|
+
* menu stays open (useful for inline row-editing where the user may Tab
|
|
88
|
+
* to the next field instead of closing the dropdown).
|
|
89
|
+
*/
|
|
90
|
+
keepOpenAfterSelect?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Render the options list via a React portal so it escapes containers
|
|
93
|
+
* with `overflow: hidden/auto` (e.g. DataTable scroll wrappers).
|
|
94
|
+
*/
|
|
95
|
+
portal?: boolean;
|
|
74
96
|
} & Omit<InputProps, "onSelect" | "value"> & React.RefAttributes<HTMLInputElement>>;
|
|
75
97
|
export default Dropdown;
|
|
@@ -31,6 +31,8 @@ declare const meta: {
|
|
|
31
31
|
selectedOption: Options | null | undefined;
|
|
32
32
|
onClick: (option: Options) => void;
|
|
33
33
|
}) => React.ReactNode;
|
|
34
|
+
keepOpenAfterSelect?: boolean;
|
|
35
|
+
portal?: boolean;
|
|
34
36
|
} & Omit<import("../..").InputProps, "onSelect" | "value"> & React.RefAttributes<HTMLInputElement>>;
|
|
35
37
|
tags: string[];
|
|
36
38
|
parameters: {
|
|
@@ -64,6 +66,8 @@ declare const meta: {
|
|
|
64
66
|
selectedOption: Options | null | undefined;
|
|
65
67
|
onClick: (option: Options) => void;
|
|
66
68
|
}) => React.ReactNode) | undefined;
|
|
69
|
+
keepOpenAfterSelect?: boolean | undefined;
|
|
70
|
+
portal?: boolean | undefined;
|
|
67
71
|
suppressHydrationWarning?: boolean | undefined | undefined;
|
|
68
72
|
color?: string | undefined | undefined;
|
|
69
73
|
height?: number | string | undefined | undefined;
|
|
@@ -3,9 +3,9 @@ export type ScrollbarSize = "m" | "s" | "xs";
|
|
|
3
3
|
export interface ScrollAreaProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
/**
|
|
5
5
|
* Scrollbar thickness.
|
|
6
|
-
* - `m` — 12 px (shows track border)
|
|
7
|
-
* - `s` — 6 px (
|
|
8
|
-
* - `xs` — 2 px (
|
|
6
|
+
* - `m` — 12 px (default, shows track border + 2px thumb inset)
|
|
7
|
+
* - `s` — 6 px (shows track border + 2px thumb inset)
|
|
8
|
+
* - `xs` — 2 px (no track border, no thumb inset)
|
|
9
9
|
*/
|
|
10
10
|
scrollbarSize?: ScrollbarSize;
|
|
11
11
|
/**
|
|
@@ -2,12 +2,42 @@ import * as React from "react";
|
|
|
2
2
|
declare const Table: React.ForwardRefExoticComponent<{
|
|
3
3
|
rootClassName?: string;
|
|
4
4
|
rootRef?: React.LegacyRef<HTMLDivElement>;
|
|
5
|
+
/**
|
|
6
|
+
* Wraps the table in a rounded frame (`rounded-md` + `border-table-c-border`).
|
|
7
|
+
* Uses an outer `overflow-hidden` shell and an inner scroll area so corners clip
|
|
8
|
+
* cleanly (same pattern as scrollable bordered tables elsewhere in the system).
|
|
9
|
+
* For pagination in the same frame, wrap `Table` + `TablePagination` in your own
|
|
10
|
+
* bordered div instead of relying on this prop alone.
|
|
11
|
+
*/
|
|
12
|
+
bordered?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* When false, render only `<table>` (no inner `overflow-auto` wrapper).
|
|
15
|
+
* Use when a parent already provides the scrollport — e.g. `DataTable` — so
|
|
16
|
+
* `sticky` header rows stick to the correct ancestor.
|
|
17
|
+
* Ignored when `bordered` is true (bordered tables always use the inner scroll shell).
|
|
18
|
+
*/
|
|
19
|
+
scrollableWrapper?: boolean;
|
|
5
20
|
} & React.HTMLAttributes<HTMLTableElement> & React.RefAttributes<HTMLTableElement>>;
|
|
6
21
|
declare const TableHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
7
|
-
declare const TableBody: React.ForwardRefExoticComponent<
|
|
22
|
+
declare const TableBody: React.ForwardRefExoticComponent<{
|
|
23
|
+
striped?: boolean;
|
|
24
|
+
} & React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
8
25
|
declare const TableFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
9
|
-
declare const TableRow: React.ForwardRefExoticComponent<
|
|
26
|
+
declare const TableRow: React.ForwardRefExoticComponent<{
|
|
27
|
+
divided?: boolean;
|
|
28
|
+
colDivided?: boolean;
|
|
29
|
+
} & React.HTMLAttributes<HTMLTableRowElement> & React.RefAttributes<HTMLTableRowElement>>;
|
|
10
30
|
declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
11
31
|
declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
12
32
|
declare const TableCaption: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableCaptionElement> & React.RefAttributes<HTMLTableCaptionElement>>;
|
|
13
|
-
export
|
|
33
|
+
export interface TablePaginationProps {
|
|
34
|
+
pageIndex: number;
|
|
35
|
+
pageSize: number;
|
|
36
|
+
totalCount: number;
|
|
37
|
+
pageSizeOptions?: number[];
|
|
38
|
+
onPageChange: (pageIndex: number) => void;
|
|
39
|
+
onPageSizeChange: (pageSize: number) => void;
|
|
40
|
+
className?: string;
|
|
41
|
+
}
|
|
42
|
+
declare const TablePagination: React.ForwardRefExoticComponent<TablePaginationProps & React.RefAttributes<HTMLDivElement>>;
|
|
43
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, TablePagination, };
|
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import type { StoryObj } from "@storybook/react";
|
|
2
3
|
declare const meta: {
|
|
3
4
|
title: string;
|
|
4
5
|
component: React.ForwardRefExoticComponent<{
|
|
5
6
|
rootClassName?: string;
|
|
6
7
|
rootRef?: React.LegacyRef<HTMLDivElement>;
|
|
8
|
+
bordered?: boolean;
|
|
9
|
+
scrollableWrapper?: boolean;
|
|
7
10
|
} & React.HTMLAttributes<HTMLTableElement> & React.RefAttributes<HTMLTableElement>>;
|
|
8
11
|
tags: string[];
|
|
9
12
|
parameters: {
|
|
10
13
|
layout: string;
|
|
11
14
|
};
|
|
15
|
+
argTypes: {
|
|
16
|
+
bordered: {
|
|
17
|
+
control: "boolean";
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
12
21
|
decorators: ((Story: import("@storybook/csf").PartialStoryFn<import("@storybook/react").ReactRenderer, {
|
|
13
22
|
rootClassName?: string | undefined;
|
|
14
23
|
rootRef?: React.LegacyRef<HTMLDivElement> | undefined;
|
|
24
|
+
bordered?: boolean | undefined;
|
|
25
|
+
scrollableWrapper?: boolean | undefined;
|
|
15
26
|
defaultChecked?: boolean | undefined | undefined;
|
|
16
27
|
defaultValue?: string | number | readonly string[] | undefined;
|
|
17
28
|
suppressContentEditableWarning?: boolean | undefined | undefined;
|
|
@@ -283,7 +294,78 @@ declare const meta: {
|
|
|
283
294
|
}>) => import("react/jsx-runtime").JSX.Element)[];
|
|
284
295
|
};
|
|
285
296
|
export default meta;
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
297
|
+
/** NON-STRIPED — horizontal row strokes, no column dividers */
|
|
298
|
+
export declare const Default: StoryObj;
|
|
299
|
+
/** NON-STRIPED + COL DIVIDED — horizontal row strokes + vertical column dividers */
|
|
300
|
+
export declare const NonStripedDivided: StoryObj;
|
|
301
|
+
/** STRIPED — alternating bg-a / bg-b, NO row strokes, NO column dividers */
|
|
302
|
+
export declare const Striped: StoryObj;
|
|
303
|
+
/**
|
|
304
|
+
* STRIPED + COL DIVIDED — alternating bg, NO row strokes, WITH column dividers.
|
|
305
|
+
* Primary Xspector table style.
|
|
306
|
+
*/
|
|
307
|
+
export declare const StripedAndDivided: StoryObj;
|
|
308
|
+
/** SELECTED ROW — data-[state=selected] applies transparent-primary-12. Row 1 pre-selected. */
|
|
309
|
+
export declare const WithSelectedRow: StoryObj;
|
|
310
|
+
/**
|
|
311
|
+
* WITH FOOTER — tfoot summary row with bg-table-bg-main + top border.
|
|
312
|
+
* TableFooter is inside Table so bordered works naturally.
|
|
313
|
+
*/
|
|
314
|
+
export declare const WithFooter: StoryObj;
|
|
315
|
+
/**
|
|
316
|
+
* WITH PAGINATION — TablePagination is a sibling of Table so needs an explicit
|
|
317
|
+
* outer wrapper (not covered by Table's bordered prop).
|
|
318
|
+
*/
|
|
319
|
+
export declare const WithPagination: StoryObj;
|
|
320
|
+
/** EMPTY STATE — single full-width row with centered message */
|
|
321
|
+
export declare const Empty: StoryObj;
|
|
322
|
+
/** ALL STATES SIDE-BY-SIDE — reference sheet for design review */
|
|
323
|
+
export declare const AllStates: StoryObj;
|
|
324
|
+
/**
|
|
325
|
+
* WITH SCROLL (Figma 9637-10817)
|
|
326
|
+
*
|
|
327
|
+
* Demonstrates both axes of overflow:
|
|
328
|
+
* - Vertical: fixed-height container → body rows overflow and scroll vertically
|
|
329
|
+
* - Horizontal: 10 columns wider than the viewport → native h-scroll bar appears
|
|
330
|
+
*
|
|
331
|
+
* Implementation notes:
|
|
332
|
+
* - Outer div sets the fixed height and owns the rounded border
|
|
333
|
+
* (TablePagination must sit outside the scrollable Table)
|
|
334
|
+
* - Table gets rootClassName="flex-1 min-h-0" so it grows to fill flex space
|
|
335
|
+
* and allows overflow-auto to kick in
|
|
336
|
+
* - TableHeader gets className="sticky top-0 z-10" for a frozen header row
|
|
337
|
+
*/
|
|
338
|
+
export declare const WithScroll: StoryObj;
|
|
339
|
+
/**
|
|
340
|
+
* SCROLLBAR SIZES — per-axis demo
|
|
341
|
+
*
|
|
342
|
+
* Combine ui-scrollbar-x-{size} + ui-scrollbar-y-{size} independently.
|
|
343
|
+
* CSS: height → horizontal bar thickness | width → vertical bar thickness
|
|
344
|
+
*/
|
|
345
|
+
export declare const ScrollbarSizes: StoryObj;
|
|
346
|
+
/** PANEL DEFAULT — transparent rows + panel-sub-line row dividers */
|
|
347
|
+
export declare const PanelDefault: StoryObj;
|
|
348
|
+
/** PANEL NON-STRIPED DIVIDED — row dividers + vertical column dividers */
|
|
349
|
+
export declare const PanelNonStripedDivided: StoryObj;
|
|
350
|
+
/** PANEL STRIPED — alternating rows (both transparent in panel mode), no row strokes */
|
|
351
|
+
export declare const PanelStriped: StoryObj;
|
|
352
|
+
/** PANEL STRIPED + COL DIVIDED */
|
|
353
|
+
export declare const PanelStripedAndDivided: StoryObj;
|
|
354
|
+
/** PANEL SELECTED ROW — table-panel-selected (yellow/olive) */
|
|
355
|
+
export declare const PanelWithSelectedRow: StoryObj;
|
|
356
|
+
/** PANEL WITH FOOTER */
|
|
357
|
+
export declare const PanelWithFooter: StoryObj;
|
|
358
|
+
/**
|
|
359
|
+
* PANEL WITH PAGINATION
|
|
360
|
+
* TablePagination sits inside the same data-surface="panel" scope so it
|
|
361
|
+
* automatically picks up the panel tokens — no variant prop needed.
|
|
362
|
+
*/
|
|
363
|
+
export declare const PanelWithPagination: StoryObj;
|
|
364
|
+
/** PANEL EMPTY STATE */
|
|
365
|
+
export declare const PanelEmpty: StoryObj;
|
|
366
|
+
/**
|
|
367
|
+
* PANEL WITH SCROLL — sticky header + both scroll axes inside a fixed-height panel.
|
|
368
|
+
*/
|
|
369
|
+
export declare const PanelWithScroll: StoryObj;
|
|
370
|
+
/** PANEL ALL STATES — all variants side-by-side for design review */
|
|
371
|
+
export declare const PanelAllStates: StoryObj;
|
|
@@ -390,6 +390,14 @@ export declare const Default: {
|
|
|
390
390
|
};
|
|
391
391
|
render: (args: {}) => import("react/jsx-runtime").JSX.Element;
|
|
392
392
|
};
|
|
393
|
+
/**
|
|
394
|
+
* `isFloatingLabel={false}` — visible **`placeholder`**, no floating animation,
|
|
395
|
+
* and no inner `<label>` when `label` is empty (e.g. table cells, compact filters).
|
|
396
|
+
* Pair with `required={false}` + `hasClearIcon={false}` when mimicking inline fields.
|
|
397
|
+
*/
|
|
398
|
+
export declare const NonFloatingLabel: {
|
|
399
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
400
|
+
};
|
|
393
401
|
export declare const CustomLabel: {
|
|
394
402
|
args: {
|
|
395
403
|
label: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const inputVariant: (props?: ({
|
|
2
|
+
floatingLabelPlaceholder?: boolean | null | undefined;
|
|
2
3
|
size?: "sm" | "md" | "lg" | null | undefined;
|
|
3
4
|
rounded?: "none" | "normal" | "full" | null | undefined;
|
|
4
5
|
variant?: "outline" | "flat" | "underline" | null | undefined;
|