asterui 0.12.6 → 0.12.8

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 (176) hide show
  1. package/dist/components/Container.d.ts +7 -1
  2. package/dist/components/Fieldset.d.ts +6 -0
  3. package/dist/components/Filter.d.ts +27 -0
  4. package/dist/components/FloatButton.d.ts +50 -11
  5. package/dist/components/Grid.d.ts +1 -1
  6. package/dist/components/Modal.d.ts +7 -2
  7. package/dist/components/ThemeController.d.ts +12 -4
  8. package/dist/index.d.ts +4 -2
  9. package/dist/index.js +167 -165
  10. package/dist/index.js.map +1 -1
  11. package/dist/index100.js +44 -11
  12. package/dist/index100.js.map +1 -1
  13. package/dist/index101.js +10 -12
  14. package/dist/index101.js.map +1 -1
  15. package/dist/index102.js +14 -7
  16. package/dist/index102.js.map +1 -1
  17. package/dist/index103.js +7 -12
  18. package/dist/index103.js.map +1 -1
  19. package/dist/index104.js +11 -29
  20. package/dist/index104.js.map +1 -1
  21. package/dist/index105.js +29 -16
  22. package/dist/index105.js.map +1 -1
  23. package/dist/index106.js +21 -0
  24. package/dist/index106.js.map +1 -0
  25. package/dist/index18.js +23 -15
  26. package/dist/index18.js.map +1 -1
  27. package/dist/index2.js +41 -34
  28. package/dist/index2.js.map +1 -1
  29. package/dist/index21.js +1 -1
  30. package/dist/index25.js +8 -8
  31. package/dist/index25.js.map +1 -1
  32. package/dist/index27.js +13 -8
  33. package/dist/index27.js.map +1 -1
  34. package/dist/index29.js +50 -61
  35. package/dist/index29.js.map +1 -1
  36. package/dist/index30.js +60 -77
  37. package/dist/index30.js.map +1 -1
  38. package/dist/index31.js +184 -18
  39. package/dist/index31.js.map +1 -1
  40. package/dist/index32.js +15 -217
  41. package/dist/index32.js.map +1 -1
  42. package/dist/index33.js +216 -1078
  43. package/dist/index33.js.map +1 -1
  44. package/dist/index34.js +1086 -17
  45. package/dist/index34.js.map +1 -1
  46. package/dist/index35.js +17 -121
  47. package/dist/index35.js.map +1 -1
  48. package/dist/index36.js +119 -37
  49. package/dist/index36.js.map +1 -1
  50. package/dist/index37.js +34 -208
  51. package/dist/index37.js.map +1 -1
  52. package/dist/index38.js +214 -97
  53. package/dist/index38.js.map +1 -1
  54. package/dist/index39.js +93 -158
  55. package/dist/index39.js.map +1 -1
  56. package/dist/index40.js +155 -139
  57. package/dist/index40.js.map +1 -1
  58. package/dist/index41.js +146 -15
  59. package/dist/index41.js.map +1 -1
  60. package/dist/index42.js +15 -17
  61. package/dist/index42.js.map +1 -1
  62. package/dist/index43.js +17 -21
  63. package/dist/index43.js.map +1 -1
  64. package/dist/index44.js +18 -116
  65. package/dist/index44.js.map +1 -1
  66. package/dist/index45.js +116 -10
  67. package/dist/index45.js.map +1 -1
  68. package/dist/index46.js +13 -35
  69. package/dist/index46.js.map +1 -1
  70. package/dist/index47.js +35 -34
  71. package/dist/index47.js.map +1 -1
  72. package/dist/index48.js +34 -116
  73. package/dist/index48.js.map +1 -1
  74. package/dist/index49.js +114 -174
  75. package/dist/index49.js.map +1 -1
  76. package/dist/index50.js +165 -136
  77. package/dist/index50.js.map +1 -1
  78. package/dist/index51.js +146 -11
  79. package/dist/index51.js.map +1 -1
  80. package/dist/index52.js +10 -20
  81. package/dist/index52.js.map +1 -1
  82. package/dist/index53.js +22 -14
  83. package/dist/index53.js.map +1 -1
  84. package/dist/index54.js +14 -7
  85. package/dist/index54.js.map +1 -1
  86. package/dist/index55.js +6 -268
  87. package/dist/index55.js.map +1 -1
  88. package/dist/index56.js +311 -17
  89. package/dist/index56.js.map +1 -1
  90. package/dist/index57.js +17 -122
  91. package/dist/index57.js.map +1 -1
  92. package/dist/index58.js +120 -108
  93. package/dist/index58.js.map +1 -1
  94. package/dist/index59.js +107 -167
  95. package/dist/index59.js.map +1 -1
  96. package/dist/index60.js +167 -29
  97. package/dist/index60.js.map +1 -1
  98. package/dist/index61.js +30 -120
  99. package/dist/index61.js.map +1 -1
  100. package/dist/index62.js +116 -80
  101. package/dist/index62.js.map +1 -1
  102. package/dist/index63.js +85 -19
  103. package/dist/index63.js.map +1 -1
  104. package/dist/index64.js +19 -73
  105. package/dist/index64.js.map +1 -1
  106. package/dist/index65.js +71 -54
  107. package/dist/index65.js.map +1 -1
  108. package/dist/index66.js +56 -44
  109. package/dist/index66.js.map +1 -1
  110. package/dist/index67.js +42 -49
  111. package/dist/index67.js.map +1 -1
  112. package/dist/index68.js +52 -62
  113. package/dist/index68.js.map +1 -1
  114. package/dist/index69.js +56 -101
  115. package/dist/index69.js.map +1 -1
  116. package/dist/index70.js +107 -41
  117. package/dist/index70.js.map +1 -1
  118. package/dist/index71.js +41 -68
  119. package/dist/index71.js.map +1 -1
  120. package/dist/index72.js +66 -19
  121. package/dist/index72.js.map +1 -1
  122. package/dist/index73.js +18 -43
  123. package/dist/index73.js.map +1 -1
  124. package/dist/index74.js +44 -132
  125. package/dist/index74.js.map +1 -1
  126. package/dist/index75.js +132 -50
  127. package/dist/index75.js.map +1 -1
  128. package/dist/index76.js +51 -21
  129. package/dist/index76.js.map +1 -1
  130. package/dist/index77.js +22 -31
  131. package/dist/index77.js.map +1 -1
  132. package/dist/index78.js +31 -22
  133. package/dist/index78.js.map +1 -1
  134. package/dist/index79.js +20 -327
  135. package/dist/index79.js.map +1 -1
  136. package/dist/index80.js +323 -50
  137. package/dist/index80.js.map +1 -1
  138. package/dist/index81.js +56 -40
  139. package/dist/index81.js.map +1 -1
  140. package/dist/index82.js +40 -23
  141. package/dist/index82.js.map +1 -1
  142. package/dist/index83.js +21 -93
  143. package/dist/index83.js.map +1 -1
  144. package/dist/index84.js +88 -123
  145. package/dist/index84.js.map +1 -1
  146. package/dist/index85.js +147 -152
  147. package/dist/index85.js.map +1 -1
  148. package/dist/index86.js +159 -63
  149. package/dist/index86.js.map +1 -1
  150. package/dist/index87.js +65 -35
  151. package/dist/index87.js.map +1 -1
  152. package/dist/index88.js +35 -234
  153. package/dist/index88.js.map +1 -1
  154. package/dist/index89.js +231 -31
  155. package/dist/index89.js.map +1 -1
  156. package/dist/index90.js +34 -210
  157. package/dist/index90.js.map +1 -1
  158. package/dist/index91.js +195 -198
  159. package/dist/index91.js.map +1 -1
  160. package/dist/index92.js +159 -241
  161. package/dist/index92.js.map +1 -1
  162. package/dist/index93.js +283 -166
  163. package/dist/index93.js.map +1 -1
  164. package/dist/index94.js +173 -253
  165. package/dist/index94.js.map +1 -1
  166. package/dist/index95.js +258 -14
  167. package/dist/index95.js.map +1 -1
  168. package/dist/index96.js +12 -31
  169. package/dist/index96.js.map +1 -1
  170. package/dist/index97.js +32 -5
  171. package/dist/index97.js.map +1 -1
  172. package/dist/index98.js +5 -13
  173. package/dist/index98.js.map +1 -1
  174. package/dist/index99.js +11 -43
  175. package/dist/index99.js.map +1 -1
  176. package/package.json +2 -2
