asterui 0.12.0 → 0.12.1

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 (160) hide show
  1. package/README.md +1 -1
  2. package/dist/components/Form.d.ts +27 -2
  3. package/dist/components/Radio.d.ts +7 -1
  4. package/dist/components/Status.d.ts +18 -0
  5. package/dist/index.d.ts +4 -2
  6. package/dist/index.js +61 -59
  7. package/dist/index.js.map +1 -1
  8. package/dist/index100.js +7 -12
  9. package/dist/index100.js.map +1 -1
  10. package/dist/index101.js +11 -29
  11. package/dist/index101.js.map +1 -1
  12. package/dist/index102.js +29 -16
  13. package/dist/index102.js.map +1 -1
  14. package/dist/index103.js +17 -10792
  15. package/dist/index103.js.map +1 -1
  16. package/dist/index104.js +10793 -5
  17. package/dist/index104.js.map +1 -1
  18. package/dist/index105.js +5 -42
  19. package/dist/index105.js.map +1 -1
  20. package/dist/index106.js +42 -2
  21. package/dist/index106.js.map +1 -1
  22. package/dist/index107.js +2 -7
  23. package/dist/index107.js.map +1 -1
  24. package/dist/index108.js +6 -151
  25. package/dist/index108.js.map +1 -1
  26. package/dist/index109.js +147 -25
  27. package/dist/index109.js.map +1 -1
  28. package/dist/index110.js +28 -28
  29. package/dist/index110.js.map +1 -1
  30. package/dist/index111.js +30 -2
  31. package/dist/index111.js.map +1 -1
  32. package/dist/index112.js +2 -72
  33. package/dist/index112.js.map +1 -1
  34. package/dist/index113.js +71 -38
  35. package/dist/index113.js.map +1 -1
  36. package/dist/index114.js +37 -24
  37. package/dist/index114.js.map +1 -1
  38. package/dist/index115.js +24 -19
  39. package/dist/index115.js.map +1 -1
  40. package/dist/index116.js +20 -23
  41. package/dist/index116.js.map +1 -1
  42. package/dist/index117.js +23 -19
  43. package/dist/index117.js.map +1 -1
  44. package/dist/index118.js +19 -99
  45. package/dist/index118.js.map +1 -1
  46. package/dist/index119.js +98 -358
  47. package/dist/index119.js.map +1 -1
  48. package/dist/index120.js +358 -23
  49. package/dist/index120.js.map +1 -1
  50. package/dist/index121.js +23 -71
  51. package/dist/index121.js.map +1 -1
  52. package/dist/index122.js +72 -15
  53. package/dist/index122.js.map +1 -1
  54. package/dist/index123.js +15 -65
  55. package/dist/index123.js.map +1 -1
  56. package/dist/index124.js +61 -139
  57. package/dist/index124.js.map +1 -1
  58. package/dist/index125.js +144 -2
  59. package/dist/index125.js.map +1 -1
  60. package/dist/index126.js +2 -56
  61. package/dist/index126.js.map +1 -1
  62. package/dist/index127.js +56 -2
  63. package/dist/index127.js.map +1 -1
  64. package/dist/index128.js +2 -2
  65. package/dist/index131.js +2 -2
  66. package/dist/index132.js +2 -2
  67. package/dist/index133.js +2 -2
  68. package/dist/index134.js +2 -2
  69. package/dist/index135.js +2 -32
  70. package/dist/index135.js.map +1 -1
  71. package/dist/index136.js +32 -2
  72. package/dist/index136.js.map +1 -1
  73. package/dist/index137.js +2 -8
  74. package/dist/index137.js.map +1 -1
  75. package/dist/index138.js +8 -2
  76. package/dist/index138.js.map +1 -1
  77. package/dist/index139.js +2 -2
  78. package/dist/index140.js +2 -21
  79. package/dist/index140.js.map +1 -1
  80. package/dist/index141.js +21 -2
  81. package/dist/index141.js.map +1 -1
  82. package/dist/index142.js +2 -24
  83. package/dist/index142.js.map +1 -1
  84. package/dist/index143.js +17 -64
  85. package/dist/index143.js.map +1 -1
  86. package/dist/index144.js +68 -18
  87. package/dist/index144.js.map +1 -1
  88. package/dist/index145.js +18 -31
  89. package/dist/index145.js.map +1 -1
  90. package/dist/index146.js +32 -68
  91. package/dist/index146.js.map +1 -1
  92. package/dist/index147.js +70 -2
  93. package/dist/index147.js.map +1 -1
  94. package/dist/index148.js +2 -22
  95. package/dist/index148.js.map +1 -1
  96. package/dist/index149.js +22 -2
  97. package/dist/index149.js.map +1 -1
  98. package/dist/index15.js +1 -1
  99. package/dist/index151.js +2 -2
  100. package/dist/index152.js +2 -2
  101. package/dist/index153.js +2 -4
  102. package/dist/index153.js.map +1 -1
  103. package/dist/index154.js +7 -0
  104. package/dist/index154.js.map +1 -0
  105. package/dist/index31.js +175 -116
  106. package/dist/index31.js.map +1 -1
  107. package/dist/index62.js +1 -1
  108. package/dist/index63.js +24 -24
  109. package/dist/index63.js.map +1 -1
  110. package/dist/index75.js +31 -22
  111. package/dist/index75.js.map +1 -1
  112. package/dist/index76.js +20 -327
  113. package/dist/index76.js.map +1 -1
  114. package/dist/index77.js +323 -50
  115. package/dist/index77.js.map +1 -1
  116. package/dist/index78.js +56 -40
  117. package/dist/index78.js.map +1 -1
  118. package/dist/index79.js +40 -23
  119. package/dist/index79.js.map +1 -1
  120. package/dist/index80.js +21 -93
  121. package/dist/index80.js.map +1 -1
  122. package/dist/index81.js +88 -123
  123. package/dist/index81.js.map +1 -1
  124. package/dist/index82.js +123 -154
  125. package/dist/index82.js.map +1 -1
  126. package/dist/index83.js +159 -63
  127. package/dist/index83.js.map +1 -1
  128. package/dist/index84.js +65 -35
  129. package/dist/index84.js.map +1 -1
  130. package/dist/index85.js +35 -234
  131. package/dist/index85.js.map +1 -1
  132. package/dist/index86.js +231 -31
  133. package/dist/index86.js.map +1 -1
  134. package/dist/index87.js +34 -210
  135. package/dist/index87.js.map +1 -1
  136. package/dist/index88.js +195 -198
  137. package/dist/index88.js.map +1 -1
  138. package/dist/index89.js +159 -241
  139. package/dist/index89.js.map +1 -1
  140. package/dist/index90.js +283 -166
  141. package/dist/index90.js.map +1 -1
  142. package/dist/index91.js +173 -253
  143. package/dist/index91.js.map +1 -1
  144. package/dist/index92.js +258 -14
  145. package/dist/index92.js.map +1 -1
  146. package/dist/index93.js +12 -31
  147. package/dist/index93.js.map +1 -1
  148. package/dist/index94.js +32 -5
  149. package/dist/index94.js.map +1 -1
  150. package/dist/index95.js +5 -13
  151. package/dist/index95.js.map +1 -1
  152. package/dist/index96.js +11 -43
  153. package/dist/index96.js.map +1 -1
  154. package/dist/index97.js +44 -11
  155. package/dist/index97.js.map +1 -1
  156. package/dist/index98.js +10 -12
  157. package/dist/index98.js.map +1 -1
  158. package/dist/index99.js +14 -7
  159. package/dist/index99.js.map +1 -1
  160. package/package.json +1 -1
