meticulous-ui 3.2.8 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/components/Button/Button.js +1 -1
  2. package/components/Dropdown/Dropdown.js +1 -1
  3. package/components/Icons/{index.js → iconsMap.js} +0 -245
  4. package/components/Input/FileUploader/FileUploader.js +1 -1
  5. package/components/Input/Input/helpers.js +1 -1
  6. package/components/Pagination/Pagination.js +1 -1
  7. package/components/Ripple/Ripple.js +24 -20
  8. package/components/Selectbox/Selectbox.js +1 -1
  9. package/components/Spinner/Spinner.js +1 -1
  10. package/hooks/useCopyToClipboard.js +14 -0
  11. package/hooks/useDebounce.js +11 -0
  12. package/hooks/useEventListener.js +15 -0
  13. package/hooks/useFirstRender.js +10 -0
  14. package/hooks/useIntersectionObserver.js +13 -0
  15. package/hooks/useInterval.js +14 -0
  16. package/hooks/useIsMounted.js +10 -0
  17. package/hooks/useLocalStorage.js +28 -0
  18. package/hooks/useMediaQuery.js +11 -0
  19. package/hooks/useOnlineStatus.js +13 -0
  20. package/hooks/useOutsideClick.js +14 -0
  21. package/hooks/usePrevious.js +10 -0
  22. package/hooks/useSessionStorage.js +28 -0
  23. package/hooks/useThrottle.js +16 -0
  24. package/hooks/useTimeout.js +14 -0
  25. package/hooks/useToggle.js +10 -0
  26. package/hooks/useUnmount.js +10 -0
  27. package/hooks/useWindowSize.js +14 -0
  28. package/index.js +907 -53
  29. package/package.json +3 -1
  30. package/reactUtils/composeProviders.js +5 -0
  31. package/reactUtils/createContextHook.js +12 -0
  32. package/reactUtils/createPortalNode.js +7 -0
  33. package/reactUtils/lazyImport.js +7 -0
  34. package/reactUtils/memoCompare.js +5 -0
  35. package/reactUtils/withErrorBoundary.js +24 -0
  36. package/reactUtils/withSuspense.js +9 -0
  37. package/utils/index.js +0 -302
  38. /package/colors/{index.js → colorMap.js} +0 -0
@@ -1,7 +1,7 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
2
  import { useRef as x } from "react";
3
3
  import D from "../Spinner/Spinner.js";
4
- import I from "../../colors/index.js";
4
+ import I from "../../colors/colorMap.js";
5
5
  import u from "../../colors/blue.js";
6
6
  import { ButtonWrapper as R, SpinnerWrapper as B, Content as E, ButtonContainer as L } from "./styles.js";
7
7
  import S from "../Ripple/Ripple.js";
@@ -2,7 +2,7 @@ import { jsxs as C, jsx as u } from "react/jsx-runtime";
2
2
  import { useState as $, useId as le, useRef as v, useMemo as ae, useEffect as h, useLayoutEffect as ue, useCallback as fe, createElement as de } from "react";
3
3
  import E from "../../colors/grey.js";
4
4
  import pe from "../MenuItem/MenuItem.js";
5
- import me from "../../colors/index.js";
5
+ import me from "../../colors/colorMap.js";
6
6
  import he from "../../colors/blue.js";
7
7
  import K from "../Spinner/Spinner.js";
8
8
  import { DropdownWrapper as be, Box as we, PWrapper as xe, ChevronDownWrapper as ge, OptionWrapper as Ie, SearchContainer as ke, SearchIcon as Se, SearchInput as Ce, OptionsList as $e, LoadMoreSentinel as ve, SpinnerWrapper as ye } from "./styles.js";
@@ -491,250 +491,5 @@ const lf = {
491
491
  Youtube: bm
492
492
  };