package/dist/index100.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=index100.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index100.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":"index100.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/index101.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=index101.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index101.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":"index101.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/index102.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=index102.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index102.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":"index102.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/dist/index103.js CHANGED
@@ -1,16 +1,11 @@
1
- import { useState as u, useRef as v, useEffect as a } from "react";
2
- function f() {
3
- const [o, t] = u(!1), n = v(null);
4
- return a(() => {
5
- const e = n.current;
6
- if (!e) return;
7
- const r = () => t(!0), s = () => t(!1);
8
- return e.addEventListener("mouseenter", r), e.addEventListener("mouseleave", s), () => {
9
- e.removeEventListener("mouseenter", r), e.removeEventListener("mouseleave", s);
10
- };
11
- }, []), { ref: n, isHovered: o };
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;
12
7
  }
13
8
  export {
14
- f as useHover
9
+ f as usePrevious
15
10
  };
16
11
  //# sourceMappingURL=index103.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index103.js","sources":["../src/hooks/useHover.ts"],"sourcesContent":["import { useState, useRef, useEffect, type RefObject } from 'react'\n\nexport interface UseHoverReturn<T extends HTMLElement> {\n ref: RefObject<T | null>\n isHovered: boolean\n}\n\n/**\n * Hook that tracks hover state of an element.\n *\n * @returns Object with ref and isHovered state\n *\n * @example\n * const { ref, isHovered } = useHover<HTMLDivElement>()\n *\n * <div ref={ref} className={isHovered ? 'bg-blue-500' : 'bg-gray-500'}>\n * Hover me!\n * </div>\n */\nexport function useHover<T extends HTMLElement = HTMLElement>(): UseHoverReturn<T> {\n const [isHovered, setIsHovered] = useState(false)\n const ref = useRef<T>(null)\n\n useEffect(() => {\n const node = ref.current\n if (!node) return\n\n const handleMouseEnter = () => setIsHovered(true)\n const handleMouseLeave = () => setIsHovered(false)\n\n node.addEventListener('mouseenter', handleMouseEnter)\n node.addEventListener('mouseleave', handleMouseLeave)\n\n return () => {\n node.removeEventListener('mouseenter', handleMouseEnter)\n node.removeEventListener('mouseleave', handleMouseLeave)\n }\n }, [])\n\n return { ref, isHovered }\n}\n"],"names":["useHover","isHovered","setIsHovered","useState","ref","useRef","useEffect","node","handleMouseEnter","handleMouseLeave"],"mappings":";AAmBO,SAASA,IAAmE;AACjF,QAAM,CAACC,GAAWC,CAAY,IAAIC,EAAS,EAAK,GAC1CC,IAAMC,EAAU,IAAI;AAE1B,SAAAC,EAAU,MAAM;AACd,UAAMC,IAAOH,EAAI;AACjB,QAAI,CAACG,EAAM;AAEX,UAAMC,IAAmB,MAAMN,EAAa,EAAI,GAC1CO,IAAmB,MAAMP,EAAa,EAAK;AAEjD,WAAAK,EAAK,iBAAiB,cAAcC,CAAgB,GACpDD,EAAK,iBAAiB,cAAcE,CAAgB,GAE7C,MAAM;AACX,MAAAF,EAAK,oBAAoB,cAAcC,CAAgB,GACvDD,EAAK,oBAAoB,cAAcE,CAAgB;AAAA,IACzD;AAAA,EACF,GAAG,CAAA,CAAE,GAEE,EAAE,KAAAL,GAAK,WAAAH,EAAA;AAChB;"}
