@dashforge/tw 0.4.0-beta → 0.6.0-beta
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/CHANGELOG.md +391 -0
- package/dist/index.esm.js +2113 -2
- package/dist/src/components/Pagination/Pagination.d.ts +32 -0
- package/dist/src/components/Pagination/Pagination.d.ts.map +1 -0
- package/dist/src/components/Pagination/pagination.helpers.d.ts +23 -0
- package/dist/src/components/Pagination/pagination.helpers.d.ts.map +1 -0
- package/dist/src/components/Pagination/pagination.types.d.ts +120 -0
- package/dist/src/components/Pagination/pagination.types.d.ts.map +1 -0
- package/dist/src/components/Pagination/pagination.variants.d.ts +150 -0
- package/dist/src/components/Pagination/pagination.variants.d.ts.map +1 -0
- package/dist/src/components/Skeleton/Skeleton.d.ts +23 -0
- package/dist/src/components/Skeleton/Skeleton.d.ts.map +1 -0
- package/dist/src/components/Skeleton/skeleton.types.d.ts +56 -0
- package/dist/src/components/Skeleton/skeleton.types.d.ts.map +1 -0
- package/dist/src/components/Skeleton/skeleton.variants.d.ts +110 -0
- package/dist/src/components/Skeleton/skeleton.variants.d.ts.map +1 -0
- package/dist/src/components/Table/Table.d.ts +24 -0
- package/dist/src/components/Table/Table.d.ts.map +1 -0
- package/dist/src/components/Table/_internal/getNestedValue.d.ts +20 -0
- package/dist/src/components/Table/_internal/getNestedValue.d.ts.map +1 -0
- package/dist/src/components/Table/_internal/useColumnAutoDetect.d.ts +45 -0
- package/dist/src/components/Table/_internal/useColumnAutoDetect.d.ts.map +1 -0
- package/dist/src/components/Table/_internal/useControllableState.d.ts +23 -0
- package/dist/src/components/Table/_internal/useControllableState.d.ts.map +1 -0
- package/dist/src/components/Table/_internal/useDebouncedValue.d.ts +10 -0
- package/dist/src/components/Table/_internal/useDebouncedValue.d.ts.map +1 -0
- package/dist/src/components/Table/_internal/useTableFilter.d.ts +13 -0
- package/dist/src/components/Table/_internal/useTableFilter.d.ts.map +1 -0
- package/dist/src/components/Table/_internal/useTableSearch.d.ts +23 -0
- package/dist/src/components/Table/_internal/useTableSearch.d.ts.map +1 -0
- package/dist/src/components/Table/_internal/useTableSelection.d.ts +25 -0
- package/dist/src/components/Table/_internal/useTableSelection.d.ts.map +1 -0
- package/dist/src/components/Table/_internal/useTableSort.d.ts +20 -0
- package/dist/src/components/Table/_internal/useTableSort.d.ts.map +1 -0
- package/dist/src/components/Table/cells/RenderButton.d.ts +13 -0
- package/dist/src/components/Table/cells/RenderButton.d.ts.map +1 -0
- package/dist/src/components/Table/cells/RenderChip.d.ts +80 -0
- package/dist/src/components/Table/cells/RenderChip.d.ts.map +1 -0
- package/dist/src/components/Table/cells/RenderText.d.ts +21 -0
- package/dist/src/components/Table/cells/RenderText.d.ts.map +1 -0
- package/dist/src/components/Table/cells/RenderTwoLine.d.ts +20 -0
- package/dist/src/components/Table/cells/RenderTwoLine.d.ts.map +1 -0
- package/dist/src/components/Table/cells/RowActionsMenu.d.ts +36 -0
- package/dist/src/components/Table/cells/RowActionsMenu.d.ts.map +1 -0
- package/dist/src/components/Table/cells/index.d.ts +11 -0
- package/dist/src/components/Table/cells/index.d.ts.map +1 -0
- package/dist/src/components/Table/table.types.d.ts +304 -0
- package/dist/src/components/Table/table.types.d.ts.map +1 -0
- package/dist/src/components/Table/table.variants.d.ts +285 -0
- package/dist/src/components/Table/table.variants.d.ts.map +1 -0
- package/dist/src/index.d.ts +13 -1
- package/dist/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Pagination/Pagination.test.tsx +314 -0
- package/src/components/Pagination/Pagination.tsx +275 -0
- package/src/components/Pagination/pagination.helpers.ts +102 -0
- package/src/components/Pagination/pagination.types.ts +117 -0
- package/src/components/Pagination/pagination.variants.ts +111 -0
- package/src/components/Skeleton/Skeleton.test.tsx +127 -0
- package/src/components/Skeleton/Skeleton.tsx +49 -0
- package/src/components/Skeleton/skeleton.types.ts +59 -0
- package/src/components/Skeleton/skeleton.variants.ts +86 -0
- package/src/components/Table/Table.test.tsx +603 -0
- package/src/components/Table/Table.tsx +816 -0
- package/src/components/Table/_internal/getNestedValue.test.ts +50 -0
- package/src/components/Table/_internal/getNestedValue.ts +32 -0
- package/src/components/Table/_internal/themeIdentity.test.ts +84 -0
- package/src/components/Table/_internal/useColumnAutoDetect.test.ts +123 -0
- package/src/components/Table/_internal/useColumnAutoDetect.ts +100 -0
- package/src/components/Table/_internal/useControllableState.ts +48 -0
- package/src/components/Table/_internal/useDebouncedValue.ts +24 -0
- package/src/components/Table/_internal/useTableFilter.ts +37 -0
- package/src/components/Table/_internal/useTableSearch.test.ts +115 -0
- package/src/components/Table/_internal/useTableSearch.ts +66 -0
- package/src/components/Table/_internal/useTableSelection.test.ts +100 -0
- package/src/components/Table/_internal/useTableSelection.ts +100 -0
- package/src/components/Table/_internal/useTableSort.test.ts +150 -0
- package/src/components/Table/_internal/useTableSort.ts +141 -0
- package/src/components/Table/cells/RenderButton.tsx +23 -0
- package/src/components/Table/cells/RenderChip.tsx +103 -0
- package/src/components/Table/cells/RenderText.tsx +37 -0
- package/src/components/Table/cells/RenderTwoLine.tsx +34 -0
- package/src/components/Table/cells/RowActionsMenu.tsx +147 -0
- package/src/components/Table/cells/index.ts +14 -0
- package/src/components/Table/table.types.ts +337 -0
- package/src/components/Table/table.variants.ts +207 -0
- package/src/index.ts +60 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useControllableState.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/_internal/useControllableState.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,IAAI,EAAE;IAC5C,eAAe,EAAE,CAAC,GAAG,SAAS,CAAC;IAC/B,YAAY,EAAE,CAAC,CAAC;IAChB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;CAC/B,GAAG,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAwB5C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a debounced version of `value` — only updates after `delayMs`
|
|
3
|
+
* of no further changes. Used by the search input so we don't re-filter
|
|
4
|
+
* the entire row set on every keystroke.
|
|
5
|
+
*
|
|
6
|
+
* `delayMs <= 0` short-circuits to the input value (no debounce —
|
|
7
|
+
* useful for tests).
|
|
8
|
+
*/
|
|
9
|
+
export declare function useDebouncedValue<T>(value: T, delayMs: number): T;
|
|
10
|
+
//# sourceMappingURL=useDebouncedValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDebouncedValue.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/_internal/useDebouncedValue.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,CAajE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TableFilterModel } from '../table.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Filters `rows` by the per-column filter model. v1 only supports
|
|
4
|
+
* the `contains` operator (text substring) — additional ops
|
|
5
|
+
* (`equals`, `in`, `gte`, `lte`, `between`, `before`, `after`)
|
|
6
|
+
* land in v1-bis once the filter UI surface for each shape is
|
|
7
|
+
* fleshed out.
|
|
8
|
+
*
|
|
9
|
+
* AND semantics across columns: a row must match EVERY active
|
|
10
|
+
* filter. Within a single filter, the op decides the predicate.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useTableFilter<T extends object>(rows: T[], filterModel: TableFilterModel): T[];
|
|
13
|
+
//# sourceMappingURL=useTableFilter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTableFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/_internal/useTableFilter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAC7C,IAAI,EAAE,CAAC,EAAE,EACT,WAAW,EAAE,gBAAgB,GAC5B,CAAC,EAAE,CAkBL"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { TableColumn } from '../table.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Stringify any value into a search-comparable form. Handles all
|
|
4
|
+
* the edge cases that bit the MUI-side Table:
|
|
5
|
+
*
|
|
6
|
+
* - `null` / `undefined` → `''`
|
|
7
|
+
* - `string` → as-is
|
|
8
|
+
* - `number` / `bigint` → `String(value)`
|
|
9
|
+
* - `boolean` → `'true'` / `'false'`
|
|
10
|
+
* - `Date` → ISO 8601
|
|
11
|
+
* - `Array` / object → `JSON.stringify` (best effort)
|
|
12
|
+
*/
|
|
13
|
+
export declare function stringifyForSearch(value: unknown): string;
|
|
14
|
+
/**
|
|
15
|
+
* Filters `rows` by `query` against the columns flagged
|
|
16
|
+
* `searchable: true`. Empty / whitespace-only query is a no-op
|
|
17
|
+
* (returns the original rows).
|
|
18
|
+
*
|
|
19
|
+
* Case-insensitive substring match. The caller is responsible for
|
|
20
|
+
* debouncing the input (use `useDebouncedValue`).
|
|
21
|
+
*/
|
|
22
|
+
export declare function useTableSearch<T extends object>(rows: T[], cols: TableColumn<T>[], query: string): T[];
|
|
23
|
+
//# sourceMappingURL=useTableSearch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTableSearch.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/_internal/useTableSearch.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAqBzD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAC7C,IAAI,EAAE,CAAC,EAAE,EACT,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,EACtB,KAAK,EAAE,MAAM,GACZ,CAAC,EAAE,CAeL"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { TableRowSelectionMode } from '../table.types.js';
|
|
2
|
+
export interface UseTableSelectionResult {
|
|
3
|
+
selectedRowIds: string[];
|
|
4
|
+
isSelected: (rowId: string) => boolean;
|
|
5
|
+
toggleRow: (rowId: string) => void;
|
|
6
|
+
toggleAll: (allRowIds: string[]) => void;
|
|
7
|
+
clearSelection: () => void;
|
|
8
|
+
/** True when EVERY id in `allRowIds` is selected. */
|
|
9
|
+
isAllSelected: (allRowIds: string[]) => boolean;
|
|
10
|
+
/** True when at least one (but not all) of `allRowIds` is selected. */
|
|
11
|
+
isIndeterminate: (allRowIds: string[]) => boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Selection logic helper. Given the controllable selection state +
|
|
15
|
+
* the setter (from `useControllableState`), exposes ergonomic
|
|
16
|
+
* helpers the Table calls from its render path.
|
|
17
|
+
*
|
|
18
|
+
* - `single` mode: at most one row selected. Toggling another
|
|
19
|
+
* replaces the previous.
|
|
20
|
+
* - `multiple` mode: any subset selectable; toggling adds/removes.
|
|
21
|
+
* - `none` mode: every toggle is a no-op (the Table shouldn't
|
|
22
|
+
* render the checkbox cells anyway, but this is defensive).
|
|
23
|
+
*/
|
|
24
|
+
export declare function useTableSelection(mode: TableRowSelectionMode, selectedRowIds: string[], setSelectedRowIds: (next: string[] | ((prev: string[]) => string[])) => void): UseTableSelectionResult;
|
|
25
|
+
//# sourceMappingURL=useTableSelection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTableSelection.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/_internal/useTableSelection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE/D,MAAM,WAAW,uBAAuB;IACtC,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IACvC,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACzC,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,qDAAqD;IACrD,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC;IAChD,uEAAuE;IACvE,eAAe,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC;CACnD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,qBAAqB,EAC3B,cAAc,EAAE,MAAM,EAAE,EACxB,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,MAAM,EAAE,CAAC,KAAK,IAAI,GAC3E,uBAAuB,CAqEzB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TableColumn, TableSortModel } from '../table.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Applies the `sortModel` to `rows`. Returns a NEW sorted array
|
|
4
|
+
* (does not mutate input). Stable sort guaranteed by the underlying
|
|
5
|
+
* `Array.prototype.sort` in modern engines.
|
|
6
|
+
*
|
|
7
|
+
* Multi-column sort: items earlier in `sortModel` have higher
|
|
8
|
+
* precedence. Equal values fall through to the next sort item; if
|
|
9
|
+
* all sort items tie, the original order is preserved (stable).
|
|
10
|
+
*/
|
|
11
|
+
export declare function useTableSort<T extends object>(rows: T[], cols: TableColumn<T>[], sortModel: TableSortModel): T[];
|
|
12
|
+
/**
|
|
13
|
+
* Three-state sort cycler: `none` → `asc` → `desc` → `none`.
|
|
14
|
+
*
|
|
15
|
+
* Used by the header click handler. Returns the next sort model
|
|
16
|
+
* to apply, given the current model + the clicked field + whether
|
|
17
|
+
* the user is multi-sorting (shift key).
|
|
18
|
+
*/
|
|
19
|
+
export declare function cycleSortFor(current: TableSortModel, field: string, multi: boolean): TableSortModel;
|
|
20
|
+
//# sourceMappingURL=useTableSort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTableSort.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/_internal/useTableSort.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EAEf,MAAM,mBAAmB,CAAC;AA+C3B;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAC3C,IAAI,EAAE,CAAC,EAAE,EACT,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,EACtB,SAAS,EAAE,cAAc,GACxB,CAAC,EAAE,CA2CL;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,OAAO,GACb,cAAc,CAkBhB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MouseEvent, ReactNode } from 'react';
|
|
2
|
+
import type { ButtonProps } from '../../Button/button.types.js';
|
|
3
|
+
export interface RenderButtonProps extends Pick<ButtonProps, 'variant' | 'color' | 'size' | 'disabled' | 'access'> {
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Inline button cell renderer. Thin wrapper over `<Button>` with
|
|
9
|
+
* the size narrowed to `sm` by default (table density expects compact
|
|
10
|
+
* controls).
|
|
11
|
+
*/
|
|
12
|
+
export declare function RenderButton(props: RenderButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=RenderButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RenderButton.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/cells/RenderButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAEhE,MAAM,WAAW,iBACf,SAAQ,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC/E,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;CAC1D;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CAOpD"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
3
|
+
/**
|
|
4
|
+
* Internal mini-chip used by the cell renderer library. Not exported
|
|
5
|
+
* from `@dashforge/tw` as a standalone component (per Sprint 4.1
|
|
6
|
+
* scope decision — a standalone `<Chip>` may ship in Sprint 5 if
|
|
7
|
+
* demand emerges).
|
|
8
|
+
*
|
|
9
|
+
* Variants:
|
|
10
|
+
* - `color`: 7 intents (neutral / primary / success / warning /
|
|
11
|
+
* danger / info / secondary)
|
|
12
|
+
* - `variant`: `soft` (default) / `solid` / `outline`
|
|
13
|
+
* - `size`: `sm` / `md`
|
|
14
|
+
*/
|
|
15
|
+
declare const chipVariants: import("tailwind-variants").TVReturnType<{
|
|
16
|
+
color: {
|
|
17
|
+
neutral: string;
|
|
18
|
+
primary: string;
|
|
19
|
+
success: string;
|
|
20
|
+
warning: string;
|
|
21
|
+
danger: string;
|
|
22
|
+
info: string;
|
|
23
|
+
secondary: string;
|
|
24
|
+
};
|
|
25
|
+
variant: {
|
|
26
|
+
soft: string;
|
|
27
|
+
solid: string;
|
|
28
|
+
outline: string;
|
|
29
|
+
};
|
|
30
|
+
size: {
|
|
31
|
+
sm: string;
|
|
32
|
+
md: string;
|
|
33
|
+
};
|
|
34
|
+
}, undefined, string[], {
|
|
35
|
+
color: {
|
|
36
|
+
neutral: string;
|
|
37
|
+
primary: string;
|
|
38
|
+
success: string;
|
|
39
|
+
warning: string;
|
|
40
|
+
danger: string;
|
|
41
|
+
info: string;
|
|
42
|
+
secondary: string;
|
|
43
|
+
};
|
|
44
|
+
variant: {
|
|
45
|
+
soft: string;
|
|
46
|
+
solid: string;
|
|
47
|
+
outline: string;
|
|
48
|
+
};
|
|
49
|
+
size: {
|
|
50
|
+
sm: string;
|
|
51
|
+
md: string;
|
|
52
|
+
};
|
|
53
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
54
|
+
color: {
|
|
55
|
+
neutral: string;
|
|
56
|
+
primary: string;
|
|
57
|
+
success: string;
|
|
58
|
+
warning: string;
|
|
59
|
+
danger: string;
|
|
60
|
+
info: string;
|
|
61
|
+
secondary: string;
|
|
62
|
+
};
|
|
63
|
+
variant: {
|
|
64
|
+
soft: string;
|
|
65
|
+
solid: string;
|
|
66
|
+
outline: string;
|
|
67
|
+
};
|
|
68
|
+
size: {
|
|
69
|
+
sm: string;
|
|
70
|
+
md: string;
|
|
71
|
+
};
|
|
72
|
+
}, undefined, string[], unknown, unknown, undefined>>;
|
|
73
|
+
type ChipVariants = VariantProps<typeof chipVariants>;
|
|
74
|
+
export interface RenderChipProps extends ChipVariants {
|
|
75
|
+
children: ReactNode;
|
|
76
|
+
className?: string;
|
|
77
|
+
}
|
|
78
|
+
export declare function RenderChip(props: RenderChipProps): import("react/jsx-runtime").JSX.Element;
|
|
79
|
+
export {};
|
|
80
|
+
//# sourceMappingURL=RenderChip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RenderChip.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/cells/RenderChip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG1D;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qDAsEhB,CAAC;AAEH,KAAK,YAAY,GAAG,YAAY,CAAC,OAAO,YAAY,CAAC,CAAC;AAEtD,MAAM,WAAW,eAAgB,SAAQ,YAAY;IACnD,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CAOhD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface RenderTextProps {
|
|
3
|
+
value: ReactNode;
|
|
4
|
+
/** Truncate to one line with ellipsis on overflow. @default false */
|
|
5
|
+
truncate?: boolean;
|
|
6
|
+
/** Secondary text color (less prominent). @default false */
|
|
7
|
+
muted?: boolean;
|
|
8
|
+
/** Extra class merged via `tailwind-merge`. */
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Plain text cell renderer. Wraps the value in a `<span>` and
|
|
13
|
+
* optionally truncates on overflow. Use this for the most common
|
|
14
|
+
* case: render a single string value.
|
|
15
|
+
*
|
|
16
|
+
* The Table component does NOT use this by default for plain
|
|
17
|
+
* string columns — it just renders `{value}` directly. Use
|
|
18
|
+
* `RenderText` when you need the truncate / muted styling.
|
|
19
|
+
*/
|
|
20
|
+
export declare function RenderText(props: RenderTextProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
//# sourceMappingURL=RenderText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RenderText.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/cells/RenderText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,SAAS,CAAC;IACjB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CAchD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface RenderTwoLineProps {
|
|
3
|
+
primary: ReactNode;
|
|
4
|
+
secondary: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Two-line cell renderer: a bold primary line stacked above a muted
|
|
9
|
+
* secondary line. Useful for `Name + email`, `Title + ID`, etc.
|
|
10
|
+
*
|
|
11
|
+
* Replaces the MUI-side `RenderTwoLineCell` without the magic-number
|
|
12
|
+
* vertical-align fudges (`mt: 0.8 / 0.2`) — flexbox handles the
|
|
13
|
+
* vertical layout cleanly.
|
|
14
|
+
*
|
|
15
|
+
* Dashforge identity rule: text colors auto-invert via the
|
|
16
|
+
* `dashforgePreset()` CSS-variable swap. No `dark:` variants needed
|
|
17
|
+
* on neutral palette.
|
|
18
|
+
*/
|
|
19
|
+
export declare function RenderTwoLine(props: RenderTwoLineProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
//# sourceMappingURL=RenderTwoLine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RenderTwoLine.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/cells/RenderTwoLine.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,SAAS,CAAC;IACnB,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,2CAYtD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { AccessRequirement } from '@dashforge/rbac';
|
|
3
|
+
/**
|
|
4
|
+
* Single action definition for `<RowActionsMenu>`.
|
|
5
|
+
*
|
|
6
|
+
* `access` (optional) gates the action via RBAC:
|
|
7
|
+
* - `onUnauthorized: 'hide'` → action not rendered
|
|
8
|
+
* - `onUnauthorized: 'disable'` → action visible, disabled
|
|
9
|
+
* - `onUnauthorized: 'readonly'` → action visible, disabled
|
|
10
|
+
*/
|
|
11
|
+
export interface TableRowAction<T> {
|
|
12
|
+
label: ReactNode;
|
|
13
|
+
onClick: (row: T) => void;
|
|
14
|
+
icon?: ReactNode;
|
|
15
|
+
color?: 'default' | 'danger' | 'warning';
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
access?: AccessRequirement;
|
|
18
|
+
}
|
|
19
|
+
export interface RowActionsMenuProps<T> {
|
|
20
|
+
row: T;
|
|
21
|
+
actions: TableRowAction<T>[];
|
|
22
|
+
/** Custom trigger element. Defaults to a ⋮ icon button. */
|
|
23
|
+
trigger?: ReactNode;
|
|
24
|
+
/** Aria-label for the default trigger. */
|
|
25
|
+
ariaLabel?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 3-dot row actions menu. Renders a trigger button that opens a
|
|
29
|
+
* Popover (Sprint 3 component) with a list of action menu items.
|
|
30
|
+
*
|
|
31
|
+
* Replaces the MUI-side `RowActions.tsx` (IconButton + Menu) with
|
|
32
|
+
* the TW equivalents. Per-action RBAC honored: hidden actions are
|
|
33
|
+
* filtered out, disabled actions render disabled.
|
|
34
|
+
*/
|
|
35
|
+
export declare function RowActionsMenu<T>(props: RowActionsMenuProps<T>): import("react/jsx-runtime").JSX.Element | null;
|
|
36
|
+
//# sourceMappingURL=RowActionsMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RowActionsMenu.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/cells/RowActionsMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAKzD;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;IAC1B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC;IACpC,GAAG,EAAE,CAAC,CAAC;IACP,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7B,2DAA2D;IAC3D,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC,kDA8D9D"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { RenderText } from './RenderText.js';
|
|
2
|
+
export type { RenderTextProps } from './RenderText.js';
|
|
3
|
+
export { RenderTwoLine } from './RenderTwoLine.js';
|
|
4
|
+
export type { RenderTwoLineProps } from './RenderTwoLine.js';
|
|
5
|
+
export { RenderChip } from './RenderChip.js';
|
|
6
|
+
export type { RenderChipProps } from './RenderChip.js';
|
|
7
|
+
export { RenderButton } from './RenderButton.js';
|
|
8
|
+
export type { RenderButtonProps } from './RenderButton.js';
|
|
9
|
+
export { RowActionsMenu } from './RowActionsMenu.js';
|
|
10
|
+
export type { RowActionsMenuProps, TableRowAction } from './RowActionsMenu.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/cells/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { AccessRequirement } from '@dashforge/rbac';
|
|
3
|
+
import type { TableVariants } from './table.variants.js';
|
|
4
|
+
/**
|
|
5
|
+
* Type-level dotted path through an object's nested structure.
|
|
6
|
+
*
|
|
7
|
+
* `NestedKeyOf<{ user: { name: string } }>` → `'user' | 'user.name'`.
|
|
8
|
+
*
|
|
9
|
+
* Used as the `field` of a column to give autocomplete on nested
|
|
10
|
+
* paths. The runtime lookup happens via `getNestedValue` in
|
|
11
|
+
* `_internal/getNestedValue.ts` (split on `.` and walk).
|
|
12
|
+
*/
|
|
13
|
+
export type NestedKeyOf<T extends object> = {
|
|
14
|
+
[K in keyof T & (string | number)]: T[K] extends object | undefined ? T[K] extends ReadonlyArray<unknown> ? `${K}` : NonNullable<T[K]> extends object ? `${K}` | `${K}.${NestedKeyOf<NonNullable<T[K]>>}` : `${K}` : `${K}`;
|
|
15
|
+
}[keyof T & (string | number)];
|
|
16
|
+
/**
|
|
17
|
+
* Auto-detected primitive type for a column. Drives smart defaults:
|
|
18
|
+
* - `number` → align right + monospace (`tabular-nums`)
|
|
19
|
+
* - `date` → align left + monospace (consistent ISO width)
|
|
20
|
+
* - `boolean` → align center
|
|
21
|
+
* - `string` → align left (default)
|
|
22
|
+
* - `unknown` → fallback to left, no monospace
|
|
23
|
+
*/
|
|
24
|
+
export type TableColumnInferredType = 'number' | 'date' | 'boolean' | 'string' | 'unknown';
|
|
25
|
+
/**
|
|
26
|
+
* Context passed to a custom `cellRenderer`. Mirrors what the consumer
|
|
27
|
+
* needs to render a cell: row, resolved value, position, selection
|
|
28
|
+
* state, expand state, and the resolved RBAC access state for THIS
|
|
29
|
+
* column.
|
|
30
|
+
*/
|
|
31
|
+
export interface TableCellContext<T> {
|
|
32
|
+
row: T;
|
|
33
|
+
value: unknown;
|
|
34
|
+
rowIndex: number;
|
|
35
|
+
isSelected: boolean;
|
|
36
|
+
isExpanded: boolean;
|
|
37
|
+
/** Resolved RBAC state for this column. `null` if no `access` set. */
|
|
38
|
+
access: {
|
|
39
|
+
hidden: boolean;
|
|
40
|
+
disabled: boolean;
|
|
41
|
+
readonly: boolean;
|
|
42
|
+
} | null;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* One column definition for `<Table>`.
|
|
46
|
+
*
|
|
47
|
+
* **i18n**: pass `t('users.name')` directly to `header` — `header`
|
|
48
|
+
* accepts `string` for the common case. Use the function form
|
|
49
|
+
* `header: () => <span>…</span>` only when you need richer JSX.
|
|
50
|
+
*
|
|
51
|
+
* **Smart defaults**: when `align` / `monospace` are omitted, the
|
|
52
|
+
* Table auto-detects the column type from the first non-null value
|
|
53
|
+
* across the visible rows and applies `right + tabular-nums` for
|
|
54
|
+
* numbers, `center` for booleans, etc. Explicit props always win.
|
|
55
|
+
*/
|
|
56
|
+
export interface TableColumn<T extends object> {
|
|
57
|
+
/**
|
|
58
|
+
* Dotted path to the value in each row. Supports nested keys
|
|
59
|
+
* (`'address.city.zipCode'`) thanks to `NestedKeyOf<T>` typing +
|
|
60
|
+
* runtime `getNestedValue()`.
|
|
61
|
+
*/
|
|
62
|
+
field: NestedKeyOf<T> | (string & {});
|
|
63
|
+
/**
|
|
64
|
+
* Visible header. Pass a translation string directly:
|
|
65
|
+
* `header: t('users.name')`. Use the function form for richer
|
|
66
|
+
* JSX (e.g. header with an icon).
|
|
67
|
+
*/
|
|
68
|
+
header: string | (() => ReactNode);
|
|
69
|
+
/** Pixel width (`px`). Mutually informative with `flex`. */
|
|
70
|
+
width?: number;
|
|
71
|
+
/** Flex grow factor (CSS `flex: <n> 1 0`). */
|
|
72
|
+
flex?: number;
|
|
73
|
+
/** Minimum pixel width (for resizable columns — deferred to v1-bis). */
|
|
74
|
+
minWidth?: number;
|
|
75
|
+
/**
|
|
76
|
+
* Horizontal alignment. Default is auto-detected from value type
|
|
77
|
+
* (number → right, boolean → center, otherwise left).
|
|
78
|
+
*/
|
|
79
|
+
align?: 'left' | 'right' | 'center';
|
|
80
|
+
/**
|
|
81
|
+
* Opt-in to a monospace **font family** for this column. The
|
|
82
|
+
* library never auto-applies `font-mono` — it would override the
|
|
83
|
+
* consumer's theme `font-sans`. Set `true` explicitly only when
|
|
84
|
+
* the design calls for a typewriter font (e.g. raw hex IDs).
|
|
85
|
+
*
|
|
86
|
+
* The dashforgePreset does NOT own the `fontFamily` axis; the
|
|
87
|
+
* consumer configures the mono stack in their own
|
|
88
|
+
* `tailwind.config.ts` (`theme.extend.fontFamily.mono`).
|
|
89
|
+
*/
|
|
90
|
+
monospace?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Apply `font-variant-numeric: tabular-nums` so every digit
|
|
93
|
+
* occupies the same width — clean alignment for currency / metric
|
|
94
|
+
* columns. Does NOT change the font family. Auto-applied for
|
|
95
|
+
* `number` and `date` columns; pass `false` explicitly to opt out
|
|
96
|
+
* or `true` to force on a string column.
|
|
97
|
+
*/
|
|
98
|
+
tabularNums?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Make the column sortable. Pass `true` for default comparator
|
|
101
|
+
* (works for string/number/date/boolean) or a custom
|
|
102
|
+
* `(a, b) => number`.
|
|
103
|
+
*/
|
|
104
|
+
sortable?: boolean | ((a: T, b: T) => number);
|
|
105
|
+
/**
|
|
106
|
+
* Include this column in the global search filter.
|
|
107
|
+
* @default false
|
|
108
|
+
*/
|
|
109
|
+
searchable?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Enable per-column quick filter (text-based in v1).
|
|
112
|
+
* @default false
|
|
113
|
+
*/
|
|
114
|
+
filterable?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Custom cell renderer. Receives the full row + the resolved
|
|
117
|
+
* (potentially nested) value, the row index, selection state,
|
|
118
|
+
* expansion state, and the RBAC access state.
|
|
119
|
+
*/
|
|
120
|
+
cellRenderer?: (ctx: TableCellContext<T>) => ReactNode;
|
|
121
|
+
/**
|
|
122
|
+
* Per-column RBAC. `onUnauthorized: 'hide'` removes the column
|
|
123
|
+
* entirely from header AND every row cell (a11y-correct).
|
|
124
|
+
* `disable` / `readonly` are forwarded to `cellRenderer` via
|
|
125
|
+
* `ctx.access` — the renderer is expected to honor them.
|
|
126
|
+
*/
|
|
127
|
+
access?: AccessRequirement;
|
|
128
|
+
/** Reserved for v1-bis (column-visibility dialog). */
|
|
129
|
+
hideable?: boolean;
|
|
130
|
+
defaultHidden?: boolean;
|
|
131
|
+
}
|
|
132
|
+
export type TableSortDirection = 'asc' | 'desc';
|
|
133
|
+
export interface TableSortItem {
|
|
134
|
+
field: string;
|
|
135
|
+
direction: TableSortDirection;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Sort model. Single-column sort = array of length 1. Multi-column
|
|
139
|
+
* sort = array of N (typically up to 3). The order matters: first
|
|
140
|
+
* item is the primary sort key, subsequent items break ties.
|
|
141
|
+
*/
|
|
142
|
+
export type TableSortModel = TableSortItem[];
|
|
143
|
+
export interface TableFilterItem {
|
|
144
|
+
field: string;
|
|
145
|
+
/** Text substring match. Future ops: `equals`, `in`, `gte`, `lte`, `between`. */
|
|
146
|
+
op: 'contains';
|
|
147
|
+
value: string;
|
|
148
|
+
}
|
|
149
|
+
export type TableFilterModel = TableFilterItem[];
|
|
150
|
+
export type TableRowSelectionMode = 'none' | 'single' | 'multiple';
|
|
151
|
+
/**
|
|
152
|
+
* Internal default strings used by the Table for accessibility
|
|
153
|
+
* announcements, density toggle, search placeholder, etc. Pass the
|
|
154
|
+
* subset you need to translate; the rest fall back to English.
|
|
155
|
+
*
|
|
156
|
+
* For column headers, empty state, bulk actions and row action
|
|
157
|
+
* labels — pass the translated value directly via the matching
|
|
158
|
+
* prop (`header`, `emptyState`, `bulkActions`, `rowActions`).
|
|
159
|
+
*/
|
|
160
|
+
export interface TableLabels {
|
|
161
|
+
searchPlaceholder?: string;
|
|
162
|
+
noData?: string;
|
|
163
|
+
loading?: string;
|
|
164
|
+
ariaSortNone?: string;
|
|
165
|
+
ariaSortAscending?: string;
|
|
166
|
+
ariaSortDescending?: string;
|
|
167
|
+
ariaSelectRow?: string;
|
|
168
|
+
ariaSelectAllRows?: string;
|
|
169
|
+
ariaExpandRow?: string;
|
|
170
|
+
ariaCollapseRow?: string;
|
|
171
|
+
/** "X selected" — `{count}` placeholder gets replaced. */
|
|
172
|
+
selectedCount?: string;
|
|
173
|
+
clearSelection?: string;
|
|
174
|
+
/** Per-column filter Popover. */
|
|
175
|
+
filterColumn?: string;
|
|
176
|
+
filterApply?: string;
|
|
177
|
+
filterClear?: string;
|
|
178
|
+
/** Density toggle. */
|
|
179
|
+
density?: string;
|
|
180
|
+
densityCompact?: string;
|
|
181
|
+
densityComfortable?: string;
|
|
182
|
+
densitySpacious?: string;
|
|
183
|
+
}
|
|
184
|
+
export interface TableSlotProps {
|
|
185
|
+
root?: {
|
|
186
|
+
className?: string;
|
|
187
|
+
};
|
|
188
|
+
toolbar?: {
|
|
189
|
+
className?: string;
|
|
190
|
+
};
|
|
191
|
+
search?: {
|
|
192
|
+
className?: string;
|
|
193
|
+
};
|
|
194
|
+
scroll?: {
|
|
195
|
+
className?: string;
|
|
196
|
+
};
|
|
197
|
+
table?: {
|
|
198
|
+
className?: string;
|
|
199
|
+
};
|
|
200
|
+
thead?: {
|
|
201
|
+
className?: string;
|
|
202
|
+
};
|
|
203
|
+
tbody?: {
|
|
204
|
+
className?: string;
|
|
205
|
+
};
|
|
206
|
+
headerRow?: {
|
|
207
|
+
className?: string;
|
|
208
|
+
};
|
|
209
|
+
headerCell?: {
|
|
210
|
+
className?: string;
|
|
211
|
+
};
|
|
212
|
+
row?: {
|
|
213
|
+
className?: string;
|
|
214
|
+
};
|
|
215
|
+
cell?: {
|
|
216
|
+
className?: string;
|
|
217
|
+
};
|
|
218
|
+
emptyState?: {
|
|
219
|
+
className?: string;
|
|
220
|
+
};
|
|
221
|
+
loadingOverlay?: {
|
|
222
|
+
className?: string;
|
|
223
|
+
};
|
|
224
|
+
selectionCell?: {
|
|
225
|
+
className?: string;
|
|
226
|
+
};
|
|
227
|
+
expandToggleCell?: {
|
|
228
|
+
className?: string;
|
|
229
|
+
};
|
|
230
|
+
expandedRow?: {
|
|
231
|
+
className?: string;
|
|
232
|
+
};
|
|
233
|
+
rowActionsCell?: {
|
|
234
|
+
className?: string;
|
|
235
|
+
};
|
|
236
|
+
bulkActionFooter?: {
|
|
237
|
+
className?: string;
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
export interface TableExpandableConfig<T> {
|
|
241
|
+
render: (row: T) => ReactNode;
|
|
242
|
+
expandedRowIds?: string[];
|
|
243
|
+
onExpandChange?: (ids: string[]) => void;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Props for `<Table>`.
|
|
247
|
+
*
|
|
248
|
+
* Hybrid declarative-first architecture: by default every state piece
|
|
249
|
+
* (sort, filter, search, selection, expansion) is internal. Pass the
|
|
250
|
+
* matching controlled prop + change handler to lift state up.
|
|
251
|
+
*
|
|
252
|
+
* Smart defaults: column types are auto-detected on first render —
|
|
253
|
+
* number columns get right-align + tabular-nums, dates get monospace,
|
|
254
|
+
* booleans get center-align, etc. Override via explicit `align` /
|
|
255
|
+
* `monospace` per column.
|
|
256
|
+
*
|
|
257
|
+
* Visual style: Stripe-inspired clean lines by default
|
|
258
|
+
* (`variant="lines"`), row actions revealed on hover, sticky header,
|
|
259
|
+
* `comfortable` density. Switch via variant / density / size props.
|
|
260
|
+
*
|
|
261
|
+
* i18n: column `header` accepts plain strings (use `t('...')`
|
|
262
|
+
* directly). All internal label strings configurable via `labels`
|
|
263
|
+
* prop with English defaults.
|
|
264
|
+
*/
|
|
265
|
+
export interface TableProps<T extends object> extends Pick<TableVariants, 'variant' | 'size' | 'density'> {
|
|
266
|
+
rows: T[];
|
|
267
|
+
cols: TableColumn<T>[];
|
|
268
|
+
/** Stable row id resolver. Default: positional index. */
|
|
269
|
+
getRowId?: (row: T, index: number) => string;
|
|
270
|
+
sortModel?: TableSortModel;
|
|
271
|
+
onSortChange?: (model: TableSortModel) => void;
|
|
272
|
+
/** Default sort applied when uncontrolled. */
|
|
273
|
+
defaultSortModel?: TableSortModel;
|
|
274
|
+
enableSearch?: boolean;
|
|
275
|
+
searchQuery?: string;
|
|
276
|
+
onSearchQueryChange?: (q: string) => void;
|
|
277
|
+
searchPlaceholder?: string;
|
|
278
|
+
searchDebounceMs?: number;
|
|
279
|
+
filterModel?: TableFilterModel;
|
|
280
|
+
onFilterChange?: (model: TableFilterModel) => void;
|
|
281
|
+
rowSelection?: TableRowSelectionMode;
|
|
282
|
+
selectedRowIds?: string[];
|
|
283
|
+
onSelectionChange?: (ids: string[]) => void;
|
|
284
|
+
/** Sticky bulk action footer (visible only when selection > 0). */
|
|
285
|
+
bulkActions?: (selectedRows: T[]) => ReactNode;
|
|
286
|
+
expandable?: TableExpandableConfig<T>;
|
|
287
|
+
rowActions?: (row: T) => ReactNode;
|
|
288
|
+
loading?: boolean;
|
|
289
|
+
/** Number of skeleton rows shown while `loading=true`. @default 5 */
|
|
290
|
+
loadingRowCount?: number;
|
|
291
|
+
emptyState?: ReactNode;
|
|
292
|
+
/** Sticky header. @default true */
|
|
293
|
+
stickyHeader?: boolean;
|
|
294
|
+
/** Optional caption for screen readers. */
|
|
295
|
+
caption?: ReactNode;
|
|
296
|
+
/** Renders the caption visually too (otherwise sr-only). @default false */
|
|
297
|
+
showCaption?: boolean;
|
|
298
|
+
/** Table-level RBAC. `hide` returns null; `disable` greys everything. */
|
|
299
|
+
access?: AccessRequirement;
|
|
300
|
+
labels?: TableLabels;
|
|
301
|
+
sx?: string;
|
|
302
|
+
slotProps?: TableSlotProps;
|
|
303
|
+
}
|
|
304
|
+
//# sourceMappingURL=table.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.types.d.ts","sourceRoot":"","sources":["../../../../src/components/Table/table.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIzD;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,MAAM,IAAI;KACzC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