@dmsi/wedgekit-react 0.0.81 → 0.0.83
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/{chunk-6R2HCLEL.js → chunk-37TJJQL3.js} +2 -2
- package/dist/{chunk-B6PDZCU7.js → chunk-5GUW4DUY.js} +1 -1
- package/dist/{chunk-ATOEGP3V.js → chunk-CKSDMI2Q.js} +14 -7
- package/dist/{chunk-2DCVAATK.js → chunk-MQWWNAO3.js} +4 -4
- package/dist/{chunk-FOC6LTSX.js → chunk-UPBBOZM3.js} +1 -1
- package/dist/{chunk-SWA5WVQO.js → chunk-WNQ53SVY.js} +30 -0
- package/dist/components/DataGridCell.cjs +53 -43
- package/dist/components/DataGridCell.js +5 -5
- package/dist/components/Menu.cjs +17 -14
- package/dist/components/Menu.js +3 -3
- package/dist/components/MenuOption.cjs +10 -7
- package/dist/components/MenuOption.js +2 -2
- package/dist/components/Modal.cjs +18 -15
- package/dist/components/Modal.js +3 -3
- package/dist/components/NestedMenu.cjs +12 -9
- package/dist/components/NestedMenu.js +2 -2
- package/dist/components/PDFViewer.cjs +21 -18
- package/dist/components/PDFViewer.js +3 -3
- package/dist/components/ProjectBar.cjs +6 -3
- package/dist/components/ProjectBar.js +1 -1
- package/dist/components/TopBar.cjs +1 -1
- package/dist/components/TopBar.js +1 -1
- package/dist/components/{DataGrid.cjs → index.cjs} +1424 -1335
- package/dist/components/{DataGrid.js → index.js} +948 -883
- package/dist/components/useMenuSystem.cjs +20 -17
- package/dist/components/useMenuSystem.js +2 -2
- package/dist/hooks/index.cjs +34 -3
- package/dist/hooks/index.js +3 -1
- package/package.json +6 -1
- package/src/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.tsx +32 -0
- package/src/components/DataGrid/ColumnSelectorHeaderCell/index.tsx +66 -0
- package/src/components/DataGrid/PinnedColumns.tsx +145 -0
- package/src/components/DataGrid/TableBody/LoadingCell.tsx +40 -0
- package/src/components/DataGrid/TableBody/TableBodyRow.tsx +129 -0
- package/src/components/DataGrid/TableBody/index.tsx +159 -0
- package/src/components/{DataGrid.tsx → DataGrid/index.tsx} +42 -678
- package/src/components/DataGrid/types.ts +86 -0
- package/src/components/DataGrid/utils.tsx +15 -0
- package/src/components/DataGridCell.tsx +37 -21
- package/src/components/TopBar.tsx +1 -1
- package/src/components/index.ts +20 -0
- package/src/hooks/index.ts +1 -0
- package/dist/chunk-AWQSSKCK.js +0 -32
- package/dist/components/useInfiniteScroll.cjs +0 -57
- package/dist/components/useInfiniteScroll.js +0 -8
- /package/src/{components → hooks}/useInfiniteScroll.tsx +0 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
"use client";
|
|
3
2
|
var __create = Object.create;
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
5
4
|
var __defProps = Object.defineProperties;
|
|
@@ -57,21 +56,83 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
57
56
|
));
|
|
58
57
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
59
58
|
|
|
60
|
-
// src/components/
|
|
61
|
-
var
|
|
62
|
-
__export(
|
|
63
|
-
|
|
59
|
+
// src/components/index.ts
|
|
60
|
+
var components_exports = {};
|
|
61
|
+
__export(components_exports, {
|
|
62
|
+
Button: () => Button,
|
|
63
|
+
Checkbox: () => Checkbox,
|
|
64
|
+
DataCellHeader: () => DataCellHeader,
|
|
65
|
+
DataGrid: () => DataGrid,
|
|
66
|
+
DataGridCell: () => DataGridCell,
|
|
67
|
+
DragAlongCell: () => DragAlongCell,
|
|
68
|
+
DraggableCellHeader: () => DraggableCellHeader,
|
|
69
|
+
Icon: () => Icon,
|
|
70
|
+
Input: () => Input,
|
|
71
|
+
Label: () => Label,
|
|
72
|
+
Menu: () => Menu,
|
|
73
|
+
MenuOption: () => MenuOption,
|
|
74
|
+
Paragraph: () => Paragraph,
|
|
75
|
+
Search: () => Search,
|
|
76
|
+
Select: () => Select,
|
|
77
|
+
Subheader: () => Subheader,
|
|
78
|
+
Tooltip: () => Tooltip
|
|
64
79
|
});
|
|
65
|
-
module.exports = __toCommonJS(
|
|
66
|
-
var import_react13 = __toESM(require("react"), 1);
|
|
67
|
-
var import_react_table = require("@tanstack/react-table");
|
|
68
|
-
var import_react_virtual = require("@tanstack/react-virtual");
|
|
69
|
-
var import_core = require("@dnd-kit/core");
|
|
70
|
-
var import_sortable2 = require("@dnd-kit/sortable");
|
|
71
|
-
var import_modifiers = require("@dnd-kit/modifiers");
|
|
80
|
+
module.exports = __toCommonJS(components_exports);
|
|
72
81
|
|
|
73
|
-
// src/components/
|
|
74
|
-
var
|
|
82
|
+
// src/components/DataGridCell.tsx
|
|
83
|
+
var import_sortable = require("@dnd-kit/sortable");
|
|
84
|
+
|
|
85
|
+
// ../../node_modules/@dnd-kit/utilities/dist/utilities.esm.js
|
|
86
|
+
var import_react = require("react");
|
|
87
|
+
var canUseDOM = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
88
|
+
var CSS = /* @__PURE__ */ Object.freeze({
|
|
89
|
+
Translate: {
|
|
90
|
+
toString(transform) {
|
|
91
|
+
if (!transform) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const {
|
|
95
|
+
x,
|
|
96
|
+
y
|
|
97
|
+
} = transform;
|
|
98
|
+
return "translate3d(" + (x ? Math.round(x) : 0) + "px, " + (y ? Math.round(y) : 0) + "px, 0)";
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
Scale: {
|
|
102
|
+
toString(transform) {
|
|
103
|
+
if (!transform) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const {
|
|
107
|
+
scaleX,
|
|
108
|
+
scaleY
|
|
109
|
+
} = transform;
|
|
110
|
+
return "scaleX(" + scaleX + ") scaleY(" + scaleY + ")";
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
Transform: {
|
|
114
|
+
toString(transform) {
|
|
115
|
+
if (!transform) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
return [CSS.Translate.toString(transform), CSS.Scale.toString(transform)].join(" ");
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
Transition: {
|
|
122
|
+
toString(_ref) {
|
|
123
|
+
let {
|
|
124
|
+
property,
|
|
125
|
+
duration,
|
|
126
|
+
easing
|
|
127
|
+
} = _ref;
|
|
128
|
+
return property + " " + duration + "ms " + easing;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// src/components/DataGridCell.tsx
|
|
134
|
+
var import_clsx8 = __toESM(require("clsx"), 1);
|
|
135
|
+
var import_react10 = require("react");
|
|
75
136
|
|
|
76
137
|
// src/classNames.ts
|
|
77
138
|
var import_clsx = __toESM(require("clsx"), 1);
|
|
@@ -199,148 +260,9 @@ var gapUsingContainerPadding = (0, import_clsx.default)(
|
|
|
199
260
|
"gap-mobile-container-padding desktop:gap-desktop-container-padding compact:gap-desktop-compact-container-padding"
|
|
200
261
|
);
|
|
201
262
|
|
|
202
|
-
// src/components/Button.tsx
|
|
203
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
204
|
-
var Button = (_a) => {
|
|
205
|
-
var _b = _a, {
|
|
206
|
-
variant = "primary",
|
|
207
|
-
as = "button",
|
|
208
|
-
block,
|
|
209
|
-
leftIcon,
|
|
210
|
-
rightIcon,
|
|
211
|
-
className,
|
|
212
|
-
classNameLabel,
|
|
213
|
-
disabled = false,
|
|
214
|
-
children,
|
|
215
|
-
iconOnly = false,
|
|
216
|
-
colorClassName,
|
|
217
|
-
href,
|
|
218
|
-
id
|
|
219
|
-
} = _b, props = __objRest(_b, [
|
|
220
|
-
"variant",
|
|
221
|
-
"as",
|
|
222
|
-
"block",
|
|
223
|
-
"leftIcon",
|
|
224
|
-
"rightIcon",
|
|
225
|
-
"className",
|
|
226
|
-
"classNameLabel",
|
|
227
|
-
"disabled",
|
|
228
|
-
"children",
|
|
229
|
-
"iconOnly",
|
|
230
|
-
"colorClassName",
|
|
231
|
-
"href",
|
|
232
|
-
"id"
|
|
233
|
-
]);
|
|
234
|
-
const primaryVariantStyles = variant === "primary" && (0, import_clsx2.default)(
|
|
235
|
-
(colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
|
|
236
|
-
"bg-background-action-primary-normal border-background-action-primary-normal",
|
|
237
|
-
"hover:bg-background-action-primary-hover hover:border-background-action-primary-hover",
|
|
238
|
-
"focus:bg-background-action-primary-hover focus:border-background-action-primary-hover focus:outline-0",
|
|
239
|
-
"active:bg-background-action-primary-active active:border-background-action-primary-active",
|
|
240
|
-
"disabled:bg-background-action-primary-disabled disabled:border-background-action-primary-disabled disabled:text-text-on-action-primary-disabled"
|
|
241
|
-
);
|
|
242
|
-
const secondaryVariantStyles = variant === "secondary" && (0, import_clsx2.default)(
|
|
243
|
-
(colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-action-primary-normal",
|
|
244
|
-
"bg-background-action-secondary-normal border-border-action-normal",
|
|
245
|
-
"hover:bg-background-action-secondary-hover hover:border-border-action-hover hover:text-text-action-primary-hover",
|
|
246
|
-
"focus:bg-background-action-secondary-hover focus:border-border-action-hover focus:text-text-action-primary-hover focus:outline-0",
|
|
247
|
-
"active:bg-background-action-secondary-active active:border-border-action-active active:text-text-action-primary-active",
|
|
248
|
-
"disabled:bg-background-action-primary-disabled disabled:border-border-action-disabled disabled:text-text-action-primary-disabled"
|
|
249
|
-
);
|
|
250
|
-
const tertiaryVariantStyles = variant === "tertiary" && (0, import_clsx2.default)(
|
|
251
|
-
"bg-transparent border-transparent",
|
|
252
|
-
iconOnly ? (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-icon-action-primary-normal" : (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-action-primary-normal",
|
|
253
|
-
"bg-transparent border-transparent",
|
|
254
|
-
"hover:bg-background-action-secondary-hover hover:border-background-action-secondary-hover hover:text-text-action-primary-hover",
|
|
255
|
-
"focus:bg-background-action-secondary-hover focus:border-background-action-secondary-hover focus:text-text-action-primary-hover focus:outline-0",
|
|
256
|
-
"active:bg-background-action-secondary-active active:border-transparent active:text-text-action-primary-active",
|
|
257
|
-
"disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
|
|
258
|
-
);
|
|
259
|
-
const primaryCriticalVariantStyles = variant === "primary-critical" && (0, import_clsx2.default)(
|
|
260
|
-
(colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
|
|
261
|
-
"bg-background-action-critical-primary-normal border-background-action-critical-primary-normal",
|
|
262
|
-
"hover:bg-background-action-critical-primary-hover hover:border-background-action-critical-primary-hover",
|
|
263
|
-
"focus:bg-background-action-critical-primary-hover focus:border-background-action-critical-primary-hover focus:outline-0",
|
|
264
|
-
"active:bg-background-action-critical-primary-active active:border-background-action-critical-primary-active",
|
|
265
|
-
"disabled:bg-background-action-critical-primary-disabled disabled:border-background-action-critical-primary-disabled disabled:text-text-on-action-primary-disabled"
|
|
266
|
-
);
|
|
267
|
-
const secondaryCriticalVariantStyles = variant === "secondary-critical" && (0, import_clsx2.default)(
|
|
268
|
-
(colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-action-critical-normal",
|
|
269
|
-
"bg-background-action-critical-secondary-normal border-border-action-critical-normal",
|
|
270
|
-
"hover:bg-background-action-critical-secondary-hover hover:border-border-action-critical-hover hover:text-text-action-critical-hover",
|
|
271
|
-
"focus:bg-background-action-critical-secondary-hover focus:border-border-action-critical-hover focus:text-text-action-critical-hover focus:outline-0",
|
|
272
|
-
"active:bg-background-action-critical-secondary-active active:border-border-action-critical-active active:text-text-action-critical-active",
|
|
273
|
-
"disabled:bg-background-action-critical-disabled disabled:border-border-action-critical-disabled disabled:text-text-action-critical-disabled"
|
|
274
|
-
);
|
|
275
|
-
const tertiaryCriticalVariantStyles = variant === "tertiary-critical" && (0, import_clsx2.default)(
|
|
276
|
-
(colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-action-critical-normal",
|
|
277
|
-
"bg-transparent border-transparent text-text-action-critical-normal",
|
|
278
|
-
"hover:bg-background-action-critical-secondary-hover hover:border-background-action-critical-secondary-hover hover:text-text-action-critical-hover",
|
|
279
|
-
"focus:bg-background-action-critical-secondary-hover focus:border-background-action-critical-secondary-hover focus:text-text-action-critical-hover focus:outline-0",
|
|
280
|
-
"active:bg-background-action-critical-secondary-active active:border-background-action-critical-secondary-active active:text-text-action-critical-active",
|
|
281
|
-
"disabled:bg-transparent disabled:border-transparent disabled:text-text-action-critical-disabled"
|
|
282
|
-
);
|
|
283
|
-
const navigationVarianStyles = variant === "navigation" && (0, import_clsx2.default)(
|
|
284
|
-
(colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
|
|
285
|
-
"bg-transparent",
|
|
286
|
-
"hover:bg-background-on-action-secondary-hover hover:text-brand-text-action-primary-hover",
|
|
287
|
-
// "hover:bg-background-action-secondary-hover hover:text-text-action-primary-hover", // Will use this once colors are finalized
|
|
288
|
-
"focus:bg-background-on-action-secondary-hover focus:text-brand-text-action-primary-hover focus:outline-0",
|
|
289
|
-
// "focus:bg-background-action-secondary-hover focus:text-text-action-primary-hover", // Will use this once colors are finalized
|
|
290
|
-
"active:bg-background-on-action-secondary-active active:text-brand-text-action-primary-active",
|
|
291
|
-
// "active:bg-background-action-secondary-active active:text-text-action-primary-active", // Will use this once colors are finalized
|
|
292
|
-
"disabled:bg-transparent disabled:text-text-on-action-primary-disabled",
|
|
293
|
-
"flex-col",
|
|
294
|
-
paddingUsingComponentGap
|
|
295
|
-
);
|
|
296
|
-
const notNavigationVariantStyles = variant !== "navigation" && (0, import_clsx2.default)("border-2 flex-row", componentPaddingMinus2pxBorder, componentGap);
|
|
297
|
-
const buttonClasses = (0, import_clsx2.default)(
|
|
298
|
-
disabled ? "cursor-default" : "cursor-pointer",
|
|
299
|
-
block ? "w-full" : "w-fit",
|
|
300
|
-
baseTransition,
|
|
301
|
-
"rounded-sm whitespace-nowrap inline-flex items-center justify-center group/btn",
|
|
302
|
-
primaryVariantStyles,
|
|
303
|
-
secondaryVariantStyles,
|
|
304
|
-
tertiaryVariantStyles,
|
|
305
|
-
primaryCriticalVariantStyles,
|
|
306
|
-
secondaryCriticalVariantStyles,
|
|
307
|
-
tertiaryCriticalVariantStyles,
|
|
308
|
-
navigationVarianStyles,
|
|
309
|
-
notNavigationVariantStyles,
|
|
310
|
-
className
|
|
311
|
-
);
|
|
312
|
-
const labelClasses = (0, import_clsx2.default)(
|
|
313
|
-
"min-h-6 flex items-center justify-center",
|
|
314
|
-
classNameLabel,
|
|
315
|
-
componentPaddingXUsingComponentGap,
|
|
316
|
-
typography.buttonLabel
|
|
317
|
-
);
|
|
318
|
-
const Element = href ? "a" : as;
|
|
319
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
320
|
-
Element,
|
|
321
|
-
__spreadProps(__spreadValues({
|
|
322
|
-
id,
|
|
323
|
-
type: Element === "button" ? "button" : void 0,
|
|
324
|
-
className: buttonClasses
|
|
325
|
-
}, props), {
|
|
326
|
-
disabled,
|
|
327
|
-
href,
|
|
328
|
-
children: [
|
|
329
|
-
leftIcon && leftIcon,
|
|
330
|
-
!iconOnly && children && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { id: id ? `${id}-label` : void 0, className: labelClasses, children }),
|
|
331
|
-
rightIcon && rightIcon
|
|
332
|
-
]
|
|
333
|
-
})
|
|
334
|
-
);
|
|
335
|
-
};
|
|
336
|
-
Button.displayName = "Button";
|
|
337
|
-
|
|
338
|
-
// src/components/Checkbox.tsx
|
|
339
|
-
var import_clsx5 = __toESM(require("clsx"), 1);
|
|
340
|
-
|
|
341
263
|
// src/components/Icon.tsx
|
|
342
|
-
var
|
|
343
|
-
var
|
|
264
|
+
var import_clsx2 = __toESM(require("clsx"), 1);
|
|
265
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
344
266
|
function Icon(_a) {
|
|
345
267
|
var _b = _a, {
|
|
346
268
|
name,
|
|
@@ -353,10 +275,10 @@ function Icon(_a) {
|
|
|
353
275
|
]);
|
|
354
276
|
const variantStyle = variant === "filled" ? '"FILL" 1' : '"FILL" 0';
|
|
355
277
|
const weightStyle = size === 16 ? '"wght" 400' : '"wght" 300';
|
|
356
|
-
return /* @__PURE__ */ (0,
|
|
278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
357
279
|
"span",
|
|
358
280
|
__spreadProps(__spreadValues({}, props), {
|
|
359
|
-
className: (0,
|
|
281
|
+
className: (0, import_clsx2.default)(
|
|
360
282
|
"icon",
|
|
361
283
|
`icon-${size}`,
|
|
362
284
|
// size === 16 ? "font-normal" : "font-light", // size 16 font weight is not working as normal from before
|
|
@@ -370,276 +292,53 @@ function Icon(_a) {
|
|
|
370
292
|
);
|
|
371
293
|
}
|
|
372
294
|
|
|
373
|
-
// src/components/
|
|
295
|
+
// src/components/Search.tsx
|
|
296
|
+
var import_react3 = require("react");
|
|
297
|
+
|
|
298
|
+
// src/components/Input.tsx
|
|
299
|
+
var import_react2 = require("react");
|
|
374
300
|
var import_clsx4 = __toESM(require("clsx"), 1);
|
|
375
|
-
|
|
376
|
-
|
|
301
|
+
|
|
302
|
+
// src/components/Label.tsx
|
|
303
|
+
var import_clsx3 = __toESM(require("clsx"), 1);
|
|
304
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
305
|
+
var Label = (_a) => {
|
|
377
306
|
var _b = _a, {
|
|
307
|
+
as = "span",
|
|
308
|
+
padded,
|
|
378
309
|
className,
|
|
379
310
|
color,
|
|
380
|
-
|
|
381
|
-
align = "left",
|
|
382
|
-
tall,
|
|
383
|
-
addOverflow,
|
|
384
|
-
children,
|
|
385
|
-
as = "p",
|
|
311
|
+
align,
|
|
386
312
|
id
|
|
387
313
|
} = _b, props = __objRest(_b, [
|
|
314
|
+
"as",
|
|
315
|
+
"padded",
|
|
388
316
|
"className",
|
|
389
317
|
"color",
|
|
390
|
-
"padded",
|
|
391
318
|
"align",
|
|
392
|
-
"tall",
|
|
393
|
-
"addOverflow",
|
|
394
|
-
"children",
|
|
395
|
-
"as",
|
|
396
319
|
"id"
|
|
397
320
|
]);
|
|
398
321
|
const Element = as;
|
|
399
|
-
return /* @__PURE__ */ (0,
|
|
322
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
400
323
|
Element,
|
|
401
324
|
__spreadProps(__spreadValues({
|
|
402
|
-
id
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
typography.paragraph,
|
|
406
|
-
className,
|
|
407
|
-
padded && componentPaddingXUsingComponentGap,
|
|
325
|
+
id,
|
|
326
|
+
className: (0, import_clsx3.default)(
|
|
327
|
+
typography.label,
|
|
408
328
|
align === "left" && "text-left",
|
|
409
329
|
align === "center" && "text-center",
|
|
410
330
|
align === "right" && "text-right",
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
)
|
|
331
|
+
className,
|
|
332
|
+
padded && componentPaddingXUsingComponentGap
|
|
333
|
+
)
|
|
334
|
+
}, props), {
|
|
414
335
|
style: __spreadProps(__spreadValues({}, props.style), {
|
|
415
336
|
color: color ? `var(--color-${color})` : void 0
|
|
416
|
-
})
|
|
417
|
-
children
|
|
337
|
+
})
|
|
418
338
|
})
|
|
419
339
|
);
|
|
420
340
|
};
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
// src/components/Checkbox.tsx
|
|
424
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
425
|
-
var Checkbox = (_a) => {
|
|
426
|
-
var _b = _a, {
|
|
427
|
-
label,
|
|
428
|
-
error,
|
|
429
|
-
disabled,
|
|
430
|
-
readOnly,
|
|
431
|
-
checked,
|
|
432
|
-
onChange,
|
|
433
|
-
indeterminate,
|
|
434
|
-
paragraphClassName,
|
|
435
|
-
id
|
|
436
|
-
} = _b, props = __objRest(_b, [
|
|
437
|
-
"label",
|
|
438
|
-
"error",
|
|
439
|
-
"disabled",
|
|
440
|
-
"readOnly",
|
|
441
|
-
"checked",
|
|
442
|
-
"onChange",
|
|
443
|
-
"indeterminate",
|
|
444
|
-
"paragraphClassName",
|
|
445
|
-
"id"
|
|
446
|
-
]);
|
|
447
|
-
const selected = indeterminate || checked;
|
|
448
|
-
const normalClassName = (0, import_clsx5.default)(
|
|
449
|
-
!selected && !error && !disabled && !readOnly && "border-border-primary-normal bg-background-action-secondary-normal peer-hover:border-border-action-hover peer-hover:bg-background-action-secondary-hover peer-active:border-border-action-active peer-active:bg-background-action-secondary-active"
|
|
450
|
-
);
|
|
451
|
-
const normalSelectedClassName = (0, import_clsx5.default)(
|
|
452
|
-
selected && !error && !disabled && !readOnly && "bg-background-action-primary-normal border-background-action-primary-normal peer-hover:bg-background-action-primary-hover peer-hover:border-background-action-primary-hover peer-active:bg-background-action-primary-active peer-active:border-background-action-primary-active"
|
|
453
|
-
);
|
|
454
|
-
const errorClassName = (0, import_clsx5.default)(
|
|
455
|
-
error && !selected && "bg-background-action-critical-secondary-normal border-border-action-critical-normal peer-hover:border-border-action-critical-hover peer-hover:bg-background-action-critical-secondary-hover peer-active:border-border-action-critical-active peer-active:bg-background-action-secondary-active"
|
|
456
|
-
);
|
|
457
|
-
const errorSelectedClassName = (0, import_clsx5.default)(
|
|
458
|
-
error && selected && "bg-background-action-critical-primary-normal border-background-action-critical-primary-normal peer-hover:bg-background-action-critical-primary-hover peer-hover:border-background-action-critical-primary-hover peer-active:bg-background-action-critical-primary-active peer-active:border-background-action-critical-primary-active"
|
|
459
|
-
);
|
|
460
|
-
const disabledClassName = (0, import_clsx5.default)(
|
|
461
|
-
disabled && !readOnly && "border-border-primary-normal bg-background-action-secondary-disabled peer-checked:bg-icon-on-action-primary-disabled peer-checked:border-icon-on-action-primary-disabled"
|
|
462
|
-
);
|
|
463
|
-
const readOnlyClassName = (0, import_clsx5.default)(
|
|
464
|
-
readOnly && "border-transparent bg-transparent peer-checked:bg-transparent peer-checked:border-transparent"
|
|
465
|
-
);
|
|
466
|
-
const checkColor = (0, import_clsx5.default)(
|
|
467
|
-
selected && !disabled && !readOnly && "color-icon-on-action-primary-normal peer-hover:color-icon-on-action-primary-hover peer-active:color-icon-on-action-primary-active",
|
|
468
|
-
selected && disabled && "color-background-action-primary-disabled"
|
|
469
|
-
);
|
|
470
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
471
|
-
"label",
|
|
472
|
-
{
|
|
473
|
-
id,
|
|
474
|
-
htmlFor: id ? `${id}-input` : void 0,
|
|
475
|
-
className: (0, import_clsx5.default)(
|
|
476
|
-
"flex items-center",
|
|
477
|
-
componentGap,
|
|
478
|
-
(disabled || readOnly && error || readOnly) && "cursor-default",
|
|
479
|
-
!(readOnly && error) && !disabled && !readOnly && "cursor-pointer"
|
|
480
|
-
),
|
|
481
|
-
children: [
|
|
482
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "relative", children: [
|
|
483
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
484
|
-
"input",
|
|
485
|
-
__spreadValues({
|
|
486
|
-
id: id ? `${id}-input` : void 0,
|
|
487
|
-
type: "checkbox",
|
|
488
|
-
className: "sr-only peer",
|
|
489
|
-
disabled,
|
|
490
|
-
checked: selected,
|
|
491
|
-
onChange: handleOnChange,
|
|
492
|
-
"data-indeterminate": indeterminate
|
|
493
|
-
}, props)
|
|
494
|
-
),
|
|
495
|
-
error && (readOnly || disabled) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: (0, import_clsx5.default)("size-6", "flex items-center justify-center"), children: selected ? indeterminate ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "question_mark" }) }) : readOnly ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-success-400 contents", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "check" }) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-icon-on-action-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "check", className: "pointer-events-none" }) }) : readOnly && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "close" }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
496
|
-
"div",
|
|
497
|
-
{
|
|
498
|
-
className: (0, import_clsx5.default)(
|
|
499
|
-
"size-6 border rounded-base",
|
|
500
|
-
"flex items-center justify-center",
|
|
501
|
-
baseTransition,
|
|
502
|
-
normalClassName,
|
|
503
|
-
normalSelectedClassName,
|
|
504
|
-
errorClassName,
|
|
505
|
-
errorSelectedClassName,
|
|
506
|
-
disabledClassName,
|
|
507
|
-
readOnlyClassName,
|
|
508
|
-
checkColor
|
|
509
|
-
),
|
|
510
|
-
children: selected ? indeterminate ? readOnly ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "question_mark" }) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-icon-on-action-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "remove", className: "pointer-events-none" }) }) : readOnly ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-success-400 contents", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "check" }) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-icon-on-action-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "check", className: "pointer-events-none" }) }) : readOnly && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "close" }) })
|
|
511
|
-
}
|
|
512
|
-
)
|
|
513
|
-
] }),
|
|
514
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
515
|
-
Paragraph,
|
|
516
|
-
{
|
|
517
|
-
id: id ? `${id}-label` : void 0,
|
|
518
|
-
as: "span",
|
|
519
|
-
padded: true,
|
|
520
|
-
className: (0, import_clsx5.default)(
|
|
521
|
-
"text-nowrap",
|
|
522
|
-
disabled && !error && "!text-text-primary-disabled",
|
|
523
|
-
error && !disabled && !readOnly && "!text-text-primary-error",
|
|
524
|
-
paragraphClassName
|
|
525
|
-
),
|
|
526
|
-
children: label
|
|
527
|
-
}
|
|
528
|
-
)
|
|
529
|
-
]
|
|
530
|
-
}
|
|
531
|
-
);
|
|
532
|
-
function handleOnChange(e) {
|
|
533
|
-
if (disabled || readOnly || readOnly && error || !onChange) {
|
|
534
|
-
return;
|
|
535
|
-
}
|
|
536
|
-
onChange(e);
|
|
537
|
-
}
|
|
538
|
-
};
|
|
539
|
-
Checkbox.displayName = "Checkbox";
|
|
540
|
-
|
|
541
|
-
// src/components/DataGridCell.tsx
|
|
542
|
-
var import_sortable = require("@dnd-kit/sortable");
|
|
543
|
-
|
|
544
|
-
// ../../node_modules/@dnd-kit/utilities/dist/utilities.esm.js
|
|
545
|
-
var import_react = require("react");
|
|
546
|
-
var canUseDOM = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
547
|
-
var CSS = /* @__PURE__ */ Object.freeze({
|
|
548
|
-
Translate: {
|
|
549
|
-
toString(transform) {
|
|
550
|
-
if (!transform) {
|
|
551
|
-
return;
|
|
552
|
-
}
|
|
553
|
-
const {
|
|
554
|
-
x,
|
|
555
|
-
y
|
|
556
|
-
} = transform;
|
|
557
|
-
return "translate3d(" + (x ? Math.round(x) : 0) + "px, " + (y ? Math.round(y) : 0) + "px, 0)";
|
|
558
|
-
}
|
|
559
|
-
},
|
|
560
|
-
Scale: {
|
|
561
|
-
toString(transform) {
|
|
562
|
-
if (!transform) {
|
|
563
|
-
return;
|
|
564
|
-
}
|
|
565
|
-
const {
|
|
566
|
-
scaleX,
|
|
567
|
-
scaleY
|
|
568
|
-
} = transform;
|
|
569
|
-
return "scaleX(" + scaleX + ") scaleY(" + scaleY + ")";
|
|
570
|
-
}
|
|
571
|
-
},
|
|
572
|
-
Transform: {
|
|
573
|
-
toString(transform) {
|
|
574
|
-
if (!transform) {
|
|
575
|
-
return;
|
|
576
|
-
}
|
|
577
|
-
return [CSS.Translate.toString(transform), CSS.Scale.toString(transform)].join(" ");
|
|
578
|
-
}
|
|
579
|
-
},
|
|
580
|
-
Transition: {
|
|
581
|
-
toString(_ref) {
|
|
582
|
-
let {
|
|
583
|
-
property,
|
|
584
|
-
duration,
|
|
585
|
-
easing
|
|
586
|
-
} = _ref;
|
|
587
|
-
return property + " " + duration + "ms " + easing;
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
});
|
|
591
|
-
|
|
592
|
-
// src/components/DataGridCell.tsx
|
|
593
|
-
var import_clsx10 = __toESM(require("clsx"), 1);
|
|
594
|
-
var import_react9 = require("react");
|
|
595
|
-
|
|
596
|
-
// src/components/Search.tsx
|
|
597
|
-
var import_react3 = require("react");
|
|
598
|
-
|
|
599
|
-
// src/components/Input.tsx
|
|
600
|
-
var import_react2 = require("react");
|
|
601
|
-
var import_clsx7 = __toESM(require("clsx"), 1);
|
|
602
|
-
|
|
603
|
-
// src/components/Label.tsx
|
|
604
|
-
var import_clsx6 = __toESM(require("clsx"), 1);
|
|
605
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
606
|
-
var Label = (_a) => {
|
|
607
|
-
var _b = _a, {
|
|
608
|
-
as = "span",
|
|
609
|
-
padded,
|
|
610
|
-
className,
|
|
611
|
-
color,
|
|
612
|
-
align,
|
|
613
|
-
id
|
|
614
|
-
} = _b, props = __objRest(_b, [
|
|
615
|
-
"as",
|
|
616
|
-
"padded",
|
|
617
|
-
"className",
|
|
618
|
-
"color",
|
|
619
|
-
"align",
|
|
620
|
-
"id"
|
|
621
|
-
]);
|
|
622
|
-
const Element = as;
|
|
623
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
624
|
-
Element,
|
|
625
|
-
__spreadProps(__spreadValues({
|
|
626
|
-
id,
|
|
627
|
-
className: (0, import_clsx6.default)(
|
|
628
|
-
typography.label,
|
|
629
|
-
align === "left" && "text-left",
|
|
630
|
-
align === "center" && "text-center",
|
|
631
|
-
align === "right" && "text-right",
|
|
632
|
-
className,
|
|
633
|
-
padded && componentPaddingXUsingComponentGap
|
|
634
|
-
)
|
|
635
|
-
}, props), {
|
|
636
|
-
style: __spreadProps(__spreadValues({}, props.style), {
|
|
637
|
-
color: color ? `var(--color-${color})` : void 0
|
|
638
|
-
})
|
|
639
|
-
})
|
|
640
|
-
);
|
|
641
|
-
};
|
|
642
|
-
Label.displayName = "Label";
|
|
341
|
+
Label.displayName = "Label";
|
|
643
342
|
|
|
644
343
|
// src/utils/formatting.tsx
|
|
645
344
|
function getDecimalPlaceholder(decimals) {
|
|
@@ -675,7 +374,7 @@ function formatCurrencyDisplay(value) {
|
|
|
675
374
|
}
|
|
676
375
|
|
|
677
376
|
// src/components/Input.tsx
|
|
678
|
-
var
|
|
377
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
679
378
|
var InputBase = (_a) => {
|
|
680
379
|
var _b = _a, {
|
|
681
380
|
id,
|
|
@@ -733,7 +432,7 @@ var InputBase = (_a) => {
|
|
|
733
432
|
};
|
|
734
433
|
}
|
|
735
434
|
}, [selectOnFocus]);
|
|
736
|
-
const inputBaseClass = (0,
|
|
435
|
+
const inputBaseClass = (0, import_clsx4.default)(
|
|
737
436
|
fullWidth ? "w-full" : "w-fit",
|
|
738
437
|
"flex flex-row items-center",
|
|
739
438
|
"bg-background-action-secondary-normal caret-icon-on-action-secondary-normal",
|
|
@@ -745,25 +444,25 @@ var InputBase = (_a) => {
|
|
|
745
444
|
!removeBorder && "border border-border-primary-normal",
|
|
746
445
|
"relative"
|
|
747
446
|
);
|
|
748
|
-
const inputFocusClass = (0,
|
|
447
|
+
const inputFocusClass = (0, import_clsx4.default)(
|
|
749
448
|
"has-[[data-focus]]:border-transparent has-[[data-focus]]:outline-border-primary-focus focus-within:border-transparent focus-within:outline-border-primary-focus"
|
|
750
449
|
);
|
|
751
|
-
const inputDisabledClass = (0,
|
|
450
|
+
const inputDisabledClass = (0, import_clsx4.default)(
|
|
752
451
|
"has-disabled:bg-background-action-secondary-disabled"
|
|
753
452
|
);
|
|
754
|
-
const inputReadOnlyClass = (0,
|
|
453
|
+
const inputReadOnlyClass = (0, import_clsx4.default)(
|
|
755
454
|
"has-[input:not(:disabled):read-only]:outline-none has-[input:not(:disabled):read-only]:bg-transparent has-[input:not(:disabled):read-only]:border-transparent has-[input:not(:disabled):read-only]:pl-0"
|
|
756
455
|
);
|
|
757
|
-
const inputInvalidClass = (0,
|
|
456
|
+
const inputInvalidClass = (0, import_clsx4.default)(
|
|
758
457
|
"has-[[data-error]]:border-transparent has-[[data-error]]:not-focus-within:outline-border-primary-error has-[[data-error]]:not-focus-within:outline-1"
|
|
759
458
|
);
|
|
760
|
-
return /* @__PURE__ */ (0,
|
|
459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
761
460
|
"label",
|
|
762
461
|
{
|
|
763
462
|
id,
|
|
764
463
|
htmlFor: inputId,
|
|
765
464
|
ref: inputContainerRef,
|
|
766
|
-
className: (0,
|
|
465
|
+
className: (0, import_clsx4.default)(
|
|
767
466
|
"w-full flex flex-col",
|
|
768
467
|
"block",
|
|
769
468
|
"text-text-primary-normal has-disabled:text-text-primary-disabled",
|
|
@@ -771,29 +470,29 @@ var InputBase = (_a) => {
|
|
|
771
470
|
),
|
|
772
471
|
style: __spreadValues({}, props.style),
|
|
773
472
|
children: [
|
|
774
|
-
label && /* @__PURE__ */ (0,
|
|
775
|
-
/* @__PURE__ */ (0,
|
|
473
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: (0, import_clsx4.default)("flex items-center", componentGap), children: [
|
|
474
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
776
475
|
Label,
|
|
777
476
|
{
|
|
778
477
|
id: id ? `${id}-label` : void 0,
|
|
779
|
-
className: (0,
|
|
478
|
+
className: (0, import_clsx4.default)(
|
|
780
479
|
props.disabled || props.readOnly ? "cursor-default" : "cursor-pointer"
|
|
781
480
|
),
|
|
782
481
|
children: label
|
|
783
482
|
}
|
|
784
483
|
),
|
|
785
|
-
required && /* @__PURE__ */ (0,
|
|
484
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
786
485
|
"span",
|
|
787
486
|
{
|
|
788
|
-
className: (0,
|
|
487
|
+
className: (0, import_clsx4.default)(typography.label, "text-text-critical-normal"),
|
|
789
488
|
children: "*"
|
|
790
489
|
}
|
|
791
490
|
)
|
|
792
491
|
] }),
|
|
793
|
-
/* @__PURE__ */ (0,
|
|
492
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
794
493
|
"div",
|
|
795
494
|
{
|
|
796
|
-
className: (0,
|
|
495
|
+
className: (0, import_clsx4.default)(
|
|
797
496
|
inputBaseClass,
|
|
798
497
|
!props.disabled && inputInvalidClass,
|
|
799
498
|
inputFocusClass,
|
|
@@ -803,7 +502,7 @@ var InputBase = (_a) => {
|
|
|
803
502
|
),
|
|
804
503
|
children: [
|
|
805
504
|
before,
|
|
806
|
-
/* @__PURE__ */ (0,
|
|
505
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
807
506
|
"input",
|
|
808
507
|
__spreadProps(__spreadValues(__spreadValues({
|
|
809
508
|
ref: (el) => {
|
|
@@ -813,7 +512,7 @@ var InputBase = (_a) => {
|
|
|
813
512
|
required
|
|
814
513
|
}, props), attributes), {
|
|
815
514
|
id: inputId,
|
|
816
|
-
className: (0,
|
|
515
|
+
className: (0, import_clsx4.default)(
|
|
817
516
|
"flex-1 outline-none w-full max-w-full min-h-6 min-w-0",
|
|
818
517
|
"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",
|
|
819
518
|
"placeholder:text-text-secondary-normal disabled:text-text-secondary-disabled",
|
|
@@ -830,7 +529,7 @@ var InputBase = (_a) => {
|
|
|
830
529
|
]
|
|
831
530
|
}
|
|
832
531
|
),
|
|
833
|
-
caption && /* @__PURE__ */ (0,
|
|
532
|
+
caption && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { id: id ? `${id}-caption` : void 0, children: caption })
|
|
834
533
|
]
|
|
835
534
|
}
|
|
836
535
|
);
|
|
@@ -915,9 +614,9 @@ var Input = (_a) => {
|
|
|
915
614
|
if (props.before) return props.before;
|
|
916
615
|
switch (variant) {
|
|
917
616
|
case "search":
|
|
918
|
-
return !removeSearchIcon ? /* @__PURE__ */ (0,
|
|
617
|
+
return !removeSearchIcon ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { name: "search" }) }) : null;
|
|
919
618
|
case "currency":
|
|
920
|
-
return /* @__PURE__ */ (0,
|
|
619
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { name: "attach_money" }) });
|
|
921
620
|
default:
|
|
922
621
|
return null;
|
|
923
622
|
}
|
|
@@ -927,7 +626,7 @@ var Input = (_a) => {
|
|
|
927
626
|
switch (variant) {
|
|
928
627
|
case "search": {
|
|
929
628
|
const hasValue = displayValue.length > 0;
|
|
930
|
-
return hasValue && !props.readOnly ? /* @__PURE__ */ (0,
|
|
629
|
+
return hasValue && !props.readOnly ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
931
630
|
Icon,
|
|
932
631
|
{
|
|
933
632
|
id: id ? `${id}-clear-button` : void 0,
|
|
@@ -938,11 +637,11 @@ var Input = (_a) => {
|
|
|
938
637
|
) : null;
|
|
939
638
|
}
|
|
940
639
|
case "finder":
|
|
941
|
-
return /* @__PURE__ */ (0,
|
|
640
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { name: "search" });
|
|
942
641
|
case "uom":
|
|
943
|
-
return uom ? /* @__PURE__ */ (0,
|
|
642
|
+
return uom ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-text-secondary-normal uppercase", children: uom.slice(0, 4) }) : null;
|
|
944
643
|
case "percentage":
|
|
945
|
-
return /* @__PURE__ */ (0,
|
|
644
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { name: "percent" }) });
|
|
946
645
|
default:
|
|
947
646
|
return null;
|
|
948
647
|
}
|
|
@@ -1024,7 +723,7 @@ var Input = (_a) => {
|
|
|
1024
723
|
onBlur == null ? void 0 : onBlur(e);
|
|
1025
724
|
};
|
|
1026
725
|
const inputProps = getInputProps();
|
|
1027
|
-
return /* @__PURE__ */ (0,
|
|
726
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1028
727
|
InputBase,
|
|
1029
728
|
__spreadProps(__spreadValues({}, inputProps), {
|
|
1030
729
|
before: getBeforeElement(),
|
|
@@ -1035,15 +734,15 @@ var Input = (_a) => {
|
|
|
1035
734
|
);
|
|
1036
735
|
};
|
|
1037
736
|
Input.displayName = "Input";
|
|
1038
|
-
var Finder = (props) => /* @__PURE__ */ (0,
|
|
1039
|
-
var UOM = (props) => /* @__PURE__ */ (0,
|
|
737
|
+
var Finder = (props) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Input, __spreadProps(__spreadValues({}, props), { variant: "finder" }));
|
|
738
|
+
var UOM = (props) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Input, __spreadProps(__spreadValues({}, props), { variant: "uom" }));
|
|
1040
739
|
var Currency = (props) => {
|
|
1041
740
|
var _a;
|
|
1042
741
|
const handleCurrencyChange = (e) => {
|
|
1043
742
|
var _a2;
|
|
1044
743
|
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, e);
|
|
1045
744
|
};
|
|
1046
|
-
return /* @__PURE__ */ (0,
|
|
745
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1047
746
|
Input,
|
|
1048
747
|
__spreadProps(__spreadValues({}, props), {
|
|
1049
748
|
variant: "currency",
|
|
@@ -1052,14 +751,14 @@ var Currency = (props) => {
|
|
|
1052
751
|
})
|
|
1053
752
|
);
|
|
1054
753
|
};
|
|
1055
|
-
var Percentage = (props) => /* @__PURE__ */ (0,
|
|
754
|
+
var Percentage = (props) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Input, __spreadProps(__spreadValues({}, props), { variant: "percentage" }));
|
|
1056
755
|
Finder.displayName = "Finder";
|
|
1057
756
|
UOM.displayName = "UOM";
|
|
1058
757
|
Currency.displayName = "Currency";
|
|
1059
758
|
Percentage.displayName = "Percentage";
|
|
1060
759
|
|
|
1061
760
|
// src/components/Search.tsx
|
|
1062
|
-
var
|
|
761
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1063
762
|
var Search = (_a) => {
|
|
1064
763
|
var _b = _a, {
|
|
1065
764
|
id,
|
|
@@ -1097,8 +796,8 @@ var Search = (_a) => {
|
|
|
1097
796
|
}
|
|
1098
797
|
(_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
1099
798
|
}, [props.value]);
|
|
1100
|
-
return /* @__PURE__ */ (0,
|
|
1101
|
-
/* @__PURE__ */ (0,
|
|
799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
800
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1102
801
|
Input,
|
|
1103
802
|
__spreadValues({
|
|
1104
803
|
id,
|
|
@@ -1169,21 +868,50 @@ var Search = (_a) => {
|
|
|
1169
868
|
Search.displayName = "Search";
|
|
1170
869
|
|
|
1171
870
|
// src/components/Menu.tsx
|
|
1172
|
-
var
|
|
1173
|
-
var
|
|
871
|
+
var import_clsx5 = __toESM(require("clsx"), 1);
|
|
872
|
+
var import_react8 = require("react");
|
|
1174
873
|
var import_react_dom = require("react-dom");
|
|
1175
874
|
|
|
1176
875
|
// src/components/useMenuSystem.tsx
|
|
1177
|
-
var
|
|
876
|
+
var import_react7 = require("react");
|
|
1178
877
|
|
|
1179
878
|
// src/hooks/useKeydown.ts
|
|
1180
879
|
var import_react4 = require("react");
|
|
1181
880
|
|
|
1182
|
-
// src/hooks/
|
|
881
|
+
// src/hooks/useInfiniteScroll.tsx
|
|
1183
882
|
var import_react5 = require("react");
|
|
883
|
+
function useInfiniteScroll({
|
|
884
|
+
containerRef,
|
|
885
|
+
onLoadMore,
|
|
886
|
+
isLoading,
|
|
887
|
+
offset = 50,
|
|
888
|
+
enabled = true
|
|
889
|
+
// ✅ Add this
|
|
890
|
+
}) {
|
|
891
|
+
(0, import_react5.useEffect)(() => {
|
|
892
|
+
if (!enabled) return;
|
|
893
|
+
const handleScroll = () => {
|
|
894
|
+
const el2 = containerRef.current;
|
|
895
|
+
if (!el2 || isLoading) return;
|
|
896
|
+
const { scrollTop, scrollHeight, clientHeight } = el2;
|
|
897
|
+
const isNearBottom = scrollTop + clientHeight >= scrollHeight - offset;
|
|
898
|
+
if (isNearBottom) {
|
|
899
|
+
onLoadMore();
|
|
900
|
+
}
|
|
901
|
+
};
|
|
902
|
+
const el = containerRef.current;
|
|
903
|
+
if (el) el.addEventListener("scroll", handleScroll);
|
|
904
|
+
return () => {
|
|
905
|
+
if (el) el.removeEventListener("scroll", handleScroll);
|
|
906
|
+
};
|
|
907
|
+
}, [containerRef, onLoadMore, isLoading, offset, enabled]);
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
// src/hooks/useMatchesMedia.ts
|
|
911
|
+
var import_react6 = require("react");
|
|
1184
912
|
var useMatchesMedia = (query) => {
|
|
1185
|
-
const [matches, setMatches] = (0,
|
|
1186
|
-
(0,
|
|
913
|
+
const [matches, setMatches] = (0, import_react6.useState)();
|
|
914
|
+
(0, import_react6.useLayoutEffect)(() => {
|
|
1187
915
|
const mediaQueryList = window.matchMedia(query);
|
|
1188
916
|
const listener = () => setMatches(mediaQueryList.matches);
|
|
1189
917
|
listener();
|
|
@@ -1196,17 +924,17 @@ var useMatchesMobile = () => useMatchesMedia("(width < 48rem)");
|
|
|
1196
924
|
|
|
1197
925
|
// src/components/useMenuSystem.tsx
|
|
1198
926
|
function useSubMenuSystem(mobilePositionTo) {
|
|
1199
|
-
const [activeMenus, setActiveMenus] = (0,
|
|
927
|
+
const [activeMenus, setActiveMenus] = (0, import_react7.useState)(
|
|
1200
928
|
{}
|
|
1201
929
|
);
|
|
1202
|
-
const [activeMenu, setActiveMenu] = (0,
|
|
1203
|
-
const [currentSubMenuLevel, setCurrentSubMenuLevel] = (0,
|
|
930
|
+
const [activeMenu, setActiveMenu] = (0, import_react7.useState)("");
|
|
931
|
+
const [currentSubMenuLevel, setCurrentSubMenuLevel] = (0, import_react7.useState)(
|
|
1204
932
|
null
|
|
1205
933
|
);
|
|
1206
|
-
const menuRootRef = (0,
|
|
1207
|
-
const subMenuRefs = (0,
|
|
1208
|
-
const hoverTimeoutRef = (0,
|
|
1209
|
-
const closeTimeoutRef = (0,
|
|
934
|
+
const menuRootRef = (0, import_react7.useRef)(null);
|
|
935
|
+
const subMenuRefs = (0, import_react7.useRef)({});
|
|
936
|
+
const hoverTimeoutRef = (0, import_react7.useRef)(null);
|
|
937
|
+
const closeTimeoutRef = (0, import_react7.useRef)(null);
|
|
1210
938
|
const isMobile = useMatchesMobile();
|
|
1211
939
|
const toggleMenu = (menuId, level) => {
|
|
1212
940
|
if (closeTimeoutRef.current) {
|
|
@@ -1304,7 +1032,7 @@ function useSubMenuSystem(mobilePositionTo) {
|
|
|
1304
1032
|
const isMenuActive = (menuId, level) => {
|
|
1305
1033
|
return activeMenus[level] === menuId;
|
|
1306
1034
|
};
|
|
1307
|
-
(0,
|
|
1035
|
+
(0, import_react7.useEffect)(() => {
|
|
1308
1036
|
const handleClickOutside = (event) => {
|
|
1309
1037
|
var _a;
|
|
1310
1038
|
if (Object.keys(activeMenus).length === 0) return;
|
|
@@ -1323,7 +1051,7 @@ function useSubMenuSystem(mobilePositionTo) {
|
|
|
1323
1051
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
1324
1052
|
};
|
|
1325
1053
|
}, [activeMenus]);
|
|
1326
|
-
(0,
|
|
1054
|
+
(0, import_react7.useEffect)(() => {
|
|
1327
1055
|
return () => {
|
|
1328
1056
|
if (hoverTimeoutRef.current) {
|
|
1329
1057
|
clearTimeout(hoverTimeoutRef.current);
|
|
@@ -1400,13 +1128,13 @@ function useSubMenuSystem(mobilePositionTo) {
|
|
|
1400
1128
|
};
|
|
1401
1129
|
}
|
|
1402
1130
|
function useMenuPosition(elementRef, position = "bottom", options) {
|
|
1403
|
-
const [menuPosition, setMenuPosition] = (0,
|
|
1131
|
+
const [menuPosition, setMenuPosition] = (0, import_react7.useState)({
|
|
1404
1132
|
top: 0,
|
|
1405
1133
|
left: 0,
|
|
1406
1134
|
minWidth: 0
|
|
1407
1135
|
});
|
|
1408
1136
|
const isMobile = useMatchesMobile();
|
|
1409
|
-
const updatePosition = (0,
|
|
1137
|
+
const updatePosition = (0, import_react7.useCallback)(() => {
|
|
1410
1138
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1411
1139
|
if (!(elementRef == null ? void 0 : elementRef.current)) return;
|
|
1412
1140
|
const triggerRect = elementRef.current.getBoundingClientRect();
|
|
@@ -1442,7 +1170,7 @@ function useMenuPosition(elementRef, position = "bottom", options) {
|
|
|
1442
1170
|
minWidth: triggerRect.width
|
|
1443
1171
|
});
|
|
1444
1172
|
}, [elementRef, position, options == null ? void 0 : options.menuRef, options == null ? void 0 : options.topOffset, isMobile]);
|
|
1445
|
-
(0,
|
|
1173
|
+
(0, import_react7.useEffect)(() => {
|
|
1446
1174
|
if (!(options == null ? void 0 : options.isOpen) || !(options == null ? void 0 : options.setIsOpen)) return;
|
|
1447
1175
|
const handleClickOutside = (event) => {
|
|
1448
1176
|
var _a, _b, _c, _d, _e;
|
|
@@ -1468,7 +1196,7 @@ function useMenuPosition(elementRef, position = "bottom", options) {
|
|
|
1468
1196
|
options == null ? void 0 : options.menuRef,
|
|
1469
1197
|
options == null ? void 0 : options.additionalRefs
|
|
1470
1198
|
]);
|
|
1471
|
-
(0,
|
|
1199
|
+
(0, import_react7.useEffect)(() => {
|
|
1472
1200
|
updatePosition();
|
|
1473
1201
|
const resizeObserver = new ResizeObserver(updatePosition);
|
|
1474
1202
|
if (elementRef == null ? void 0 : elementRef.current) {
|
|
@@ -1509,7 +1237,7 @@ function findDocumentRoot(element) {
|
|
|
1509
1237
|
}
|
|
1510
1238
|
|
|
1511
1239
|
// src/components/Menu.tsx
|
|
1512
|
-
var
|
|
1240
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1513
1241
|
var Menu = (_a) => {
|
|
1514
1242
|
var _b = _a, {
|
|
1515
1243
|
id,
|
|
@@ -1546,9 +1274,9 @@ var Menu = (_a) => {
|
|
|
1546
1274
|
"autoFocusOff",
|
|
1547
1275
|
"menuName"
|
|
1548
1276
|
]);
|
|
1549
|
-
const internalRef = (0,
|
|
1277
|
+
const internalRef = (0, import_react8.useRef)(null);
|
|
1550
1278
|
const actualRef = ref || internalRef;
|
|
1551
|
-
const [maxHeight, setMaxHeight] = (0,
|
|
1279
|
+
const [maxHeight, setMaxHeight] = (0, import_react8.useState)("180px");
|
|
1552
1280
|
const isMobile = useMatchesMobile();
|
|
1553
1281
|
const { menuPosition, updatePosition } = useMenuPosition(
|
|
1554
1282
|
isMobile && mobilePositionTo ? mobilePositionTo : positionTo,
|
|
@@ -1560,7 +1288,7 @@ var Menu = (_a) => {
|
|
|
1560
1288
|
topOffset
|
|
1561
1289
|
}
|
|
1562
1290
|
);
|
|
1563
|
-
(0,
|
|
1291
|
+
(0, import_react8.useEffect)(() => {
|
|
1564
1292
|
const raf = requestAnimationFrame(() => {
|
|
1565
1293
|
if (!actualRef || !actualRef.current || customMaxHeight) {
|
|
1566
1294
|
return;
|
|
@@ -1581,14 +1309,14 @@ var Menu = (_a) => {
|
|
|
1581
1309
|
cancelAnimationFrame(raf);
|
|
1582
1310
|
};
|
|
1583
1311
|
}, [actualRef, customMaxHeight]);
|
|
1584
|
-
(0,
|
|
1312
|
+
(0, import_react8.useEffect)(() => {
|
|
1585
1313
|
if (!show) {
|
|
1586
1314
|
return;
|
|
1587
1315
|
}
|
|
1588
1316
|
initializeMenuFocus();
|
|
1589
1317
|
updatePosition();
|
|
1590
1318
|
}, [show, updatePosition]);
|
|
1591
|
-
(0,
|
|
1319
|
+
(0, import_react8.useEffect)(() => {
|
|
1592
1320
|
if (!show || !setShow) {
|
|
1593
1321
|
return;
|
|
1594
1322
|
}
|
|
@@ -1606,12 +1334,12 @@ var Menu = (_a) => {
|
|
|
1606
1334
|
};
|
|
1607
1335
|
}, [show, setShow, positionTo]);
|
|
1608
1336
|
return show && (0, import_react_dom.createPortal)(
|
|
1609
|
-
/* @__PURE__ */ (0,
|
|
1337
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1610
1338
|
"div",
|
|
1611
1339
|
__spreadProps(__spreadValues({
|
|
1612
1340
|
id,
|
|
1613
1341
|
ref: setRefs,
|
|
1614
|
-
className: (0,
|
|
1342
|
+
className: (0, import_clsx5.default)(
|
|
1615
1343
|
"shadow-4 rounded-base bg-background-grouped-primary-normal overflow-x-hidden overflow-y-auto flex flex-col outline-0",
|
|
1616
1344
|
"fixed",
|
|
1617
1345
|
"z-50",
|
|
@@ -1740,12 +1468,64 @@ var Menu = (_a) => {
|
|
|
1740
1468
|
Menu.displayName = "Menu";
|
|
1741
1469
|
|
|
1742
1470
|
// src/components/MenuOption.tsx
|
|
1743
|
-
var
|
|
1744
|
-
var
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1471
|
+
var import_clsx7 = __toESM(require("clsx"), 1);
|
|
1472
|
+
var import_react9 = require("react");
|
|
1473
|
+
|
|
1474
|
+
// src/components/Paragraph.tsx
|
|
1475
|
+
var import_clsx6 = __toESM(require("clsx"), 1);
|
|
1476
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1477
|
+
var Paragraph = (_a) => {
|
|
1478
|
+
var _b = _a, {
|
|
1479
|
+
className,
|
|
1480
|
+
color,
|
|
1481
|
+
padded,
|
|
1482
|
+
align = "left",
|
|
1483
|
+
tall,
|
|
1484
|
+
addOverflow,
|
|
1485
|
+
children,
|
|
1486
|
+
as = "p",
|
|
1487
|
+
id
|
|
1488
|
+
} = _b, props = __objRest(_b, [
|
|
1489
|
+
"className",
|
|
1490
|
+
"color",
|
|
1491
|
+
"padded",
|
|
1492
|
+
"align",
|
|
1493
|
+
"tall",
|
|
1494
|
+
"addOverflow",
|
|
1495
|
+
"children",
|
|
1496
|
+
"as",
|
|
1497
|
+
"id"
|
|
1498
|
+
]);
|
|
1499
|
+
const Element = as;
|
|
1500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1501
|
+
Element,
|
|
1502
|
+
__spreadProps(__spreadValues({
|
|
1503
|
+
id
|
|
1504
|
+
}, props), {
|
|
1505
|
+
className: (0, import_clsx6.default)(
|
|
1506
|
+
typography.paragraph,
|
|
1507
|
+
className,
|
|
1508
|
+
padded && componentPaddingXUsingComponentGap,
|
|
1509
|
+
align === "left" && "text-left",
|
|
1510
|
+
align === "center" && "text-center",
|
|
1511
|
+
align === "right" && "text-right",
|
|
1512
|
+
tall && "!leading-6",
|
|
1513
|
+
addOverflow && "whitespace-nowrap text-ellipsis overflow-hidden"
|
|
1514
|
+
),
|
|
1515
|
+
style: __spreadProps(__spreadValues({}, props.style), {
|
|
1516
|
+
color: color ? `var(--color-${color})` : void 0
|
|
1517
|
+
}),
|
|
1518
|
+
children
|
|
1519
|
+
})
|
|
1520
|
+
);
|
|
1521
|
+
};
|
|
1522
|
+
Paragraph.displayName = "Paragraph";
|
|
1523
|
+
|
|
1524
|
+
// src/components/MenuOption.tsx
|
|
1525
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1526
|
+
var MenuOption = ({
|
|
1527
|
+
id,
|
|
1528
|
+
children,
|
|
1749
1529
|
disabled = false,
|
|
1750
1530
|
variant = "normal",
|
|
1751
1531
|
value,
|
|
@@ -1767,10 +1547,10 @@ var MenuOption = ({
|
|
|
1767
1547
|
highlightMatchingText = false,
|
|
1768
1548
|
menuValue
|
|
1769
1549
|
}) => {
|
|
1770
|
-
const uniqueId = (0,
|
|
1771
|
-
const internalRef = (0,
|
|
1550
|
+
const uniqueId = (0, import_react9.useId)();
|
|
1551
|
+
const internalRef = (0, import_react9.useRef)(null);
|
|
1772
1552
|
const actualRef = ref || internalRef;
|
|
1773
|
-
const menuId = (0,
|
|
1553
|
+
const menuId = (0, import_react9.useRef)(`menu-${uniqueId}`);
|
|
1774
1554
|
const isMobile = useMatchesMobile();
|
|
1775
1555
|
const handleMouseEnter = () => {
|
|
1776
1556
|
if (subMenu && onSubMenuHover && !disabled) {
|
|
@@ -1790,36 +1570,36 @@ var MenuOption = ({
|
|
|
1790
1570
|
const additionalAttributes = {
|
|
1791
1571
|
"data-selected": selected || null
|
|
1792
1572
|
};
|
|
1793
|
-
const svgStyles = (0,
|
|
1573
|
+
const svgStyles = (0, import_clsx7.default)(
|
|
1794
1574
|
"[&>svg]:shrink-0 [&>svg]:fill-icon-action-primary-normal"
|
|
1795
1575
|
);
|
|
1796
|
-
const textLabelStyles = (0,
|
|
1797
|
-
const normalStyles = variant === "normal" && !disabled && (0,
|
|
1576
|
+
const textLabelStyles = (0, import_clsx7.default)("w-full whitespace-nowrap !leading-6");
|
|
1577
|
+
const normalStyles = variant === "normal" && !disabled && (0, import_clsx7.default)(
|
|
1798
1578
|
"bg-transparent text-text-primary-normal",
|
|
1799
1579
|
"hover:bg-background-action-secondary-hover",
|
|
1800
1580
|
"focus:bg-background-action-secondary-hover",
|
|
1801
1581
|
"data-selected:bg-background-action-secondary-hover",
|
|
1802
1582
|
"active:bg-background-action-secondary-active"
|
|
1803
1583
|
);
|
|
1804
|
-
const normalDisabledStyles = variant === "normal" && disabled && (0,
|
|
1805
|
-
const actionStyles = variant === "action" && !disabled && (0,
|
|
1584
|
+
const normalDisabledStyles = variant === "normal" && disabled && (0, import_clsx7.default)("text-text-primary-disabled");
|
|
1585
|
+
const actionStyles = variant === "action" && !disabled && (0, import_clsx7.default)(
|
|
1806
1586
|
"text-action-400 bg-transparent",
|
|
1807
1587
|
"hover:bg-background-action-secondary-hover hover:text-text-action-hover",
|
|
1808
1588
|
"focus:bg-background-action-secondary-hover focus:text-text-action-hover",
|
|
1809
1589
|
"data-selected:bg-background-action-secondary-active data-selected:text-text-action-active",
|
|
1810
1590
|
"active:bg-background-action-secondary-active active:text-text-action-active"
|
|
1811
1591
|
);
|
|
1812
|
-
const actionDisabledStyles = variant === "action" && disabled && (0,
|
|
1813
|
-
const disabledStyles = disabled && (0,
|
|
1592
|
+
const actionDisabledStyles = variant === "action" && disabled && (0, import_clsx7.default)("text-text-action-disabled");
|
|
1593
|
+
const disabledStyles = disabled && (0, import_clsx7.default)("bg-transparent cursor-default pointer-events-none");
|
|
1814
1594
|
const processChildren = typeof children === "string" && highlightMatchingText ? highlightMatch(children, menuValue) : children;
|
|
1815
|
-
const renderChildren = typeof children === "object" ? children : variant === "action" ? /* @__PURE__ */ (0,
|
|
1816
|
-
return /* @__PURE__ */ (0,
|
|
1817
|
-
/* @__PURE__ */ (0,
|
|
1595
|
+
const renderChildren = typeof children === "object" ? children : variant === "action" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Label, { padded: true, className: textLabelStyles, children: processChildren }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Paragraph, { padded: true, className: textLabelStyles, children: processChildren });
|
|
1596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1597
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1818
1598
|
"div",
|
|
1819
1599
|
__spreadProps(__spreadValues({
|
|
1820
1600
|
id,
|
|
1821
1601
|
ref: actualRef,
|
|
1822
|
-
className: (0,
|
|
1602
|
+
className: (0, import_clsx7.default)(
|
|
1823
1603
|
"flex items-center cursor-pointer w-full text-left relative outline-none",
|
|
1824
1604
|
svgStyles,
|
|
1825
1605
|
componentGap,
|
|
@@ -1845,13 +1625,13 @@ var MenuOption = ({
|
|
|
1845
1625
|
role: "menuitem",
|
|
1846
1626
|
"aria-haspopup": subMenu ? "menu" : void 0,
|
|
1847
1627
|
children: [
|
|
1848
|
-
before && /* @__PURE__ */ (0,
|
|
1628
|
+
before && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "shrink-0 flex items-center", children: before }),
|
|
1849
1629
|
renderChildren,
|
|
1850
1630
|
renderAfterProp()
|
|
1851
1631
|
]
|
|
1852
1632
|
})
|
|
1853
1633
|
),
|
|
1854
|
-
subMenu && /* @__PURE__ */ (0,
|
|
1634
|
+
subMenu && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1855
1635
|
"div",
|
|
1856
1636
|
{
|
|
1857
1637
|
onMouseEnter: handleSubMenuEnter,
|
|
@@ -1875,14 +1655,14 @@ var MenuOption = ({
|
|
|
1875
1655
|
return after;
|
|
1876
1656
|
}
|
|
1877
1657
|
if (subMenu && after !== null) {
|
|
1878
|
-
return /* @__PURE__ */ (0,
|
|
1658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "chevron_right" });
|
|
1879
1659
|
}
|
|
1880
1660
|
}
|
|
1881
1661
|
function mobileBackMenuOption() {
|
|
1882
1662
|
if (!isMobile) {
|
|
1883
1663
|
return;
|
|
1884
1664
|
}
|
|
1885
|
-
return /* @__PURE__ */ (0,
|
|
1665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1886
1666
|
MenuOption,
|
|
1887
1667
|
{
|
|
1888
1668
|
id: id ? `${id}-back` : void 0,
|
|
@@ -1890,7 +1670,7 @@ var MenuOption = ({
|
|
|
1890
1670
|
closeSubMenuLevel == null ? void 0 : closeSubMenuLevel(currentSubMenuLevel != null ? currentSubMenuLevel : 0);
|
|
1891
1671
|
},
|
|
1892
1672
|
variant: "action",
|
|
1893
|
-
before: /* @__PURE__ */ (0,
|
|
1673
|
+
before: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "chevron_left" }),
|
|
1894
1674
|
children: "Back"
|
|
1895
1675
|
}
|
|
1896
1676
|
);
|
|
@@ -1907,13 +1687,13 @@ function highlightMatch(text, searchValue) {
|
|
|
1907
1687
|
);
|
|
1908
1688
|
const parts = text.split(regex);
|
|
1909
1689
|
return parts.map(
|
|
1910
|
-
(part, index) => regex.test(part) ? /* @__PURE__ */ (0,
|
|
1690
|
+
(part, index) => regex.test(part) ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "font-bold", children: part }, index) : part
|
|
1911
1691
|
);
|
|
1912
1692
|
}
|
|
1913
1693
|
|
|
1914
1694
|
// src/components/DataGridCell.tsx
|
|
1915
|
-
var
|
|
1916
|
-
var DataGridCell = (0,
|
|
1695
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1696
|
+
var DataGridCell = (0, import_react10.memo)(
|
|
1917
1697
|
(_a) => {
|
|
1918
1698
|
var _b = _a, {
|
|
1919
1699
|
id,
|
|
@@ -1949,10 +1729,10 @@ var DataGridCell = (0, import_react9.memo)(
|
|
|
1949
1729
|
"width"
|
|
1950
1730
|
]);
|
|
1951
1731
|
const Element = type === "header" ? "th" : "td";
|
|
1952
|
-
const timerRef = (0,
|
|
1953
|
-
const [isGrabbing, setIsGrabbing] = (0,
|
|
1954
|
-
const [isPointerPressed, setIsPointerPressed] = (0,
|
|
1955
|
-
(0,
|
|
1732
|
+
const timerRef = (0, import_react10.useRef)(null);
|
|
1733
|
+
const [isGrabbing, setIsGrabbing] = (0, import_react10.useState)(false);
|
|
1734
|
+
const [isPointerPressed, setIsPointerPressed] = (0, import_react10.useState)(false);
|
|
1735
|
+
(0, import_react10.useEffect)(() => {
|
|
1956
1736
|
return () => {
|
|
1957
1737
|
if (timerRef.current) {
|
|
1958
1738
|
clearTimeout(timerRef.current);
|
|
@@ -1989,10 +1769,10 @@ var DataGridCell = (0, import_react9.memo)(
|
|
|
1989
1769
|
};
|
|
1990
1770
|
const headerBgStyles = type === "header" && !locked && !["button"].includes(component) && "bg-brand-400 border-brand-200";
|
|
1991
1771
|
const lockedHeaderBgStyles = locked && !["button"].includes(component) && "bg-neutral-400 border-neutral-300";
|
|
1992
|
-
const headerTypeStyles = type === "header" && component !== "button" && component !== "icon" && (0,
|
|
1993
|
-
const buttonComponentStyles = component === "button" && (0,
|
|
1994
|
-
const iconComponentStyles = component === "icon" && (0,
|
|
1995
|
-
const cellClasses = (0,
|
|
1772
|
+
const headerTypeStyles = type === "header" && component !== "button" && component !== "icon" && (0, import_clsx8.default)("border-r");
|
|
1773
|
+
const buttonComponentStyles = component === "button" && (0, import_clsx8.default)("border-r border-b border-border-primary-normal");
|
|
1774
|
+
const iconComponentStyles = component === "icon" && (0, import_clsx8.default)("border-l");
|
|
1775
|
+
const cellClasses = (0, import_clsx8.default)(
|
|
1996
1776
|
headerTypeStyles,
|
|
1997
1777
|
buttonComponentStyles,
|
|
1998
1778
|
headerBgStyles,
|
|
@@ -2011,14 +1791,14 @@ var DataGridCell = (0, import_react9.memo)(
|
|
|
2011
1791
|
isGrabbing && "!cursor-grabbing",
|
|
2012
1792
|
component === "checkbox" || center && "justify-center"
|
|
2013
1793
|
);
|
|
2014
|
-
return /* @__PURE__ */ (0,
|
|
1794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2015
1795
|
Element,
|
|
2016
1796
|
__spreadProps(__spreadValues({
|
|
2017
1797
|
id,
|
|
2018
|
-
className: (0,
|
|
1798
|
+
className: (0, import_clsx8.default)("flex h-10", !width && "flex-1"),
|
|
2019
1799
|
style: { width }
|
|
2020
1800
|
}, props), {
|
|
2021
|
-
children: /* @__PURE__ */ (0,
|
|
1801
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2022
1802
|
"div",
|
|
2023
1803
|
{
|
|
2024
1804
|
className: cellClasses,
|
|
@@ -2044,21 +1824,23 @@ function DataCellHeader(_a) {
|
|
|
2044
1824
|
children,
|
|
2045
1825
|
setNodeRef,
|
|
2046
1826
|
node,
|
|
2047
|
-
id
|
|
1827
|
+
id,
|
|
1828
|
+
useMenuDefaultMinWidth
|
|
2048
1829
|
} = _b, props = __objRest(_b, [
|
|
2049
1830
|
"header",
|
|
2050
1831
|
"children",
|
|
2051
1832
|
"setNodeRef",
|
|
2052
1833
|
"node",
|
|
2053
|
-
"id"
|
|
1834
|
+
"id",
|
|
1835
|
+
"useMenuDefaultMinWidth"
|
|
2054
1836
|
]);
|
|
2055
1837
|
var _a2;
|
|
2056
|
-
const [showMenu, setShowMenu] = (0,
|
|
2057
|
-
const [filter, setFilter] = (0,
|
|
1838
|
+
const [showMenu, setShowMenu] = (0, import_react10.useState)(false);
|
|
1839
|
+
const [filter, setFilter] = (0, import_react10.useState)(
|
|
2058
1840
|
(_a2 = header.column.getFilterValue()) != null ? _a2 : ""
|
|
2059
1841
|
);
|
|
2060
|
-
const ref = (0,
|
|
2061
|
-
const predeterminedPinned = (0,
|
|
1842
|
+
const ref = (0, import_react10.useRef)(null);
|
|
1843
|
+
const predeterminedPinned = (0, import_react10.useRef)(false);
|
|
2062
1844
|
const {
|
|
2063
1845
|
menuRootRef,
|
|
2064
1846
|
isMenuActive,
|
|
@@ -2066,14 +1848,16 @@ function DataCellHeader(_a) {
|
|
|
2066
1848
|
listeners: subMenuListeners,
|
|
2067
1849
|
mobileHide
|
|
2068
1850
|
} = useSubMenuSystem(node ? node : ref);
|
|
2069
|
-
(0,
|
|
1851
|
+
(0, import_react10.useEffect)(() => {
|
|
2070
1852
|
var _a3;
|
|
2071
1853
|
const columnPinning = (_a3 = header.getContext().table.options.initialState) == null ? void 0 : _a3.columnPinning;
|
|
2072
1854
|
const left = (columnPinning == null ? void 0 : columnPinning.left) ? columnPinning.left : [];
|
|
2073
1855
|
const right = (columnPinning == null ? void 0 : columnPinning.right) ? columnPinning.right : [];
|
|
2074
|
-
predeterminedPinned.current = [...left, ...right].includes(
|
|
1856
|
+
predeterminedPinned.current = [...left, ...right].includes(
|
|
1857
|
+
header.column.id
|
|
1858
|
+
);
|
|
2075
1859
|
}, []);
|
|
2076
|
-
(0,
|
|
1860
|
+
(0, import_react10.useEffect)(() => {
|
|
2077
1861
|
const handler = setTimeout(() => {
|
|
2078
1862
|
header.column.setFilterValue(filter);
|
|
2079
1863
|
}, 500);
|
|
@@ -2087,7 +1871,7 @@ function DataCellHeader(_a) {
|
|
|
2087
1871
|
width: header.column.getSize(),
|
|
2088
1872
|
"--color-text-primary-normal": "var(--color-text-brand-primary-normal)"
|
|
2089
1873
|
}, props.style);
|
|
2090
|
-
return /* @__PURE__ */ (0,
|
|
1874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2091
1875
|
DataGridCell,
|
|
2092
1876
|
__spreadProps(__spreadValues({
|
|
2093
1877
|
id,
|
|
@@ -2100,7 +1884,7 @@ function DataCellHeader(_a) {
|
|
|
2100
1884
|
}, props), {
|
|
2101
1885
|
children: [
|
|
2102
1886
|
children,
|
|
2103
|
-
header.column.getCanFilter() && /* @__PURE__ */ (0,
|
|
1887
|
+
header.column.getCanFilter() && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2104
1888
|
Menu,
|
|
2105
1889
|
{
|
|
2106
1890
|
id: id ? `${id}-menu` : void 0,
|
|
@@ -2109,15 +1893,16 @@ function DataCellHeader(_a) {
|
|
|
2109
1893
|
show: showMenu,
|
|
2110
1894
|
setShow: setShowMenu,
|
|
2111
1895
|
mobileHide,
|
|
1896
|
+
useDefaultMinWidth: useMenuDefaultMinWidth,
|
|
2112
1897
|
children: [
|
|
2113
|
-
/* @__PURE__ */ (0,
|
|
1898
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2114
1899
|
MenuOption,
|
|
2115
1900
|
__spreadProps(__spreadValues({
|
|
2116
1901
|
id: id ? `${id}-filter-option` : void 0
|
|
2117
1902
|
}, subMenuListeners), {
|
|
2118
1903
|
subMenu: (_b2) => {
|
|
2119
1904
|
var _c = _b2, { menuId, subMenuLevel } = _c, props2 = __objRest(_c, ["menuId", "subMenuLevel"]);
|
|
2120
|
-
return /* @__PURE__ */ (0,
|
|
1905
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2121
1906
|
Menu,
|
|
2122
1907
|
__spreadProps(__spreadValues({
|
|
2123
1908
|
id: id ? `${id}-filter-submenu` : void 0
|
|
@@ -2126,8 +1911,9 @@ function DataCellHeader(_a) {
|
|
|
2126
1911
|
ref: (el) => {
|
|
2127
1912
|
registerSubMenu(menuId, el);
|
|
2128
1913
|
},
|
|
1914
|
+
useDefaultMinWidth: useMenuDefaultMinWidth,
|
|
2129
1915
|
children: [
|
|
2130
|
-
/* @__PURE__ */ (0,
|
|
1916
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: (0, import_clsx8.default)(paddingUsingComponentGap), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2131
1917
|
Search,
|
|
2132
1918
|
{
|
|
2133
1919
|
id: id ? `${id}-filter-search` : void 0,
|
|
@@ -2142,7 +1928,7 @@ function DataCellHeader(_a) {
|
|
|
2142
1928
|
value: filter != null ? filter : ""
|
|
2143
1929
|
}
|
|
2144
1930
|
) }),
|
|
2145
|
-
/* @__PURE__ */ (0,
|
|
1931
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2146
1932
|
MenuOption,
|
|
2147
1933
|
{
|
|
2148
1934
|
id: id ? `${id}-filter-contains` : void 0,
|
|
@@ -2151,7 +1937,7 @@ function DataCellHeader(_a) {
|
|
|
2151
1937
|
children: "Contains"
|
|
2152
1938
|
}
|
|
2153
1939
|
),
|
|
2154
|
-
/* @__PURE__ */ (0,
|
|
1940
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2155
1941
|
MenuOption,
|
|
2156
1942
|
{
|
|
2157
1943
|
id: id ? `${id}-filter-startswith` : void 0,
|
|
@@ -2160,7 +1946,7 @@ function DataCellHeader(_a) {
|
|
|
2160
1946
|
children: "Starts with"
|
|
2161
1947
|
}
|
|
2162
1948
|
),
|
|
2163
|
-
/* @__PURE__ */ (0,
|
|
1949
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2164
1950
|
MenuOption,
|
|
2165
1951
|
{
|
|
2166
1952
|
id: id ? `${id}-filter-endswith` : void 0,
|
|
@@ -2176,7 +1962,7 @@ function DataCellHeader(_a) {
|
|
|
2176
1962
|
children: "Filter"
|
|
2177
1963
|
})
|
|
2178
1964
|
),
|
|
2179
|
-
!predeterminedPinned.current && header.column.getCanPin() && /* @__PURE__ */ (0,
|
|
1965
|
+
!predeterminedPinned.current && header.column.getCanPin() && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2180
1966
|
MenuOption,
|
|
2181
1967
|
__spreadProps(__spreadValues({
|
|
2182
1968
|
onClick: () => {
|
|
@@ -2185,7 +1971,7 @@ function DataCellHeader(_a) {
|
|
|
2185
1971
|
}, subMenuListeners), {
|
|
2186
1972
|
subMenu: (_d) => {
|
|
2187
1973
|
var _e = _d, { menuId, subMenuLevel } = _e, props2 = __objRest(_e, ["menuId", "subMenuLevel"]);
|
|
2188
|
-
return /* @__PURE__ */ (0,
|
|
1974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2189
1975
|
Menu,
|
|
2190
1976
|
__spreadProps(__spreadValues({}, props2), {
|
|
2191
1977
|
show: isMenuActive(menuId, subMenuLevel),
|
|
@@ -2193,7 +1979,7 @@ function DataCellHeader(_a) {
|
|
|
2193
1979
|
registerSubMenu(menuId, el);
|
|
2194
1980
|
},
|
|
2195
1981
|
children: [
|
|
2196
|
-
/* @__PURE__ */ (0,
|
|
1982
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2197
1983
|
MenuOption,
|
|
2198
1984
|
{
|
|
2199
1985
|
selected: header.column.getIsPinned() === "left",
|
|
@@ -2204,11 +1990,11 @@ function DataCellHeader(_a) {
|
|
|
2204
1990
|
header.column.pin("left");
|
|
2205
1991
|
}
|
|
2206
1992
|
},
|
|
2207
|
-
after: header.column.getIsPinned() === "left" && /* @__PURE__ */ (0,
|
|
1993
|
+
after: header.column.getIsPinned() === "left" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { name: "check" }),
|
|
2208
1994
|
children: "Left"
|
|
2209
1995
|
}
|
|
2210
1996
|
),
|
|
2211
|
-
/* @__PURE__ */ (0,
|
|
1997
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2212
1998
|
MenuOption,
|
|
2213
1999
|
{
|
|
2214
2000
|
selected: header.column.getIsPinned() === "right",
|
|
@@ -2219,7 +2005,7 @@ function DataCellHeader(_a) {
|
|
|
2219
2005
|
header.column.pin("right");
|
|
2220
2006
|
}
|
|
2221
2007
|
},
|
|
2222
|
-
after: header.column.getIsPinned() === "right" && /* @__PURE__ */ (0,
|
|
2008
|
+
after: header.column.getIsPinned() === "right" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { name: "check" }),
|
|
2223
2009
|
children: "Right"
|
|
2224
2010
|
}
|
|
2225
2011
|
)
|
|
@@ -2241,11 +2027,11 @@ function DataCellHeader(_a) {
|
|
|
2241
2027
|
})
|
|
2242
2028
|
);
|
|
2243
2029
|
function menuOptionIcon(value) {
|
|
2244
|
-
return /* @__PURE__ */ (0,
|
|
2030
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2245
2031
|
Icon,
|
|
2246
2032
|
{
|
|
2247
2033
|
name: "check",
|
|
2248
|
-
className: (0,
|
|
2034
|
+
className: (0, import_clsx8.default)(
|
|
2249
2035
|
header.column.columnDef.filterFn !== value && "text-transparent"
|
|
2250
2036
|
)
|
|
2251
2037
|
}
|
|
@@ -2287,9 +2073,10 @@ function DraggableCellHeader(_a) {
|
|
|
2287
2073
|
whiteSpace: "nowrap",
|
|
2288
2074
|
zIndex: isDragging ? 1 : 0,
|
|
2289
2075
|
width: header.column.getSize(),
|
|
2290
|
-
"--color-text-primary-normal": "var(--color-neutral-000)"
|
|
2076
|
+
"--color-text-primary-normal": "var(--color-neutral-000)",
|
|
2077
|
+
userSelect: "none"
|
|
2291
2078
|
};
|
|
2292
|
-
return /* @__PURE__ */ (0,
|
|
2079
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2293
2080
|
DataCellHeader,
|
|
2294
2081
|
__spreadProps(__spreadValues(__spreadValues(__spreadValues({
|
|
2295
2082
|
header,
|
|
@@ -2321,378 +2108,567 @@ function DragAlongCell(_a) {
|
|
|
2321
2108
|
width: cell.column.getSize(),
|
|
2322
2109
|
zIndex: isDragging ? 1 : 0
|
|
2323
2110
|
};
|
|
2324
|
-
return /* @__PURE__ */ (0,
|
|
2111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DataGridCell, __spreadProps(__spreadValues({ style, ref: setNodeRef }, props), { children }));
|
|
2325
2112
|
}
|
|
2326
2113
|
DragAlongCell.displayName = "DragAlongCell";
|
|
2327
2114
|
|
|
2328
|
-
// src/components/
|
|
2329
|
-
var
|
|
2330
|
-
var
|
|
2331
|
-
var
|
|
2332
|
-
var
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
error,
|
|
2337
|
-
children,
|
|
2338
|
-
readOnly,
|
|
2339
|
-
renderMenu,
|
|
2340
|
-
onClick,
|
|
2341
|
-
className,
|
|
2342
|
-
wrapperClassName,
|
|
2343
|
-
removeRoundness,
|
|
2344
|
-
displayValue,
|
|
2345
|
-
value
|
|
2346
|
-
} = _b, props = __objRest(_b, [
|
|
2347
|
-
"id",
|
|
2348
|
-
"label",
|
|
2349
|
-
"error",
|
|
2350
|
-
"children",
|
|
2351
|
-
"readOnly",
|
|
2352
|
-
"renderMenu",
|
|
2353
|
-
"onClick",
|
|
2354
|
-
"className",
|
|
2355
|
-
"wrapperClassName",
|
|
2356
|
-
"removeRoundness",
|
|
2357
|
-
"displayValue",
|
|
2358
|
-
"value"
|
|
2359
|
-
]);
|
|
2360
|
-
const inputRef = (0, import_react10.useRef)(null);
|
|
2361
|
-
const inputContainerRef = (0, import_react10.useRef)(null);
|
|
2362
|
-
const preventFocusOnInitialRender = (0, import_react10.useRef)(true);
|
|
2363
|
-
const [show, setShow] = (0, import_react10.useState)(false);
|
|
2364
|
-
(0, import_react10.useEffect)(() => {
|
|
2365
|
-
var _a2;
|
|
2366
|
-
if (preventFocusOnInitialRender.current) {
|
|
2367
|
-
preventFocusOnInitialRender.current = false;
|
|
2368
|
-
return;
|
|
2369
|
-
}
|
|
2370
|
-
(_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
2371
|
-
}, [value]);
|
|
2372
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
2373
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2374
|
-
InputBase,
|
|
2375
|
-
__spreadProps(__spreadValues({
|
|
2376
|
-
id,
|
|
2377
|
-
inputContainerRef,
|
|
2378
|
-
ref: inputRef,
|
|
2379
|
-
label,
|
|
2380
|
-
after: !readOnly && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2381
|
-
"span",
|
|
2382
|
-
{
|
|
2383
|
-
className: (0, import_clsx11.default)(
|
|
2384
|
-
props.disabled ? "text-icon-action-primary-disabled" : "text-icon-action-primary-normal",
|
|
2385
|
-
"contents"
|
|
2386
|
-
),
|
|
2387
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { name: "keyboard_arrow_down" })
|
|
2388
|
-
}
|
|
2389
|
-
),
|
|
2390
|
-
maxLength: 0,
|
|
2391
|
-
className: (0, import_clsx11.default)("!caret-transparent !cursor-default", className),
|
|
2392
|
-
wrapperClassName,
|
|
2393
|
-
onKeyDown: (e) => {
|
|
2394
|
-
const openKeys = ["Enter", "Space", " "];
|
|
2395
|
-
if (openKeys.includes(e.key)) {
|
|
2396
|
-
e.preventDefault();
|
|
2397
|
-
e.target.click();
|
|
2398
|
-
}
|
|
2399
|
-
},
|
|
2400
|
-
onClick: (e) => {
|
|
2401
|
-
if (props.disabled || readOnly) {
|
|
2402
|
-
return;
|
|
2403
|
-
}
|
|
2404
|
-
setShow(!show);
|
|
2405
|
-
onClick == null ? void 0 : onClick(e);
|
|
2406
|
-
},
|
|
2407
|
-
error,
|
|
2408
|
-
readOnly,
|
|
2409
|
-
removeRoundness,
|
|
2410
|
-
focus: show
|
|
2411
|
-
}, props), {
|
|
2412
|
-
value: displayValue != null ? displayValue : value
|
|
2413
|
-
})
|
|
2414
|
-
),
|
|
2415
|
-
renderMenu ? renderMenu({
|
|
2416
|
-
id: id ? `${id}-menu` : void 0,
|
|
2417
|
-
positionTo: inputContainerRef,
|
|
2418
|
-
show,
|
|
2419
|
-
setShow,
|
|
2420
|
-
topOffset: props.caption ? -16 : null
|
|
2421
|
-
}) : children
|
|
2422
|
-
] });
|
|
2423
|
-
};
|
|
2424
|
-
Select.displayName = "Select";
|
|
2115
|
+
// src/components/DataGrid/index.tsx
|
|
2116
|
+
var import_react15 = __toESM(require("react"), 1);
|
|
2117
|
+
var import_react_table3 = require("@tanstack/react-table");
|
|
2118
|
+
var import_core = require("@dnd-kit/core");
|
|
2119
|
+
var import_sortable2 = require("@dnd-kit/sortable");
|
|
2120
|
+
var import_modifiers = require("@dnd-kit/modifiers");
|
|
2121
|
+
var import_react_virtual2 = require("@tanstack/react-virtual");
|
|
2122
|
+
var import_clsx13 = __toESM(require("clsx"), 1);
|
|
2425
2123
|
|
|
2426
|
-
// src/components/
|
|
2124
|
+
// src/components/DataGrid/PinnedColumns.tsx
|
|
2125
|
+
var import_react_table2 = require("@tanstack/react-table");
|
|
2427
2126
|
var import_clsx12 = __toESM(require("clsx"), 1);
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
tall,
|
|
2437
|
-
id
|
|
2438
|
-
} = _b, props = __objRest(_b, [
|
|
2439
|
-
"className",
|
|
2440
|
-
"children",
|
|
2441
|
-
"as",
|
|
2442
|
-
"align",
|
|
2443
|
-
"color",
|
|
2444
|
-
"tall",
|
|
2445
|
-
"id"
|
|
2446
|
-
]);
|
|
2447
|
-
const Element = as;
|
|
2448
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2449
|
-
Element,
|
|
2450
|
-
__spreadProps(__spreadValues({
|
|
2451
|
-
id,
|
|
2452
|
-
className: (0, import_clsx12.default)(
|
|
2453
|
-
typography.subheader,
|
|
2454
|
-
className,
|
|
2455
|
-
align === "left" && "text-left",
|
|
2456
|
-
align === "center" && "text-center",
|
|
2457
|
-
align === "right" && "text-right",
|
|
2458
|
-
tall && "!leading-6"
|
|
2459
|
-
),
|
|
2460
|
-
style: __spreadProps(__spreadValues({}, props.style), {
|
|
2461
|
-
color: color ? `var(--color-${color})` : void 0
|
|
2462
|
-
})
|
|
2463
|
-
}, props), {
|
|
2464
|
-
children
|
|
2465
|
-
})
|
|
2127
|
+
|
|
2128
|
+
// src/components/DataGrid/utils.tsx
|
|
2129
|
+
var import_clsx9 = __toESM(require("clsx"), 1);
|
|
2130
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2131
|
+
function getSortIcon(sort, nextSort = false) {
|
|
2132
|
+
const iconClassName = (0, import_clsx9.default)(
|
|
2133
|
+
"text-icon-on-action-primary-normal",
|
|
2134
|
+
nextSort && "hidden group-hover:block"
|
|
2466
2135
|
);
|
|
2467
|
-
|
|
2468
|
-
|
|
2136
|
+
if (sort === "asc")
|
|
2137
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { size: 16, className: iconClassName, name: "arrow_upward" });
|
|
2138
|
+
if (sort === "desc")
|
|
2139
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { size: 16, className: iconClassName, name: "arrow_downward" });
|
|
2140
|
+
return null;
|
|
2141
|
+
}
|
|
2469
2142
|
|
|
2470
|
-
// src/components/
|
|
2471
|
-
var
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
var
|
|
2475
|
-
var
|
|
2143
|
+
// src/components/DataGrid/PinnedColumns.tsx
|
|
2144
|
+
var import_react12 = __toESM(require("react"), 1);
|
|
2145
|
+
|
|
2146
|
+
// src/components/DataGrid/TableBody/index.tsx
|
|
2147
|
+
var import_react_virtual = require("@tanstack/react-virtual");
|
|
2148
|
+
var import_clsx11 = __toESM(require("clsx"), 1);
|
|
2149
|
+
|
|
2150
|
+
// src/components/DataGrid/TableBody/TableBodyRow.tsx
|
|
2151
|
+
var import_clsx10 = __toESM(require("clsx"), 1);
|
|
2152
|
+
var import_react_table = require("@tanstack/react-table");
|
|
2153
|
+
var import_react11 = __toESM(require("react"), 1);
|
|
2154
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2155
|
+
function TableBodyRow({
|
|
2476
2156
|
id,
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
left = rect.left + rect.width / 2 - tooltipRect.width / 2;
|
|
2502
|
-
break;
|
|
2503
|
-
case "left":
|
|
2504
|
-
top = rect.top + rect.height / 2 - tooltipRect.height / 2;
|
|
2505
|
-
left = rect.left - tooltipRect.width - offset;
|
|
2506
|
-
break;
|
|
2507
|
-
case "right":
|
|
2508
|
-
top = rect.top + rect.height / 2 - tooltipRect.height / 2;
|
|
2509
|
-
left = rect.right + offset;
|
|
2510
|
-
break;
|
|
2511
|
-
}
|
|
2512
|
-
setTooltipPosition({ top, left });
|
|
2513
|
-
requestAnimationFrame(() => {
|
|
2514
|
-
setRemoveOpacity(true);
|
|
2515
|
-
});
|
|
2516
|
-
};
|
|
2517
|
-
const handleMouseEnter = () => {
|
|
2518
|
-
if (!showOnTruncation || checkForTextTruncation()) {
|
|
2519
|
-
setIsVisible(true);
|
|
2520
|
-
}
|
|
2521
|
-
};
|
|
2522
|
-
const handleMouseLeave = () => {
|
|
2523
|
-
setIsVisible(false);
|
|
2524
|
-
setRemoveOpacity(false);
|
|
2525
|
-
};
|
|
2526
|
-
(0, import_react11.useEffect)(() => {
|
|
2527
|
-
if (isVisible && tooltipRef.current) {
|
|
2528
|
-
requestAnimationFrame(() => {
|
|
2529
|
-
updatePosition();
|
|
2530
|
-
});
|
|
2531
|
-
}
|
|
2532
|
-
}, [isVisible]);
|
|
2533
|
-
(0, import_react11.useEffect)(() => {
|
|
2534
|
-
if (isVisible) {
|
|
2535
|
-
window.addEventListener("resize", updatePosition);
|
|
2536
|
-
return () => window.removeEventListener("resize", updatePosition);
|
|
2537
|
-
}
|
|
2538
|
-
}, [isVisible]);
|
|
2539
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2540
|
-
"div",
|
|
2157
|
+
columnVirtualizer,
|
|
2158
|
+
row,
|
|
2159
|
+
// rowVirtualizer,
|
|
2160
|
+
virtualPaddingLeft,
|
|
2161
|
+
virtualPaddingRight,
|
|
2162
|
+
virtualRow,
|
|
2163
|
+
showFilterRow,
|
|
2164
|
+
enableColumnSelector = false,
|
|
2165
|
+
locked,
|
|
2166
|
+
pinDirection
|
|
2167
|
+
}) {
|
|
2168
|
+
var _a;
|
|
2169
|
+
let visibleCells;
|
|
2170
|
+
if (locked) {
|
|
2171
|
+
visibleCells = pinDirection === "left" ? row.getLeftVisibleCells() : row.getRightVisibleCells();
|
|
2172
|
+
} else {
|
|
2173
|
+
visibleCells = row.getCenterVisibleCells();
|
|
2174
|
+
}
|
|
2175
|
+
const virtualColumns = (_a = columnVirtualizer == null ? void 0 : columnVirtualizer.getVirtualItems()) != null ? _a : [];
|
|
2176
|
+
const columns = locked ? visibleCells : virtualColumns;
|
|
2177
|
+
const isError = typeof row.original === "object" && row.original !== null && "rowState" in row.original && row.original.rowState === "error";
|
|
2178
|
+
const CellElement = locked ? DataGridCell : DragAlongCell;
|
|
2179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2180
|
+
"tr",
|
|
2541
2181
|
{
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2182
|
+
className: (0, import_clsx10.default)(
|
|
2183
|
+
"transition-colors hover:bg-background-action-secondary-hover",
|
|
2184
|
+
row.getIsSelected() && "!bg-background-action-secondary-hover",
|
|
2185
|
+
isError && "!bg-background-action-critical-secondary-hover",
|
|
2186
|
+
showFilterRow ? "even:bg-background-grouped-primary-normal odd:bg-background-grouped-secondary-normal" : "odd:bg-background-grouped-primary-normal even:bg-background-grouped-secondary-normal"
|
|
2187
|
+
),
|
|
2188
|
+
style: {
|
|
2189
|
+
display: "flex",
|
|
2190
|
+
position: "absolute",
|
|
2191
|
+
transform: `translateY(${showFilterRow ? virtualRow.start + 40 : virtualRow.start}px)`,
|
|
2192
|
+
width: "100%"
|
|
2193
|
+
},
|
|
2547
2194
|
children: [
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
/* @__PURE__ */ (0,
|
|
2551
|
-
|
|
2195
|
+
!locked && virtualPaddingLeft ? (
|
|
2196
|
+
// fake empty column to the left for virtualization scroll padding
|
|
2197
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("td", { style: { display: "flex", width: virtualPaddingLeft } })
|
|
2198
|
+
) : null,
|
|
2199
|
+
columns.map((column) => {
|
|
2200
|
+
var _a2, _b;
|
|
2201
|
+
const cell = locked ? column : visibleCells[column.index];
|
|
2202
|
+
if (!cell) {
|
|
2203
|
+
return;
|
|
2204
|
+
}
|
|
2205
|
+
const cellValue = cell.getValue();
|
|
2206
|
+
return ((_a2 = cell.column.columnDef.meta) == null ? void 0 : _a2.useCustomRenderer) ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react11.default.Fragment, { children: (0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext()) }, cell.id) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2207
|
+
CellElement,
|
|
2552
2208
|
{
|
|
2553
|
-
id: id ? `${id}-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2209
|
+
id: id ? `${id}-cell-${cell.id}` : void 0,
|
|
2210
|
+
cell,
|
|
2211
|
+
className: (0, import_clsx10.default)({
|
|
2212
|
+
"justify-end": typeof cellValue === "number"
|
|
2213
|
+
}),
|
|
2214
|
+
width: (_b = cell.column.columnDef.meta) == null ? void 0 : _b.headerWidth,
|
|
2215
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2216
|
+
Tooltip,
|
|
2217
|
+
{
|
|
2218
|
+
id: id ? `${id}-tooltip-${cell.id}` : void 0,
|
|
2219
|
+
showOnTruncation: true,
|
|
2220
|
+
message: cellValue,
|
|
2221
|
+
position: "bottom",
|
|
2222
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Paragraph, { addOverflow: true, tall: true, children: cellValue })
|
|
2223
|
+
}
|
|
2224
|
+
)
|
|
2225
|
+
},
|
|
2226
|
+
cell.id
|
|
2227
|
+
);
|
|
2228
|
+
}),
|
|
2229
|
+
!locked && virtualPaddingRight ? (
|
|
2230
|
+
// fake empty column to the right for virtualization scroll padding
|
|
2231
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("td", { style: { display: "flex", width: virtualPaddingRight } })
|
|
2232
|
+
) : null,
|
|
2233
|
+
enableColumnSelector && !locked && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("td", { className: "p-2", style: { width: "48.8px" } })
|
|
2572
2234
|
]
|
|
2573
|
-
}
|
|
2235
|
+
},
|
|
2236
|
+
row.id
|
|
2574
2237
|
);
|
|
2575
|
-
function checkForTextTruncation() {
|
|
2576
|
-
if (showOnTruncation && ref.current) {
|
|
2577
|
-
const paragraph = ref.current.querySelector("p");
|
|
2578
|
-
if (paragraph) {
|
|
2579
|
-
const isTruncated = paragraph.scrollWidth > paragraph.clientWidth;
|
|
2580
|
-
return isTruncated;
|
|
2581
|
-
}
|
|
2582
|
-
}
|
|
2583
|
-
return false;
|
|
2584
|
-
}
|
|
2585
|
-
};
|
|
2586
|
-
Tooltip.displayName = "Tooltip";
|
|
2587
|
-
|
|
2588
|
-
// src/components/useInfiniteScroll.tsx
|
|
2589
|
-
var import_react12 = require("react");
|
|
2590
|
-
function useInfiniteScroll({
|
|
2591
|
-
containerRef,
|
|
2592
|
-
onLoadMore,
|
|
2593
|
-
isLoading,
|
|
2594
|
-
offset = 50,
|
|
2595
|
-
enabled = true
|
|
2596
|
-
// ✅ Add this
|
|
2597
|
-
}) {
|
|
2598
|
-
(0, import_react12.useEffect)(() => {
|
|
2599
|
-
if (!enabled) return;
|
|
2600
|
-
const handleScroll = () => {
|
|
2601
|
-
const el2 = containerRef.current;
|
|
2602
|
-
if (!el2 || isLoading) return;
|
|
2603
|
-
const { scrollTop, scrollHeight, clientHeight } = el2;
|
|
2604
|
-
const isNearBottom = scrollTop + clientHeight >= scrollHeight - offset;
|
|
2605
|
-
if (isNearBottom) {
|
|
2606
|
-
onLoadMore();
|
|
2607
|
-
}
|
|
2608
|
-
};
|
|
2609
|
-
const el = containerRef.current;
|
|
2610
|
-
if (el) el.addEventListener("scroll", handleScroll);
|
|
2611
|
-
return () => {
|
|
2612
|
-
if (el) el.removeEventListener("scroll", handleScroll);
|
|
2613
|
-
};
|
|
2614
|
-
}, [containerRef, onLoadMore, isLoading, offset, enabled]);
|
|
2615
2238
|
}
|
|
2616
2239
|
|
|
2617
|
-
// src/components/DataGrid.tsx
|
|
2618
|
-
var
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2240
|
+
// src/components/DataGrid/TableBody/LoadingCell.tsx
|
|
2241
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2242
|
+
function LoadingCell({
|
|
2243
|
+
id,
|
|
2244
|
+
column
|
|
2245
|
+
}) {
|
|
2246
|
+
const key = `loading-${column.id}`;
|
|
2247
|
+
if (column.cell === "checkbox") {
|
|
2248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DataGridCell, { id: id ? `${id}-${key}` : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Checkbox, { id: id ? `${id}-${key}-checkbox` : void 0, disabled: true }) }, key);
|
|
2249
|
+
}
|
|
2250
|
+
if (column.cell === "input") {
|
|
2251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2252
|
+
DataGridCell,
|
|
2253
|
+
{
|
|
2254
|
+
id: id ? `${id}-${key}` : void 0,
|
|
2255
|
+
component: "input",
|
|
2256
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2257
|
+
Input,
|
|
2258
|
+
{
|
|
2259
|
+
id: id ? `${id}-${key}-input` : void 0,
|
|
2260
|
+
align: "left",
|
|
2261
|
+
disabled: true,
|
|
2262
|
+
wrapperClassName: "!rounded-none !border-0"
|
|
2263
|
+
}
|
|
2264
|
+
)
|
|
2265
|
+
},
|
|
2266
|
+
key
|
|
2626
2267
|
);
|
|
2627
|
-
}
|
|
2268
|
+
}
|
|
2269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DataGridCell, { id: id ? `${id}-${key}` : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "bg-linear-270 to-neutral-300/[24%] from-neutral-300/[12%] rounded-xs w-full max-w-25 h-6" }) }, key);
|
|
2628
2270
|
}
|
|
2629
|
-
|
|
2271
|
+
|
|
2272
|
+
// src/components/DataGrid/TableBody/index.tsx
|
|
2273
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2274
|
+
function TableBody({
|
|
2630
2275
|
id,
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2276
|
+
columnVirtualizer,
|
|
2277
|
+
table,
|
|
2278
|
+
tableContainerRef,
|
|
2279
|
+
virtualPaddingLeft,
|
|
2280
|
+
virtualPaddingRight,
|
|
2636
2281
|
pagination,
|
|
2637
|
-
|
|
2638
|
-
hasMore
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
rowSelection: externalRowSelection,
|
|
2644
|
-
onRowSelectionChange,
|
|
2645
|
-
filteredSortedData,
|
|
2646
|
-
totalRowCount,
|
|
2647
|
-
hideStatusBar,
|
|
2648
|
-
centerHeader,
|
|
2649
|
-
enableColumnSelector,
|
|
2650
|
-
predeterminedLeftPins = [],
|
|
2651
|
-
predeterminedRightPins = []
|
|
2282
|
+
isLoadingMore,
|
|
2283
|
+
hasMore,
|
|
2284
|
+
showFilterRow,
|
|
2285
|
+
enableColumnSelector = false,
|
|
2286
|
+
locked,
|
|
2287
|
+
pinDirection
|
|
2652
2288
|
}) {
|
|
2653
|
-
|
|
2654
|
-
const
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
const [localRowSelection, setLocalRowSelection] = (0, import_react13.useState)({});
|
|
2660
|
-
const sortingState = pagination ? externalSorting != null ? externalSorting : localSorting : localSorting;
|
|
2661
|
-
const setSortingState = pagination ? (updaterOrValue) => {
|
|
2662
|
-
const value = typeof updaterOrValue === "function" ? updaterOrValue(
|
|
2663
|
-
externalSorting != null ? externalSorting : []
|
|
2664
|
-
) : updaterOrValue;
|
|
2665
|
-
(onSortingChange != null ? onSortingChange : setLocalSorting)(value);
|
|
2666
|
-
} : setLocalSorting;
|
|
2667
|
-
const columnFilterState = pagination ? externalColumnFilters != null ? externalColumnFilters : localColumnFilters : localColumnFilters;
|
|
2668
|
-
const setColumnFilterState = pagination ? (updaterOrValue) => {
|
|
2669
|
-
const value = typeof updaterOrValue === "function" ? updaterOrValue(externalColumnFilters != null ? externalColumnFilters : []) : updaterOrValue;
|
|
2670
|
-
(onColumnFiltersChange != null ? onColumnFiltersChange : setLocalColumnFilters)(value);
|
|
2671
|
-
} : setLocalColumnFilters;
|
|
2672
|
-
const rowSelection = pagination ? externalRowSelection != null ? externalRowSelection : localRowSelection : localRowSelection;
|
|
2673
|
-
const setRowSelection = pagination ? (updaterOrValue) => {
|
|
2674
|
-
const value = typeof updaterOrValue === "function" ? updaterOrValue(externalRowSelection != null ? externalRowSelection : {}) : updaterOrValue;
|
|
2675
|
-
(onRowSelectionChange != null ? onRowSelectionChange : setLocalRowSelection)(value);
|
|
2676
|
-
} : setLocalRowSelection;
|
|
2677
|
-
const dndId = (0, import_react13.useId)();
|
|
2678
|
-
const containerRef = import_react13.default.useRef(null);
|
|
2679
|
-
const [columnVisibility, setColumnVisibility] = (0, import_react13.useState)(() => {
|
|
2680
|
-
const initialVisibility = {};
|
|
2681
|
-
columns.forEach((column) => {
|
|
2682
|
-
var _a2, _b2;
|
|
2683
|
-
if (column.id) {
|
|
2684
|
-
initialVisibility[column.id] = (_b2 = (_a2 = column.meta) == null ? void 0 : _a2.visible) != null ? _b2 : true;
|
|
2685
|
-
}
|
|
2686
|
-
});
|
|
2687
|
-
return initialVisibility;
|
|
2289
|
+
const { rows } = table.getRowModel();
|
|
2290
|
+
const rowVirtualizer = (0, import_react_virtual.useVirtualizer)({
|
|
2291
|
+
count: rows.length,
|
|
2292
|
+
estimateSize: () => 40,
|
|
2293
|
+
getScrollElement: () => tableContainerRef.current,
|
|
2294
|
+
overscan: 8
|
|
2688
2295
|
});
|
|
2689
|
-
const
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
)
|
|
2695
|
-
|
|
2296
|
+
const virtualRows = rowVirtualizer.getVirtualItems();
|
|
2297
|
+
const CellElement = locked ? DataGridCell : DragAlongCell;
|
|
2298
|
+
let headerGroups;
|
|
2299
|
+
if (pinDirection === "left") {
|
|
2300
|
+
headerGroups = table.getLeftHeaderGroups();
|
|
2301
|
+
} else if (pinDirection === "right") {
|
|
2302
|
+
headerGroups = table.getRightHeaderGroups();
|
|
2303
|
+
} else {
|
|
2304
|
+
headerGroups = table.getCenterHeaderGroups();
|
|
2305
|
+
}
|
|
2306
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
2307
|
+
"tbody",
|
|
2308
|
+
{
|
|
2309
|
+
className: (0, import_clsx11.default)(locked ? "shadow-16" : ""),
|
|
2310
|
+
style: {
|
|
2311
|
+
display: "grid",
|
|
2312
|
+
height: `${showFilterRow ? rowVirtualizer.getTotalSize() + 40 : rowVirtualizer.getTotalSize()}px`,
|
|
2313
|
+
// tells scrollbar how big the table is
|
|
2314
|
+
position: "relative"
|
|
2315
|
+
// needed for absolute positioning of rows
|
|
2316
|
+
},
|
|
2317
|
+
children: [
|
|
2318
|
+
showFilterRow && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2319
|
+
"tr",
|
|
2320
|
+
{
|
|
2321
|
+
style: {
|
|
2322
|
+
display: "flex",
|
|
2323
|
+
position: "sticky",
|
|
2324
|
+
top: "40px",
|
|
2325
|
+
width: "100%",
|
|
2326
|
+
height: "40px",
|
|
2327
|
+
zIndex: 10
|
|
2328
|
+
},
|
|
2329
|
+
className: "even:bg-background-grouped-primary-normal odd:bg-background-grouped-secondary-normal",
|
|
2330
|
+
children: headerGroups.flatMap(
|
|
2331
|
+
(x) => x.headers.map((header) => {
|
|
2332
|
+
var _a, _b, _c, _d, _e;
|
|
2333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2334
|
+
CellElement,
|
|
2335
|
+
{
|
|
2336
|
+
id: id ? `${id}-filter-cell-${header.id}` : void 0,
|
|
2337
|
+
noPadding: true,
|
|
2338
|
+
cell: header,
|
|
2339
|
+
width: ((_a = header.column.columnDef.meta) == null ? void 0 : _a.headerWidth) || (locked ? `${header.column.getSize()}px` : ""),
|
|
2340
|
+
children: header.column.getCanFilter() && ((_e = (_c = (_b = header.column.columnDef.meta) == null ? void 0 : _b.filterRowCell) == null ? void 0 : _c.call(_b, {
|
|
2341
|
+
header,
|
|
2342
|
+
table
|
|
2343
|
+
})) != null ? _e : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2344
|
+
Search,
|
|
2345
|
+
{
|
|
2346
|
+
id: id ? `${id}-filter-search-${header.id}` : void 0,
|
|
2347
|
+
removeRoundness: true,
|
|
2348
|
+
onChange: (e) => header.column.setFilterValue(e.target.value),
|
|
2349
|
+
value: (_d = header.column.getFilterValue()) != null ? _d : "",
|
|
2350
|
+
placeholder: "",
|
|
2351
|
+
removeSearchIcon: true
|
|
2352
|
+
}
|
|
2353
|
+
))
|
|
2354
|
+
},
|
|
2355
|
+
header.id
|
|
2356
|
+
);
|
|
2357
|
+
})
|
|
2358
|
+
)
|
|
2359
|
+
}
|
|
2360
|
+
),
|
|
2361
|
+
virtualRows.map((virtualRow) => {
|
|
2362
|
+
const row = rows[virtualRow.index];
|
|
2363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2364
|
+
TableBodyRow,
|
|
2365
|
+
{
|
|
2366
|
+
id,
|
|
2367
|
+
columnVirtualizer,
|
|
2368
|
+
row,
|
|
2369
|
+
rowVirtualizer,
|
|
2370
|
+
virtualPaddingLeft,
|
|
2371
|
+
virtualPaddingRight,
|
|
2372
|
+
virtualRow,
|
|
2373
|
+
showFilterRow,
|
|
2374
|
+
enableColumnSelector,
|
|
2375
|
+
locked,
|
|
2376
|
+
pinDirection
|
|
2377
|
+
},
|
|
2378
|
+
row.id
|
|
2379
|
+
);
|
|
2380
|
+
}),
|
|
2381
|
+
!pagination && isLoadingMore && hasMore && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2382
|
+
"tr",
|
|
2383
|
+
{
|
|
2384
|
+
style: {
|
|
2385
|
+
display: "flex",
|
|
2386
|
+
position: "absolute",
|
|
2387
|
+
width: "100%",
|
|
2388
|
+
transform: `translateY(${virtualRows[virtualRows.length - 1].start + 40}px)`
|
|
2389
|
+
},
|
|
2390
|
+
className: "odd:bg-background-grouped-primary-normal even:bg-background-grouped-secondary-normal",
|
|
2391
|
+
children: table.getAllLeafColumns().map((column) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LoadingCell, { id, column: column.columnDef }, column.id))
|
|
2392
|
+
}
|
|
2393
|
+
)
|
|
2394
|
+
]
|
|
2395
|
+
}
|
|
2396
|
+
);
|
|
2397
|
+
}
|
|
2398
|
+
|
|
2399
|
+
// src/components/DataGrid/PinnedColumns.tsx
|
|
2400
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2401
|
+
function PinnedColumns(_a) {
|
|
2402
|
+
var _b = _a, {
|
|
2403
|
+
pinDirection = "left",
|
|
2404
|
+
table,
|
|
2405
|
+
centerHeader,
|
|
2406
|
+
allSelectedAcrossPages,
|
|
2407
|
+
someSelectedAcrossPages,
|
|
2408
|
+
toggleSelectAllAcrossPages
|
|
2409
|
+
} = _b, props = __objRest(_b, [
|
|
2410
|
+
"pinDirection",
|
|
2411
|
+
"table",
|
|
2412
|
+
"centerHeader",
|
|
2413
|
+
"allSelectedAcrossPages",
|
|
2414
|
+
"someSelectedAcrossPages",
|
|
2415
|
+
"toggleSelectAllAcrossPages"
|
|
2416
|
+
]);
|
|
2417
|
+
var _a2;
|
|
2418
|
+
const headerGroups = pinDirection === "left" ? table.getLeftHeaderGroups() : table.getRightHeaderGroups();
|
|
2419
|
+
return ((_a2 = headerGroups[0]) == null ? void 0 : _a2.headers.length) > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2420
|
+
"table",
|
|
2421
|
+
{
|
|
2422
|
+
className: (0, import_clsx12.default)(
|
|
2423
|
+
"flex flex-col min-h-min sticky z-20 bg-background-grouped-primary-normal",
|
|
2424
|
+
pinDirection === "left" ? "left-0" : "right-0"
|
|
2425
|
+
),
|
|
2426
|
+
children: [
|
|
2427
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("thead", { className: "sticky top-0 z-20 grid", children: headerGroups.map((headerGroup) => {
|
|
2428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("tr", { className: "flex w-full", children: headerGroup.headers.map((header) => {
|
|
2429
|
+
var _a3, _b2, _c;
|
|
2430
|
+
if (!header) {
|
|
2431
|
+
return;
|
|
2432
|
+
}
|
|
2433
|
+
if (typeof header.column.columnDef.header === "string") {
|
|
2434
|
+
const customHeaderWidth = (_a3 = header.column.columnDef.meta) == null ? void 0 : _a3.headerWidth;
|
|
2435
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2436
|
+
DataCellHeader,
|
|
2437
|
+
{
|
|
2438
|
+
locked: true,
|
|
2439
|
+
header,
|
|
2440
|
+
center: centerHeader,
|
|
2441
|
+
width: customHeaderWidth,
|
|
2442
|
+
className: (0, import_clsx12.default)(
|
|
2443
|
+
header.column.getCanSort() ? "cursor-pointer" : "cursor-grab",
|
|
2444
|
+
"group"
|
|
2445
|
+
),
|
|
2446
|
+
children: [
|
|
2447
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Subheader, { tall: true, children: header.column.columnDef.header }),
|
|
2448
|
+
getSortIcon(header.column.getIsSorted()),
|
|
2449
|
+
!header.column.getIsSorted() && header.column.getCanSort() && getSortIcon(
|
|
2450
|
+
header.column.getNextSortingOrder(),
|
|
2451
|
+
true
|
|
2452
|
+
),
|
|
2453
|
+
header.column.getSortIndex() !== -1 && table.getState().sorting.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Subheader, { tall: true, children: header.column.getSortIndex() + 1 }),
|
|
2454
|
+
!((_b2 = header.column.columnDef.meta) == null ? void 0 : _b2.locked) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2455
|
+
"div",
|
|
2456
|
+
{
|
|
2457
|
+
onDoubleClick: (e) => {
|
|
2458
|
+
e.stopPropagation();
|
|
2459
|
+
header.column.resetSize();
|
|
2460
|
+
},
|
|
2461
|
+
onMouseDown: (e) => {
|
|
2462
|
+
e.stopPropagation();
|
|
2463
|
+
header.getResizeHandler()(e);
|
|
2464
|
+
},
|
|
2465
|
+
onTouchStart: (e) => {
|
|
2466
|
+
e.stopPropagation();
|
|
2467
|
+
header.getResizeHandler()(e);
|
|
2468
|
+
},
|
|
2469
|
+
className: "absolute right-0 inset-y-0 w-px bg-black cursor-col-resize"
|
|
2470
|
+
}
|
|
2471
|
+
)
|
|
2472
|
+
]
|
|
2473
|
+
},
|
|
2474
|
+
header.id
|
|
2475
|
+
);
|
|
2476
|
+
}
|
|
2477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react12.default.Fragment, { children: ((_c = header.column.columnDef.meta) == null ? void 0 : _c.checkbox) ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DataGridCell, { type: "header", component: "checkbox", locked: true, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2478
|
+
Checkbox,
|
|
2479
|
+
{
|
|
2480
|
+
checked: allSelectedAcrossPages,
|
|
2481
|
+
indeterminate: someSelectedAcrossPages,
|
|
2482
|
+
onChange: toggleSelectAllAcrossPages
|
|
2483
|
+
}
|
|
2484
|
+
) }) : (0, import_react_table2.flexRender)(
|
|
2485
|
+
header.column.columnDef.header,
|
|
2486
|
+
header.getContext()
|
|
2487
|
+
) }, header.id);
|
|
2488
|
+
}) }, headerGroup.id);
|
|
2489
|
+
}) }),
|
|
2490
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2491
|
+
TableBody,
|
|
2492
|
+
__spreadProps(__spreadValues({}, props), {
|
|
2493
|
+
table,
|
|
2494
|
+
locked: true,
|
|
2495
|
+
pinDirection
|
|
2496
|
+
})
|
|
2497
|
+
)
|
|
2498
|
+
]
|
|
2499
|
+
}
|
|
2500
|
+
);
|
|
2501
|
+
}
|
|
2502
|
+
|
|
2503
|
+
// src/components/DataGrid/ColumnSelectorHeaderCell/index.tsx
|
|
2504
|
+
var import_react14 = require("react");
|
|
2505
|
+
|
|
2506
|
+
// src/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.tsx
|
|
2507
|
+
var import_react13 = require("react");
|
|
2508
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2509
|
+
function ColumnSelectorMenuOption({
|
|
2510
|
+
id,
|
|
2511
|
+
column,
|
|
2512
|
+
toggleColumnVisibility
|
|
2513
|
+
}) {
|
|
2514
|
+
const [isVisible, setIsVisible] = (0, import_react13.useState)(column.getIsVisible());
|
|
2515
|
+
const label = typeof column.columnDef.header === "string" ? column.columnDef.header : null;
|
|
2516
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MenuOption, { id, selected: isVisible, defaultChecked: isVisible, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2517
|
+
Checkbox,
|
|
2518
|
+
{
|
|
2519
|
+
id: id ? `${id}-checkbox` : void 0,
|
|
2520
|
+
label: label != null ? label : "Unknown",
|
|
2521
|
+
checked: isVisible,
|
|
2522
|
+
onChange: (e) => {
|
|
2523
|
+
setIsVisible(e.target.checked);
|
|
2524
|
+
toggleColumnVisibility(column.id, e.target.checked);
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
) });
|
|
2528
|
+
}
|
|
2529
|
+
|
|
2530
|
+
// src/components/DataGrid/ColumnSelectorHeaderCell/index.tsx
|
|
2531
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2532
|
+
function ColumnSelectorHeaderCell({
|
|
2533
|
+
id,
|
|
2534
|
+
table,
|
|
2535
|
+
toggleColumnVisibility,
|
|
2536
|
+
resetColumnVisibility
|
|
2537
|
+
}) {
|
|
2538
|
+
const ref = (0, import_react14.useRef)(null);
|
|
2539
|
+
const [show, setShow] = (0, import_react14.useState)(false);
|
|
2540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2541
|
+
DataGridCell,
|
|
2542
|
+
{
|
|
2543
|
+
id,
|
|
2544
|
+
width: "48",
|
|
2545
|
+
type: "header",
|
|
2546
|
+
color: "text-secondary-normal",
|
|
2547
|
+
ref,
|
|
2548
|
+
children: [
|
|
2549
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2550
|
+
Button,
|
|
2551
|
+
{
|
|
2552
|
+
id: id ? `${id}-button` : void 0,
|
|
2553
|
+
onClick: () => setShow((prev) => !prev),
|
|
2554
|
+
variant: "navigation",
|
|
2555
|
+
iconOnly: true,
|
|
2556
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Icon, { name: "tune" })
|
|
2557
|
+
}
|
|
2558
|
+
),
|
|
2559
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2560
|
+
Menu,
|
|
2561
|
+
{
|
|
2562
|
+
id: id ? `${id}-menu` : void 0,
|
|
2563
|
+
positionTo: ref,
|
|
2564
|
+
position: "bottom-right",
|
|
2565
|
+
show,
|
|
2566
|
+
setShow,
|
|
2567
|
+
children: [
|
|
2568
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2569
|
+
Button,
|
|
2570
|
+
{
|
|
2571
|
+
id: id ? `${id}-reset-button` : void 0,
|
|
2572
|
+
variant: "tertiary",
|
|
2573
|
+
onClick: () => {
|
|
2574
|
+
resetColumnVisibility();
|
|
2575
|
+
setShow(false);
|
|
2576
|
+
},
|
|
2577
|
+
children: "Reset to default"
|
|
2578
|
+
}
|
|
2579
|
+
),
|
|
2580
|
+
table.getAllColumns().filter((x) => {
|
|
2581
|
+
var _a;
|
|
2582
|
+
return (_a = x.columnDef.meta) == null ? void 0 : _a.inVisibilityMenu;
|
|
2583
|
+
}).map((column) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2584
|
+
ColumnSelectorMenuOption,
|
|
2585
|
+
{
|
|
2586
|
+
id: id ? `${id}-option-${column.id}` : void 0,
|
|
2587
|
+
column,
|
|
2588
|
+
toggleColumnVisibility
|
|
2589
|
+
},
|
|
2590
|
+
column.id
|
|
2591
|
+
))
|
|
2592
|
+
]
|
|
2593
|
+
}
|
|
2594
|
+
)
|
|
2595
|
+
]
|
|
2596
|
+
}
|
|
2597
|
+
);
|
|
2598
|
+
}
|
|
2599
|
+
|
|
2600
|
+
// src/components/DataGrid/index.tsx
|
|
2601
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2602
|
+
var PAGE_SIZE_OPTIONS = [5, 10, 15, 20, 25, 30, 35];
|
|
2603
|
+
var NO_RESULTS_HEIGHT = "h-[120px]";
|
|
2604
|
+
function DataGrid({
|
|
2605
|
+
id,
|
|
2606
|
+
data,
|
|
2607
|
+
columns,
|
|
2608
|
+
status,
|
|
2609
|
+
isLoadingMore = false,
|
|
2610
|
+
onLoadMore,
|
|
2611
|
+
pagination,
|
|
2612
|
+
showFilterRow = false,
|
|
2613
|
+
hasMore = false,
|
|
2614
|
+
sorting: externalSorting,
|
|
2615
|
+
onSortingChange,
|
|
2616
|
+
columnFilters: externalColumnFilters,
|
|
2617
|
+
onColumnFiltersChange,
|
|
2618
|
+
rowSelection: externalRowSelection,
|
|
2619
|
+
onRowSelectionChange,
|
|
2620
|
+
filteredSortedData,
|
|
2621
|
+
totalRowCount,
|
|
2622
|
+
hideStatusBar,
|
|
2623
|
+
centerHeader,
|
|
2624
|
+
enableColumnSelector,
|
|
2625
|
+
predeterminedLeftPins = [],
|
|
2626
|
+
predeterminedRightPins = [],
|
|
2627
|
+
useMenuDefaultMinWidth
|
|
2628
|
+
}) {
|
|
2629
|
+
var _a, _b, _c, _d, _e;
|
|
2630
|
+
const [columnOrder, setColumnOrder] = (0, import_react15.useState)(
|
|
2631
|
+
() => columns.map((c) => c.id)
|
|
2632
|
+
);
|
|
2633
|
+
const [localSorting, setLocalSorting] = (0, import_react15.useState)([]);
|
|
2634
|
+
const [localColumnFilters, setLocalColumnFilters] = (0, import_react15.useState)([]);
|
|
2635
|
+
const [localRowSelection, setLocalRowSelection] = (0, import_react15.useState)({});
|
|
2636
|
+
const sortingState = pagination ? externalSorting != null ? externalSorting : localSorting : localSorting;
|
|
2637
|
+
const setSortingState = pagination ? (updaterOrValue) => {
|
|
2638
|
+
const value = typeof updaterOrValue === "function" ? updaterOrValue(
|
|
2639
|
+
externalSorting != null ? externalSorting : []
|
|
2640
|
+
) : updaterOrValue;
|
|
2641
|
+
(onSortingChange != null ? onSortingChange : setLocalSorting)(value);
|
|
2642
|
+
} : setLocalSorting;
|
|
2643
|
+
const columnFilterState = pagination ? externalColumnFilters != null ? externalColumnFilters : localColumnFilters : localColumnFilters;
|
|
2644
|
+
const setColumnFilterState = pagination ? (updaterOrValue) => {
|
|
2645
|
+
const value = typeof updaterOrValue === "function" ? updaterOrValue(externalColumnFilters != null ? externalColumnFilters : []) : updaterOrValue;
|
|
2646
|
+
(onColumnFiltersChange != null ? onColumnFiltersChange : setLocalColumnFilters)(value);
|
|
2647
|
+
} : setLocalColumnFilters;
|
|
2648
|
+
const rowSelection = pagination ? externalRowSelection != null ? externalRowSelection : localRowSelection : localRowSelection;
|
|
2649
|
+
const setRowSelection = pagination ? (updaterOrValue) => {
|
|
2650
|
+
const value = typeof updaterOrValue === "function" ? updaterOrValue(externalRowSelection != null ? externalRowSelection : {}) : updaterOrValue;
|
|
2651
|
+
(onRowSelectionChange != null ? onRowSelectionChange : setLocalRowSelection)(value);
|
|
2652
|
+
} : setLocalRowSelection;
|
|
2653
|
+
const dndId = (0, import_react15.useId)();
|
|
2654
|
+
const containerRef = import_react15.default.useRef(null);
|
|
2655
|
+
const [columnVisibility, setColumnVisibility] = (0, import_react15.useState)(() => {
|
|
2656
|
+
const initialVisibility = {};
|
|
2657
|
+
columns.forEach((column) => {
|
|
2658
|
+
var _a2, _b2;
|
|
2659
|
+
if (column.id) {
|
|
2660
|
+
initialVisibility[column.id] = (_b2 = (_a2 = column.meta) == null ? void 0 : _a2.visible) != null ? _b2 : true;
|
|
2661
|
+
}
|
|
2662
|
+
});
|
|
2663
|
+
return initialVisibility;
|
|
2664
|
+
});
|
|
2665
|
+
const toggleColumnVisibility = (0, import_react15.useCallback)(
|
|
2666
|
+
(columnId, isVisible) => {
|
|
2667
|
+
setColumnVisibility((prev) => __spreadProps(__spreadValues({}, prev), { [columnId]: isVisible }));
|
|
2668
|
+
},
|
|
2669
|
+
[setColumnVisibility]
|
|
2670
|
+
);
|
|
2671
|
+
const resetColumnVisibility = (0, import_react15.useCallback)(() => {
|
|
2696
2672
|
setColumnVisibility(() => {
|
|
2697
2673
|
const initialVisibility = {};
|
|
2698
2674
|
columns.forEach((column) => {
|
|
@@ -2704,12 +2680,12 @@ function DataGrid({
|
|
|
2704
2680
|
return initialVisibility;
|
|
2705
2681
|
});
|
|
2706
2682
|
}, [columns]);
|
|
2707
|
-
const table = (0,
|
|
2683
|
+
const table = (0, import_react_table3.useReactTable)({
|
|
2708
2684
|
columns,
|
|
2709
2685
|
data,
|
|
2710
|
-
getCoreRowModel: (0,
|
|
2711
|
-
getSortedRowModel: (0,
|
|
2712
|
-
getFilteredRowModel: (0,
|
|
2686
|
+
getCoreRowModel: (0, import_react_table3.getCoreRowModel)(),
|
|
2687
|
+
getSortedRowModel: (0, import_react_table3.getSortedRowModel)(),
|
|
2688
|
+
getFilteredRowModel: (0, import_react_table3.getFilteredRowModel)(),
|
|
2713
2689
|
columnResizeMode: "onChange",
|
|
2714
2690
|
getRowId: (row, index) => {
|
|
2715
2691
|
var _a2;
|
|
@@ -2799,7 +2775,7 @@ function DataGrid({
|
|
|
2799
2775
|
(0, import_core.useSensor)(import_core.KeyboardSensor)
|
|
2800
2776
|
);
|
|
2801
2777
|
const visibleColumns = table.getVisibleLeafColumns();
|
|
2802
|
-
const columnVirtualizer = (0,
|
|
2778
|
+
const columnVirtualizer = (0, import_react_virtual2.useVirtualizer)({
|
|
2803
2779
|
count: visibleColumns.length,
|
|
2804
2780
|
estimateSize: (index) => visibleColumns[index].getSize(),
|
|
2805
2781
|
//estimate width of each column for accurate scrollbar dragging
|
|
@@ -2816,7 +2792,7 @@ function DataGrid({
|
|
|
2816
2792
|
virtualPaddingRight = columnVirtualizer.getTotalSize() - ((_e = (_d = virtualColumns[virtualColumns.length - 1]) == null ? void 0 : _d.end) != null ? _e : 0);
|
|
2817
2793
|
}
|
|
2818
2794
|
const empty = table.getRowModel().rows.length === 0;
|
|
2819
|
-
return /* @__PURE__ */ (0,
|
|
2795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2820
2796
|
import_core.DndContext,
|
|
2821
2797
|
{
|
|
2822
2798
|
id: dndId,
|
|
@@ -2824,27 +2800,27 @@ function DataGrid({
|
|
|
2824
2800
|
modifiers: [import_modifiers.restrictToHorizontalAxis],
|
|
2825
2801
|
onDragEnd: handleDragEnd,
|
|
2826
2802
|
sensors,
|
|
2827
|
-
children: /* @__PURE__ */ (0,
|
|
2803
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2828
2804
|
import_sortable2.SortableContext,
|
|
2829
2805
|
{
|
|
2830
2806
|
items: columnOrder,
|
|
2831
2807
|
strategy: import_sortable2.horizontalListSortingStrategy,
|
|
2832
|
-
children: /* @__PURE__ */ (0,
|
|
2808
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2833
2809
|
"div",
|
|
2834
2810
|
{
|
|
2835
2811
|
id,
|
|
2836
2812
|
className: "flex flex-col flex-1 h-full w-full rounded border border-border-primary-normal overflow-hidden text-text-primary-normal",
|
|
2837
2813
|
children: [
|
|
2838
|
-
/* @__PURE__ */ (0,
|
|
2814
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2839
2815
|
"div",
|
|
2840
2816
|
{
|
|
2841
|
-
className: (0,
|
|
2817
|
+
className: (0, import_clsx13.default)(
|
|
2842
2818
|
"flex overflow-auto scrollbar-thin relative contain-paint will-change-transform",
|
|
2843
2819
|
empty ? "overflow-y-hidden" : "h-full"
|
|
2844
2820
|
),
|
|
2845
2821
|
ref: containerRef,
|
|
2846
2822
|
children: [
|
|
2847
|
-
/* @__PURE__ */ (0,
|
|
2823
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2848
2824
|
PinnedColumns,
|
|
2849
2825
|
{
|
|
2850
2826
|
pinDirection: "left",
|
|
@@ -2857,11 +2833,11 @@ function DataGrid({
|
|
|
2857
2833
|
enableColumnSelector
|
|
2858
2834
|
}
|
|
2859
2835
|
),
|
|
2860
|
-
/* @__PURE__ */ (0,
|
|
2861
|
-
/* @__PURE__ */ (0,
|
|
2836
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("table", { className: "flex-1 flex flex-col min-h-min", children: [
|
|
2837
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("thead", { className: "sticky top-0 z-10 grid", children: table.getCenterHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("tr", { className: "flex w-full", children: [
|
|
2862
2838
|
virtualPaddingLeft ? (
|
|
2863
2839
|
// fake empty column to the left for virtualization scroll padding
|
|
2864
|
-
/* @__PURE__ */ (0,
|
|
2840
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2865
2841
|
"th",
|
|
2866
2842
|
{
|
|
2867
2843
|
style: { display: "flex", width: virtualPaddingLeft }
|
|
@@ -2869,34 +2845,39 @@ function DataGrid({
|
|
|
2869
2845
|
)
|
|
2870
2846
|
) : null,
|
|
2871
2847
|
virtualColumns.map((virtualColumn) => {
|
|
2872
|
-
var _a2, _b2, _c2, _d2;
|
|
2848
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
2873
2849
|
const header = headerGroup.headers[virtualColumn.index];
|
|
2874
2850
|
if (!header) {
|
|
2875
2851
|
return;
|
|
2876
2852
|
}
|
|
2877
2853
|
if (typeof header.column.columnDef.header === "string") {
|
|
2878
2854
|
const customHeaderWidth = (_a2 = header.column.columnDef.meta) == null ? void 0 : _a2.headerWidth;
|
|
2879
|
-
|
|
2855
|
+
const cellValue = (_b2 = table.getRowModel().rows[0]) == null ? void 0 : _b2.getValue(header.column.id);
|
|
2856
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2880
2857
|
DraggableCellHeader,
|
|
2881
2858
|
{
|
|
2882
2859
|
id: id ? `${id}-header-${header.id}` : void 0,
|
|
2883
2860
|
header,
|
|
2884
|
-
locked: (
|
|
2861
|
+
locked: (_c2 = header.column.columnDef.meta) == null ? void 0 : _c2.locked,
|
|
2885
2862
|
center: centerHeader,
|
|
2886
2863
|
width: customHeaderWidth,
|
|
2887
|
-
className: (0,
|
|
2864
|
+
className: (0, import_clsx13.default)(
|
|
2888
2865
|
header.column.getCanSort() ? "cursor-pointer" : "cursor-grab",
|
|
2889
|
-
"group"
|
|
2866
|
+
"group",
|
|
2867
|
+
{
|
|
2868
|
+
"justify-end": typeof cellValue === "number"
|
|
2869
|
+
}
|
|
2890
2870
|
),
|
|
2871
|
+
useMenuDefaultMinWidth,
|
|
2891
2872
|
children: [
|
|
2892
|
-
/* @__PURE__ */ (0,
|
|
2873
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Subheader, { tall: true, children: header.column.columnDef.header }),
|
|
2893
2874
|
getSortIcon(header.column.getIsSorted()),
|
|
2894
2875
|
!header.column.getIsSorted() && header.column.getCanSort() && getSortIcon(
|
|
2895
2876
|
header.column.getNextSortingOrder(),
|
|
2896
2877
|
true
|
|
2897
2878
|
),
|
|
2898
|
-
header.column.getSortIndex() !== -1 && table.getState().sorting.length > 1 && /* @__PURE__ */ (0,
|
|
2899
|
-
/* @__PURE__ */ (0,
|
|
2879
|
+
header.column.getSortIndex() !== -1 && table.getState().sorting.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Subheader, { tall: true, children: header.column.getSortIndex() + 1 }),
|
|
2880
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2900
2881
|
"div",
|
|
2901
2882
|
{
|
|
2902
2883
|
onDoubleClick: (e) => {
|
|
@@ -2919,14 +2900,14 @@ function DataGrid({
|
|
|
2919
2900
|
header.id
|
|
2920
2901
|
);
|
|
2921
2902
|
}
|
|
2922
|
-
return /* @__PURE__ */ (0,
|
|
2903
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react15.default.Fragment, { children: ((_d2 = header.column.columnDef.meta) == null ? void 0 : _d2.checkbox) ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2923
2904
|
DataGridCell,
|
|
2924
2905
|
{
|
|
2925
2906
|
id: id ? `${id}-header-${header.id}` : void 0,
|
|
2926
2907
|
type: "header",
|
|
2927
2908
|
component: "checkbox",
|
|
2928
|
-
locked: (
|
|
2929
|
-
children: /* @__PURE__ */ (0,
|
|
2909
|
+
locked: (_e2 = header.column.columnDef.meta) == null ? void 0 : _e2.locked,
|
|
2910
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2930
2911
|
Checkbox,
|
|
2931
2912
|
{
|
|
2932
2913
|
id: id ? `${id}-select-all-checkbox` : void 0,
|
|
@@ -2936,21 +2917,21 @@ function DataGrid({
|
|
|
2936
2917
|
}
|
|
2937
2918
|
)
|
|
2938
2919
|
}
|
|
2939
|
-
) : (0,
|
|
2920
|
+
) : (0, import_react_table3.flexRender)(
|
|
2940
2921
|
header.column.columnDef.header,
|
|
2941
2922
|
header.getContext()
|
|
2942
2923
|
) }, header.id);
|
|
2943
2924
|
}),
|
|
2944
2925
|
virtualPaddingRight ? (
|
|
2945
2926
|
//fake empty column to the right for virtualization scroll padding
|
|
2946
|
-
/* @__PURE__ */ (0,
|
|
2927
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2947
2928
|
"th",
|
|
2948
2929
|
{
|
|
2949
2930
|
style: { display: "flex", width: virtualPaddingRight }
|
|
2950
2931
|
}
|
|
2951
2932
|
)
|
|
2952
2933
|
) : null,
|
|
2953
|
-
enableColumnSelector && /* @__PURE__ */ (0,
|
|
2934
|
+
enableColumnSelector && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2954
2935
|
ColumnSelectorHeaderCell,
|
|
2955
2936
|
{
|
|
2956
2937
|
id: id ? `${id}-column-selector` : void 0,
|
|
@@ -2960,7 +2941,7 @@ function DataGrid({
|
|
|
2960
2941
|
}
|
|
2961
2942
|
)
|
|
2962
2943
|
] }, headerGroup.id)) }),
|
|
2963
|
-
/* @__PURE__ */ (0,
|
|
2944
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2964
2945
|
TableBody,
|
|
2965
2946
|
{
|
|
2966
2947
|
id,
|
|
@@ -2977,7 +2958,7 @@ function DataGrid({
|
|
|
2977
2958
|
}
|
|
2978
2959
|
)
|
|
2979
2960
|
] }),
|
|
2980
|
-
/* @__PURE__ */ (0,
|
|
2961
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2981
2962
|
PinnedColumns,
|
|
2982
2963
|
{
|
|
2983
2964
|
pinDirection: "right",
|
|
@@ -2993,25 +2974,25 @@ function DataGrid({
|
|
|
2993
2974
|
]
|
|
2994
2975
|
}
|
|
2995
2976
|
),
|
|
2996
|
-
empty && /* @__PURE__ */ (0,
|
|
2977
|
+
empty && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2997
2978
|
"div",
|
|
2998
2979
|
{
|
|
2999
|
-
className: (0,
|
|
2980
|
+
className: (0, import_clsx13.default)(
|
|
3000
2981
|
NO_RESULTS_HEIGHT,
|
|
3001
2982
|
"flex flex-col items-center justify-center",
|
|
3002
2983
|
componentGap,
|
|
3003
2984
|
componentPadding
|
|
3004
2985
|
),
|
|
3005
2986
|
children: [
|
|
3006
|
-
/* @__PURE__ */ (0,
|
|
3007
|
-
/* @__PURE__ */ (0,
|
|
2987
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Subheader, { color: "text-secondary-normal", children: "No Results" }),
|
|
2988
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Paragraph, { color: "text-secondary-normal", children: "To view results, enter or update your search criteria." })
|
|
3008
2989
|
]
|
|
3009
2990
|
}
|
|
3010
2991
|
),
|
|
3011
|
-
!hideStatusBar && /* @__PURE__ */ (0,
|
|
3012
|
-
pagination && /* @__PURE__ */ (0,
|
|
3013
|
-
/* @__PURE__ */ (0,
|
|
3014
|
-
/* @__PURE__ */ (0,
|
|
2992
|
+
!hideStatusBar && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "p-2 pt-[7px] border-t border-border-primary-normal h-full min-h-[34px]", children: [
|
|
2993
|
+
pagination && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex justify-between items-center", children: [
|
|
2994
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1 w-min", children: [
|
|
2995
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3015
2996
|
Select,
|
|
3016
2997
|
{
|
|
3017
2998
|
id: id ? `${id}-pagesize-select` : void 0,
|
|
@@ -3021,11 +3002,11 @@ function DataGrid({
|
|
|
3021
3002
|
var _a2;
|
|
3022
3003
|
return (_a2 = pagination.onPageSizeChange) == null ? void 0 : _a2.call(pagination, Number(e.target.value));
|
|
3023
3004
|
},
|
|
3024
|
-
renderMenu: (props) => /* @__PURE__ */ (0,
|
|
3005
|
+
renderMenu: (props) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3025
3006
|
Menu,
|
|
3026
3007
|
__spreadProps(__spreadValues({}, props), {
|
|
3027
3008
|
id: id ? `${id}-pagesize-menu` : void 0,
|
|
3028
|
-
children: PAGE_SIZE_OPTIONS.map((option) => /* @__PURE__ */ (0,
|
|
3009
|
+
children: PAGE_SIZE_OPTIONS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3029
3010
|
MenuOption,
|
|
3030
3011
|
{
|
|
3031
3012
|
id: id ? `${id}-pagesize-option-${option}` : void 0,
|
|
@@ -3042,21 +3023,21 @@ function DataGrid({
|
|
|
3042
3023
|
)
|
|
3043
3024
|
}
|
|
3044
3025
|
),
|
|
3045
|
-
/* @__PURE__ */ (0,
|
|
3026
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Label, { children: "Per Page" })
|
|
3046
3027
|
] }),
|
|
3047
|
-
/* @__PURE__ */ (0,
|
|
3048
|
-
/* @__PURE__ */ (0,
|
|
3028
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3029
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3049
3030
|
Button,
|
|
3050
3031
|
{
|
|
3051
3032
|
id: id ? `${id}-prev-page-button` : void 0,
|
|
3052
3033
|
iconOnly: true,
|
|
3053
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
3034
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { name: "chevron_left" }),
|
|
3054
3035
|
onClick: () => pagination.onPageChange(pagination.pageIndex - 1),
|
|
3055
3036
|
variant: "tertiary",
|
|
3056
3037
|
disabled: pagination.pageIndex === 0
|
|
3057
3038
|
}
|
|
3058
3039
|
),
|
|
3059
|
-
/* @__PURE__ */ (0,
|
|
3040
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Paragraph, { children: [
|
|
3060
3041
|
pagination.pageIndex * pagination.pageSize + 1,
|
|
3061
3042
|
" -",
|
|
3062
3043
|
" ",
|
|
@@ -3068,12 +3049,12 @@ function DataGrid({
|
|
|
3068
3049
|
"of ",
|
|
3069
3050
|
pagination.total
|
|
3070
3051
|
] }),
|
|
3071
|
-
/* @__PURE__ */ (0,
|
|
3052
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3072
3053
|
Button,
|
|
3073
3054
|
{
|
|
3074
3055
|
id: id ? `${id}-next-page-button` : void 0,
|
|
3075
3056
|
iconOnly: true,
|
|
3076
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
3057
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { name: "chevron_right" }),
|
|
3077
3058
|
onClick: () => pagination.onPageChange(pagination.pageIndex + 1),
|
|
3078
3059
|
variant: "tertiary",
|
|
3079
3060
|
disabled: (pagination.pageIndex + 1) * pagination.pageSize >= pagination.total
|
|
@@ -3081,7 +3062,7 @@ function DataGrid({
|
|
|
3081
3062
|
)
|
|
3082
3063
|
] })
|
|
3083
3064
|
] }),
|
|
3084
|
-
status && /* @__PURE__ */ (0,
|
|
3065
|
+
status && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Paragraph, { children: status })
|
|
3085
3066
|
] })
|
|
3086
3067
|
]
|
|
3087
3068
|
}
|
|
@@ -3089,441 +3070,549 @@ function DataGrid({
|
|
|
3089
3070
|
}
|
|
3090
3071
|
)
|
|
3091
3072
|
}
|
|
3092
|
-
);
|
|
3093
|
-
}
|
|
3094
|
-
DataGrid.displayName = "DataGrid";
|
|
3095
|
-
function
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
"
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3073
|
+
);
|
|
3074
|
+
}
|
|
3075
|
+
DataGrid.displayName = "DataGrid";
|
|
3076
|
+
function adaptTableStateSetter(setter) {
|
|
3077
|
+
return (valueOrFn) => {
|
|
3078
|
+
setter(
|
|
3079
|
+
(prev) => typeof valueOrFn === "function" ? valueOrFn(prev) : valueOrFn
|
|
3080
|
+
);
|
|
3081
|
+
};
|
|
3082
|
+
}
|
|
3083
|
+
|
|
3084
|
+
// src/components/Select.tsx
|
|
3085
|
+
var import_react16 = require("react");
|
|
3086
|
+
var import_clsx14 = __toESM(require("clsx"), 1);
|
|
3087
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3088
|
+
var Select = (_a) => {
|
|
3089
|
+
var _b = _a, {
|
|
3090
|
+
id,
|
|
3091
|
+
label,
|
|
3092
|
+
error,
|
|
3093
|
+
children,
|
|
3094
|
+
readOnly,
|
|
3095
|
+
renderMenu,
|
|
3096
|
+
onClick,
|
|
3097
|
+
className,
|
|
3098
|
+
wrapperClassName,
|
|
3099
|
+
removeRoundness,
|
|
3100
|
+
displayValue,
|
|
3101
|
+
value
|
|
3102
|
+
} = _b, props = __objRest(_b, [
|
|
3103
|
+
"id",
|
|
3104
|
+
"label",
|
|
3105
|
+
"error",
|
|
3106
|
+
"children",
|
|
3107
|
+
"readOnly",
|
|
3108
|
+
"renderMenu",
|
|
3109
|
+
"onClick",
|
|
3110
|
+
"className",
|
|
3111
|
+
"wrapperClassName",
|
|
3112
|
+
"removeRoundness",
|
|
3113
|
+
"displayValue",
|
|
3114
|
+
"value"
|
|
3115
|
+
]);
|
|
3116
|
+
const inputRef = (0, import_react16.useRef)(null);
|
|
3117
|
+
const inputContainerRef = (0, import_react16.useRef)(null);
|
|
3118
|
+
const preventFocusOnInitialRender = (0, import_react16.useRef)(true);
|
|
3119
|
+
const [show, setShow] = (0, import_react16.useState)(false);
|
|
3120
|
+
(0, import_react16.useEffect)(() => {
|
|
3121
|
+
var _a2;
|
|
3122
|
+
if (preventFocusOnInitialRender.current) {
|
|
3123
|
+
preventFocusOnInitialRender.current = false;
|
|
3124
|
+
return;
|
|
3125
|
+
}
|
|
3126
|
+
(_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
3127
|
+
}, [value]);
|
|
3128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
3129
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3130
|
+
InputBase,
|
|
3131
|
+
__spreadProps(__spreadValues({
|
|
3132
|
+
id,
|
|
3133
|
+
inputContainerRef,
|
|
3134
|
+
ref: inputRef,
|
|
3135
|
+
label,
|
|
3136
|
+
after: !readOnly && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3137
|
+
"span",
|
|
3141
3138
|
{
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
height: "40px",
|
|
3148
|
-
zIndex: 10
|
|
3149
|
-
},
|
|
3150
|
-
className: "even:bg-background-grouped-primary-normal odd:bg-background-grouped-secondary-normal",
|
|
3151
|
-
children: headerGroups.flatMap(
|
|
3152
|
-
(x) => x.headers.map((header) => {
|
|
3153
|
-
var _a, _b, _c, _d, _e;
|
|
3154
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3155
|
-
CellElement,
|
|
3156
|
-
{
|
|
3157
|
-
id: id ? `${id}-filter-cell-${header.id}` : void 0,
|
|
3158
|
-
noPadding: true,
|
|
3159
|
-
cell: header,
|
|
3160
|
-
width: ((_a = header.column.columnDef.meta) == null ? void 0 : _a.headerWidth) || (locked ? `${header.column.getSize()}px` : ""),
|
|
3161
|
-
children: header.column.getCanFilter() && ((_e = (_c = (_b = header.column.columnDef.meta) == null ? void 0 : _b.filterRowCell) == null ? void 0 : _c.call(_b, {
|
|
3162
|
-
header,
|
|
3163
|
-
table
|
|
3164
|
-
})) != null ? _e : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3165
|
-
Search,
|
|
3166
|
-
{
|
|
3167
|
-
id: id ? `${id}-filter-search-${header.id}` : void 0,
|
|
3168
|
-
removeRoundness: true,
|
|
3169
|
-
onChange: (e) => header.column.setFilterValue(e.target.value),
|
|
3170
|
-
value: (_d = header.column.getFilterValue()) != null ? _d : "",
|
|
3171
|
-
placeholder: "",
|
|
3172
|
-
removeSearchIcon: true
|
|
3173
|
-
}
|
|
3174
|
-
))
|
|
3175
|
-
},
|
|
3176
|
-
header.id
|
|
3177
|
-
);
|
|
3178
|
-
})
|
|
3179
|
-
)
|
|
3139
|
+
className: (0, import_clsx14.default)(
|
|
3140
|
+
props.disabled ? "text-icon-action-primary-disabled" : "text-icon-action-primary-normal",
|
|
3141
|
+
"contents"
|
|
3142
|
+
),
|
|
3143
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon, { name: "keyboard_arrow_down" })
|
|
3180
3144
|
}
|
|
3181
3145
|
),
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
rowVirtualizer,
|
|
3191
|
-
virtualPaddingLeft,
|
|
3192
|
-
virtualPaddingRight,
|
|
3193
|
-
virtualRow,
|
|
3194
|
-
showFilterRow,
|
|
3195
|
-
enableColumnSelector,
|
|
3196
|
-
locked,
|
|
3197
|
-
pinDirection
|
|
3198
|
-
},
|
|
3199
|
-
row.id
|
|
3200
|
-
);
|
|
3201
|
-
}),
|
|
3202
|
-
!pagination && isLoadingMore && hasMore && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3203
|
-
"tr",
|
|
3204
|
-
{
|
|
3205
|
-
style: {
|
|
3206
|
-
display: "flex",
|
|
3207
|
-
position: "absolute",
|
|
3208
|
-
width: "100%",
|
|
3209
|
-
transform: `translateY(${virtualRows[virtualRows.length - 1].start + 40}px)`
|
|
3210
|
-
},
|
|
3211
|
-
className: "odd:bg-background-grouped-primary-normal even:bg-background-grouped-secondary-normal",
|
|
3212
|
-
children: table.getAllLeafColumns().map((column) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(LoadingCell, { id, column: column.columnDef }, column.id))
|
|
3146
|
+
maxLength: 0,
|
|
3147
|
+
className: (0, import_clsx14.default)("!caret-transparent !cursor-default", className),
|
|
3148
|
+
wrapperClassName,
|
|
3149
|
+
onKeyDown: (e) => {
|
|
3150
|
+
const openKeys = ["Enter", "Space", " "];
|
|
3151
|
+
if (openKeys.includes(e.key)) {
|
|
3152
|
+
e.preventDefault();
|
|
3153
|
+
e.target.click();
|
|
3213
3154
|
}
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3155
|
+
},
|
|
3156
|
+
onClick: (e) => {
|
|
3157
|
+
if (props.disabled || readOnly) {
|
|
3158
|
+
return;
|
|
3159
|
+
}
|
|
3160
|
+
setShow(!show);
|
|
3161
|
+
onClick == null ? void 0 : onClick(e);
|
|
3162
|
+
},
|
|
3163
|
+
error,
|
|
3164
|
+
readOnly,
|
|
3165
|
+
removeRoundness,
|
|
3166
|
+
focus: show
|
|
3167
|
+
}, props), {
|
|
3168
|
+
value: displayValue != null ? displayValue : value
|
|
3169
|
+
})
|
|
3170
|
+
),
|
|
3171
|
+
renderMenu ? renderMenu({
|
|
3172
|
+
id: id ? `${id}-menu` : void 0,
|
|
3173
|
+
positionTo: inputContainerRef,
|
|
3174
|
+
show,
|
|
3175
|
+
setShow,
|
|
3176
|
+
topOffset: props.caption ? -16 : null
|
|
3177
|
+
}) : children
|
|
3178
|
+
] });
|
|
3179
|
+
};
|
|
3180
|
+
Select.displayName = "Select";
|
|
3181
|
+
|
|
3182
|
+
// src/components/Subheader.tsx
|
|
3183
|
+
var import_clsx15 = __toESM(require("clsx"), 1);
|
|
3184
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3185
|
+
var Subheader = (_a) => {
|
|
3186
|
+
var _b = _a, {
|
|
3187
|
+
className,
|
|
3188
|
+
children,
|
|
3189
|
+
as = "span",
|
|
3190
|
+
align,
|
|
3191
|
+
color,
|
|
3192
|
+
tall,
|
|
3193
|
+
id
|
|
3194
|
+
} = _b, props = __objRest(_b, [
|
|
3195
|
+
"className",
|
|
3196
|
+
"children",
|
|
3197
|
+
"as",
|
|
3198
|
+
"align",
|
|
3199
|
+
"color",
|
|
3200
|
+
"tall",
|
|
3201
|
+
"id"
|
|
3202
|
+
]);
|
|
3203
|
+
const Element = as;
|
|
3204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3205
|
+
Element,
|
|
3206
|
+
__spreadProps(__spreadValues({
|
|
3207
|
+
id,
|
|
3208
|
+
className: (0, import_clsx15.default)(
|
|
3209
|
+
typography.subheader,
|
|
3210
|
+
className,
|
|
3211
|
+
align === "left" && "text-left",
|
|
3212
|
+
align === "center" && "text-center",
|
|
3213
|
+
align === "right" && "text-right",
|
|
3214
|
+
tall && "!leading-6"
|
|
3215
|
+
),
|
|
3216
|
+
style: __spreadProps(__spreadValues({}, props.style), {
|
|
3217
|
+
color: color ? `var(--color-${color})` : void 0
|
|
3218
|
+
})
|
|
3219
|
+
}, props), {
|
|
3220
|
+
children
|
|
3221
|
+
})
|
|
3222
|
+
);
|
|
3223
|
+
};
|
|
3224
|
+
Subheader.displayName = "Subheader";
|
|
3225
|
+
|
|
3226
|
+
// src/components/Checkbox.tsx
|
|
3227
|
+
var import_clsx16 = __toESM(require("clsx"), 1);
|
|
3228
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3229
|
+
var Checkbox = (_a) => {
|
|
3230
|
+
var _b = _a, {
|
|
3231
|
+
label,
|
|
3232
|
+
error,
|
|
3233
|
+
disabled,
|
|
3234
|
+
readOnly,
|
|
3235
|
+
checked,
|
|
3236
|
+
onChange,
|
|
3237
|
+
indeterminate,
|
|
3238
|
+
paragraphClassName,
|
|
3239
|
+
id
|
|
3240
|
+
} = _b, props = __objRest(_b, [
|
|
3241
|
+
"label",
|
|
3242
|
+
"error",
|
|
3243
|
+
"disabled",
|
|
3244
|
+
"readOnly",
|
|
3245
|
+
"checked",
|
|
3246
|
+
"onChange",
|
|
3247
|
+
"indeterminate",
|
|
3248
|
+
"paragraphClassName",
|
|
3249
|
+
"id"
|
|
3250
|
+
]);
|
|
3251
|
+
const selected = indeterminate || checked;
|
|
3252
|
+
const normalClassName = (0, import_clsx16.default)(
|
|
3253
|
+
!selected && !error && !disabled && !readOnly && "border-border-primary-normal bg-background-action-secondary-normal peer-hover:border-border-action-hover peer-hover:bg-background-action-secondary-hover peer-active:border-border-action-active peer-active:bg-background-action-secondary-active"
|
|
3254
|
+
);
|
|
3255
|
+
const normalSelectedClassName = (0, import_clsx16.default)(
|
|
3256
|
+
selected && !error && !disabled && !readOnly && "bg-background-action-primary-normal border-background-action-primary-normal peer-hover:bg-background-action-primary-hover peer-hover:border-background-action-primary-hover peer-active:bg-background-action-primary-active peer-active:border-background-action-primary-active"
|
|
3257
|
+
);
|
|
3258
|
+
const errorClassName = (0, import_clsx16.default)(
|
|
3259
|
+
error && !selected && "bg-background-action-critical-secondary-normal border-border-action-critical-normal peer-hover:border-border-action-critical-hover peer-hover:bg-background-action-critical-secondary-hover peer-active:border-border-action-critical-active peer-active:bg-background-action-secondary-active"
|
|
3260
|
+
);
|
|
3261
|
+
const errorSelectedClassName = (0, import_clsx16.default)(
|
|
3262
|
+
error && selected && "bg-background-action-critical-primary-normal border-background-action-critical-primary-normal peer-hover:bg-background-action-critical-primary-hover peer-hover:border-background-action-critical-primary-hover peer-active:bg-background-action-critical-primary-active peer-active:border-background-action-critical-primary-active"
|
|
3263
|
+
);
|
|
3264
|
+
const disabledClassName = (0, import_clsx16.default)(
|
|
3265
|
+
disabled && !readOnly && "border-border-primary-normal bg-background-action-secondary-disabled peer-checked:bg-icon-on-action-primary-disabled peer-checked:border-icon-on-action-primary-disabled"
|
|
3266
|
+
);
|
|
3267
|
+
const readOnlyClassName = (0, import_clsx16.default)(
|
|
3268
|
+
readOnly && "border-transparent bg-transparent peer-checked:bg-transparent peer-checked:border-transparent"
|
|
3269
|
+
);
|
|
3270
|
+
const checkColor = (0, import_clsx16.default)(
|
|
3271
|
+
selected && !disabled && !readOnly && "color-icon-on-action-primary-normal peer-hover:color-icon-on-action-primary-hover peer-active:color-icon-on-action-primary-active",
|
|
3272
|
+
selected && disabled && "color-background-action-primary-disabled"
|
|
3217
3273
|
);
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
id,
|
|
3221
|
-
columnVirtualizer,
|
|
3222
|
-
row,
|
|
3223
|
-
// rowVirtualizer,
|
|
3224
|
-
virtualPaddingLeft,
|
|
3225
|
-
virtualPaddingRight,
|
|
3226
|
-
virtualRow,
|
|
3227
|
-
showFilterRow,
|
|
3228
|
-
enableColumnSelector = false,
|
|
3229
|
-
locked,
|
|
3230
|
-
pinDirection
|
|
3231
|
-
}) {
|
|
3232
|
-
var _a;
|
|
3233
|
-
let visibleCells;
|
|
3234
|
-
if (locked) {
|
|
3235
|
-
visibleCells = pinDirection === "left" ? row.getLeftVisibleCells() : row.getRightVisibleCells();
|
|
3236
|
-
} else {
|
|
3237
|
-
visibleCells = row.getCenterVisibleCells();
|
|
3238
|
-
}
|
|
3239
|
-
const virtualColumns = (_a = columnVirtualizer == null ? void 0 : columnVirtualizer.getVirtualItems()) != null ? _a : [];
|
|
3240
|
-
const columns = locked ? visibleCells : virtualColumns;
|
|
3241
|
-
const isError = typeof row.original === "object" && row.original !== null && "rowState" in row.original && row.original.rowState === "error";
|
|
3242
|
-
const CellElement = locked ? DataGridCell : DragAlongCell;
|
|
3243
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
3244
|
-
"tr",
|
|
3274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
3275
|
+
"label",
|
|
3245
3276
|
{
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3277
|
+
id,
|
|
3278
|
+
htmlFor: id ? `${id}-input` : void 0,
|
|
3279
|
+
className: (0, import_clsx16.default)(
|
|
3280
|
+
"flex items-center",
|
|
3281
|
+
componentGap,
|
|
3282
|
+
(disabled || readOnly && error || readOnly) && "cursor-default",
|
|
3283
|
+
!(readOnly && error) && !disabled && !readOnly && "cursor-pointer"
|
|
3251
3284
|
),
|
|
3252
|
-
style: {
|
|
3253
|
-
display: "flex",
|
|
3254
|
-
position: "absolute",
|
|
3255
|
-
transform: `translateY(${showFilterRow ? virtualRow.start + 40 : virtualRow.start}px)`,
|
|
3256
|
-
width: "100%"
|
|
3257
|
-
},
|
|
3258
3285
|
children: [
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3286
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "relative", children: [
|
|
3287
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3288
|
+
"input",
|
|
3289
|
+
__spreadValues({
|
|
3290
|
+
id: id ? `${id}-input` : void 0,
|
|
3291
|
+
type: "checkbox",
|
|
3292
|
+
className: "sr-only peer",
|
|
3293
|
+
disabled,
|
|
3294
|
+
checked: selected,
|
|
3295
|
+
onChange: handleOnChange,
|
|
3296
|
+
"data-indeterminate": indeterminate
|
|
3297
|
+
}, props)
|
|
3298
|
+
),
|
|
3299
|
+
error && (readOnly || disabled) ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: (0, import_clsx16.default)("size-6", "flex items-center justify-center"), children: selected ? indeterminate ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, { name: "question_mark" }) }) : readOnly ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-success-400 contents", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, { name: "check" }) }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-icon-on-action-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, { name: "check", className: "pointer-events-none" }) }) : readOnly && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, { name: "close" }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3300
|
+
"div",
|
|
3271
3301
|
{
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
)
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
)
|
|
3287
|
-
}),
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3302
|
+
className: (0, import_clsx16.default)(
|
|
3303
|
+
"size-6 border rounded-base",
|
|
3304
|
+
"flex items-center justify-center",
|
|
3305
|
+
baseTransition,
|
|
3306
|
+
normalClassName,
|
|
3307
|
+
normalSelectedClassName,
|
|
3308
|
+
errorClassName,
|
|
3309
|
+
errorSelectedClassName,
|
|
3310
|
+
disabledClassName,
|
|
3311
|
+
readOnlyClassName,
|
|
3312
|
+
checkColor
|
|
3313
|
+
),
|
|
3314
|
+
children: selected ? indeterminate ? readOnly ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, { name: "question_mark" }) }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-icon-on-action-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, { name: "remove", className: "pointer-events-none" }) }) : readOnly ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-success-400 contents", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, { name: "check" }) }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-icon-on-action-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, { name: "check", className: "pointer-events-none" }) }) : readOnly && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, { name: "close" }) })
|
|
3315
|
+
}
|
|
3316
|
+
)
|
|
3317
|
+
] }),
|
|
3318
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3319
|
+
Paragraph,
|
|
3320
|
+
{
|
|
3321
|
+
id: id ? `${id}-label` : void 0,
|
|
3322
|
+
as: "span",
|
|
3323
|
+
padded: true,
|
|
3324
|
+
className: (0, import_clsx16.default)(
|
|
3325
|
+
"text-nowrap",
|
|
3326
|
+
disabled && !error && "!text-text-primary-disabled",
|
|
3327
|
+
error && !disabled && !readOnly && "!text-text-primary-error",
|
|
3328
|
+
paragraphClassName
|
|
3329
|
+
),
|
|
3330
|
+
children: label
|
|
3331
|
+
}
|
|
3332
|
+
)
|
|
3293
3333
|
]
|
|
3294
|
-
}
|
|
3295
|
-
row.id
|
|
3334
|
+
}
|
|
3296
3335
|
);
|
|
3297
|
-
|
|
3298
|
-
|
|
3336
|
+
function handleOnChange(e) {
|
|
3337
|
+
if (disabled || readOnly || readOnly && error || !onChange) {
|
|
3338
|
+
return;
|
|
3339
|
+
}
|
|
3340
|
+
onChange(e);
|
|
3341
|
+
}
|
|
3342
|
+
};
|
|
3343
|
+
Checkbox.displayName = "Checkbox";
|
|
3344
|
+
|
|
3345
|
+
// src/components/Button.tsx
|
|
3346
|
+
var import_clsx17 = __toESM(require("clsx"), 1);
|
|
3347
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3348
|
+
var Button = (_a) => {
|
|
3299
3349
|
var _b = _a, {
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3350
|
+
variant = "primary",
|
|
3351
|
+
as = "button",
|
|
3352
|
+
block,
|
|
3353
|
+
leftIcon,
|
|
3354
|
+
rightIcon,
|
|
3355
|
+
className,
|
|
3356
|
+
classNameLabel,
|
|
3357
|
+
disabled = false,
|
|
3358
|
+
children,
|
|
3359
|
+
iconOnly = false,
|
|
3360
|
+
colorClassName,
|
|
3361
|
+
href,
|
|
3362
|
+
id
|
|
3306
3363
|
} = _b, props = __objRest(_b, [
|
|
3307
|
-
"
|
|
3308
|
-
"
|
|
3309
|
-
"
|
|
3310
|
-
"
|
|
3311
|
-
"
|
|
3312
|
-
"
|
|
3364
|
+
"variant",
|
|
3365
|
+
"as",
|
|
3366
|
+
"block",
|
|
3367
|
+
"leftIcon",
|
|
3368
|
+
"rightIcon",
|
|
3369
|
+
"className",
|
|
3370
|
+
"classNameLabel",
|
|
3371
|
+
"disabled",
|
|
3372
|
+
"children",
|
|
3373
|
+
"iconOnly",
|
|
3374
|
+
"colorClassName",
|
|
3375
|
+
"href",
|
|
3376
|
+
"id"
|
|
3313
3377
|
]);
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
"
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3378
|
+
const primaryVariantStyles = variant === "primary" && (0, import_clsx17.default)(
|
|
3379
|
+
(colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
|
|
3380
|
+
"bg-background-action-primary-normal border-background-action-primary-normal",
|
|
3381
|
+
"hover:bg-background-action-primary-hover hover:border-background-action-primary-hover",
|
|
3382
|
+
"focus:bg-background-action-primary-hover focus:border-background-action-primary-hover focus:outline-0",
|
|
3383
|
+
"active:bg-background-action-primary-active active:border-background-action-primary-active",
|
|
3384
|
+
"disabled:bg-background-action-primary-disabled disabled:border-background-action-primary-disabled disabled:text-text-on-action-primary-disabled"
|
|
3385
|
+
);
|
|
3386
|
+
const secondaryVariantStyles = variant === "secondary" && (0, import_clsx17.default)(
|
|
3387
|
+
(colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-action-primary-normal",
|
|
3388
|
+
"bg-background-action-secondary-normal border-border-action-normal",
|
|
3389
|
+
"hover:bg-background-action-secondary-hover hover:border-border-action-hover hover:text-text-action-primary-hover",
|
|
3390
|
+
"focus:bg-background-action-secondary-hover focus:border-border-action-hover focus:text-text-action-primary-hover focus:outline-0",
|
|
3391
|
+
"active:bg-background-action-secondary-active active:border-border-action-active active:text-text-action-primary-active",
|
|
3392
|
+
"disabled:bg-background-action-primary-disabled disabled:border-border-action-disabled disabled:text-text-action-primary-disabled"
|
|
3393
|
+
);
|
|
3394
|
+
const tertiaryVariantStyles = variant === "tertiary" && (0, import_clsx17.default)(
|
|
3395
|
+
"bg-transparent border-transparent",
|
|
3396
|
+
iconOnly ? (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-icon-action-primary-normal" : (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-action-primary-normal",
|
|
3397
|
+
"bg-transparent border-transparent",
|
|
3398
|
+
"hover:bg-background-action-secondary-hover hover:border-background-action-secondary-hover hover:text-text-action-primary-hover",
|
|
3399
|
+
"focus:bg-background-action-secondary-hover focus:border-background-action-secondary-hover focus:text-text-action-primary-hover focus:outline-0",
|
|
3400
|
+
"active:bg-background-action-secondary-active active:border-transparent active:text-text-action-primary-active",
|
|
3401
|
+
"disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
|
|
3402
|
+
);
|
|
3403
|
+
const primaryCriticalVariantStyles = variant === "primary-critical" && (0, import_clsx17.default)(
|
|
3404
|
+
(colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
|
|
3405
|
+
"bg-background-action-critical-primary-normal border-background-action-critical-primary-normal",
|
|
3406
|
+
"hover:bg-background-action-critical-primary-hover hover:border-background-action-critical-primary-hover",
|
|
3407
|
+
"focus:bg-background-action-critical-primary-hover focus:border-background-action-critical-primary-hover focus:outline-0",
|
|
3408
|
+
"active:bg-background-action-critical-primary-active active:border-background-action-critical-primary-active",
|
|
3409
|
+
"disabled:bg-background-action-critical-primary-disabled disabled:border-background-action-critical-primary-disabled disabled:text-text-on-action-primary-disabled"
|
|
3410
|
+
);
|
|
3411
|
+
const secondaryCriticalVariantStyles = variant === "secondary-critical" && (0, import_clsx17.default)(
|
|
3412
|
+
(colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-action-critical-normal",
|
|
3413
|
+
"bg-background-action-critical-secondary-normal border-border-action-critical-normal",
|
|
3414
|
+
"hover:bg-background-action-critical-secondary-hover hover:border-border-action-critical-hover hover:text-text-action-critical-hover",
|
|
3415
|
+
"focus:bg-background-action-critical-secondary-hover focus:border-border-action-critical-hover focus:text-text-action-critical-hover focus:outline-0",
|
|
3416
|
+
"active:bg-background-action-critical-secondary-active active:border-border-action-critical-active active:text-text-action-critical-active",
|
|
3417
|
+
"disabled:bg-background-action-critical-disabled disabled:border-border-action-critical-disabled disabled:text-text-action-critical-disabled"
|
|
3418
|
+
);
|
|
3419
|
+
const tertiaryCriticalVariantStyles = variant === "tertiary-critical" && (0, import_clsx17.default)(
|
|
3420
|
+
(colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-action-critical-normal",
|
|
3421
|
+
"bg-transparent border-transparent text-text-action-critical-normal",
|
|
3422
|
+
"hover:bg-background-action-critical-secondary-hover hover:border-background-action-critical-secondary-hover hover:text-text-action-critical-hover",
|
|
3423
|
+
"focus:bg-background-action-critical-secondary-hover focus:border-background-action-critical-secondary-hover focus:text-text-action-critical-hover focus:outline-0",
|
|
3424
|
+
"active:bg-background-action-critical-secondary-active active:border-background-action-critical-secondary-active active:text-text-action-critical-active",
|
|
3425
|
+
"disabled:bg-transparent disabled:border-transparent disabled:text-text-action-critical-disabled"
|
|
3426
|
+
);
|
|
3427
|
+
const navigationVarianStyles = variant === "navigation" && (0, import_clsx17.default)(
|
|
3428
|
+
(colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
|
|
3429
|
+
"bg-transparent",
|
|
3430
|
+
"hover:bg-background-on-action-secondary-hover hover:text-brand-text-action-primary-hover",
|
|
3431
|
+
// "hover:bg-background-action-secondary-hover hover:text-text-action-primary-hover", // Will use this once colors are finalized
|
|
3432
|
+
"focus:bg-background-on-action-secondary-hover focus:text-brand-text-action-primary-hover focus:outline-0",
|
|
3433
|
+
// "focus:bg-background-action-secondary-hover focus:text-text-action-primary-hover", // Will use this once colors are finalized
|
|
3434
|
+
"active:bg-background-on-action-secondary-active active:text-brand-text-action-primary-active",
|
|
3435
|
+
// "active:bg-background-action-secondary-active active:text-text-action-primary-active", // Will use this once colors are finalized
|
|
3436
|
+
"disabled:bg-transparent disabled:text-text-on-action-primary-disabled",
|
|
3437
|
+
"flex-col",
|
|
3438
|
+
paddingUsingComponentGap
|
|
3439
|
+
);
|
|
3440
|
+
const notNavigationVariantStyles = variant !== "navigation" && (0, import_clsx17.default)("border-2 flex-row", componentPaddingMinus2pxBorder, componentGap);
|
|
3441
|
+
const buttonClasses = (0, import_clsx17.default)(
|
|
3442
|
+
disabled ? "cursor-default" : "cursor-pointer",
|
|
3443
|
+
block ? "w-full" : "w-fit",
|
|
3444
|
+
baseTransition,
|
|
3445
|
+
"rounded-sm whitespace-nowrap inline-flex items-center justify-center group/btn",
|
|
3446
|
+
primaryVariantStyles,
|
|
3447
|
+
secondaryVariantStyles,
|
|
3448
|
+
tertiaryVariantStyles,
|
|
3449
|
+
primaryCriticalVariantStyles,
|
|
3450
|
+
secondaryCriticalVariantStyles,
|
|
3451
|
+
tertiaryCriticalVariantStyles,
|
|
3452
|
+
navigationVarianStyles,
|
|
3453
|
+
notNavigationVariantStyles,
|
|
3454
|
+
className
|
|
3455
|
+
);
|
|
3456
|
+
const labelClasses = (0, import_clsx17.default)(
|
|
3457
|
+
"min-h-6 flex items-center justify-center",
|
|
3458
|
+
classNameLabel,
|
|
3459
|
+
componentPaddingXUsingComponentGap,
|
|
3460
|
+
typography.buttonLabel
|
|
3461
|
+
);
|
|
3462
|
+
const Element = href ? "a" : as;
|
|
3463
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3464
|
+
Element,
|
|
3465
|
+
__spreadProps(__spreadValues({
|
|
3466
|
+
id,
|
|
3467
|
+
type: Element === "button" ? "button" : void 0,
|
|
3468
|
+
className: buttonClasses
|
|
3469
|
+
}, props), {
|
|
3470
|
+
disabled,
|
|
3471
|
+
href,
|
|
3472
|
+
children: [
|
|
3473
|
+
leftIcon && leftIcon,
|
|
3474
|
+
!iconOnly && children && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { id: id ? `${id}-label` : void 0, className: labelClasses, children }),
|
|
3475
|
+
rightIcon && rightIcon
|
|
3395
3476
|
]
|
|
3396
|
-
}
|
|
3477
|
+
})
|
|
3397
3478
|
);
|
|
3398
|
-
}
|
|
3399
|
-
var LoadingCell = ({
|
|
3400
|
-
id,
|
|
3401
|
-
column
|
|
3402
|
-
}) => {
|
|
3403
|
-
const key = `loading-${column.id}`;
|
|
3404
|
-
if (column.cell === "checkbox") {
|
|
3405
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DataGridCell, { id: id ? `${id}-${key}` : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Checkbox, { id: id ? `${id}-${key}-checkbox` : void 0, disabled: true }) }, key);
|
|
3406
|
-
}
|
|
3407
|
-
if (column.cell === "input") {
|
|
3408
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3409
|
-
DataGridCell,
|
|
3410
|
-
{
|
|
3411
|
-
id: id ? `${id}-${key}` : void 0,
|
|
3412
|
-
component: "input",
|
|
3413
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3414
|
-
Input,
|
|
3415
|
-
{
|
|
3416
|
-
id: id ? `${id}-${key}-input` : void 0,
|
|
3417
|
-
align: "left",
|
|
3418
|
-
disabled: true,
|
|
3419
|
-
wrapperClassName: "!rounded-none !border-0"
|
|
3420
|
-
}
|
|
3421
|
-
)
|
|
3422
|
-
},
|
|
3423
|
-
key
|
|
3424
|
-
);
|
|
3425
|
-
}
|
|
3426
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DataGridCell, { id: id ? `${id}-${key}` : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "bg-linear-270 to-neutral-300/[24%] from-neutral-300/[12%] rounded-xs w-full max-w-25 h-6" }) }, key);
|
|
3427
3479
|
};
|
|
3428
|
-
|
|
3480
|
+
Button.displayName = "Button";
|
|
3481
|
+
|
|
3482
|
+
// src/components/Tooltip.tsx
|
|
3483
|
+
var import_clsx18 = __toESM(require("clsx"), 1);
|
|
3484
|
+
var import_react17 = require("react");
|
|
3485
|
+
var import_react_dom2 = require("react-dom");
|
|
3486
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3487
|
+
var Tooltip = ({
|
|
3429
3488
|
id,
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3489
|
+
message,
|
|
3490
|
+
position = "top",
|
|
3491
|
+
children,
|
|
3492
|
+
showOnTruncation = false,
|
|
3493
|
+
offset = 8
|
|
3494
|
+
}) => {
|
|
3495
|
+
const ref = (0, import_react17.useRef)(null);
|
|
3496
|
+
const tooltipRef = (0, import_react17.useRef)(null);
|
|
3497
|
+
const [tooltipPosition, setTooltipPosition] = (0, import_react17.useState)({ top: 0, left: 0 });
|
|
3498
|
+
const [isVisible, setIsVisible] = (0, import_react17.useState)(false);
|
|
3499
|
+
const [removeOpacity, setRemoveOpacity] = (0, import_react17.useState)(false);
|
|
3500
|
+
const updatePosition = () => {
|
|
3501
|
+
if (!ref.current || !tooltipRef.current) return;
|
|
3502
|
+
const rect = ref.current.getBoundingClientRect();
|
|
3503
|
+
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
3504
|
+
let top = 0;
|
|
3505
|
+
let left = 0;
|
|
3506
|
+
switch (position) {
|
|
3507
|
+
case "top":
|
|
3508
|
+
top = rect.top - tooltipRect.height - offset;
|
|
3509
|
+
left = rect.left + rect.width / 2 - tooltipRect.width / 2;
|
|
3510
|
+
break;
|
|
3511
|
+
case "bottom":
|
|
3512
|
+
top = rect.bottom + offset;
|
|
3513
|
+
left = rect.left + rect.width / 2 - tooltipRect.width / 2;
|
|
3514
|
+
break;
|
|
3515
|
+
case "left":
|
|
3516
|
+
top = rect.top + rect.height / 2 - tooltipRect.height / 2;
|
|
3517
|
+
left = rect.left - tooltipRect.width - offset;
|
|
3518
|
+
break;
|
|
3519
|
+
case "right":
|
|
3520
|
+
top = rect.top + rect.height / 2 - tooltipRect.height / 2;
|
|
3521
|
+
left = rect.right + offset;
|
|
3522
|
+
break;
|
|
3523
|
+
}
|
|
3524
|
+
setTooltipPosition({ top, left });
|
|
3525
|
+
requestAnimationFrame(() => {
|
|
3526
|
+
setRemoveOpacity(true);
|
|
3527
|
+
});
|
|
3528
|
+
};
|
|
3529
|
+
const handleMouseEnter = () => {
|
|
3530
|
+
if (!showOnTruncation || checkForTextTruncation()) {
|
|
3531
|
+
setIsVisible(true);
|
|
3532
|
+
}
|
|
3533
|
+
};
|
|
3534
|
+
const handleMouseLeave = () => {
|
|
3535
|
+
setIsVisible(false);
|
|
3536
|
+
setRemoveOpacity(false);
|
|
3537
|
+
};
|
|
3538
|
+
(0, import_react17.useEffect)(() => {
|
|
3539
|
+
if (isVisible && tooltipRef.current) {
|
|
3540
|
+
requestAnimationFrame(() => {
|
|
3541
|
+
updatePosition();
|
|
3542
|
+
});
|
|
3543
|
+
}
|
|
3544
|
+
}, [isVisible]);
|
|
3545
|
+
(0, import_react17.useEffect)(() => {
|
|
3546
|
+
if (isVisible) {
|
|
3547
|
+
window.addEventListener("resize", updatePosition);
|
|
3548
|
+
return () => window.removeEventListener("resize", updatePosition);
|
|
3549
|
+
}
|
|
3550
|
+
}, [isVisible]);
|
|
3551
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3552
|
+
"div",
|
|
3438
3553
|
{
|
|
3439
3554
|
id,
|
|
3440
|
-
width: "48",
|
|
3441
|
-
type: "header",
|
|
3442
|
-
color: "text-secondary-normal",
|
|
3443
3555
|
ref,
|
|
3556
|
+
className: "relative inline-grid grid-cols-[auto_1fr] items-center",
|
|
3557
|
+
onMouseEnter: handleMouseEnter,
|
|
3558
|
+
onMouseLeave: handleMouseLeave,
|
|
3444
3559
|
children: [
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
children: [
|
|
3464
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3465
|
-
Button,
|
|
3466
|
-
{
|
|
3467
|
-
id: id ? `${id}-reset-button` : void 0,
|
|
3468
|
-
variant: "tertiary",
|
|
3469
|
-
onClick: () => {
|
|
3470
|
-
resetColumnVisibility();
|
|
3471
|
-
setShow(false);
|
|
3472
|
-
},
|
|
3473
|
-
children: "Reset to default"
|
|
3474
|
-
}
|
|
3560
|
+
children,
|
|
3561
|
+
isVisible && typeof document !== "undefined" && (0, import_react_dom2.createPortal)(
|
|
3562
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3563
|
+
"div",
|
|
3564
|
+
{
|
|
3565
|
+
id: id ? `${id}-message` : void 0,
|
|
3566
|
+
ref: tooltipRef,
|
|
3567
|
+
style: {
|
|
3568
|
+
position: "fixed",
|
|
3569
|
+
top: `${tooltipPosition.top}px`,
|
|
3570
|
+
left: `${tooltipPosition.left}px`,
|
|
3571
|
+
zIndex: 9999
|
|
3572
|
+
},
|
|
3573
|
+
className: (0, import_clsx18.default)(
|
|
3574
|
+
typography.caption,
|
|
3575
|
+
"bg-neutral-500 text-neutral-100 rounded whitespace-nowrap shadow-2 pointer-events-none transition-opacity duration-100 ease-in-out",
|
|
3576
|
+
componentPadding,
|
|
3577
|
+
!removeOpacity && "opacity-0"
|
|
3475
3578
|
),
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
ColumnSelectorMenuOption,
|
|
3481
|
-
{
|
|
3482
|
-
id: id ? `${id}-option-${column.id}` : void 0,
|
|
3483
|
-
column,
|
|
3484
|
-
toggleColumnVisibility
|
|
3485
|
-
},
|
|
3486
|
-
column.id
|
|
3487
|
-
))
|
|
3488
|
-
]
|
|
3489
|
-
}
|
|
3579
|
+
children: message
|
|
3580
|
+
}
|
|
3581
|
+
),
|
|
3582
|
+
document.body
|
|
3490
3583
|
)
|
|
3491
3584
|
]
|
|
3492
3585
|
}
|
|
3493
3586
|
);
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
const [isVisible, setIsVisible] = (0, import_react13.useState)(column.getIsVisible());
|
|
3501
|
-
const label = typeof column.columnDef.header === "string" ? column.columnDef.header : null;
|
|
3502
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MenuOption, { id, selected: isVisible, defaultChecked: isVisible, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3503
|
-
Checkbox,
|
|
3504
|
-
{
|
|
3505
|
-
id: id ? `${id}-checkbox` : void 0,
|
|
3506
|
-
label: label != null ? label : "Unknown",
|
|
3507
|
-
checked: isVisible,
|
|
3508
|
-
onChange: (e) => {
|
|
3509
|
-
setIsVisible(e.target.checked);
|
|
3510
|
-
toggleColumnVisibility(column.id, e.target.checked);
|
|
3587
|
+
function checkForTextTruncation() {
|
|
3588
|
+
if (showOnTruncation && ref.current) {
|
|
3589
|
+
const paragraph = ref.current.querySelector("p");
|
|
3590
|
+
if (paragraph) {
|
|
3591
|
+
const isTruncated = paragraph.scrollWidth > paragraph.clientWidth;
|
|
3592
|
+
return isTruncated;
|
|
3511
3593
|
}
|
|
3512
3594
|
}
|
|
3513
|
-
|
|
3514
|
-
}
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
"text-icon-on-action-primary-normal",
|
|
3518
|
-
nextSort && "hidden group-hover:block"
|
|
3519
|
-
);
|
|
3520
|
-
if (sort === "asc")
|
|
3521
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon, { size: 16, className: iconClassName, name: "arrow_upward" });
|
|
3522
|
-
if (sort === "desc")
|
|
3523
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon, { size: 16, className: iconClassName, name: "arrow_downward" });
|
|
3524
|
-
return null;
|
|
3525
|
-
}
|
|
3595
|
+
return false;
|
|
3596
|
+
}
|
|
3597
|
+
};
|
|
3598
|
+
Tooltip.displayName = "Tooltip";
|
|
3526
3599
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3527
3600
|
0 && (module.exports = {
|
|
3528
|
-
|
|
3601
|
+
Button,
|
|
3602
|
+
Checkbox,
|
|
3603
|
+
DataCellHeader,
|
|
3604
|
+
DataGrid,
|
|
3605
|
+
DataGridCell,
|
|
3606
|
+
DragAlongCell,
|
|
3607
|
+
DraggableCellHeader,
|
|
3608
|
+
Icon,
|
|
3609
|
+
Input,
|
|
3610
|
+
Label,
|
|
3611
|
+
Menu,
|
|
3612
|
+
MenuOption,
|
|
3613
|
+
Paragraph,
|
|
3614
|
+
Search,
|
|
3615
|
+
Select,
|
|
3616
|
+
Subheader,
|
|
3617
|
+
Tooltip
|
|
3529
3618
|
});
|