@chekinapp/ui 0.0.23 → 0.0.24

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.js CHANGED
@@ -2059,29 +2059,42 @@ function useAbortController() {
2059
2059
  }
2060
2060
 
2061
2061
  // src/hooks/use-click-escape.ts
2062
- import { useEffect as useEffect5, useRef as useRef3 } from "react";
2062
+ import { useEffect as useEffect5 } from "react";
2063
+
2064
+ // src/hooks/use-event.ts
2065
+ import { useCallback as useCallback2, useLayoutEffect, useRef as useRef3 } from "react";
2066
+ function useEvent(fn) {
2067
+ const fnRef = useRef3(fn);
2068
+ useLayoutEffect(() => {
2069
+ fnRef.current = fn;
2070
+ }, [fn]);
2071
+ const eventCb = useCallback2(
2072
+ (...args) => {
2073
+ return fnRef.current?.apply(null, args);
2074
+ },
2075
+ [fnRef]
2076
+ );
2077
+ return eventCb;
2078
+ }
2079
+
2080
+ // src/hooks/use-click-escape.ts
2063
2081
  function useClickEscape({ enabled = true, onClick }) {
2064
- const onClickRef = useRef3(onClick);
2065
- useEffect5(() => {
2066
- onClickRef.current = onClick;
2067
- }, [onClick]);
2082
+ const handler = useEvent(onClick);
2068
2083
  useEffect5(() => {
2069
2084
  const handleKeyDown = (event) => {
2070
2085
  if (event.key === "Escape" && enabled) {
2071
- onClickRef.current?.();
2086
+ handler();
2072
2087
  }
2073
2088
  };
2074
2089
  window.addEventListener("keydown", handleKeyDown);
2075
- return () => {
2076
- window.removeEventListener("keydown", handleKeyDown);
2077
- };
2078
- }, [enabled]);
2090
+ return () => window.removeEventListener("keydown", handleKeyDown);
2091
+ }, [handler, enabled]);
2079
2092
  }
2080
2093
 
2081
2094
  // src/hooks/use-combined-ref.ts
