@chekinapp/ui 0.0.25 → 0.0.28
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/index.cjs +329 -177
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +53 -7
- package/dist/index.d.ts +53 -7
- package/dist/index.js +257 -109
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2518,12 +2518,76 @@ function usePagination(config) {
|
|
|
2518
2518
|
};
|
|
2519
2519
|
}
|
|
2520
2520
|
|
|
2521
|
+
// src/hooks/use-copy-to-clipboard.ts
|
|
2522
|
+
import { useEffect as useEffect13, useRef as useRef8, useState as useState10 } from "react";
|
|
2523
|
+
|
|
2524
|
+
// src/lib/copy-to-clipboard.ts
|
|
2525
|
+
function copyToClipboardFallback(value) {
|
|
2526
|
+
const targetDocument = getDocument();
|
|
2527
|
+
const targetBody = targetDocument.body;
|
|
2528
|
+
if (!targetBody) {
|
|
2529
|
+
return;
|
|
2530
|
+
}
|
|
2531
|
+
const el = targetDocument.createElement("textarea");
|
|
2532
|
+
el.value = value;
|
|
2533
|
+
el.setAttribute("readonly", "");
|
|
2534
|
+
el.style.position = "fixed";
|
|
2535
|
+
el.style.opacity = "0";
|
|
2536
|
+
el.style.pointerEvents = "none";
|
|
2537
|
+
el.style.left = "-9999px";
|
|
2538
|
+
targetBody.appendChild(el);
|
|
2539
|
+
el.focus();
|
|
2540
|
+
el.select();
|
|
2541
|
+
targetDocument.execCommand("copy");
|
|
2542
|
+
targetBody.removeChild(el);
|
|
2543
|
+
}
|
|
2544
|
+
function copyToClipboard2(value) {
|
|
2545
|
+
const text = typeof value === "number" ? value.toString() : value;
|
|
2546
|
+
const targetDocument = getDocument();
|
|
2547
|
+
const clipboard = targetDocument.defaultView?.navigator?.clipboard ?? globalThis.navigator?.clipboard;
|
|
2548
|
+
if (!clipboard?.writeText) {
|
|
2549
|
+
copyToClipboardFallback(text);
|
|
2550
|
+
return;
|
|
2551
|
+
}
|
|
2552
|
+
void clipboard.writeText(text).catch(() => {
|
|
2553
|
+
copyToClipboardFallback(text);
|
|
2554
|
+
});
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2557
|
+
// src/hooks/use-copy-to-clipboard.ts
|
|
2558
|
+
var COPIED_TIMEOUT_S = 1.5;
|
|
2559
|
+
function useCopyToClipboard({ value, onCopiedLink, onReset }) {
|
|
2560
|
+
const [isCopied, setIsLinkCopied] = useState10(false);
|
|
2561
|
+
const timeoutRef = useRef8();
|
|
2562
|
+
useEffect13(() => {
|
|
2563
|
+
return () => {
|
|
2564
|
+
if (timeoutRef.current) {
|
|
2565
|
+
clearTimeout(timeoutRef.current);
|
|
2566
|
+
}
|
|
2567
|
+
};
|
|
2568
|
+
}, []);
|
|
2569
|
+
const copy = () => {
|
|
2570
|
+
if (!value) return;
|
|
2571
|
+
if (timeoutRef.current) {
|
|
2572
|
+
clearTimeout(timeoutRef.current);
|
|
2573
|
+
}
|
|
2574
|
+
copyToClipboard2(value);
|
|
2575
|
+
setIsLinkCopied(true);
|
|
2576
|
+
timeoutRef.current = setTimeout(() => {
|
|
2577
|
+
setIsLinkCopied(false);
|
|
2578
|
+
onReset?.();
|
|
2579
|
+
}, COPIED_TIMEOUT_S * 1e3);
|
|
2580
|
+
onCopiedLink?.();
|
|
2581
|
+
};
|
|
2582
|
+
return { isCopied, copy };
|
|
2583
|
+
}
|
|
2584
|
+
|
|
2521
2585
|
// src/hooks/use-timer.ts
|
|
2522
|
-
import { useEffect as
|
|
2586
|
+
import { useEffect as useEffect14, useState as useState11 } from "react";
|
|
2523
2587
|
var useTimer = ({ seconds }) => {
|
|
2524
|
-
const [timeLeft, setTimeLeft] =
|
|
2525
|
-
const [isTimerRunning, setIsTimerRunning] =
|
|
2526
|
-
|
|
2588
|
+
const [timeLeft, setTimeLeft] = useState11(seconds);
|
|
2589
|
+
const [isTimerRunning, setIsTimerRunning] = useState11(true);
|
|
2590
|
+
useEffect14(() => {
|
|
2527
2591
|
if (!isTimerRunning) return;
|
|
2528
2592
|
const timer = setInterval(() => {
|
|
2529
2593
|
setTimeLeft((prev) => {
|
|
@@ -2549,32 +2613,46 @@ var useTimer = ({ seconds }) => {
|
|
|
2549
2613
|
};
|
|
2550
2614
|
|
|
2551
2615
|
// src/hooks/use-timeout.ts
|
|
2552
|
-
import {
|
|
2553
|
-
function useTimeout() {
|
|
2554
|
-
const
|
|
2555
|
-
const
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2616
|
+
import { useEffect as useEffect15, useMemo as useMemo2, useRef as useRef9 } from "react";
|
|
2617
|
+
function useTimeout(callback, ms = 0) {
|
|
2618
|
+
const timeoutId = useRef9();
|
|
2619
|
+
const memoizedCallback = useEvent(callback);
|
|
2620
|
+
const handler = useMemo2(() => {
|
|
2621
|
+
return {
|
|
2622
|
+
start(overrideMs) {
|
|
2623
|
+
handler.stop();
|
|
2624
|
+
timeoutId.current = setTimeout(
|
|
2625
|
+
memoizedCallback,
|
|
2626
|
+
overrideMs === void 0 ? ms : overrideMs
|
|
2627
|
+
);
|
|
2628
|
+
},
|
|
2629
|
+
stop() {
|
|
2630
|
+
if (timeoutId.current) {
|
|
2631
|
+
clearTimeout(timeoutId.current);
|
|
2632
|
+
}
|
|
2633
|
+
},
|
|
2634
|
+
restart() {
|
|
2635
|
+
handler.stop();
|
|
2636
|
+
handler.start();
|
|
2637
|
+
}
|
|
2638
|
+
};
|
|
2639
|
+
}, [memoizedCallback, ms]);
|
|
2640
|
+
useEffect15(() => {
|
|
2641
|
+
return () => {
|
|
2642
|
+
handler.stop();
|
|
2643
|
+
};
|
|
2644
|
+
}, [handler]);
|
|
2645
|
+
return handler;
|
|
2568
2646
|
}
|
|
2569
2647
|
|
|
2570
2648
|
// src/hooks/use-hover.ts
|
|
2571
|
-
import { useCallback as
|
|
2649
|
+
import { useCallback as useCallback9, useState as useState12 } from "react";
|
|
2572
2650
|
function useHover() {
|
|
2573
|
-
const [isHovering, setIsHovering] =
|
|
2574
|
-
const handleMouseEnter =
|
|
2651
|
+
const [isHovering, setIsHovering] = useState12(false);
|
|
2652
|
+
const handleMouseEnter = useCallback9(() => {
|
|
2575
2653
|
setIsHovering(true);
|
|
2576
2654
|
}, []);
|
|
2577
|
-
const handleMouseLeave =
|
|
2655
|
+
const handleMouseLeave = useCallback9(() => {
|
|
2578
2656
|
setIsHovering(false);
|
|
2579
2657
|
}, []);
|
|
2580
2658
|
return {
|
|
@@ -2584,11 +2662,60 @@ function useHover() {
|
|
|
2584
2662
|
};
|
|
2585
2663
|
}
|
|
2586
2664
|
|
|
2665
|
+
// src/hooks/use-key-down.ts
|
|
2666
|
+
import { useCallback as useCallback10, useEffect as useEffect16 } from "react";
|
|
2667
|
+
function useKeyDown(key, cb, options) {
|
|
2668
|
+
const {
|
|
2669
|
+
enabled = true,
|
|
2670
|
+
metaKey = false,
|
|
2671
|
+
ctrlKey = false,
|
|
2672
|
+
shiftKey = false,
|
|
2673
|
+
altKey = false
|
|
2674
|
+
} = options ?? {};
|
|
2675
|
+
const handleCallback = useEvent(cb);
|
|
2676
|
+
const handleKeyDown = useCallback10(
|
|
2677
|
+
(event) => {
|
|
2678
|
+
const keys = Array.isArray(key) ? key : [key];
|
|
2679
|
+
const isKeyMatch = keys.includes(event.key);
|
|
2680
|
+
const isModifierMatch = event.metaKey === metaKey && event.ctrlKey === ctrlKey && event.shiftKey === shiftKey && event.altKey === altKey;
|
|
2681
|
+
if (isKeyMatch && isModifierMatch) {
|
|
2682
|
+
handleCallback(event);
|
|
2683
|
+
}
|
|
2684
|
+
},
|
|
2685
|
+
[key, handleCallback, metaKey, ctrlKey, shiftKey, altKey]
|
|
2686
|
+
);
|
|
2687
|
+
useEffect16(() => {
|
|
2688
|
+
if (!enabled) return;
|
|
2689
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
2690
|
+
return () => {
|
|
2691
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
2692
|
+
};
|
|
2693
|
+
}, [handleKeyDown, enabled]);
|
|
2694
|
+
}
|
|
2695
|
+
|
|
2696
|
+
// src/hooks/use-reset-after-request-status.ts
|
|
2697
|
+
import { useEffect as useEffect17, useRef as useRef10 } from "react";
|
|
2698
|
+
var ResetStatusTimeoutMs = 2e3;
|
|
2699
|
+
function useResetAfterRequestStatus({ status, reset }) {
|
|
2700
|
+
const stateTimeoutRef = useRef10();
|
|
2701
|
+
const handleReset = useEvent(reset);
|
|
2702
|
+
const isNotIdle = ["success", "error"].includes(status);
|
|
2703
|
+
useEffect17(() => {
|
|
2704
|
+
if (isNotIdle) {
|
|
2705
|
+
stateTimeoutRef.current = setTimeout(handleReset, ResetStatusTimeoutMs);
|
|
2706
|
+
return () => {
|
|
2707
|
+
clearTimeout(stateTimeoutRef.current);
|
|
2708
|
+
};
|
|
2709
|
+
}
|
|
2710
|
+
}, [handleReset, isNotIdle]);
|
|
2711
|
+
return { isNotIdle };
|
|
2712
|
+
}
|
|
2713
|
+
|
|
2587
2714
|
// src/hooks/use-promised-modal-controls.ts
|
|
2588
|
-
import { useRef as
|
|
2715
|
+
import { useRef as useRef11 } from "react";
|
|
2589
2716
|
var usePromisedModalControls = () => {
|
|
2590
2717
|
const { closeModal, isOpen, openModal } = useModalControls();
|
|
2591
|
-
const resolveRef =
|
|
2718
|
+
const resolveRef = useRef11();
|
|
2592
2719
|
const openModalWithPromise = async () => {
|
|
2593
2720
|
openModal();
|
|
2594
2721
|
return new Promise((resolve) => {
|
|
@@ -2603,6 +2730,56 @@ var usePromisedModalControls = () => {
|
|
|
2603
2730
|
};
|
|
2604
2731
|
};
|
|
2605
2732
|
|
|
2733
|
+
// src/hooks/use-is-form-touched.ts
|
|
2734
|
+
import { useState as useState13 } from "react";
|
|
2735
|
+
function useIsFormTouched({
|
|
2736
|
+
watch,
|
|
2737
|
+
displayFields,
|
|
2738
|
+
debug,
|
|
2739
|
+
defaultValues
|
|
2740
|
+
}) {
|
|
2741
|
+
const [untouchedValues, setUntouchedValues] = useState13(defaultValues || {});
|
|
2742
|
+
const getIsFormTouched = () => {
|
|
2743
|
+
if (!Object.keys(untouchedValues)) {
|
|
2744
|
+
return false;
|
|
2745
|
+
}
|
|
2746
|
+
return Object.keys(untouchedValues).some((field) => {
|
|
2747
|
+
if (!displayFields[field] || watch(field) === void 0) {
|
|
2748
|
+
return false;
|
|
2749
|
+
}
|
|
2750
|
+
if (watch(field)?.value && untouchedValues[field]?.value) {
|
|
2751
|
+
if (debug) {
|
|
2752
|
+
console.log({
|
|
2753
|
+
res: untouchedValues[field]?.value !== watch(field)?.value,
|
|
2754
|
+
[field]: { form: watch(field), untouched: untouchedValues[field] }
|
|
2755
|
+
});
|
|
2756
|
+
}
|
|
2757
|
+
return untouchedValues[field]?.value !== watch(field)?.value;
|
|
2758
|
+
}
|
|
2759
|
+
if (watch(field) instanceof Array || watch(field) instanceof Object) {
|
|
2760
|
+
if (debug) {
|
|
2761
|
+
console.log({
|
|
2762
|
+
res: JSON.stringify(untouchedValues[field]) !== JSON.stringify(watch(field)),
|
|
2763
|
+
[field]: { form: watch(field), untouched: untouchedValues[field] }
|
|
2764
|
+
});
|
|
2765
|
+
}
|
|
2766
|
+
return JSON.stringify(untouchedValues[field]) !== JSON.stringify(watch(field));
|
|
2767
|
+
}
|
|
2768
|
+
if (debug) {
|
|
2769
|
+
console.log({
|
|
2770
|
+
res: untouchedValues[field] !== watch(field),
|
|
2771
|
+
[field]: { form: watch(field), untouched: untouchedValues[field] }
|
|
2772
|
+
});
|
|
2773
|
+
}
|
|
2774
|
+
return untouchedValues[field] !== watch(field);
|
|
2775
|
+
});
|
|
2776
|
+
};
|
|
2777
|
+
return {
|
|
2778
|
+
setUntouchedValues,
|
|
2779
|
+
isFormTouched: getIsFormTouched()
|
|
2780
|
+
};
|
|
2781
|
+
}
|
|
2782
|
+
|
|
2606
2783
|
// src/dialog/Dialog.tsx
|
|
2607
2784
|
import { jsx as jsx29, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2608
2785
|
function useIframeTitleFix(titleRef) {
|
|
@@ -2838,7 +3015,7 @@ function DownloadEntryFormsButton({
|
|
|
2838
3015
|
}
|
|
2839
3016
|
|
|
2840
3017
|
// src/dropdown-button/DropdownButton.tsx
|
|
2841
|
-
import { useState as
|
|
3018
|
+
import { useState as useState14 } from "react";
|
|
2842
3019
|
|
|
2843
3020
|
// src/dropdown-menu/DropdownMenu.tsx
|
|
2844
3021
|
import * as React13 from "react";
|
|
@@ -2902,7 +3079,7 @@ function DropdownButton({
|
|
|
2902
3079
|
modal,
|
|
2903
3080
|
className
|
|
2904
3081
|
}) {
|
|
2905
|
-
const [isOpen, setIsOpen] =
|
|
3082
|
+
const [isOpen, setIsOpen] = useState14(false);
|
|
2906
3083
|
return /* @__PURE__ */ jsxs25(DropdownMenu, { onOpenChange: setIsOpen, modal, children: [
|
|
2907
3084
|
/* @__PURE__ */ jsx34(DropdownMenuTrigger, { asChild: true, children: typeof trigger === "function" ? trigger(isOpen) : trigger }),
|
|
2908
3085
|
/* @__PURE__ */ jsx34(
|
|
@@ -3240,7 +3417,7 @@ var Switch = React15.forwardRef(
|
|
|
3240
3417
|
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
3241
3418
|
|
|
3242
3419
|
// src/video-player/VideoPlayer.tsx
|
|
3243
|
-
import { useEffect as
|
|
3420
|
+
import { useEffect as useEffect19, useRef as useRef13, useState as useState15 } from "react";
|
|
3244
3421
|
import { useTranslation as useTranslation8 } from "react-i18next";
|
|
3245
3422
|
import {
|
|
3246
3423
|
Loader2,
|
|
@@ -3264,20 +3441,20 @@ function VideoPlayer({
|
|
|
3264
3441
|
autoPlay = false
|
|
3265
3442
|
}) {
|
|
3266
3443
|
const { t } = useTranslation8();
|
|
3267
|
-
const videoRef =
|
|
3268
|
-
const iframeRef =
|
|
3269
|
-
const containerRef =
|
|
3270
|
-
const [isPlaying, setIsPlaying] =
|
|
3271
|
-
const [isMuted, setIsMuted] =
|
|
3272
|
-
const [currentTime, setCurrentTime] =
|
|
3273
|
-
const [duration, setDuration] =
|
|
3274
|
-
const [isFullScreenMode, setIsFullScreenMode] =
|
|
3275
|
-
const [isLoading, setIsLoading] =
|
|
3276
|
-
const [videoSource, setVideoSource] =
|
|
3277
|
-
const [youtubeEmbedUrl, setYoutubeEmbedUrl] =
|
|
3278
|
-
const [vimeoEmbedUrl, setVimeoEmbedUrl] =
|
|
3444
|
+
const videoRef = useRef13(null);
|
|
3445
|
+
const iframeRef = useRef13(null);
|
|
3446
|
+
const containerRef = useRef13(null);
|
|
3447
|
+
const [isPlaying, setIsPlaying] = useState15(false);
|
|
3448
|
+
const [isMuted, setIsMuted] = useState15(false);
|
|
3449
|
+
const [currentTime, setCurrentTime] = useState15(0);
|
|
3450
|
+
const [duration, setDuration] = useState15(0);
|
|
3451
|
+
const [isFullScreenMode, setIsFullScreenMode] = useState15(isFullScreen);
|
|
3452
|
+
const [isLoading, setIsLoading] = useState15(true);
|
|
3453
|
+
const [videoSource, setVideoSource] = useState15("file");
|
|
3454
|
+
const [youtubeEmbedUrl, setYoutubeEmbedUrl] = useState15("");
|
|
3455
|
+
const [vimeoEmbedUrl, setVimeoEmbedUrl] = useState15("");
|
|
3279
3456
|
useClickEscape({ enabled: isFullScreenMode, onClick: onClose });
|
|
3280
|
-
|
|
3457
|
+
useEffect19(() => {
|
|
3281
3458
|
const youtubeRegex = /(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/;
|
|
3282
3459
|
const vimeoRegex = /(?:vimeo\.com\/|vimeo\.com\/video\/)(\d+)/;
|
|
3283
3460
|
const youtubeMatch = src.match(youtubeRegex);
|
|
@@ -3306,7 +3483,7 @@ function VideoPlayer({
|
|
|
3306
3483
|
setYoutubeEmbedUrl("");
|
|
3307
3484
|
setVimeoEmbedUrl("");
|
|
3308
3485
|
}, [src, autoPlay]);
|
|
3309
|
-
|
|
3486
|
+
useEffect19(() => {
|
|
3310
3487
|
if (videoSource !== "file") return;
|
|
3311
3488
|
const video = videoRef.current;
|
|
3312
3489
|
if (!video) return;
|
|
@@ -3334,7 +3511,7 @@ function VideoPlayer({
|
|
|
3334
3511
|
video.removeEventListener("canplay", handleCanPlay);
|
|
3335
3512
|
};
|
|
3336
3513
|
}, [videoSource]);
|
|
3337
|
-
|
|
3514
|
+
useEffect19(() => {
|
|
3338
3515
|
if (isFullScreenMode && videoRef.current && videoSource === "file") {
|
|
3339
3516
|
void videoRef.current.play();
|
|
3340
3517
|
setIsPlaying(true);
|
|
@@ -3712,7 +3889,7 @@ var FormBox = {
|
|
|
3712
3889
|
import {
|
|
3713
3890
|
forwardRef as forwardRef20,
|
|
3714
3891
|
useId as useId4,
|
|
3715
|
-
useState as
|
|
3892
|
+
useState as useState16
|
|
3716
3893
|
} from "react";
|
|
3717
3894
|
import { useTranslation as useTranslation10 } from "react-i18next";
|
|
3718
3895
|
|
|
@@ -3744,8 +3921,8 @@ var FreeTextField = forwardRef20(
|
|
|
3744
3921
|
}, ref) => {
|
|
3745
3922
|
const { t } = useTranslation10();
|
|
3746
3923
|
const inputId = useId4();
|
|
3747
|
-
const [internalValue, setInternalValue] =
|
|
3748
|
-
const [isFocused, setIsFocused] =
|
|
3924
|
+
const [internalValue, setInternalValue] = useState16(defaultValue ?? "");
|
|
3925
|
+
const [isFocused, setIsFocused] = useState16(false);
|
|
3749
3926
|
const currentValue = value !== void 0 ? value : internalValue;
|
|
3750
3927
|
const isEmpty = !currentValue || String(currentValue).length === 0;
|
|
3751
3928
|
const hasError = Boolean(error);
|
|
@@ -4077,7 +4254,7 @@ function InfoBox({ className, children }) {
|
|
|
4077
4254
|
}
|
|
4078
4255
|
|
|
4079
4256
|
// src/image/Image.tsx
|
|
4080
|
-
import { useState as
|
|
4257
|
+
import { useState as useState17 } from "react";
|
|
4081
4258
|
import { jsx as jsx59 } from "react/jsx-runtime";
|
|
4082
4259
|
function Image2({
|
|
4083
4260
|
src,
|
|
@@ -4086,7 +4263,7 @@ function Image2({
|
|
|
4086
4263
|
fallbackSrc = "https://placehold.co/600x400?text=Image",
|
|
4087
4264
|
...props
|
|
4088
4265
|
}) {
|
|
4089
|
-
const [error, setError] =
|
|
4266
|
+
const [error, setError] = useState17(false);
|
|
4090
4267
|
return /* @__PURE__ */ jsx59(
|
|
4091
4268
|
"img",
|
|
4092
4269
|
{
|
|
@@ -4145,7 +4322,7 @@ function extractDigits(str) {
|
|
|
4145
4322
|
}
|
|
4146
4323
|
|
|
4147
4324
|
// src/input-otp/useInputOTP.ts
|
|
4148
|
-
import { useCallback as useCallback12, useEffect as
|
|
4325
|
+
import { useCallback as useCallback12, useEffect as useEffect20, useMemo as useMemo3, useRef as useRef14, useState as useState18 } from "react";
|
|
4149
4326
|
function useInputOTP({
|
|
4150
4327
|
maxLength,
|
|
4151
4328
|
value,
|
|
@@ -4154,12 +4331,12 @@ function useInputOTP({
|
|
|
4154
4331
|
autoFocus,
|
|
4155
4332
|
error
|
|
4156
4333
|
}) {
|
|
4157
|
-
const [activeIndex, setActiveIndex] =
|
|
4158
|
-
const inputRefs =
|
|
4159
|
-
const containerRef =
|
|
4160
|
-
const blurTimeoutRef =
|
|
4161
|
-
const slotsRef =
|
|
4162
|
-
const slots =
|
|
4334
|
+
const [activeIndex, setActiveIndex] = useState18(-1);
|
|
4335
|
+
const inputRefs = useRef14([]);
|
|
4336
|
+
const containerRef = useRef14(null);
|
|
4337
|
+
const blurTimeoutRef = useRef14();
|
|
4338
|
+
const slotsRef = useRef14(Array.from({ length: maxLength }, () => ""));
|
|
4339
|
+
const slots = useMemo3(() => {
|
|
4163
4340
|
const nextSlots = Array.from({ length: maxLength }, () => "");
|
|
4164
4341
|
for (let index = 0; index < Math.min(value.length, maxLength); index += 1) {
|
|
4165
4342
|
const char = value[index];
|
|
@@ -4191,7 +4368,7 @@ function useInputOTP({
|
|
|
4191
4368
|
},
|
|
4192
4369
|
[onChange]
|
|
4193
4370
|
);
|
|
4194
|
-
|
|
4371
|
+
useEffect20(() => {
|
|
4195
4372
|
if (autoFocus && inputRefs.current[0]) {
|
|
4196
4373
|
inputRefs.current[0].focus();
|
|
4197
4374
|
}
|
|
@@ -4212,7 +4389,7 @@ function useInputOTP({
|
|
|
4212
4389
|
}
|
|
4213
4390
|
}, 0);
|
|
4214
4391
|
}, []);
|
|
4215
|
-
|
|
4392
|
+
useEffect20(() => () => clearTimeout(blurTimeoutRef.current), []);
|
|
4216
4393
|
const handleDigitInput = useCallback12(
|
|
4217
4394
|
(index, digit) => {
|
|
4218
4395
|
if (!DIGIT_REGEX.test(digit)) return;
|
|
@@ -4258,7 +4435,7 @@ function useInputOTP({
|
|
|
4258
4435
|
},
|
|
4259
4436
|
[maxLength, emitValue]
|
|
4260
4437
|
);
|
|
4261
|
-
const contextValue =
|
|
4438
|
+
const contextValue = useMemo3(
|
|
4262
4439
|
() => ({
|
|
4263
4440
|
slots,
|
|
4264
4441
|
activeIndex,
|
|
@@ -4471,7 +4648,7 @@ var InputOTPSeparator = React19.forwardRef(
|
|
|
4471
4648
|
InputOTPSeparator.displayName = "InputOTPSeparator";
|
|
4472
4649
|
|
|
4473
4650
|
// src/icons-dropdown/IconsDropdown.tsx
|
|
4474
|
-
import { useState as
|
|
4651
|
+
import { useState as useState19 } from "react";
|
|
4475
4652
|
import { jsx as jsx62, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
4476
4653
|
function IconsDropdown({
|
|
4477
4654
|
icons,
|
|
@@ -4483,7 +4660,7 @@ function IconsDropdown({
|
|
|
4483
4660
|
defaultOpen,
|
|
4484
4661
|
onOpenChange: onOpenChangeProp
|
|
4485
4662
|
}) {
|
|
4486
|
-
const [open, setOpen] =
|
|
4663
|
+
const [open, setOpen] = useState19(defaultOpen ?? false);
|
|
4487
4664
|
function handleOpenChange(value) {
|
|
4488
4665
|
setOpen(value);
|
|
4489
4666
|
onOpenChangeProp?.(value);
|
|
@@ -5090,14 +5267,14 @@ LinkInternal.displayName = "Link";
|
|
|
5090
5267
|
var Link = memo3(LinkInternal);
|
|
5091
5268
|
|
|
5092
5269
|
// src/image-full-screen-view/ImageFullScreenView.tsx
|
|
5093
|
-
import { useState as
|
|
5270
|
+
import { useState as useState20 } from "react";
|
|
5094
5271
|
import { RotateCw, X as X4, ZoomIn, ZoomOut } from "lucide-react";
|
|
5095
5272
|
import { useTranslation as useTranslation13 } from "react-i18next";
|
|
5096
5273
|
import { jsx as jsx67, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
5097
5274
|
function ImageFullScreenView({ src, alt, onClose }) {
|
|
5098
5275
|
const { t } = useTranslation13();
|
|
5099
|
-
const [scale, setScale] =
|
|
5100
|
-
const [rotation, setRotation] =
|
|
5276
|
+
const [scale, setScale] = useState20(1);
|
|
5277
|
+
const [rotation, setRotation] = useState20(0);
|
|
5101
5278
|
useClickEscape({ onClick: onClose });
|
|
5102
5279
|
const zoomIn = () => setScale((value) => Math.min(value + 0.25, 3));
|
|
5103
5280
|
const zoomOut = () => setScale((value) => Math.max(value - 0.25, 0.5));
|
|
@@ -5295,7 +5472,7 @@ var METRIC_CARD_VARIANTS = {
|
|
|
5295
5472
|
};
|
|
5296
5473
|
|
|
5297
5474
|
// src/modal/Modal.tsx
|
|
5298
|
-
import { forwardRef as forwardRef28, useRef as
|
|
5475
|
+
import { forwardRef as forwardRef28, useRef as useRef15 } from "react";
|
|
5299
5476
|
import { X as X5 } from "lucide-react";
|
|
5300
5477
|
|
|
5301
5478
|
// src/modal/styles.module.css
|
|
@@ -5326,7 +5503,7 @@ function Modal({
|
|
|
5326
5503
|
container,
|
|
5327
5504
|
modal
|
|
5328
5505
|
}) {
|
|
5329
|
-
const contentRef =
|
|
5506
|
+
const contentRef = useRef15(null);
|
|
5330
5507
|
useScrollFrameIntoView(open, { elementRef: contentRef });
|
|
5331
5508
|
const handleClose = () => {
|
|
5332
5509
|
onOpenChange?.(false);
|
|
@@ -5807,10 +5984,10 @@ var RadioGroupItem = React22.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
5807
5984
|
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
5808
5985
|
|
|
5809
5986
|
// src/radio/useRadioOptions.ts
|
|
5810
|
-
import { useCallback as useCallback14, useState as
|
|
5987
|
+
import { useCallback as useCallback14, useState as useState21 } from "react";
|
|
5811
5988
|
function useRadioOptions({ options, defaultValue, onChange }) {
|
|
5812
5989
|
const initialValue = (typeof defaultValue === "string" ? options.find((option) => option.value === defaultValue) : defaultValue) || "";
|
|
5813
|
-
const [selectedValue, setSelectedValue] =
|
|
5990
|
+
const [selectedValue, setSelectedValue] = useState21(initialValue);
|
|
5814
5991
|
const handleValueChange = useCallback14(
|
|
5815
5992
|
(value) => {
|
|
5816
5993
|
setSelectedValue(value);
|
|
@@ -6315,7 +6492,7 @@ import {
|
|
|
6315
6492
|
cloneElement as cloneElement2,
|
|
6316
6493
|
forwardRef as forwardRef34,
|
|
6317
6494
|
isValidElement as isValidElement2,
|
|
6318
|
-
useEffect as
|
|
6495
|
+
useEffect as useEffect21
|
|
6319
6496
|
} from "react";
|
|
6320
6497
|
|
|
6321
6498
|
// src/selector-button/styles.module.css
|
|
@@ -6434,7 +6611,7 @@ function SelectorsInternal({
|
|
|
6434
6611
|
}
|
|
6435
6612
|
};
|
|
6436
6613
|
const isAnyActive = getValueArray(value).length > 0;
|
|
6437
|
-
|
|
6614
|
+
useEffect21(() => {
|
|
6438
6615
|
onAnySelectorActive?.(isAnyActive);
|
|
6439
6616
|
}, [isAnyActive, onAnySelectorActive]);
|
|
6440
6617
|
return /* @__PURE__ */ jsxs56(Fragment8, { children: [
|
|
@@ -7492,7 +7669,7 @@ function SortingAction({
|
|
|
7492
7669
|
}
|
|
7493
7670
|
|
|
7494
7671
|
// src/status-button/StatusButton.tsx
|
|
7495
|
-
import { useMemo as
|
|
7672
|
+
import { useMemo as useMemo5 } from "react";
|
|
7496
7673
|
import { useTranslation as useTranslation20 } from "react-i18next";
|
|
7497
7674
|
import { AlertCircle as AlertCircle2, CheckCircle, Loader2 as Loader24 } from "lucide-react";
|
|
7498
7675
|
import { jsx as jsx98, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
@@ -7510,7 +7687,7 @@ function StatusButton({
|
|
|
7510
7687
|
...props
|
|
7511
7688
|
}) {
|
|
7512
7689
|
const { t } = useTranslation20();
|
|
7513
|
-
const configMap =
|
|
7690
|
+
const configMap = useMemo5(() => {
|
|
7514
7691
|
const defaultLoadingConfig = {
|
|
7515
7692
|
text: loadingText ?? `${t("saving")}...`,
|
|
7516
7693
|
icon: /* @__PURE__ */ jsx98(Loader24, { className: "h-4 w-4 animate-spin" }),
|
|
@@ -7912,10 +8089,10 @@ var TASK_VARIANTS = {
|
|
|
7912
8089
|
import { Toaster, toast as toast2 } from "sonner";
|
|
7913
8090
|
|
|
7914
8091
|
// src/toaster/useUpdateToast.ts
|
|
7915
|
-
import { useCallback as useCallback16, useRef as
|
|
8092
|
+
import { useCallback as useCallback16, useRef as useRef17 } from "react";
|
|
7916
8093
|
import { toast } from "sonner";
|
|
7917
8094
|
function useUpdateToast({ id }) {
|
|
7918
|
-
const toastIdRef =
|
|
8095
|
+
const toastIdRef = useRef17("");
|
|
7919
8096
|
const getToastOptions = useCallback16(
|
|
7920
8097
|
(options) => ({
|
|
7921
8098
|
id: toastIdRef.current,
|
|
@@ -8031,7 +8208,7 @@ var ToggleGroupItem = React27.forwardRef(({ className, children, variant, size,
|
|
|
8031
8208
|
ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
|
|
8032
8209
|
|
|
8033
8210
|
// src/toggle-group/Toggles.tsx
|
|
8034
|
-
import { forwardRef as forwardRef40, useEffect as
|
|
8211
|
+
import { forwardRef as forwardRef40, useEffect as useEffect23 } from "react";
|
|
8035
8212
|
import { jsx as jsx108, jsxs as jsxs69 } from "react/jsx-runtime";
|
|
8036
8213
|
var getValueArray2 = (value) => {
|
|
8037
8214
|
if (value) {
|
|
@@ -8106,7 +8283,7 @@ function TogglesInternal({
|
|
|
8106
8283
|
}
|
|
8107
8284
|
};
|
|
8108
8285
|
const isAnyActive = getValueArray2(value).length > 0;
|
|
8109
|
-
|
|
8286
|
+
useEffect23(() => {
|
|
8110
8287
|
onAnySelectorActive?.(isAnyActive);
|
|
8111
8288
|
}, [isAnyActive, onAnySelectorActive]);
|
|
8112
8289
|
const currentValue = getValueArray2(value).map((item) => String(item));
|
|
@@ -11693,39 +11870,6 @@ function getNextEnabledIndex(options, startIndex, step) {
|
|
|
11693
11870
|
}
|
|
11694
11871
|
return -1;
|
|
11695
11872
|
}
|
|
11696
|
-
|
|
11697
|
-
// src/lib/copy-to-clipboard.ts
|
|
11698
|
-
function copyToClipboardFallback(value) {
|
|
11699
|
-
const targetDocument = getDocument();
|
|
11700
|
-
const targetBody = targetDocument.body;
|
|
11701
|
-
if (!targetBody) {
|
|
11702
|
-
return;
|
|
11703
|
-
}
|
|
11704
|
-
const el = targetDocument.createElement("textarea");
|
|
11705
|
-
el.value = value;
|
|
11706
|
-
el.setAttribute("readonly", "");
|
|
11707
|
-
el.style.position = "fixed";
|
|
11708
|
-
el.style.opacity = "0";
|
|
11709
|
-
el.style.pointerEvents = "none";
|
|
11710
|
-
el.style.left = "-9999px";
|
|
11711
|
-
targetBody.appendChild(el);
|
|
11712
|
-
el.focus();
|
|
11713
|
-
el.select();
|
|
11714
|
-
targetDocument.execCommand("copy");
|
|
11715
|
-
targetBody.removeChild(el);
|
|
11716
|
-
}
|
|
11717
|
-
function copyToClipboard2(value) {
|
|
11718
|
-
const text = typeof value === "number" ? value.toString() : value;
|
|
11719
|
-
const targetDocument = getDocument();
|
|
11720
|
-
const clipboard = targetDocument.defaultView?.navigator?.clipboard ?? globalThis.navigator?.clipboard;
|
|
11721
|
-
if (!clipboard?.writeText) {
|
|
11722
|
-
copyToClipboardFallback(text);
|
|
11723
|
-
return;
|
|
11724
|
-
}
|
|
11725
|
-
void clipboard.writeText(text).catch(() => {
|
|
11726
|
-
copyToClipboardFallback(text);
|
|
11727
|
-
});
|
|
11728
|
-
}
|
|
11729
11873
|
export {
|
|
11730
11874
|
Accordion,
|
|
11731
11875
|
AccordionContent,
|
|
@@ -11994,18 +12138,22 @@ export {
|
|
|
11994
12138
|
useAbortController,
|
|
11995
12139
|
useClickEscape,
|
|
11996
12140
|
useCombinedRef,
|
|
12141
|
+
useCopyToClipboard,
|
|
11997
12142
|
useDebounce,
|
|
11998
12143
|
useDebouncedFunction,
|
|
11999
12144
|
useEvent,
|
|
12000
12145
|
useHover,
|
|
12146
|
+
useIsFormTouched,
|
|
12001
12147
|
useIsMobile,
|
|
12002
12148
|
useIsMounted,
|
|
12149
|
+
useKeyDown,
|
|
12003
12150
|
useModalControls,
|
|
12004
12151
|
useOutsideClick,
|
|
12005
12152
|
usePagination,
|
|
12006
12153
|
usePrevious,
|
|
12007
12154
|
usePromisedModalControls,
|
|
12008
12155
|
useRadioOptions,
|
|
12156
|
+
useResetAfterRequestStatus,
|
|
12009
12157
|
useScreenResize,
|
|
12010
12158
|
useScrollFrameIntoView,
|
|
12011
12159
|
useScrollToTop,
|