jean-react-utils 0.2.1 → 0.2.3

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.mjs CHANGED
@@ -41,12 +41,12 @@ var require_use_sync_external_store_shim_production = __commonJS({
41
41
  return x2 === y3 && (0 !== x2 || 1 / x2 === 1 / y3) || x2 !== x2 && y3 !== y3;
42
42
  }
43
43
  var objectIs = "function" === typeof Object.is ? Object.is : is;
44
- var useState4 = React3.useState;
45
- var useEffect2 = React3.useEffect;
44
+ var useState5 = React3.useState;
45
+ var useEffect3 = React3.useEffect;
46
46
  var useLayoutEffect = React3.useLayoutEffect;
47
47
  var useDebugValue2 = React3.useDebugValue;
48
48
  function useSyncExternalStore$2(subscribe, getSnapshot) {
49
- var value = getSnapshot(), _useState = useState4({ inst: { value, getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1];
49
+ var value = getSnapshot(), _useState = useState5({ inst: { value, getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1];
50
50
  useLayoutEffect(
51
51
  function() {
52
52
  inst.value = value;
@@ -55,7 +55,7 @@ var require_use_sync_external_store_shim_production = __commonJS({
55
55
  },
56
56
  [subscribe, value, getSnapshot]
57
57
  );
58
- useEffect2(
58
+ useEffect3(
59
59
  function() {
60
60
  checkIfSnapshotChanged(inst) && forceUpdate({ inst });
61
61
  return subscribe(function() {
@@ -104,7 +104,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
104
104
  "The result of getSnapshot should be cached to avoid an infinite loop"
105
105
  ), didWarnUncachedGetSnapshot = true);
106
106
  }
107
- cachedValue = useState4({
107
+ cachedValue = useState5({
108
108
  inst: { value, getSnapshot }
109
109
  });
110
110
  var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
@@ -116,7 +116,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
116
116
  },
117
117
  [subscribe, value, getSnapshot]
118
118
  );
119
- useEffect2(
119
+ useEffect3(
120
120
  function() {
121
121
  checkIfSnapshotChanged(inst) && forceUpdate({ inst });
122
122
  return subscribe(function() {
@@ -142,7 +142,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
142
142
  return getSnapshot();
143
143
  }
144
144
  "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
145
- var React3 = __require("react"), objectIs = "function" === typeof Object.is ? Object.is : is, useState4 = React3.useState, useEffect2 = React3.useEffect, useLayoutEffect = React3.useLayoutEffect, useDebugValue2 = React3.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
145
+ var React3 = __require("react"), objectIs = "function" === typeof Object.is ? Object.is : is, useState5 = React3.useState, useEffect3 = React3.useEffect, useLayoutEffect = React3.useLayoutEffect, useDebugValue2 = React3.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
146
146
  exports.useSyncExternalStore = void 0 !== React3.useSyncExternalStore ? React3.useSyncExternalStore : shim;
147
147
  "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
148
148
  }();
@@ -173,7 +173,7 @@ var require_with_selector_production = __commonJS({
173
173
  var objectIs = "function" === typeof Object.is ? Object.is : is;
174
174
  var useSyncExternalStore = shim.useSyncExternalStore;
175
175
  var useRef = React3.useRef;
176
- var useEffect2 = React3.useEffect;
176
+ var useEffect3 = React3.useEffect;
177
177
  var useMemo2 = React3.useMemo;
178
178
  var useDebugValue2 = React3.useDebugValue;
179
179
  exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
@@ -217,7 +217,7 @@ var require_with_selector_production = __commonJS({
217
217
  [getSnapshot, getServerSnapshot, selector, isEqual]
218
218
  );
219
219
  var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
220
- useEffect2(
220
+ useEffect3(
221
221
  function() {
222
222
  inst.hasValue = true;
223
223
  inst.value = value;
@@ -239,7 +239,7 @@ var require_with_selector_development = __commonJS({
239
239
  return x2 === y3 && (0 !== x2 || 1 / x2 === 1 / y3) || x2 !== x2 && y3 !== y3;
240
240
  }
241
241
  "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
242
- var React3 = __require("react"), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore = shim.useSyncExternalStore, useRef = React3.useRef, useEffect2 = React3.useEffect, useMemo2 = React3.useMemo, useDebugValue2 = React3.useDebugValue;
242
+ var React3 = __require("react"), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore = shim.useSyncExternalStore, useRef = React3.useRef, useEffect3 = React3.useEffect, useMemo2 = React3.useMemo, useDebugValue2 = React3.useDebugValue;
243
243
  exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
244
244
  var instRef = useRef(null);
245
245
  if (null === instRef.current) {
@@ -282,7 +282,7 @@ var require_with_selector_development = __commonJS({
282
282
  [getSnapshot, getServerSnapshot, selector, isEqual]
283
283
  );
284
284
  var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
285
- useEffect2(
285
+ useEffect3(
286
286
  function() {
287
287
  inst.hasValue = true;
288
288
  inst.value = value;
@@ -2865,7 +2865,6 @@ var buttonVariants = cva(
2865
2865
  );
2866
2866
  var Button = React.forwardRef(
2867
2867
  ({ className, variant, size, ...props }, ref) => {
2868
- console.log(">>>>> button props >>> ", props);
2869
2868
  return /* @__PURE__ */ jsx(
2870
2869
  "button",
2871
2870
  {
@@ -2932,7 +2931,7 @@ function SubTitle({ children, title, className = "" }) {
2932
2931
  }
2933
2932
 
2934
2933
  // src/layout/Header/index.tsx
2935
- import { useState as useState2 } from "react";
2934
+ import { useState as useState3 } from "react";
2936
2935
  import Link from "next/link";
2937
2936
  import { motion as motion2, AnimatePresence } from "framer-motion";
2938
2937
 
@@ -2952,6 +2951,9 @@ function BreadIcon({ isMenuOpen }) {
2952
2951
  // src/layout/Header/index.tsx
2953
2952
  import { usePathname } from "next/navigation";
2954
2953
 
2954
+ // src/theme/providers/theme-toggle.tsx
2955
+ import { useState as useState2, useEffect as useEffect2 } from "react";
2956
+
2955
2957
  // ../node_modules/next-themes/dist/index.mjs
2956
2958
  import * as t from "react";
2957
2959
  var M = (e3, i2, s2, u2, m2, a3, l2, h) => {
@@ -3052,17 +3054,24 @@ var E = (e3) => (e3 || (e3 = window.matchMedia(I)), e3.matches ? "dark" : "light
3052
3054
  import { Moon, Sun } from "lucide-react";
3053
3055
  import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
3054
3056
  function ThemeToggle() {
3057
+ const [mounted, setMounted] = useState2(false);
3055
3058
  const { theme, setTheme } = z();
3059
+ useEffect2(() => {
3060
+ setMounted(true);
3061
+ }, []);
3062
+ if (!mounted) {
3063
+ return null;
3064
+ }
3065
+ const isDark = theme === "dark";
3056
3066
  return /* @__PURE__ */ jsxs2(
3057
3067
  Button,
3058
3068
  {
3059
3069
  variant: "borderNone",
3060
3070
  size: "icon",
3061
- onClick: () => setTheme(theme === "light" ? "dark" : "light"),
3071
+ onClick: () => setTheme(isDark ? "light" : "dark"),
3062
3072
  children: [
3063
3073
  /* @__PURE__ */ jsx4(Sun, { className: "h-5 w-5 rotate-0 scale-100 transition-all dark:rotate-90 dark:scale-0" }),
3064
- /* @__PURE__ */ jsx4(Moon, { className: "absolute h-5 w-5 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" }),
3065
- /* @__PURE__ */ jsx4("span", { className: "sr-only", children: "Toggle theme" })
3074
+ /* @__PURE__ */ jsx4(Moon, { className: "absolute h-5 w-5 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" })
3066
3075
  ]
3067
3076
  }
3068
3077
  );
@@ -3084,7 +3093,7 @@ var Header = ({
3084
3093
  enableAnimation = true,
3085
3094
  theme = {}
3086
3095
  }) => {
3087
- const [isMenuOpen, setIsMenuOpen] = useState2(false);
3096
+ const [isMenuOpen, setIsMenuOpen] = useState3(false);
3088
3097
  const selectedKey = usePathname().split("/")[2] || "home";
3089
3098
  const baseNavClassName = `fixed top-0 left-0 right-0 z-50 backdrop-blur-lg ${className}`;
3090
3099
  const navVariants = {
@@ -3321,9 +3330,9 @@ function BasicLayout({ children }) {
3321
3330
  }
3322
3331
 
3323
3332
  // src/hooks/useForceRerender.ts
3324
- import { useState as useState3, useCallback as useCallback2 } from "react";
3333
+ import { useState as useState4, useCallback as useCallback2 } from "react";
3325
3334
  var useForceRerender = () => {
3326
- const [key, setKey] = useState3(0);
3335
+ const [key, setKey] = useState4(0);
3327
3336
  const forceRerender = useCallback2(() => {
3328
3337
  setKey((prevKey) => prevKey + 1);
3329
3338
  }, []);