493
493
  export {
494
- i as Add,
495
- r as AddCircle,
496
- o as AddCircleFilled,
497
- m as ArrowDown,
498
- t as ArrowLeft,
499
- e as ArrowRight,
500
- l as ArrowUp,
501
- p as BagFilled,
502
- f as BagOutline,
503
- n as BellFilled,
504
- d as BellOffFilled,
505
- u as BellOffOutline,
506
- a as BellOutline,
507
- F as BookmarkFilled,
508
- O as BookmarkOutline,
509
- c as BoxCoveredFilled,
510
- C as BoxCoveredOutline,
511
- s as BoxFilled,
512
- h as BoxOutline,
513
- S as CalendarDays,
514
- k as CalendarLinesPen,
515
- T as CartCheckFilled,
516
- y as CartCheckOutline,
517
- g as CartCrossFilled,
518
- P as CartCrossOutline,
519
- B as CartFilled,
520
- D as CartMinusFilled,
521
- M as CartMinusOutline,
522
- L as CartOutline,
523
- b as CartPlusFilled,
524
- x as CartPlusOutline,
525
- A as Check,
526
- w as CheckDouble,
527
- R as ChevronDown,
528
- v as ChevronLeft,
529
- E as ChevronRight,
530
- H as ChevronUp,
531
- K as ClockCircleOutline,
532
- W as ClockSquareOutline,
533
- U as Close,
534
- I as CloseCircleFilled,
535
- q as CloseCircleOutline,
536
- V as CommentBubbleFilled,
537
- z as CommentBubbleOutline,
538
- N as CommentFilled,
539
- Y as CommentLineFilled,
540
- G as CommentLineOutline,
541
- j as CommentOutline,
542
- J as ContactDetailsFilled,
543
- Q as ContactDetailsOutline,
544
- X as DeliveryTruckFastFilled,
545
- Z as DeliveryTruckFastOutline,
546
- _ as DeliveryTruckLeftFilled,
547
- $ as DeliveryTruckLeftOutline,
548
- oo as DeliveryTruckRightFilled,
549
- ro as DeliveryTruckRightOutline,
550
- io as DetailsOutline,
551
- mo as DiscordConversation,
552
- to as DiscordFilled,
553
- eo as DiscordOutline,
554
- lo as DoorClosedFilled,
555
- po as DoorClosedOutline,
556
- fo as DoorOpenFilled,
557
- no as DoorOpenOutline,
558
- uo as DotsHorizontalFilled,
559
- ao as DotsHorizontalOutline,
560
- Fo as DotsVerticalFilled,
561
- Oo as DotsVerticalOutline,
562
- so as Download,
563
- co as DownloadBoxFilled,
564
- Co as DownloadBoxOutline,
565
- ho as EditBoxThick,
566
- So as EditBoxThin,
567
- ko as EmailFilled,
568
- To as EmailOutline,
569
- yo as ExitArrowInOutline,
570
- go as ExitArrowOutOutline,
571
- Bo as ExitFullScreen,
572
- Po as ExitFullScreenThick,
573
- Do as EyeClosed,
574
- Mo as EyeFilled,
575
- Lo as EyeOutline,
576
- bo as FacebookFilled,
577
- xo as FacebookMessengerOutline,
578
- wo as FacebookOutline,
579
- Ao as FacebookRoundFilled,
580
- Ho as Filter,
581
- Ro as FilterList,
582
- vo as FilterThickFilled,
583
- Eo as FilterThickOutline,
584
- Ko as FullScreenArrowThick,
585
- Wo as FullScreenArrowThin,
586
- Io as FullScreenExit,
587
- qo as FullScreenFilled,
588
- Uo as FullScreenOutline,
589
- Vo as HamburgerMenu,
590
- zo as HamburgerSpaced,
591
- No as HeartFilled,
592
- Yo as HeartOutline,
593
- Jo as Help,
594
- Go as HelpCircleFilled,
595
- jo as HelpCircleOutline,
596
- Qo as HomeFilled,
597
- Xo as HomeOutline,
598
- rr as Info,
599
- Zo as InfoCircleFilled,
600
- _o as InfoCircleOutline,
601
- $o as InfoSquareFilled,
602
- or as InfoSquareOutline,
603
- ir as InstagramOuline,
604
- mr as InstagramRoundFilled,
605
- tr as KeyFilled,
606
- er as KeyInSquareFilled,
607
- lr as KeyInSquareOutline,
608
- pr as KeyOutline,
609
- fr as KeySideSquareFilled,
610
- nr as KeySideSquareOutline,
611
- dr as KeySquareFilled,
612
- ur as KeySquareOutline,
613
- ar as Link,
614
- Fr as LinkedinFilled,
615
- Or as LinkedinOutline,
616
- cr as LinkedinRoundFilled,
617
- Cr as Loading,
618
- sr as LocationArrowFilled,
619
- hr as LocationArrowOutline,
620
- Sr as LocationFilled,
621
- kr as LocationOutline,
622
- Pr as LockKeyhole,
623
- Tr as LockKeyholeOutline,
624
- gr as LockKeyholeUnlocked,
625
- yr as LockKeyholeUnlockedOutline,
626
- Br as MediaPauseCircleFilled,
627
- Dr as MediaPauseCircleOuline,
628
- Mr as MediaPauseFilled,
629
- Lr as MediaPauseOutline,
630
- br as MediaPlayCircleFilled,
631
- xr as MediaPlayCircleOutline,
632
- wr as MediaPlayFilled,
633
- Ar as MediaPlayOutline,
634
- Rr as MediaStopCircleFilled,
635
- vr as MediaStopCircleOutline,
636
- Er as MediaStopFilled,
637
- Hr as MediaStopOutline,
638
- Ir as Minus,
639
- Wr as MinusCircle,
640
- Kr as MinusCircleFilled,
641
- qr as MoneyBagOutline,
642
- Ur as MoneyBriefcaseFilled,
643
- Vr as MoneyBriefcaseOutline,
644
- Yr as NoEntry,
645
- zr as NoEntryFilled,
646
- Nr as NoEntryOutline,
647
- Gr as PaymentCardFilled,
648
- jr as PaymentCardOutline,
649
- Jr as PhoneCallingFilled,
650
- Qr as PhoneCallingOutline,
651
- Xr as PhoneFilled,
652
- Zr as PhoneOutline,
653
- li as Pin,
654
- _r as PinAddFilled,
655
- $r as PinAddOutline,
656
- oi as PinCircleFilled,
657
- ri as PinCircleOutline,
658
- ii as PinFilled,
659
- mi as PinOutline,
660
- ti as PinSubFilled,
661
- ei as PinSubOutline,
662
- pi as PinterestFilled,
663
- fi as PinterestOutline,
664
- ni as ProfileFemaleOutline,
665
- di as ProfileGroupFilled,
666
- ui as ProfileMaleFilled,
667
- ai as ProfileMaleOutline,
668
- Fi as RedditFilled,
669
- Oi as RedditOutline,
670
- ci as RedditRoundFilled,
671
- Ci as RedditRoundOutline,
672
- si as RupeeOutlined,
673
- hi as RupeeSign,
674
- Si as SaveFilled,
675
- ki as SaveOutline,
676
- Ti as Search,
677
- yi as SettingFilled,
678
- gi as SettingOutline,
679
- Pi as ShareAllFilled,
680
- Bi as ShareAllOutline,
681
- Di as ShareBoxOutline,
682
- Mi as ShareFilled,
683
- Li as ShareOutline,
684
- bi as ShareThickFilled,
685
- xi as ShieldCheckFilled,
686
- wi as ShieldCheckOutline,
687
- Ai as ShieldCrossFilled,
688
- Ri as ShieldCrossOutline,
689
- vi as ShieldFilled,
690
- Ei as ShieldOutline,
691
- Hi as ShieldWarningFilled,
692
- Ki as ShieldWarningOutline,
693
- Wi as SnapchatFilled,
694
- Ii as SnapchatOutline,
695
- qi as SortBottomToTop,
696
- Ui as SortHorizontal,
697
- Vi as SortTopToBottom,
698
- zi as SortVertical,
699
- Ni as StarFilled,
700
- Yi as StarOutline,
701
- Gi as TelegramFilled,
702
- ji as TelegramOutline,
703
- Ji as TelegramRoundFilled,
704
- Qi as ThumbsDownFilled,
705
- Xi as ThumbsDownOutline,
706
- Zi as ThumbsUpFilled,
707
- _i as ThumbsUpOutline,
708
- $i as TiktokBox,
709
- om as TiktokThickFilled,
710
- rm as TiktokThinFilled,
711
- im as TrashBigFilled,
712
- mm as TrashBigOutline,
713
- tm as TrashFilled,
714
- em as TrashLinesFilled,
715
- lm as TrashLinesOutline,
716
- pm as TrashOutline,
717
- dm as Upload,
718
- fm as UploadBoxFilled,
719
- nm as UploadBoxOutline,
720
- um as VolumeFilled,
721
- am as VolumeMuteFilled,
722
- Fm as VolumeMuteOutline,
723
- Om as VolumeOffFilled,
724
- cm as VolumeOffOutline,
725
- Cm as VolumeOutline,
726
- sm as WalletFilled,
727
- hm as WalletOutline,
728
- Pm as Warning,
729
- Sm as WarningCircleFilled,
730
- km as WarningCircleOutline,
731
- Tm as WarningSmall,
732
- ym as WarningTriangleFilled,
733
- gm as WarningTriangleOutline,
734
- Bm as WhatsappFilled,
735
- Dm as WhatsappOutline,
736
- bm as Youtube,
737
- Mm as YoutubeFilled,
738
- Lm as YoutubeRoundFilled,
739
494
  lf as default
740
495
  };