2082
- import { useCallback as useCallback2 } from "react";
2095
+ import { useCallback as useCallback3 } from "react";
2083
2096
  function useCombinedRef(...refs) {
2084
- return useCallback2(
2097
+ return useCallback3(
2085
2098
  (node) => {
2086
2099
  refs.forEach((ref) => {
2087
2100
  if (!ref) return;
@@ -2097,22 +2110,6 @@ function useCombinedRef(...refs) {
2097
2110
  );
2098
2111
  }
2099
2112
 
2100
- // src/hooks/use-event.ts
2101
- import { useCallback as useCallback3, useLayoutEffect, useRef as useRef4 } from "react";
2102
- function useEvent(fn) {
2103
- const fnRef = useRef4(fn);
2104
- useLayoutEffect(() => {
2105
- fnRef.current = fn;
2106
- }, [fn]);
2107
- const eventCb = useCallback3(
2108
- (...args) => {
2109
- return fnRef.current?.apply(null, args);
2110
- },
2111
- [fnRef]
2112
- );
2113
- return eventCb;
2114
- }
2115
-
2116
2113
  // src/hooks/use-is-mobile.ts
2117
2114
  import { useEffect as useEffect6, useState as useState5 } from "react";
2118
2115
  var MOBILE_BREAKPOINT = 768;
@@ -2133,9 +2130,9 @@ function useIsMobile({ breakpoint = MOBILE_BREAKPOINT } = {}) {
2133
2130
  }
2134
2131
 
2135
2132
  // src/hooks/use-is-mounted.ts
2136
- import { useEffect as useEffect7, useRef as useRef5 } from "react";
2133
+ import { useEffect as useEffect7, useRef as useRef4 } from "react";
2137
2134
  function useIsMounted() {
2138
- const isMounted = useRef5(false);
2135
+ const isMounted = useRef4(false);
2139
2136
  useEffect7(() => {
2140
2137
  isMounted.current = true;
2141
2138
  return () => {
@@ -2171,9 +2168,9 @@ function useModalControls(initState = false, { disabled } = {}) {
2171
2168
  }
2172
2169
 
2173
2170
  // src/hooks/use-outside-click.ts
2174
- import { useCallback as useCallback5, useEffect as useEffect8, useRef as useRef6 } from "react";
2171
+ import { useCallback as useCallback5, useEffect as useEffect8, useRef as useRef5 } from "react";
2175
2172
  function useOutsideClick(elementRef, onOutsideClick, nested) {
2176
- const handleOutsideClick = useRef6(onOutsideClick);
2173
+ const handleOutsideClick = useRef5(onOutsideClick);
2177
2174
  handleOutsideClick.current = onOutsideClick;
2178
2175
  const checkNestedElements = useCallback5(
2179
2176
  (event) => {
@@ -2309,6 +2306,33 @@ function useDebounce(value, delayMs = 1e3, handleChange) {
2309
2306
  return [debouncedValue, setDebouncedValue];
2310
2307
  }
2311
2308
 
2309
+ // src/hooks/use-debounced-function.ts
2310
+ import { useCallback as useCallback7, useRef as useRef6 } from "react";
2311
+ function useDebouncedFunction(callback, delay) {
2312
+ const timerRef = useRef6();
2313
+ const immediateCalling = useRef6(false);
2314
+ const callbackFn = useEvent(callback);
2315
+ const throttled = useCallback7(
2316
+ (...args) => {
2317
+ clearTimeout(timerRef.current);
2318
+ if (immediateCalling.current) {
2319
+ immediateCalling.current = false;
2320
+ callbackFn?.(...args);
2321
+ } else {
2322
+ timerRef.current = setTimeout(() => {
2323
+ immediateCalling.current = false;
2324
+ callbackFn?.(...args);
2325
+ }, delay);
2326
+ }
2327
+ },
2328
+ [callbackFn, delay]
2329
+ );
2330
+ const immediate = useCallback7(() => {
2331
+ immediateCalling.current = true;
2332
+ }, []);
2333
+ return { throttled, immediate };
2334
+ }
2335
+
2312
2336
  // src/hooks/use-previous.ts
2313
2337
  import { useEffect as useEffect11, useRef as useRef7 } from "react";
2314
2338
  function usePrevious(value, defaultValue) {
@@ -2319,12 +2343,187 @@ function usePrevious(value, defaultValue) {
2319
2343
  return ref.current;
2320
2344
  }
2321
2345
 
2346
+ // src/hooks/use-pagination.ts
2347
+ import { useCallback as useCallback8, useEffect as useEffect12, useMemo, useState as useState9 } from "react";
2348
+
2349
+ // src/storage/AbstractStorage.ts
2350
+ var AbstractStorage = class {
2351
+ static get(key) {
2352
+ if (!key) {
2353
+ throw new Error("The key is not valid");
2354
+ }
2355
+ return null;
2356
+ }
2357
+ static set(key, value) {
2358
+ if (!key) {
2359
+ throw new Error("The key is not valid");
2360
+ }
2361
+ if (!value) {
2362
+ throw new Error("The value not passed");
2363
+ }
2364
+ }
2365
+ static remove(key) {
2366
+ if (!key) {
2367
+ throw new Error("The key is not valid");
2368
+ }
2369
+ }
2370
+ static clear() {
2371
+ }
2372
+ };
2373
+ var AbstractStorage_default = AbstractStorage;
2374
+
2375
+ // src/storage/utils.ts
2376
+ function jsonParse(data) {
2377
+ try {
2378
+ if (data) {
2379
+ return JSON.parse(data);
2380
+ }
2381
+ return null;
2382
+ } catch {
2383
+ return data;
2384
+ }
2385
+ }
2386
+
2387
+ // src/storage/SessionStorage.ts
2388
+ var SessionStorage = class _SessionStorage extends AbstractStorage_default {
2389
+ static get(key) {
2390
+ const data = sessionStorage.getItem(key);
2391
+ return jsonParse(data);
2392
+ }
2393
+ static set(key, value) {
2394
+ if (value) {
2395
+ sessionStorage.setItem(key, JSON.stringify(value));
2396
+ }
2397
+ }
2398
+ static update(key, field, value) {
2399
+ const data = _SessionStorage.get(key);
2400
+ if (data) {
2401
+ data[field] = value;
2402
+ _SessionStorage.set(key, data);
2403
+ } else {
2404
+ _SessionStorage.set(key, { [field]: value });
2405
+ }
2406
+ }
2407
+ static remove(key) {
2408
+ sessionStorage.removeItem(key);
2409
+ }
2410
+ static clear() {
2411
+ sessionStorage.clear();
2412
+ }
2413
+ };
2414
+
2415
+ // src/hooks/use-pagination.ts
2416
+ var DEFAULT_PAGE_SIZE = 20;
2417
+ var DEFAULT_PAGE = 1;
2418
+ function usePagination(config) {
2419
+ const { key, defaultPageSize = DEFAULT_PAGE_SIZE, defaultPage = DEFAULT_PAGE } = config;
2420
+ const [state, setState] = useState9(() => {
2421
+ const stored = SessionStorage.get(`pagination-${key}`);
2422
+ if (stored) {
2423
+ return {
2424
+ page: stored.page || defaultPage,
2425
+ pageSize: stored.pageSize || defaultPageSize,
2426
+ totalItems: stored.totalItems || 0
2427
+ };
2428
+ }
2429
+ return {
2430
+ page: defaultPage,
2431
+ pageSize: defaultPageSize,
2432
+ totalItems: 0
2433
+ };
2434
+ });
2435
+ useEffect12(() => {
2436
+ SessionStorage.set(`pagination-${key}`, state);
2437
+ }, [key, state]);
2438
+ const pages = useMemo(() => {
2439
+ return state.totalItems > 0 ? Math.ceil(state.totalItems / state.pageSize) : 0;
2440
+ }, [state.totalItems, state.pageSize]);
2441
+ const hasNextPage = useMemo(() => state.page < pages, [state.page, pages]);
2442
+ const hasPreviousPage = useMemo(() => state.page > 1, [state.page]);
2443
+ const startItem = useMemo(() => {
2444
+ return state.totalItems === 0 ? 0 : (state.page - 1) * state.pageSize + 1;
2445
+ }, [state.page, state.pageSize, state.totalItems]);
2446
+ const endItem = useMemo(() => {
2447
+ return Math.min(state.page * state.pageSize, state.totalItems);
2448
+ }, [state.page, state.pageSize, state.totalItems]);
2449
+ const isEmpty = useMemo(() => state.totalItems === 0, [state.totalItems]);
2450
+ const setPage = useCallback8(
2451
+ (page) => {
2452
+ const clampedPage = Math.max(1, Math.min(page, pages || 1));
2453
+ setState((prev) => ({ ...prev, page: clampedPage }));
2454
+ },
2455
+ [pages]
2456
+ );
2457
+ const setPageSize = useCallback8((pageSize) => {
2458
+ const validPageSize = Math.max(1, pageSize);
2459
+ setState((prev) => {
2460
+ const currentFirstItem = (prev.page - 1) * prev.pageSize + 1;
2461
+ const newPage = Math.max(1, Math.ceil(currentFirstItem / validPageSize));
2462
+ return {
2463
+ ...prev,
2464
+ pageSize: validPageSize,
2465
+ page: newPage
2466
+ };
2467
+ });
2468
+ }, []);
2469
+ const setTotalItems = useCallback8((totalItems) => {
2470
+ const validTotalItems = Math.max(0, totalItems);
2471
+ setState((prev) => {
2472
+ const newPages = validTotalItems > 0 ? Math.ceil(validTotalItems / prev.pageSize) : 0;
2473
+ const clampedPage = prev.page > newPages && newPages > 0 ? newPages : prev.page;
2474
+ return {
2475
+ ...prev,
2476
+ totalItems: validTotalItems,
2477
+ page: clampedPage
2478
+ };
2479
+ });
2480
+ }, []);
2481
+ const nextPage = useCallback8(() => {
2482
+ setPage(state.page + 1);
2483
+ }, [setPage, state.page]);
2484
+ const previousPage = useCallback8(() => {
2485
+ setPage(state.page - 1);
2486
+ }, [setPage, state.page]);
2487
+ const goToFirstPage = useCallback8(() => {
2488
+ setPage(1);
2489
+ }, [setPage]);
2490
+ const goToLastPage = useCallback8(() => {
2491
+ setPage(pages);
2492
+ }, [setPage, pages]);
2493
+ const reset = useCallback8(() => {
2494
+ setState({
2495
+ page: defaultPage,
2496
+ pageSize: defaultPageSize,
2497
+ totalItems: 0
2498
+ });
2499
+ }, [defaultPage, defaultPageSize]);
2500
+ return {
2501
+ page: state.page,
2502
+ pageSize: state.pageSize,
2503
+ totalItems: state.totalItems,
2504
+ pages,
2505
+ setPage,
2506
+ setPageSize,
2507
+ setTotalItems,
2508
+ nextPage,
2509
+ previousPage,
2510
+ goToFirstPage,
2511
+ goToLastPage,
2512
+ reset,
2513
+ hasNextPage,
2514
+ hasPreviousPage,
2515
+ startItem,
2516
+ endItem,
2517
+ isEmpty
2518
+ };
2519
+ }
2520
+
2322
2521
  // src/hooks/use-timer.ts
2323
- import { useEffect as useEffect12, useState as useState9 } from "react";
2522
+ import { useEffect as useEffect13, useState as useState10 } from "react";
2324
2523
  var useTimer = ({ seconds }) => {
2325
- const [timeLeft, setTimeLeft] = useState9(seconds);
2326
- const [isTimerRunning, setIsTimerRunning] = useState9(true);
2327
- useEffect12(() => {
2524
+ const [timeLeft, setTimeLeft] = useState10(seconds);
2525
+ const [isTimerRunning, setIsTimerRunning] = useState10(true);
2526
+ useEffect13(() => {
2328
2527
  if (!isTimerRunning) return;
2329
2528
  const timer = setInterval(() => {
2330
2529
  setTimeLeft((prev) => {
@@ -2350,32 +2549,32 @@ var useTimer = ({ seconds }) => {
2350
2549
  };
2351
2550
 
2352
2551
  // src/hooks/use-timeout.ts
2353
- import { useCallback as useCallback7, useEffect as useEffect13, useRef as useRef8 } from "react";
2552
+ import { useCallback as useCallback9, useEffect as useEffect14, useRef as useRef8 } from "react";
2354
2553
  function useTimeout() {
2355
2554
  const timeoutRef = useRef8();
2356
- const clearTimeoutRef = useCallback7(() => {
2555
+ const clearTimeoutRef = useCallback9(() => {
2357
2556
  clearTimeout(timeoutRef.current);
2358
2557
  timeoutRef.current = void 0;
2359
2558
  }, []);
2360
- const scheduleTimeout = useCallback7(
2559
+ const scheduleTimeout = useCallback9(
2361
2560
  (callback, delay) => {
2362
2561
  clearTimeoutRef();
2363
2562
  timeoutRef.current = setTimeout(callback, delay);
2364
2563
  },
2365
2564
  [clearTimeoutRef]
2366
2565
  );
2367
- useEffect13(() => clearTimeoutRef, [clearTimeoutRef]);
2566
+ useEffect14(() => clearTimeoutRef, [clearTimeoutRef]);
2368
2567
  return { scheduleTimeout, clearTimeoutRef };
2369
2568
  }
2370
2569
 
2371
2570
  // src/hooks/use-hover.ts
2372
- import { useCallback as useCallback8, useState as useState10 } from "react";
2571
+ import { useCallback as useCallback10, useState as useState11 } from "react";
2373
2572
  function useHover() {
2374
- const [isHovering, setIsHovering] = useState10(false);
2375
- const handleMouseEnter = useCallback8(() => {
2573
+ const [isHovering, setIsHovering] = useState11(false);
2574
+ const handleMouseEnter = useCallback10(() => {
2376
2575
  setIsHovering(true);
2377
2576
  }, []);
2378
- const handleMouseLeave = useCallback8(() => {
2577
+ const handleMouseLeave = useCallback10(() => {
2379
2578
  setIsHovering(false);
2380
2579
  }, []);
2381
2580
  return {
@@ -2620,7 +2819,7 @@ function DownloadEntryFormsButton({
2620
2819
  }
2621
2820
 
2622
2821
  // src/dropdown-button/DropdownButton.tsx
2623
- import { useState as useState11 } from "react";
2822
+ import { useState as useState12 } from "react";
2624
2823
 
2625
2824
  // src/dropdown-menu/DropdownMenu.tsx
2626
2825
  import * as React13 from "react";
@@ -2684,7 +2883,7 @@ function DropdownButton({
2684
2883
  modal,
2685
2884
  className
2686
2885
  }) {
2687
- const [isOpen, setIsOpen] = useState11(false);
2886
+ const [isOpen, setIsOpen] = useState12(false);
2688
2887
  return /* @__PURE__ */ jsxs25(DropdownMenu, { onOpenChange: setIsOpen, modal, children: [
2689
2888
  /* @__PURE__ */ jsx34(DropdownMenuTrigger, { asChild: true, children: typeof trigger === "function" ? trigger(isOpen) : trigger }),
2690
2889
  /* @__PURE__ */ jsx34(
@@ -3022,7 +3221,7 @@ var Switch = React15.forwardRef(
3022
3221
  Switch.displayName = SwitchPrimitives.Root.displayName;
3023
3222
 
3024
3223
  // src/video-player/VideoPlayer.tsx
3025
- import { useEffect as useEffect15, useRef as useRef10, useState as useState12 } from "react";
3224
+ import { useEffect as useEffect16, useRef as useRef10, useState as useState13 } from "react";
3026
3225
  import { useTranslation as useTranslation8 } from "react-i18next";
3027
3226
  import {
3028
3227
  Loader2,
@@ -3049,17 +3248,17 @@ function VideoPlayer({
3049
3248
  const videoRef = useRef10(null);
3050
3249
  const iframeRef = useRef10(null);
3051
3250
  const containerRef = useRef10(null);
3052
- const [isPlaying, setIsPlaying] = useState12(false);
3053
- const [isMuted, setIsMuted] = useState12(false);
3054
- const [currentTime, setCurrentTime] = useState12(0);
3055
- const [duration, setDuration] = useState12(0);
3056
- const [isFullScreenMode, setIsFullScreenMode] = useState12(isFullScreen);
3057
- const [isLoading, setIsLoading] = useState12(true);
3058
- const [videoSource, setVideoSource] = useState12("file");
3059
- const [youtubeEmbedUrl, setYoutubeEmbedUrl] = useState12("");
3060
- const [vimeoEmbedUrl, setVimeoEmbedUrl] = useState12("");
3251
+ const [isPlaying, setIsPlaying] = useState13(false);
3252
+ const [isMuted, setIsMuted] = useState13(false);
3253
+ const [currentTime, setCurrentTime] = useState13(0);
3254
+ const [duration, setDuration] = useState13(0);
3255
+ const [isFullScreenMode, setIsFullScreenMode] = useState13(isFullScreen);
3256
+ const [isLoading, setIsLoading] = useState13(true);
3257
+ const [videoSource, setVideoSource] = useState13("file");
3258
+ const [youtubeEmbedUrl, setYoutubeEmbedUrl] = useState13("");
3259
+ const [vimeoEmbedUrl, setVimeoEmbedUrl] = useState13("");
3061
3260
  useClickEscape({ enabled: isFullScreenMode, onClick: onClose });
3062
- useEffect15(() => {
3261
+ useEffect16(() => {
3063
3262
  const youtubeRegex = /(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/;
3064
3263
  const vimeoRegex = /(?:vimeo\.com\/|vimeo\.com\/video\/)(\d+)/;
3065
3264
  const youtubeMatch = src.match(youtubeRegex);
@@ -3088,7 +3287,7 @@ function VideoPlayer({
3088
3287
  setYoutubeEmbedUrl("");
3089
3288
  setVimeoEmbedUrl("");
3090
3289
  }, [src, autoPlay]);
3091
- useEffect15(() => {
3290
+ useEffect16(() => {
3092
3291
  if (videoSource !== "file") return;
3093
3292
  const video = videoRef.current;
3094
3293
  if (!video) return;
@@ -3116,7 +3315,7 @@ function VideoPlayer({
3116
3315
  video.removeEventListener("canplay", handleCanPlay);
3117
3316
  };
3118
3317
  }, [videoSource]);
3119
- useEffect15(() => {
3318
+ useEffect16(() => {
3120
3319
  if (isFullScreenMode && videoRef.current && videoSource === "file") {
3121
3320
  void videoRef.current.play();
3122
3321
  setIsPlaying(true);
@@ -3395,7 +3594,7 @@ function FeatureCard({
3395
3594
  // src/file-input-button/FileInputButton.tsx
3396
3595
  import {
3397
3596
  forwardRef as forwardRef19,
3398
- useCallback as useCallback9
3597
+ useCallback as useCallback11
3399
3598
  } from "react";
3400
3599
  import { Upload } from "lucide-react";
3401
3600
  import { jsx as jsx47, jsxs as jsxs31 } from "react/jsx-runtime";
@@ -3411,7 +3610,7 @@ var FileInputButton = forwardRef19(
3411
3610
  size = "default",
3412
3611
  ...props
3413
3612
  }, ref) => {
3414
- const handleChange = useCallback9(
3613
+ const handleChange = useCallback11(
3415
3614
  (event) => {
3416
3615
  onChange?.(event);
3417
3616
  event.target.value = "";
@@ -3494,7 +3693,7 @@ var FormBox = {
3494
3693
  import {
3495
3694
  forwardRef as forwardRef20,
3496
3695
  useId as useId4,
3497
- useState as useState13
3696
+ useState as useState14
3498
3697
  } from "react";
3499
3698
  import { useTranslation as useTranslation10 } from "react-i18next";
3500
3699
 
@@ -3526,8 +3725,8 @@ var FreeTextField = forwardRef20(
3526
3725
  }, ref) => {
3527
3726
  const { t } = useTranslation10();
3528
3727
  const inputId = useId4();
3529
- const [internalValue, setInternalValue] = useState13(defaultValue ?? "");
3530
- const [isFocused, setIsFocused] = useState13(false);
3728
+ const [internalValue, setInternalValue] = useState14(defaultValue ?? "");
3729
+ const [isFocused, setIsFocused] = useState14(false);
3531
3730
  const currentValue = value !== void 0 ? value : internalValue;
3532
3731
  const isEmpty = !currentValue || String(currentValue).length === 0;
3533
3732
  const hasError = Boolean(error);
@@ -3859,7 +4058,7 @@ function InfoBox({ className, children }) {
3859
4058
  }
3860
4059
 
3861
4060
  // src/image/Image.tsx
3862
- import { useState as useState14 } from "react";
4061
+ import { useState as useState15 } from "react";
3863
4062
  import { jsx as jsx59 } from "react/jsx-runtime";
3864
4063
  function Image2({
3865
4064
  src,
@@ -3868,7 +4067,7 @@ function Image2({
3868
4067
  fallbackSrc = "https://placehold.co/600x400?text=Image",
3869
4068
  ...props
3870
4069
  }) {
3871
- const [error, setError] = useState14(false);
4070
+ const [error, setError] = useState15(false);
3872
4071
  return /* @__PURE__ */ jsx59(
3873
4072
  "img",
3874
4073
  {
@@ -3927,7 +4126,7 @@ function extractDigits(str) {
3927
4126
  }
3928
4127
 
3929
4128
  // src/input-otp/useInputOTP.ts
3930
- import { useCallback as useCallback10, useEffect as useEffect16, useMemo, useRef as useRef11, useState as useState15 } from "react";
4129
+ import { useCallback as useCallback12, useEffect as useEffect17, useMemo as useMemo2, useRef as useRef11, useState as useState16 } from "react";
3931
4130
  function useInputOTP({
3932
4131
  maxLength,
3933
4132
  value,
@@ -3936,12 +4135,12 @@ function useInputOTP({
3936
4135
  autoFocus,
3937
4136
  error
3938
4137
  }) {
3939
- const [activeIndex, setActiveIndex] = useState15(-1);
4138
+ const [activeIndex, setActiveIndex] = useState16(-1);
3940
4139
  const inputRefs = useRef11([]);
3941
4140
  const containerRef = useRef11(null);
3942
4141
  const blurTimeoutRef = useRef11();
3943
4142
  const slotsRef = useRef11(Array.from({ length: maxLength }, () => ""));
3944
- const slots = useMemo(() => {
4143
+ const slots = useMemo2(() => {
3945
4144
  const nextSlots = Array.from({ length: maxLength }, () => "");
3946
4145
  for (let index = 0; index < Math.min(value.length, maxLength); index += 1) {
3947
4146
  const char = value[index];
@@ -3952,7 +4151,7 @@ function useInputOTP({
3952
4151
  return nextSlots;
3953
4152
  }, [value, maxLength]);
3954
4153
  slotsRef.current = slots;
3955
- const emitValue = useCallback10(
4154
+ const emitValue = useCallback12(
3956
4155
  (newSlots) => {
3957
4156
  let lastFilledIndex = -1;
3958
4157
  for (let index = newSlots.length - 1; index >= 0; index -= 1) {
@@ -3973,12 +4172,12 @@ function useInputOTP({
3973
4172
  },
3974
4173
  [onChange]
3975
4174
  );
3976
- useEffect16(() => {
4175
+ useEffect17(() => {
3977
4176
  if (autoFocus && inputRefs.current[0]) {
3978
4177
  inputRefs.current[0].focus();
3979
4178
  }
3980
4179
  }, [autoFocus]);
3981
- const handleContainerFocusIn = useCallback10((event) => {
4180
+ const handleContainerFocusIn = useCallback12((event) => {
3982
4181
  clearTimeout(blurTimeoutRef.current);
3983
4182
  const target = event.target;
3984
4183
  const slotIndex = inputRefs.current.indexOf(target);
@@ -3986,7 +4185,7 @@ function useInputOTP({
3986
4185
  setActiveIndex(slotIndex);
3987
4186
  }
3988
4187
  }, []);
3989
- const handleContainerFocusOut = useCallback10(() => {
4188
+ const handleContainerFocusOut = useCallback12(() => {
3990
4189
  clearTimeout(blurTimeoutRef.current);
3991
4190
  blurTimeoutRef.current = setTimeout(() => {
3992
4191
  if (!containerRef.current?.contains(document.activeElement)) {
@@ -3994,8 +4193,8 @@ function useInputOTP({
3994
4193
  }
3995
4194
  }, 0);
3996
4195
  }, []);
3997
- useEffect16(() => () => clearTimeout(blurTimeoutRef.current), []);
3998
- const handleDigitInput = useCallback10(
4196
+ useEffect17(() => () => clearTimeout(blurTimeoutRef.current), []);
4197
+ const handleDigitInput = useCallback12(
3999
4198
  (index, digit) => {
4000
4199
  if (!DIGIT_REGEX.test(digit)) return;
4001
4200
  const newSlots = [...slotsRef.current];
@@ -4009,7 +4208,7 @@ function useInputOTP({
4009
4208
  },
4010
4209
  [maxLength, emitValue]
4011
4210
  );
4012
- const handleDelete = useCallback10(
4211
+ const handleDelete = useCallback12(
4013
4212
  (index) => {
4014
4213
  const newSlots = [...slotsRef.current];
4015
4214
  if (newSlots[index]) {
@@ -4024,7 +4223,7 @@ function useInputOTP({
4024
4223
  },
4025
4224
  [emitValue]
4026
4225
  );
4027
- const handlePaste = useCallback10(
4226
+ const handlePaste = useCallback12(
4028
4227
  (text) => {
4029
4228
  const digits = extractDigits(text).slice(0, maxLength);
4030
4229
  if (digits.length > 0) {
@@ -4040,7 +4239,7 @@ function useInputOTP({
4040
4239
  },
4041
4240
  [maxLength, emitValue]
4042
4241
  );
4043
- const contextValue = useMemo(
4242
+ const contextValue = useMemo2(
4044
4243
  () => ({
4045
4244
  slots,
4046
4245
  activeIndex,
@@ -4074,7 +4273,7 @@ function useInputOTP({
4074
4273
 
4075
4274
  // src/input-otp/useInputOTPSlot.ts
4076
4275
  import {
4077
- useCallback as useCallback11
4276
+ useCallback as useCallback13
4078
4277
  } from "react";
4079
4278
  function useInputOTPSlot(index) {
4080
4279
  const {
@@ -4145,13 +4344,13 @@ function useInputOTPSlot(index) {
4145
4344
  event.preventDefault();
4146
4345
  handlePaste(event.clipboardData.getData("text/plain"));
4147
4346
  };
4148
- const setInputRef = useCallback11(
4347
+ const setInputRef = useCallback13(
4149
4348
  (element) => {
4150
4349
  inputRefs.current[index] = element;
4151
4350
  },
4152
4351
  [index, inputRefs]
4153
4352
  );
4154
- const focusSlot = useCallback11(() => {
4353
+ const focusSlot = useCallback13(() => {
4155
4354
  inputRefs.current[index]?.focus();
4156
4355
  }, [index, inputRefs]);
4157
4356
  return {
@@ -4253,7 +4452,7 @@ var InputOTPSeparator = React19.forwardRef(
4253
4452
  InputOTPSeparator.displayName = "InputOTPSeparator";
4254
4453
 
4255
4454
  // src/icons-dropdown/IconsDropdown.tsx
4256
- import { useState as useState16 } from "react";
4455
+ import { useState as useState17 } from "react";
4257
4456
  import { jsx as jsx62, jsxs as jsxs36 } from "react/jsx-runtime";
4258
4457
  function IconsDropdown({
4259
4458
  icons,
@@ -4265,7 +4464,7 @@ function IconsDropdown({
4265
4464
  defaultOpen,
4266
4465
  onOpenChange: onOpenChangeProp
4267
4466
  }) {
4268
- const [open, setOpen] = useState16(defaultOpen ?? false);
4467
+ const [open, setOpen] = useState17(defaultOpen ?? false);
4269
4468
  function handleOpenChange(value) {
4270
4469
  setOpen(value);
4271
4470
  onOpenChangeProp?.(value);
@@ -4872,14 +5071,14 @@ LinkInternal.displayName = "Link";
4872
5071
  var Link = memo3(LinkInternal);
4873
5072
 
4874
5073
  // src/image-full-screen-view/ImageFullScreenView.tsx
4875
- import { useState as useState17 } from "react";
5074
+ import { useState as useState18 } from "react";
4876
5075
  import { RotateCw, X as X4, ZoomIn, ZoomOut } from "lucide-react";
4877
5076
  import { useTranslation as useTranslation13 } from "react-i18next";
4878
5077
  import { jsx as jsx67, jsxs as jsxs40 } from "react/jsx-runtime";
4879
5078
  function ImageFullScreenView({ src, alt, onClose }) {
4880
5079
  const { t } = useTranslation13();
4881
- const [scale, setScale] = useState17(1);
4882
- const [rotation, setRotation] = useState17(0);
5080
+ const [scale, setScale] = useState18(1);
5081
+ const [rotation, setRotation] = useState18(0);
4883
5082
  useClickEscape({ onClick: onClose });
4884
5083
  const zoomIn = () => setScale((value) => Math.min(value + 0.25, 3));
4885
5084
  const zoomOut = () => setScale((value) => Math.max(value - 0.25, 0.5));
@@ -5589,11 +5788,11 @@ var RadioGroupItem = React22.forwardRef(({ className, ...props }, ref) => /* @__
5589
5788
  RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
5590
5789
 
5591
5790
  // src/radio/useRadioOptions.ts
5592
- import { useCallback as useCallback12, useState as useState18 } from "react";
5791
+ import { useCallback as useCallback14, useState as useState19 } from "react";
5593
5792
  function useRadioOptions({ options, defaultValue, onChange }) {
5594
5793
  const initialValue = (typeof defaultValue === "string" ? options.find((option) => option.value === defaultValue) : defaultValue) || "";
5595
- const [selectedValue, setSelectedValue] = useState18(initialValue);
5596
- const handleValueChange = useCallback12(
5794
+ const [selectedValue, setSelectedValue] = useState19(initialValue);
5795
+ const handleValueChange = useCallback14(
5597
5796
  (value) => {
5598
5797
  setSelectedValue(value);
5599
5798
  const selectedOption = options.find((option) => option.value === value) || "";
@@ -6097,7 +6296,7 @@ import {
6097
6296
  cloneElement as cloneElement2,
6098
6297
  forwardRef as forwardRef34,
6099
6298
  isValidElement as isValidElement2,
6100
- useEffect as useEffect17
6299
+ useEffect as useEffect18
6101
6300
  } from "react";
6102
6301
 
6103
6302
  // src/selector-button/styles.module.css
@@ -6216,7 +6415,7 @@ function SelectorsInternal({
6216
6415
  }
6217
6416
  };
6218
6417
  const isAnyActive = getValueArray(value).length > 0;
6219
- useEffect17(() => {
6418
+ useEffect18(() => {
6220
6419
  onAnySelectorActive?.(isAnyActive);
6221
6420
  }, [isAnyActive, onAnySelectorActive]);
6222
6421
  return /* @__PURE__ */ jsxs56(Fragment8, { children: [
@@ -7274,7 +7473,7 @@ function SortingAction({
7274
7473
  }
7275
7474
 
7276
7475
  // src/status-button/StatusButton.tsx
7277
- import { useMemo as useMemo3 } from "react";
7476
+ import { useMemo as useMemo4 } from "react";
7278
7477
  import { useTranslation as useTranslation20 } from "react-i18next";
7279
7478
  import { AlertCircle as AlertCircle2, CheckCircle, Loader2 as Loader24 } from "lucide-react";
7280
7479
  import { jsx as jsx98, jsxs as jsxs62 } from "react/jsx-runtime";
@@ -7292,7 +7491,7 @@ function StatusButton({
7292
7491
  ...props
7293
7492
  }) {
7294
7493
  const { t } = useTranslation20();
7295
- const configMap = useMemo3(() => {
7494
+ const configMap = useMemo4(() => {
7296
7495
  const defaultLoadingConfig = {
7297
7496
  text: loadingText ?? `${t("saving")}...`,
7298
7497
  icon: /* @__PURE__ */ jsx98(Loader24, { className: "h-4 w-4 animate-spin" }),
@@ -7694,11 +7893,11 @@ var TASK_VARIANTS = {
7694
7893
  import { Toaster, toast as toast2 } from "sonner";
7695
7894
 
7696
7895
  // src/toaster/useUpdateToast.ts
7697
- import { useCallback as useCallback14, useRef as useRef14 } from "react";
7896
+ import { useCallback as useCallback16, useRef as useRef14 } from "react";
7698
7897
  import { toast } from "sonner";
7699
7898
  function useUpdateToast({ id }) {
7700
7899
  const toastIdRef = useRef14("");
7701
- const getToastOptions = useCallback14(
7900
+ const getToastOptions = useCallback16(
7702
7901
  (options) => ({
7703
7902
  id: toastIdRef.current,
7704
7903
  dismissible: false,
@@ -7813,7 +8012,7 @@ var ToggleGroupItem = React27.forwardRef(({ className, children, variant, size,
7813
8012
  ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
7814
8013
 
7815
8014
  // src/toggle-group/Toggles.tsx
7816
- import { forwardRef as forwardRef40, useEffect as useEffect19 } from "react";
8015
+ import { forwardRef as forwardRef40, useEffect as useEffect20 } from "react";
7817
8016
  import { jsx as jsx108, jsxs as jsxs69 } from "react/jsx-runtime";
7818
8017
  var getValueArray2 = (value) => {
7819
8018
  if (value) {
@@ -7888,7 +8087,7 @@ function TogglesInternal({
7888
8087
  }
7889
8088
  };
7890
8089
  const isAnyActive = getValueArray2(value).length > 0;
7891
- useEffect19(() => {
8090
+ useEffect20(() => {
7892
8091
  onAnySelectorActive?.(isAnyActive);
7893
8092
  }, [isAnyActive, onAnySelectorActive]);
7894
8093
  const currentValue = getValueArray2(value).map((item) => String(item));
@@ -11032,7 +11231,7 @@ AirbnbSearchInput.displayName = "SearchInput";
11032
11231
  import * as React41 from "react";
11033
11232
  import { ChevronDown as ChevronDown3, Search as Search4 } from "lucide-react";
11034
11233
  import { useVirtualizer } from "@tanstack/react-virtual";
11035
- import { useCallback as useCallback23 } from "react";
11234
+ import { useCallback as useCallback25 } from "react";
11036
11235
  import { jsx as jsx133, jsxs as jsxs87 } from "react/jsx-runtime";
11037
11236
  var ROW_HEIGHT = 48;
11038
11237
  var DESKTOP_LIST_HEIGHT = 280;
@@ -11107,7 +11306,7 @@ var SearchableSelectInternal = ({
11107
11306
  const activeOptionId = highlightedIndex >= 0 ? getOptionId(reactId, highlightedIndex) : void 0;
11108
11307
  useOutsideClick(containerRef, open && !isMobile ? () => closeSelect() : null);
11109
11308
  const handleOnOpenChange = useEvent(onOpenChange);
11110
- const setSelectOpen = useCallback23(
11309
+ const setSelectOpen = useCallback25(
11111
11310
  (nextOpen, options2) => {
11112
11311
  setOpen(nextOpen);
11113
11312
  handleOnOpenChange?.(nextOpen);
@@ -11475,6 +11674,39 @@ function getNextEnabledIndex(options, startIndex, step) {
11475
11674
  }
11476
11675
  return -1;
11477
11676
  }
11677
+
11678
+ // src/lib/copy-to-clipboard.ts
11679
+ function copyToClipboardFallback(value) {
11680
+ const targetDocument = getDocument();
11681
+ const targetBody = targetDocument.body;
11682
+ if (!targetBody) {
11683
+ return;
11684
+ }
11685
+ const el = targetDocument.createElement("textarea");
11686
+ el.value = value;
11687
+ el.setAttribute("readonly", "");
11688
+ el.style.position = "fixed";
11689
+ el.style.opacity = "0";
11690
+ el.style.pointerEvents = "none";
11691
+ el.style.left = "-9999px";
11692
+ targetBody.appendChild(el);
11693
+ el.focus();
11694
+ el.select();
11695
+ targetDocument.execCommand("copy");
11696
+ targetBody.removeChild(el);
11697
+ }
11698
+ function copyToClipboard2(value) {
11699
+ const text = typeof value === "number" ? value.toString() : value;
11700
+ const targetDocument = getDocument();
11701
+ const clipboard = targetDocument.defaultView?.navigator?.clipboard ?? globalThis.navigator?.clipboard;
11702
+ if (!clipboard?.writeText) {
11703
+ copyToClipboardFallback(text);
11704
+ return;
11705
+ }
11706
+ void clipboard.writeText(text).catch(() => {
11707
+ copyToClipboardFallback(text);
11708
+ });
11709
+ }
11478
11710
  export {
11479
11711
  Accordion,
11480
11712
  AccordionContent,
@@ -11726,6 +11958,7 @@ export {
11726
11958
  buttonVariants,
11727
11959
  calendarClassNames,
11728
11960
  cn,
11961
+ copyToClipboard2 as copyToClipboard,
11729
11962
  emptyMediaVariants,
11730
11963
  getSidebarState,
11731
11964
  inputVariants,
@@ -11743,12 +11976,14 @@ export {
11743
11976
  useClickEscape,
11744
11977
  useCombinedRef,
11745
11978
  useDebounce,
11979
+ useDebouncedFunction,
11746
11980
  useEvent,
11747
11981
  useHover,
11748
11982
  useIsMobile,
11749
11983
  useIsMounted,
11750
11984
  useModalControls,
11751
11985
  useOutsideClick,
11986
+ usePagination,
11752
11987
  usePrevious,
11753
11988
  useRadioOptions,
11754
11989
  useScreenResize,