asterui 0.12.19 → 0.12.21

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 (204) hide show
  1. package/dist/components/Code.d.ts +2 -0
  2. package/dist/components/CopyButton.d.ts +34 -0
  3. package/dist/index.d.ts +2 -0
  4. package/dist/index.js +205 -203
  5. package/dist/index.js.map +1 -1
  6. package/dist/index10.js +91 -121
  7. package/dist/index10.js.map +1 -1
  8. package/dist/index100.js +5 -13
  9. package/dist/index100.js.map +1 -1
  10. package/dist/index101.js +11 -43
  11. package/dist/index101.js.map +1 -1
  12. package/dist/index102.js +44 -11
  13. package/dist/index102.js.map +1 -1
  14. package/dist/index103.js +10 -12
  15. package/dist/index103.js.map +1 -1
  16. package/dist/index104.js +14 -7
  17. package/dist/index104.js.map +1 -1
  18. package/dist/index105.js +7 -12
  19. package/dist/index105.js.map +1 -1
  20. package/dist/index106.js +11 -29
  21. package/dist/index106.js.map +1 -1
  22. package/dist/index107.js +29 -16
  23. package/dist/index107.js.map +1 -1
  24. package/dist/index108.js +21 -0
  25. package/dist/index108.js.map +1 -0
  26. package/dist/index11.js +123 -30
  27. package/dist/index11.js.map +1 -1
  28. package/dist/index12.js +28 -263
  29. package/dist/index12.js.map +1 -1
  30. package/dist/index13.js +257 -105
  31. package/dist/index13.js.map +1 -1
  32. package/dist/index14.js +108 -153
  33. package/dist/index14.js.map +1 -1
  34. package/dist/index15.js +154 -146
  35. package/dist/index15.js.map +1 -1
  36. package/dist/index16.js +150 -5
  37. package/dist/index16.js.map +1 -1
  38. package/dist/index17.js +5 -71
  39. package/dist/index17.js.map +1 -1
  40. package/dist/index18.js +70 -24
  41. package/dist/index18.js.map +1 -1
  42. package/dist/index19.js +23 -194
  43. package/dist/index19.js.map +1 -1
  44. package/dist/index20.js +188 -106
  45. package/dist/index20.js.map +1 -1
  46. package/dist/index21.js +107 -177
  47. package/dist/index21.js.map +1 -1
  48. package/dist/index22.js +181 -107
  49. package/dist/index22.js.map +1 -1
  50. package/dist/index23.js +110 -19
  51. package/dist/index23.js.map +1 -1
  52. package/dist/index24.js +17 -41
  53. package/dist/index24.js.map +1 -1
  54. package/dist/index25.js +43 -32
  55. package/dist/index25.js.map +1 -1
  56. package/dist/index26.js +30 -170
  57. package/dist/index26.js.map +1 -1
  58. package/dist/index27.js +171 -40
  59. package/dist/index27.js.map +1 -1
  60. package/dist/index28.js +41 -17
  61. package/dist/index28.js.map +1 -1
  62. package/dist/index29.js +17 -33
  63. package/dist/index29.js.map +1 -1
  64. package/dist/index30.js +33 -52
  65. package/dist/index30.js.map +1 -1
  66. package/dist/index31.js +50 -61
  67. package/dist/index31.js.map +1 -1
  68. package/dist/index32.js +60 -181
  69. package/dist/index32.js.map +1 -1
  70. package/dist/index33.js +184 -18
  71. package/dist/index33.js.map +1 -1
  72. package/dist/index34.js +15 -271
  73. package/dist/index34.js.map +1 -1
  74. package/dist/index35.js +270 -1083
  75. package/dist/index35.js.map +1 -1
  76. package/dist/index36.js +1086 -16
  77. package/dist/index36.js.map +1 -1
  78. package/dist/index37.js +17 -17
  79. package/dist/index37.js.map +1 -1
  80. package/dist/index38.js +15 -120
  81. package/dist/index38.js.map +1 -1
  82. package/dist/index39.js +119 -37
  83. package/dist/index39.js.map +1 -1
  84. package/dist/index40.js +40 -398
  85. package/dist/index40.js.map +1 -1
  86. package/dist/index41.js +390 -89
  87. package/dist/index41.js.map +1 -1
  88. package/dist/index42.js +91 -253
  89. package/dist/index42.js.map +1 -1
  90. package/dist/index43.js +249 -145
  91. package/dist/index43.js.map +1 -1
  92. package/dist/index44.js +155 -15
  93. package/dist/index44.js.map +1 -1
  94. package/dist/index45.js +15 -17
  95. package/dist/index45.js.map +1 -1
  96. package/dist/index46.js +16 -136
  97. package/dist/index46.js.map +1 -1
  98. package/dist/index47.js +134 -10
  99. package/dist/index47.js.map +1 -1
  100. package/dist/index48.js +13 -35
  101. package/dist/index48.js.map +1 -1
  102. package/dist/index49.js +35 -34
  103. package/dist/index49.js.map +1 -1
  104. package/dist/index50.js +34 -81
  105. package/dist/index50.js.map +1 -1
  106. package/dist/index51.js +71 -166
  107. package/dist/index51.js.map +1 -1
  108. package/dist/index52.js +167 -144
  109. package/dist/index52.js.map +1 -1
  110. package/dist/index53.js +152 -11
  111. package/dist/index53.js.map +1 -1
  112. package/dist/index54.js +10 -20
  113. package/dist/index54.js.map +1 -1
  114. package/dist/index55.js +55 -12
  115. package/dist/index55.js.map +1 -1
  116. package/dist/index56.js +14 -7
  117. package/dist/index56.js.map +1 -1
  118. package/dist/index57.js +6 -333
  119. package/dist/index57.js.map +1 -1
  120. package/dist/index58.js +334 -47
  121. package/dist/index58.js.map +1 -1
  122. package/dist/index59.js +47 -122
  123. package/dist/index59.js.map +1 -1
  124. package/dist/index60.js +120 -108
  125. package/dist/index60.js.map +1 -1
  126. package/dist/index61.js +107 -167
  127. package/dist/index61.js.map +1 -1
  128. package/dist/index62.js +167 -29
  129. package/dist/index62.js.map +1 -1
  130. package/dist/index63.js +30 -120
  131. package/dist/index63.js.map +1 -1
  132. package/dist/index64.js +116 -80
  133. package/dist/index64.js.map +1 -1
  134. package/dist/index65.js +85 -19
  135. package/dist/index65.js.map +1 -1
  136. package/dist/index66.js +19 -73
  137. package/dist/index66.js.map +1 -1
  138. package/dist/index67.js +71 -54
  139. package/dist/index67.js.map +1 -1
  140. package/dist/index68.js +56 -44
  141. package/dist/index68.js.map +1 -1
  142. package/dist/index69.js +42 -49
  143. package/dist/index69.js.map +1 -1
  144. package/dist/index70.js +50 -121
  145. package/dist/index70.js.map +1 -1
  146. package/dist/index71.js +118 -102
  147. package/dist/index71.js.map +1 -1
  148. package/dist/index72.js +105 -72
  149. package/dist/index72.js.map +1 -1
  150. package/dist/index73.js +73 -67
  151. package/dist/index73.js.map +1 -1
  152. package/dist/index74.js +66 -19
  153. package/dist/index74.js.map +1 -1
  154. package/dist/index75.js +18 -55
  155. package/dist/index75.js.map +1 -1
  156. package/dist/index76.js +55 -251
  157. package/dist/index76.js.map +1 -1
  158. package/dist/index77.js +254 -22
  159. package/dist/index77.js.map +1 -1
  160. package/dist/index78.js +22 -31
  161. package/dist/index78.js.map +1 -1
  162. package/dist/index79.js +30 -93
  163. package/dist/index79.js.map +1 -1
  164. package/dist/index80.js +89 -324
  165. package/dist/index80.js.map +1 -1
  166. package/dist/index81.js +322 -73
  167. package/dist/index81.js.map +1 -1
  168. package/dist/index82.js +79 -39
  169. package/dist/index82.js.map +1 -1
  170. package/dist/index83.js +40 -23
  171. package/dist/index83.js.map +1 -1
  172. package/dist/index84.js +21 -93
  173. package/dist/index84.js.map +1 -1
  174. package/dist/index85.js +87 -148
  175. package/dist/index85.js.map +1 -1
  176. package/dist/index86.js +147 -152
  177. package/dist/index86.js.map +1 -1
  178. package/dist/index87.js +159 -63
  179. package/dist/index87.js.map +1 -1
  180. package/dist/index88.js +65 -35
  181. package/dist/index88.js.map +1 -1
  182. package/dist/index89.js +35 -234
  183. package/dist/index89.js.map +1 -1
  184. package/dist/index90.js +231 -31
  185. package/dist/index90.js.map +1 -1
  186. package/dist/index91.js +34 -210
  187. package/dist/index91.js.map +1 -1
  188. package/dist/index92.js +195 -198
  189. package/dist/index92.js.map +1 -1
  190. package/dist/index93.js +159 -241
  191. package/dist/index93.js.map +1 -1
  192. package/dist/index94.js +283 -166
  193. package/dist/index94.js.map +1 -1
  194. package/dist/index95.js +173 -253
  195. package/dist/index95.js.map +1 -1
  196. package/dist/index96.js +253 -121
  197. package/dist/index96.js.map +1 -1
  198. package/dist/index97.js +126 -14
  199. package/dist/index97.js.map +1 -1
  200. package/dist/index98.js +12 -31
  201. package/dist/index98.js.map +1 -1
  202. package/dist/index99.js +32 -5
  203. package/dist/index99.js.map +1 -1
  204. package/package.json +1 -1