package/dist/index97.js CHANGED
@@ -1,16 +1,49 @@
1
- import { useState as r, useEffect as c } from "react";
2
- function i(e, t = 300) {
3
- const [o, u] = r(e);
4
- return c(() => {
5
- const n = setTimeout(() => {
6
- u(e);
7
- }, t);
8
- return () => {
9
- clearTimeout(n);
1
+ import { useState as u, useCallback as c, useEffect as f } from "react";
2
+ function S(o, t) {
3
+ const [s, n] = u(() => {
4
+ if (typeof window > "u")
5
+ return t;
6
+ try {
7
+ const e = window.localStorage.getItem(o);
8
+ return e ? JSON.parse(e) : t;
9
+ } catch {
10
+ return t;
11
+ }
12
+ }), d = c(
13
+ (e) => {
14
+ n((r) => {
15
+ const a = e instanceof Function ? e(r) : e;
16
+ if (typeof window < "u")
17
+ try {
18
+ window.localStorage.setItem(o, JSON.stringify(a));
19
+ } catch (l) {
20
+ console.warn(`Failed to save to localStorage key "${o}":`, l);
21
+ }
22
+ return a;
23
+ });
24
+ },
25
+ [o]
26
+ ), w = c(() => {
27
+ if (typeof window < "u")
28
+ try {
29
+ window.localStorage.removeItem(o);
30
+ } catch (e) {
31
+ console.warn(`Failed to remove localStorage key "${o}":`, e);
32
+ }
33
+ n(t);
34
+ }, [o, t]);
35
+ return f(() => {
36
+ const e = (r) => {
37
+ if (r.key === o && r.newValue !== null)
38
+ try {
39
+ n(JSON.parse(r.newValue));
40
+ } catch {
41
+ }
10
42
  };
11
- }, [e, t]), o;
43
+ return window.addEventListener("storage", e), () => window.removeEventListener("storage", e);
44
+ }, [o]), [s, d, w];
12
45
  }
13
46
  export {
14
- i as useDebounce
47
+ S as useLocalStorage
15
48
  };
16
49
  //# sourceMappingURL=index97.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index97.js","sources":["../src/hooks/useDebounce.ts"],"sourcesContent":["import { useState, useEffect } from 'react'\n\n/**\n * Hook that delays updating a value until after a specified delay.\n * Useful for search inputs to avoid excessive API calls.\n *\n * @param value - Value to debounce\n * @param delay - Delay in milliseconds (default: 300)\n * @returns Debounced value\n *\n * @example\n * const [search, setSearch] = useState('')\n * const debouncedSearch = useDebounce(search, 500)\n *\n * useEffect(() => {\n * // This runs 500ms after user stops typing\n * fetchResults(debouncedSearch)\n * }, [debouncedSearch])\n */\nexport function useDebounce<T>(value: T, delay = 300): T {\n const [debouncedValue, setDebouncedValue] = useState<T>(value)\n\n useEffect(() => {\n const timer = setTimeout(() => {\n setDebouncedValue(value)\n }, delay)\n\n return () => {\n clearTimeout(timer)\n }\n }, [value, delay])\n\n return debouncedValue\n}\n"],"names":["useDebounce","value","delay","debouncedValue","setDebouncedValue","useState","useEffect","timer"],"mappings":";AAmBO,SAASA,EAAeC,GAAUC,IAAQ,KAAQ;AACvD,QAAM,CAACC,GAAgBC,CAAiB,IAAIC,EAAYJ,CAAK;AAE7D,SAAAK,EAAU,MAAM;AACd,UAAMC,IAAQ,WAAW,MAAM;AAC7B,MAAAH,EAAkBH,CAAK;AAAA,IACzB,GAAGC,CAAK;AAER,WAAO,MAAM;AACX,mBAAaK,CAAK;AAAA,IACpB;AAAA,EACF,GAAG,CAACN,GAAOC,CAAK,CAAC,GAEVC;AACT;"}
1
+ {"version":3,"file":"index97.js","sources":["../src/hooks/useLocalStorage.ts"],"sourcesContent":["import { useState, useCallback, useEffect } from 'react'\n\n/**\n * Hook for persisting state to localStorage.\n *\n * @param key - localStorage key\n * @param initialValue - Initial value if key doesn't exist\n * @returns [value, setValue, removeValue] tuple\n *\n * @example\n * const [theme, setTheme] = useLocalStorage('theme', 'light')\n * const [user, setUser, removeUser] = useLocalStorage('user', null)\n */\nexport function useLocalStorage<T>(\n key: string,\n initialValue: T\n): [T, (value: T | ((prev: T) => T)) => void, () => void] {\n // Get initial value from localStorage or use default\n const [storedValue, setStoredValue] = useState<T>(() => {\n if (typeof window === 'undefined') {\n return initialValue\n }\n\n try {\n const item = window.localStorage.getItem(key)\n return item ? (JSON.parse(item) as T) : initialValue\n } catch {\n return initialValue\n }\n })\n\n // Update localStorage when value changes\n const setValue = useCallback(\n (value: T | ((prev: T) => T)) => {\n setStoredValue(prev => {\n const valueToStore = value instanceof Function ? value(prev) : value\n\n if (typeof window !== 'undefined') {\n try {\n window.localStorage.setItem(key, JSON.stringify(valueToStore))\n } catch (error) {\n console.warn(`Failed to save to localStorage key \"${key}\":`, error)\n }\n }\n\n return valueToStore\n })\n },\n [key]\n )\n\n // Remove from localStorage\n const removeValue = useCallback(() => {\n if (typeof window !== 'undefined') {\n try {\n window.localStorage.removeItem(key)\n } catch (error) {\n console.warn(`Failed to remove localStorage key \"${key}\":`, error)\n }\n }\n setStoredValue(initialValue)\n }, [key, initialValue])\n\n // Sync with other tabs/windows\n useEffect(() => {\n const handleStorageChange = (e: StorageEvent) => {\n if (e.key === key && e.newValue !== null) {\n try {\n setStoredValue(JSON.parse(e.newValue) as T)\n } catch {\n // Ignore parse errors\n }\n }\n }\n\n window.addEventListener('storage', handleStorageChange)\n return () => window.removeEventListener('storage', handleStorageChange)\n }, [key])\n\n return [storedValue, setValue, removeValue]\n}\n"],"names":["useLocalStorage","key","initialValue","storedValue","setStoredValue","useState","item","setValue","useCallback","value","prev","valueToStore","error","removeValue","useEffect","handleStorageChange","e"],"mappings":";AAaO,SAASA,EACdC,GACAC,GACwD;AAExD,QAAM,CAACC,GAAaC,CAAc,IAAIC,EAAY,MAAM;AACtD,QAAI,OAAO,SAAW;AACpB,aAAOH;AAGT,QAAI;AACF,YAAMI,IAAO,OAAO,aAAa,QAAQL,CAAG;AAC5C,aAAOK,IAAQ,KAAK,MAAMA,CAAI,IAAUJ;AAAA,IAC1C,QAAQ;AACN,aAAOA;AAAA,IACT;AAAA,EACF,CAAC,GAGKK,IAAWC;AAAA,IACf,CAACC,MAAgC;AAC/B,MAAAL,EAAe,CAAAM,MAAQ;AACrB,cAAMC,IAAeF,aAAiB,WAAWA,EAAMC,CAAI,IAAID;AAE/D,YAAI,OAAO,SAAW;AACpB,cAAI;AACF,mBAAO,aAAa,QAAQR,GAAK,KAAK,UAAUU,CAAY,CAAC;AAAA,UAC/D,SAASC,GAAO;AACd,oBAAQ,KAAK,uCAAuCX,CAAG,MAAMW,CAAK;AAAA,UACpE;AAGF,eAAOD;AAAA,MACT,CAAC;AAAA,IACH;AAAA,IACA,CAACV,CAAG;AAAA,EAAA,GAIAY,IAAcL,EAAY,MAAM;AACpC,QAAI,OAAO,SAAW;AACpB,UAAI;AACF,eAAO,aAAa,WAAWP,CAAG;AAAA,MACpC,SAASW,GAAO;AACd,gBAAQ,KAAK,sCAAsCX,CAAG,MAAMW,CAAK;AAAA,MACnE;AAEF,IAAAR,EAAeF,CAAY;AAAA,EAC7B,GAAG,CAACD,GAAKC,CAAY,CAAC;AAGtB,SAAAY,EAAU,MAAM;AACd,UAAMC,IAAsB,CAACC,MAAoB;AAC/C,UAAIA,EAAE,QAAQf,KAAOe,EAAE,aAAa;AAClC,YAAI;AACF,UAAAZ,EAAe,KAAK,MAAMY,EAAE,QAAQ,CAAM;AAAA,QAC5C,QAAQ;AAAA,QAER;AAAA,IAEJ;AAEA,kBAAO,iBAAiB,WAAWD,CAAmB,GAC/C,MAAM,OAAO,oBAAoB,WAAWA,CAAmB;AAAA,EACxE,GAAG,CAACd,CAAG,CAAC,GAED,CAACE,GAAaI,GAAUM,CAAW;AAC5C;"}
package/dist/index98.js CHANGED
@@ -1,18 +1,16 @@
1
- import { useRef as s, useEffect as c } from "react";
2
- function m(t, n = !0) {
3
- const r = s(null);
1
+ import { useState as r, useEffect as c } from "react";
2
+ function i(e, t = 300) {
3
+ const [o, u] = r(e);
4
4
  return c(() => {
5
- if (!n) return;
6
- const e = (o) => {
7
- const u = r.current;
8
- !u || u.contains(o.target) || t(o);
5
+ const n = setTimeout(() => {
6
+ u(e);
7
+ }, t);
8
+ return () => {
9
+ clearTimeout(n);
9
10
  };
10
- return document.addEventListener("mousedown", e), document.addEventListener("touchstart", e), () => {
11
- document.removeEventListener("mousedown", e), document.removeEventListener("touchstart", e);
12
- };
13
- }, [t, n]), r;
11
+ }, [e, t]), o;
14
12
  }
15
13
  export {
16
- m as useClickOutside
14
+ i as useDebounce
17
15
  };
18
16
  //# sourceMappingURL=index98.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index98.js","sources":["../src/hooks/useClickOutside.ts"],"sourcesContent":["import { useEffect, useRef, type RefObject } from 'react'\n\n/**\n * Hook that detects clicks outside of a referenced element.\n * Useful for closing dropdowns, modals, or menus.\n *\n * @param handler - Callback when click outside is detected\n * @param enabled - Whether the listener is active (default: true)\n * @returns Ref to attach to the element\n *\n * @example\n * const ref = useClickOutside(() => setIsOpen(false))\n *\n * <div ref={ref}>\n * <Dropdown>...</Dropdown>\n * </div>\n */\nexport function useClickOutside<T extends HTMLElement = HTMLElement>(\n handler: (event: MouseEvent | TouchEvent) => void,\n enabled = true\n): RefObject<T | null> {\n const ref = useRef<T>(null)\n\n useEffect(() => {\n if (!enabled) return\n\n const listener = (event: MouseEvent | TouchEvent) => {\n const el = ref.current\n if (!el || el.contains(event.target as Node)) {\n return\n }\n handler(event)\n }\n\n document.addEventListener('mousedown', listener)\n document.addEventListener('touchstart', listener)\n\n return () => {\n document.removeEventListener('mousedown', listener)\n document.removeEventListener('touchstart', listener)\n }\n }, [handler, enabled])\n\n return ref\n}\n"],"names":["useClickOutside","handler","enabled","ref","useRef","useEffect","listener","event","el"],"mappings":";AAiBO,SAASA,EACdC,GACAC,IAAU,IACW;AACrB,QAAMC,IAAMC,EAAU,IAAI;AAE1B,SAAAC,EAAU,MAAM;AACd,QAAI,CAACH,EAAS;AAEd,UAAMI,IAAW,CAACC,MAAmC;AACnD,YAAMC,IAAKL,EAAI;AACf,MAAI,CAACK,KAAMA,EAAG,SAASD,EAAM,MAAc,KAG3CN,EAAQM,CAAK;AAAA,IACf;AAEA,oBAAS,iBAAiB,aAAaD,CAAQ,GAC/C,SAAS,iBAAiB,cAAcA,CAAQ,GAEzC,MAAM;AACX,eAAS,oBAAoB,aAAaA,CAAQ,GAClD,SAAS,oBAAoB,cAAcA,CAAQ;AAAA,IACrD;AAAA,EACF,GAAG,CAACL,GAASC,CAAO,CAAC,GAEdC;AACT;"}
1
+ {"version":3,"file":"index98.js","sources":["../src/hooks/useDebounce.ts"],"sourcesContent":["import { useState, useEffect } from 'react'\n\n/**\n * Hook that delays updating a value until after a specified delay.\n * Useful for search inputs to avoid excessive API calls.\n *\n * @param value - Value to debounce\n * @param delay - Delay in milliseconds (default: 300)\n * @returns Debounced value\n *\n * @example\n * const [search, setSearch] = useState('')\n * const debouncedSearch = useDebounce(search, 500)\n *\n * useEffect(() => {\n * // This runs 500ms after user stops typing\n * fetchResults(debouncedSearch)\n * }, [debouncedSearch])\n */\nexport function useDebounce<T>(value: T, delay = 300): T {\n const [debouncedValue, setDebouncedValue] = useState<T>(value)\n\n useEffect(() => {\n const timer = setTimeout(() => {\n setDebouncedValue(value)\n }, delay)\n\n return () => {\n clearTimeout(timer)\n }\n }, [value, delay])\n\n return debouncedValue\n}\n"],"names":["useDebounce","value","delay","debouncedValue","setDebouncedValue","useState","useEffect","timer"],"mappings":";AAmBO,SAASA,EAAeC,GAAUC,IAAQ,KAAQ;AACvD,QAAM,CAACC,GAAgBC,CAAiB,IAAIC,EAAYJ,CAAK;AAE7D,SAAAK,EAAU,MAAM;AACd,UAAMC,IAAQ,WAAW,MAAM;AAC7B,MAAAH,EAAkBH,CAAK;AAAA,IACzB,GAAGC,CAAK;AAER,WAAO,MAAM;AACX,mBAAaK,CAAK;AAAA,IACpB;AAAA,EACF,GAAG,CAACN,GAAOC,CAAK,CAAC,GAEVC;AACT;"}
package/dist/index99.js CHANGED
@@ -1,11 +1,18 @@
1
- import { useRef as t, useEffect as o } from "react";
2
- function f(r) {
3
- const e = t(void 0);
4
- return o(() => {
5
- e.current = r;
6
- }, [r]), e.current;
1
+ import { useRef as s, useEffect as c } from "react";
2
+ function m(t, n = !0) {
3
+ const r = s(null);
4
+ return c(() => {
5
+ if (!n) return;
6
+ const e = (o) => {
7
+ const u = r.current;
8
+ !u || u.contains(o.target) || t(o);
9
+ };
10
+ return document.addEventListener("mousedown", e), document.addEventListener("touchstart", e), () => {
11
+ document.removeEventListener("mousedown", e), document.removeEventListener("touchstart", e);
12
+ };
13
+ }, [t, n]), r;
7
14
  }
8
15
  export {
9
- f as usePrevious
16
+ m as useClickOutside
10
17
  };
11
18
  //# sourceMappingURL=index99.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index99.js","sources":["../src/hooks/usePrevious.ts"],"sourcesContent":["import { useRef, useEffect } from 'react'\n\n/**\n * Hook that returns the previous value of a variable.\n * Useful for comparing current and previous values in effects.\n *\n * @param value - Current value\n * @returns Previous value (undefined on first render)\n *\n * @example\n * const [count, setCount] = useState(0)\n * const prevCount = usePrevious(count)\n *\n * // prevCount is the value from previous render\n * console.log(`Changed from ${prevCount} to ${count}`)\n */\nexport function usePrevious<T>(value: T): T | undefined {\n const ref = useRef<T | undefined>(undefined)\n\n useEffect(() => {\n ref.current = value\n }, [value])\n\n return ref.current\n}\n"],"names":["usePrevious","value","ref","useRef","useEffect"],"mappings":";AAgBO,SAASA,EAAeC,GAAyB;AACtD,QAAMC,IAAMC,EAAsB,MAAS;AAE3C,SAAAC,EAAU,MAAM;AACd,IAAAF,EAAI,UAAUD;AAAA,EAChB,GAAG,CAACA,CAAK,CAAC,GAEHC,EAAI;AACb;"}
1
+ {"version":3,"file":"index99.js","sources":["../src/hooks/useClickOutside.ts"],"sourcesContent":["import { useEffect, useRef, type RefObject } from 'react'\n\n/**\n * Hook that detects clicks outside of a referenced element.\n * Useful for closing dropdowns, modals, or menus.\n *\n * @param handler - Callback when click outside is detected\n * @param enabled - Whether the listener is active (default: true)\n * @returns Ref to attach to the element\n *\n * @example\n * const ref = useClickOutside(() => setIsOpen(false))\n *\n * <div ref={ref}>\n * <Dropdown>...</Dropdown>\n * </div>\n */\nexport function useClickOutside<T extends HTMLElement = HTMLElement>(\n handler: (event: MouseEvent | TouchEvent) => void,\n enabled = true\n): RefObject<T | null> {\n const ref = useRef<T>(null)\n\n useEffect(() => {\n if (!enabled) return\n\n const listener = (event: MouseEvent | TouchEvent) => {\n const el = ref.current\n if (!el || el.contains(event.target as Node)) {\n return\n }\n handler(event)\n }\n\n document.addEventListener('mousedown', listener)\n document.addEventListener('touchstart', listener)\n\n return () => {\n document.removeEventListener('mousedown', listener)\n document.removeEventListener('touchstart', listener)\n }\n }, [handler, enabled])\n\n return ref\n}\n"],"names":["useClickOutside","handler","enabled","ref","useRef","useEffect","listener","event","el"],"mappings":";AAiBO,SAASA,EACdC,GACAC,IAAU,IACW;AACrB,QAAMC,IAAMC,EAAU,IAAI;AAE1B,SAAAC,EAAU,MAAM;AACd,QAAI,CAACH,EAAS;AAEd,UAAMI,IAAW,CAACC,MAAmC;AACnD,YAAMC,IAAKL,EAAI;AACf,MAAI,CAACK,KAAMA,EAAG,SAASD,EAAM,MAAc,KAG3CN,EAAQM,CAAK;AAAA,IACf;AAEA,oBAAS,iBAAiB,aAAaD,CAAQ,GAC/C,SAAS,iBAAiB,cAAcA,CAAQ,GAEzC,MAAM;AACX,eAAS,oBAAoB,aAAaA,CAAQ,GAClD,SAAS,oBAAoB,cAAcA,CAAQ;AAAA,IACrD;AAAA,EACF,GAAG,CAACL,GAASC,CAAO,CAAC,GAEdC;AACT;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asterui",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "React UI component library with DaisyUI",
5
5
  "homepage": "https://asterui.com",
6
6
  "repository": {