@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,32 @@
|
|
|
1
|
+
import type { PaginationProps } from './pagination.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Dashforge TW `<Pagination>` — controlled pagination primitive.
|
|
4
|
+
*
|
|
5
|
+
* Three variants:
|
|
6
|
+
* - `default` — page-size selector + summary + page numbers + nav buttons + jump input
|
|
7
|
+
* - `compact` — page numbers + nav buttons only (no summary, no selector, no jump)
|
|
8
|
+
* - `minimal` — "Page X of Y" + prev/next only
|
|
9
|
+
*
|
|
10
|
+
* Always controlled (no internal state besides the jump-input draft).
|
|
11
|
+
*
|
|
12
|
+
* A11Y:
|
|
13
|
+
* - `<nav aria-label="Pagination">` root
|
|
14
|
+
* - `aria-current="page"` on the active page button
|
|
15
|
+
* - `aria-label` on every interactive element
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* const [page, setPage] = useState(1);
|
|
20
|
+
* const [pageSize, setPageSize] = useState(20);
|
|
21
|
+
*
|
|
22
|
+
* <Pagination
|
|
23
|
+
* page={page}
|
|
24
|
+
* pageSize={pageSize}
|
|
25
|
+
* totalCount={1437}
|
|
26
|
+
* onPageChange={setPage}
|
|
27
|
+
* onPageSizeChange={setPageSize}
|
|
28
|
+
* />
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function Pagination(props: PaginationProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
//# sourceMappingURL=Pagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../../../src/components/Pagination/Pagination.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAoB,MAAM,uBAAuB,CAAC;AAgB/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CAiOhD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compute the array of page indices (or `'ellipsis'` sentinels) to
|
|
3
|
+
* render for a `<Pagination>`.
|
|
4
|
+
*
|
|
5
|
+
* Algorithm (standard "siblings + boundaries + ellipsis fill"):
|
|
6
|
+
* 1. Always show `boundaryCount` pages at the start and `boundaryCount`
|
|
7
|
+
* at the end.
|
|
8
|
+
* 2. Show `siblingCount` pages on each side of the current page.
|
|
9
|
+
* 3. Fill gaps wider than 1 with `'ellipsis'`.
|
|
10
|
+
* 4. If a gap is exactly 1 page wide, include that page directly
|
|
11
|
+
* (no ellipsis for a single hidden number).
|
|
12
|
+
*
|
|
13
|
+
* Output is 1-indexed page numbers OR the literal string `'ellipsis'`.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* range(1, 10, 1, 1) // [1, 'ellipsis', 5, 'ellipsis', 10] when current=5
|
|
18
|
+
* range(1, 5, 1, 1) // [1, 2, 3, 4, 5]
|
|
19
|
+
* range(1, 100, 1, 1) // edges varying with current
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function computePageRange(currentPage: number, totalPages: number, siblingCount: number, boundaryCount: number): (number | 'ellipsis')[];
|
|
23
|
+
//# sourceMappingURL=pagination.helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.helpers.d.ts","sourceRoot":"","sources":["../../../../src/components/Pagination/pagination.helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,GACpB,CAAC,MAAM,GAAG,UAAU,CAAC,EAAE,CAsEzB"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { PaginationVariants } from './pagination.variants.js';
|
|
2
|
+
export interface PaginationSlotProps {
|
|
3
|
+
root?: {
|
|
4
|
+
className?: string;
|
|
5
|
+
};
|
|
6
|
+
summary?: {
|
|
7
|
+
className?: string;
|
|
8
|
+
};
|
|
9
|
+
list?: {
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
|
+
pageButton?: {
|
|
13
|
+
className?: string;
|
|
14
|
+
};
|
|
15
|
+
activeButton?: {
|
|
16
|
+
className?: string;
|
|
17
|
+
};
|
|
18
|
+
navButton?: {
|
|
19
|
+
className?: string;
|
|
20
|
+
};
|
|
21
|
+
ellipsis?: {
|
|
22
|
+
className?: string;
|
|
23
|
+
};
|
|
24
|
+
pageSizeSelector?: {
|
|
25
|
+
className?: string;
|
|
26
|
+
};
|
|
27
|
+
jumpInput?: {
|
|
28
|
+
className?: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* I18n strings for `<Pagination>`. Default = English. Override the
|
|
33
|
+
* subset you need to translate; the rest fall back to defaults.
|
|
34
|
+
*/
|
|
35
|
+
export interface PaginationLabels {
|
|
36
|
+
first?: string;
|
|
37
|
+
prev?: string;
|
|
38
|
+
next?: string;
|
|
39
|
+
last?: string;
|
|
40
|
+
page?: string;
|
|
41
|
+
of?: string;
|
|
42
|
+
showing?: string;
|
|
43
|
+
perPage?: string;
|
|
44
|
+
goToPage?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Props for `<Pagination>`.
|
|
48
|
+
*
|
|
49
|
+
* Controlled component: the consumer owns `page` + `pageSize`. The
|
|
50
|
+
* component emits `onPageChange` / `onPageSizeChange` and recomputes
|
|
51
|
+
* the visible page range from `totalCount`.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```tsx
|
|
55
|
+
* const [page, setPage] = useState(1);
|
|
56
|
+
* const [pageSize, setPageSize] = useState(20);
|
|
57
|
+
*
|
|
58
|
+
* <Pagination
|
|
59
|
+
* page={page}
|
|
60
|
+
* pageSize={pageSize}
|
|
61
|
+
* totalCount={1437}
|
|
62
|
+
* onPageChange={setPage}
|
|
63
|
+
* onPageSizeChange={setPageSize}
|
|
64
|
+
* pageSizeOptions={[10, 20, 50, 100]}
|
|
65
|
+
* />
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export interface PaginationProps extends Pick<PaginationVariants, 'variant' | 'size'> {
|
|
69
|
+
/** Current page, **1-indexed**. */
|
|
70
|
+
page: number;
|
|
71
|
+
/** Items per page. */
|
|
72
|
+
pageSize: number;
|
|
73
|
+
/** Total items in the underlying data set (NOT total pages — we compute that). */
|
|
74
|
+
totalCount: number;
|
|
75
|
+
/** Fired when the user picks a different page. */
|
|
76
|
+
onPageChange: (page: number) => void;
|
|
77
|
+
/**
|
|
78
|
+
* Fired when the user picks a different page size. Omit (or pass
|
|
79
|
+
* undefined) to hide the page-size selector.
|
|
80
|
+
*/
|
|
81
|
+
onPageSizeChange?: (pageSize: number) => void;
|
|
82
|
+
/**
|
|
83
|
+
* Options shown in the page-size selector.
|
|
84
|
+
* @default [10, 20, 50, 100]
|
|
85
|
+
*/
|
|
86
|
+
pageSizeOptions?: number[];
|
|
87
|
+
/**
|
|
88
|
+
* How many page buttons to show on each side of the current page.
|
|
89
|
+
* @default 1
|
|
90
|
+
*/
|
|
91
|
+
siblingCount?: number;
|
|
92
|
+
/**
|
|
93
|
+
* How many page buttons to always show at the start/end of the
|
|
94
|
+
* sequence (acts as "boundary"). @default 1
|
|
95
|
+
*/
|
|
96
|
+
boundaryCount?: number;
|
|
97
|
+
/**
|
|
98
|
+
* Show first/last buttons (`«` / `»`). @default true
|
|
99
|
+
*/
|
|
100
|
+
showFirstLast?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Show the direct page-jump input (variant=`default` only).
|
|
103
|
+
* @default true
|
|
104
|
+
*/
|
|
105
|
+
showJumpInput?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Disable all interactive elements (kept rendered but inert).
|
|
108
|
+
*/
|
|
109
|
+
disabled?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* I18n strings. Defaults are English; pass the subset you need
|
|
112
|
+
* to translate.
|
|
113
|
+
*/
|
|
114
|
+
labels?: PaginationLabels;
|
|
115
|
+
/** Root-level Tailwind override. */
|
|
116
|
+
sx?: string;
|
|
117
|
+
/** Per-slot overrides. */
|
|
118
|
+
slotProps?: PaginationSlotProps;
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=pagination.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.types.d.ts","sourceRoot":"","sources":["../../../../src/components/Pagination/pagination.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9B,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjC,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9B,UAAU,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACpC,YAAY,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,SAAS,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,QAAQ,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAClC,gBAAgB,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,SAAS,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,kBAAkB,EAAE,SAAS,GAAG,MAAM,CAAC;IACnF,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IAEb,sBAAsB;IACtB,QAAQ,EAAE,MAAM,CAAC;IAEjB,kFAAkF;IAClF,UAAU,EAAE,MAAM,CAAC;IAEnB,kDAAkD;IAClD,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAErC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAE9C;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAE3B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAE1B,oCAAoC;IACpC,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ,0BAA0B;IAC1B,SAAS,CAAC,EAAE,mBAAmB,CAAC;CACjC"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
2
|
+
/**
|
|
3
|
+
* `<Pagination>` variant recipe.
|
|
4
|
+
*
|
|
5
|
+
* Slots:
|
|
6
|
+
* - `root` — outer `<nav>` container
|
|
7
|
+
* - `summary` — "Showing X-Y of Z" text
|
|
8
|
+
* - `list` — `<ul>` of page buttons
|
|
9
|
+
* - `pageButton` — individual page number button
|
|
10
|
+
* - `activeButton` — modifier applied to the current page
|
|
11
|
+
* - `navButton` — first/prev/next/last buttons
|
|
12
|
+
* - `ellipsis` — `…` rendered when range gap
|
|
13
|
+
* - `pageSizeSelector` — native `<select>` for page size
|
|
14
|
+
* - `jumpInput` — direct page jump `<input>`
|
|
15
|
+
*
|
|
16
|
+
* Variant axes:
|
|
17
|
+
* - `variant` — `default` (full kit) | `compact` (number buttons +
|
|
18
|
+
* prev/next only) | `minimal` ("X / Y pages" + prev/next only).
|
|
19
|
+
* - `size` — `sm` | `md` (default) | `lg`. Drives padding + text
|
|
20
|
+
* size on the buttons.
|
|
21
|
+
*/
|
|
22
|
+
export declare const paginationVariants: import("tailwind-variants").TVReturnType<{
|
|
23
|
+
variant: {
|
|
24
|
+
default: {};
|
|
25
|
+
compact: {};
|
|
26
|
+
minimal: {};
|
|
27
|
+
};
|
|
28
|
+
size: {
|
|
29
|
+
sm: {
|
|
30
|
+
summary: string;
|
|
31
|
+
pageButton: string;
|
|
32
|
+
navButton: string;
|
|
33
|
+
ellipsis: string;
|
|
34
|
+
pageSizeSelector: string;
|
|
35
|
+
jumpInput: string;
|
|
36
|
+
};
|
|
37
|
+
md: {
|
|
38
|
+
summary: string;
|
|
39
|
+
pageButton: string;
|
|
40
|
+
navButton: string;
|
|
41
|
+
ellipsis: string;
|
|
42
|
+
pageSizeSelector: string;
|
|
43
|
+
jumpInput: string;
|
|
44
|
+
};
|
|
45
|
+
lg: {
|
|
46
|
+
summary: string;
|
|
47
|
+
pageButton: string;
|
|
48
|
+
navButton: string;
|
|
49
|
+
ellipsis: string;
|
|
50
|
+
pageSizeSelector: string;
|
|
51
|
+
jumpInput: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
}, {
|
|
55
|
+
root: string;
|
|
56
|
+
summary: string;
|
|
57
|
+
list: string;
|
|
58
|
+
pageButton: string[];
|
|
59
|
+
activeButton: string[];
|
|
60
|
+
navButton: string[];
|
|
61
|
+
ellipsis: string;
|
|
62
|
+
pageSizeSelector: string[];
|
|
63
|
+
jumpInput: string[];
|
|
64
|
+
}, undefined, {
|
|
65
|
+
variant: {
|
|
66
|
+
default: {};
|
|
67
|
+
compact: {};
|
|
68
|
+
minimal: {};
|
|
69
|
+
};
|
|
70
|
+
size: {
|
|
71
|
+
sm: {
|
|
72
|
+
summary: string;
|
|
73
|
+
pageButton: string;
|
|
74
|
+
navButton: string;
|
|
75
|
+
ellipsis: string;
|
|
76
|
+
pageSizeSelector: string;
|
|
77
|
+
jumpInput: string;
|
|
78
|
+
};
|
|
79
|
+
md: {
|
|
80
|
+
summary: string;
|
|
81
|
+
pageButton: string;
|
|
82
|
+
navButton: string;
|
|
83
|
+
ellipsis: string;
|
|
84
|
+
pageSizeSelector: string;
|
|
85
|
+
jumpInput: string;
|
|
86
|
+
};
|
|
87
|
+
lg: {
|
|
88
|
+
summary: string;
|
|
89
|
+
pageButton: string;
|
|
90
|
+
navButton: string;
|
|
91
|
+
ellipsis: string;
|
|
92
|
+
pageSizeSelector: string;
|
|
93
|
+
jumpInput: string;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
}, {
|
|
97
|
+
root: string;
|
|
98
|
+
summary: string;
|
|
99
|
+
list: string;
|
|
100
|
+
pageButton: string[];
|
|
101
|
+
activeButton: string[];
|
|
102
|
+
navButton: string[];
|
|
103
|
+
ellipsis: string;
|
|
104
|
+
pageSizeSelector: string[];
|
|
105
|
+
jumpInput: string[];
|
|
106
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
107
|
+
variant: {
|
|
108
|
+
default: {};
|
|
109
|
+
compact: {};
|
|
110
|
+
minimal: {};
|
|
111
|
+
};
|
|
112
|
+
size: {
|
|
113
|
+
sm: {
|
|
114
|
+
summary: string;
|
|
115
|
+
pageButton: string;
|
|
116
|
+
navButton: string;
|
|
117
|
+
ellipsis: string;
|
|
118
|
+
pageSizeSelector: string;
|
|
119
|
+
jumpInput: string;
|
|
120
|
+
};
|
|
121
|
+
md: {
|
|
122
|
+
summary: string;
|
|
123
|
+
pageButton: string;
|
|
124
|
+
navButton: string;
|
|
125
|
+
ellipsis: string;
|
|
126
|
+
pageSizeSelector: string;
|
|
127
|
+
jumpInput: string;
|
|
128
|
+
};
|
|
129
|
+
lg: {
|
|
130
|
+
summary: string;
|
|
131
|
+
pageButton: string;
|
|
132
|
+
navButton: string;
|
|
133
|
+
ellipsis: string;
|
|
134
|
+
pageSizeSelector: string;
|
|
135
|
+
jumpInput: string;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
}, {
|
|
139
|
+
root: string;
|
|
140
|
+
summary: string;
|
|
141
|
+
list: string;
|
|
142
|
+
pageButton: string[];
|
|
143
|
+
activeButton: string[];
|
|
144
|
+
navButton: string[];
|
|
145
|
+
ellipsis: string;
|
|
146
|
+
pageSizeSelector: string[];
|
|
147
|
+
jumpInput: string[];
|
|
148
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
149
|
+
export type PaginationVariants = VariantProps<typeof paginationVariants>;
|
|
150
|
+
//# sourceMappingURL=pagination.variants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.variants.d.ts","sourceRoot":"","sources":["../../../../src/components/Pagination/pagination.variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAsF7B,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,YAAY,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { SkeletonProps } from './skeleton.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Dashforge TW `<Skeleton>` — loading placeholder primitive.
|
|
4
|
+
*
|
|
5
|
+
* Renders as a non-interactive `<span aria-hidden="true">` so screen
|
|
6
|
+
* readers skip it. The surrounding component is responsible for
|
|
7
|
+
* announcing loading state via `aria-busy` or `aria-live` if needed.
|
|
8
|
+
*
|
|
9
|
+
* Variants:
|
|
10
|
+
* - `variant` — `text` (default, line shape) / `rectangle` / `circle`
|
|
11
|
+
* - `animation` — `pulse` (default) / `wave` / `none`
|
|
12
|
+
*
|
|
13
|
+
* Both animations are gated by `prefers-reduced-motion` (WCAG 2.3.3).
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <Skeleton variant="text" width="200px" />
|
|
18
|
+
* <Skeleton variant="rectangle" width="100%" height="120px" />
|
|
19
|
+
* <Skeleton variant="circle" width="40px" />
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function Skeleton(props: SkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
//# sourceMappingURL=Skeleton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Skeleton.d.ts","sourceRoot":"","sources":["../../../../src/components/Skeleton/Skeleton.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,2CAuB5C"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { SkeletonVariants } from './skeleton.variants.js';
|
|
2
|
+
export interface SkeletonSlotProps {
|
|
3
|
+
/** Root element override. */
|
|
4
|
+
root?: {
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Props for `<Skeleton>`.
|
|
10
|
+
*
|
|
11
|
+
* Visual loading placeholder shown while data / images / components
|
|
12
|
+
* are being prepared. Three shapes (`variant`), three animations
|
|
13
|
+
* (`animation`), and free-form `width` / `height` for arbitrary
|
|
14
|
+
* dimensions.
|
|
15
|
+
*
|
|
16
|
+
* Rendered as a non-interactive `<span aria-hidden="true">` so screen
|
|
17
|
+
* readers skip it entirely.
|
|
18
|
+
*
|
|
19
|
+
* Compose by nesting: e.g. avatar + two text lines for a card
|
|
20
|
+
* placeholder.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <Skeleton variant="text" width="200px" />
|
|
25
|
+
* <Skeleton variant="rectangle" width="100%" height="120px" />
|
|
26
|
+
* <Skeleton variant="circle" width="40px" />
|
|
27
|
+
*
|
|
28
|
+
* // Compose to mimic a card shape
|
|
29
|
+
* <div className="flex gap-3">
|
|
30
|
+
* <Skeleton variant="circle" width="48px" />
|
|
31
|
+
* <div className="flex flex-col gap-2 flex-1">
|
|
32
|
+
* <Skeleton variant="text" width="60%" />
|
|
33
|
+
* <Skeleton variant="text" width="40%" />
|
|
34
|
+
* </div>
|
|
35
|
+
* </div>
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export interface SkeletonProps extends Pick<SkeletonVariants, 'variant' | 'animation'> {
|
|
39
|
+
/**
|
|
40
|
+
* CSS width (e.g. `"200px"`, `"100%"`, `"60%"`).
|
|
41
|
+
*
|
|
42
|
+
* Defaults: `text` → `100%`, `rectangle` → `100%`, `circle` → `40px`.
|
|
43
|
+
*/
|
|
44
|
+
width?: string;
|
|
45
|
+
/**
|
|
46
|
+
* CSS height (e.g. `"1em"`, `"120px"`).
|
|
47
|
+
*
|
|
48
|
+
* Defaults: `text` → `1em`, `rectangle` → `100px`, `circle` → matches `width`.
|
|
49
|
+
*/
|
|
50
|
+
height?: string;
|
|
51
|
+
/** Root-level Tailwind override (wins via `tailwind-merge`). */
|
|
52
|
+
sx?: string;
|
|
53
|
+
/** Per-slot overrides. */
|
|
54
|
+
slotProps?: SkeletonSlotProps;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=skeleton.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skeleton.types.d.ts","sourceRoot":"","sources":["../../../../src/components/Skeleton/skeleton.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,MAAM,WAAW,iBAAiB;IAChC,6BAA6B;IAC7B,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,aACf,SAAQ,IAAI,CAAC,gBAAgB,EAAE,SAAS,GAAG,WAAW,CAAC;IACvD;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,gEAAgE;IAChE,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ,0BAA0B;IAC1B,SAAS,CAAC,EAAE,iBAAiB,CAAC;CAC/B"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
2
|
+
/**
|
|
3
|
+
* `<Skeleton>` variant recipe.
|
|
4
|
+
*
|
|
5
|
+
* Slots:
|
|
6
|
+
* - `root` — single element (atomic component)
|
|
7
|
+
*
|
|
8
|
+
* Variant axes:
|
|
9
|
+
* - `variant` (`text` | `rectangle` | `circle`) — shape / radius
|
|
10
|
+
* - `animation` (`pulse` | `wave` | `none`) — how the placeholder
|
|
11
|
+
* "breathes" while data loads. Always gated on
|
|
12
|
+
* `prefers-reduced-motion` (no exception — animations are
|
|
13
|
+
* purely cosmetic).
|
|
14
|
+
*
|
|
15
|
+
* Implementation notes:
|
|
16
|
+
*
|
|
17
|
+
* - `pulse` uses Tailwind's built-in `animate-pulse` (opacity
|
|
18
|
+
* 1.0 ↔ 0.5 over 2s, ease-in-out infinite).
|
|
19
|
+
* - `wave` overlays a moving gradient. Implemented with a
|
|
20
|
+
* `relative` container + an `::after` pseudo-element via a
|
|
21
|
+
* Tailwind arbitrary-value class. The gradient slides
|
|
22
|
+
* horizontally over the surface, mimicking the MUI Skeleton
|
|
23
|
+
* "wave" look.
|
|
24
|
+
* - Color uses neutral-200 (light) and neutral-800 (dark) for
|
|
25
|
+
* the base, picked up automatically by the dashforge preset's
|
|
26
|
+
* CSS-variable layer.
|
|
27
|
+
*
|
|
28
|
+
* Accessibility: the root has `aria-hidden="true"` (set on the JSX
|
|
29
|
+
* side, not here). Screen readers skip the skeleton entirely;
|
|
30
|
+
* the surrounding component is responsible for announcing
|
|
31
|
+
* loading state via `aria-busy` or `aria-live` if needed.
|
|
32
|
+
*/
|
|
33
|
+
export declare const skeletonVariants: import("tailwind-variants").TVReturnType<{
|
|
34
|
+
variant: {
|
|
35
|
+
text: {
|
|
36
|
+
root: string;
|
|
37
|
+
};
|
|
38
|
+
rectangle: {
|
|
39
|
+
root: string;
|
|
40
|
+
};
|
|
41
|
+
circle: {
|
|
42
|
+
root: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
animation: {
|
|
46
|
+
pulse: {
|
|
47
|
+
root: string;
|
|
48
|
+
};
|
|
49
|
+
wave: {
|
|
50
|
+
root: string[];
|
|
51
|
+
};
|
|
52
|
+
none: {
|
|
53
|
+
root: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
}, {
|
|
57
|
+
root: string[];
|
|
58
|
+
}, undefined, {
|
|
59
|
+
variant: {
|
|
60
|
+
text: {
|
|
61
|
+
root: string;
|
|
62
|
+
};
|
|
63
|
+
rectangle: {
|
|
64
|
+
root: string;
|
|
65
|
+
};
|
|
66
|
+
circle: {
|
|
67
|
+
root: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
animation: {
|
|
71
|
+
pulse: {
|
|
72
|
+
root: string;
|
|
73
|
+
};
|
|
74
|
+
wave: {
|
|
75
|
+
root: string[];
|
|
76
|
+
};
|
|
77
|
+
none: {
|
|
78
|
+
root: string;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
}, {
|
|
82
|
+
root: string[];
|
|
83
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
84
|
+
variant: {
|
|
85
|
+
text: {
|
|
86
|
+
root: string;
|
|
87
|
+
};
|
|
88
|
+
rectangle: {
|
|
89
|
+
root: string;
|
|
90
|
+
};
|
|
91
|
+
circle: {
|
|
92
|
+
root: string;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
animation: {
|
|
96
|
+
pulse: {
|
|
97
|
+
root: string;
|
|
98
|
+
};
|
|
99
|
+
wave: {
|
|
100
|
+
root: string[];
|
|
101
|
+
};
|
|
102
|
+
none: {
|
|
103
|
+
root: string;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
}, {
|
|
107
|
+
root: string[];
|
|
108
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
109
|
+
export type SkeletonVariants = VariantProps<typeof skeletonVariants>;
|
|
110
|
+
//# sourceMappingURL=skeleton.variants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skeleton.variants.d.ts","sourceRoot":"","sources":["../../../../src/components/Skeleton/skeleton.variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAkD3B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { TableProps } from './table.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Dashforge TW `<Table>` — declarative-first, market-grounded table.
|
|
4
|
+
*
|
|
5
|
+
* Design references:
|
|
6
|
+
* - Visual: Stripe (clean line dividers, hover row actions, sticky header)
|
|
7
|
+
* - Density: Pencil & Paper UX research (compact / comfortable / spacious)
|
|
8
|
+
* - A11Y: W3C WAI Table tutorial (semantic `<table>`, scope, aria-sort)
|
|
9
|
+
* - Column model: extended from Dashforge MUI Table existing API
|
|
10
|
+
*
|
|
11
|
+
* Smart defaults: column types auto-detected → numbers right-aligned
|
|
12
|
+
* + tabular-nums, dates monospace, booleans center-aligned. Override
|
|
13
|
+
* via explicit `align` / `monospace` per column.
|
|
14
|
+
*
|
|
15
|
+
* State (sort / search / filter / selection / expansion) is internal
|
|
16
|
+
* by default; pass the controlled prop + matching change handler to
|
|
17
|
+
* lift state up — same pattern as `<TextField>` value.
|
|
18
|
+
*
|
|
19
|
+
* i18n: pass `header: t('users.name')` for column headers; pass
|
|
20
|
+
* `labels={{ searchPlaceholder: t('...'), ... }}` for internal default
|
|
21
|
+
* strings.
|
|
22
|
+
*/
|
|
23
|
+
export declare function Table<T extends object>(props: TableProps<T>): import("react/jsx-runtime").JSX.Element | null;
|
|
24
|
+
//# sourceMappingURL=Table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../../src/components/Table/Table.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EACV,UAAU,EAKX,MAAM,kBAAkB,CAAC;AA0B1B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,kDAgW3D"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Walk a dotted path through an object and return the value, or
|
|
3
|
+
* `undefined` if any segment is missing / nullish.
|
|
4
|
+
*
|
|
5
|
+
* Bug fix from the MUI-side Table (Sprint 4.1 motivation): the
|
|
6
|
+
* existing wrapper typed `field: NestedKeyOf<T>` but performed a
|
|
7
|
+
* flat `row[col.field]` lookup at runtime — nested keys silently
|
|
8
|
+
* returned `undefined`. This helper makes the runtime match the
|
|
9
|
+
* type contract.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* getNestedValue({ user: { name: 'Jane' } }, 'user.name') // 'Jane'
|
|
14
|
+
* getNestedValue({ user: null }, 'user.name') // undefined
|
|
15
|
+
* getNestedValue({}, 'a.b.c') // undefined
|
|
16
|
+
* getNestedValue({ a: { b: 0 } }, 'a.b') // 0 (NOT undefined)
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function getNestedValue<T extends object>(row: T, path: string): unknown;
|
|
20
|
+
//# sourceMappingURL=getNestedValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getNestedValue.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/_internal/getNestedValue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAC7C,GAAG,EAAE,CAAC,EACN,IAAI,EAAE,MAAM,GACX,OAAO,CAUT"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { TableColumn, TableColumnInferredType } from '../table.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Auto-detects the primitive type of each column by scanning the
|
|
4
|
+
* first non-null value across the supplied rows. Drives smart
|
|
5
|
+
* defaults for `align` and `monospace` on the cell render path.
|
|
6
|
+
*
|
|
7
|
+
* Scans only the first N rows (default 50) for performance — if the
|
|
8
|
+
* dataset's first 50 rows are unrepresentative, the consumer can
|
|
9
|
+
* override per-column via explicit `align` / `monospace` props.
|
|
10
|
+
*
|
|
11
|
+
* Returns `Map<columnField, inferredType>`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useColumnAutoDetect<T extends object>(rows: T[], cols: TableColumn<T>[], sampleSize?: number): Map<string, TableColumnInferredType>;
|
|
14
|
+
/**
|
|
15
|
+
* Resolves the effective `align` for a column, honoring explicit
|
|
16
|
+
* `col.align` first and falling back to the inferred type.
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveAlign(col: {
|
|
19
|
+
align?: 'left' | 'right' | 'center';
|
|
20
|
+
}, inferred: TableColumnInferredType | undefined): 'left' | 'right' | 'center';
|
|
21
|
+
/**
|
|
22
|
+
* Resolves the effective `tabularNums` flag for a column.
|
|
23
|
+
*
|
|
24
|
+
* `tabular-nums` is a `font-variant-numeric` rule that makes every
|
|
25
|
+
* digit occupy the same width — it does NOT change the font family.
|
|
26
|
+
* Auto-applied for `number` and `date` columns so currency values
|
|
27
|
+
* and ISO dates align cleanly. Explicit `col.tabularNums` wins.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveTabularNums(col: {
|
|
30
|
+
tabularNums?: boolean;
|
|
31
|
+
}, inferred: TableColumnInferredType | undefined): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Resolves the effective `monospace` flag for a column.
|
|
34
|
+
*
|
|
35
|
+
* `font-mono` changes the font FAMILY to a monospace stack, which
|
|
36
|
+
* would override the consumer's theme `font-sans`. The library
|
|
37
|
+
* never auto-applies it — only an explicit `col.monospace: true`
|
|
38
|
+
* opts in. Consumers wanting a custom mono stack configure it
|
|
39
|
+
* through Tailwind's `theme.extend.fontFamily.mono` in their own
|
|
40
|
+
* preset (the dashforgePreset does not own the `fontFamily` axis).
|
|
41
|
+
*/
|
|
42
|
+
export declare function resolveMonospace(col: {
|
|
43
|
+
monospace?: boolean;
|
|
44
|
+
}): boolean;
|
|
45
|
+
//# sourceMappingURL=useColumnAutoDetect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useColumnAutoDetect.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/_internal/useColumnAutoDetect.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE9E;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,EAClD,IAAI,EAAE,CAAC,EAAE,EACT,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,EACtB,UAAU,SAAK,GACd,GAAG,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAiBtC;AAcD;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;CAAE,EAC5C,QAAQ,EAAE,uBAAuB,GAAG,SAAS,GAC5C,MAAM,GAAG,OAAO,GAAG,QAAQ,CAU7B;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,EAC9B,QAAQ,EAAE,uBAAuB,GAAG,SAAS,GAC5C,OAAO,CAGT;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GAC3B,OAAO,CAET"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic "controllable" state hook — switches between controlled
|
|
3
|
+
* (via parent-supplied value + setter) and uncontrolled (internal
|
|
4
|
+
* `useState`).
|
|
5
|
+
*
|
|
6
|
+
* - If `controlledValue !== undefined`, the hook is in **controlled**
|
|
7
|
+
* mode: the internal state is ignored; the returned setter calls
|
|
8
|
+
* `onControlledChange` only.
|
|
9
|
+
* - Otherwise it's in **uncontrolled** mode: internal `useState`,
|
|
10
|
+
* defaulting to `defaultValue`. The optional `onControlledChange`
|
|
11
|
+
* is still fired on every change so the parent can react.
|
|
12
|
+
*
|
|
13
|
+
* The control mode is determined per-render. Mixing modes (passing
|
|
14
|
+
* `controlledValue` undefined sometimes) is a consumer bug — we don't
|
|
15
|
+
* try to "remember" the last mode (React's rules-of-hooks make that
|
|
16
|
+
* unsafe).
|
|
17
|
+
*/
|
|
18
|
+
export declare function useControllableState<T>(args: {
|
|
19
|
+
controlledValue: T | undefined;
|
|
20
|
+
defaultValue: T;
|
|
21
|
+
onChange?: (value: T) => void;
|
|
22
|
+
}): [T, (next: T | ((prev: T) => T)) => void];
|
|
23
|
+
//# sourceMappingURL=useControllableState.d.ts.map
|