package/dist/index98.js CHANGED
@@ -1,36 +1,17 @@
1
- import { useState as u, useEffect as f } from "react";
2
- const t = {
3
- sm: 640,
4
- md: 768,
5
- lg: 1024,
6
- xl: 1280,
7
- "2xl": 1536
8
- }, s = ["xs", "sm", "md", "lg", "xl", "2xl"];
9
- function l(e) {
10
- return e >= t["2xl"] ? "2xl" : e >= t.xl ? "xl" : e >= t.lg ? "lg" : e >= t.md ? "md" : e >= t.sm ? "sm" : "xs";
1
+ import { jsx as v, Fragment as A } from "react/jsx-runtime";
2
+ import { useBreakpoint as m } from "./index99.js";
3
+ function h({ children: f, above: o, below: r, at: s, between: e }) {
4
+ const { isAbove: d, isBelow: n, isAt: l, isBetween: u } = m();
5
+ let i = !1;
6
+ return o !== void 0 ? i = d(o) : r !== void 0 ? i = n(r) : s !== void 0 ? Array.isArray(s) ? i = s.some((t) => l(t)) : i = l(s) : e !== void 0 ? i = u(e[0], e[1]) : i = !0, i ? /* @__PURE__ */ v(A, { children: f }) : null;
11
7
  }
12
- function i(e, o) {
13
- return s.indexOf(e) - s.indexOf(o);
14
- }
15
- function m() {
16
- const [e, o] = u(
17
- () => typeof window < "u" ? window.innerWidth : 1024
18
- );
19
- f(() => {
20
- const n = () => o(window.innerWidth);
21
- return window.addEventListener("resize", n), () => window.removeEventListener("resize", n);
22
- }, []);
23
- const r = l(e);
24
- return {
25
- breakpoint: r,
26
- width: e,
27
- isAbove: (n) => i(r, n) >= 0,
28
- isBelow: (n) => i(r, n) < 0,
29
- isAt: (n) => r === n,
30
- isBetween: (n, d) => i(r, n) >= 0 && i(r, d) <= 0
31
- };
8
+ function p({ children: f, above: o, below: r, at: s, between: e }) {
9
+ const { isAbove: d, isBelow: n, isAt: l, isBetween: u } = m();
10
+ let i = !1;
11
+ return o !== void 0 ? i = d(o) : r !== void 0 ? i = n(r) : s !== void 0 ? Array.isArray(s) ? i = s.some((t) => l(t)) : i = l(s) : e !== void 0 && (i = u(e[0], e[1])), i ? null : /* @__PURE__ */ v(A, { children: f });
32
12
  }
33
13
  export {
34
- m as useBreakpoint
14
+ p as Hide,
15
+ h as Show
35
16
  };
36
17
  //# sourceMappingURL=index98.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index98.js","sources":["../src/hooks/useBreakpoint.ts"],"sourcesContent":["import { useState, useEffect } from 'react'\n\nexport type Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n\nconst breakpoints: Record<Breakpoint, number> = {\n xs: 0,\n sm: 640,\n md: 768,\n lg: 1024,\n xl: 1280,\n '2xl': 1536,\n}\n\nconst breakpointOrder: Breakpoint[] = ['xs', 'sm', 'md', 'lg', 'xl', '2xl']\n\nfunction getBreakpoint(width: number): Breakpoint {\n if (width >= breakpoints['2xl']) return '2xl'\n if (width >= breakpoints.xl) return 'xl'\n if (width >= breakpoints.lg) return 'lg'\n if (width >= breakpoints.md) return 'md'\n if (width >= breakpoints.sm) return 'sm'\n return 'xs'\n}\n\nfunction compareBreakpoints(a: Breakpoint, b: Breakpoint): number {\n return breakpointOrder.indexOf(a) - breakpointOrder.indexOf(b)\n}\n\nexport interface UseBreakpointReturn {\n breakpoint: Breakpoint\n width: number\n isAbove: (bp: Breakpoint) => boolean\n isBelow: (bp: Breakpoint) => boolean\n isAt: (bp: Breakpoint) => boolean\n isBetween: (min: Breakpoint, max: Breakpoint) => boolean\n}\n\nexport function useBreakpoint(): UseBreakpointReturn {\n const [width, setWidth] = useState(() =>\n typeof window !== 'undefined' ? window.innerWidth : 1024\n )\n\n useEffect(() => {\n const handleResize = () => setWidth(window.innerWidth)\n\n window.addEventListener('resize', handleResize)\n return () => window.removeEventListener('resize', handleResize)\n }, [])\n\n const breakpoint = getBreakpoint(width)\n\n return {\n breakpoint,\n width,\n isAbove: (bp: Breakpoint) => compareBreakpoints(breakpoint, bp) >= 0,\n isBelow: (bp: Breakpoint) => compareBreakpoints(breakpoint, bp) < 0,\n isAt: (bp: Breakpoint) => breakpoint === bp,\n isBetween: (min: Breakpoint, max: Breakpoint) =>\n compareBreakpoints(breakpoint, min) >= 0 && compareBreakpoints(breakpoint, max) <= 0,\n }\n}\n"],"names":["breakpoints","breakpointOrder","getBreakpoint","width","compareBreakpoints","a","b","useBreakpoint","setWidth","useState","useEffect","handleResize","breakpoint","bp","min","max"],"mappings":";AAIA,MAAMA,IAA0C;AAAA,EAE9C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AACT,GAEMC,IAAgC,CAAC,MAAM,MAAM,MAAM,MAAM,MAAM,KAAK;AAE1E,SAASC,EAAcC,GAA2B;AAChD,SAAIA,KAASH,EAAY,KAAK,IAAU,QACpCG,KAASH,EAAY,KAAW,OAChCG,KAASH,EAAY,KAAW,OAChCG,KAASH,EAAY,KAAW,OAChCG,KAASH,EAAY,KAAW,OAC7B;AACT;AAEA,SAASI,EAAmBC,GAAeC,GAAuB;AAChE,SAAOL,EAAgB,QAAQI,CAAC,IAAIJ,EAAgB,QAAQK,CAAC;AAC/D;AAWO,SAASC,IAAqC;AACnD,QAAM,CAACJ,GAAOK,CAAQ,IAAIC;AAAA,IAAS,MACjC,OAAO,SAAW,MAAc,OAAO,aAAa;AAAA,EAAA;AAGtD,EAAAC,EAAU,MAAM;AACd,UAAMC,IAAe,MAAMH,EAAS,OAAO,UAAU;AAErD,kBAAO,iBAAiB,UAAUG,CAAY,GACvC,MAAM,OAAO,oBAAoB,UAAUA,CAAY;AAAA,EAChE,GAAG,CAAA,CAAE;AAEL,QAAMC,IAAaV,EAAcC,CAAK;AAEtC,SAAO;AAAA,IACL,YAAAS;AAAA,IACA,OAAAT;AAAA,IACA,SAAS,CAACU,MAAmBT,EAAmBQ,GAAYC,CAAE,KAAK;AAAA,IACnE,SAAS,CAACA,MAAmBT,EAAmBQ,GAAYC,CAAE,IAAI;AAAA,IAClE,MAAM,CAACA,MAAmBD,MAAeC;AAAA,IACzC,WAAW,CAACC,GAAiBC,MAC3BX,EAAmBQ,GAAYE,CAAG,KAAK,KAAKV,EAAmBQ,GAAYG,CAAG,KAAK;AAAA,EAAA;AAEzF;"}
1
+ {"version":3,"file":"index98.js","sources":["../src/components/Responsive.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useBreakpoint, Breakpoint } from '../hooks/useBreakpoint'\n\nexport interface ShowProps {\n children: ReactNode\n above?: Breakpoint\n below?: Breakpoint\n at?: Breakpoint | Breakpoint[]\n between?: [Breakpoint, Breakpoint]\n}\n\nexport function Show({ children, above, below, at, between }: ShowProps): React.ReactElement | null {\n const { isAbove, isBelow, isAt, isBetween } = useBreakpoint()\n\n let shouldShow = false\n\n if (above !== undefined) {\n shouldShow = isAbove(above)\n } else if (below !== undefined) {\n shouldShow = isBelow(below)\n } else if (at !== undefined) {\n if (Array.isArray(at)) {\n shouldShow = at.some((bp) => isAt(bp))\n } else {\n shouldShow = isAt(at)\n }\n } else if (between !== undefined) {\n shouldShow = isBetween(between[0], between[1])\n } else {\n shouldShow = true\n }\n\n return shouldShow ? <>{children}</> : null\n}\n\nexport interface HideProps {\n children: ReactNode\n above?: Breakpoint\n below?: Breakpoint\n at?: Breakpoint | Breakpoint[]\n between?: [Breakpoint, Breakpoint]\n}\n\nexport function Hide({ children, above, below, at, between }: HideProps): React.ReactElement | null {\n const { isAbove, isBelow, isAt, isBetween } = useBreakpoint()\n\n let shouldHide = false\n\n if (above !== undefined) {\n shouldHide = isAbove(above)\n } else if (below !== undefined) {\n shouldHide = isBelow(below)\n } else if (at !== undefined) {\n if (Array.isArray(at)) {\n shouldHide = at.some((bp) => isAt(bp))\n } else {\n shouldHide = isAt(at)\n }\n } else if (between !== undefined) {\n shouldHide = isBetween(between[0], between[1])\n }\n\n return shouldHide ? null : <>{children}</>\n}\n"],"names":["Show","children","above","below","at","between","isAbove","isBelow","isAt","isBetween","useBreakpoint","shouldShow","bp","jsx","Fragment","Hide","shouldHide"],"mappings":";;AAWO,SAASA,EAAK,EAAE,UAAAC,GAAU,OAAAC,GAAO,OAAAC,GAAO,IAAAC,GAAI,SAAAC,KAAiD;AAClG,QAAM,EAAE,SAAAC,GAAS,SAAAC,GAAS,MAAAC,GAAM,WAAAC,EAAA,IAAcC,EAAA;AAE9C,MAAIC,IAAa;AAEjB,SAAIT,MAAU,SACZS,IAAaL,EAAQJ,CAAK,IACjBC,MAAU,SACnBQ,IAAaJ,EAAQJ,CAAK,IACjBC,MAAO,SACZ,MAAM,QAAQA,CAAE,IAClBO,IAAaP,EAAG,KAAK,CAACQ,MAAOJ,EAAKI,CAAE,CAAC,IAErCD,IAAaH,EAAKJ,CAAE,IAEbC,MAAY,SACrBM,IAAaF,EAAUJ,EAAQ,CAAC,GAAGA,EAAQ,CAAC,CAAC,IAE7CM,IAAa,IAGRA,IAAa,gBAAAE,EAAAC,GAAA,EAAG,UAAAb,EAAA,CAAS,IAAM;AACxC;AAUO,SAASc,EAAK,EAAE,UAAAd,GAAU,OAAAC,GAAO,OAAAC,GAAO,IAAAC,GAAI,SAAAC,KAAiD;AAClG,QAAM,EAAE,SAAAC,GAAS,SAAAC,GAAS,MAAAC,GAAM,WAAAC,EAAA,IAAcC,EAAA;AAE9C,MAAIM,IAAa;AAEjB,SAAId,MAAU,SACZc,IAAaV,EAAQJ,CAAK,IACjBC,MAAU,SACnBa,IAAaT,EAAQJ,CAAK,IACjBC,MAAO,SACZ,MAAM,QAAQA,CAAE,IAClBY,IAAaZ,EAAG,KAAK,CAACQ,MAAOJ,EAAKI,CAAE,CAAC,IAErCI,IAAaR,EAAKJ,CAAE,IAEbC,MAAY,WACrBW,IAAaP,EAAUJ,EAAQ,CAAC,GAAGA,EAAQ,CAAC,CAAC,IAGxCW,IAAa,OAAO,gBAAAH,EAAAC,GAAA,EAAG,UAAAb,EAAA,CAAS;AACzC;"}
package/dist/index99.js CHANGED
@@ -1,9 +1,36 @@
1
- import { useState as u, useCallback as s } from "react";
2
- function p(o = !1) {
3
- const [n, e] = u(o), t = s(() => e(!0), []), c = s(() => e(!1), []), l = s(() => e((r) => !r), []);
4
- return { isOpen: n, onOpen: t, onClose: c, onToggle: l, setIsOpen: e };
1
+ import { useState as u, useEffect as f } from "react";
2
+ const t = {
3
+ sm: 640,
4
+ md: 768,
5
+ lg: 1024,
6
+ xl: 1280,
7
+ "2xl": 1536
8
+ }, s = ["xs", "sm", "md", "lg", "xl", "2xl"];
9
+ function l(e) {
10
+ return e >= t["2xl"] ? "2xl" : e >= t.xl ? "xl" : e >= t.lg ? "lg" : e >= t.md ? "md" : e >= t.sm ? "sm" : "xs";
11
+ }
12
+ function i(e, o) {
13
+ return s.indexOf(e) - s.indexOf(o);
14
+ }
15
+ function m() {
16
+ const [e, o] = u(
17
+ () => typeof window < "u" ? window.innerWidth : 1024
18
+ );
19
+ f(() => {
20
+ const n = () => o(window.innerWidth);
21
+ return window.addEventListener("resize", n), () => window.removeEventListener("resize", n);
22
+ }, []);
23
+ const r = l(e);
24
+ return {
25
+ breakpoint: r,
26
+ width: e,
27
+ isAbove: (n) => i(r, n) >= 0,
28
+ isBelow: (n) => i(r, n) < 0,
29
+ isAt: (n) => r === n,
30
+ isBetween: (n, d) => i(r, n) >= 0 && i(r, d) <= 0
31
+ };
5
32
  }
6
33
  export {
7
- p as useDisclosure
34
+ m as useBreakpoint
8
35
  };
9
36
  //# sourceMappingURL=index99.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index99.js","sources":["../src/hooks/useDisclosure.ts"],"sourcesContent":["import { useState, useCallback } from 'react'\n\nexport interface UseDisclosureReturn {\n isOpen: boolean\n onOpen: () => void\n onClose: () => void\n onToggle: () => void\n setIsOpen: (value: boolean) => void\n}\n\n/**\n * Hook for managing open/close state of modals, drawers, dropdowns, etc.\n *\n * @param defaultIsOpen - Initial open state (default: false)\n * @returns Object with isOpen state and control functions\n *\n * @example\n * const { isOpen, onOpen, onClose } = useDisclosure()\n *\n * <Button onClick={onOpen}>Open Modal</Button>\n * <Modal open={isOpen} onClose={onClose}>Content</Modal>\n */\nexport function useDisclosure(defaultIsOpen = false): UseDisclosureReturn {\n const [isOpen, setIsOpen] = useState(defaultIsOpen)\n\n const onOpen = useCallback(() => setIsOpen(true), [])\n const onClose = useCallback(() => setIsOpen(false), [])\n const onToggle = useCallback(() => setIsOpen(prev => !prev), [])\n\n return { isOpen, onOpen, onClose, onToggle, setIsOpen }\n}\n"],"names":["useDisclosure","defaultIsOpen","isOpen","setIsOpen","useState","onOpen","useCallback","onClose","onToggle","prev"],"mappings":";AAsBO,SAASA,EAAcC,IAAgB,IAA4B;AACxE,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAASH,CAAa,GAE5CI,IAASC,EAAY,MAAMH,EAAU,EAAI,GAAG,CAAA,CAAE,GAC9CI,IAAUD,EAAY,MAAMH,EAAU,EAAK,GAAG,CAAA,CAAE,GAChDK,IAAWF,EAAY,MAAMH,EAAU,OAAQ,CAACM,CAAI,GAAG,EAAE;AAE/D,SAAO,EAAE,QAAAP,GAAQ,QAAAG,GAAQ,SAAAE,GAAS,UAAAC,GAAU,WAAAL,EAAA;AAC9C;"}
1
+ {"version":3,"file":"index99.js","sources":["../src/hooks/useBreakpoint.ts"],"sourcesContent":["import { useState, useEffect } from 'react'\n\nexport type Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n\nconst breakpoints: Record<Breakpoint, number> = {\n xs: 0,\n sm: 640,\n md: 768,\n lg: 1024,\n xl: 1280,\n '2xl': 1536,\n}\n\nconst breakpointOrder: Breakpoint[] = ['xs', 'sm', 'md', 'lg', 'xl', '2xl']\n\nfunction getBreakpoint(width: number): Breakpoint {\n if (width >= breakpoints['2xl']) return '2xl'\n if (width >= breakpoints.xl) return 'xl'\n if (width >= breakpoints.lg) return 'lg'\n if (width >= breakpoints.md) return 'md'\n if (width >= breakpoints.sm) return 'sm'\n return 'xs'\n}\n\nfunction compareBreakpoints(a: Breakpoint, b: Breakpoint): number {\n return breakpointOrder.indexOf(a) - breakpointOrder.indexOf(b)\n}\n\nexport interface UseBreakpointReturn {\n breakpoint: Breakpoint\n width: number\n isAbove: (bp: Breakpoint) => boolean\n isBelow: (bp: Breakpoint) => boolean\n isAt: (bp: Breakpoint) => boolean\n isBetween: (min: Breakpoint, max: Breakpoint) => boolean\n}\n\nexport function useBreakpoint(): UseBreakpointReturn {\n const [width, setWidth] = useState(() =>\n typeof window !== 'undefined' ? window.innerWidth : 1024\n )\n\n useEffect(() => {\n const handleResize = () => setWidth(window.innerWidth)\n\n window.addEventListener('resize', handleResize)\n return () => window.removeEventListener('resize', handleResize)\n }, [])\n\n const breakpoint = getBreakpoint(width)\n\n return {\n breakpoint,\n width,\n isAbove: (bp: Breakpoint) => compareBreakpoints(breakpoint, bp) >= 0,\n isBelow: (bp: Breakpoint) => compareBreakpoints(breakpoint, bp) < 0,\n isAt: (bp: Breakpoint) => breakpoint === bp,\n isBetween: (min: Breakpoint, max: Breakpoint) =>\n compareBreakpoints(breakpoint, min) >= 0 && compareBreakpoints(breakpoint, max) <= 0,\n }\n}\n"],"names":["breakpoints","breakpointOrder","getBreakpoint","width","compareBreakpoints","a","b","useBreakpoint","setWidth","useState","useEffect","handleResize","breakpoint","bp","min","max"],"mappings":";AAIA,MAAMA,IAA0C;AAAA,EAE9C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AACT,GAEMC,IAAgC,CAAC,MAAM,MAAM,MAAM,MAAM,MAAM,KAAK;AAE1E,SAASC,EAAcC,GAA2B;AAChD,SAAIA,KAASH,EAAY,KAAK,IAAU,QACpCG,KAASH,EAAY,KAAW,OAChCG,KAASH,EAAY,KAAW,OAChCG,KAASH,EAAY,KAAW,OAChCG,KAASH,EAAY,KAAW,OAC7B;AACT;AAEA,SAASI,EAAmBC,GAAeC,GAAuB;AAChE,SAAOL,EAAgB,QAAQI,CAAC,IAAIJ,EAAgB,QAAQK,CAAC;AAC/D;AAWO,SAASC,IAAqC;AACnD,QAAM,CAACJ,GAAOK,CAAQ,IAAIC;AAAA,IAAS,MACjC,OAAO,SAAW,MAAc,OAAO,aAAa;AAAA,EAAA;AAGtD,EAAAC,EAAU,MAAM;AACd,UAAMC,IAAe,MAAMH,EAAS,OAAO,UAAU;AAErD,kBAAO,iBAAiB,UAAUG,CAAY,GACvC,MAAM,OAAO,oBAAoB,UAAUA,CAAY;AAAA,EAChE,GAAG,CAAA,CAAE;AAEL,QAAMC,IAAaV,EAAcC,CAAK;AAEtC,SAAO;AAAA,IACL,YAAAS;AAAA,IACA,OAAAT;AAAA,IACA,SAAS,CAACU,MAAmBT,EAAmBQ,GAAYC,CAAE,KAAK;AAAA,IACnE,SAAS,CAACA,MAAmBT,EAAmBQ,GAAYC,CAAE,IAAI;AAAA,IAClE,MAAM,CAACA,MAAmBD,MAAeC;AAAA,IACzC,WAAW,CAACC,GAAiBC,MAC3BX,EAAmBQ,GAAYE,CAAG,KAAK,KAAKV,EAAmBQ,GAAYG,CAAG,KAAK;AAAA,EAAA;AAEzF;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asterui",
3
- "version": "0.12.19",
3
+ "version": "0.12.21",
4
4
  "description": "React UI component library with DaisyUI",
5
5
  "homepage": "https://asterui.com",
6
6
  "repository": {