@jmruthers/pace-core 0.6.4 → 0.6.5
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/{DataTable-E7YQZD7D.js → DataTable-AOVNCPTX.js} +8 -8
- package/dist/{PublicPageProvider-DEMpysFR.d.ts → PublicPageProvider-QTFVrL-Z.d.ts} +65 -83
- package/dist/{UnifiedAuthProvider-QPXO24B4.js → UnifiedAuthProvider-4SBX4LU5.js} +4 -4
- package/dist/{api-6LVZTHDS.js → api-O6HTBX5Y.js} +3 -3
- package/dist/{chunk-I6DAQMWX.js → chunk-6COVEUS7.js} +130 -106
- package/dist/chunk-6COVEUS7.js.map +1 -0
- package/dist/{chunk-36LVWXB2.js → chunk-AFVQODI2.js} +37 -1
- package/dist/{chunk-36LVWXB2.js.map → chunk-AFVQODI2.js.map} +1 -1
- package/dist/{chunk-3LPHPB62.js → chunk-EFN2EIMK.js} +2 -2
- package/dist/{chunk-ATKZM7RX.js → chunk-G7QEZTYQ.js} +31 -31
- package/dist/{chunk-ATKZM7RX.js.map → chunk-G7QEZTYQ.js.map} +1 -1
- package/dist/{chunk-NN6WWZ5U.js → chunk-HU2C6SSC.js} +29 -18
- package/dist/chunk-HU2C6SSC.js.map +1 -0
- package/dist/{chunk-AVMLPIM7.js → chunk-IHB5DR3H.js} +102 -51
- package/dist/chunk-IHB5DR3H.js.map +1 -0
- package/dist/{chunk-7JPAB3T5.js → chunk-IVOFDYWT.js} +364 -208
- package/dist/chunk-IVOFDYWT.js.map +1 -0
- package/dist/{chunk-6SOIHG6Z.js → chunk-JGRYX5UX.js} +120 -20
- package/dist/chunk-JGRYX5UX.js.map +1 -0
- package/dist/{chunk-OEWDTMG7.js → chunk-NTM7ZSB6.js} +4 -4
- package/dist/chunk-NTM7ZSB6.js.map +1 -0
- package/dist/{chunk-5EC5MEWX.js → chunk-RGAWHO7N.js} +4 -4
- package/dist/chunk-RGAWHO7N.js.map +1 -0
- package/dist/{chunk-YKRAFF5K.js → chunk-UPPMRMYG.js} +3 -3
- package/dist/{chunk-YKRAFF5K.js.map → chunk-UPPMRMYG.js.map} +1 -1
- package/dist/components.d.ts +2 -3
- package/dist/components.js +24 -28
- package/dist/components.js.map +1 -1
- package/dist/{contextValidator-OOPCLPZW.js → contextValidator-5OGXSPKS.js} +2 -2
- package/dist/hooks.d.ts +3 -3
- package/dist/hooks.js +41 -139
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +27 -18
- package/dist/index.js +41 -50
- package/dist/index.js.map +1 -1
- package/dist/providers.js +3 -3
- package/dist/rbac/index.d.ts +16 -9
- package/dist/rbac/index.js +6 -6
- package/dist/{usePublicRouteParams-i3qtoBgg.d.ts → usePublicRouteParams-ClnV4tnv.d.ts} +8 -8
- package/dist/utils.js +1 -1
- package/docs/api/modules.md +210 -100
- package/package.json +1 -2
- package/scripts/validate-master.js +1 -1
- package/src/components/DataTable/__tests__/keyboard.test.tsx +15 -2
- package/src/components/DataTable/components/ImportModal.tsx +4 -6
- package/src/components/DataTable/components/ViewRowModal.tsx +4 -4
- package/src/components/DataTable/components/__tests__/ImportModal.test.tsx +455 -96
- package/src/components/DataTable/components/__tests__/ViewRowModal.test.tsx +122 -58
- package/src/components/DataTable/core/DataTableContext.tsx +1 -1
- package/src/components/DateTimeField/DateTimeField.tsx +17 -19
- package/src/components/DateTimeField/README.md +5 -2
- package/src/components/Dialog/Dialog.test.tsx +248 -228
- package/src/components/Dialog/Dialog.tsx +455 -325
- package/src/components/Dialog/index.ts +3 -3
- package/src/components/FileDisplay/FileDisplay.test.tsx +41 -0
- package/src/components/FileDisplay/FileDisplay.tsx +5 -5
- package/src/components/Form/Form.test.tsx +3 -2
- package/src/components/Form/Form.tsx +4 -5
- package/src/components/InactivityWarningModal/InactivityWarningModal.test.tsx +28 -28
- package/src/components/InactivityWarningModal/InactivityWarningModal.tsx +40 -54
- package/src/components/LoginForm/LoginForm.tsx +2 -2
- package/src/components/NavigationMenu/NavigationMenu.tsx +2 -2
- package/src/components/PaceAppLayout/PaceAppLayout.tsx +32 -39
- package/src/components/PaceAppLayout/README.md +10 -9
- package/src/components/PaceAppLayout/test-setup.tsx +40 -31
- package/src/components/PasswordChange/PasswordChangeForm.test.tsx +61 -0
- package/src/components/PasswordChange/PasswordChangeForm.tsx +20 -13
- package/src/components/PublicLayout/PublicLayout.test.tsx +7 -3
- package/src/components/PublicLayout/PublicPageLayout.tsx +5 -8
- package/src/components/UserMenu/UserMenu.test.tsx +38 -6
- package/src/components/UserMenu/UserMenu.tsx +36 -34
- package/src/components/index.ts +3 -4
- package/src/hooks/useEventTheme.ts +4 -4
- package/src/hooks/useEvents.ts +11 -7
- package/src/hooks/useKeyboardShortcuts.ts +1 -1
- package/src/hooks/useOrganisationPermissions.ts +4 -4
- package/src/hooks/useOrganisations.ts +13 -7
- package/src/index.ts +11 -1
- package/src/rbac/README.md +20 -20
- package/src/rbac/hooks/useRBAC.test.ts +21 -3
- package/src/rbac/hooks/useRBAC.ts +4 -3
- package/src/rbac/hooks/useResourcePermissions.test.ts +125 -30
- package/src/rbac/hooks/useResourcePermissions.ts +57 -29
- package/src/rbac/permissions.ts +17 -17
- package/src/rbac/utils/contextValidator.ts +36 -0
- package/src/services/AuthService.ts +2 -5
- package/src/services/InactivityService.ts +139 -58
- package/src/styles/core.css +4 -0
- package/src/utils/formatting/formatTime.test.ts +3 -2
- package/dist/chunk-5EC5MEWX.js.map +0 -1
- package/dist/chunk-6SOIHG6Z.js.map +0 -1
- package/dist/chunk-7JPAB3T5.js.map +0 -1
- package/dist/chunk-AVMLPIM7.js.map +0 -1
- package/dist/chunk-I6DAQMWX.js.map +0 -1
- package/dist/chunk-NN6WWZ5U.js.map +0 -1
- package/dist/chunk-OEWDTMG7.js.map +0 -1
- /package/dist/{DataTable-E7YQZD7D.js.map → DataTable-AOVNCPTX.js.map} +0 -0
- /package/dist/{UnifiedAuthProvider-QPXO24B4.js.map → UnifiedAuthProvider-4SBX4LU5.js.map} +0 -0
- /package/dist/{api-6LVZTHDS.js.map → api-O6HTBX5Y.js.map} +0 -0
- /package/dist/{chunk-3LPHPB62.js.map → chunk-EFN2EIMK.js.map} +0 -0
- /package/dist/{contextValidator-OOPCLPZW.js.map → contextValidator-5OGXSPKS.js.map} +0 -0
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useCan,
|
|
3
3
|
useResolvedScope
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-HU2C6SSC.js";
|
|
5
5
|
import {
|
|
6
6
|
toast,
|
|
7
|
-
useDataTablePerformance
|
|
8
|
-
|
|
7
|
+
useDataTablePerformance,
|
|
8
|
+
useFocusTrap
|
|
9
|
+
} from "./chunk-JGRYX5UX.js";
|
|
9
10
|
import {
|
|
10
11
|
useUnifiedAuth
|
|
11
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-IHB5DR3H.js";
|
|
12
13
|
import {
|
|
13
14
|
isSuperAdmin
|
|
14
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-EFN2EIMK.js";
|
|
15
16
|
import {
|
|
16
17
|
cn,
|
|
17
18
|
renderSafeHtml
|
|
@@ -24,7 +25,7 @@ import {
|
|
|
24
25
|
import React30 from "react";
|
|
25
26
|
|
|
26
27
|
// src/components/DataTable/components/DataTableCore.tsx
|
|
27
|
-
import { useMemo as useMemo14, useCallback as
|
|
28
|
+
import { useMemo as useMemo14, useCallback as useCallback12, useEffect as useEffect16, useRef as useRef10 } from "react";
|
|
28
29
|
import { useReactTable } from "@tanstack/react-table";
|
|
29
30
|
import { Edit as Edit2, Trash as Trash3 } from "lucide-react";
|
|
30
31
|
|
|
@@ -3297,13 +3298,13 @@ function EnhancedPaginationControls({
|
|
|
3297
3298
|
import { useEffect as useEffect8 } from "react";
|
|
3298
3299
|
|
|
3299
3300
|
// src/components/DataTable/components/ImportModal.tsx
|
|
3300
|
-
import { useState as useState5, useRef as
|
|
3301
|
+
import { useState as useState5, useRef as useRef6, useEffect as useEffect7 } from "react";
|
|
3301
3302
|
|
|
3302
3303
|
// src/components/Dialog/Dialog.tsx
|
|
3303
3304
|
import * as React19 from "react";
|
|
3304
|
-
import
|
|
3305
|
+
import { createPortal } from "react-dom";
|
|
3305
3306
|
import { X as X4 } from "lucide-react";
|
|
3306
|
-
import { useState as useState4, useEffect as useEffect6 } from "react";
|
|
3307
|
+
import { useState as useState4, useEffect as useEffect6, useRef as useRef5, useCallback as useCallback4, useId } from "react";
|
|
3307
3308
|
import { Fragment as Fragment3, jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3308
3309
|
function debounce(func, wait) {
|
|
3309
3310
|
let timeoutId = null;
|
|
@@ -3323,6 +3324,14 @@ function debounce(func, wait) {
|
|
|
3323
3324
|
};
|
|
3324
3325
|
return debounced;
|
|
3325
3326
|
}
|
|
3327
|
+
var DialogContext = React19.createContext(null);
|
|
3328
|
+
function useDialogContext() {
|
|
3329
|
+
const context = React19.useContext(DialogContext);
|
|
3330
|
+
if (!context) {
|
|
3331
|
+
throw new Error("Dialog components must be used within a Dialog");
|
|
3332
|
+
}
|
|
3333
|
+
return context;
|
|
3334
|
+
}
|
|
3326
3335
|
var sizeClasses = {
|
|
3327
3336
|
sm: "max-w-sm",
|
|
3328
3337
|
md: "max-w-md",
|
|
@@ -3331,22 +3340,79 @@ var sizeClasses = {
|
|
|
3331
3340
|
full: "max-w-full size-full",
|
|
3332
3341
|
auto: "max-w-none w-auto min-w-0"
|
|
3333
3342
|
};
|
|
3334
|
-
var Dialog =
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3343
|
+
var Dialog = React19.memo(function Dialog2({
|
|
3344
|
+
children,
|
|
3345
|
+
open: controlledOpen,
|
|
3346
|
+
defaultOpen = false,
|
|
3347
|
+
onOpenChange
|
|
3348
|
+
}) {
|
|
3349
|
+
const [internalOpen, setInternalOpen] = useState4(defaultOpen);
|
|
3350
|
+
const dialogRef = useRef5(null);
|
|
3351
|
+
const titleId = useId();
|
|
3352
|
+
const descriptionId = useId();
|
|
3353
|
+
const isControlled = controlledOpen !== void 0;
|
|
3354
|
+
const open = isControlled ? controlledOpen : internalOpen;
|
|
3355
|
+
const handleOpenChange = useCallback4((newOpen) => {
|
|
3356
|
+
if (!isControlled) {
|
|
3357
|
+
setInternalOpen(newOpen);
|
|
3358
|
+
}
|
|
3359
|
+
onOpenChange?.(newOpen);
|
|
3360
|
+
}, [isControlled, onOpenChange]);
|
|
3361
|
+
const contextValue = React19.useMemo(() => ({
|
|
3362
|
+
open,
|
|
3363
|
+
onOpenChange: handleOpenChange,
|
|
3364
|
+
dialogRef,
|
|
3365
|
+
titleId,
|
|
3366
|
+
descriptionId
|
|
3367
|
+
}), [open, handleOpenChange, titleId, descriptionId]);
|
|
3368
|
+
return /* @__PURE__ */ jsx19(DialogContext.Provider, { value: contextValue, children });
|
|
3369
|
+
});
|
|
3370
|
+
Dialog.displayName = "Dialog";
|
|
3371
|
+
var DialogTrigger = React19.forwardRef(
|
|
3372
|
+
({ children, asChild = false, className, onClick, ...props }, ref) => {
|
|
3373
|
+
const { onOpenChange } = useDialogContext();
|
|
3374
|
+
const handleClick = useCallback4((e) => {
|
|
3375
|
+
onClick?.(e);
|
|
3376
|
+
onOpenChange(true);
|
|
3377
|
+
}, [onOpenChange, onClick]);
|
|
3378
|
+
if (asChild && React19.isValidElement(children)) {
|
|
3379
|
+
return React19.cloneElement(children, {
|
|
3380
|
+
ref,
|
|
3381
|
+
onClick: handleClick,
|
|
3382
|
+
className: cn(className, children.props?.className),
|
|
3383
|
+
...props
|
|
3384
|
+
});
|
|
3385
|
+
}
|
|
3386
|
+
return /* @__PURE__ */ jsx19(
|
|
3387
|
+
"button",
|
|
3388
|
+
{
|
|
3389
|
+
ref,
|
|
3390
|
+
type: "button",
|
|
3391
|
+
onClick: handleClick,
|
|
3392
|
+
className,
|
|
3393
|
+
...props,
|
|
3394
|
+
children
|
|
3395
|
+
}
|
|
3396
|
+
);
|
|
3347
3397
|
}
|
|
3348
|
-
)
|
|
3349
|
-
|
|
3398
|
+
);
|
|
3399
|
+
DialogTrigger.displayName = "DialogTrigger";
|
|
3400
|
+
var DialogPortal = ({ children }) => {
|
|
3401
|
+
const [mounted, setMounted] = useState4(false);
|
|
3402
|
+
useEffect6(() => {
|
|
3403
|
+
setMounted(true);
|
|
3404
|
+
return () => setMounted(false);
|
|
3405
|
+
}, []);
|
|
3406
|
+
if (!mounted) return null;
|
|
3407
|
+
return createPortal(children, document.body);
|
|
3408
|
+
};
|
|
3409
|
+
DialogPortal.displayName = "DialogPortal";
|
|
3410
|
+
var DialogOverlay = React19.forwardRef(
|
|
3411
|
+
({ className, ...props }, ref) => {
|
|
3412
|
+
return null;
|
|
3413
|
+
}
|
|
3414
|
+
);
|
|
3415
|
+
DialogOverlay.displayName = "DialogOverlay";
|
|
3350
3416
|
var useSmartDimensions = ({
|
|
3351
3417
|
maxHeightPercent,
|
|
3352
3418
|
maxWidthPercent,
|
|
@@ -3412,74 +3478,134 @@ var useSmartDimensions = ({
|
|
|
3412
3478
|
}
|
|
3413
3479
|
return result;
|
|
3414
3480
|
};
|
|
3415
|
-
var DialogContent = React19.forwardRef(
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
maxHeightPercent,
|
|
3424
|
-
maxWidthPercent,
|
|
3425
|
-
enableScrolling = false,
|
|
3426
|
-
maxHeight,
|
|
3427
|
-
maxWidth,
|
|
3428
|
-
minHeight,
|
|
3429
|
-
minWidth,
|
|
3430
|
-
style,
|
|
3431
|
-
...props
|
|
3432
|
-
}, ref) => {
|
|
3433
|
-
const smartDimensions = useSmartDimensions({
|
|
3481
|
+
var DialogContent = React19.forwardRef(
|
|
3482
|
+
({
|
|
3483
|
+
className,
|
|
3484
|
+
children,
|
|
3485
|
+
size = "md",
|
|
3486
|
+
showCloseButton = true,
|
|
3487
|
+
preventCloseOnEscape = false,
|
|
3488
|
+
preventCloseOnOutsideClick = false,
|
|
3434
3489
|
maxHeightPercent,
|
|
3435
3490
|
maxWidthPercent,
|
|
3491
|
+
enableScrolling = false,
|
|
3436
3492
|
maxHeight,
|
|
3437
3493
|
maxWidth,
|
|
3438
3494
|
minHeight,
|
|
3439
3495
|
minWidth,
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
}
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3496
|
+
title,
|
|
3497
|
+
description,
|
|
3498
|
+
style,
|
|
3499
|
+
...props
|
|
3500
|
+
}, ref) => {
|
|
3501
|
+
const { open, onOpenChange, dialogRef, titleId, descriptionId } = useDialogContext();
|
|
3502
|
+
const internalRef = useRef5(null);
|
|
3503
|
+
const actualDialogRef = dialogRef.current ? dialogRef : ref ? ref : internalRef;
|
|
3504
|
+
const smartDimensions = useSmartDimensions({
|
|
3505
|
+
maxHeightPercent,
|
|
3506
|
+
maxWidthPercent,
|
|
3507
|
+
maxHeight,
|
|
3508
|
+
maxWidth,
|
|
3509
|
+
minHeight,
|
|
3510
|
+
minWidth,
|
|
3511
|
+
enableScrolling
|
|
3512
|
+
});
|
|
3513
|
+
const { containerRef } = useFocusTrap({
|
|
3514
|
+
isActive: open,
|
|
3515
|
+
autoFocus: true,
|
|
3516
|
+
restoreFocus: true,
|
|
3517
|
+
onEscape: preventCloseOnEscape ? void 0 : () => onOpenChange(false)
|
|
3518
|
+
});
|
|
3519
|
+
const mergedRef = useCallback4((node) => {
|
|
3520
|
+
if (dialogRef && "current" in dialogRef) {
|
|
3521
|
+
dialogRef.current = node;
|
|
3522
|
+
}
|
|
3523
|
+
if (internalRef && "current" in internalRef) {
|
|
3524
|
+
internalRef.current = node;
|
|
3525
|
+
}
|
|
3526
|
+
if (containerRef && "current" in containerRef) {
|
|
3527
|
+
containerRef.current = node;
|
|
3528
|
+
}
|
|
3529
|
+
if (typeof ref === "function") {
|
|
3530
|
+
ref(node);
|
|
3531
|
+
} else if (ref && "current" in ref) {
|
|
3532
|
+
ref.current = node;
|
|
3533
|
+
}
|
|
3534
|
+
}, [dialogRef, containerRef, ref]);
|
|
3535
|
+
useEffect6(() => {
|
|
3536
|
+
const dialog = dialogRef.current || internalRef.current;
|
|
3537
|
+
if (!dialog) return;
|
|
3538
|
+
if (open) {
|
|
3539
|
+
requestAnimationFrame(() => {
|
|
3540
|
+
if (dialog && open) {
|
|
3541
|
+
dialog.showModal();
|
|
3542
|
+
}
|
|
3543
|
+
});
|
|
3544
|
+
} else {
|
|
3545
|
+
if (dialog.open) {
|
|
3546
|
+
dialog.close();
|
|
3547
|
+
}
|
|
3548
|
+
}
|
|
3549
|
+
}, [open, dialogRef]);
|
|
3550
|
+
useEffect6(() => {
|
|
3551
|
+
const dialog = dialogRef.current || internalRef.current;
|
|
3552
|
+
if (!dialog) return;
|
|
3553
|
+
const handleClose = () => {
|
|
3554
|
+
if (!dialog.open && open) {
|
|
3555
|
+
onOpenChange(false);
|
|
3556
|
+
}
|
|
3557
|
+
};
|
|
3558
|
+
dialog.addEventListener("close", handleClose);
|
|
3559
|
+
return () => {
|
|
3560
|
+
dialog.removeEventListener("close", handleClose);
|
|
3561
|
+
};
|
|
3562
|
+
}, [open, onOpenChange, dialogRef]);
|
|
3563
|
+
useEffect6(() => {
|
|
3564
|
+
const dialog = dialogRef.current || internalRef.current;
|
|
3565
|
+
if (!dialog) return;
|
|
3566
|
+
const handleCancel = (e) => {
|
|
3567
|
+
if (preventCloseOnEscape || preventCloseOnOutsideClick) {
|
|
3568
|
+
e.preventDefault();
|
|
3569
|
+
return;
|
|
3570
|
+
}
|
|
3571
|
+
onOpenChange(false);
|
|
3572
|
+
};
|
|
3573
|
+
dialog.addEventListener("cancel", handleCancel);
|
|
3574
|
+
return () => {
|
|
3575
|
+
dialog.removeEventListener("cancel", handleCancel);
|
|
3576
|
+
};
|
|
3577
|
+
}, [preventCloseOnEscape, preventCloseOnOutsideClick, onOpenChange, dialogRef]);
|
|
3578
|
+
const mergedStyle = React19.useMemo(() => {
|
|
3579
|
+
if (Object.keys(smartDimensions).length === 0) {
|
|
3580
|
+
return style;
|
|
3581
|
+
}
|
|
3582
|
+
const finalStyle = { ...smartDimensions, ...style };
|
|
3583
|
+
if (!maxWidth && !maxWidthPercent) {
|
|
3584
|
+
const { maxWidth: _, ...styleWithoutMaxWidth } = finalStyle;
|
|
3585
|
+
return styleWithoutMaxWidth;
|
|
3586
|
+
}
|
|
3587
|
+
return finalStyle;
|
|
3588
|
+
}, [smartDimensions, style, maxWidth, maxWidthPercent]);
|
|
3589
|
+
return /* @__PURE__ */ jsx19(DialogPortal, { children: open && /* @__PURE__ */ jsxs15(
|
|
3590
|
+
"dialog",
|
|
3467
3591
|
{
|
|
3468
|
-
ref,
|
|
3469
|
-
onEscapeKeyDown: preventCloseOnEscape ? handleEscapeKeyDown : void 0,
|
|
3470
|
-
onPointerDownOutside: handlePointerDownOutside,
|
|
3592
|
+
ref: mergedRef,
|
|
3471
3593
|
className: cn(
|
|
3472
|
-
"fixed left-[50%] top-[50%] z-[51] w-full translate-x-[-50%] translate-y-[-50%] border bg-background shadow-lg duration-200
|
|
3473
|
-
|
|
3594
|
+
"fixed left-[50%] top-[50%] z-[51] w-full translate-x-[-50%] translate-y-[-50%] border bg-background shadow-lg duration-200",
|
|
3595
|
+
"animate-in fade-in-0 zoom-in-95 slide-in-from-left-1/2 slide-in-from-top-[48%]",
|
|
3596
|
+
"sm:rounded-lg",
|
|
3597
|
+
// Reset native dialog styles
|
|
3474
3598
|
"m-0 p-0 max-w-none max-h-none w-auto h-auto border-0 bg-transparent outline-none",
|
|
3475
3599
|
// Apply our custom styling
|
|
3476
3600
|
"border bg-background shadow-lg",
|
|
3601
|
+
// Style native backdrop pseudo-element (Tailwind v4 supports arbitrary variants)
|
|
3602
|
+
"[&::backdrop]:bg-black/50 [&::backdrop]:animate-in [&::backdrop]:fade-in-0",
|
|
3477
3603
|
// Only apply size classes if not using smart width
|
|
3478
3604
|
!maxWidth && !maxWidthPercent && sizeClasses[size],
|
|
3479
|
-
// Auto size gets special handling
|
|
3605
|
+
// Auto size gets special handling
|
|
3480
3606
|
size === "auto" && "w-fit max-w-[90vw] sm:max-w-[80vw]",
|
|
3481
3607
|
// Layout classes based on scrolling mode
|
|
3482
|
-
enableScrolling ? "flex flex-col" : "grid gap-4 p-6",
|
|
3608
|
+
enableScrolling ? "flex flex-col px-6" : "grid gap-4 p-6",
|
|
3483
3609
|
// Full screen handling
|
|
3484
3610
|
size === "full" && "sm:left-[50%] sm:top-[50%] sm:translate-x-[-50%] sm:translate-y-[-50%] left-0 top-0 translate-x-0 translate-y-0 h-full rounded-none sm:h-auto sm:rounded-lg",
|
|
3485
3611
|
// Overflow handling for scrolling mode
|
|
@@ -3487,19 +3613,45 @@ var DialogContent = React19.forwardRef(({
|
|
|
3487
3613
|
className
|
|
3488
3614
|
),
|
|
3489
3615
|
style: mergedStyle,
|
|
3616
|
+
role: "dialog",
|
|
3617
|
+
"aria-modal": "true",
|
|
3618
|
+
"aria-labelledby": titleId,
|
|
3619
|
+
"aria-describedby": descriptionId,
|
|
3620
|
+
title,
|
|
3621
|
+
"aria-description": description,
|
|
3490
3622
|
...props,
|
|
3491
3623
|
children: [
|
|
3492
3624
|
children,
|
|
3493
|
-
showCloseButton && /* @__PURE__ */
|
|
3494
|
-
/* @__PURE__ */ jsx19(X4, { className: "size-4" }),
|
|
3495
|
-
/* @__PURE__ */ jsx19("span", { className: "sr-only", children: "Close" })
|
|
3496
|
-
] })
|
|
3625
|
+
showCloseButton && /* @__PURE__ */ jsx19(DialogClose, {})
|
|
3497
3626
|
]
|
|
3498
3627
|
}
|
|
3499
|
-
)
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
DialogContent.displayName =
|
|
3628
|
+
) });
|
|
3629
|
+
}
|
|
3630
|
+
);
|
|
3631
|
+
DialogContent.displayName = "DialogContent";
|
|
3632
|
+
var DialogClose = React19.forwardRef(
|
|
3633
|
+
({ className, ...props }, ref) => {
|
|
3634
|
+
const { onOpenChange } = useDialogContext();
|
|
3635
|
+
return /* @__PURE__ */ jsxs15(
|
|
3636
|
+
"button",
|
|
3637
|
+
{
|
|
3638
|
+
ref,
|
|
3639
|
+
type: "button",
|
|
3640
|
+
onClick: () => onOpenChange(false),
|
|
3641
|
+
className: cn(
|
|
3642
|
+
"absolute right-4 top-4 z-10 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",
|
|
3643
|
+
className
|
|
3644
|
+
),
|
|
3645
|
+
...props,
|
|
3646
|
+
children: [
|
|
3647
|
+
/* @__PURE__ */ jsx19(X4, { className: "size-4" }),
|
|
3648
|
+
/* @__PURE__ */ jsx19("span", { className: "sr-only", children: "Close" })
|
|
3649
|
+
]
|
|
3650
|
+
}
|
|
3651
|
+
);
|
|
3652
|
+
}
|
|
3653
|
+
);
|
|
3654
|
+
DialogClose.displayName = "DialogClose";
|
|
3503
3655
|
var DialogHeader = ({
|
|
3504
3656
|
className,
|
|
3505
3657
|
sticky = false,
|
|
@@ -3509,7 +3661,7 @@ var DialogHeader = ({
|
|
|
3509
3661
|
{
|
|
3510
3662
|
className: cn(
|
|
3511
3663
|
"flex flex-col space-y-1.5 text-center sm:text-left",
|
|
3512
|
-
sticky ? "sticky top-0 z-10 bg-background
|
|
3664
|
+
sticky ? "sticky top-0 z-10 bg-background pt-6 pb-4 border-b" : "py-2",
|
|
3513
3665
|
className
|
|
3514
3666
|
),
|
|
3515
3667
|
...props
|
|
@@ -3548,7 +3700,7 @@ var DialogBody = ({
|
|
|
3548
3700
|
"main",
|
|
3549
3701
|
{
|
|
3550
3702
|
className: cn(
|
|
3551
|
-
"overflow-y-auto
|
|
3703
|
+
"overflow-y-auto py-2",
|
|
3552
3704
|
className
|
|
3553
3705
|
),
|
|
3554
3706
|
style: mergedStyle,
|
|
@@ -3556,13 +3708,13 @@ var DialogBody = ({
|
|
|
3556
3708
|
tabIndex: -1,
|
|
3557
3709
|
...props,
|
|
3558
3710
|
children: processedHtmlContent ? /* @__PURE__ */ jsx19(
|
|
3559
|
-
"
|
|
3711
|
+
"p",
|
|
3560
3712
|
{
|
|
3561
3713
|
dangerouslySetInnerHTML: { __html: processedHtmlContent },
|
|
3562
3714
|
className: "prose prose-sm max-w-none"
|
|
3563
3715
|
}
|
|
3564
3716
|
) : /* @__PURE__ */ jsxs15(Fragment3, { children: [
|
|
3565
|
-
hasHtmlContent && !processedHtmlContent && /* @__PURE__ */ jsx19("
|
|
3717
|
+
hasHtmlContent && !processedHtmlContent && /* @__PURE__ */ jsx19("p", { className: "text-acc-500 mb-2", children: "No HTML content processed. Showing children instead." }),
|
|
3566
3718
|
children
|
|
3567
3719
|
] })
|
|
3568
3720
|
}
|
|
@@ -3577,61 +3729,66 @@ var DialogFooter = ({
|
|
|
3577
3729
|
"footer",
|
|
3578
3730
|
{
|
|
3579
3731
|
className: cn(
|
|
3580
|
-
// Only apply default layout classes if no custom className is provided
|
|
3581
3732
|
!className && "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
3582
|
-
!className && (sticky ? "sticky bottom-0 z-10 bg-background
|
|
3733
|
+
!className && (sticky ? "sticky bottom-0 z-10 bg-background pt-4 pb-6 border-t" : "py-2"),
|
|
3583
3734
|
className
|
|
3584
3735
|
),
|
|
3585
3736
|
...props
|
|
3586
3737
|
}
|
|
3587
3738
|
);
|
|
3588
3739
|
DialogFooter.displayName = "DialogFooter";
|
|
3589
|
-
var DialogTitle = React19.forwardRef(
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
}
|
|
3618
|
-
const
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3740
|
+
var DialogTitle = React19.forwardRef(
|
|
3741
|
+
({ className, htmlContent, allowHtml = true, children, ...props }, ref) => {
|
|
3742
|
+
const { titleId } = useDialogContext();
|
|
3743
|
+
const processedHtmlContent = React19.useMemo(() => {
|
|
3744
|
+
if (!htmlContent || !allowHtml) {
|
|
3745
|
+
return null;
|
|
3746
|
+
}
|
|
3747
|
+
const result = renderSafeHtml(htmlContent, {
|
|
3748
|
+
strict: true,
|
|
3749
|
+
logWarnings: false
|
|
3750
|
+
});
|
|
3751
|
+
return result.html;
|
|
3752
|
+
}, [htmlContent, allowHtml]);
|
|
3753
|
+
return /* @__PURE__ */ jsx19(
|
|
3754
|
+
"h2",
|
|
3755
|
+
{
|
|
3756
|
+
ref,
|
|
3757
|
+
id: titleId,
|
|
3758
|
+
className: cn(className),
|
|
3759
|
+
...props,
|
|
3760
|
+
children: processedHtmlContent ? /* @__PURE__ */ jsx19("span", { dangerouslySetInnerHTML: { __html: processedHtmlContent } }) : children
|
|
3761
|
+
}
|
|
3762
|
+
);
|
|
3763
|
+
}
|
|
3764
|
+
);
|
|
3765
|
+
DialogTitle.displayName = "DialogTitle";
|
|
3766
|
+
var DialogDescription = React19.forwardRef(
|
|
3767
|
+
({ className, htmlContent, allowHtml = true, children, ...props }, ref) => {
|
|
3768
|
+
const { descriptionId } = useDialogContext();
|
|
3769
|
+
const processedHtmlContent = React19.useMemo(() => {
|
|
3770
|
+
if (!htmlContent || !allowHtml) {
|
|
3771
|
+
return null;
|
|
3772
|
+
}
|
|
3773
|
+
const result = renderSafeHtml(htmlContent, {
|
|
3774
|
+
strict: true,
|
|
3775
|
+
logWarnings: false
|
|
3776
|
+
});
|
|
3777
|
+
return result.html;
|
|
3778
|
+
}, [htmlContent, allowHtml]);
|
|
3779
|
+
return /* @__PURE__ */ jsx19(
|
|
3780
|
+
"p",
|
|
3781
|
+
{
|
|
3782
|
+
ref,
|
|
3783
|
+
id: descriptionId,
|
|
3784
|
+
className: cn(className),
|
|
3785
|
+
...props,
|
|
3786
|
+
children: processedHtmlContent ? /* @__PURE__ */ jsx19("span", { dangerouslySetInnerHTML: { __html: processedHtmlContent } }) : children
|
|
3787
|
+
}
|
|
3788
|
+
);
|
|
3789
|
+
}
|
|
3790
|
+
);
|
|
3791
|
+
DialogDescription.displayName = "DialogDescription";
|
|
3635
3792
|
|
|
3636
3793
|
// src/components/Progress/Progress.tsx
|
|
3637
3794
|
import * as React20 from "react";
|
|
@@ -3667,8 +3824,8 @@ function ImportModal({ isOpen, onClose, onImport, config = {} }) {
|
|
|
3667
3824
|
const [totalCount, setTotalCount] = useState5(0);
|
|
3668
3825
|
const [validationErrors, setValidationErrors] = useState5([]);
|
|
3669
3826
|
const [importProgress, setImportProgress] = useState5(null);
|
|
3670
|
-
const fileInputRef =
|
|
3671
|
-
const isMountedRef =
|
|
3827
|
+
const fileInputRef = useRef6(null);
|
|
3828
|
+
const isMountedRef = useRef6(true);
|
|
3672
3829
|
useEffect7(() => {
|
|
3673
3830
|
return () => {
|
|
3674
3831
|
isMountedRef.current = false;
|
|
@@ -3858,10 +4015,10 @@ function ImportModal({ isOpen, onClose, onImport, config = {} }) {
|
|
|
3858
4015
|
}
|
|
3859
4016
|
}
|
|
3860
4017
|
};
|
|
3861
|
-
return /* @__PURE__ */ jsx21(Dialog, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs16(DialogContent, { className: "sm:max-w-2xl bg-main-50", children: [
|
|
4018
|
+
return /* @__PURE__ */ jsx21(Dialog, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs16(DialogContent, { className: "sm:max-w-2xl bg-main-50", title, description, children: [
|
|
3862
4019
|
/* @__PURE__ */ jsxs16(DialogHeader, { children: [
|
|
3863
|
-
/* @__PURE__ */ jsx21(
|
|
3864
|
-
/* @__PURE__ */ jsx21(
|
|
4020
|
+
/* @__PURE__ */ jsx21("h2", { children: title }),
|
|
4021
|
+
/* @__PURE__ */ jsx21("p", { children: description })
|
|
3865
4022
|
] }),
|
|
3866
4023
|
/* @__PURE__ */ jsxs16("div", { className: "space-y-4", children: [
|
|
3867
4024
|
/* @__PURE__ */ jsxs16("div", { className: "border-2 border-dashed border-sec-200 rounded-lg p-6 text-center", children: [
|
|
@@ -4946,7 +5103,7 @@ var DataTableErrorBoundary = class extends Component {
|
|
|
4946
5103
|
};
|
|
4947
5104
|
|
|
4948
5105
|
// src/components/DataTable/hooks/useColumnOrderPersistence.ts
|
|
4949
|
-
import { useState as useState6, useEffect as useEffect9, useCallback as
|
|
5106
|
+
import { useState as useState6, useEffect as useEffect9, useCallback as useCallback5 } from "react";
|
|
4950
5107
|
function useColumnOrderPersistence({
|
|
4951
5108
|
tableId,
|
|
4952
5109
|
defaultOrder = [],
|
|
@@ -4980,7 +5137,7 @@ function useColumnOrderPersistence({
|
|
|
4980
5137
|
setIsLoaded(true);
|
|
4981
5138
|
}
|
|
4982
5139
|
}, [enablePersistence, finalStorageKey, storageKey, tableId]);
|
|
4983
|
-
const saveColumnOrder =
|
|
5140
|
+
const saveColumnOrder = useCallback5((newOrder) => {
|
|
4984
5141
|
if (!enablePersistence || typeof window === "undefined") return;
|
|
4985
5142
|
if (!storageKey && !tableId) return;
|
|
4986
5143
|
try {
|
|
@@ -4989,11 +5146,11 @@ function useColumnOrderPersistence({
|
|
|
4989
5146
|
logger2.warn("Failed to save column order to localStorage:", error);
|
|
4990
5147
|
}
|
|
4991
5148
|
}, [enablePersistence, finalStorageKey, storageKey, tableId]);
|
|
4992
|
-
const updateColumnOrder =
|
|
5149
|
+
const updateColumnOrder = useCallback5((newOrder) => {
|
|
4993
5150
|
setColumnOrder(newOrder);
|
|
4994
5151
|
saveColumnOrder(newOrder);
|
|
4995
5152
|
}, [saveColumnOrder]);
|
|
4996
|
-
const resetColumnOrder =
|
|
5153
|
+
const resetColumnOrder = useCallback5(() => {
|
|
4997
5154
|
setColumnOrder(defaultOrder);
|
|
4998
5155
|
if (enablePersistence && (storageKey || tableId) && typeof window !== "undefined") {
|
|
4999
5156
|
try {
|
|
@@ -5003,7 +5160,7 @@ function useColumnOrderPersistence({
|
|
|
5003
5160
|
}
|
|
5004
5161
|
}
|
|
5005
5162
|
}, [defaultOrder, enablePersistence, finalStorageKey, storageKey, tableId]);
|
|
5006
|
-
const clearAllPreferences =
|
|
5163
|
+
const clearAllPreferences = useCallback5(() => {
|
|
5007
5164
|
if (!enablePersistence || typeof window === "undefined") return;
|
|
5008
5165
|
try {
|
|
5009
5166
|
const keys = Object.keys(localStorage);
|
|
@@ -5026,7 +5183,7 @@ function useColumnOrderPersistence({
|
|
|
5026
5183
|
}
|
|
5027
5184
|
|
|
5028
5185
|
// src/components/DataTable/hooks/useColumnVisibilityPersistence.ts
|
|
5029
|
-
import { useState as useState7, useEffect as useEffect10, useCallback as
|
|
5186
|
+
import { useState as useState7, useEffect as useEffect10, useCallback as useCallback6 } from "react";
|
|
5030
5187
|
function useColumnVisibilityPersistence({
|
|
5031
5188
|
tableId,
|
|
5032
5189
|
defaultVisibility = {},
|
|
@@ -5056,7 +5213,7 @@ function useColumnVisibilityPersistence({
|
|
|
5056
5213
|
setIsLoaded(true);
|
|
5057
5214
|
}
|
|
5058
5215
|
}, [enablePersistence, finalStorageKey]);
|
|
5059
|
-
const saveColumnVisibility =
|
|
5216
|
+
const saveColumnVisibility = useCallback6((newVisibility) => {
|
|
5060
5217
|
if (!enablePersistence || typeof window === "undefined") return;
|
|
5061
5218
|
try {
|
|
5062
5219
|
localStorage.setItem(finalStorageKey, JSON.stringify(newVisibility));
|
|
@@ -5064,11 +5221,11 @@ function useColumnVisibilityPersistence({
|
|
|
5064
5221
|
logger2.warn("Failed to save column visibility to localStorage:", error);
|
|
5065
5222
|
}
|
|
5066
5223
|
}, [enablePersistence, finalStorageKey]);
|
|
5067
|
-
const updateColumnVisibility =
|
|
5224
|
+
const updateColumnVisibility = useCallback6((newVisibility) => {
|
|
5068
5225
|
setColumnVisibility(newVisibility);
|
|
5069
5226
|
saveColumnVisibility(newVisibility);
|
|
5070
5227
|
}, [saveColumnVisibility]);
|
|
5071
|
-
const resetColumnVisibility =
|
|
5228
|
+
const resetColumnVisibility = useCallback6(() => {
|
|
5072
5229
|
setColumnVisibility(defaultVisibility);
|
|
5073
5230
|
if (enablePersistence && typeof window !== "undefined") {
|
|
5074
5231
|
try {
|
|
@@ -5078,7 +5235,7 @@ function useColumnVisibilityPersistence({
|
|
|
5078
5235
|
}
|
|
5079
5236
|
}
|
|
5080
5237
|
}, [defaultVisibility, enablePersistence, finalStorageKey]);
|
|
5081
|
-
const clearAllPreferences =
|
|
5238
|
+
const clearAllPreferences = useCallback6(() => {
|
|
5082
5239
|
if (!enablePersistence || typeof window === "undefined") return;
|
|
5083
5240
|
try {
|
|
5084
5241
|
const keys = Object.keys(localStorage);
|
|
@@ -5101,7 +5258,7 @@ function useColumnVisibilityPersistence({
|
|
|
5101
5258
|
}
|
|
5102
5259
|
|
|
5103
5260
|
// src/components/DataTable/hooks/useDataTableState.ts
|
|
5104
|
-
import { useReducer, useCallback as
|
|
5261
|
+
import { useReducer, useCallback as useCallback7, useMemo as useMemo6 } from "react";
|
|
5105
5262
|
function dataTableReducer(state, action) {
|
|
5106
5263
|
switch (action.type) {
|
|
5107
5264
|
case "SET_SORTING":
|
|
@@ -5237,7 +5394,7 @@ function useDataTableState({
|
|
|
5237
5394
|
hasFilters: state.columnFilters.length > 0 || state.searchQuery !== "",
|
|
5238
5395
|
canClearFilters: state.columnFilters.length > 0 || state.searchQuery !== ""
|
|
5239
5396
|
}), [state]);
|
|
5240
|
-
const clearFilters =
|
|
5397
|
+
const clearFilters = useCallback7(() => {
|
|
5241
5398
|
dispatch({ type: "SET_COLUMN_FILTERS", payload: [] });
|
|
5242
5399
|
dispatch({ type: "SET_SEARCH_QUERY", payload: "" });
|
|
5243
5400
|
}, []);
|
|
@@ -5253,7 +5410,7 @@ function useDataTableState({
|
|
|
5253
5410
|
import { useMemo as useMemo8 } from "react";
|
|
5254
5411
|
|
|
5255
5412
|
// src/components/DataTable/hooks/useHierarchicalState.ts
|
|
5256
|
-
import { useState as useState8, useCallback as
|
|
5413
|
+
import { useState as useState8, useCallback as useCallback8, useMemo as useMemo7, useEffect as useEffect11 } from "react";
|
|
5257
5414
|
function useHierarchicalState(data, config) {
|
|
5258
5415
|
const initialExpandedState = useMemo7(() => {
|
|
5259
5416
|
if (!config?.defaultExpanded) {
|
|
@@ -5315,7 +5472,7 @@ function useHierarchicalState(data, config) {
|
|
|
5315
5472
|
}
|
|
5316
5473
|
return visible;
|
|
5317
5474
|
}, [data, expandedRows, parentChildMap]);
|
|
5318
|
-
const toggleRow =
|
|
5475
|
+
const toggleRow = useCallback8((rowId) => {
|
|
5319
5476
|
setExpandedRows((prev) => {
|
|
5320
5477
|
const newSet = new Set(prev);
|
|
5321
5478
|
if (newSet.has(rowId)) {
|
|
@@ -5329,32 +5486,32 @@ function useHierarchicalState(data, config) {
|
|
|
5329
5486
|
return newSet;
|
|
5330
5487
|
});
|
|
5331
5488
|
}, [config]);
|
|
5332
|
-
const expandAll =
|
|
5489
|
+
const expandAll = useCallback8(() => {
|
|
5333
5490
|
const parentIds = data.filter((row) => row.isParent).map((row) => row.id);
|
|
5334
5491
|
setExpandedRows(new Set(parentIds));
|
|
5335
5492
|
if (config?.onExpandedChange) {
|
|
5336
5493
|
config.onExpandedChange(parentIds);
|
|
5337
5494
|
}
|
|
5338
5495
|
}, [data, config]);
|
|
5339
|
-
const collapseAll =
|
|
5496
|
+
const collapseAll = useCallback8(() => {
|
|
5340
5497
|
setExpandedRows(/* @__PURE__ */ new Set());
|
|
5341
5498
|
if (config?.onExpandedChange) {
|
|
5342
5499
|
config.onExpandedChange([]);
|
|
5343
5500
|
}
|
|
5344
5501
|
}, [config]);
|
|
5345
|
-
const isExpanded =
|
|
5502
|
+
const isExpanded = useCallback8((rowId) => {
|
|
5346
5503
|
return expandedRows.has(rowId);
|
|
5347
5504
|
}, [expandedRows]);
|
|
5348
|
-
const hasChildren =
|
|
5505
|
+
const hasChildren = useCallback8((rowId) => {
|
|
5349
5506
|
return parentChildMap.has(rowId) && (parentChildMap.get(rowId)?.length || 0) > 0;
|
|
5350
5507
|
}, [parentChildMap]);
|
|
5351
|
-
const getChildrenCount =
|
|
5508
|
+
const getChildrenCount = useCallback8((rowId) => {
|
|
5352
5509
|
return parentChildMap.get(rowId)?.length || 0;
|
|
5353
5510
|
}, [parentChildMap]);
|
|
5354
|
-
const getExpandedIds =
|
|
5511
|
+
const getExpandedIds = useCallback8(() => {
|
|
5355
5512
|
return Array.from(expandedRows);
|
|
5356
5513
|
}, [expandedRows]);
|
|
5357
|
-
const setExpandedIds =
|
|
5514
|
+
const setExpandedIds = useCallback8((ids) => {
|
|
5358
5515
|
setExpandedRows(new Set(ids));
|
|
5359
5516
|
}, []);
|
|
5360
5517
|
return {
|
|
@@ -5535,7 +5692,7 @@ function useDataTableDataPipeline({
|
|
|
5535
5692
|
}
|
|
5536
5693
|
|
|
5537
5694
|
// src/components/DataTable/hooks/useServerSideDataEffect.ts
|
|
5538
|
-
import { useCallback as
|
|
5695
|
+
import { useCallback as useCallback9, useEffect as useEffect12 } from "react";
|
|
5539
5696
|
function useServerSideDataEffect({
|
|
5540
5697
|
finalPaginationMode,
|
|
5541
5698
|
serverSide,
|
|
@@ -5548,7 +5705,7 @@ function useServerSideDataEffect({
|
|
|
5548
5705
|
fetchServerData,
|
|
5549
5706
|
cleanup
|
|
5550
5707
|
}) {
|
|
5551
|
-
const handleServerSideChange =
|
|
5708
|
+
const handleServerSideChange = useCallback9(async () => {
|
|
5552
5709
|
if (finalPaginationMode !== "server" || !serverSide) {
|
|
5553
5710
|
return;
|
|
5554
5711
|
}
|
|
@@ -5615,7 +5772,7 @@ function useEffectiveColumnOrder({
|
|
|
5615
5772
|
}
|
|
5616
5773
|
|
|
5617
5774
|
// src/components/DataTable/hooks/useTableHandlers.ts
|
|
5618
|
-
import { useCallback as
|
|
5775
|
+
import { useCallback as useCallback10, useMemo as useMemo10 } from "react";
|
|
5619
5776
|
function useTableHandlers({
|
|
5620
5777
|
state,
|
|
5621
5778
|
stateSnapshot,
|
|
@@ -5629,15 +5786,15 @@ function useTableHandlers({
|
|
|
5629
5786
|
updateColumnOrder,
|
|
5630
5787
|
onLayoutChange
|
|
5631
5788
|
}) {
|
|
5632
|
-
const handleSortingChange =
|
|
5789
|
+
const handleSortingChange = useCallback10((updaterOrValue) => {
|
|
5633
5790
|
const nextValue = typeof updaterOrValue === "function" ? updaterOrValue(stateSnapshot.sorting) : updaterOrValue;
|
|
5634
5791
|
actions.setSorting(nextValue);
|
|
5635
5792
|
}, [actions, stateSnapshot.sorting]);
|
|
5636
|
-
const handleColumnFiltersChange =
|
|
5793
|
+
const handleColumnFiltersChange = useCallback10((updaterOrValue) => {
|
|
5637
5794
|
const nextValue = typeof updaterOrValue === "function" ? updaterOrValue(stateSnapshot.columnFilters) : updaterOrValue;
|
|
5638
5795
|
actions.setColumnFilters(nextValue);
|
|
5639
5796
|
}, [actions, stateSnapshot.columnFilters]);
|
|
5640
|
-
const handleColumnVisibilityChange =
|
|
5797
|
+
const handleColumnVisibilityChange = useCallback10((updaterOrValue) => {
|
|
5641
5798
|
const nextValue = typeof updaterOrValue === "function" ? updaterOrValue(stateSnapshot.columnVisibility) : updaterOrValue;
|
|
5642
5799
|
actions.setColumnVisibility(nextValue);
|
|
5643
5800
|
if (canPersistVisibility) {
|
|
@@ -5648,7 +5805,7 @@ function useTableHandlers({
|
|
|
5648
5805
|
columnVisibility: nextValue
|
|
5649
5806
|
});
|
|
5650
5807
|
}, [actions, stateSnapshot.columnVisibility, canPersistVisibility, updateSavedColumnVisibility, onLayoutChange, effectiveColumnOrder]);
|
|
5651
|
-
const handleRowSelectionChange =
|
|
5808
|
+
const handleRowSelectionChange = useCallback10((updaterOrValue) => {
|
|
5652
5809
|
const currentSelection = selection ?? state.rowSelection;
|
|
5653
5810
|
const nextSelection = typeof updaterOrValue === "function" ? updaterOrValue(currentSelection) : updaterOrValue;
|
|
5654
5811
|
if (selection === void 0) {
|
|
@@ -5658,19 +5815,19 @@ function useTableHandlers({
|
|
|
5658
5815
|
}
|
|
5659
5816
|
onRowSelectionChange?.(nextSelection);
|
|
5660
5817
|
}, [actions, selection, state.rowSelection, onRowSelectionChange]);
|
|
5661
|
-
const handleGroupingChange =
|
|
5818
|
+
const handleGroupingChange = useCallback10((updaterOrValue) => {
|
|
5662
5819
|
const nextValue = typeof updaterOrValue === "function" ? updaterOrValue(stateSnapshot.grouping) : updaterOrValue;
|
|
5663
5820
|
actions.setGrouping(nextValue);
|
|
5664
5821
|
}, [actions, stateSnapshot.grouping]);
|
|
5665
|
-
const handleExpandedChange =
|
|
5822
|
+
const handleExpandedChange = useCallback10((updaterOrValue) => {
|
|
5666
5823
|
const nextValue = typeof updaterOrValue === "function" ? updaterOrValue(stateSnapshot.expanded) : updaterOrValue;
|
|
5667
5824
|
actions.setExpanded(nextValue);
|
|
5668
5825
|
}, [actions, stateSnapshot.expanded]);
|
|
5669
|
-
const handlePaginationChange =
|
|
5826
|
+
const handlePaginationChange = useCallback10((updaterOrValue) => {
|
|
5670
5827
|
const nextValue = typeof updaterOrValue === "function" ? updaterOrValue(stateSnapshot.pagination) : updaterOrValue;
|
|
5671
5828
|
actions.setPagination(nextValue);
|
|
5672
5829
|
}, [actions, stateSnapshot.pagination]);
|
|
5673
|
-
const handleColumnOrderChange =
|
|
5830
|
+
const handleColumnOrderChange = useCallback10((updaterOrValue) => {
|
|
5674
5831
|
const nextValue = typeof updaterOrValue === "function" ? updaterOrValue(stateSnapshot.columnOrder) : updaterOrValue;
|
|
5675
5832
|
const normalizedOrder = nextValue.includes("select") ? ["select", ...nextValue.filter((id) => id !== "select")] : nextValue;
|
|
5676
5833
|
actions.setColumnOrder(normalizedOrder);
|
|
@@ -6040,7 +6197,7 @@ function AccessDeniedPage({
|
|
|
6040
6197
|
}
|
|
6041
6198
|
|
|
6042
6199
|
// src/components/DataTable/hooks/useDataTablePermissions.ts
|
|
6043
|
-
import { useMemo as useMemo12, useRef as
|
|
6200
|
+
import { useMemo as useMemo12, useRef as useRef7, useState as useState9, useEffect as useEffect13 } from "react";
|
|
6044
6201
|
|
|
6045
6202
|
// src/components/DataTable/types.ts
|
|
6046
6203
|
var defaultDataTableFeatures = {
|
|
@@ -6074,8 +6231,8 @@ function useDataTablePermissions(rbac, features = {}) {
|
|
|
6074
6231
|
const user = authResult.user;
|
|
6075
6232
|
const [isSuperAdminUser, setIsSuperAdminUser] = useState9(null);
|
|
6076
6233
|
const [isCheckingSuperAdmin, setIsCheckingSuperAdmin] = useState9(() => !!user?.id);
|
|
6077
|
-
const lastCheckedUserIdRef =
|
|
6078
|
-
const isCheckingRef =
|
|
6234
|
+
const lastCheckedUserIdRef = useRef7(null);
|
|
6235
|
+
const isCheckingRef = useRef7(false);
|
|
6079
6236
|
useEffect13(() => {
|
|
6080
6237
|
if (lastCheckedUserIdRef.current === user?.id && isSuperAdminUser !== null) {
|
|
6081
6238
|
return;
|
|
@@ -6138,7 +6295,7 @@ function useDataTablePermissions(rbac, features = {}) {
|
|
|
6138
6295
|
selectedOrganisationId: selectedOrganisation?.id || null,
|
|
6139
6296
|
selectedEventId: selectedEvent?.event_id || null
|
|
6140
6297
|
});
|
|
6141
|
-
const stableScopeRef =
|
|
6298
|
+
const stableScopeRef = useRef7({
|
|
6142
6299
|
organisationId: void 0,
|
|
6143
6300
|
appId: void 0,
|
|
6144
6301
|
eventId: void 0
|
|
@@ -6520,7 +6677,7 @@ function useTableColumns({
|
|
|
6520
6677
|
}
|
|
6521
6678
|
|
|
6522
6679
|
// src/components/DataTable/hooks/useKeyboardNavigation.ts
|
|
6523
|
-
import { useCallback as
|
|
6680
|
+
import { useCallback as useCallback11, useEffect as useEffect14, useRef as useRef8, useState as useState10 } from "react";
|
|
6524
6681
|
function useKeyboardNavigation(rowCount, columnCount, options = {}) {
|
|
6525
6682
|
const {
|
|
6526
6683
|
enabled = true,
|
|
@@ -6535,11 +6692,11 @@ function useKeyboardNavigation(rowCount, columnCount, options = {}) {
|
|
|
6535
6692
|
focusedColumnIndex: 0,
|
|
6536
6693
|
isNavigating: false
|
|
6537
6694
|
});
|
|
6538
|
-
const internalTableRef =
|
|
6695
|
+
const internalTableRef = useRef8(null);
|
|
6539
6696
|
const tableRef = externalTableRef || internalTableRef;
|
|
6540
|
-
const storedFocusRef =
|
|
6541
|
-
const navigationTimeoutRef =
|
|
6542
|
-
const getCellElement =
|
|
6697
|
+
const storedFocusRef = useRef8(null);
|
|
6698
|
+
const navigationTimeoutRef = useRef8(void 0);
|
|
6699
|
+
const getCellElement = useCallback11((rowIndex, columnIndex) => {
|
|
6543
6700
|
if (!tableRef.current) return null;
|
|
6544
6701
|
const tbody = tableRef.current.querySelector("tbody");
|
|
6545
6702
|
if (!tbody) return null;
|
|
@@ -6549,7 +6706,7 @@ function useKeyboardNavigation(rowCount, columnCount, options = {}) {
|
|
|
6549
6706
|
const cells = row.querySelectorAll('td[role="cell"], th[role="columnheader"]');
|
|
6550
6707
|
return cells[columnIndex] || null;
|
|
6551
6708
|
}, []);
|
|
6552
|
-
const getHeaderElement =
|
|
6709
|
+
const getHeaderElement = useCallback11((columnIndex) => {
|
|
6553
6710
|
if (!tableRef.current) return null;
|
|
6554
6711
|
const thead = tableRef.current.querySelector("thead");
|
|
6555
6712
|
if (!thead) return null;
|
|
@@ -6558,7 +6715,7 @@ function useKeyboardNavigation(rowCount, columnCount, options = {}) {
|
|
|
6558
6715
|
const headers = headerRow.querySelectorAll('th[role="columnheader"]');
|
|
6559
6716
|
return headers[columnIndex] || null;
|
|
6560
6717
|
}, []);
|
|
6561
|
-
const focusCell =
|
|
6718
|
+
const focusCell = useCallback11((rowIndex, columnIndex) => {
|
|
6562
6719
|
if (!enabled) return;
|
|
6563
6720
|
const clampedRowIndex = Math.max(0, Math.min(rowIndex, rowCount - 1));
|
|
6564
6721
|
const clampedColumnIndex = Math.max(0, Math.min(columnIndex, columnCount - 1));
|
|
@@ -6577,7 +6734,7 @@ function useKeyboardNavigation(rowCount, columnCount, options = {}) {
|
|
|
6577
6734
|
announce(`Row ${clampedRowIndex + 1}, Column ${clampedColumnIndex + 1}`);
|
|
6578
6735
|
}
|
|
6579
6736
|
}, [enabled, rowCount, columnCount, getCellElement, onFocusChange, announceNavigation]);
|
|
6580
|
-
const focusNext =
|
|
6737
|
+
const focusNext = useCallback11(() => {
|
|
6581
6738
|
const { focusedRowIndex, focusedColumnIndex } = state;
|
|
6582
6739
|
if (focusedColumnIndex < columnCount - 1) {
|
|
6583
6740
|
focusCell(focusedRowIndex, focusedColumnIndex + 1);
|
|
@@ -6585,7 +6742,7 @@ function useKeyboardNavigation(rowCount, columnCount, options = {}) {
|
|
|
6585
6742
|
focusCell(focusedRowIndex + 1, 0);
|
|
6586
6743
|
}
|
|
6587
6744
|
}, [state, columnCount, rowCount, focusCell]);
|
|
6588
|
-
const focusPrevious =
|
|
6745
|
+
const focusPrevious = useCallback11(() => {
|
|
6589
6746
|
const { focusedRowIndex, focusedColumnIndex } = state;
|
|
6590
6747
|
if (focusedColumnIndex > 0) {
|
|
6591
6748
|
focusCell(focusedRowIndex, focusedColumnIndex - 1);
|
|
@@ -6593,37 +6750,37 @@ function useKeyboardNavigation(rowCount, columnCount, options = {}) {
|
|
|
6593
6750
|
focusCell(focusedRowIndex - 1, columnCount - 1);
|
|
6594
6751
|
}
|
|
6595
6752
|
}, [state, columnCount, focusCell]);
|
|
6596
|
-
const focusUp =
|
|
6753
|
+
const focusUp = useCallback11(() => {
|
|
6597
6754
|
const { focusedRowIndex, focusedColumnIndex } = state;
|
|
6598
6755
|
if (focusedRowIndex > 0) {
|
|
6599
6756
|
focusCell(focusedRowIndex - 1, focusedColumnIndex);
|
|
6600
6757
|
}
|
|
6601
6758
|
}, [state, focusCell]);
|
|
6602
|
-
const focusDown =
|
|
6759
|
+
const focusDown = useCallback11(() => {
|
|
6603
6760
|
const { focusedRowIndex, focusedColumnIndex } = state;
|
|
6604
6761
|
if (focusedRowIndex < rowCount - 1) {
|
|
6605
6762
|
focusCell(focusedRowIndex + 1, focusedColumnIndex);
|
|
6606
6763
|
}
|
|
6607
6764
|
}, [state, rowCount, focusCell]);
|
|
6608
|
-
const focusRowStart =
|
|
6765
|
+
const focusRowStart = useCallback11(() => {
|
|
6609
6766
|
const { focusedRowIndex } = state;
|
|
6610
6767
|
focusCell(focusedRowIndex, 0);
|
|
6611
6768
|
}, [state, focusCell]);
|
|
6612
|
-
const focusRowEnd =
|
|
6769
|
+
const focusRowEnd = useCallback11(() => {
|
|
6613
6770
|
const { focusedRowIndex } = state;
|
|
6614
6771
|
focusCell(focusedRowIndex, columnCount - 1);
|
|
6615
6772
|
}, [state, columnCount, focusCell]);
|
|
6616
|
-
const focusTableStart =
|
|
6773
|
+
const focusTableStart = useCallback11(() => {
|
|
6617
6774
|
focusCell(0, 0);
|
|
6618
6775
|
}, [focusCell]);
|
|
6619
|
-
const focusTableEnd =
|
|
6776
|
+
const focusTableEnd = useCallback11(() => {
|
|
6620
6777
|
focusCell(rowCount - 1, columnCount - 1);
|
|
6621
6778
|
}, [rowCount, columnCount, focusCell]);
|
|
6622
|
-
const getCellTabIndex =
|
|
6779
|
+
const getCellTabIndex = useCallback11((rowIndex, columnIndex) => {
|
|
6623
6780
|
if (!enabled) return -1;
|
|
6624
6781
|
return state.focusedRowIndex === rowIndex && state.focusedColumnIndex === columnIndex ? 0 : -1;
|
|
6625
6782
|
}, [enabled, state.focusedRowIndex, state.focusedColumnIndex]);
|
|
6626
|
-
const getCellKeyboardHandlers =
|
|
6783
|
+
const getCellKeyboardHandlers = useCallback11((rowIndex, columnIndex) => {
|
|
6627
6784
|
const onKeyDown = (event) => {
|
|
6628
6785
|
if (!enabled) return;
|
|
6629
6786
|
switch (event.key) {
|
|
@@ -6703,7 +6860,7 @@ function useKeyboardNavigation(rowCount, columnCount, options = {}) {
|
|
|
6703
6860
|
};
|
|
6704
6861
|
return { onKeyDown, onFocus, onBlur };
|
|
6705
6862
|
}, [enabled, focusNext, focusPrevious, focusUp, focusDown, focusRowStart, focusRowEnd, focusTableStart, focusTableEnd, onFocusChange]);
|
|
6706
|
-
const getHeaderKeyboardHandlers =
|
|
6863
|
+
const getHeaderKeyboardHandlers = useCallback11((columnIndex, onSort) => {
|
|
6707
6864
|
const onKeyDown = (event) => {
|
|
6708
6865
|
if (!enabled) return;
|
|
6709
6866
|
switch (event.key) {
|
|
@@ -6761,20 +6918,20 @@ function useKeyboardNavigation(rowCount, columnCount, options = {}) {
|
|
|
6761
6918
|
};
|
|
6762
6919
|
return { onKeyDown, onFocus };
|
|
6763
6920
|
}, [enabled, getHeaderElement, columnCount, supportsColumnReorder, supportsColumnResize]);
|
|
6764
|
-
const resetFocus =
|
|
6921
|
+
const resetFocus = useCallback11(() => {
|
|
6765
6922
|
setState({
|
|
6766
6923
|
focusedRowIndex: 0,
|
|
6767
6924
|
focusedColumnIndex: 0,
|
|
6768
6925
|
isNavigating: false
|
|
6769
6926
|
});
|
|
6770
6927
|
}, []);
|
|
6771
|
-
const storeFocus =
|
|
6928
|
+
const storeFocus = useCallback11(() => {
|
|
6772
6929
|
storedFocusRef.current = {
|
|
6773
6930
|
rowIndex: state.focusedRowIndex,
|
|
6774
6931
|
columnIndex: state.focusedColumnIndex
|
|
6775
6932
|
};
|
|
6776
6933
|
}, [state.focusedRowIndex, state.focusedColumnIndex]);
|
|
6777
|
-
const restoreFocus =
|
|
6934
|
+
const restoreFocus = useCallback11(() => {
|
|
6778
6935
|
if (storedFocusRef.current) {
|
|
6779
6936
|
const { rowIndex, columnIndex } = storedFocusRef.current;
|
|
6780
6937
|
focusCell(rowIndex, columnIndex);
|
|
@@ -6900,10 +7057,10 @@ function usePermissionTracking({
|
|
|
6900
7057
|
}
|
|
6901
7058
|
|
|
6902
7059
|
// src/components/DataTable/components/hooks/useImportModalFocus.ts
|
|
6903
|
-
import { useEffect as useEffect15, useRef as
|
|
7060
|
+
import { useEffect as useEffect15, useRef as useRef9 } from "react";
|
|
6904
7061
|
function useImportModalFocus(isImportOpen, keyboardNavigation) {
|
|
6905
|
-
const lastFocusedElementRef =
|
|
6906
|
-
const wasImportModalOpenRef =
|
|
7062
|
+
const lastFocusedElementRef = useRef9(null);
|
|
7063
|
+
const wasImportModalOpenRef = useRef9(false);
|
|
6907
7064
|
useEffect15(() => {
|
|
6908
7065
|
if (isImportOpen) {
|
|
6909
7066
|
wasImportModalOpenRef.current = true;
|
|
@@ -7061,11 +7218,11 @@ function DataTableInternal(props) {
|
|
|
7061
7218
|
initializeLiveRegion();
|
|
7062
7219
|
}, []);
|
|
7063
7220
|
const rowSelection = selection !== void 0 ? selection : state.rowSelection;
|
|
7064
|
-
const resolvedGetRowId =
|
|
7221
|
+
const resolvedGetRowId = useCallback12(
|
|
7065
7222
|
(row, index) => getRowIdSafe(row, index, getRowId),
|
|
7066
7223
|
[getRowId]
|
|
7067
7224
|
);
|
|
7068
|
-
const hasInitializedExpansion =
|
|
7225
|
+
const hasInitializedExpansion = useRef10(false);
|
|
7069
7226
|
useEffect16(() => {
|
|
7070
7227
|
if (!hasInitializedExpansion.current && defaultGrouping && defaultGrouping.length > 0) {
|
|
7071
7228
|
stateActions.setExpanded(true);
|
|
@@ -7215,7 +7372,7 @@ function DataTableInternal(props) {
|
|
|
7215
7372
|
() => externalIsLoading || performanceLoading,
|
|
7216
7373
|
[externalIsLoading, performanceLoading]
|
|
7217
7374
|
);
|
|
7218
|
-
const handleSearch =
|
|
7375
|
+
const handleSearch = useCallback12((value) => {
|
|
7219
7376
|
stateActions.setSearchQuery(value);
|
|
7220
7377
|
setSearchQuery(value);
|
|
7221
7378
|
if (secureFeatures.pagination) {
|
|
@@ -7693,9 +7850,8 @@ export {
|
|
|
7693
7850
|
Dialog,
|
|
7694
7851
|
DialogTrigger,
|
|
7695
7852
|
DialogPortal,
|
|
7696
|
-
DialogClose,
|
|
7697
|
-
DialogOverlay,
|
|
7698
7853
|
DialogContent,
|
|
7854
|
+
DialogClose,
|
|
7699
7855
|
DialogHeader,
|
|
7700
7856
|
DialogBody,
|
|
7701
7857
|
DialogFooter,
|
|
@@ -7790,4 +7946,4 @@ export {
|
|
|
7790
7946
|
min,
|
|
7791
7947
|
max
|
|
7792
7948
|
};
|
|
7793
|
-
//# sourceMappingURL=chunk-
|
|
7949
|
+
//# sourceMappingURL=chunk-IVOFDYWT.js.map
|