@harpercollins/harpercollins-design-system 1.32.0 → 1.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/data-display/Table/Table.cjs +1 -1
- package/dist/cjs/components/data-display/Table/Table.styles.cjs +2 -2
- package/dist/cjs/components/data-display/Table/TableHeader.cjs +1 -0
- package/dist/cjs/components/data-display/Table/TableToolbar.cjs +1 -1
- package/dist/cjs/components/data-display/Table/tableUrlUtils.cjs +1 -0
- package/dist/cjs/components/feedback/LinearProgress/LinearProgress.cjs +1 -0
- package/dist/cjs/hooks/useServerSideTableState.cjs +1 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/LinearProgress/LinearProgress.cjs +29 -0
- package/dist/cjs/node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/LinearProgress/linearProgressClasses.cjs +1 -0
- package/dist/esm/components/data-display/Table/Table.js +226 -277
- package/dist/esm/components/data-display/Table/Table.styles.js +4 -5
- package/dist/esm/components/data-display/Table/TableHeader.js +92 -0
- package/dist/esm/components/data-display/Table/TableToolbar.js +10 -8
- package/dist/esm/components/data-display/Table/tableUrlUtils.js +108 -0
- package/dist/esm/components/feedback/LinearProgress/LinearProgress.js +8 -0
- package/dist/esm/hooks/useServerSideTableState.js +47 -0
- package/dist/esm/index.js +184 -178
- package/dist/esm/node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/LinearProgress/LinearProgress.js +262 -0
- package/dist/esm/node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/LinearProgress/linearProgressClasses.js +8 -0
- package/dist/index.d.ts +128 -1
- package/package.json +1 -1
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import R from "../../../../../@babel_runtime@7.29.2/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js";
|
|
2
|
+
import a from "../../../../../@babel_runtime@7.29.2/node_modules/@babel/runtime/helpers/esm/extends.js";
|
|
3
|
+
import * as $ from "react";
|
|
4
|
+
import r from "../../../../../../../_virtual/index.js";
|
|
5
|
+
import { clsx as O } from "../../../../../clsx@2.1.1/node_modules/clsx/dist/clsx.js";
|
|
6
|
+
import W from "../styles/styled.js";
|
|
7
|
+
import M from "../styles/useThemeProps.js";
|
|
8
|
+
import { getLinearProgressUtilityClass as j } from "./linearProgressClasses.js";
|
|
9
|
+
import N from "../utils/useSlot.js";
|
|
10
|
+
import { resolveSxValue as I } from "../styles/styleUtils.js";
|
|
11
|
+
import { jsx as E } from "react/jsx-runtime";
|
|
12
|
+
import d from "../../../../../@mui_utils@5.17.1_@types_react@18.3.28_react@18.3.1/node_modules/@mui/utils/esm/capitalize/capitalize.js";
|
|
13
|
+
import H from "../../../../../@mui_utils@5.17.1_@types_react@18.3.28_react@18.3.1/node_modules/@mui/utils/esm/composeClasses/composeClasses.js";
|
|
14
|
+
import { css as J, keyframes as U } from "../../../../../@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1/node_modules/@emotion/react/dist/emotion-react.browser.esm.js";
|
|
15
|
+
const V = ["children", "className", "component", "color", "size", "variant", "thickness", "determinate", "value", "style", "slots", "slotProps"];
|
|
16
|
+
let P = (s) => s, m, v;
|
|
17
|
+
const B = U(m || (m = P`
|
|
18
|
+
0% {
|
|
19
|
+
left: var(--_LinearProgress-progressInset);
|
|
20
|
+
width: var(--LinearProgress-progressMinWidth);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
25% {
|
|
24
|
+
width: var(--LinearProgress-progressMaxWidth);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
50% {
|
|
28
|
+
left: var(--_LinearProgress-progressLeft);
|
|
29
|
+
width: var(--LinearProgress-progressMinWidth);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
75% {
|
|
33
|
+
width: var(--LinearProgress-progressMaxWidth);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
100% {
|
|
37
|
+
left: var(--_LinearProgress-progressInset);
|
|
38
|
+
width: var(--LinearProgress-progressMinWidth);
|
|
39
|
+
}
|
|
40
|
+
`)), D = (s) => {
|
|
41
|
+
const {
|
|
42
|
+
determinate: e,
|
|
43
|
+
color: i,
|
|
44
|
+
variant: o,
|
|
45
|
+
size: n
|
|
46
|
+
} = s, t = {
|
|
47
|
+
root: ["root", e && "determinate", i && `color${d(i)}`, o && `variant${d(o)}`, n && `size${d(n)}`]
|
|
48
|
+
};
|
|
49
|
+
return H(t, j, {});
|
|
50
|
+
}, F = W("div", {
|
|
51
|
+
name: "JoyLinearProgress",
|
|
52
|
+
slot: "Root",
|
|
53
|
+
overridesResolver: (s, e) => e.root
|
|
54
|
+
})(({
|
|
55
|
+
ownerState: s,
|
|
56
|
+
theme: e
|
|
57
|
+
}) => {
|
|
58
|
+
var i, o, n, t;
|
|
59
|
+
return a({
|
|
60
|
+
// public variables
|
|
61
|
+
"--LinearProgress-radius": "var(--LinearProgress-thickness)",
|
|
62
|
+
"--LinearProgress-progressThickness": "var(--LinearProgress-thickness)",
|
|
63
|
+
"--LinearProgress-progressRadius": "max(var(--LinearProgress-radius) - var(--_LinearProgress-padding), min(var(--_LinearProgress-padding) / 2, var(--LinearProgress-radius) / 2))"
|
|
64
|
+
}, s.size === "sm" && {
|
|
65
|
+
"--LinearProgress-thickness": "4px"
|
|
66
|
+
}, s.size === "md" && {
|
|
67
|
+
"--LinearProgress-thickness": "6px"
|
|
68
|
+
}, s.size === "lg" && {
|
|
69
|
+
"--LinearProgress-thickness": "8px"
|
|
70
|
+
}, s.thickness && {
|
|
71
|
+
"--LinearProgress-thickness": `${s.thickness}px`
|
|
72
|
+
}, !s.determinate && {
|
|
73
|
+
"--LinearProgress-progressMinWidth": "calc(var(--LinearProgress-percent) * 1% / 2)",
|
|
74
|
+
"--LinearProgress-progressMaxWidth": "calc(var(--LinearProgress-percent) * 1%)",
|
|
75
|
+
"--_LinearProgress-progressLeft": "calc(100% - var(--LinearProgress-progressMinWidth) - var(--_LinearProgress-progressInset))",
|
|
76
|
+
"--_LinearProgress-progressInset": "calc(var(--LinearProgress-thickness) / 2 - var(--LinearProgress-progressThickness) / 2)"
|
|
77
|
+
}, {
|
|
78
|
+
minBlockSize: "var(--LinearProgress-thickness)",
|
|
79
|
+
boxSizing: "border-box",
|
|
80
|
+
borderRadius: "var(--LinearProgress-radius)",
|
|
81
|
+
display: "flex",
|
|
82
|
+
justifyContent: "center",
|
|
83
|
+
alignItems: "center",
|
|
84
|
+
flex: 1,
|
|
85
|
+
padding: "var(--_LinearProgress-padding)",
|
|
86
|
+
position: "relative"
|
|
87
|
+
}, (i = e.variants[s.variant]) == null ? void 0 : i[s.color], {
|
|
88
|
+
"--_LinearProgress-padding": "max((var(--LinearProgress-thickness) - 2 * var(--variant-borderWidth, 0px) - var(--LinearProgress-progressThickness)) / 2, 0px)",
|
|
89
|
+
"&::before": {
|
|
90
|
+
content: '""',
|
|
91
|
+
display: "block",
|
|
92
|
+
boxSizing: "inherit",
|
|
93
|
+
blockSize: "var(--LinearProgress-progressThickness)",
|
|
94
|
+
borderRadius: "var(--LinearProgress-progressRadius)",
|
|
95
|
+
backgroundColor: "currentColor",
|
|
96
|
+
color: "inherit",
|
|
97
|
+
position: "absolute"
|
|
98
|
+
// required to make `left` animation works.
|
|
99
|
+
}
|
|
100
|
+
}, s.variant === "soft" && {
|
|
101
|
+
backgroundColor: e.variants.soft.neutral.backgroundColor,
|
|
102
|
+
color: (o = e.variants.solid) == null ? void 0 : o[s.color].backgroundColor
|
|
103
|
+
}, s.variant === "solid" && {
|
|
104
|
+
backgroundColor: (n = e.variants.softHover) == null ? void 0 : n[s.color].backgroundColor,
|
|
105
|
+
color: (t = e.variants.solid) == null ? void 0 : t[s.color].backgroundColor
|
|
106
|
+
});
|
|
107
|
+
}, ({
|
|
108
|
+
ownerState: s
|
|
109
|
+
}) => s.determinate ? {
|
|
110
|
+
"&::before": {
|
|
111
|
+
left: "var(--_LinearProgress-padding)",
|
|
112
|
+
inlineSize: "calc(var(--LinearProgress-percent) * 1% - 2 * var(--_LinearProgress-padding))"
|
|
113
|
+
}
|
|
114
|
+
} : J(v || (v = P`
|
|
115
|
+
&::before {
|
|
116
|
+
animation: ${0}
|
|
117
|
+
var(--LinearProgress-circulation, 2.5s ease-in-out 0s infinite normal none running);
|
|
118
|
+
}
|
|
119
|
+
`), B), ({
|
|
120
|
+
ownerState: s,
|
|
121
|
+
theme: e
|
|
122
|
+
}) => {
|
|
123
|
+
const {
|
|
124
|
+
borderRadius: i,
|
|
125
|
+
height: o
|
|
126
|
+
} = I({
|
|
127
|
+
theme: e,
|
|
128
|
+
ownerState: s
|
|
129
|
+
}, ["borderRadius", "height"]);
|
|
130
|
+
return a({}, i !== void 0 && {
|
|
131
|
+
"--LinearProgress-radius": i
|
|
132
|
+
}, o !== void 0 && {
|
|
133
|
+
"--LinearProgress-thickness": o
|
|
134
|
+
});
|
|
135
|
+
}), K = /* @__PURE__ */ $.forwardRef(function(e, i) {
|
|
136
|
+
const o = M({
|
|
137
|
+
props: e,
|
|
138
|
+
name: "JoyLinearProgress"
|
|
139
|
+
}), {
|
|
140
|
+
children: n,
|
|
141
|
+
className: t,
|
|
142
|
+
component: c,
|
|
143
|
+
color: u = "primary",
|
|
144
|
+
size: f = "md",
|
|
145
|
+
variant: L = "soft",
|
|
146
|
+
thickness: h,
|
|
147
|
+
determinate: g = !1,
|
|
148
|
+
value: l = g ? 0 : 25,
|
|
149
|
+
// `25` is the 1/4 of the bar.
|
|
150
|
+
style: b,
|
|
151
|
+
slots: k = {},
|
|
152
|
+
slotProps: y = {}
|
|
153
|
+
} = o, x = R(o, V), p = a({}, o, {
|
|
154
|
+
component: c,
|
|
155
|
+
color: u,
|
|
156
|
+
size: f,
|
|
157
|
+
variant: L,
|
|
158
|
+
thickness: h,
|
|
159
|
+
value: l,
|
|
160
|
+
determinate: g,
|
|
161
|
+
instanceSize: e.size
|
|
162
|
+
}), _ = D(p), z = a({}, x, {
|
|
163
|
+
component: c,
|
|
164
|
+
slots: k,
|
|
165
|
+
slotProps: y
|
|
166
|
+
}), [T, C] = N("root", {
|
|
167
|
+
ref: i,
|
|
168
|
+
className: O(_.root, t),
|
|
169
|
+
elementType: F,
|
|
170
|
+
externalForwardedProps: z,
|
|
171
|
+
ownerState: p,
|
|
172
|
+
additionalProps: a({
|
|
173
|
+
as: c,
|
|
174
|
+
role: "progressbar",
|
|
175
|
+
style: a({}, {
|
|
176
|
+
"--LinearProgress-percent": l
|
|
177
|
+
}, b)
|
|
178
|
+
}, typeof l == "number" && g && {
|
|
179
|
+
"aria-valuenow": Math.round(l)
|
|
180
|
+
})
|
|
181
|
+
});
|
|
182
|
+
return /* @__PURE__ */ E(T, a({}, C, {
|
|
183
|
+
children: n
|
|
184
|
+
}));
|
|
185
|
+
});
|
|
186
|
+
process.env.NODE_ENV !== "production" && (K.propTypes = {
|
|
187
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
188
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
189
|
+
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
190
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
191
|
+
/**
|
|
192
|
+
* @ignore
|
|
193
|
+
*/
|
|
194
|
+
children: r.node,
|
|
195
|
+
/**
|
|
196
|
+
* @ignore
|
|
197
|
+
*/
|
|
198
|
+
className: r.string,
|
|
199
|
+
/**
|
|
200
|
+
* The color of the component. It supports those theme colors that make sense for this component.
|
|
201
|
+
* @default 'primary'
|
|
202
|
+
*/
|
|
203
|
+
color: r.oneOfType([r.oneOf(["danger", "neutral", "primary", "success", "warning"]), r.string]),
|
|
204
|
+
/**
|
|
205
|
+
* The component used for the root node.
|
|
206
|
+
* Either a string to use a HTML element or a component.
|
|
207
|
+
*/
|
|
208
|
+
component: r.elementType,
|
|
209
|
+
/**
|
|
210
|
+
* The boolean to select a variant.
|
|
211
|
+
* Use indeterminate when there is no progress value.
|
|
212
|
+
* @default false
|
|
213
|
+
*/
|
|
214
|
+
determinate: r.bool,
|
|
215
|
+
/**
|
|
216
|
+
* The size of the component.
|
|
217
|
+
* It accepts theme values between 'sm' and 'lg'.
|
|
218
|
+
* @default 'md'
|
|
219
|
+
*/
|
|
220
|
+
size: r.oneOfType([r.oneOf(["sm", "md", "lg"]), r.string]),
|
|
221
|
+
/**
|
|
222
|
+
* The props used for each slot inside.
|
|
223
|
+
* @default {}
|
|
224
|
+
*/
|
|
225
|
+
slotProps: r.shape({
|
|
226
|
+
root: r.oneOfType([r.func, r.object])
|
|
227
|
+
}),
|
|
228
|
+
/**
|
|
229
|
+
* The components used for each slot inside.
|
|
230
|
+
* @default {}
|
|
231
|
+
*/
|
|
232
|
+
slots: r.shape({
|
|
233
|
+
root: r.elementType
|
|
234
|
+
}),
|
|
235
|
+
/**
|
|
236
|
+
* @ignore
|
|
237
|
+
*/
|
|
238
|
+
style: r.object,
|
|
239
|
+
/**
|
|
240
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
241
|
+
*/
|
|
242
|
+
sx: r.oneOfType([r.arrayOf(r.oneOfType([r.func, r.object, r.bool])), r.func, r.object]),
|
|
243
|
+
/**
|
|
244
|
+
* The thickness of the bar.
|
|
245
|
+
*/
|
|
246
|
+
thickness: r.number,
|
|
247
|
+
/**
|
|
248
|
+
* The value of the progress indicator for the determinate variant.
|
|
249
|
+
* Value between 0 and 100.
|
|
250
|
+
*
|
|
251
|
+
* @default determinate ? 0 : 25
|
|
252
|
+
*/
|
|
253
|
+
value: r.number,
|
|
254
|
+
/**
|
|
255
|
+
* The [global variant](https://mui.com/joy-ui/main-features/global-variants/) to use.
|
|
256
|
+
* @default 'soft'
|
|
257
|
+
*/
|
|
258
|
+
variant: r.oneOfType([r.oneOf(["outlined", "plain", "soft", "solid"]), r.string])
|
|
259
|
+
});
|
|
260
|
+
export {
|
|
261
|
+
K as default
|
|
262
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { generateUtilityClass as e, generateUtilityClasses as i } from "../className/index.js";
|
|
2
|
+
function o(r) {
|
|
3
|
+
return e("MuiLinearProgress", r);
|
|
4
|
+
}
|
|
5
|
+
i("MuiLinearProgress", ["root", "determinate", "colorPrimary", "colorNeutral", "colorDanger", "colorSuccess", "colorWarning", "colorContext", "sizeSm", "sizeMd", "sizeLg", "variantPlain", "variantOutlined", "variantSoft", "variantSolid"]);
|
|
6
|
+
export {
|
|
7
|
+
o as getLinearProgressUtilityClass
|
|
8
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ import { CheckboxProps } from '@mui/joy';
|
|
|
20
20
|
import { ChipProps } from '@mui/joy';
|
|
21
21
|
import { CircularProgressProps } from '@mui/joy';
|
|
22
22
|
import { ColorPaletteProp } from '@mui/joy';
|
|
23
|
+
import { ColumnDef } from '@tanstack/react-table';
|
|
24
|
+
import { ColumnFiltersState } from '@tanstack/react-table';
|
|
23
25
|
import { Component } from 'react';
|
|
24
26
|
import { ContainerProps } from '@mui/joy';
|
|
25
27
|
import { default as default_2 } from 'react';
|
|
@@ -46,6 +48,7 @@ import { InputProps } from '@mui/joy';
|
|
|
46
48
|
import { IStyledComponentBase } from 'styled-components/dist/types';
|
|
47
49
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
48
50
|
import { LiHTMLAttributes } from 'react';
|
|
51
|
+
import { LinearProgressProps } from '@mui/joy';
|
|
49
52
|
import { ListDivider } from '@mui/joy';
|
|
50
53
|
import { ListItem } from '@mui/joy';
|
|
51
54
|
import { ListItemButton } from '@mui/joy';
|
|
@@ -62,6 +65,7 @@ import { ModalClose } from '@mui/joy';
|
|
|
62
65
|
import { ModalDialog } from '@mui/joy';
|
|
63
66
|
import { ModalOverflow } from '@mui/joy';
|
|
64
67
|
import { ModalProps } from '@mui/joy';
|
|
68
|
+
import { OnChangeFn } from '@tanstack/react-table';
|
|
65
69
|
import { Option as Option_2 } from '@mui/joy';
|
|
66
70
|
import { PropsWithChildren } from 'react';
|
|
67
71
|
import { RadioGroup } from '@mui/joy';
|
|
@@ -76,6 +80,7 @@ import { SelectProps } from '@mui/joy';
|
|
|
76
80
|
import { SheetProps } from '@mui/joy';
|
|
77
81
|
import { SkeletonProps } from '@mui/joy';
|
|
78
82
|
import { SliderProps } from '@mui/joy';
|
|
83
|
+
import { SortingState } from '@tanstack/react-table';
|
|
79
84
|
import { Step } from '@mui/joy';
|
|
80
85
|
import { StepButton } from '@mui/joy';
|
|
81
86
|
import { StepIndicator } from '@mui/joy';
|
|
@@ -235,6 +240,12 @@ export declare const Drawer: default_2.ForwardRefExoticComponent<Omit<default_2.
|
|
|
235
240
|
|
|
236
241
|
export declare function Dropdown(props: DropdownProps): JSX_2.Element;
|
|
237
242
|
|
|
243
|
+
/**
|
|
244
|
+
* Derives a `columnFilterTypes` map from TanStack Table column definitions by
|
|
245
|
+
* reading each column's `meta.filterType`.
|
|
246
|
+
*/
|
|
247
|
+
export declare function extractColumnFilterTypes(columns: ColumnDef<unknown, unknown>[]): Record<string, ServerSideFilterType>;
|
|
248
|
+
|
|
238
249
|
/**
|
|
239
250
|
* Format currency value to locale and currency
|
|
240
251
|
* @param value - The value to format
|
|
@@ -348,6 +359,8 @@ declare interface LayoutProps {
|
|
|
348
359
|
footerCopyright?: string;
|
|
349
360
|
}
|
|
350
361
|
|
|
362
|
+
export declare function LinearProgress(props: LinearProgressProps): JSX_2.Element;
|
|
363
|
+
|
|
351
364
|
export declare function List(props: ListProps): JSX_2.Element;
|
|
352
365
|
|
|
353
366
|
export { ListDivider }
|
|
@@ -480,6 +493,9 @@ declare interface RelativeTimeProps {
|
|
|
480
493
|
|
|
481
494
|
export declare function Select<TValue extends object>(props: SelectProps<TValue, false>): JSX_2.Element;
|
|
482
495
|
|
|
496
|
+
/** Filter types that affect how URL params are serialized/deserialized. */
|
|
497
|
+
export declare type ServerSideFilterType = "text" | "select" | "multiselect" | "date" | "number";
|
|
498
|
+
|
|
483
499
|
export declare function Sheet(props: SheetProps): JSX_2.Element;
|
|
484
500
|
|
|
485
501
|
export declare function Skeleton(props: SkeletonProps): JSX_2.Element;
|
|
@@ -516,7 +532,7 @@ export { Tab }
|
|
|
516
532
|
|
|
517
533
|
export { tabClasses }
|
|
518
534
|
|
|
519
|
-
export declare function Table<TData = unknown>({ id, loading, maxHeight, wrapText, rowRender, reactTableOptions, gridCheckboxes, allSelected, onSelectionChange, showStickyScrollbar, enableStickyHeader, stickyHeaderOffset, infiniteScroll, toolbar, footer, isError, errorMessage, }: TableProps<TData>): JSX_2.Element;
|
|
535
|
+
export declare function Table<TData = unknown>({ id, loading, maxHeight, wrapText, rowRender, reactTableOptions, gridCheckboxes, allSelected, onSelectionChange, showStickyScrollbar, enableStickyHeader, stickyHeaderOffset, infiniteScroll, toolbar, footer, isError, errorMessage, syncUrl, urlParamPrefix, }: TableProps<TData>): JSX_2.Element;
|
|
520
536
|
|
|
521
537
|
export declare interface TableProps<TData = unknown> {
|
|
522
538
|
id: string;
|
|
@@ -538,6 +554,19 @@ export declare interface TableProps<TData = unknown> {
|
|
|
538
554
|
footer?: boolean;
|
|
539
555
|
isError?: boolean;
|
|
540
556
|
errorMessage?: string | JSX.Element;
|
|
557
|
+
/**
|
|
558
|
+
* When true, the table's sort and filter state is read from and written to
|
|
559
|
+
* the browser's URL query string via `window.history.replaceState`.
|
|
560
|
+
* Intended for client-side tables — for server-side tables use
|
|
561
|
+
* `useServerSideTableState({ syncUrl: true })` instead.
|
|
562
|
+
*/
|
|
563
|
+
syncUrl?: boolean;
|
|
564
|
+
/**
|
|
565
|
+
* Namespace prefix for URL params when `syncUrl` is true. Required when
|
|
566
|
+
* more than one table on the same page needs URL sync to avoid key
|
|
567
|
+
* collisions. e.g. prefix "products" turns "sort_by" → "products_sort_by".
|
|
568
|
+
*/
|
|
569
|
+
urlParamPrefix?: string;
|
|
541
570
|
}
|
|
542
571
|
|
|
543
572
|
export declare interface TableToolbarOptions {
|
|
@@ -691,6 +720,104 @@ export declare const useNavigationProgress: () => NavigationProgressContextType;
|
|
|
691
720
|
*/
|
|
692
721
|
export declare function useSentryFeedbackOpen(): boolean;
|
|
693
722
|
|
|
723
|
+
/**
|
|
724
|
+
* Manages server-side sorting and filtering state for a TanStack Table.
|
|
725
|
+
*
|
|
726
|
+
* Returns TanStack-compatible state/callbacks plus pre-built query param
|
|
727
|
+
* strings (`sortParams`, `filterParams`) ready to append to API URLs.
|
|
728
|
+
*
|
|
729
|
+
* When `syncUrl` is `true` the current sort/filter state is reflected in the
|
|
730
|
+
* browser's address bar via `history.replaceState`, enabling deep-linkable
|
|
731
|
+
* tables without polluting the browser history stack.
|
|
732
|
+
*
|
|
733
|
+
* @example
|
|
734
|
+
* ```tsx
|
|
735
|
+
* const columns = useMemo(() => buildColumns(options), [options]);
|
|
736
|
+
*
|
|
737
|
+
* const { sorting, onSortingChange, columnFilters, onColumnFiltersChange, sortParams, filterParams } =
|
|
738
|
+
* useServerSideTableState({ syncUrl: true, columns });
|
|
739
|
+
*
|
|
740
|
+
* const { data } = useMyQuery(sortParams, filterParams);
|
|
741
|
+
*
|
|
742
|
+
* <Table
|
|
743
|
+
* reactTableOptions={{
|
|
744
|
+
* columns,
|
|
745
|
+
* manualSorting: true,
|
|
746
|
+
* manualFiltering: true,
|
|
747
|
+
* onSortingChange,
|
|
748
|
+
* onColumnFiltersChange,
|
|
749
|
+
* state: { sorting, columnFilters },
|
|
750
|
+
* }}
|
|
751
|
+
* />
|
|
752
|
+
* ```
|
|
753
|
+
*/
|
|
754
|
+
export declare const useServerSideTableState: (options?: UseServerSideTableStateOptions) => UseServerSideTableStateResult;
|
|
755
|
+
|
|
756
|
+
export declare interface UseServerSideTableStateOptions {
|
|
757
|
+
/** Initial sort column ID. */
|
|
758
|
+
initialSortField?: string;
|
|
759
|
+
/** Initial sort direction. Defaults to "asc". */
|
|
760
|
+
initialSortDirection?: "asc" | "desc";
|
|
761
|
+
/**
|
|
762
|
+
* When true, sorting and filtering state is read from and written to the
|
|
763
|
+
* browser's URL query string via `window.history.replaceState`, enabling
|
|
764
|
+
* shareable deep-links to a pre-filtered table.
|
|
765
|
+
*/
|
|
766
|
+
syncUrl?: boolean;
|
|
767
|
+
/**
|
|
768
|
+
* Namespace prefix for URL params. Required when more than one table on the
|
|
769
|
+
* same page needs URL sync to avoid key collisions.
|
|
770
|
+
* e.g. prefix "assets" turns "sortBy" → "assets_sortBy".
|
|
771
|
+
*
|
|
772
|
+
* Note: sortParams / filterParams returned by this hook are always
|
|
773
|
+
* unprefixed, regardless of the prefix used in the URL bar.
|
|
774
|
+
*/
|
|
775
|
+
urlParamPrefix?: string;
|
|
776
|
+
/**
|
|
777
|
+
* The same column definitions passed to the Table component. Used to
|
|
778
|
+
* automatically derive filter type information (via `meta.filterType`) for
|
|
779
|
+
* correct URL param serialization and deserialization.
|
|
780
|
+
*
|
|
781
|
+
* When provided, takes precedence over `columnFilterTypes`.
|
|
782
|
+
*/
|
|
783
|
+
columns?: ColumnDef<unknown, unknown>[];
|
|
784
|
+
/**
|
|
785
|
+
* Manual filter type map. Prefer passing `columns` instead — use this only
|
|
786
|
+
* when column definitions are not available.
|
|
787
|
+
*
|
|
788
|
+
* Maps column IDs to their filter type so URL params can be correctly
|
|
789
|
+
* deserialized back to TanStack Table filter state on page load.
|
|
790
|
+
* Columns not listed default to "text" (single string value).
|
|
791
|
+
* - "multiselect" → value serialized as comma-separated string, parsed back as string[]
|
|
792
|
+
* - "date" | "number" → value serialized as `<colId>_gte` / `<colId>_lte` pairs,
|
|
793
|
+
* parsed back as `{ min, max }` range object
|
|
794
|
+
*/
|
|
795
|
+
columnFilterTypes?: Record<string, ServerSideFilterType>;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
export declare interface UseServerSideTableStateResult {
|
|
799
|
+
/** Pass to `reactTableOptions.state.sorting`. */
|
|
800
|
+
sorting: SortingState;
|
|
801
|
+
/** Pass to `reactTableOptions.onSortingChange`. */
|
|
802
|
+
onSortingChange: OnChangeFn<SortingState>;
|
|
803
|
+
/** Pass to `reactTableOptions.state.columnFilters`. */
|
|
804
|
+
columnFilters: ColumnFiltersState;
|
|
805
|
+
/** Pass to `reactTableOptions.onColumnFiltersChange`. */
|
|
806
|
+
onColumnFiltersChange: OnChangeFn<ColumnFiltersState>;
|
|
807
|
+
/**
|
|
808
|
+
* Sort query string (always unprefixed).
|
|
809
|
+
* e.g. `"&sort_by=review_status&sort_order=asc"` or `""` when unsorted.
|
|
810
|
+
* Append directly to your API request URL.
|
|
811
|
+
*/
|
|
812
|
+
sortParams: string;
|
|
813
|
+
/**
|
|
814
|
+
* Filter query string (always unprefixed).
|
|
815
|
+
* e.g. `"&review_status=approved&title=foo"` or `""` when unfiltered.
|
|
816
|
+
* Append directly to your API request URL.
|
|
817
|
+
*/
|
|
818
|
+
filterParams: string;
|
|
819
|
+
}
|
|
820
|
+
|
|
694
821
|
/**
|
|
695
822
|
* A hook to toggle a boolean value.
|
|
696
823
|
* @param initialState The initial state of the toggle.
|