1
+ {"version":3,"file":"index103.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;"}
package/dist/index104.js CHANGED
@@ -1,34 +1,16 @@
1
- import { useState as v, useCallback as i, useEffect as l } from "react";
2
- function c(n, f = {}) {
3
- const { target: u, event: o = "keydown", preventDefault: r = !1 } = f, [a, d] = v(!1), t = i(
4
- (e) => {
5
- e.key === n && (r && e.preventDefault(), d(!0));
6
- },
7
- [n, r]
8
- ), s = i(
9
- (e) => {
10
- e.key === n && d(!1);
11
- },
12
- [n]
13
- );
14
- return l(() => {
15
- const e = u ?? window;
16
- return o === "keydown" ? (e.addEventListener("keydown", t), e.addEventListener("keyup", s)) : e.addEventListener("keyup", t), () => {
17
- e.removeEventListener("keydown", t), e.removeEventListener("keyup", s);
1
+ import { useState as u, useRef as v, useEffect as a } from "react";
2
+ function f() {
3
+ const [o, t] = u(!1), n = v(null);
4
+ return a(() => {
5
+ const e = n.current;
6
+ if (!e) return;
7
+ const r = () => t(!0), s = () => t(!1);
8
+ return e.addEventListener("mouseenter", r), e.addEventListener("mouseleave", s), () => {
9
+ e.removeEventListener("mouseenter", r), e.removeEventListener("mouseleave", s);
18
10
  };
19
- }, [u, o, t, s]), a;
20
- }
21
- function y(n, f, u = {}) {
22
- const { target: o, event: r = "keydown", preventDefault: a = !1 } = u;
23
- l(() => {
24
- const d = o ?? window, t = (s) => {
25
- s.key === n && (a && s.preventDefault(), f(s));
26
- };
27
- return d.addEventListener(r, t), () => d.removeEventListener(r, t);
28
- }, [o, n, f, r, a]);
11
+ }, []), { ref: n, isHovered: o };
29
12
  }
30
13
  export {
31
- c as useKeyPress,
32
- y as useKeyPressCallback
14
+ f as useHover
33
15
  };
34
16
  //# sourceMappingURL=index104.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index104.js","sources":["../src/hooks/useKeyPress.ts"],"sourcesContent":["import { useState, useEffect, useCallback } from 'react'\n\nexport interface UseKeyPressOptions {\n /** Target element (default: window) */\n target?: HTMLElement | Window | null\n /** Event type: 'keydown' | 'keyup' (default: 'keydown') */\n event?: 'keydown' | 'keyup'\n /** Prevent default browser behavior */\n preventDefault?: boolean\n}\n\n/**\n * Hook that detects when a specific key is pressed.\n *\n * @param targetKey - Key to detect (e.g., 'Enter', 'Escape', 'a')\n * @param options - Configuration options\n * @returns Whether the key is currently pressed\n *\n * @example\n * const enterPressed = useKeyPress('Enter')\n * const escapePressed = useKeyPress('Escape')\n *\n * useEffect(() => {\n * if (escapePressed) closeModal()\n * }, [escapePressed])\n *\n * @example\n * // With callback for immediate action\n * useKeyPress('Escape', { preventDefault: true })\n */\nexport function useKeyPress(\n targetKey: string,\n options: UseKeyPressOptions = {}\n): boolean {\n const { target, event = 'keydown', preventDefault = false } = options\n const [keyPressed, setKeyPressed] = useState(false)\n\n const downHandler = useCallback(\n (e: KeyboardEvent) => {\n if (e.key === targetKey) {\n if (preventDefault) e.preventDefault()\n setKeyPressed(true)\n }\n },\n [targetKey, preventDefault]\n )\n\n const upHandler = useCallback(\n (e: KeyboardEvent) => {\n if (e.key === targetKey) {\n setKeyPressed(false)\n }\n },\n [targetKey]\n )\n\n useEffect(() => {\n const targetElement = target ?? window\n\n if (event === 'keydown') {\n targetElement.addEventListener('keydown', downHandler as EventListener)\n targetElement.addEventListener('keyup', upHandler as EventListener)\n } else {\n targetElement.addEventListener('keyup', downHandler as EventListener)\n }\n\n return () => {\n targetElement.removeEventListener('keydown', downHandler as EventListener)\n targetElement.removeEventListener('keyup', upHandler as EventListener)\n }\n }, [target, event, downHandler, upHandler])\n\n return keyPressed\n}\n\n/**\n * Hook that calls a callback when a specific key is pressed.\n *\n * @param targetKey - Key to detect\n * @param callback - Function to call when key is pressed\n * @param options - Configuration options\n *\n * @example\n * useKeyPressCallback('Escape', () => closeModal())\n * useKeyPressCallback('Enter', () => submitForm(), { preventDefault: true })\n */\nexport function useKeyPressCallback(\n targetKey: string,\n callback: (event: KeyboardEvent) => void,\n options: UseKeyPressOptions = {}\n): void {\n const { target, event = 'keydown', preventDefault = false } = options\n\n useEffect(() => {\n const targetElement = target ?? window\n\n const handler = (e: KeyboardEvent) => {\n if (e.key === targetKey) {\n if (preventDefault) e.preventDefault()\n callback(e)\n }\n }\n\n targetElement.addEventListener(event, handler as EventListener)\n return () => targetElement.removeEventListener(event, handler as EventListener)\n }, [target, targetKey, callback, event, preventDefault])\n}\n"],"names":["useKeyPress","targetKey","options","target","event","preventDefault","keyPressed","setKeyPressed","useState","downHandler","useCallback","upHandler","useEffect","targetElement","useKeyPressCallback","callback","handler","e"],"mappings":";AA8BO,SAASA,EACdC,GACAC,IAA8B,IACrB;AACT,QAAM,EAAE,QAAAC,GAAQ,OAAAC,IAAQ,WAAW,gBAAAC,IAAiB,OAAUH,GACxD,CAACI,GAAYC,CAAa,IAAIC,EAAS,EAAK,GAE5CC,IAAcC;AAAA,IAClB,CAAC,MAAqB;AACpB,MAAI,EAAE,QAAQT,MACRI,OAAkB,eAAA,GACtBE,EAAc,EAAI;AAAA,IAEtB;AAAA,IACA,CAACN,GAAWI,CAAc;AAAA,EAAA,GAGtBM,IAAYD;AAAA,IAChB,CAAC,MAAqB;AACpB,MAAI,EAAE,QAAQT,KACZM,EAAc,EAAK;AAAA,IAEvB;AAAA,IACA,CAACN,CAAS;AAAA,EAAA;AAGZ,SAAAW,EAAU,MAAM;AACd,UAAMC,IAAgBV,KAAU;AAEhC,WAAIC,MAAU,aACZS,EAAc,iBAAiB,WAAWJ,CAA4B,GACtEI,EAAc,iBAAiB,SAASF,CAA0B,KAElEE,EAAc,iBAAiB,SAASJ,CAA4B,GAG/D,MAAM;AACX,MAAAI,EAAc,oBAAoB,WAAWJ,CAA4B,GACzEI,EAAc,oBAAoB,SAASF,CAA0B;AAAA,IACvE;AAAA,EACF,GAAG,CAACR,GAAQC,GAAOK,GAAaE,CAAS,CAAC,GAEnCL;AACT;AAaO,SAASQ,EACdb,GACAc,GACAb,IAA8B,CAAA,GACxB;AACN,QAAM,EAAE,QAAAC,GAAQ,OAAAC,IAAQ,WAAW,gBAAAC,IAAiB,OAAUH;AAE9D,EAAAU,EAAU,MAAM;AACd,UAAMC,IAAgBV,KAAU,QAE1Ba,IAAU,CAACC,MAAqB;AACpC,MAAIA,EAAE,QAAQhB,MACRI,OAAkB,eAAA,GACtBU,EAASE,CAAC;AAAA,IAEd;AAEA,WAAAJ,EAAc,iBAAiBT,GAAOY,CAAwB,GACvD,MAAMH,EAAc,oBAAoBT,GAAOY,CAAwB;AAAA,EAChF,GAAG,CAACb,GAAQF,GAAWc,GAAUX,GAAOC,CAAc,CAAC;AACzD;"}
1
+ {"version":3,"file":"index104.js","sources":["../src/hooks/useHover.ts"],"sourcesContent":["import { useState, useRef, useEffect, type RefObject } from 'react'\n\nexport interface UseHoverReturn<T extends HTMLElement> {\n ref: RefObject<T | null>\n isHovered: boolean\n}\n\n/**\n * Hook that tracks hover state of an element.\n *\n * @returns Object with ref and isHovered state\n *\n * @example\n * const { ref, isHovered } = useHover<HTMLDivElement>()\n *\n * <div ref={ref} className={isHovered ? 'bg-blue-500' : 'bg-gray-500'}>\n * Hover me!\n * </div>\n */\nexport function useHover<T extends HTMLElement = HTMLElement>(): UseHoverReturn<T> {\n const [isHovered, setIsHovered] = useState(false)\n const ref = useRef<T>(null)\n\n useEffect(() => {\n const node = ref.current\n if (!node) return\n\n const handleMouseEnter = () => setIsHovered(true)\n const handleMouseLeave = () => setIsHovered(false)\n\n node.addEventListener('mouseenter', handleMouseEnter)\n node.addEventListener('mouseleave', handleMouseLeave)\n\n return () => {\n node.removeEventListener('mouseenter', handleMouseEnter)\n node.removeEventListener('mouseleave', handleMouseLeave)\n }\n }, [])\n\n return { ref, isHovered }\n}\n"],"names":["useHover","isHovered","setIsHovered","useState","ref","useRef","useEffect","node","handleMouseEnter","handleMouseLeave"],"mappings":";AAmBO,SAASA,IAAmE;AACjF,QAAM,CAACC,GAAWC,CAAY,IAAIC,EAAS,EAAK,GAC1CC,IAAMC,EAAU,IAAI;AAE1B,SAAAC,EAAU,MAAM;AACd,UAAMC,IAAOH,EAAI;AACjB,QAAI,CAACG,EAAM;AAEX,UAAMC,IAAmB,MAAMN,EAAa,EAAI,GAC1CO,IAAmB,MAAMP,EAAa,EAAK;AAEjD,WAAAK,EAAK,iBAAiB,cAAcC,CAAgB,GACpDD,EAAK,iBAAiB,cAAcE,CAAgB,GAE7C,MAAM;AACX,MAAAF,EAAK,oBAAoB,cAAcC,CAAgB,GACvDD,EAAK,oBAAoB,cAAcE,CAAgB;AAAA,IACzD;AAAA,EACF,GAAG,CAAA,CAAE,GAEE,EAAE,KAAAL,GAAK,WAAAH,EAAA;AAChB;"}
package/dist/index105.js CHANGED
@@ -1,21 +1,34 @@
1
- import { useState as t, useEffect as d } from "react";
2
- function r() {
3
- const [i, n] = t(() => typeof window > "u" ? { width: 0, height: 0 } : {
4
- width: window.innerWidth,
5
- height: window.innerHeight
6
- });
7
- return d(() => {
8
- if (typeof window > "u") return;
9
- const e = () => {
10
- n({
11
- width: window.innerWidth,
12
- height: window.innerHeight
13
- });
1
+ import { useState as v, useCallback as i, useEffect as l } from "react";
2
+ function c(n, f = {}) {
3
+ const { target: u, event: o = "keydown", preventDefault: r = !1 } = f, [a, d] = v(!1), t = i(
4
+ (e) => {
5
+ e.key === n && (r && e.preventDefault(), d(!0));
6
+ },
7
+ [n, r]
8
+ ), s = i(
9
+ (e) => {
10
+ e.key === n && d(!1);
11
+ },
12
+ [n]
13
+ );
14
+ return l(() => {
15
+ const e = u ?? window;
16
+ return o === "keydown" ? (e.addEventListener("keydown", t), e.addEventListener("keyup", s)) : e.addEventListener("keyup", t), () => {
17
+ e.removeEventListener("keydown", t), e.removeEventListener("keyup", s);
14
18
  };
15
- return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
16
- }, []), i;
19
+ }, [u, o, t, s]), a;
20
+ }
21
+ function y(n, f, u = {}) {
22
+ const { target: o, event: r = "keydown", preventDefault: a = !1 } = u;
23
+ l(() => {
24
+ const d = o ?? window, t = (s) => {
25
+ s.key === n && (a && s.preventDefault(), f(s));
26
+ };
27
+ return d.addEventListener(r, t), () => d.removeEventListener(r, t);
28
+ }, [o, n, f, r, a]);
17
29
  }
18
30
  export {
19
- r as useWindowSize
31
+ c as useKeyPress,
32
+ y as useKeyPressCallback
20
33
  };
21
34
  //# sourceMappingURL=index105.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index105.js","sources":["../src/hooks/useWindowSize.ts"],"sourcesContent":["import { useState, useEffect } from 'react'\n\nexport interface WindowSize {\n width: number\n height: number\n}\n\n/**\n * Hook that tracks window dimensions.\n * Updates on window resize.\n *\n * @returns Object with current width and height\n *\n * @example\n * const { width, height } = useWindowSize()\n *\n * return (\n * <div>\n * Window: {width} x {height}\n * {width < 768 && <MobileNav />}\n * </div>\n * )\n */\nexport function useWindowSize(): WindowSize {\n const [windowSize, setWindowSize] = useState<WindowSize>(() => {\n if (typeof window === 'undefined') {\n return { width: 0, height: 0 }\n }\n return {\n width: window.innerWidth,\n height: window.innerHeight,\n }\n })\n\n useEffect(() => {\n if (typeof window === 'undefined') return\n\n const handleResize = () => {\n setWindowSize({\n width: window.innerWidth,\n height: window.innerHeight,\n })\n }\n\n window.addEventListener('resize', handleResize)\n return () => window.removeEventListener('resize', handleResize)\n }, [])\n\n return windowSize\n}\n"],"names":["useWindowSize","windowSize","setWindowSize","useState","useEffect","handleResize"],"mappings":";AAuBO,SAASA,IAA4B;AAC1C,QAAM,CAACC,GAAYC,CAAa,IAAIC,EAAqB,MACnD,OAAO,SAAW,MACb,EAAE,OAAO,GAAG,QAAQ,EAAA,IAEtB;AAAA,IACL,OAAO,OAAO;AAAA,IACd,QAAQ,OAAO;AAAA,EAAA,CAElB;AAED,SAAAC,EAAU,MAAM;AACd,QAAI,OAAO,SAAW,IAAa;AAEnC,UAAMC,IAAe,MAAM;AACzB,MAAAH,EAAc;AAAA,QACZ,OAAO,OAAO;AAAA,QACd,QAAQ,OAAO;AAAA,MAAA,CAChB;AAAA,IACH;AAEA,kBAAO,iBAAiB,UAAUG,CAAY,GACvC,MAAM,OAAO,oBAAoB,UAAUA,CAAY;AAAA,EAChE,GAAG,CAAA,CAAE,GAEEJ;AACT;"}
1
+ {"version":3,"file":"index105.js","sources":["../src/hooks/useKeyPress.ts"],"sourcesContent":["import { useState, useEffect, useCallback } from 'react'\n\nexport interface UseKeyPressOptions {\n /** Target element (default: window) */\n target?: HTMLElement | Window | null\n /** Event type: 'keydown' | 'keyup' (default: 'keydown') */\n event?: 'keydown' | 'keyup'\n /** Prevent default browser behavior */\n preventDefault?: boolean\n}\n\n/**\n * Hook that detects when a specific key is pressed.\n *\n * @param targetKey - Key to detect (e.g., 'Enter', 'Escape', 'a')\n * @param options - Configuration options\n * @returns Whether the key is currently pressed\n *\n * @example\n * const enterPressed = useKeyPress('Enter')\n * const escapePressed = useKeyPress('Escape')\n *\n * useEffect(() => {\n * if (escapePressed) closeModal()\n * }, [escapePressed])\n *\n * @example\n * // With callback for immediate action\n * useKeyPress('Escape', { preventDefault: true })\n */\nexport function useKeyPress(\n targetKey: string,\n options: UseKeyPressOptions = {}\n): boolean {\n const { target, event = 'keydown', preventDefault = false } = options\n const [keyPressed, setKeyPressed] = useState(false)\n\n const downHandler = useCallback(\n (e: KeyboardEvent) => {\n if (e.key === targetKey) {\n if (preventDefault) e.preventDefault()\n setKeyPressed(true)\n }\n },\n [targetKey, preventDefault]\n )\n\n const upHandler = useCallback(\n (e: KeyboardEvent) => {\n if (e.key === targetKey) {\n setKeyPressed(false)\n }\n },\n [targetKey]\n )\n\n useEffect(() => {\n const targetElement = target ?? window\n\n if (event === 'keydown') {\n targetElement.addEventListener('keydown', downHandler as EventListener)\n targetElement.addEventListener('keyup', upHandler as EventListener)\n } else {\n targetElement.addEventListener('keyup', downHandler as EventListener)\n }\n\n return () => {\n targetElement.removeEventListener('keydown', downHandler as EventListener)\n targetElement.removeEventListener('keyup', upHandler as EventListener)\n }\n }, [target, event, downHandler, upHandler])\n\n return keyPressed\n}\n\n/**\n * Hook that calls a callback when a specific key is pressed.\n *\n * @param targetKey - Key to detect\n * @param callback - Function to call when key is pressed\n * @param options - Configuration options\n *\n * @example\n * useKeyPressCallback('Escape', () => closeModal())\n * useKeyPressCallback('Enter', () => submitForm(), { preventDefault: true })\n */\nexport function useKeyPressCallback(\n targetKey: string,\n callback: (event: KeyboardEvent) => void,\n options: UseKeyPressOptions = {}\n): void {\n const { target, event = 'keydown', preventDefault = false } = options\n\n useEffect(() => {\n const targetElement = target ?? window\n\n const handler = (e: KeyboardEvent) => {\n if (e.key === targetKey) {\n if (preventDefault) e.preventDefault()\n callback(e)\n }\n }\n\n targetElement.addEventListener(event, handler as EventListener)\n return () => targetElement.removeEventListener(event, handler as EventListener)\n }, [target, targetKey, callback, event, preventDefault])\n}\n"],"names":["useKeyPress","targetKey","options","target","event","preventDefault","keyPressed","setKeyPressed","useState","downHandler","useCallback","upHandler","useEffect","targetElement","useKeyPressCallback","callback","handler","e"],"mappings":";AA8BO,SAASA,EACdC,GACAC,IAA8B,IACrB;AACT,QAAM,EAAE,QAAAC,GAAQ,OAAAC,IAAQ,WAAW,gBAAAC,IAAiB,OAAUH,GACxD,CAACI,GAAYC,CAAa,IAAIC,EAAS,EAAK,GAE5CC,IAAcC;AAAA,IAClB,CAAC,MAAqB;AACpB,MAAI,EAAE,QAAQT,MACRI,OAAkB,eAAA,GACtBE,EAAc,EAAI;AAAA,IAEtB;AAAA,IACA,CAACN,GAAWI,CAAc;AAAA,EAAA,GAGtBM,IAAYD;AAAA,IAChB,CAAC,MAAqB;AACpB,MAAI,EAAE,QAAQT,KACZM,EAAc,EAAK;AAAA,IAEvB;AAAA,IACA,CAACN,CAAS;AAAA,EAAA;AAGZ,SAAAW,EAAU,MAAM;AACd,UAAMC,IAAgBV,KAAU;AAEhC,WAAIC,MAAU,aACZS,EAAc,iBAAiB,WAAWJ,CAA4B,GACtEI,EAAc,iBAAiB,SAASF,CAA0B,KAElEE,EAAc,iBAAiB,SAASJ,CAA4B,GAG/D,MAAM;AACX,MAAAI,EAAc,oBAAoB,WAAWJ,CAA4B,GACzEI,EAAc,oBAAoB,SAASF,CAA0B;AAAA,IACvE;AAAA,EACF,GAAG,CAACR,GAAQC,GAAOK,GAAaE,CAAS,CAAC,GAEnCL;AACT;AAaO,SAASQ,EACdb,GACAc,GACAb,IAA8B,CAAA,GACxB;AACN,QAAM,EAAE,QAAAC,GAAQ,OAAAC,IAAQ,WAAW,gBAAAC,IAAiB,OAAUH;AAE9D,EAAAU,EAAU,MAAM;AACd,UAAMC,IAAgBV,KAAU,QAE1Ba,IAAU,CAACC,MAAqB;AACpC,MAAIA,EAAE,QAAQhB,MACRI,OAAkB,eAAA,GACtBU,EAASE,CAAC;AAAA,IAEd;AAEA,WAAAJ,EAAc,iBAAiBT,GAAOY,CAAwB,GACvD,MAAMH,EAAc,oBAAoBT,GAAOY,CAAwB;AAAA,EAChF,GAAG,CAACb,GAAQF,GAAWc,GAAUX,GAAOC,CAAc,CAAC;AACzD;"}
@@ -0,0 +1,21 @@
1
+ import { useState as t, useEffect as d } from "react";
2
+ function r() {
3
+ const [i, n] = t(() => typeof window > "u" ? { width: 0, height: 0 } : {
4
+ width: window.innerWidth,
5
+ height: window.innerHeight
6
+ });
7
+ return d(() => {
8
+ if (typeof window > "u") return;
9
+ const e = () => {
10
+ n({
11
+ width: window.innerWidth,
12
+ height: window.innerHeight
13
+ });
14
+ };
15
+ return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
16
+ }, []), i;
17
+ }
18
+ export {
19
+ r as useWindowSize
20
+ };
21
+ //# sourceMappingURL=index106.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index106.js","sources":["../src/hooks/useWindowSize.ts"],"sourcesContent":["import { useState, useEffect } from 'react'\n\nexport interface WindowSize {\n width: number\n height: number\n}\n\n/**\n * Hook that tracks window dimensions.\n * Updates on window resize.\n *\n * @returns Object with current width and height\n *\n * @example\n * const { width, height } = useWindowSize()\n *\n * return (\n * <div>\n * Window: {width} x {height}\n * {width < 768 && <MobileNav />}\n * </div>\n * )\n */\nexport function useWindowSize(): WindowSize {\n const [windowSize, setWindowSize] = useState<WindowSize>(() => {\n if (typeof window === 'undefined') {\n return { width: 0, height: 0 }\n }\n return {\n width: window.innerWidth,\n height: window.innerHeight,\n }\n })\n\n useEffect(() => {\n if (typeof window === 'undefined') return\n\n const handleResize = () => {\n setWindowSize({\n width: window.innerWidth,\n height: window.innerHeight,\n })\n }\n\n window.addEventListener('resize', handleResize)\n return () => window.removeEventListener('resize', handleResize)\n }, [])\n\n return windowSize\n}\n"],"names":["useWindowSize","windowSize","setWindowSize","useState","useEffect","handleResize"],"mappings":";AAuBO,SAASA,IAA4B;AAC1C,QAAM,CAACC,GAAYC,CAAa,IAAIC,EAAqB,MACnD,OAAO,SAAW,MACb,EAAE,OAAO,GAAG,QAAQ,EAAA,IAEtB;AAAA,IACL,OAAO,OAAO;AAAA,IACd,QAAQ,OAAO;AAAA,EAAA,CAElB;AAED,SAAAC,EAAU,MAAM;AACd,QAAI,OAAO,SAAW,IAAa;AAEnC,UAAMC,IAAe,MAAM;AACzB,MAAAH,EAAc;AAAA,QACZ,OAAO,OAAO;AAAA,QACd,QAAQ,OAAO;AAAA,MAAA,CAChB;AAAA,IACH;AAEA,kBAAO,iBAAiB,UAAUG,CAAY,GACvC,MAAM,OAAO,oBAAoB,UAAUA,CAAY;AAAA,EAChE,GAAG,CAAA,CAAE,GAEEJ;AACT;"}
package/dist/index18.js CHANGED
@@ -1,20 +1,28 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- const n = ({
3
- children: s,
4
- size: l = "lg",
5
- className: x = "",
6
- ...a
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ const o = {
3
+ sm: "max-w-screen-sm",
4
+ md: "max-w-screen-md",
5
+ lg: "max-w-screen-lg",
6
+ xl: "max-w-screen-xl",
7
+ "2xl": "max-w-screen-2xl",
8
+ full: "max-w-full"
9
+ }, c = ({
10
+ children: e,
11
+ size: s = "xl",
12
+ centered: l = !0,
13
+ padding: x = !0,
14
+ className: m = "",
15
+ ...r
7
16
  }) => {
8
- const m = ["mx-auto px-4 sm:px-6 lg:px-8", {
9
- sm: "max-w-2xl",
10
- md: "max-w-4xl",
11
- lg: "max-w-6xl",
12
- xl: "max-w-7xl",
13
- full: "max-w-full"
14
- }[l], x].filter(Boolean).join(" ");
15
- return /* @__PURE__ */ e("div", { className: m, ...a, children: s });
17
+ const a = [
18
+ o[s],
19
+ l && "mx-auto",
20
+ x && "px-4 sm:px-6 lg:px-8",
21
+ m
22
+ ].filter(Boolean).join(" ");
23
+ return /* @__PURE__ */ n("div", { className: a, ...r, children: e });
16
24
  };
17
25
  export {
18
- n as Container
26
+ c as Container
19
27
  };
20
28
  //# sourceMappingURL=index18.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index18.js","sources":["../src/components/Container.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface ContainerProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode\n size?: 'sm' | 'md' | 'lg' | 'xl' | 'full'\n}\n\nexport const Container: React.FC<ContainerProps> = ({\n children,\n size = 'lg',\n className = '',\n ...rest\n}) => {\n const sizeClasses = {\n sm: 'max-w-2xl',\n md: 'max-w-4xl',\n lg: 'max-w-6xl',\n xl: 'max-w-7xl',\n full: 'max-w-full',\n }\n\n const classes = ['mx-auto px-4 sm:px-6 lg:px-8', sizeClasses[size], className]\n .filter(Boolean)\n .join(' ')\n\n return <div className={classes} {...rest}>{children}</div>\n}\n"],"names":["Container","children","size","className","rest","classes"],"mappings":";AAOO,MAAMA,IAAsC,CAAC;AAAA,EAClD,UAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,MAAM;AASJ,QAAMC,IAAU,CAAC,gCARG;AAAA,IAClB,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,MAAM;AAAA,EAAA,EAGqDH,CAAI,GAAGC,CAAS,EAC1E,OAAO,OAAO,EACd,KAAK,GAAG;AAEX,2BAAQ,OAAA,EAAI,WAAWE,GAAU,GAAGD,GAAO,UAAAH,GAAS;AACtD;"}
1
+ {"version":3,"file":"index18.js","sources":["../src/components/Container.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface ContainerProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Container content */\n children: React.ReactNode\n /** Max width size */\n size?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'full'\n /** Center container horizontally */\n centered?: boolean\n /** Add horizontal padding */\n padding?: boolean\n}\n\nconst sizeClasses: Record<string, string> = {\n sm: 'max-w-screen-sm',\n md: 'max-w-screen-md',\n lg: 'max-w-screen-lg',\n xl: 'max-w-screen-xl',\n '2xl': 'max-w-screen-2xl',\n full: 'max-w-full',\n}\n\nexport const Container: React.FC<ContainerProps> = ({\n children,\n size = 'xl',\n centered = true,\n padding = true,\n className = '',\n ...rest\n}) => {\n const classes = [\n sizeClasses[size],\n centered && 'mx-auto',\n padding && 'px-4 sm:px-6 lg:px-8',\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n return <div className={classes} {...rest}>{children}</div>\n}\n"],"names":["sizeClasses","Container","children","size","centered","padding","className","rest","classes"],"mappings":";AAaA,MAAMA,IAAsC;AAAA,EAC1C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,MAAM;AACR,GAEaC,IAAsC,CAAC;AAAA,EAClD,UAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,UAAAC,IAAW;AAAA,EACX,SAAAC,IAAU;AAAA,EACV,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAU;AAAA,IACdR,EAAYG,CAAI;AAAA,IAChBC,KAAY;AAAA,IACZC,KAAW;AAAA,IACXC;AAAA,EAAA,EAEC,OAAO,OAAO,EACd,KAAK,GAAG;AAEX,2BAAQ,OAAA,EAAI,WAAWE,GAAU,GAAGD,GAAO,UAAAL,GAAS;AACtD;"}
package/dist/index2.js CHANGED
@@ -1,50 +1,57 @@
1
- import { jsxs as z, jsx as v } from "react/jsx-runtime";
2
- import { useState as f, useRef as p, useEffect as L } from "react";
3
- const H = ({
4
- children: y,
5
- offsetTop: i,
6
- offsetBottom: n,
7
- target: d,
8
- onChange: w,
9
- className: S = "",
10
- ...g
1
+ import { jsx as u, jsxs as L } from "react/jsx-runtime";
2
+ import { useState as w, useRef as S, useEffect as b } from "react";
3
+ const j = ({
4
+ children: a,
5
+ offsetTop: t,
6
+ offsetBottom: i,
7
+ target: m,
8
+ onChange: h,
9
+ className: x = "",
10
+ ...v
11
11
  }) => {
12
- const [r, m] = f(!1), [R, h] = f({}), [A, u] = f({}), s = p(null), o = p(null);
13
- return L(() => {
14
- const x = d ? d() : window, t = () => {
15
- if (!s.current || !o.current) return;
16
- const l = s.current.getBoundingClientRect(), a = o.current.getBoundingClientRect();
17
- let e = !1, c = {};
18
- if (i !== void 0)
19
- e = l.top < i, e && (c = {
12
+ const [r, R] = w(!1), [z, y] = w({}), [A, g] = w({}), l = S(null), d = S(null), o = !!m;
13
+ return b(() => {
14
+ if (o)
15
+ return;
16
+ const c = window, n = () => {
17
+ if (!l.current || !d.current) return;
18
+ const s = l.current.getBoundingClientRect(), p = d.current.getBoundingClientRect();
19
+ let e = !1, f = {};
20
+ if (t !== void 0)
21
+ e = s.top < t, e && (f = {
20
22
  position: "fixed",
21
- top: i,
22
- width: l.width,
23
+ top: t,
24
+ width: s.width,
23
25
  zIndex: 100
24
26
  });
25
- else if (n !== void 0) {
27
+ else if (i !== void 0) {
26
28
  const E = window.innerHeight;
27
- e = l.bottom > E - n, e && (c = {
29
+ e = s.bottom > E - i, e && (f = {
28
30
  position: "fixed",
29
- bottom: n,
30
- width: l.width,
31
+ bottom: i,
32
+ width: s.width,
31
33
  zIndex: 100
32
34
  });
33
35
  }
34
- e !== r && (m(e), w?.(e)), e ? (h({
35
- width: a.width,
36
- height: a.height
37
- }), u(c)) : (h({}), u({}));
36
+ e !== r && (R(e), h?.(e)), e ? (y({
37
+ width: p.width,
38
+ height: p.height
39
+ }), g(f)) : (y({}), g({}));
38
40
  };
39
- return x.addEventListener("scroll", t), window.addEventListener("resize", t), t(), () => {
40
- x.removeEventListener("scroll", t), window.removeEventListener("resize", t);
41
+ return c.addEventListener("scroll", n), window.addEventListener("resize", n), n(), () => {
42
+ c.removeEventListener("scroll", n), window.removeEventListener("resize", n);
41
43
  };
42
- }, [d, i, n, r, w]), /* @__PURE__ */ z("div", { ref: s, className: S, "data-state": r ? "affixed" : "normal", ...g, children: [
43
- r && /* @__PURE__ */ v("div", { style: R }),
44
- /* @__PURE__ */ v("div", { ref: o, style: A, children: y })
44
+ }, [o, t, i, r, h]), o ? /* @__PURE__ */ u("div", { className: x, style: {
45
+ position: "sticky",
46
+ top: t,
47
+ bottom: i,
48
+ zIndex: 100
49
+ }, ...v, children: a }) : /* @__PURE__ */ L("div", { ref: l, className: x, "data-state": r ? "affixed" : "normal", ...v, children: [
50
+ r && /* @__PURE__ */ u("div", { style: z }),
51
+ /* @__PURE__ */ u("div", { ref: d, style: A, children: a })
45
52
  ] });
46
53
  };
47
54
  export {
48
- H as Affix
55
+ j as Affix
49
56
  };
50
57
  //# sourceMappingURL=index2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index2.js","sources":["../src/components/Affix.tsx"],"sourcesContent":["import React, { useState, useEffect, useRef } from 'react'\n\nexport interface AffixProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {\n /** Content to make sticky */\n children: React.ReactNode\n /** Offset from top when fixed (pixels) */\n offsetTop?: number\n /** Offset from bottom when fixed (pixels) */\n offsetBottom?: number\n /** Scroll target (default: window) */\n target?: () => HTMLElement | Window\n /** Callback when affix state changes */\n onChange?: (affixed: boolean) => void\n}\n\nexport const Affix: React.FC<AffixProps> = ({\n children,\n offsetTop,\n offsetBottom,\n target,\n onChange,\n className = '',\n ...rest\n}) => {\n const [affixed, setAffixed] = useState(false)\n const [placeholderStyle, setPlaceholderStyle] = useState<React.CSSProperties>({})\n const [affixStyle, setAffixStyle] = useState<React.CSSProperties>({})\n const wrapperRef = useRef<HTMLDivElement>(null)\n const contentRef = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n const scrollTarget = target ? target() : window\n\n const handleScroll = () => {\n if (!wrapperRef.current || !contentRef.current) return\n\n const rect = wrapperRef.current.getBoundingClientRect()\n const contentRect = contentRef.current.getBoundingClientRect()\n\n let shouldAffix = false\n let newAffixStyle: React.CSSProperties = {}\n\n if (offsetTop !== undefined) {\n // Affix to top\n shouldAffix = rect.top < offsetTop\n if (shouldAffix) {\n newAffixStyle = {\n position: 'fixed',\n top: offsetTop,\n width: rect.width,\n zIndex: 100,\n }\n }\n } else if (offsetBottom !== undefined) {\n // Affix to bottom\n const viewportHeight = window.innerHeight\n shouldAffix = rect.bottom > viewportHeight - offsetBottom\n if (shouldAffix) {\n newAffixStyle = {\n position: 'fixed',\n bottom: offsetBottom,\n width: rect.width,\n zIndex: 100,\n }\n }\n }\n\n if (shouldAffix !== affixed) {\n setAffixed(shouldAffix)\n onChange?.(shouldAffix)\n }\n\n if (shouldAffix) {\n setPlaceholderStyle({\n width: contentRect.width,\n height: contentRect.height,\n })\n setAffixStyle(newAffixStyle)\n } else {\n setPlaceholderStyle({})\n setAffixStyle({})\n }\n }\n\n scrollTarget.addEventListener('scroll', handleScroll)\n window.addEventListener('resize', handleScroll)\n handleScroll()\n\n return () => {\n scrollTarget.removeEventListener('scroll', handleScroll)\n window.removeEventListener('resize', handleScroll)\n }\n }, [target, offsetTop, offsetBottom, affixed, onChange])\n\n return (\n <div ref={wrapperRef} className={className} data-state={affixed ? 'affixed' : 'normal'} {...rest}>\n {affixed && <div style={placeholderStyle} />}\n <div ref={contentRef} style={affixStyle}>\n {children}\n </div>\n </div>\n )\n}\n"],"names":["Affix","children","offsetTop","offsetBottom","target","onChange","className","rest","affixed","setAffixed","useState","placeholderStyle","setPlaceholderStyle","affixStyle","setAffixStyle","wrapperRef","useRef","contentRef","useEffect","scrollTarget","handleScroll","rect","contentRect","shouldAffix","newAffixStyle","viewportHeight","jsxs","jsx"],"mappings":";;AAeO,MAAMA,IAA8B,CAAC;AAAA,EAC1C,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,MAAM;AACJ,QAAM,CAACC,GAASC,CAAU,IAAIC,EAAS,EAAK,GACtC,CAACC,GAAkBC,CAAmB,IAAIF,EAA8B,CAAA,CAAE,GAC1E,CAACG,GAAYC,CAAa,IAAIJ,EAA8B,CAAA,CAAE,GAC9DK,IAAaC,EAAuB,IAAI,GACxCC,IAAaD,EAAuB,IAAI;AAE9C,SAAAE,EAAU,MAAM;AACd,UAAMC,IAAef,IAASA,EAAA,IAAW,QAEnCgB,IAAe,MAAM;AACzB,UAAI,CAACL,EAAW,WAAW,CAACE,EAAW,QAAS;AAEhD,YAAMI,IAAON,EAAW,QAAQ,sBAAA,GAC1BO,IAAcL,EAAW,QAAQ,sBAAA;AAEvC,UAAIM,IAAc,IACdC,IAAqC,CAAA;AAEzC,UAAItB,MAAc;AAEhB,QAAAqB,IAAcF,EAAK,MAAMnB,GACrBqB,MACFC,IAAgB;AAAA,UACd,UAAU;AAAA,UACV,KAAKtB;AAAA,UACL,OAAOmB,EAAK;AAAA,UACZ,QAAQ;AAAA,QAAA;AAAA,eAGHlB,MAAiB,QAAW;AAErC,cAAMsB,IAAiB,OAAO;AAC9B,QAAAF,IAAcF,EAAK,SAASI,IAAiBtB,GACzCoB,MACFC,IAAgB;AAAA,UACd,UAAU;AAAA,UACV,QAAQrB;AAAA,UACR,OAAOkB,EAAK;AAAA,UACZ,QAAQ;AAAA,QAAA;AAAA,MAGd;AAEA,MAAIE,MAAgBf,MAClBC,EAAWc,CAAW,GACtBlB,IAAWkB,CAAW,IAGpBA,KACFX,EAAoB;AAAA,QAClB,OAAOU,EAAY;AAAA,QACnB,QAAQA,EAAY;AAAA,MAAA,CACrB,GACDR,EAAcU,CAAa,MAE3BZ,EAAoB,CAAA,CAAE,GACtBE,EAAc,CAAA,CAAE;AAAA,IAEpB;AAEA,WAAAK,EAAa,iBAAiB,UAAUC,CAAY,GACpD,OAAO,iBAAiB,UAAUA,CAAY,GAC9CA,EAAA,GAEO,MAAM;AACX,MAAAD,EAAa,oBAAoB,UAAUC,CAAY,GACvD,OAAO,oBAAoB,UAAUA,CAAY;AAAA,IACnD;AAAA,EACF,GAAG,CAAChB,GAAQF,GAAWC,GAAcK,GAASH,CAAQ,CAAC,GAGrD,gBAAAqB,EAAC,OAAA,EAAI,KAAKX,GAAY,WAAAT,GAAsB,cAAYE,IAAU,YAAY,UAAW,GAAGD,GACzF,UAAA;AAAA,IAAAC,KAAW,gBAAAmB,EAAC,OAAA,EAAI,OAAOhB,EAAA,CAAkB;AAAA,sBACzC,OAAA,EAAI,KAAKM,GAAY,OAAOJ,GAC1B,UAAAZ,EAAA,CACH;AAAA,EAAA,GACF;AAEJ;"}
1
+ {"version":3,"file":"index2.js","sources":["../src/components/Affix.tsx"],"sourcesContent":["import React, { useState, useEffect, useRef } from 'react'\n\nexport interface AffixProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {\n /** Content to make sticky */\n children: React.ReactNode\n /** Offset from top when fixed (pixels) */\n offsetTop?: number\n /** Offset from bottom when fixed (pixels) */\n offsetBottom?: number\n /** Scroll target (default: window) */\n target?: () => HTMLElement | Window\n /** Callback when affix state changes */\n onChange?: (affixed: boolean) => void\n}\n\nexport const Affix: React.FC<AffixProps> = ({\n children,\n offsetTop,\n offsetBottom,\n target,\n onChange,\n className = '',\n ...rest\n}) => {\n const [affixed, setAffixed] = useState(false)\n const [placeholderStyle, setPlaceholderStyle] = useState<React.CSSProperties>({})\n const [affixStyle, setAffixStyle] = useState<React.CSSProperties>({})\n const wrapperRef = useRef<HTMLDivElement>(null)\n const contentRef = useRef<HTMLDivElement>(null)\n\n // For custom targets, use CSS sticky positioning\n const hasCustomTarget = !!target\n\n useEffect(() => {\n // For custom targets, use CSS sticky - no JS needed for positioning\n if (hasCustomTarget) {\n return\n }\n\n const scrollTarget = window\n\n const handleScroll = () => {\n if (!wrapperRef.current || !contentRef.current) return\n\n const rect = wrapperRef.current.getBoundingClientRect()\n const contentRect = contentRef.current.getBoundingClientRect()\n\n let shouldAffix = false\n let newAffixStyle: React.CSSProperties = {}\n\n if (offsetTop !== undefined) {\n // Affix to top\n shouldAffix = rect.top < offsetTop\n if (shouldAffix) {\n newAffixStyle = {\n position: 'fixed',\n top: offsetTop,\n width: rect.width,\n zIndex: 100,\n }\n }\n } else if (offsetBottom !== undefined) {\n // Affix to bottom\n const viewportHeight = window.innerHeight\n shouldAffix = rect.bottom > viewportHeight - offsetBottom\n if (shouldAffix) {\n newAffixStyle = {\n position: 'fixed',\n bottom: offsetBottom,\n width: rect.width,\n zIndex: 100,\n }\n }\n }\n\n if (shouldAffix !== affixed) {\n setAffixed(shouldAffix)\n onChange?.(shouldAffix)\n }\n\n if (shouldAffix) {\n setPlaceholderStyle({\n width: contentRect.width,\n height: contentRect.height,\n })\n setAffixStyle(newAffixStyle)\n } else {\n setPlaceholderStyle({})\n setAffixStyle({})\n }\n }\n\n scrollTarget.addEventListener('scroll', handleScroll)\n window.addEventListener('resize', handleScroll)\n handleScroll()\n\n return () => {\n scrollTarget.removeEventListener('scroll', handleScroll)\n window.removeEventListener('resize', handleScroll)\n }\n }, [hasCustomTarget, offsetTop, offsetBottom, affixed, onChange])\n\n // For custom scroll containers, use CSS sticky\n if (hasCustomTarget) {\n const stickyStyle: React.CSSProperties = {\n position: 'sticky',\n top: offsetTop,\n bottom: offsetBottom,\n zIndex: 100,\n }\n\n return (\n <div className={className} style={stickyStyle} {...rest}>\n {children}\n </div>\n )\n }\n\n // For window scrolling, use fixed positioning with JS\n return (\n <div ref={wrapperRef} className={className} data-state={affixed ? 'affixed' : 'normal'} {...rest}>\n {affixed && <div style={placeholderStyle} />}\n <div ref={contentRef} style={affixStyle}>\n {children}\n </div>\n </div>\n )\n}\n"],"names":["Affix","children","offsetTop","offsetBottom","target","onChange","className","rest","affixed","setAffixed","useState","placeholderStyle","setPlaceholderStyle","affixStyle","setAffixStyle","wrapperRef","useRef","contentRef","hasCustomTarget","useEffect","scrollTarget","handleScroll","rect","contentRect","shouldAffix","newAffixStyle","viewportHeight","jsxs","jsx"],"mappings":";;AAeO,MAAMA,IAA8B,CAAC;AAAA,EAC1C,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,MAAM;AACJ,QAAM,CAACC,GAASC,CAAU,IAAIC,EAAS,EAAK,GACtC,CAACC,GAAkBC,CAAmB,IAAIF,EAA8B,CAAA,CAAE,GAC1E,CAACG,GAAYC,CAAa,IAAIJ,EAA8B,CAAA,CAAE,GAC9DK,IAAaC,EAAuB,IAAI,GACxCC,IAAaD,EAAuB,IAAI,GAGxCE,IAAkB,CAAC,CAACd;AAwE1B,SAtEAe,EAAU,MAAM;AAEd,QAAID;AACF;AAGF,UAAME,IAAe,QAEfC,IAAe,MAAM;AACzB,UAAI,CAACN,EAAW,WAAW,CAACE,EAAW,QAAS;AAEhD,YAAMK,IAAOP,EAAW,QAAQ,sBAAA,GAC1BQ,IAAcN,EAAW,QAAQ,sBAAA;AAEvC,UAAIO,IAAc,IACdC,IAAqC,CAAA;AAEzC,UAAIvB,MAAc;AAEhB,QAAAsB,IAAcF,EAAK,MAAMpB,GACrBsB,MACFC,IAAgB;AAAA,UACd,UAAU;AAAA,UACV,KAAKvB;AAAA,UACL,OAAOoB,EAAK;AAAA,UACZ,QAAQ;AAAA,QAAA;AAAA,eAGHnB,MAAiB,QAAW;AAErC,cAAMuB,IAAiB,OAAO;AAC9B,QAAAF,IAAcF,EAAK,SAASI,IAAiBvB,GACzCqB,MACFC,IAAgB;AAAA,UACd,UAAU;AAAA,UACV,QAAQtB;AAAA,UACR,OAAOmB,EAAK;AAAA,UACZ,QAAQ;AAAA,QAAA;AAAA,MAGd;AAEA,MAAIE,MAAgBhB,MAClBC,EAAWe,CAAW,GACtBnB,IAAWmB,CAAW,IAGpBA,KACFZ,EAAoB;AAAA,QAClB,OAAOW,EAAY;AAAA,QACnB,QAAQA,EAAY;AAAA,MAAA,CACrB,GACDT,EAAcW,CAAa,MAE3Bb,EAAoB,CAAA,CAAE,GACtBE,EAAc,CAAA,CAAE;AAAA,IAEpB;AAEA,WAAAM,EAAa,iBAAiB,UAAUC,CAAY,GACpD,OAAO,iBAAiB,UAAUA,CAAY,GAC9CA,EAAA,GAEO,MAAM;AACX,MAAAD,EAAa,oBAAoB,UAAUC,CAAY,GACvD,OAAO,oBAAoB,UAAUA,CAAY;AAAA,IACnD;AAAA,EACF,GAAG,CAACH,GAAiBhB,GAAWC,GAAcK,GAASH,CAAQ,CAAC,GAG5Da,sBASC,OAAA,EAAI,WAAAZ,GAAsB,OARY;AAAA,IACvC,UAAU;AAAA,IACV,KAAKJ;AAAA,IACL,QAAQC;AAAA,IACR,QAAQ;AAAA,EAAA,GAIwC,GAAGI,GAChD,UAAAN,GACH,IAMF,gBAAA0B,EAAC,OAAA,EAAI,KAAKZ,GAAY,WAAAT,GAAsB,cAAYE,IAAU,YAAY,UAAW,GAAGD,GACzF,UAAA;AAAA,IAAAC,KAAW,gBAAAoB,EAAC,OAAA,EAAI,OAAOjB,EAAA,CAAkB;AAAA,sBACzC,OAAA,EAAI,KAAKM,GAAY,OAAOJ,GAC1B,UAAAZ,EAAA,CACH;AAAA,EAAA,GACF;AAEJ;"}
package/dist/index21.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsxs as m, jsx as n } from "react/jsx-runtime";
2
2
  import { useState as h, useRef as j, useEffect as y } from "react";
3
- import { Input as T } from "./index39.js";
3
+ import { Input as T } from "./index40.js";
4
4
  const $ = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], I = [
5
5
  "January",
6
6
  "February",