@@ -5,7 +5,7 @@ import F from "../../../colors/white.js";
5
5
  import x from "../../../colors/blue.js";
6
6
  import H from "../../../colors/grey.js";
7
7
  import P from "../../Icons/Link/Link.js";
8
- import Z from "../../../colors/index.js";
8
+ import Z from "../../../colors/colorMap.js";
9
9
  import q from "../../Ripple/Ripple.js";
10
10
  import { SIZE as A, MEDIUM as G } from "./constants.js";
11
11
  const J = ({ theme: t, children: l }) => /* @__PURE__ */ o(q, { rippleColor: t.m100, children: l }), oo = ({
@@ -9,7 +9,7 @@ import a from "../../../colors/violet.js";
9
9
  import c from "../../../colors/teal.js";
10
10
  import s from "../../../colors/purple.js";
11
11
  import y from "../../../colors/pink.js";
12
- import b from "../../Icons/index.js";
12
+ import b from "../../Icons/iconsMap.js";
13
13
  const d = {
14
14
  blue: l.m500,
15
15
  green: n.m500,
@@ -1,7 +1,7 @@
1
1
  import { jsxs as l, jsx as f } from "react/jsx-runtime";
2
2
  import { useRef as S, useEffect as u } from "react";
3
3
  import { PrevArrow as M, renderPageNum as t, NextArrow as R, renderThreeDots as $ } from "./helpers.js";
4
- import j from "../../colors/index.js";
4
+ import j from "../../colors/colorMap.js";
5
5
  import G from "../../colors/teal.js";
6
6
  import { ICON_SIZE_MAPPING as L, MEDIUM as U, SIZE_REM_MAPPING as Z } from "./constants.js";
7
7
  import { AllPages as v, MiddleLayer as x } from "./styles.js";
@@ -1,38 +1,42 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import { useRef as g } from "react";
3
- /* empty css */
4
- const C = ({
5
- children: s,
1
+ import { jsx as f } from "react/jsx-runtime";
2
+ import { useRef as y } from "react";
3
+ const h = ".ripple-container{position:relative;overflow:hidden;display:inline-block;cursor:pointer}.ripple-effect{position:absolute;border-radius:50%;transform:scale(0);animation:ripple-animation 600ms linear;pointer-events:none}@keyframes ripple-animation{to{transform:scale(4);opacity:0}}";
4
+ if (typeof document < "u" && !document.getElementById("meticulous-ripple-styles")) {
5
+ const i = document.createElement("style");
6
+ i.id = "meticulous-ripple-styles", i.textContent = h, document.head.appendChild(i);
7
+ }
8
+ const R = ({
9
+ children: i,
6
10
  rippleColor: p = "rgba(255, 255, 255, 0.3)",
7
11
  className: a = "",
8
12
  ...d
9
13
  }) => {
10
- const r = g(null), c = (t, n) => {
11
- const i = r.current;
12
- if (!i) return;
13
- const e = document.createElement("span"), l = i.getBoundingClientRect(), o = Math.max(l.width, l.height);
14
- e.style.width = e.style.height = `${o}px`, e.style.left = `${t - o / 2}px`, e.style.top = `${n - o / 2}px`, e.style.backgroundColor = p, e.classList.add("ripple-effect"), i.appendChild(e), e.addEventListener("animationend", () => e.remove());
14
+ const o = y(null), s = (t, n) => {
15
+ const r = o.current;
16
+ if (!r) return;
17
+ const e = document.createElement("span"), c = r.getBoundingClientRect(), l = Math.max(c.width, c.height);
18
+ e.style.width = e.style.height = `${l}px`, e.style.left = `${t - l / 2}px`, e.style.top = `${n - l / 2}px`, e.style.backgroundColor = p, e.classList.add("ripple-effect"), r.appendChild(e), e.addEventListener("animationend", () => e.remove());
15
19
  }, u = (t) => {
16
20
  if (t.detail === 0) return;
17
- const n = r.current.getBoundingClientRect();
18
- c(t.clientX - n.left, t.clientY - n.top);
19
- }, f = (t) => {
21
+ const n = o.current.getBoundingClientRect();
22
+ s(t.clientX - n.left, t.clientY - n.top);
23
+ }, m = (t) => {
20
24
  if (t.key !== "Enter" && t.key !== " ") return;
21
- const n = r.current.getBoundingClientRect();
22
- c(n.width / 2, n.height / 2);
25
+ const n = o.current.getBoundingClientRect();
26
+ s(n.width / 2, n.height / 2);
23
27
  };
24
- return /* @__PURE__ */ m(
28
+ return /* @__PURE__ */ f(
25
29
  "div",
26
30
  {
27
- ref: r,
31
+ ref: o,
28
32
  className: `ripple-container ${a}`,
29
33
  onClick: u,
30
- onKeyDown: f,
34
+ onKeyDown: m,
31
35
  ...d,
32
- children: s
36
+ children: i
33
37
  }
34
38
  );
35
39
  };
36
40
  export {
37
- C as default
41
+ R as default
38
42
  };
@@ -1,7 +1,7 @@
1
1
  import { jsxs as $, jsx as i } from "react/jsx-runtime";
2
2
  import { useState as C, useId as T, useRef as v, useMemo as ce, useEffect as I, useLayoutEffect as le, useCallback as ae } from "react";
3
3
  import O from "../../colors/grey.js";
4
- import ue from "../../colors/index.js";
4
+ import ue from "../../colors/colorMap.js";
5
5
  import de from "../../colors/blue.js";
6
6
  import pe from "../Input/Checkbox/Checkbox.js";
7
7
  import U from "../Spinner/Spinner.js";
@@ -1,6 +1,6 @@
1
1
  import { jsx as i } from "react/jsx-runtime";
2
2
  import { SpinnerSVG as s, SpinnerCircle as a } from "./styles.js";
3
- import h from "../../colors/index.js";
3
+ import h from "../../colors/colorMap.js";
4
4
  import d from "../../colors/green.js";
5
5
  import p from "../../colors/white.js";
6
6
  import c from "../../colors/grey.js";
@@ -0,0 +1,14 @@
1
+ import { useState as a } from "react";
2
+ const c = () => {
3
+ const [e, t] = a(!1);
4
+ return [e, async (o) => {
5
+ try {
6
+ await navigator.clipboard.writeText(o), t(!0), setTimeout(() => t(!1), 2e3);
7
+ } catch {
8
+ t(!1);
9
+ }
10
+ }];
11
+ };
12
+ export {
13
+ c as default
14
+ };
@@ -0,0 +1,11 @@
1
+ import { useState as c, useEffect as n } from "react";
2
+ const d = (e, t) => {
3
+ const [o, s] = c(e);
4
+ return n(() => {
5
+ const u = setTimeout(() => s(e), t);
6
+ return () => clearTimeout(u);
7
+ }, [e, t]), o;
8
+ };
9
+ export {
10
+ d as default
11
+ };
@@ -0,0 +1,15 @@
1
+ import { useRef as o, useEffect as c } from "react";
2
+ const f = (r, s, e = window) => {
3
+ const t = o(s);
4
+ c(() => {
5
+ t.current = s;
6
+ }, [s]), c(() => {
7
+ const n = e && "current" in e ? e.current : e;
8
+ if (!(n != null && n.addEventListener)) return;
9
+ const u = (i) => t.current(i);
10
+ return n.addEventListener(r, u), () => n.removeEventListener(r, u);
11
+ }, [r, e]);
12
+ };
13
+ export {
14
+ f as default
15
+ };
@@ -0,0 +1,10 @@
1
+ import { useRef as r, useEffect as t } from "react";
2
+ const u = () => {
3
+ const e = r(!0);
4
+ return t(() => {
5
+ e.current = !1;
6
+ }, []), e.current;
7
+ };
8
+ export {
9
+ u as default
10
+ };
@@ -0,0 +1,13 @@
1
+ import { useState as u, useEffect as l } from "react";
2
+ const b = (r, e = {}) => {
3
+ const [s, o] = u(null);
4
+ return l(() => {
5
+ const t = r.current;
6
+ if (!t) return;
7
+ const n = new IntersectionObserver(([c]) => o(c), e);
8
+ return n.observe(t), () => n.disconnect();
9
+ }, [r, e.threshold, e.root, e.rootMargin]), s;
10
+ };
11
+ export {
12
+ b as default
13
+ };
@@ -0,0 +1,14 @@
1
+ import { useRef as u, useEffect as n } from "react";
2
+ const o = (e, r) => {
3
+ const t = u(e);
4
+ n(() => {
5
+ t.current = e;
6
+ }, [e]), n(() => {
7
+ if (r === null) return;
8
+ const s = setInterval(() => t.current(), r);
9
+ return () => clearInterval(s);
10
+ }, [r]);
11
+ };
12
+ export {
13
+ o as default
14
+ };
@@ -0,0 +1,10 @@
1
+ import { useRef as t, useEffect as r } from "react";
2
+ const s = () => {
3
+ const e = t(!1);
4
+ return r(() => (e.current = !0, () => {
5
+ e.current = !1;
6
+ }), []), e;
7
+ };
8
+ export {
9
+ s as default
10
+ };
@@ -0,0 +1,28 @@
1
+ import { useState as n } from "react";
2
+ const g = (e, o) => {
3
+ const [r, c] = n(() => {
4
+ try {
5
+ const t = localStorage.getItem(e);
6
+ return t !== null ? JSON.parse(t) : o;
7
+ } catch {
8
+ return o;
9
+ }
10
+ });
11
+ return [r, (t) => {
12
+ const s = typeof t == "function" ? t(r) : t;
13
+ c(s);
14
+ try {
15
+ localStorage.setItem(e, JSON.stringify(s));
16
+ } catch {
17
+ }
18
+ }, () => {
19
+ c(o);
20
+ try {
21
+ localStorage.removeItem(e);
22
+ } catch {
23
+ }
24
+ }];
25
+ };
26
+ export {
27
+ g as default
28
+ };
@@ -0,0 +1,11 @@
1
+ import { useState as o, useEffect as r } from "react";
2
+ const h = (e) => {
3
+ const [n, s] = o(() => window.matchMedia(e).matches);
4
+ return r(() => {
5
+ const t = window.matchMedia(e), a = (c) => s(c.matches);
6
+ return t.addEventListener("change", a), () => t.removeEventListener("change", a);
7
+ }, [e]), n;
8
+ };
9
+ export {
10
+ h as default
11
+ };
@@ -0,0 +1,13 @@
1
+ import { useState as o, useEffect as s } from "react";
2
+ const f = () => {
3
+ const [i, e] = o(navigator.onLine);
4
+ return s(() => {
5
+ const n = () => e(!0), t = () => e(!1);
6
+ return window.addEventListener("online", n), window.addEventListener("offline", t), () => {
7
+ window.removeEventListener("online", n), window.removeEventListener("offline", t);
8
+ };
9
+ }, []), i;
10
+ };
11
+ export {
12
+ f as default
13
+ };
@@ -0,0 +1,14 @@
1
+ import { useEffect as r } from "react";
2
+ const u = (e, n) => {
3
+ r(() => {
4
+ const t = (o) => {
5
+ e.current && !e.current.contains(o.target) && n(o);
6
+ };
7
+ return document.addEventListener("mousedown", t), document.addEventListener("touchstart", t), () => {
8
+ document.removeEventListener("mousedown", t), document.removeEventListener("touchstart", t);
9
+ };
10
+ }, [e, n]);
11
+ };
12
+ export {
13
+ u as default
14
+ };
@@ -0,0 +1,10 @@
1
+ import { useRef as t, useEffect as u } from "react";
2
+ const n = (r) => {
3
+ const e = t(void 0);
4
+ return u(() => {
5
+ e.current = r;
6
+ }), e.current;
7
+ };
8
+ export {
9
+ n as default
10
+ };
@@ -0,0 +1,28 @@
1
+ import { useState as c } from "react";
2
+ const g = (e, s) => {
3
+ const [o, r] = c(() => {
4
+ try {
5
+ const t = sessionStorage.getItem(e);
6
+ return t !== null ? JSON.parse(t) : s;
7
+ } catch {
8
+ return s;
9
+ }
10
+ });
11
+ return [o, (t) => {
12
+ const n = typeof t == "function" ? t(o) : t;
13
+ r(n);
14
+ try {
15
+ sessionStorage.setItem(e, JSON.stringify(n));
16
+ } catch {
17
+ }
18
+ }, () => {
19
+ r(s);
20
+ try {
21
+ sessionStorage.removeItem(e);
22
+ } catch {
23
+ }
24
+ }];
25
+ };
26
+ export {
27
+ g as default
28
+ };
@@ -0,0 +1,16 @@
1
+ import { useState as c, useRef as u, useEffect as i } from "react";
2
+ const f = (t, e) => {
3
+ const [r, n] = c(t), o = u(Date.now());
4
+ return i(() => {
5
+ const s = e - (Date.now() - o.current), a = setTimeout(
6
+ () => {
7
+ n(t), o.current = Date.now();
8
+ },
9
+ Math.max(0, s)
10
+ );
11
+ return () => clearTimeout(a);
12
+ }, [t, e]), r;
13
+ };
14
+ export {
15
+ f as default
16
+ };
@@ -0,0 +1,14 @@
1
+ import { useRef as s, useEffect as u } from "react";
2
+ const f = (e, t) => {
3
+ const r = s(e);
4
+ u(() => {
5
+ r.current = e;
6
+ }, [e]), u(() => {
7
+ if (t === null) return;
8
+ const o = setTimeout(() => r.current(), t);
9
+ return () => clearTimeout(o);
10
+ }, [t]);
11
+ };
12
+ export {
13
+ f as default
14
+ };
@@ -0,0 +1,10 @@
1
+ import { useState as u, useCallback as r } from "react";
2
+ const f = (o = !1) => {
3
+ const [t, a] = u(o), l = r((e) => {
4
+ a((s) => typeof e == "boolean" ? e : !s);
5
+ }, []);
6
+ return [t, l];
7
+ };
8
+ export {
9
+ f as default
10
+ };
@@ -0,0 +1,10 @@
1
+ import { useRef as u, useEffect as r } from "react";
2
+ const s = (e) => {
3
+ const t = u(e);
4
+ r(() => {
5
+ t.current = e;
6
+ }, [e]), r(() => () => t.current(), []);
7
+ };
8
+ export {
9
+ s as default
10
+ };
@@ -0,0 +1,14 @@
1
+ import { useState as t, useEffect as r } from "react";
2
+ const w = () => {
3
+ const [i, n] = t({
4
+ width: window.innerWidth,
5
+ height: window.innerHeight
6
+ });
7
+ return r(() => {
8
+ const e = () => n({ width: window.innerWidth, height: window.innerHeight });
9
+ return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
10
+ }, []), i;
11
+ };
12
+ export {
13
+ w as default
14
+ };