@uselets/ui 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/README.md +91 -1
  2. package/dist/chart-DHS2QeM8.d.ts +80 -0
  3. package/dist/cli/uselets.mjs.map +1 -1
  4. package/dist/components/accordion.d.ts +4 -5
  5. package/dist/components/accordion.js.map +1 -1
  6. package/dist/components/alert-dialog.d.ts +12 -13
  7. package/dist/components/alert-dialog.js.map +1 -1
  8. package/dist/components/alert.d.ts +5 -7
  9. package/dist/components/alert.js.map +1 -1
  10. package/dist/components/anchor.d.ts +2 -4
  11. package/dist/components/anchor.js.map +1 -1
  12. package/dist/components/area-chart.d.ts +58 -0
  13. package/dist/components/area-chart.js +2 -0
  14. package/dist/components/area-chart.js.map +1 -0
  15. package/dist/components/avatar.d.ts +6 -7
  16. package/dist/components/avatar.js.map +1 -1
  17. package/dist/components/badge.d.ts +2 -4
  18. package/dist/components/badge.js.map +1 -1
  19. package/dist/components/bar-chart.d.ts +54 -0
  20. package/dist/components/bar-chart.js +2 -0
  21. package/dist/components/bar-chart.js.map +1 -0
  22. package/dist/components/breadcrumb.d.ts +7 -8
  23. package/dist/components/breadcrumb.js.map +1 -1
  24. package/dist/components/button-group.d.ts +4 -6
  25. package/dist/components/button-group.js.map +1 -1
  26. package/dist/components/button.d.ts +2 -4
  27. package/dist/components/button.js.map +1 -1
  28. package/dist/components/calendar.d.ts +2 -3
  29. package/dist/components/calendar.js.map +1 -1
  30. package/dist/components/card.d.ts +7 -8
  31. package/dist/components/card.js.map +1 -1
  32. package/dist/components/carousel.d.ts +6 -7
  33. package/dist/components/carousel.js.map +1 -1
  34. package/dist/components/carousel.spec.js +1 -1
  35. package/dist/components/carousel.spec.js.map +1 -1
  36. package/dist/components/center.d.ts +2 -4
  37. package/dist/components/center.js.map +1 -1
  38. package/dist/components/chart.d.ts +2 -263
  39. package/dist/components/chart.js +1 -1
  40. package/dist/components/chart.js.map +1 -1
  41. package/dist/components/checkbox.d.ts +2 -4
  42. package/dist/components/checkbox.js +1 -1
  43. package/dist/components/checkbox.js.map +1 -1
  44. package/dist/components/code.d.ts +1 -2
  45. package/dist/components/code.js.map +1 -1
  46. package/dist/components/collapsible.d.ts +3 -4
  47. package/dist/components/collapsible.js.map +1 -1
  48. package/dist/components/combobox.d.ts +15 -16
  49. package/dist/components/combobox.js.map +1 -1
  50. package/dist/components/command.d.ts +9 -10
  51. package/dist/components/command.js.map +1 -1
  52. package/dist/components/container.d.ts +2 -4
  53. package/dist/components/container.js.map +1 -1
  54. package/dist/components/data-table.d.ts +164 -0
  55. package/dist/components/data-table.js +2 -0
  56. package/dist/components/data-table.js.map +1 -0
  57. package/dist/components/date-range-picker.d.ts +11 -12
  58. package/dist/components/date-range-picker.js.map +1 -1
  59. package/dist/components/dialog.d.ts +11 -13
  60. package/dist/components/dialog.js.map +1 -1
  61. package/dist/components/donut-chart.d.ts +22 -0
  62. package/dist/components/donut-chart.js +2 -0
  63. package/dist/components/donut-chart.js.map +1 -0
  64. package/dist/components/drawer.d.ts +12 -14
  65. package/dist/components/drawer.js.map +1 -1
  66. package/dist/components/dropdown-menu.d.ts +15 -16
  67. package/dist/components/dropdown-menu.js.map +1 -1
  68. package/dist/components/dropzone.d.ts +1 -2
  69. package/dist/components/dropzone.js.map +1 -1
  70. package/dist/components/empty.d.ts +7 -9
  71. package/dist/components/empty.js.map +1 -1
  72. package/dist/components/field.d.ts +11 -13
  73. package/dist/components/field.js.map +1 -1
  74. package/dist/components/field.spec.js +1 -1
  75. package/dist/components/field.spec.js.map +1 -1
  76. package/dist/components/flex.d.ts +4 -6
  77. package/dist/components/flex.js.map +1 -1
  78. package/dist/components/grid.d.ts +2 -3
  79. package/dist/components/grid.js.map +1 -1
  80. package/dist/components/group.d.ts +6 -4
  81. package/dist/components/group.js +1 -1
  82. package/dist/components/group.js.map +1 -1
  83. package/dist/components/heading.d.ts +2 -4
  84. package/dist/components/heading.js.map +1 -1
  85. package/dist/components/hover-card.d.ts +3 -4
  86. package/dist/components/hover-card.js.map +1 -1
  87. package/dist/components/input-group.d.ts +8 -10
  88. package/dist/components/input-group.js.map +1 -1
  89. package/dist/components/input-otp.d.ts +4 -5
  90. package/dist/components/input-otp.js.map +1 -1
  91. package/dist/components/input.d.ts +1 -2
  92. package/dist/components/input.js.map +1 -1
  93. package/dist/components/kbd.d.ts +2 -3
  94. package/dist/components/kbd.js.map +1 -1
  95. package/dist/components/label.d.ts +1 -2
  96. package/dist/components/label.js.map +1 -1
  97. package/dist/components/list.d.ts +4 -6
  98. package/dist/components/list.js.map +1 -1
  99. package/dist/components/mask-input.d.ts +25 -0
  100. package/dist/components/mask-input.js +2 -0
  101. package/dist/components/mask-input.js.map +1 -0
  102. package/dist/components/native-select.d.ts +3 -4
  103. package/dist/components/native-select.js.map +1 -1
  104. package/dist/components/navigation-menu.d.ts +9 -11
  105. package/dist/components/navigation-menu.js.map +1 -1
  106. package/dist/components/pagination.d.ts +7 -8
  107. package/dist/components/pagination.js.map +1 -1
  108. package/dist/components/pie-chart.d.ts +58 -0
  109. package/dist/components/pie-chart.js +2 -0
  110. package/dist/components/pie-chart.js.map +1 -0
  111. package/dist/components/popover.d.ts +7 -8
  112. package/dist/components/popover.js.map +1 -1
  113. package/dist/components/progress.d.ts +1 -2
  114. package/dist/components/progress.js.map +1 -1
  115. package/dist/components/radio-group.d.ts +3 -5
  116. package/dist/components/radio-group.js.map +1 -1
  117. package/dist/components/resizable.d.ts +3 -4
  118. package/dist/components/resizable.js.map +1 -1
  119. package/dist/components/scroll-area.d.ts +2 -3
  120. package/dist/components/scroll-area.js.map +1 -1
  121. package/dist/components/select.d.ts +10 -11
  122. package/dist/components/select.js.map +1 -1
  123. package/dist/components/separator.d.ts +1 -2
  124. package/dist/components/separator.js.map +1 -1
  125. package/dist/components/sidebar.d.ts +24 -26
  126. package/dist/components/sidebar.js.map +1 -1
  127. package/dist/components/simple-grid.d.ts +1 -2
  128. package/dist/components/simple-grid.js.map +1 -1
  129. package/dist/components/skeleton.d.ts +1 -2
  130. package/dist/components/skeleton.js.map +1 -1
  131. package/dist/components/skeleton.spec.js +1 -1
  132. package/dist/components/skeleton.spec.js.map +1 -1
  133. package/dist/components/slider.d.ts +1 -2
  134. package/dist/components/slider.js.map +1 -1
  135. package/dist/components/sonner.d.ts +1 -2
  136. package/dist/components/sonner.js.map +1 -1
  137. package/dist/components/spinner.d.ts +2 -4
  138. package/dist/components/spinner.js.map +1 -1
  139. package/dist/components/stack.d.ts +6 -4
  140. package/dist/components/stack.js +1 -1
  141. package/dist/components/stack.js.map +1 -1
  142. package/dist/components/switch.d.ts +1 -2
  143. package/dist/components/switch.js.map +1 -1
  144. package/dist/components/table.d.ts +29 -11
  145. package/dist/components/table.js +1 -1
  146. package/dist/components/table.js.map +1 -1
  147. package/dist/components/tabs.d.ts +5 -7
  148. package/dist/components/tabs.js.map +1 -1
  149. package/dist/components/text.d.ts +2 -4
  150. package/dist/components/text.js.map +1 -1
  151. package/dist/components/textarea.d.ts +1 -2
  152. package/dist/components/textarea.js.map +1 -1
  153. package/dist/components/theme.d.ts +2 -3
  154. package/dist/components/theme.js.map +1 -1
  155. package/dist/components/timeline.d.ts +4 -5
  156. package/dist/components/timeline.js.map +1 -1
  157. package/dist/components/toggle-group.d.ts +2 -3
  158. package/dist/components/toggle-group.js.map +1 -1
  159. package/dist/components/toggle.d.ts +2 -4
  160. package/dist/components/toggle.js.map +1 -1
  161. package/dist/components/tooltip.d.ts +5 -6
  162. package/dist/components/tooltip.js.map +1 -1
  163. package/dist/components/unstyled-button.d.ts +1 -2
  164. package/dist/components/unstyled-button.js.map +1 -1
  165. package/dist/components/visibility.d.ts +2 -3
  166. package/dist/components/visibility.js.map +1 -1
  167. package/dist/{dist-QvsLCO1I.js → dist-C35vdEt2.js} +45 -25
  168. package/dist/dist-C35vdEt2.js.map +1 -0
  169. package/dist/hooks/use-breakpoint-value.js.map +1 -1
  170. package/dist/hooks/use-breakpoint-value.spec.js +1 -1
  171. package/dist/hooks/use-breakpoint-value.spec.js.map +1 -1
  172. package/dist/hooks/use-breakpoint.js.map +1 -1
  173. package/dist/hooks/use-breakpoint.spec.js +1 -1
  174. package/dist/hooks/use-breakpoint.spec.js.map +1 -1
  175. package/dist/hooks/use-disclosure.js.map +1 -1
  176. package/dist/hooks/use-disclosure.spec.js +1 -1
  177. package/dist/hooks/use-disclosure.spec.js.map +1 -1
  178. package/dist/hooks/use-document-visibility.js.map +1 -1
  179. package/dist/hooks/use-document-visibility.spec.js +1 -1
  180. package/dist/hooks/use-document-visibility.spec.js.map +1 -1
  181. package/dist/hooks/use-idle.js.map +1 -1
  182. package/dist/hooks/use-idle.spec.js +1 -1
  183. package/dist/hooks/use-idle.spec.js.map +1 -1
  184. package/dist/hooks/use-interval.js.map +1 -1
  185. package/dist/hooks/use-interval.spec.js +1 -1
  186. package/dist/hooks/use-interval.spec.js.map +1 -1
  187. package/dist/hooks/use-local-storage.js.map +1 -1
  188. package/dist/hooks/use-local-storage.spec.js +1 -1
  189. package/dist/hooks/use-local-storage.spec.js.map +1 -1
  190. package/dist/hooks/use-mask.d.ts +9 -0
  191. package/dist/hooks/use-mask.js +2 -0
  192. package/dist/hooks/use-mask.js.map +1 -0
  193. package/dist/hooks/use-mobile.js.map +1 -1
  194. package/dist/hooks/use-mobile.spec.js +1 -1
  195. package/dist/hooks/use-mobile.spec.js.map +1 -1
  196. package/dist/index.d.ts +10 -3
  197. package/dist/index.js +1 -1
  198. package/dist/lib/button.js.map +1 -1
  199. package/dist/lib/color.js.map +1 -1
  200. package/dist/lib/utils.js.map +1 -1
  201. package/dist/magic-string.es-C-uSEkg2.js.map +1 -1
  202. package/dist/postcss.config.js.map +1 -1
  203. package/dist/{react.esm-D_dNEsWM.js → react.esm-BagSCtI3.js} +11 -2
  204. package/dist/{react.esm-D_dNEsWM.js.map → react.esm-BagSCtI3.js.map} +1 -1
  205. package/dist/skills/uselets-ui/SKILL.md +1 -0
  206. package/dist/skills/uselets-ui/references/component-catalog.md +31 -4
  207. package/dist/skills/uselets-ui/references/package-guide.md +136 -1
  208. package/package.json +15 -13
  209. package/skills/uselets-ui/SKILL.md +1 -0
  210. package/skills/uselets-ui/references/component-catalog.md +31 -4
  211. package/skills/uselets-ui/references/package-guide.md +136 -1
  212. package/dist/dist-QvsLCO1I.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"use-breakpoint-value.js","names":[],"sources":["../../src/hooks/use-breakpoint-value.ts"],"sourcesContent":["import type { Breakpoint } from './use-breakpoint'\nimport { useBreakpoint } from './use-breakpoint'\n\nexport type ResponsiveValueMap<T> = Partial<Record<Breakpoint, T>>\n\nconst breakpointOrder = ['base', 'sm', 'md', 'lg', 'xl', '2xl'] as const satisfies readonly Breakpoint[]\n\nexport function useBreakpointValue<T>(values: ResponsiveValueMap<T>) {\n const activeBreakpoints = {\n base: useBreakpoint('base'),\n sm: useBreakpoint('sm'),\n md: useBreakpoint('md'),\n lg: useBreakpoint('lg'),\n xl: useBreakpoint('xl'),\n '2xl': useBreakpoint('2xl')\n }\n\n let value = values.base\n\n for (const breakpoint of breakpointOrder) {\n if (activeBreakpoints[breakpoint] && values[breakpoint] !== undefined) {\n value = values[breakpoint]\n }\n }\n\n return value\n}\n"],"mappings":"iFAKA,MAAM,EAAkB,CAAC,OAAQ,KAAM,KAAM,KAAM,KAAM,MAAM,CAE/D,SAAgB,mBAAsB,EAA+B,CACnE,IAAM,EAAoB,CACxB,KAAM,EAAc,OAAO,CAC3B,GAAI,EAAc,KAAK,CACvB,GAAI,EAAc,KAAK,CACvB,GAAI,EAAc,KAAK,CACvB,GAAI,EAAc,KAAK,CACvB,MAAO,EAAc,MAAM,CAC5B,CAEG,EAAQ,EAAO,KAEnB,IAAK,IAAM,KAAc,EACnB,EAAkB,IAAe,EAAO,KAAgB,IAAA,KAC1D,EAAQ,EAAO,IAInB,OAAO"}
1
+ {"version":3,"file":"use-breakpoint-value.js","names":[],"sources":["../../src/hooks/use-breakpoint-value.ts"],"sourcesContent":["import type { Breakpoint } from './use-breakpoint'\nimport { useBreakpoint } from './use-breakpoint'\n\nexport type ResponsiveValueMap<T> = Partial<Record<Breakpoint, T>>\n\nconst breakpointOrder = ['base', 'sm', 'md', 'lg', 'xl', '2xl'] as const satisfies readonly Breakpoint[]\n\nexport function useBreakpointValue<T>(values: ResponsiveValueMap<T>) {\n const activeBreakpoints = {\n base: useBreakpoint('base'),\n sm: useBreakpoint('sm'),\n md: useBreakpoint('md'),\n lg: useBreakpoint('lg'),\n xl: useBreakpoint('xl'),\n '2xl': useBreakpoint('2xl')\n }\n\n let value = values.base\n\n for (const breakpoint of breakpointOrder) {\n if (activeBreakpoints[breakpoint] && values[breakpoint] !== undefined) {\n value = values[breakpoint]\n }\n }\n\n return value\n}\n"],"mappings":"iFAKA,MAAM,EAAkB,CAAC,OAAQ,KAAM,KAAM,KAAM,KAAM,KAAK,EAE9D,SAAgB,mBAAsB,EAA+B,CACnE,IAAM,EAAoB,CACxB,KAAM,EAAc,MAAM,EAC1B,GAAI,EAAc,IAAI,EACtB,GAAI,EAAc,IAAI,EACtB,GAAI,EAAc,IAAI,EACtB,GAAI,EAAc,IAAI,EACtB,MAAO,EAAc,KAAK,CAC5B,EAEI,EAAQ,EAAO,KAEnB,IAAK,IAAM,KAAc,EACnB,EAAkB,IAAe,EAAO,KAAgB,IAAA,KAC1D,EAAQ,EAAO,IAInB,OAAO,CACT"}
@@ -1,2 +1,2 @@
1
- import"../chunk-CHh1Zzun.js";import{useBreakpointValue as e}from"./use-breakpoint-value.js";import{i as t,t as n}from"../react.esm-D_dNEsWM.js";import{t as r}from"../dist-QvsLCO1I.js";describe(`useBreakpointValue`,()=>{it(`returns the base value below the first defined breakpoint`,()=>{globalThis.setTestViewportWidth(500);let{result:n}=t(()=>e({base:1,md:2}));expect(n.current).toBe(1)}),it(`returns the largest defined active breakpoint value`,()=>{globalThis.setTestViewportWidth(1200);let{result:n}=t(()=>e({base:1,md:2,lg:3,xl:4}));expect(n.current).toBe(3)}),it(`keeps the previous fallback when an active breakpoint has no value`,()=>{globalThis.setTestViewportWidth(900);let{result:n}=t(()=>e({base:`base`,lg:`large`}));expect(n.current).toBe(`base`)}),it(`updates when the active breakpoint changes`,()=>{globalThis.setTestViewportWidth(500);let{result:r}=t(()=>e({base:!1,md:!0}));expect(r.current).toBe(!1),n(()=>{globalThis.setTestViewportWidth(768)}),expect(r.current).toBe(!0)}),it(`infers value types from the values object`,()=>{(0,r.expectTypeOf)(void 0).toEqualTypeOf(),(0,r.expectTypeOf)(void 0).toEqualTypeOf(),(0,r.expectTypeOf)(void 0).toEqualTypeOf()}),it(`accepts an explicit generic value type`,()=>{(0,r.expectTypeOf)(void 0).toEqualTypeOf()})});
1
+ import"../chunk-CHh1Zzun.js";import{useBreakpointValue as e}from"./use-breakpoint-value.js";import{i as t,t as n}from"../react.esm-BagSCtI3.js";import{t as r}from"../dist-C35vdEt2.js";describe(`useBreakpointValue`,()=>{it(`returns the base value below the first defined breakpoint`,()=>{globalThis.setTestViewportWidth(500);let{result:n}=t(()=>e({base:1,md:2}));expect(n.current).toBe(1)}),it(`returns the largest defined active breakpoint value`,()=>{globalThis.setTestViewportWidth(1200);let{result:n}=t(()=>e({base:1,md:2,lg:3,xl:4}));expect(n.current).toBe(3)}),it(`keeps the previous fallback when an active breakpoint has no value`,()=>{globalThis.setTestViewportWidth(900);let{result:n}=t(()=>e({base:`base`,lg:`large`}));expect(n.current).toBe(`base`)}),it(`updates when the active breakpoint changes`,()=>{globalThis.setTestViewportWidth(500);let{result:r}=t(()=>e({base:!1,md:!0}));expect(r.current).toBe(!1),n(()=>{globalThis.setTestViewportWidth(768)}),expect(r.current).toBe(!0)}),it(`infers value types from the values object`,()=>{(0,r.expectTypeOf)(void 0).toEqualTypeOf(),(0,r.expectTypeOf)(void 0).toEqualTypeOf(),(0,r.expectTypeOf)(void 0).toEqualTypeOf()}),it(`accepts an explicit generic value type`,()=>{(0,r.expectTypeOf)(void 0).toEqualTypeOf()})});
2
2
  //# sourceMappingURL=use-breakpoint-value.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-breakpoint-value.spec.js","names":[],"sources":["../../src/hooks/use-breakpoint-value.spec.ts"],"sourcesContent":["import { act, renderHook } from '@testing-library/react'\nimport { expectTypeOf } from 'vitest'\n\nimport { useBreakpointValue } from './use-breakpoint-value'\n\nfunction inferBreakpointValue<T>(_values: Parameters<typeof useBreakpointValue<T>>[0]) {\n return undefined as ReturnType<typeof useBreakpointValue<T>>\n}\n\ndescribe('useBreakpointValue', () => {\n it('returns the base value below the first defined breakpoint', () => {\n globalThis.setTestViewportWidth(500)\n\n const { result } = renderHook(() => useBreakpointValue({ base: 1, md: 2 }))\n\n expect(result.current).toBe(1)\n })\n\n it('returns the largest defined active breakpoint value', () => {\n globalThis.setTestViewportWidth(1200)\n\n const { result } = renderHook(() => useBreakpointValue({ base: 1, md: 2, lg: 3, xl: 4 }))\n\n expect(result.current).toBe(3)\n })\n\n it('keeps the previous fallback when an active breakpoint has no value', () => {\n globalThis.setTestViewportWidth(900)\n\n const { result } = renderHook(() => useBreakpointValue({ base: 'base', lg: 'large' }))\n\n expect(result.current).toBe('base')\n })\n\n it('updates when the active breakpoint changes', () => {\n globalThis.setTestViewportWidth(500)\n const { result } = renderHook(() => useBreakpointValue({ base: false, md: true }))\n\n expect(result.current).toBe(false)\n\n act(() => {\n globalThis.setTestViewportWidth(768)\n })\n expect(result.current).toBe(true)\n })\n\n it('infers value types from the values object', () => {\n const numberValue = inferBreakpointValue({ base: 1, md: 2 })\n const stringValue = inferBreakpointValue({ base: 'base', md: 'medium' })\n const booleanValue = inferBreakpointValue({ base: false, md: true })\n\n expectTypeOf(numberValue).toEqualTypeOf<number | undefined>()\n expectTypeOf(stringValue).toEqualTypeOf<string | undefined>()\n expectTypeOf(booleanValue).toEqualTypeOf<boolean | undefined>()\n })\n\n it('accepts an explicit generic value type', () => {\n const value = inferBreakpointValue<number>({ base: 1, md: 2 })\n\n expectTypeOf(value).toEqualTypeOf<number | undefined>()\n })\n})\n"],"mappings":"wLASA,SAAS,yBAA4B,CACnC,GAAG,gEAAmE,CACpE,WAAW,qBAAqB,IAAI,CAEpC,GAAM,CAAE,UAAW,MAAiB,EAAmB,CAAE,KAAM,EAAG,GAAI,EAAG,CAAC,CAAC,CAE3E,OAAO,EAAO,QAAQ,CAAC,KAAK,EAAE,EAC9B,CAEF,GAAG,0DAA6D,CAC9D,WAAW,qBAAqB,KAAK,CAErC,GAAM,CAAE,UAAW,MAAiB,EAAmB,CAAE,KAAM,EAAG,GAAI,EAAG,GAAI,EAAG,GAAI,EAAG,CAAC,CAAC,CAEzF,OAAO,EAAO,QAAQ,CAAC,KAAK,EAAE,EAC9B,CAEF,GAAG,yEAA4E,CAC7E,WAAW,qBAAqB,IAAI,CAEpC,GAAM,CAAE,UAAW,MAAiB,EAAmB,CAAE,KAAM,OAAQ,GAAI,QAAS,CAAC,CAAC,CAEtF,OAAO,EAAO,QAAQ,CAAC,KAAK,OAAO,EACnC,CAEF,GAAG,iDAAoD,CACrD,WAAW,qBAAqB,IAAI,CACpC,GAAM,CAAE,UAAW,MAAiB,EAAmB,CAAE,KAAM,GAAO,GAAI,GAAM,CAAC,CAAC,CAElF,OAAO,EAAO,QAAQ,CAAC,KAAK,GAAM,CAElC,MAAU,CACR,WAAW,qBAAqB,IAAI,EACpC,CACF,OAAO,EAAO,QAAQ,CAAC,KAAK,GAAK,EACjC,CAEF,GAAG,gDAAmD,EAKpD,EAAA,EAAA,cAAa,OAAY,CAAC,eAAmC,EAC7D,EAAA,EAAA,cAAa,OAAY,CAAC,eAAmC,EAC7D,EAAA,EAAA,cAAa,OAAa,CAAC,eAAoC,EAC/D,CAEF,GAAG,6CAAgD,EAGjD,EAAA,EAAA,cAFc,OAEK,CAAC,eAAmC,EACvD,EACF"}
1
+ {"version":3,"file":"use-breakpoint-value.spec.js","names":[],"sources":["../../src/hooks/use-breakpoint-value.spec.ts"],"sourcesContent":["import { act, renderHook } from '@testing-library/react'\nimport { expectTypeOf } from 'vitest'\n\nimport { useBreakpointValue } from './use-breakpoint-value'\n\nfunction inferBreakpointValue<T>(_values: Parameters<typeof useBreakpointValue<T>>[0]) {\n return undefined as ReturnType<typeof useBreakpointValue<T>>\n}\n\ndescribe('useBreakpointValue', () => {\n it('returns the base value below the first defined breakpoint', () => {\n globalThis.setTestViewportWidth(500)\n\n const { result } = renderHook(() => useBreakpointValue({ base: 1, md: 2 }))\n\n expect(result.current).toBe(1)\n })\n\n it('returns the largest defined active breakpoint value', () => {\n globalThis.setTestViewportWidth(1200)\n\n const { result } = renderHook(() => useBreakpointValue({ base: 1, md: 2, lg: 3, xl: 4 }))\n\n expect(result.current).toBe(3)\n })\n\n it('keeps the previous fallback when an active breakpoint has no value', () => {\n globalThis.setTestViewportWidth(900)\n\n const { result } = renderHook(() => useBreakpointValue({ base: 'base', lg: 'large' }))\n\n expect(result.current).toBe('base')\n })\n\n it('updates when the active breakpoint changes', () => {\n globalThis.setTestViewportWidth(500)\n const { result } = renderHook(() => useBreakpointValue({ base: false, md: true }))\n\n expect(result.current).toBe(false)\n\n act(() => {\n globalThis.setTestViewportWidth(768)\n })\n expect(result.current).toBe(true)\n })\n\n it('infers value types from the values object', () => {\n const numberValue = inferBreakpointValue({ base: 1, md: 2 })\n const stringValue = inferBreakpointValue({ base: 'base', md: 'medium' })\n const booleanValue = inferBreakpointValue({ base: false, md: true })\n\n expectTypeOf(numberValue).toEqualTypeOf<number | undefined>()\n expectTypeOf(stringValue).toEqualTypeOf<string | undefined>()\n expectTypeOf(booleanValue).toEqualTypeOf<boolean | undefined>()\n })\n\n it('accepts an explicit generic value type', () => {\n const value = inferBreakpointValue<number>({ base: 1, md: 2 })\n\n expectTypeOf(value).toEqualTypeOf<number | undefined>()\n })\n})\n"],"mappings":"wLASA,SAAS,yBAA4B,CACnC,GAAG,gEAAmE,CACpE,WAAW,qBAAqB,GAAG,EAEnC,GAAM,CAAE,UAAW,MAAiB,EAAmB,CAAE,KAAM,EAAG,GAAI,CAAE,CAAC,CAAC,EAE1E,OAAO,EAAO,OAAO,EAAE,KAAK,CAAC,CAC/B,CAAC,EAED,GAAG,0DAA6D,CAC9D,WAAW,qBAAqB,IAAI,EAEpC,GAAM,CAAE,UAAW,MAAiB,EAAmB,CAAE,KAAM,EAAG,GAAI,EAAG,GAAI,EAAG,GAAI,CAAE,CAAC,CAAC,EAExF,OAAO,EAAO,OAAO,EAAE,KAAK,CAAC,CAC/B,CAAC,EAED,GAAG,yEAA4E,CAC7E,WAAW,qBAAqB,GAAG,EAEnC,GAAM,CAAE,UAAW,MAAiB,EAAmB,CAAE,KAAM,OAAQ,GAAI,OAAQ,CAAC,CAAC,EAErF,OAAO,EAAO,OAAO,EAAE,KAAK,MAAM,CACpC,CAAC,EAED,GAAG,iDAAoD,CACrD,WAAW,qBAAqB,GAAG,EACnC,GAAM,CAAE,UAAW,MAAiB,EAAmB,CAAE,KAAM,GAAO,GAAI,EAAK,CAAC,CAAC,EAEjF,OAAO,EAAO,OAAO,EAAE,KAAK,EAAK,EAEjC,MAAU,CACR,WAAW,qBAAqB,GAAG,CACrC,CAAC,EACD,OAAO,EAAO,OAAO,EAAE,KAAK,EAAI,CAClC,CAAC,EAED,GAAG,gDAAmD,EAKpD,EAAA,EAAA,cAAa,MAAW,EAAE,cAAkC,GAC5D,EAAA,EAAA,cAAa,MAAW,EAAE,cAAkC,GAC5D,EAAA,EAAA,cAAa,MAAY,EAAE,cAAmC,CAChE,CAAC,EAED,GAAG,6CAAgD,EAGjD,EAAA,EAAA,cAAa,IAAA,EAAK,EAAE,cAAkC,CACxD,CAAC,CACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-breakpoint.js","names":[],"sources":["../../src/hooks/use-breakpoint.ts"],"sourcesContent":["import * as React from 'react'\n\nexport type Breakpoint = 'base' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n\nexport const breakpointValues: Record<Exclude<Breakpoint, 'base'>, number> = {\n sm: 640,\n md: 768,\n lg: 1024,\n xl: 1280,\n '2xl': 1536\n}\n\nexport function useBreakpoint(breakpoint: Breakpoint) {\n const [matches, setMatches] = React.useState(breakpoint === 'base')\n\n React.useEffect(() => {\n if (breakpoint === 'base') {\n setMatches(true)\n return\n }\n\n const mql = window.matchMedia(`(min-width: ${breakpointValues[breakpoint]}px)`)\n const onChange = () => {\n setMatches(mql.matches)\n }\n\n mql.addEventListener('change', onChange)\n setMatches(mql.matches)\n\n return () => mql.removeEventListener('change', onChange)\n }, [breakpoint])\n\n return breakpoint === 'base' || matches\n}\n"],"mappings":"qDAIA,MAAa,EAAgE,CAC3E,GAAI,IACJ,GAAI,IACJ,GAAI,KACJ,GAAI,KACJ,MAAO,KACR,CAED,SAAgB,cAAc,EAAwB,CACpD,GAAM,CAAC,EAAS,GAAc,EAAM,SAAS,IAAe,OAAO,CAmBnE,OAjBA,EAAM,cAAgB,CACpB,GAAI,IAAe,OAAQ,CACzB,EAAW,GAAK,CAChB,OAGF,IAAM,EAAM,OAAO,WAAW,eAAe,EAAiB,GAAY,KAAK,CACzE,aAAiB,CACrB,EAAW,EAAI,QAAQ,EAMzB,OAHA,EAAI,iBAAiB,SAAU,SAAS,CACxC,EAAW,EAAI,QAAQ,KAEV,EAAI,oBAAoB,SAAU,SAAS,EACvD,CAAC,EAAW,CAAC,CAET,IAAe,QAAU"}
1
+ {"version":3,"file":"use-breakpoint.js","names":[],"sources":["../../src/hooks/use-breakpoint.ts"],"sourcesContent":["import * as React from 'react'\n\nexport type Breakpoint = 'base' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n\nexport const breakpointValues: Record<Exclude<Breakpoint, 'base'>, number> = {\n sm: 640,\n md: 768,\n lg: 1024,\n xl: 1280,\n '2xl': 1536\n}\n\nexport function useBreakpoint(breakpoint: Breakpoint) {\n const [matches, setMatches] = React.useState(breakpoint === 'base')\n\n React.useEffect(() => {\n if (breakpoint === 'base') {\n setMatches(true)\n return\n }\n\n const mql = window.matchMedia(`(min-width: ${breakpointValues[breakpoint]}px)`)\n const onChange = () => {\n setMatches(mql.matches)\n }\n\n mql.addEventListener('change', onChange)\n setMatches(mql.matches)\n\n return () => mql.removeEventListener('change', onChange)\n }, [breakpoint])\n\n return breakpoint === 'base' || matches\n}\n"],"mappings":"qDAIA,MAAa,EAAgE,CAC3E,GAAI,IACJ,GAAI,IACJ,GAAI,KACJ,GAAI,KACJ,MAAO,IACT,EAEA,SAAgB,cAAc,EAAwB,CACpD,GAAM,CAAC,EAAS,GAAc,EAAM,SAAS,IAAe,MAAM,EAmBlE,OAjBA,EAAM,cAAgB,CACpB,GAAI,IAAe,OAAQ,CACzB,EAAW,EAAI,EACf,MACF,CAEA,IAAM,EAAM,OAAO,WAAW,eAAe,EAAiB,GAAY,IAAI,EACxE,aAAiB,CACrB,EAAW,EAAI,OAAO,CACxB,EAKA,OAHA,EAAI,iBAAiB,SAAU,QAAQ,EACvC,EAAW,EAAI,OAAO,MAET,EAAI,oBAAoB,SAAU,QAAQ,CACzD,EAAG,CAAC,CAAU,CAAC,EAER,IAAe,QAAU,CAClC"}
@@ -1,2 +1,2 @@
1
- import"../chunk-CHh1Zzun.js";import{useBreakpoint as e}from"./use-breakpoint.js";import{i as t,t as n}from"../react.esm-D_dNEsWM.js";describe(`useBreakpoint`,()=>{it(`returns true for the base breakpoint`,()=>{globalThis.setTestViewportWidth(320);let{result:n}=t(()=>e(`base`));expect(n.current).toBe(!0)}),it(`returns false below the requested breakpoint`,()=>{globalThis.setTestViewportWidth(767);let{result:n}=t(()=>e(`md`));expect(n.current).toBe(!1)}),it(`returns true at the requested breakpoint`,()=>{globalThis.setTestViewportWidth(768);let{result:n}=t(()=>e(`md`));expect(n.current).toBe(!0)}),it(`returns true above the requested breakpoint`,()=>{globalThis.setTestViewportWidth(900);let{result:n}=t(()=>e(`md`));expect(n.current).toBe(!0)}),it(`updates when the media query changes`,()=>{globalThis.setTestViewportWidth(1024);let{result:r}=t(()=>e(`lg`));expect(r.current).toBe(!0),n(()=>{globalThis.setTestViewportWidth(900)}),expect(r.current).toBe(!1),n(()=>{globalThis.setTestViewportWidth(1200)}),expect(r.current).toBe(!0)}),it(`removes the media query listener on unmount`,()=>{let n=vi.fn();vi.spyOn(window,`matchMedia`).mockReturnValue({matches:!1,media:`(min-width: 768px)`,onchange:null,addEventListener:vi.fn(),removeEventListener:n,dispatchEvent:vi.fn(),addListener:vi.fn(),removeListener:vi.fn()});let{unmount:r}=t(()=>e(`md`));r(),expect(n).toHaveBeenCalledWith(`change`,expect.any(Function))})});
1
+ import"../chunk-CHh1Zzun.js";import{useBreakpoint as e}from"./use-breakpoint.js";import{i as t,t as n}from"../react.esm-BagSCtI3.js";describe(`useBreakpoint`,()=>{it(`returns true for the base breakpoint`,()=>{globalThis.setTestViewportWidth(320);let{result:n}=t(()=>e(`base`));expect(n.current).toBe(!0)}),it(`returns false below the requested breakpoint`,()=>{globalThis.setTestViewportWidth(767);let{result:n}=t(()=>e(`md`));expect(n.current).toBe(!1)}),it(`returns true at the requested breakpoint`,()=>{globalThis.setTestViewportWidth(768);let{result:n}=t(()=>e(`md`));expect(n.current).toBe(!0)}),it(`returns true above the requested breakpoint`,()=>{globalThis.setTestViewportWidth(900);let{result:n}=t(()=>e(`md`));expect(n.current).toBe(!0)}),it(`updates when the media query changes`,()=>{globalThis.setTestViewportWidth(1024);let{result:r}=t(()=>e(`lg`));expect(r.current).toBe(!0),n(()=>{globalThis.setTestViewportWidth(900)}),expect(r.current).toBe(!1),n(()=>{globalThis.setTestViewportWidth(1200)}),expect(r.current).toBe(!0)}),it(`removes the media query listener on unmount`,()=>{let n=vi.fn();vi.spyOn(window,`matchMedia`).mockReturnValue({matches:!1,media:`(min-width: 768px)`,onchange:null,addEventListener:vi.fn(),removeEventListener:n,dispatchEvent:vi.fn(),addListener:vi.fn(),removeListener:vi.fn()});let{unmount:r}=t(()=>e(`md`));r(),expect(n).toHaveBeenCalledWith(`change`,expect.any(Function))})});
2
2
  //# sourceMappingURL=use-breakpoint.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-breakpoint.spec.js","names":[],"sources":["../../src/hooks/use-breakpoint.spec.ts"],"sourcesContent":["import { act, renderHook } from '@testing-library/react'\n\nimport { useBreakpoint } from './use-breakpoint'\n\ndescribe('useBreakpoint', () => {\n it('returns true for the base breakpoint', () => {\n globalThis.setTestViewportWidth(320)\n\n const { result } = renderHook(() => useBreakpoint('base'))\n\n expect(result.current).toBe(true)\n })\n\n it('returns false below the requested breakpoint', () => {\n globalThis.setTestViewportWidth(767)\n\n const { result } = renderHook(() => useBreakpoint('md'))\n\n expect(result.current).toBe(false)\n })\n\n it('returns true at the requested breakpoint', () => {\n globalThis.setTestViewportWidth(768)\n\n const { result } = renderHook(() => useBreakpoint('md'))\n\n expect(result.current).toBe(true)\n })\n\n it('returns true above the requested breakpoint', () => {\n globalThis.setTestViewportWidth(900)\n\n const { result } = renderHook(() => useBreakpoint('md'))\n\n expect(result.current).toBe(true)\n })\n\n it('updates when the media query changes', () => {\n globalThis.setTestViewportWidth(1024)\n const { result } = renderHook(() => useBreakpoint('lg'))\n\n expect(result.current).toBe(true)\n\n act(() => {\n globalThis.setTestViewportWidth(900)\n })\n expect(result.current).toBe(false)\n\n act(() => {\n globalThis.setTestViewportWidth(1200)\n })\n expect(result.current).toBe(true)\n })\n\n it('removes the media query listener on unmount', () => {\n const removeEventListener = vi.fn()\n\n vi.spyOn(window, 'matchMedia').mockReturnValue({\n matches: false,\n media: '(min-width: 768px)',\n onchange: null,\n addEventListener: vi.fn(),\n removeEventListener,\n dispatchEvent: vi.fn(),\n addListener: vi.fn(),\n removeListener: vi.fn()\n })\n\n const { unmount } = renderHook(() => useBreakpoint('md'))\n\n unmount()\n\n expect(removeEventListener).toHaveBeenCalledWith('change', expect.any(Function))\n })\n})\n"],"mappings":"qIAIA,SAAS,oBAAuB,CAC9B,GAAG,2CAA8C,CAC/C,WAAW,qBAAqB,IAAI,CAEpC,GAAM,CAAE,UAAW,MAAiB,EAAc,OAAO,CAAC,CAE1D,OAAO,EAAO,QAAQ,CAAC,KAAK,GAAK,EACjC,CAEF,GAAG,mDAAsD,CACvD,WAAW,qBAAqB,IAAI,CAEpC,GAAM,CAAE,UAAW,MAAiB,EAAc,KAAK,CAAC,CAExD,OAAO,EAAO,QAAQ,CAAC,KAAK,GAAM,EAClC,CAEF,GAAG,+CAAkD,CACnD,WAAW,qBAAqB,IAAI,CAEpC,GAAM,CAAE,UAAW,MAAiB,EAAc,KAAK,CAAC,CAExD,OAAO,EAAO,QAAQ,CAAC,KAAK,GAAK,EACjC,CAEF,GAAG,kDAAqD,CACtD,WAAW,qBAAqB,IAAI,CAEpC,GAAM,CAAE,UAAW,MAAiB,EAAc,KAAK,CAAC,CAExD,OAAO,EAAO,QAAQ,CAAC,KAAK,GAAK,EACjC,CAEF,GAAG,2CAA8C,CAC/C,WAAW,qBAAqB,KAAK,CACrC,GAAM,CAAE,UAAW,MAAiB,EAAc,KAAK,CAAC,CAExD,OAAO,EAAO,QAAQ,CAAC,KAAK,GAAK,CAEjC,MAAU,CACR,WAAW,qBAAqB,IAAI,EACpC,CACF,OAAO,EAAO,QAAQ,CAAC,KAAK,GAAM,CAElC,MAAU,CACR,WAAW,qBAAqB,KAAK,EACrC,CACF,OAAO,EAAO,QAAQ,CAAC,KAAK,GAAK,EACjC,CAEF,GAAG,kDAAqD,CACtD,IAAM,EAAsB,GAAG,IAAI,CAEnC,GAAG,MAAM,OAAQ,aAAa,CAAC,gBAAgB,CAC7C,QAAS,GACT,MAAO,qBACP,SAAU,KACV,iBAAkB,GAAG,IAAI,CACzB,sBACA,cAAe,GAAG,IAAI,CACtB,YAAa,GAAG,IAAI,CACpB,eAAgB,GAAG,IAAI,CACxB,CAAC,CAEF,GAAM,CAAE,WAAY,MAAiB,EAAc,KAAK,CAAC,CAEzD,GAAS,CAET,OAAO,EAAoB,CAAC,qBAAqB,SAAU,OAAO,IAAI,SAAS,CAAC,EAChF,EACF"}
1
+ {"version":3,"file":"use-breakpoint.spec.js","names":[],"sources":["../../src/hooks/use-breakpoint.spec.ts"],"sourcesContent":["import { act, renderHook } from '@testing-library/react'\n\nimport { useBreakpoint } from './use-breakpoint'\n\ndescribe('useBreakpoint', () => {\n it('returns true for the base breakpoint', () => {\n globalThis.setTestViewportWidth(320)\n\n const { result } = renderHook(() => useBreakpoint('base'))\n\n expect(result.current).toBe(true)\n })\n\n it('returns false below the requested breakpoint', () => {\n globalThis.setTestViewportWidth(767)\n\n const { result } = renderHook(() => useBreakpoint('md'))\n\n expect(result.current).toBe(false)\n })\n\n it('returns true at the requested breakpoint', () => {\n globalThis.setTestViewportWidth(768)\n\n const { result } = renderHook(() => useBreakpoint('md'))\n\n expect(result.current).toBe(true)\n })\n\n it('returns true above the requested breakpoint', () => {\n globalThis.setTestViewportWidth(900)\n\n const { result } = renderHook(() => useBreakpoint('md'))\n\n expect(result.current).toBe(true)\n })\n\n it('updates when the media query changes', () => {\n globalThis.setTestViewportWidth(1024)\n const { result } = renderHook(() => useBreakpoint('lg'))\n\n expect(result.current).toBe(true)\n\n act(() => {\n globalThis.setTestViewportWidth(900)\n })\n expect(result.current).toBe(false)\n\n act(() => {\n globalThis.setTestViewportWidth(1200)\n })\n expect(result.current).toBe(true)\n })\n\n it('removes the media query listener on unmount', () => {\n const removeEventListener = vi.fn()\n\n vi.spyOn(window, 'matchMedia').mockReturnValue({\n matches: false,\n media: '(min-width: 768px)',\n onchange: null,\n addEventListener: vi.fn(),\n removeEventListener,\n dispatchEvent: vi.fn(),\n addListener: vi.fn(),\n removeListener: vi.fn()\n })\n\n const { unmount } = renderHook(() => useBreakpoint('md'))\n\n unmount()\n\n expect(removeEventListener).toHaveBeenCalledWith('change', expect.any(Function))\n })\n})\n"],"mappings":"qIAIA,SAAS,oBAAuB,CAC9B,GAAG,2CAA8C,CAC/C,WAAW,qBAAqB,GAAG,EAEnC,GAAM,CAAE,UAAW,MAAiB,EAAc,MAAM,CAAC,EAEzD,OAAO,EAAO,OAAO,EAAE,KAAK,EAAI,CAClC,CAAC,EAED,GAAG,mDAAsD,CACvD,WAAW,qBAAqB,GAAG,EAEnC,GAAM,CAAE,UAAW,MAAiB,EAAc,IAAI,CAAC,EAEvD,OAAO,EAAO,OAAO,EAAE,KAAK,EAAK,CACnC,CAAC,EAED,GAAG,+CAAkD,CACnD,WAAW,qBAAqB,GAAG,EAEnC,GAAM,CAAE,UAAW,MAAiB,EAAc,IAAI,CAAC,EAEvD,OAAO,EAAO,OAAO,EAAE,KAAK,EAAI,CAClC,CAAC,EAED,GAAG,kDAAqD,CACtD,WAAW,qBAAqB,GAAG,EAEnC,GAAM,CAAE,UAAW,MAAiB,EAAc,IAAI,CAAC,EAEvD,OAAO,EAAO,OAAO,EAAE,KAAK,EAAI,CAClC,CAAC,EAED,GAAG,2CAA8C,CAC/C,WAAW,qBAAqB,IAAI,EACpC,GAAM,CAAE,UAAW,MAAiB,EAAc,IAAI,CAAC,EAEvD,OAAO,EAAO,OAAO,EAAE,KAAK,EAAI,EAEhC,MAAU,CACR,WAAW,qBAAqB,GAAG,CACrC,CAAC,EACD,OAAO,EAAO,OAAO,EAAE,KAAK,EAAK,EAEjC,MAAU,CACR,WAAW,qBAAqB,IAAI,CACtC,CAAC,EACD,OAAO,EAAO,OAAO,EAAE,KAAK,EAAI,CAClC,CAAC,EAED,GAAG,kDAAqD,CACtD,IAAM,EAAsB,GAAG,GAAG,EAElC,GAAG,MAAM,OAAQ,YAAY,EAAE,gBAAgB,CAC7C,QAAS,GACT,MAAO,qBACP,SAAU,KACV,iBAAkB,GAAG,GAAG,EACxB,sBACA,cAAe,GAAG,GAAG,EACrB,YAAa,GAAG,GAAG,EACnB,eAAgB,GAAG,GAAG,CACxB,CAAC,EAED,GAAM,CAAE,WAAY,MAAiB,EAAc,IAAI,CAAC,EAExD,EAAQ,EAER,OAAO,CAAmB,EAAE,qBAAqB,SAAU,OAAO,IAAI,QAAQ,CAAC,CACjF,CAAC,CACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-disclosure.js","names":[],"sources":["../../src/hooks/use-disclosure.ts"],"sourcesContent":["import { useCallback, useState } from 'react'\n\nexport type UseDisclosureOptions = {\n onOpen?: () => void\n onClose?: () => void\n}\n\nexport type UseDisclosureHandlers = {\n set: (value: boolean) => void\n open: () => void\n close: () => void\n toggle: () => void\n}\n\nexport type UseDisclosureReturnValue = [boolean, UseDisclosureHandlers]\n\nexport function useDisclosure(initialState = false, options: UseDisclosureOptions = {}): UseDisclosureReturnValue {\n const [opened, setOpened] = useState(initialState)\n\n const open = useCallback(() => {\n setOpened((isOpened) => {\n if (!isOpened) {\n options.onOpen?.()\n return true\n }\n return isOpened\n })\n }, [options.onOpen])\n\n const close = useCallback(() => {\n setOpened((isOpened) => {\n if (isOpened) {\n options.onClose?.()\n return false\n }\n return isOpened\n })\n }, [options.onClose])\n\n const toggle = useCallback(() => {\n opened ? close() : open()\n }, [close, open, opened])\n\n return [opened, { open, close, toggle, set: setOpened }]\n}\n\nexport namespace useDisclosure {\n export type Options = UseDisclosureOptions\n export type Handlers = UseDisclosureHandlers\n export type ReturnValue = UseDisclosureReturnValue\n}\n"],"mappings":"+EAgBA,SAAgB,cAAc,EAAe,GAAO,EAAgC,EAAE,CAA4B,CAChH,GAAM,CAAC,EAAQ,GAAa,EAAS,EAAa,CAE5C,EAAO,MAAkB,CAC7B,EAAW,GACJ,IACH,EAAQ,UAAU,CACX,IAGT,EACD,CAAC,EAAQ,OAAO,CAAC,CAEd,EAAQ,MAAkB,CAC9B,EAAW,GACL,IACF,EAAQ,WAAW,CACZ,IAGT,EACD,CAAC,EAAQ,QAAQ,CAAC,CAMrB,MAAO,CAAC,EAAQ,CAAE,OAAM,QAAO,OAJhB,MAAkB,CAC/B,EAAS,GAAO,CAAG,GAAM,EACxB,CAAC,EAAO,EAAM,EAAO,CAEa,CAAE,IAAK,EAAW,CAAC"}
1
+ {"version":3,"file":"use-disclosure.js","names":[],"sources":["../../src/hooks/use-disclosure.ts"],"sourcesContent":["import { useCallback, useState } from 'react'\n\nexport type UseDisclosureOptions = {\n onOpen?: () => void\n onClose?: () => void\n}\n\nexport type UseDisclosureHandlers = {\n set: (value: boolean) => void\n open: () => void\n close: () => void\n toggle: () => void\n}\n\nexport type UseDisclosureReturnValue = [boolean, UseDisclosureHandlers]\n\nexport function useDisclosure(initialState = false, options: UseDisclosureOptions = {}): UseDisclosureReturnValue {\n const [opened, setOpened] = useState(initialState)\n\n const open = useCallback(() => {\n setOpened((isOpened) => {\n if (!isOpened) {\n options.onOpen?.()\n return true\n }\n return isOpened\n })\n }, [options.onOpen])\n\n const close = useCallback(() => {\n setOpened((isOpened) => {\n if (isOpened) {\n options.onClose?.()\n return false\n }\n return isOpened\n })\n }, [options.onClose])\n\n const toggle = useCallback(() => {\n opened ? close() : open()\n }, [close, open, opened])\n\n return [opened, { open, close, toggle, set: setOpened }]\n}\n\nexport namespace useDisclosure {\n export type Options = UseDisclosureOptions\n export type Handlers = UseDisclosureHandlers\n export type ReturnValue = UseDisclosureReturnValue\n}\n"],"mappings":"+EAgBA,SAAgB,cAAc,EAAe,GAAO,EAAgC,CAAC,EAA6B,CAChH,GAAM,CAAC,EAAQ,GAAa,EAAS,CAAY,EAE3C,EAAO,MAAkB,CAC7B,EAAW,GACJ,IACH,EAAQ,SAAS,EACV,GAGV,CACH,EAAG,CAAC,EAAQ,MAAM,CAAC,EAEb,EAAQ,MAAkB,CAC9B,EAAW,GACL,IACF,EAAQ,UAAU,EACX,GAGV,CACH,EAAG,CAAC,EAAQ,OAAO,CAAC,EAMpB,MAAO,CAAC,EAAQ,CAAE,OAAM,QAAO,OAJhB,MAAkB,CAC/B,EAAS,EAAM,EAAI,EAAK,CAC1B,EAAG,CAAC,EAAO,EAAM,CAAM,CAEa,EAAG,IAAK,CAAU,CAAC,CACzD"}
@@ -1,2 +1,2 @@
1
- import"../chunk-CHh1Zzun.js";import{useDisclosure as e}from"./use-disclosure.js";import{i as t,t as n}from"../react.esm-D_dNEsWM.js";describe(`useDisclosure`,()=>{it(`uses false as the default initial state`,()=>{let{result:n}=t(()=>e());expect(n.current[0]).toBe(!1)}),it(`uses the provided initial state`,()=>{let{result:n}=t(()=>e(!0));expect(n.current[0]).toBe(!0)}),it(`opens, closes, toggles, and sets the state`,()=>{let{result:r}=t(()=>e());n(()=>r.current[1].open()),expect(r.current[0]).toBe(!0),n(()=>r.current[1].close()),expect(r.current[0]).toBe(!1),n(()=>r.current[1].toggle()),expect(r.current[0]).toBe(!0),n(()=>r.current[1].set(!1)),expect(r.current[0]).toBe(!1)}),it(`calls callbacks only when state transitions happen`,()=>{let r=vi.fn(),i=vi.fn(),{result:a}=t(()=>e(!1,{onOpen:r,onClose:i}));n(()=>a.current[1].close()),expect(i).not.toHaveBeenCalled(),n(()=>a.current[1].open()),n(()=>a.current[1].open()),expect(r).toHaveBeenCalledTimes(1),n(()=>a.current[1].close()),n(()=>a.current[1].close()),expect(i).toHaveBeenCalledTimes(1)})});
1
+ import"../chunk-CHh1Zzun.js";import{useDisclosure as e}from"./use-disclosure.js";import{i as t,t as n}from"../react.esm-BagSCtI3.js";describe(`useDisclosure`,()=>{it(`uses false as the default initial state`,()=>{let{result:n}=t(()=>e());expect(n.current[0]).toBe(!1)}),it(`uses the provided initial state`,()=>{let{result:n}=t(()=>e(!0));expect(n.current[0]).toBe(!0)}),it(`opens, closes, toggles, and sets the state`,()=>{let{result:r}=t(()=>e());n(()=>r.current[1].open()),expect(r.current[0]).toBe(!0),n(()=>r.current[1].close()),expect(r.current[0]).toBe(!1),n(()=>r.current[1].toggle()),expect(r.current[0]).toBe(!0),n(()=>r.current[1].set(!1)),expect(r.current[0]).toBe(!1)}),it(`calls callbacks only when state transitions happen`,()=>{let r=vi.fn(),i=vi.fn(),{result:a}=t(()=>e(!1,{onOpen:r,onClose:i}));n(()=>a.current[1].close()),expect(i).not.toHaveBeenCalled(),n(()=>a.current[1].open()),n(()=>a.current[1].open()),expect(r).toHaveBeenCalledTimes(1),n(()=>a.current[1].close()),n(()=>a.current[1].close()),expect(i).toHaveBeenCalledTimes(1)})});
2
2
  //# sourceMappingURL=use-disclosure.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-disclosure.spec.js","names":[],"sources":["../../src/hooks/use-disclosure.spec.ts"],"sourcesContent":["import { act, renderHook } from '@testing-library/react'\n\nimport { useDisclosure } from './use-disclosure'\n\ndescribe('useDisclosure', () => {\n it('uses false as the default initial state', () => {\n const { result } = renderHook(() => useDisclosure())\n\n expect(result.current[0]).toBe(false)\n })\n\n it('uses the provided initial state', () => {\n const { result } = renderHook(() => useDisclosure(true))\n\n expect(result.current[0]).toBe(true)\n })\n\n it('opens, closes, toggles, and sets the state', () => {\n const { result } = renderHook(() => useDisclosure())\n\n act(() => result.current[1].open())\n expect(result.current[0]).toBe(true)\n\n act(() => result.current[1].close())\n expect(result.current[0]).toBe(false)\n\n act(() => result.current[1].toggle())\n expect(result.current[0]).toBe(true)\n\n act(() => result.current[1].set(false))\n expect(result.current[0]).toBe(false)\n })\n\n it('calls callbacks only when state transitions happen', () => {\n const onOpen = vi.fn()\n const onClose = vi.fn()\n const { result } = renderHook(() => useDisclosure(false, { onOpen, onClose }))\n\n act(() => result.current[1].close())\n expect(onClose).not.toHaveBeenCalled()\n\n act(() => result.current[1].open())\n act(() => result.current[1].open())\n expect(onOpen).toHaveBeenCalledTimes(1)\n\n act(() => result.current[1].close())\n act(() => result.current[1].close())\n expect(onClose).toHaveBeenCalledTimes(1)\n })\n})\n"],"mappings":"qIAIA,SAAS,oBAAuB,CAC9B,GAAG,8CAAiD,CAClD,GAAM,CAAE,UAAW,MAAiB,GAAe,CAAC,CAEpD,OAAO,EAAO,QAAQ,GAAG,CAAC,KAAK,GAAM,EACrC,CAEF,GAAG,sCAAyC,CAC1C,GAAM,CAAE,UAAW,MAAiB,EAAc,GAAK,CAAC,CAExD,OAAO,EAAO,QAAQ,GAAG,CAAC,KAAK,GAAK,EACpC,CAEF,GAAG,iDAAoD,CACrD,GAAM,CAAE,UAAW,MAAiB,GAAe,CAAC,CAEpD,MAAU,EAAO,QAAQ,GAAG,MAAM,CAAC,CACnC,OAAO,EAAO,QAAQ,GAAG,CAAC,KAAK,GAAK,CAEpC,MAAU,EAAO,QAAQ,GAAG,OAAO,CAAC,CACpC,OAAO,EAAO,QAAQ,GAAG,CAAC,KAAK,GAAM,CAErC,MAAU,EAAO,QAAQ,GAAG,QAAQ,CAAC,CACrC,OAAO,EAAO,QAAQ,GAAG,CAAC,KAAK,GAAK,CAEpC,MAAU,EAAO,QAAQ,GAAG,IAAI,GAAM,CAAC,CACvC,OAAO,EAAO,QAAQ,GAAG,CAAC,KAAK,GAAM,EACrC,CAEF,GAAG,yDAA4D,CAC7D,IAAM,EAAS,GAAG,IAAI,CAChB,EAAU,GAAG,IAAI,CACjB,CAAE,UAAW,MAAiB,EAAc,GAAO,CAAE,SAAQ,UAAS,CAAC,CAAC,CAE9E,MAAU,EAAO,QAAQ,GAAG,OAAO,CAAC,CACpC,OAAO,EAAQ,CAAC,IAAI,kBAAkB,CAEtC,MAAU,EAAO,QAAQ,GAAG,MAAM,CAAC,CACnC,MAAU,EAAO,QAAQ,GAAG,MAAM,CAAC,CACnC,OAAO,EAAO,CAAC,sBAAsB,EAAE,CAEvC,MAAU,EAAO,QAAQ,GAAG,OAAO,CAAC,CACpC,MAAU,EAAO,QAAQ,GAAG,OAAO,CAAC,CACpC,OAAO,EAAQ,CAAC,sBAAsB,EAAE,EACxC,EACF"}
1
+ {"version":3,"file":"use-disclosure.spec.js","names":[],"sources":["../../src/hooks/use-disclosure.spec.ts"],"sourcesContent":["import { act, renderHook } from '@testing-library/react'\n\nimport { useDisclosure } from './use-disclosure'\n\ndescribe('useDisclosure', () => {\n it('uses false as the default initial state', () => {\n const { result } = renderHook(() => useDisclosure())\n\n expect(result.current[0]).toBe(false)\n })\n\n it('uses the provided initial state', () => {\n const { result } = renderHook(() => useDisclosure(true))\n\n expect(result.current[0]).toBe(true)\n })\n\n it('opens, closes, toggles, and sets the state', () => {\n const { result } = renderHook(() => useDisclosure())\n\n act(() => result.current[1].open())\n expect(result.current[0]).toBe(true)\n\n act(() => result.current[1].close())\n expect(result.current[0]).toBe(false)\n\n act(() => result.current[1].toggle())\n expect(result.current[0]).toBe(true)\n\n act(() => result.current[1].set(false))\n expect(result.current[0]).toBe(false)\n })\n\n it('calls callbacks only when state transitions happen', () => {\n const onOpen = vi.fn()\n const onClose = vi.fn()\n const { result } = renderHook(() => useDisclosure(false, { onOpen, onClose }))\n\n act(() => result.current[1].close())\n expect(onClose).not.toHaveBeenCalled()\n\n act(() => result.current[1].open())\n act(() => result.current[1].open())\n expect(onOpen).toHaveBeenCalledTimes(1)\n\n act(() => result.current[1].close())\n act(() => result.current[1].close())\n expect(onClose).toHaveBeenCalledTimes(1)\n })\n})\n"],"mappings":"qIAIA,SAAS,oBAAuB,CAC9B,GAAG,8CAAiD,CAClD,GAAM,CAAE,UAAW,MAAiB,EAAc,CAAC,EAEnD,OAAO,EAAO,QAAQ,EAAE,EAAE,KAAK,EAAK,CACtC,CAAC,EAED,GAAG,sCAAyC,CAC1C,GAAM,CAAE,UAAW,MAAiB,EAAc,EAAI,CAAC,EAEvD,OAAO,EAAO,QAAQ,EAAE,EAAE,KAAK,EAAI,CACrC,CAAC,EAED,GAAG,iDAAoD,CACrD,GAAM,CAAE,UAAW,MAAiB,EAAc,CAAC,EAEnD,MAAU,EAAO,QAAQ,GAAG,KAAK,CAAC,EAClC,OAAO,EAAO,QAAQ,EAAE,EAAE,KAAK,EAAI,EAEnC,MAAU,EAAO,QAAQ,GAAG,MAAM,CAAC,EACnC,OAAO,EAAO,QAAQ,EAAE,EAAE,KAAK,EAAK,EAEpC,MAAU,EAAO,QAAQ,GAAG,OAAO,CAAC,EACpC,OAAO,EAAO,QAAQ,EAAE,EAAE,KAAK,EAAI,EAEnC,MAAU,EAAO,QAAQ,GAAG,IAAI,EAAK,CAAC,EACtC,OAAO,EAAO,QAAQ,EAAE,EAAE,KAAK,EAAK,CACtC,CAAC,EAED,GAAG,yDAA4D,CAC7D,IAAM,EAAS,GAAG,GAAG,EACf,EAAU,GAAG,GAAG,EAChB,CAAE,UAAW,MAAiB,EAAc,GAAO,CAAE,SAAQ,SAAQ,CAAC,CAAC,EAE7E,MAAU,EAAO,QAAQ,GAAG,MAAM,CAAC,EACnC,OAAO,CAAO,EAAE,IAAI,iBAAiB,EAErC,MAAU,EAAO,QAAQ,GAAG,KAAK,CAAC,EAClC,MAAU,EAAO,QAAQ,GAAG,KAAK,CAAC,EAClC,OAAO,CAAM,EAAE,sBAAsB,CAAC,EAEtC,MAAU,EAAO,QAAQ,GAAG,MAAM,CAAC,EACnC,MAAU,EAAO,QAAQ,GAAG,MAAM,CAAC,EACnC,OAAO,CAAO,EAAE,sBAAsB,CAAC,CACzC,CAAC,CACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-document-visibility.js","names":[],"sources":["../../src/hooks/use-document-visibility.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\n\nexport function useDocumentVisibility(): DocumentVisibilityState {\n const [documentVisibility, setDocumentVisibility] = useState<DocumentVisibilityState>('visible')\n\n useEffect(() => {\n setDocumentVisibility(document.visibilityState)\n const listener = () => setDocumentVisibility(document.visibilityState)\n document.addEventListener('visibilitychange', listener)\n return () => document.removeEventListener('visibilitychange', listener)\n }, [])\n\n return documentVisibility\n}\n"],"mappings":"6EAEA,SAAgB,uBAAiD,CAC/D,GAAM,CAAC,EAAoB,GAAyB,EAAkC,UAAU,CAShG,OAPA,MAAgB,CACd,EAAsB,SAAS,gBAAgB,CAC/C,IAAM,aAAiB,EAAsB,SAAS,gBAAgB,CAEtE,OADA,SAAS,iBAAiB,mBAAoB,SAAS,KAC1C,SAAS,oBAAoB,mBAAoB,SAAS,EACtE,EAAE,CAAC,CAEC"}
1
+ {"version":3,"file":"use-document-visibility.js","names":[],"sources":["../../src/hooks/use-document-visibility.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\n\nexport function useDocumentVisibility(): DocumentVisibilityState {\n const [documentVisibility, setDocumentVisibility] = useState<DocumentVisibilityState>('visible')\n\n useEffect(() => {\n setDocumentVisibility(document.visibilityState)\n const listener = () => setDocumentVisibility(document.visibilityState)\n document.addEventListener('visibilitychange', listener)\n return () => document.removeEventListener('visibilitychange', listener)\n }, [])\n\n return documentVisibility\n}\n"],"mappings":"6EAEA,SAAgB,uBAAiD,CAC/D,GAAM,CAAC,EAAoB,GAAyB,EAAkC,SAAS,EAS/F,OAPA,MAAgB,CACd,EAAsB,SAAS,eAAe,EAC9C,IAAM,aAAiB,EAAsB,SAAS,eAAe,EAErE,OADA,SAAS,iBAAiB,mBAAoB,QAAQ,MACzC,SAAS,oBAAoB,mBAAoB,QAAQ,CACxE,EAAG,CAAC,CAAC,EAEE,CACT"}
@@ -1,2 +1,2 @@
1
- import"../chunk-CHh1Zzun.js";import{useDocumentVisibility as e}from"./use-document-visibility.js";import{i as t,t as n}from"../react.esm-D_dNEsWM.js";function setDocumentVisibility(e){Object.defineProperty(document,`visibilityState`,{configurable:!0,get:()=>e})}describe(`useDocumentVisibility`,()=>{it(`uses the current document visibility on mount`,()=>{setDocumentVisibility(`hidden`);let{result:n}=t(()=>e());expect(n.current).toBe(`hidden`)}),it(`updates when the document visibility changes`,()=>{setDocumentVisibility(`visible`);let{result:r}=t(()=>e());n(()=>{setDocumentVisibility(`hidden`),document.dispatchEvent(new Event(`visibilitychange`))}),expect(r.current).toBe(`hidden`)}),it(`removes the visibility listener on unmount`,()=>{let n=vi.spyOn(document,`removeEventListener`),{unmount:r}=t(()=>e());r(),expect(n).toHaveBeenCalledWith(`visibilitychange`,expect.any(Function))})});
1
+ import"../chunk-CHh1Zzun.js";import{useDocumentVisibility as e}from"./use-document-visibility.js";import{i as t,t as n}from"../react.esm-BagSCtI3.js";function setDocumentVisibility(e){Object.defineProperty(document,`visibilityState`,{configurable:!0,get:()=>e})}describe(`useDocumentVisibility`,()=>{it(`uses the current document visibility on mount`,()=>{setDocumentVisibility(`hidden`);let{result:n}=t(()=>e());expect(n.current).toBe(`hidden`)}),it(`updates when the document visibility changes`,()=>{setDocumentVisibility(`visible`);let{result:r}=t(()=>e());n(()=>{setDocumentVisibility(`hidden`),document.dispatchEvent(new Event(`visibilitychange`))}),expect(r.current).toBe(`hidden`)}),it(`removes the visibility listener on unmount`,()=>{let n=vi.spyOn(document,`removeEventListener`),{unmount:r}=t(()=>e());r(),expect(n).toHaveBeenCalledWith(`visibilitychange`,expect.any(Function))})});
2
2
  //# sourceMappingURL=use-document-visibility.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-document-visibility.spec.js","names":[],"sources":["../../src/hooks/use-document-visibility.spec.ts"],"sourcesContent":["import { act, renderHook } from '@testing-library/react'\n\nimport { useDocumentVisibility } from './use-document-visibility'\n\nfunction setDocumentVisibility(visibilityState: DocumentVisibilityState) {\n Object.defineProperty(document, 'visibilityState', {\n configurable: true,\n get: () => visibilityState\n })\n}\n\ndescribe('useDocumentVisibility', () => {\n it('uses the current document visibility on mount', () => {\n setDocumentVisibility('hidden')\n\n const { result } = renderHook(() => useDocumentVisibility())\n\n expect(result.current).toBe('hidden')\n })\n\n it('updates when the document visibility changes', () => {\n setDocumentVisibility('visible')\n const { result } = renderHook(() => useDocumentVisibility())\n\n act(() => {\n setDocumentVisibility('hidden')\n document.dispatchEvent(new Event('visibilitychange'))\n })\n\n expect(result.current).toBe('hidden')\n })\n\n it('removes the visibility listener on unmount', () => {\n const removeEventListener = vi.spyOn(document, 'removeEventListener')\n const { unmount } = renderHook(() => useDocumentVisibility())\n\n unmount()\n\n expect(removeEventListener).toHaveBeenCalledWith('visibilitychange', expect.any(Function))\n })\n})\n"],"mappings":"sJAIA,SAAS,sBAAsB,EAA0C,CACvE,OAAO,eAAe,SAAU,kBAAmB,CACjD,aAAc,GACd,QAAW,EACZ,CAAC,CAGJ,SAAS,4BAA+B,CACtC,GAAG,oDAAuD,CACxD,sBAAsB,SAAS,CAE/B,GAAM,CAAE,UAAW,MAAiB,GAAuB,CAAC,CAE5D,OAAO,EAAO,QAAQ,CAAC,KAAK,SAAS,EACrC,CAEF,GAAG,mDAAsD,CACvD,sBAAsB,UAAU,CAChC,GAAM,CAAE,UAAW,MAAiB,GAAuB,CAAC,CAE5D,MAAU,CACR,sBAAsB,SAAS,CAC/B,SAAS,cAAc,IAAI,MAAM,mBAAmB,CAAC,EACrD,CAEF,OAAO,EAAO,QAAQ,CAAC,KAAK,SAAS,EACrC,CAEF,GAAG,iDAAoD,CACrD,IAAM,EAAsB,GAAG,MAAM,SAAU,sBAAsB,CAC/D,CAAE,WAAY,MAAiB,GAAuB,CAAC,CAE7D,GAAS,CAET,OAAO,EAAoB,CAAC,qBAAqB,mBAAoB,OAAO,IAAI,SAAS,CAAC,EAC1F,EACF"}
1
+ {"version":3,"file":"use-document-visibility.spec.js","names":[],"sources":["../../src/hooks/use-document-visibility.spec.ts"],"sourcesContent":["import { act, renderHook } from '@testing-library/react'\n\nimport { useDocumentVisibility } from './use-document-visibility'\n\nfunction setDocumentVisibility(visibilityState: DocumentVisibilityState) {\n Object.defineProperty(document, 'visibilityState', {\n configurable: true,\n get: () => visibilityState\n })\n}\n\ndescribe('useDocumentVisibility', () => {\n it('uses the current document visibility on mount', () => {\n setDocumentVisibility('hidden')\n\n const { result } = renderHook(() => useDocumentVisibility())\n\n expect(result.current).toBe('hidden')\n })\n\n it('updates when the document visibility changes', () => {\n setDocumentVisibility('visible')\n const { result } = renderHook(() => useDocumentVisibility())\n\n act(() => {\n setDocumentVisibility('hidden')\n document.dispatchEvent(new Event('visibilitychange'))\n })\n\n expect(result.current).toBe('hidden')\n })\n\n it('removes the visibility listener on unmount', () => {\n const removeEventListener = vi.spyOn(document, 'removeEventListener')\n const { unmount } = renderHook(() => useDocumentVisibility())\n\n unmount()\n\n expect(removeEventListener).toHaveBeenCalledWith('visibilitychange', expect.any(Function))\n })\n})\n"],"mappings":"sJAIA,SAAS,sBAAsB,EAA0C,CACvE,OAAO,eAAe,SAAU,kBAAmB,CACjD,aAAc,GACd,QAAW,CACb,CAAC,CACH,CAEA,SAAS,4BAA+B,CACtC,GAAG,oDAAuD,CACxD,sBAAsB,QAAQ,EAE9B,GAAM,CAAE,UAAW,MAAiB,EAAsB,CAAC,EAE3D,OAAO,EAAO,OAAO,EAAE,KAAK,QAAQ,CACtC,CAAC,EAED,GAAG,mDAAsD,CACvD,sBAAsB,SAAS,EAC/B,GAAM,CAAE,UAAW,MAAiB,EAAsB,CAAC,EAE3D,MAAU,CACR,sBAAsB,QAAQ,EAC9B,SAAS,cAAc,IAAI,MAAM,kBAAkB,CAAC,CACtD,CAAC,EAED,OAAO,EAAO,OAAO,EAAE,KAAK,QAAQ,CACtC,CAAC,EAED,GAAG,iDAAoD,CACrD,IAAM,EAAsB,GAAG,MAAM,SAAU,qBAAqB,EAC9D,CAAE,WAAY,MAAiB,EAAsB,CAAC,EAE5D,EAAQ,EAER,OAAO,CAAmB,EAAE,qBAAqB,mBAAoB,OAAO,IAAI,QAAQ,CAAC,CAC3F,CAAC,CACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-idle.js","names":[],"sources":["../../src/hooks/use-idle.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\n\nexport type UseIdleOptions = {\n events?: (keyof DocumentEventMap)[]\n initialState?: boolean\n}\n\nconst DEFAULT_OPTIONS: Required<UseIdleOptions> = {\n events: ['keydown', 'mousemove', 'touchmove', 'click', 'scroll', 'wheel'],\n initialState: true\n}\n\nexport function useIdle(timeout: number, options?: UseIdleOptions) {\n const { events, initialState } = { ...DEFAULT_OPTIONS, ...options }\n const [idle, setIdle] = useState(initialState)\n const timer = useRef(-1)\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: should not re-execute the effect when `events` changes\n useEffect(() => {\n const handleEvents = () => {\n setIdle(false)\n\n if (timer.current) {\n window.clearTimeout(timer.current)\n }\n\n timer.current = window.setTimeout(() => {\n setIdle(true)\n }, timeout)\n }\n\n for (const event of events) {\n document.addEventListener(event, handleEvents)\n }\n\n // Start the timer immediately instead of waiting for the first event to happen\n timer.current = window.setTimeout(() => {\n setIdle(true)\n }, timeout)\n\n return () => {\n for (const event of events) {\n document.removeEventListener(event, handleEvents)\n }\n\n window.clearTimeout(timer.current)\n timer.current = -1\n }\n }, [timeout])\n\n return idle\n}\n\nexport namespace useIdle {\n export type Options = UseIdleOptions\n}\n"],"mappings":"yFAOA,MAAM,EAA4C,CAChD,OAAQ,CAAC,UAAW,YAAa,YAAa,QAAS,SAAU,QAAQ,CACzE,aAAc,GACf,CAED,SAAgB,QAAQ,EAAiB,EAA0B,CACjE,GAAM,CAAE,SAAQ,gBAAiB,CAAE,GAAG,EAAiB,GAAG,EAAS,CAC7D,CAAC,EAAM,GAAW,EAAS,EAAa,CACxC,EAAQ,EAAO,GAAG,CAmCxB,OAhCA,MAAgB,CACd,IAAM,iBAAqB,CACzB,EAAQ,GAAM,CAEV,EAAM,SACR,OAAO,aAAa,EAAM,QAAQ,CAGpC,EAAM,QAAU,OAAO,eAAiB,CACtC,EAAQ,GAAK,EACZ,EAAQ,EAGb,IAAK,IAAM,KAAS,EAClB,SAAS,iBAAiB,EAAO,aAAa,CAQhD,MAJA,GAAM,QAAU,OAAO,eAAiB,CACtC,EAAQ,GAAK,EACZ,EAAQ,KAEE,CACX,IAAK,IAAM,KAAS,EAClB,SAAS,oBAAoB,EAAO,aAAa,CAGnD,OAAO,aAAa,EAAM,QAAQ,CAClC,EAAM,QAAU,KAEjB,CAAC,EAAQ,CAAC,CAEN"}
1
+ {"version":3,"file":"use-idle.js","names":[],"sources":["../../src/hooks/use-idle.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\n\nexport type UseIdleOptions = {\n events?: (keyof DocumentEventMap)[]\n initialState?: boolean\n}\n\nconst DEFAULT_OPTIONS: Required<UseIdleOptions> = {\n events: ['keydown', 'mousemove', 'touchmove', 'click', 'scroll', 'wheel'],\n initialState: true\n}\n\nexport function useIdle(timeout: number, options?: UseIdleOptions) {\n const { events, initialState } = { ...DEFAULT_OPTIONS, ...options }\n const [idle, setIdle] = useState(initialState)\n const timer = useRef(-1)\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: should not re-execute the effect when `events` changes\n useEffect(() => {\n const handleEvents = () => {\n setIdle(false)\n\n if (timer.current) {\n window.clearTimeout(timer.current)\n }\n\n timer.current = window.setTimeout(() => {\n setIdle(true)\n }, timeout)\n }\n\n for (const event of events) {\n document.addEventListener(event, handleEvents)\n }\n\n // Start the timer immediately instead of waiting for the first event to happen\n timer.current = window.setTimeout(() => {\n setIdle(true)\n }, timeout)\n\n return () => {\n for (const event of events) {\n document.removeEventListener(event, handleEvents)\n }\n\n window.clearTimeout(timer.current)\n timer.current = -1\n }\n }, [timeout])\n\n return idle\n}\n\nexport namespace useIdle {\n export type Options = UseIdleOptions\n}\n"],"mappings":"yFAOA,MAAM,EAA4C,CAChD,OAAQ,CAAC,UAAW,YAAa,YAAa,QAAS,SAAU,OAAO,EACxE,aAAc,EAChB,EAEA,SAAgB,QAAQ,EAAiB,EAA0B,CACjE,GAAM,CAAE,SAAQ,gBAAiB,CAAE,GAAG,EAAiB,GAAG,CAAQ,EAC5D,CAAC,EAAM,GAAW,EAAS,CAAY,EACvC,EAAQ,EAAO,EAAE,EAmCvB,OAhCA,MAAgB,CACd,IAAM,iBAAqB,CACzB,EAAQ,EAAK,EAET,EAAM,SACR,OAAO,aAAa,EAAM,OAAO,EAGnC,EAAM,QAAU,OAAO,eAAiB,CACtC,EAAQ,EAAI,CACd,EAAG,CAAO,CACZ,EAEA,IAAK,IAAM,KAAS,EAClB,SAAS,iBAAiB,EAAO,YAAY,EAQ/C,MAJA,GAAM,QAAU,OAAO,eAAiB,CACtC,EAAQ,EAAI,CACd,EAAG,CAAO,MAEG,CACX,IAAK,IAAM,KAAS,EAClB,SAAS,oBAAoB,EAAO,YAAY,EAGlD,OAAO,aAAa,EAAM,OAAO,EACjC,EAAM,QAAU,EAClB,CACF,EAAG,CAAC,CAAO,CAAC,EAEL,CACT"}
@@ -1,2 +1,2 @@
1
- import"../chunk-CHh1Zzun.js";import{useIdle as e}from"./use-idle.js";import{i as t,t as n}from"../react.esm-D_dNEsWM.js";describe(`useIdle`,()=>{it(`starts idle by default`,()=>{vi.useFakeTimers();let{result:n}=t(()=>e(1e3));expect(n.current).toBe(!0)}),it(`supports a custom initial state and becomes idle after the timeout`,()=>{vi.useFakeTimers();let{result:r}=t(()=>e(1e3,{initialState:!1}));expect(r.current).toBe(!1),n(()=>{vi.advanceTimersByTime(1e3)}),expect(r.current).toBe(!0)}),it(`becomes active on configured events and returns to idle after the timeout`,()=>{vi.useFakeTimers();let{result:r}=t(()=>e(1e3,{events:[`click`]}));n(()=>{document.dispatchEvent(new Event(`click`))}),expect(r.current).toBe(!1),n(()=>{vi.advanceTimersByTime(999)}),expect(r.current).toBe(!1),n(()=>{vi.advanceTimersByTime(1)}),expect(r.current).toBe(!0)}),it(`registers and removes only the configured event listeners`,()=>{vi.useFakeTimers();let n=vi.spyOn(document,`addEventListener`),r=vi.spyOn(document,`removeEventListener`),{unmount:i}=t(()=>e(1e3,{events:[`click`,`keydown`]}));expect(n).toHaveBeenCalledWith(`click`,expect.any(Function)),expect(n).toHaveBeenCalledWith(`keydown`,expect.any(Function)),expect(n).not.toHaveBeenCalledWith(`mousemove`,expect.any(Function)),i(),expect(r).toHaveBeenCalledWith(`click`,expect.any(Function)),expect(r).toHaveBeenCalledWith(`keydown`,expect.any(Function))}),it(`clears pending timers on unmount`,()=>{vi.useFakeTimers();let n=vi.spyOn(window,`clearTimeout`),{unmount:r}=t(()=>e(1e3));r(),expect(n).toHaveBeenCalled()})});
1
+ import"../chunk-CHh1Zzun.js";import{useIdle as e}from"./use-idle.js";import{i as t,t as n}from"../react.esm-BagSCtI3.js";describe(`useIdle`,()=>{it(`starts idle by default`,()=>{vi.useFakeTimers();let{result:n}=t(()=>e(1e3));expect(n.current).toBe(!0)}),it(`supports a custom initial state and becomes idle after the timeout`,()=>{vi.useFakeTimers();let{result:r}=t(()=>e(1e3,{initialState:!1}));expect(r.current).toBe(!1),n(()=>{vi.advanceTimersByTime(1e3)}),expect(r.current).toBe(!0)}),it(`becomes active on configured events and returns to idle after the timeout`,()=>{vi.useFakeTimers();let{result:r}=t(()=>e(1e3,{events:[`click`]}));n(()=>{document.dispatchEvent(new Event(`click`))}),expect(r.current).toBe(!1),n(()=>{vi.advanceTimersByTime(999)}),expect(r.current).toBe(!1),n(()=>{vi.advanceTimersByTime(1)}),expect(r.current).toBe(!0)}),it(`registers and removes only the configured event listeners`,()=>{vi.useFakeTimers();let n=vi.spyOn(document,`addEventListener`),r=vi.spyOn(document,`removeEventListener`),{unmount:i}=t(()=>e(1e3,{events:[`click`,`keydown`]}));expect(n).toHaveBeenCalledWith(`click`,expect.any(Function)),expect(n).toHaveBeenCalledWith(`keydown`,expect.any(Function)),expect(n).not.toHaveBeenCalledWith(`mousemove`,expect.any(Function)),i(),expect(r).toHaveBeenCalledWith(`click`,expect.any(Function)),expect(r).toHaveBeenCalledWith(`keydown`,expect.any(Function))}),it(`clears pending timers on unmount`,()=>{vi.useFakeTimers();let n=vi.spyOn(window,`clearTimeout`),{unmount:r}=t(()=>e(1e3));r(),expect(n).toHaveBeenCalled()})});
2
2
  //# sourceMappingURL=use-idle.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-idle.spec.js","names":[],"sources":["../../src/hooks/use-idle.spec.ts"],"sourcesContent":["import { act, renderHook } from '@testing-library/react'\n\nimport { useIdle } from './use-idle'\n\ndescribe('useIdle', () => {\n it('starts idle by default', () => {\n vi.useFakeTimers()\n\n const { result } = renderHook(() => useIdle(1000))\n\n expect(result.current).toBe(true)\n })\n\n it('supports a custom initial state and becomes idle after the timeout', () => {\n vi.useFakeTimers()\n\n const { result } = renderHook(() => useIdle(1000, { initialState: false }))\n\n expect(result.current).toBe(false)\n\n act(() => {\n vi.advanceTimersByTime(1000)\n })\n\n expect(result.current).toBe(true)\n })\n\n it('becomes active on configured events and returns to idle after the timeout', () => {\n vi.useFakeTimers()\n\n const { result } = renderHook(() => useIdle(1000, { events: ['click'] }))\n\n act(() => {\n document.dispatchEvent(new Event('click'))\n })\n\n expect(result.current).toBe(false)\n\n act(() => {\n vi.advanceTimersByTime(999)\n })\n\n expect(result.current).toBe(false)\n\n act(() => {\n vi.advanceTimersByTime(1)\n })\n\n expect(result.current).toBe(true)\n })\n\n it('registers and removes only the configured event listeners', () => {\n vi.useFakeTimers()\n const addEventListener = vi.spyOn(document, 'addEventListener')\n const removeEventListener = vi.spyOn(document, 'removeEventListener')\n\n const { unmount } = renderHook(() => useIdle(1000, { events: ['click', 'keydown'] }))\n\n expect(addEventListener).toHaveBeenCalledWith('click', expect.any(Function))\n expect(addEventListener).toHaveBeenCalledWith('keydown', expect.any(Function))\n expect(addEventListener).not.toHaveBeenCalledWith('mousemove', expect.any(Function))\n\n unmount()\n\n expect(removeEventListener).toHaveBeenCalledWith('click', expect.any(Function))\n expect(removeEventListener).toHaveBeenCalledWith('keydown', expect.any(Function))\n })\n\n it('clears pending timers on unmount', () => {\n vi.useFakeTimers()\n const clearTimeout = vi.spyOn(window, 'clearTimeout')\n const { unmount } = renderHook(() => useIdle(1000))\n\n unmount()\n\n expect(clearTimeout).toHaveBeenCalled()\n })\n})\n"],"mappings":"yHAIA,SAAS,cAAiB,CACxB,GAAG,6BAAgC,CACjC,GAAG,eAAe,CAElB,GAAM,CAAE,UAAW,MAAiB,EAAQ,IAAK,CAAC,CAElD,OAAO,EAAO,QAAQ,CAAC,KAAK,GAAK,EACjC,CAEF,GAAG,yEAA4E,CAC7E,GAAG,eAAe,CAElB,GAAM,CAAE,UAAW,MAAiB,EAAQ,IAAM,CAAE,aAAc,GAAO,CAAC,CAAC,CAE3E,OAAO,EAAO,QAAQ,CAAC,KAAK,GAAM,CAElC,MAAU,CACR,GAAG,oBAAoB,IAAK,EAC5B,CAEF,OAAO,EAAO,QAAQ,CAAC,KAAK,GAAK,EACjC,CAEF,GAAG,gFAAmF,CACpF,GAAG,eAAe,CAElB,GAAM,CAAE,UAAW,MAAiB,EAAQ,IAAM,CAAE,OAAQ,CAAC,QAAQ,CAAE,CAAC,CAAC,CAEzE,MAAU,CACR,SAAS,cAAc,IAAI,MAAM,QAAQ,CAAC,EAC1C,CAEF,OAAO,EAAO,QAAQ,CAAC,KAAK,GAAM,CAElC,MAAU,CACR,GAAG,oBAAoB,IAAI,EAC3B,CAEF,OAAO,EAAO,QAAQ,CAAC,KAAK,GAAM,CAElC,MAAU,CACR,GAAG,oBAAoB,EAAE,EACzB,CAEF,OAAO,EAAO,QAAQ,CAAC,KAAK,GAAK,EACjC,CAEF,GAAG,gEAAmE,CACpE,GAAG,eAAe,CAClB,IAAM,EAAmB,GAAG,MAAM,SAAU,mBAAmB,CACzD,EAAsB,GAAG,MAAM,SAAU,sBAAsB,CAE/D,CAAE,WAAY,MAAiB,EAAQ,IAAM,CAAE,OAAQ,CAAC,QAAS,UAAU,CAAE,CAAC,CAAC,CAErF,OAAO,EAAiB,CAAC,qBAAqB,QAAS,OAAO,IAAI,SAAS,CAAC,CAC5E,OAAO,EAAiB,CAAC,qBAAqB,UAAW,OAAO,IAAI,SAAS,CAAC,CAC9E,OAAO,EAAiB,CAAC,IAAI,qBAAqB,YAAa,OAAO,IAAI,SAAS,CAAC,CAEpF,GAAS,CAET,OAAO,EAAoB,CAAC,qBAAqB,QAAS,OAAO,IAAI,SAAS,CAAC,CAC/E,OAAO,EAAoB,CAAC,qBAAqB,UAAW,OAAO,IAAI,SAAS,CAAC,EACjF,CAEF,GAAG,uCAA0C,CAC3C,GAAG,eAAe,CAClB,IAAM,EAAe,GAAG,MAAM,OAAQ,eAAe,CAC/C,CAAE,WAAY,MAAiB,EAAQ,IAAK,CAAC,CAEnD,GAAS,CAET,OAAO,EAAa,CAAC,kBAAkB,EACvC,EACF"}
1
+ {"version":3,"file":"use-idle.spec.js","names":[],"sources":["../../src/hooks/use-idle.spec.ts"],"sourcesContent":["import { act, renderHook } from '@testing-library/react'\n\nimport { useIdle } from './use-idle'\n\ndescribe('useIdle', () => {\n it('starts idle by default', () => {\n vi.useFakeTimers()\n\n const { result } = renderHook(() => useIdle(1000))\n\n expect(result.current).toBe(true)\n })\n\n it('supports a custom initial state and becomes idle after the timeout', () => {\n vi.useFakeTimers()\n\n const { result } = renderHook(() => useIdle(1000, { initialState: false }))\n\n expect(result.current).toBe(false)\n\n act(() => {\n vi.advanceTimersByTime(1000)\n })\n\n expect(result.current).toBe(true)\n })\n\n it('becomes active on configured events and returns to idle after the timeout', () => {\n vi.useFakeTimers()\n\n const { result } = renderHook(() => useIdle(1000, { events: ['click'] }))\n\n act(() => {\n document.dispatchEvent(new Event('click'))\n })\n\n expect(result.current).toBe(false)\n\n act(() => {\n vi.advanceTimersByTime(999)\n })\n\n expect(result.current).toBe(false)\n\n act(() => {\n vi.advanceTimersByTime(1)\n })\n\n expect(result.current).toBe(true)\n })\n\n it('registers and removes only the configured event listeners', () => {\n vi.useFakeTimers()\n const addEventListener = vi.spyOn(document, 'addEventListener')\n const removeEventListener = vi.spyOn(document, 'removeEventListener')\n\n const { unmount } = renderHook(() => useIdle(1000, { events: ['click', 'keydown'] }))\n\n expect(addEventListener).toHaveBeenCalledWith('click', expect.any(Function))\n expect(addEventListener).toHaveBeenCalledWith('keydown', expect.any(Function))\n expect(addEventListener).not.toHaveBeenCalledWith('mousemove', expect.any(Function))\n\n unmount()\n\n expect(removeEventListener).toHaveBeenCalledWith('click', expect.any(Function))\n expect(removeEventListener).toHaveBeenCalledWith('keydown', expect.any(Function))\n })\n\n it('clears pending timers on unmount', () => {\n vi.useFakeTimers()\n const clearTimeout = vi.spyOn(window, 'clearTimeout')\n const { unmount } = renderHook(() => useIdle(1000))\n\n unmount()\n\n expect(clearTimeout).toHaveBeenCalled()\n })\n})\n"],"mappings":"yHAIA,SAAS,cAAiB,CACxB,GAAG,6BAAgC,CACjC,GAAG,cAAc,EAEjB,GAAM,CAAE,UAAW,MAAiB,EAAQ,GAAI,CAAC,EAEjD,OAAO,EAAO,OAAO,EAAE,KAAK,EAAI,CAClC,CAAC,EAED,GAAG,yEAA4E,CAC7E,GAAG,cAAc,EAEjB,GAAM,CAAE,UAAW,MAAiB,EAAQ,IAAM,CAAE,aAAc,EAAM,CAAC,CAAC,EAE1E,OAAO,EAAO,OAAO,EAAE,KAAK,EAAK,EAEjC,MAAU,CACR,GAAG,oBAAoB,GAAI,CAC7B,CAAC,EAED,OAAO,EAAO,OAAO,EAAE,KAAK,EAAI,CAClC,CAAC,EAED,GAAG,gFAAmF,CACpF,GAAG,cAAc,EAEjB,GAAM,CAAE,UAAW,MAAiB,EAAQ,IAAM,CAAE,OAAQ,CAAC,OAAO,CAAE,CAAC,CAAC,EAExE,MAAU,CACR,SAAS,cAAc,IAAI,MAAM,OAAO,CAAC,CAC3C,CAAC,EAED,OAAO,EAAO,OAAO,EAAE,KAAK,EAAK,EAEjC,MAAU,CACR,GAAG,oBAAoB,GAAG,CAC5B,CAAC,EAED,OAAO,EAAO,OAAO,EAAE,KAAK,EAAK,EAEjC,MAAU,CACR,GAAG,oBAAoB,CAAC,CAC1B,CAAC,EAED,OAAO,EAAO,OAAO,EAAE,KAAK,EAAI,CAClC,CAAC,EAED,GAAG,gEAAmE,CACpE,GAAG,cAAc,EACjB,IAAM,EAAmB,GAAG,MAAM,SAAU,kBAAkB,EACxD,EAAsB,GAAG,MAAM,SAAU,qBAAqB,EAE9D,CAAE,WAAY,MAAiB,EAAQ,IAAM,CAAE,OAAQ,CAAC,QAAS,SAAS,CAAE,CAAC,CAAC,EAEpF,OAAO,CAAgB,EAAE,qBAAqB,QAAS,OAAO,IAAI,QAAQ,CAAC,EAC3E,OAAO,CAAgB,EAAE,qBAAqB,UAAW,OAAO,IAAI,QAAQ,CAAC,EAC7E,OAAO,CAAgB,EAAE,IAAI,qBAAqB,YAAa,OAAO,IAAI,QAAQ,CAAC,EAEnF,EAAQ,EAER,OAAO,CAAmB,EAAE,qBAAqB,QAAS,OAAO,IAAI,QAAQ,CAAC,EAC9E,OAAO,CAAmB,EAAE,qBAAqB,UAAW,OAAO,IAAI,QAAQ,CAAC,CAClF,CAAC,EAED,GAAG,uCAA0C,CAC3C,GAAG,cAAc,EACjB,IAAM,EAAe,GAAG,MAAM,OAAQ,cAAc,EAC9C,CAAE,WAAY,MAAiB,EAAQ,GAAI,CAAC,EAElD,EAAQ,EAER,OAAO,CAAY,EAAE,iBAAiB,CACxC,CAAC,CACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-interval.js","names":[],"sources":["../../src/hooks/use-interval.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react'\n\nexport type UseIntervalOptions = {\n /** If set, the interval will start automatically when the component is mounted, `false` by default */\n autoInvoke?: boolean\n}\n\nexport type UseIntervalReturnValue = {\n /** Starts the interval */\n start: () => void\n\n /** Stops the interval */\n stop: () => void\n\n /** Toggles the interval */\n toggle: () => void\n\n /** Indicates if the interval is active */\n active: boolean\n}\n\nexport function useInterval(\n fn: () => void,\n interval: number,\n { autoInvoke = false }: UseIntervalOptions = {}\n): UseIntervalReturnValue {\n const intervalRef = useRef<number | null>(null)\n const fnRef = useRef<() => void>(null)\n const intervalValueRef = useRef(interval)\n\n const [active, setActive] = useState(false)\n\n intervalValueRef.current = interval\n\n const start = useCallback(() => {\n setActive((old) => {\n if (!old && !intervalRef.current) {\n intervalRef.current = window.setInterval(fnRef.current!, intervalValueRef.current)\n }\n return true\n })\n }, [])\n\n const stop = useCallback(() => {\n setActive(false)\n if (intervalRef.current) {\n window.clearInterval(intervalRef.current)\n }\n intervalRef.current = null\n }, [])\n\n const toggle = useCallback(() => {\n setActive((current) => {\n if (current) {\n if (intervalRef.current) {\n window.clearInterval(intervalRef.current)\n }\n intervalRef.current = null\n return false\n }\n if (!intervalRef.current) {\n intervalRef.current = window.setInterval(fnRef.current!, intervalValueRef.current)\n }\n return true\n })\n }, [])\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: should includes the 'interval'\n useEffect(() => {\n fnRef.current = fn\n active && start()\n return stop\n }, [fn, active, interval, start, stop])\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: should execute only once\n useEffect(() => {\n if (autoInvoke) {\n start()\n }\n }, [start])\n\n return { start, stop, toggle, active }\n}\n\nexport namespace useInterval {\n export type Options = UseIntervalOptions\n export type ReturnValue = UseIntervalReturnValue\n}\n"],"mappings":"0GAqBA,SAAgB,YACd,EACA,EACA,CAAE,aAAa,IAA8B,EAAE,CACvB,CACxB,IAAM,EAAc,EAAsB,KAAK,CACzC,EAAQ,EAAmB,KAAK,CAChC,EAAmB,EAAO,EAAS,CAEnC,CAAC,EAAQ,GAAa,EAAS,GAAM,CAE3C,EAAiB,QAAU,EAE3B,IAAM,EAAQ,MAAkB,CAC9B,EAAW,IACL,CAAC,GAAO,CAAC,EAAY,UACvB,EAAY,QAAU,OAAO,YAAY,EAAM,QAAU,EAAiB,QAAQ,EAE7E,IACP,EACD,EAAE,CAAC,CAEA,EAAO,MAAkB,CAC7B,EAAU,GAAM,CACZ,EAAY,SACd,OAAO,cAAc,EAAY,QAAQ,CAE3C,EAAY,QAAU,MACrB,EAAE,CAAC,CAEA,EAAS,MAAkB,CAC/B,EAAW,GACL,GACE,EAAY,SACd,OAAO,cAAc,EAAY,QAAQ,CAE3C,EAAY,QAAU,KACf,KAET,AACE,EAAY,UAAU,OAAO,YAAY,EAAM,QAAU,EAAiB,QAAQ,CAE7E,IACP,EACD,EAAE,CAAC,CAgBN,OAbA,OACE,EAAM,QAAU,EAChB,GAAU,GAAO,CACV,GACN,CAAC,EAAI,EAAQ,EAAU,EAAO,EAAK,CAAC,CAGvC,MAAgB,CACV,GACF,GAAO,EAER,CAAC,EAAM,CAAC,CAEJ,CAAE,QAAO,OAAM,SAAQ,SAAQ"}
1
+ {"version":3,"file":"use-interval.js","names":[],"sources":["../../src/hooks/use-interval.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react'\n\nexport type UseIntervalOptions = {\n /** If set, the interval will start automatically when the component is mounted, `false` by default */\n autoInvoke?: boolean\n}\n\nexport type UseIntervalReturnValue = {\n /** Starts the interval */\n start: () => void\n\n /** Stops the interval */\n stop: () => void\n\n /** Toggles the interval */\n toggle: () => void\n\n /** Indicates if the interval is active */\n active: boolean\n}\n\nexport function useInterval(\n fn: () => void,\n interval: number,\n { autoInvoke = false }: UseIntervalOptions = {}\n): UseIntervalReturnValue {\n const intervalRef = useRef<number | null>(null)\n const fnRef = useRef<() => void>(null)\n const intervalValueRef = useRef(interval)\n\n const [active, setActive] = useState(false)\n\n intervalValueRef.current = interval\n\n const start = useCallback(() => {\n setActive((old) => {\n if (!old && !intervalRef.current) {\n intervalRef.current = window.setInterval(fnRef.current!, intervalValueRef.current)\n }\n return true\n })\n }, [])\n\n const stop = useCallback(() => {\n setActive(false)\n if (intervalRef.current) {\n window.clearInterval(intervalRef.current)\n }\n intervalRef.current = null\n }, [])\n\n const toggle = useCallback(() => {\n setActive((current) => {\n if (current) {\n if (intervalRef.current) {\n window.clearInterval(intervalRef.current)\n }\n intervalRef.current = null\n return false\n }\n if (!intervalRef.current) {\n intervalRef.current = window.setInterval(fnRef.current!, intervalValueRef.current)\n }\n return true\n })\n }, [])\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: should includes the 'interval'\n useEffect(() => {\n fnRef.current = fn\n active && start()\n return stop\n }, [fn, active, interval, start, stop])\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: should execute only once\n useEffect(() => {\n if (autoInvoke) {\n start()\n }\n }, [start])\n\n return { start, stop, toggle, active }\n}\n\nexport namespace useInterval {\n export type Options = UseIntervalOptions\n export type ReturnValue = UseIntervalReturnValue\n}\n"],"mappings":"0GAqBA,SAAgB,YACd,EACA,EACA,CAAE,aAAa,IAA8B,CAAC,EACtB,CACxB,IAAM,EAAc,EAAsB,IAAI,EACxC,EAAQ,EAAmB,IAAI,EAC/B,EAAmB,EAAO,CAAQ,EAElC,CAAC,EAAQ,GAAa,EAAS,EAAK,EAE1C,EAAiB,QAAU,EAE3B,IAAM,EAAQ,MAAkB,CAC9B,EAAW,IACL,CAAC,GAAO,CAAC,EAAY,UACvB,EAAY,QAAU,OAAO,YAAY,EAAM,QAAU,EAAiB,OAAO,GAE5E,GACR,CACH,EAAG,CAAC,CAAC,EAEC,EAAO,MAAkB,CAC7B,EAAU,EAAK,EACX,EAAY,SACd,OAAO,cAAc,EAAY,OAAO,EAE1C,EAAY,QAAU,IACxB,EAAG,CAAC,CAAC,EAEC,EAAS,MAAkB,CAC/B,EAAW,GACL,GACE,EAAY,SACd,OAAO,cAAc,EAAY,OAAO,EAE1C,EAAY,QAAU,KACf,KAET,AACE,EAAY,UAAU,OAAO,YAAY,EAAM,QAAU,EAAiB,OAAO,EAE5E,GACR,CACH,EAAG,CAAC,CAAC,EAgBL,OAbA,OACE,EAAM,QAAU,EAChB,GAAU,EAAM,EACT,GACN,CAAC,EAAI,EAAQ,EAAU,EAAO,CAAI,CAAC,EAGtC,MAAgB,CACV,GACF,EAAM,CAEV,EAAG,CAAC,CAAK,CAAC,EAEH,CAAE,QAAO,OAAM,SAAQ,QAAO,CACvC"}
@@ -1,2 +1,2 @@
1
- import"../chunk-CHh1Zzun.js";import{useInterval as e}from"./use-interval.js";import{i as t,t as n}from"../react.esm-D_dNEsWM.js";describe(`useInterval`,()=>{it(`does not start by default`,()=>{vi.useFakeTimers();let r=vi.fn(),{result:i}=t(()=>e(r,1e3));expect(i.current.active).toBe(!1),n(()=>{vi.advanceTimersByTime(1e3)}),expect(r).not.toHaveBeenCalled()}),it(`starts and stops the interval`,()=>{vi.useFakeTimers();let r=vi.fn(),{result:i}=t(()=>e(r,1e3));n(()=>i.current.start()),expect(i.current.active).toBe(!0),n(()=>{vi.advanceTimersByTime(3e3)}),expect(r).toHaveBeenCalledTimes(3),n(()=>i.current.stop()),expect(i.current.active).toBe(!1),n(()=>{vi.advanceTimersByTime(1e3)}),expect(r).toHaveBeenCalledTimes(3)}),it(`toggles the interval`,()=>{vi.useFakeTimers();let r=vi.fn(),{result:i}=t(()=>e(r,1e3));n(()=>i.current.toggle()),expect(i.current.active).toBe(!0),n(()=>{vi.advanceTimersByTime(1e3)}),expect(r).toHaveBeenCalledTimes(1),n(()=>i.current.toggle()),expect(i.current.active).toBe(!1),n(()=>{vi.advanceTimersByTime(1e3)}),expect(r).toHaveBeenCalledTimes(1)}),it(`starts automatically when autoInvoke is enabled`,()=>{vi.useFakeTimers();let r=vi.fn(),{result:i}=t(()=>e(r,1e3,{autoInvoke:!0}));expect(i.current.active).toBe(!0),n(()=>{vi.advanceTimersByTime(1e3)}),expect(r).toHaveBeenCalledTimes(1)}),it(`uses the latest callback after rerendering`,()=>{vi.useFakeTimers();let r=vi.fn(),i=vi.fn(),{result:a,rerender:o}=t(({callback:t})=>e(t,1e3),{initialProps:{callback:r}});n(()=>a.current.start()),n(()=>{vi.advanceTimersByTime(1e3)}),o({callback:i}),n(()=>{vi.advanceTimersByTime(1e3)}),expect(r).toHaveBeenCalledTimes(1),expect(i).toHaveBeenCalledTimes(1)}),it(`cleans the interval on unmount`,()=>{vi.useFakeTimers();let r=vi.fn(),{result:i,unmount:a}=t(()=>e(r,1e3));n(()=>i.current.start()),a(),n(()=>{vi.advanceTimersByTime(1e3)}),expect(r).not.toHaveBeenCalled()})});
1
+ import"../chunk-CHh1Zzun.js";import{useInterval as e}from"./use-interval.js";import{i as t,t as n}from"../react.esm-BagSCtI3.js";describe(`useInterval`,()=>{it(`does not start by default`,()=>{vi.useFakeTimers();let r=vi.fn(),{result:i}=t(()=>e(r,1e3));expect(i.current.active).toBe(!1),n(()=>{vi.advanceTimersByTime(1e3)}),expect(r).not.toHaveBeenCalled()}),it(`starts and stops the interval`,()=>{vi.useFakeTimers();let r=vi.fn(),{result:i}=t(()=>e(r,1e3));n(()=>i.current.start()),expect(i.current.active).toBe(!0),n(()=>{vi.advanceTimersByTime(3e3)}),expect(r).toHaveBeenCalledTimes(3),n(()=>i.current.stop()),expect(i.current.active).toBe(!1),n(()=>{vi.advanceTimersByTime(1e3)}),expect(r).toHaveBeenCalledTimes(3)}),it(`toggles the interval`,()=>{vi.useFakeTimers();let r=vi.fn(),{result:i}=t(()=>e(r,1e3));n(()=>i.current.toggle()),expect(i.current.active).toBe(!0),n(()=>{vi.advanceTimersByTime(1e3)}),expect(r).toHaveBeenCalledTimes(1),n(()=>i.current.toggle()),expect(i.current.active).toBe(!1),n(()=>{vi.advanceTimersByTime(1e3)}),expect(r).toHaveBeenCalledTimes(1)}),it(`starts automatically when autoInvoke is enabled`,()=>{vi.useFakeTimers();let r=vi.fn(),{result:i}=t(()=>e(r,1e3,{autoInvoke:!0}));expect(i.current.active).toBe(!0),n(()=>{vi.advanceTimersByTime(1e3)}),expect(r).toHaveBeenCalledTimes(1)}),it(`uses the latest callback after rerendering`,()=>{vi.useFakeTimers();let r=vi.fn(),i=vi.fn(),{result:a,rerender:o}=t(({callback:t})=>e(t,1e3),{initialProps:{callback:r}});n(()=>a.current.start()),n(()=>{vi.advanceTimersByTime(1e3)}),o({callback:i}),n(()=>{vi.advanceTimersByTime(1e3)}),expect(r).toHaveBeenCalledTimes(1),expect(i).toHaveBeenCalledTimes(1)}),it(`cleans the interval on unmount`,()=>{vi.useFakeTimers();let r=vi.fn(),{result:i,unmount:a}=t(()=>e(r,1e3));n(()=>i.current.start()),a(),n(()=>{vi.advanceTimersByTime(1e3)}),expect(r).not.toHaveBeenCalled()})});
2
2
  //# sourceMappingURL=use-interval.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-interval.spec.js","names":[],"sources":["../../src/hooks/use-interval.spec.ts"],"sourcesContent":["import { act, renderHook } from '@testing-library/react'\n\nimport { useInterval } from './use-interval'\n\ndescribe('useInterval', () => {\n it('does not start by default', () => {\n vi.useFakeTimers()\n const callback = vi.fn()\n\n const { result } = renderHook(() => useInterval(callback, 1000))\n\n expect(result.current.active).toBe(false)\n\n act(() => {\n vi.advanceTimersByTime(1000)\n })\n\n expect(callback).not.toHaveBeenCalled()\n })\n\n it('starts and stops the interval', () => {\n vi.useFakeTimers()\n const callback = vi.fn()\n const { result } = renderHook(() => useInterval(callback, 1000))\n\n act(() => result.current.start())\n expect(result.current.active).toBe(true)\n\n act(() => {\n vi.advanceTimersByTime(3000)\n })\n\n expect(callback).toHaveBeenCalledTimes(3)\n\n act(() => result.current.stop())\n expect(result.current.active).toBe(false)\n\n act(() => {\n vi.advanceTimersByTime(1000)\n })\n\n expect(callback).toHaveBeenCalledTimes(3)\n })\n\n it('toggles the interval', () => {\n vi.useFakeTimers()\n const callback = vi.fn()\n const { result } = renderHook(() => useInterval(callback, 1000))\n\n act(() => result.current.toggle())\n expect(result.current.active).toBe(true)\n\n act(() => {\n vi.advanceTimersByTime(1000)\n })\n\n expect(callback).toHaveBeenCalledTimes(1)\n\n act(() => result.current.toggle())\n expect(result.current.active).toBe(false)\n\n act(() => {\n vi.advanceTimersByTime(1000)\n })\n\n expect(callback).toHaveBeenCalledTimes(1)\n })\n\n it('starts automatically when autoInvoke is enabled', () => {\n vi.useFakeTimers()\n const callback = vi.fn()\n\n const { result } = renderHook(() => useInterval(callback, 1000, { autoInvoke: true }))\n\n expect(result.current.active).toBe(true)\n\n act(() => {\n vi.advanceTimersByTime(1000)\n })\n\n expect(callback).toHaveBeenCalledTimes(1)\n })\n\n it('uses the latest callback after rerendering', () => {\n vi.useFakeTimers()\n const firstCallback = vi.fn()\n const secondCallback = vi.fn()\n const { result, rerender } = renderHook(({ callback }) => useInterval(callback, 1000), {\n initialProps: { callback: firstCallback }\n })\n\n act(() => result.current.start())\n act(() => {\n vi.advanceTimersByTime(1000)\n })\n\n rerender({ callback: secondCallback })\n\n act(() => {\n vi.advanceTimersByTime(1000)\n })\n\n expect(firstCallback).toHaveBeenCalledTimes(1)\n expect(secondCallback).toHaveBeenCalledTimes(1)\n })\n\n it('cleans the interval on unmount', () => {\n vi.useFakeTimers()\n const callback = vi.fn()\n const { result, unmount } = renderHook(() => useInterval(callback, 1000))\n\n act(() => result.current.start())\n unmount()\n\n act(() => {\n vi.advanceTimersByTime(1000)\n })\n\n expect(callback).not.toHaveBeenCalled()\n })\n})\n"],"mappings":"iIAIA,SAAS,kBAAqB,CAC5B,GAAG,gCAAmC,CACpC,GAAG,eAAe,CAClB,IAAM,EAAW,GAAG,IAAI,CAElB,CAAE,UAAW,MAAiB,EAAY,EAAU,IAAK,CAAC,CAEhE,OAAO,EAAO,QAAQ,OAAO,CAAC,KAAK,GAAM,CAEzC,MAAU,CACR,GAAG,oBAAoB,IAAK,EAC5B,CAEF,OAAO,EAAS,CAAC,IAAI,kBAAkB,EACvC,CAEF,GAAG,oCAAuC,CACxC,GAAG,eAAe,CAClB,IAAM,EAAW,GAAG,IAAI,CAClB,CAAE,UAAW,MAAiB,EAAY,EAAU,IAAK,CAAC,CAEhE,MAAU,EAAO,QAAQ,OAAO,CAAC,CACjC,OAAO,EAAO,QAAQ,OAAO,CAAC,KAAK,GAAK,CAExC,MAAU,CACR,GAAG,oBAAoB,IAAK,EAC5B,CAEF,OAAO,EAAS,CAAC,sBAAsB,EAAE,CAEzC,MAAU,EAAO,QAAQ,MAAM,CAAC,CAChC,OAAO,EAAO,QAAQ,OAAO,CAAC,KAAK,GAAM,CAEzC,MAAU,CACR,GAAG,oBAAoB,IAAK,EAC5B,CAEF,OAAO,EAAS,CAAC,sBAAsB,EAAE,EACzC,CAEF,GAAG,2BAA8B,CAC/B,GAAG,eAAe,CAClB,IAAM,EAAW,GAAG,IAAI,CAClB,CAAE,UAAW,MAAiB,EAAY,EAAU,IAAK,CAAC,CAEhE,MAAU,EAAO,QAAQ,QAAQ,CAAC,CAClC,OAAO,EAAO,QAAQ,OAAO,CAAC,KAAK,GAAK,CAExC,MAAU,CACR,GAAG,oBAAoB,IAAK,EAC5B,CAEF,OAAO,EAAS,CAAC,sBAAsB,EAAE,CAEzC,MAAU,EAAO,QAAQ,QAAQ,CAAC,CAClC,OAAO,EAAO,QAAQ,OAAO,CAAC,KAAK,GAAM,CAEzC,MAAU,CACR,GAAG,oBAAoB,IAAK,EAC5B,CAEF,OAAO,EAAS,CAAC,sBAAsB,EAAE,EACzC,CAEF,GAAG,sDAAyD,CAC1D,GAAG,eAAe,CAClB,IAAM,EAAW,GAAG,IAAI,CAElB,CAAE,UAAW,MAAiB,EAAY,EAAU,IAAM,CAAE,WAAY,GAAM,CAAC,CAAC,CAEtF,OAAO,EAAO,QAAQ,OAAO,CAAC,KAAK,GAAK,CAExC,MAAU,CACR,GAAG,oBAAoB,IAAK,EAC5B,CAEF,OAAO,EAAS,CAAC,sBAAsB,EAAE,EACzC,CAEF,GAAG,iDAAoD,CACrD,GAAG,eAAe,CAClB,IAAM,EAAgB,GAAG,IAAI,CACvB,EAAiB,GAAG,IAAI,CACxB,CAAE,SAAQ,YAAa,GAAY,CAAE,cAAe,EAAY,EAAU,IAAK,CAAE,CACrF,aAAc,CAAE,SAAU,EAAe,CAC1C,CAAC,CAEF,MAAU,EAAO,QAAQ,OAAO,CAAC,CACjC,MAAU,CACR,GAAG,oBAAoB,IAAK,EAC5B,CAEF,EAAS,CAAE,SAAU,EAAgB,CAAC,CAEtC,MAAU,CACR,GAAG,oBAAoB,IAAK,EAC5B,CAEF,OAAO,EAAc,CAAC,sBAAsB,EAAE,CAC9C,OAAO,EAAe,CAAC,sBAAsB,EAAE,EAC/C,CAEF,GAAG,qCAAwC,CACzC,GAAG,eAAe,CAClB,IAAM,EAAW,GAAG,IAAI,CAClB,CAAE,SAAQ,WAAY,MAAiB,EAAY,EAAU,IAAK,CAAC,CAEzE,MAAU,EAAO,QAAQ,OAAO,CAAC,CACjC,GAAS,CAET,MAAU,CACR,GAAG,oBAAoB,IAAK,EAC5B,CAEF,OAAO,EAAS,CAAC,IAAI,kBAAkB,EACvC,EACF"}
1
+ {"version":3,"file":"use-interval.spec.js","names":[],"sources":["../../src/hooks/use-interval.spec.ts"],"sourcesContent":["import { act, renderHook } from '@testing-library/react'\n\nimport { useInterval } from './use-interval'\n\ndescribe('useInterval', () => {\n it('does not start by default', () => {\n vi.useFakeTimers()\n const callback = vi.fn()\n\n const { result } = renderHook(() => useInterval(callback, 1000))\n\n expect(result.current.active).toBe(false)\n\n act(() => {\n vi.advanceTimersByTime(1000)\n })\n\n expect(callback).not.toHaveBeenCalled()\n })\n\n it('starts and stops the interval', () => {\n vi.useFakeTimers()\n const callback = vi.fn()\n const { result } = renderHook(() => useInterval(callback, 1000))\n\n act(() => result.current.start())\n expect(result.current.active).toBe(true)\n\n act(() => {\n vi.advanceTimersByTime(3000)\n })\n\n expect(callback).toHaveBeenCalledTimes(3)\n\n act(() => result.current.stop())\n expect(result.current.active).toBe(false)\n\n act(() => {\n vi.advanceTimersByTime(1000)\n })\n\n expect(callback).toHaveBeenCalledTimes(3)\n })\n\n it('toggles the interval', () => {\n vi.useFakeTimers()\n const callback = vi.fn()\n const { result } = renderHook(() => useInterval(callback, 1000))\n\n act(() => result.current.toggle())\n expect(result.current.active).toBe(true)\n\n act(() => {\n vi.advanceTimersByTime(1000)\n })\n\n expect(callback).toHaveBeenCalledTimes(1)\n\n act(() => result.current.toggle())\n expect(result.current.active).toBe(false)\n\n act(() => {\n vi.advanceTimersByTime(1000)\n })\n\n expect(callback).toHaveBeenCalledTimes(1)\n })\n\n it('starts automatically when autoInvoke is enabled', () => {\n vi.useFakeTimers()\n const callback = vi.fn()\n\n const { result } = renderHook(() => useInterval(callback, 1000, { autoInvoke: true }))\n\n expect(result.current.active).toBe(true)\n\n act(() => {\n vi.advanceTimersByTime(1000)\n })\n\n expect(callback).toHaveBeenCalledTimes(1)\n })\n\n it('uses the latest callback after rerendering', () => {\n vi.useFakeTimers()\n const firstCallback = vi.fn()\n const secondCallback = vi.fn()\n const { result, rerender } = renderHook(({ callback }) => useInterval(callback, 1000), {\n initialProps: { callback: firstCallback }\n })\n\n act(() => result.current.start())\n act(() => {\n vi.advanceTimersByTime(1000)\n })\n\n rerender({ callback: secondCallback })\n\n act(() => {\n vi.advanceTimersByTime(1000)\n })\n\n expect(firstCallback).toHaveBeenCalledTimes(1)\n expect(secondCallback).toHaveBeenCalledTimes(1)\n })\n\n it('cleans the interval on unmount', () => {\n vi.useFakeTimers()\n const callback = vi.fn()\n const { result, unmount } = renderHook(() => useInterval(callback, 1000))\n\n act(() => result.current.start())\n unmount()\n\n act(() => {\n vi.advanceTimersByTime(1000)\n })\n\n expect(callback).not.toHaveBeenCalled()\n })\n})\n"],"mappings":"iIAIA,SAAS,kBAAqB,CAC5B,GAAG,gCAAmC,CACpC,GAAG,cAAc,EACjB,IAAM,EAAW,GAAG,GAAG,EAEjB,CAAE,UAAW,MAAiB,EAAY,EAAU,GAAI,CAAC,EAE/D,OAAO,EAAO,QAAQ,MAAM,EAAE,KAAK,EAAK,EAExC,MAAU,CACR,GAAG,oBAAoB,GAAI,CAC7B,CAAC,EAED,OAAO,CAAQ,EAAE,IAAI,iBAAiB,CACxC,CAAC,EAED,GAAG,oCAAuC,CACxC,GAAG,cAAc,EACjB,IAAM,EAAW,GAAG,GAAG,EACjB,CAAE,UAAW,MAAiB,EAAY,EAAU,GAAI,CAAC,EAE/D,MAAU,EAAO,QAAQ,MAAM,CAAC,EAChC,OAAO,EAAO,QAAQ,MAAM,EAAE,KAAK,EAAI,EAEvC,MAAU,CACR,GAAG,oBAAoB,GAAI,CAC7B,CAAC,EAED,OAAO,CAAQ,EAAE,sBAAsB,CAAC,EAExC,MAAU,EAAO,QAAQ,KAAK,CAAC,EAC/B,OAAO,EAAO,QAAQ,MAAM,EAAE,KAAK,EAAK,EAExC,MAAU,CACR,GAAG,oBAAoB,GAAI,CAC7B,CAAC,EAED,OAAO,CAAQ,EAAE,sBAAsB,CAAC,CAC1C,CAAC,EAED,GAAG,2BAA8B,CAC/B,GAAG,cAAc,EACjB,IAAM,EAAW,GAAG,GAAG,EACjB,CAAE,UAAW,MAAiB,EAAY,EAAU,GAAI,CAAC,EAE/D,MAAU,EAAO,QAAQ,OAAO,CAAC,EACjC,OAAO,EAAO,QAAQ,MAAM,EAAE,KAAK,EAAI,EAEvC,MAAU,CACR,GAAG,oBAAoB,GAAI,CAC7B,CAAC,EAED,OAAO,CAAQ,EAAE,sBAAsB,CAAC,EAExC,MAAU,EAAO,QAAQ,OAAO,CAAC,EACjC,OAAO,EAAO,QAAQ,MAAM,EAAE,KAAK,EAAK,EAExC,MAAU,CACR,GAAG,oBAAoB,GAAI,CAC7B,CAAC,EAED,OAAO,CAAQ,EAAE,sBAAsB,CAAC,CAC1C,CAAC,EAED,GAAG,sDAAyD,CAC1D,GAAG,cAAc,EACjB,IAAM,EAAW,GAAG,GAAG,EAEjB,CAAE,UAAW,MAAiB,EAAY,EAAU,IAAM,CAAE,WAAY,EAAK,CAAC,CAAC,EAErF,OAAO,EAAO,QAAQ,MAAM,EAAE,KAAK,EAAI,EAEvC,MAAU,CACR,GAAG,oBAAoB,GAAI,CAC7B,CAAC,EAED,OAAO,CAAQ,EAAE,sBAAsB,CAAC,CAC1C,CAAC,EAED,GAAG,iDAAoD,CACrD,GAAG,cAAc,EACjB,IAAM,EAAgB,GAAG,GAAG,EACtB,EAAiB,GAAG,GAAG,EACvB,CAAE,SAAQ,YAAa,GAAY,CAAE,cAAe,EAAY,EAAU,GAAI,EAAG,CACrF,aAAc,CAAE,SAAU,CAAc,CAC1C,CAAC,EAED,MAAU,EAAO,QAAQ,MAAM,CAAC,EAChC,MAAU,CACR,GAAG,oBAAoB,GAAI,CAC7B,CAAC,EAED,EAAS,CAAE,SAAU,CAAe,CAAC,EAErC,MAAU,CACR,GAAG,oBAAoB,GAAI,CAC7B,CAAC,EAED,OAAO,CAAa,EAAE,sBAAsB,CAAC,EAC7C,OAAO,CAAc,EAAE,sBAAsB,CAAC,CAChD,CAAC,EAED,GAAG,qCAAwC,CACzC,GAAG,cAAc,EACjB,IAAM,EAAW,GAAG,GAAG,EACjB,CAAE,SAAQ,WAAY,MAAiB,EAAY,EAAU,GAAI,CAAC,EAExE,MAAU,EAAO,QAAQ,MAAM,CAAC,EAChC,EAAQ,EAER,MAAU,CACR,GAAG,oBAAoB,GAAI,CAC7B,CAAC,EAED,OAAO,CAAQ,EAAE,IAAI,iBAAiB,CACxC,CAAC,CACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-local-storage.js","names":[],"sources":["../../src/hooks/use-local-storage.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react'\n\nexport type UseLocalStorageOptions<T> = {\n defaultValue?: T\n sync?: boolean\n}\n\nfunction parseStorageValue<T>(value: string) {\n try {\n return JSON.parse(value) as T\n } catch {\n return value as T\n }\n}\n\nfunction readStorageValue<T>(key: string, defaultValue: T | undefined) {\n if (typeof window === 'undefined') {\n return defaultValue\n }\n\n try {\n const item = window.localStorage.getItem(key)\n\n if (item === null) {\n return defaultValue\n }\n\n return parseStorageValue<T>(item)\n } catch {\n return defaultValue\n }\n}\n\nfunction writeStorageValue<T>(key: string, value: T) {\n if (typeof window === 'undefined') {\n return\n }\n\n try {\n window.localStorage.setItem(key, String(JSON.stringify(value)))\n } catch {}\n}\n\nexport function useLocalStorage<T>(\n key: string,\n options: UseLocalStorageOptions<T> & { defaultValue: T }\n): [T, React.Dispatch<React.SetStateAction<T>>]\n\nexport function useLocalStorage<T = undefined>(\n key: string,\n options?: UseLocalStorageOptions<T>\n): [T | undefined, React.Dispatch<React.SetStateAction<T | undefined>>]\n\nexport function useLocalStorage<T>(key: string, options: UseLocalStorageOptions<T> = {}) {\n const { defaultValue, sync = true } = options\n const defaultValueRef = useRef(defaultValue)\n const [storedValue, setStoredValue] = useState<T | undefined>(() => readStorageValue<T>(key, defaultValue))\n const storedValueRef = useRef(storedValue)\n\n defaultValueRef.current = defaultValue\n storedValueRef.current = storedValue\n\n const setValue = useCallback<React.Dispatch<React.SetStateAction<T | undefined>>>(\n (value) => {\n const nextValue =\n typeof value === 'function'\n ? (value as (previousValue: T | undefined) => T | undefined)(storedValueRef.current)\n : value\n\n storedValueRef.current = nextValue\n writeStorageValue(key, nextValue)\n setStoredValue(nextValue)\n },\n [key]\n )\n\n useEffect(() => {\n if (!sync || typeof window === 'undefined') {\n return\n }\n\n const handleStorage = (event: StorageEvent) => {\n if (event.storageArea !== window.localStorage || event.key !== key) {\n return\n }\n\n const nextValue = event.newValue === null ? defaultValueRef.current : parseStorageValue<T>(event.newValue)\n\n storedValueRef.current = nextValue\n setStoredValue(nextValue)\n }\n\n window.addEventListener('storage', handleStorage)\n\n return () => window.removeEventListener('storage', handleStorage)\n }, [key, sync])\n\n return [storedValue, setValue]\n}\n\nexport namespace useLocalStorage {\n export type Options<T> = UseLocalStorageOptions<T>\n}\n"],"mappings":"0GAOA,SAAS,kBAAqB,EAAe,CAC3C,GAAI,CACF,OAAO,KAAK,MAAM,EAAM,MAClB,CACN,OAAO,GAIX,SAAS,iBAAoB,EAAa,EAA6B,CACrE,GAAI,OAAO,OAAW,IACpB,OAAO,EAGT,GAAI,CACF,IAAM,EAAO,OAAO,aAAa,QAAQ,EAAI,CAM7C,OAJI,IAAS,KACJ,EAGF,kBAAqB,EAAK,MAC3B,CACN,OAAO,GAIX,SAAS,kBAAqB,EAAa,EAAU,CAC/C,YAAO,OAAW,KAItB,GAAI,CACF,OAAO,aAAa,QAAQ,EAAK,OAAO,KAAK,UAAU,EAAM,CAAC,CAAC,MACzD,GAaV,SAAgB,gBAAmB,EAAa,EAAqC,EAAE,CAAE,CACvF,GAAM,CAAE,eAAc,OAAO,IAAS,EAChC,EAAkB,EAAO,EAAa,CACtC,CAAC,EAAa,GAAkB,MAA8B,iBAAoB,EAAK,EAAa,CAAC,CACrG,EAAiB,EAAO,EAAY,CAE1C,EAAgB,QAAU,EAC1B,EAAe,QAAU,EAEzB,IAAM,EAAW,EACd,GAAU,CACT,IAAM,EACJ,OAAO,GAAU,WACZ,EAA0D,EAAe,QAAQ,CAClF,EAEN,EAAe,QAAU,EACzB,kBAAkB,EAAK,EAAU,CACjC,EAAe,EAAU,EAE3B,CAAC,EAAI,CACN,CAuBD,OArBA,MAAgB,CACd,GAAI,CAAC,GAAQ,OAAO,OAAW,IAC7B,OAGF,IAAM,cAAiB,GAAwB,CAC7C,GAAI,EAAM,cAAgB,OAAO,cAAgB,EAAM,MAAQ,EAC7D,OAGF,IAAM,EAAY,EAAM,WAAa,KAAO,EAAgB,QAAU,kBAAqB,EAAM,SAAS,CAE1G,EAAe,QAAU,EACzB,EAAe,EAAU,EAK3B,OAFA,OAAO,iBAAiB,UAAW,cAAc,KAEpC,OAAO,oBAAoB,UAAW,cAAc,EAChE,CAAC,EAAK,EAAK,CAAC,CAER,CAAC,EAAa,EAAS"}
1
+ {"version":3,"file":"use-local-storage.js","names":[],"sources":["../../src/hooks/use-local-storage.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react'\n\nexport type UseLocalStorageOptions<T> = {\n defaultValue?: T\n sync?: boolean\n}\n\nfunction parseStorageValue<T>(value: string) {\n try {\n return JSON.parse(value) as T\n } catch {\n return value as T\n }\n}\n\nfunction readStorageValue<T>(key: string, defaultValue: T | undefined) {\n if (typeof window === 'undefined') {\n return defaultValue\n }\n\n try {\n const item = window.localStorage.getItem(key)\n\n if (item === null) {\n return defaultValue\n }\n\n return parseStorageValue<T>(item)\n } catch {\n return defaultValue\n }\n}\n\nfunction writeStorageValue<T>(key: string, value: T) {\n if (typeof window === 'undefined') {\n return\n }\n\n try {\n window.localStorage.setItem(key, String(JSON.stringify(value)))\n } catch {}\n}\n\nexport function useLocalStorage<T>(\n key: string,\n options: UseLocalStorageOptions<T> & { defaultValue: T }\n): [T, React.Dispatch<React.SetStateAction<T>>]\n\nexport function useLocalStorage<T = undefined>(\n key: string,\n options?: UseLocalStorageOptions<T>\n): [T | undefined, React.Dispatch<React.SetStateAction<T | undefined>>]\n\nexport function useLocalStorage<T>(key: string, options: UseLocalStorageOptions<T> = {}) {\n const { defaultValue, sync = true } = options\n const defaultValueRef = useRef(defaultValue)\n const [storedValue, setStoredValue] = useState<T | undefined>(() => readStorageValue<T>(key, defaultValue))\n const storedValueRef = useRef(storedValue)\n\n defaultValueRef.current = defaultValue\n storedValueRef.current = storedValue\n\n const setValue = useCallback<React.Dispatch<React.SetStateAction<T | undefined>>>(\n (value) => {\n const nextValue =\n typeof value === 'function'\n ? (value as (previousValue: T | undefined) => T | undefined)(storedValueRef.current)\n : value\n\n storedValueRef.current = nextValue\n writeStorageValue(key, nextValue)\n setStoredValue(nextValue)\n },\n [key]\n )\n\n useEffect(() => {\n if (!sync || typeof window === 'undefined') {\n return\n }\n\n const handleStorage = (event: StorageEvent) => {\n if (event.storageArea !== window.localStorage || event.key !== key) {\n return\n }\n\n const nextValue = event.newValue === null ? defaultValueRef.current : parseStorageValue<T>(event.newValue)\n\n storedValueRef.current = nextValue\n setStoredValue(nextValue)\n }\n\n window.addEventListener('storage', handleStorage)\n\n return () => window.removeEventListener('storage', handleStorage)\n }, [key, sync])\n\n return [storedValue, setValue]\n}\n\nexport namespace useLocalStorage {\n export type Options<T> = UseLocalStorageOptions<T>\n}\n"],"mappings":"0GAOA,SAAS,kBAAqB,EAAe,CAC3C,GAAI,CACF,OAAO,KAAK,MAAM,CAAK,CACzB,MAAQ,CACN,OAAO,CACT,CACF,CAEA,SAAS,iBAAoB,EAAa,EAA6B,CACrE,GAAI,OAAO,OAAW,IACpB,OAAO,EAGT,GAAI,CACF,IAAM,EAAO,OAAO,aAAa,QAAQ,CAAG,EAM5C,OAJI,IAAS,KACJ,EAGF,kBAAqB,CAAI,CAClC,MAAQ,CACN,OAAO,CACT,CACF,CAEA,SAAS,kBAAqB,EAAa,EAAU,CAC/C,YAAO,OAAW,KAItB,GAAI,CACF,OAAO,aAAa,QAAQ,EAAK,OAAO,KAAK,UAAU,CAAK,CAAC,CAAC,CAChE,MAAQ,CAAC,CACX,CAYA,SAAgB,gBAAmB,EAAa,EAAqC,CAAC,EAAG,CACvF,GAAM,CAAE,eAAc,OAAO,IAAS,EAChC,EAAkB,EAAO,CAAY,EACrC,CAAC,EAAa,GAAkB,MAA8B,iBAAoB,EAAK,CAAY,CAAC,EACpG,EAAiB,EAAO,CAAW,EAEzC,EAAgB,QAAU,EAC1B,EAAe,QAAU,EAEzB,IAAM,EAAW,EACd,GAAU,CACT,IAAM,EACJ,OAAO,GAAU,WACZ,EAA0D,EAAe,OAAO,EACjF,EAEN,EAAe,QAAU,EACzB,kBAAkB,EAAK,CAAS,EAChC,EAAe,CAAS,CAC1B,EACA,CAAC,CAAG,CACN,EAuBA,OArBA,MAAgB,CACd,GAAI,CAAC,GAAQ,OAAO,OAAW,IAC7B,OAGF,IAAM,cAAiB,GAAwB,CAC7C,GAAI,EAAM,cAAgB,OAAO,cAAgB,EAAM,MAAQ,EAC7D,OAGF,IAAM,EAAY,EAAM,WAAa,KAAO,EAAgB,QAAU,kBAAqB,EAAM,QAAQ,EAEzG,EAAe,QAAU,EACzB,EAAe,CAAS,CAC1B,EAIA,OAFA,OAAO,iBAAiB,UAAW,aAAa,MAEnC,OAAO,oBAAoB,UAAW,aAAa,CAClE,EAAG,CAAC,EAAK,CAAI,CAAC,EAEP,CAAC,EAAa,CAAQ,CAC/B"}
@@ -1,2 +1,2 @@
1
- import"../chunk-CHh1Zzun.js";import{useLocalStorage as e}from"./use-local-storage.js";import{i as t,t as n}from"../react.esm-D_dNEsWM.js";describe(`useLocalStorage`,()=>{it(`returns the default value when storage is empty`,()=>{let{result:n}=t(()=>e(`settings`,{defaultValue:{compact:!1}}));expect(n.current[0]).toEqual({compact:!1})}),it(`reads an existing JSON value from localStorage`,()=>{window.localStorage.setItem(`settings`,JSON.stringify({compact:!0}));let{result:n}=t(()=>e(`settings`,{defaultValue:{compact:!1}}));expect(n.current[0]).toEqual({compact:!0})}),it(`writes serialized values to localStorage`,()=>{let{result:r}=t(()=>e(`settings`,{defaultValue:{compact:!1}}));n(()=>r.current[1]({compact:!0})),expect(r.current[0]).toEqual({compact:!0}),expect(window.localStorage.getItem(`settings`)).toBe(JSON.stringify({compact:!0}))}),it(`supports functional updates`,()=>{let{result:r}=t(()=>e(`count`,{defaultValue:1}));n(()=>r.current[1](e=>e+1)),expect(r.current[0]).toBe(2),expect(window.localStorage.getItem(`count`)).toBe(`2`)}),it(`syncs updates from storage events for the same key`,()=>{let{result:r}=t(()=>e(`settings`,{defaultValue:{compact:!1}}));n(()=>{window.dispatchEvent(new StorageEvent(`storage`,{key:`settings`,newValue:JSON.stringify({compact:!0}),storageArea:window.localStorage}))}),expect(r.current[0]).toEqual({compact:!0})}),it(`ignores storage events for other keys`,()=>{let{result:r}=t(()=>e(`settings`,{defaultValue:{compact:!1}}));n(()=>{window.dispatchEvent(new StorageEvent(`storage`,{key:`profile`,newValue:JSON.stringify({compact:!0}),storageArea:window.localStorage}))}),expect(r.current[0]).toEqual({compact:!1})}),it(`does not subscribe to storage events when sync is disabled`,()=>{let{result:r}=t(()=>e(`settings`,{defaultValue:{compact:!1},sync:!1}));n(()=>{window.dispatchEvent(new StorageEvent(`storage`,{key:`settings`,newValue:JSON.stringify({compact:!0}),storageArea:window.localStorage}))}),expect(r.current[0]).toEqual({compact:!1})})});
1
+ import"../chunk-CHh1Zzun.js";import{useLocalStorage as e}from"./use-local-storage.js";import{i as t,t as n}from"../react.esm-BagSCtI3.js";describe(`useLocalStorage`,()=>{it(`returns the default value when storage is empty`,()=>{let{result:n}=t(()=>e(`settings`,{defaultValue:{compact:!1}}));expect(n.current[0]).toEqual({compact:!1})}),it(`reads an existing JSON value from localStorage`,()=>{window.localStorage.setItem(`settings`,JSON.stringify({compact:!0}));let{result:n}=t(()=>e(`settings`,{defaultValue:{compact:!1}}));expect(n.current[0]).toEqual({compact:!0})}),it(`writes serialized values to localStorage`,()=>{let{result:r}=t(()=>e(`settings`,{defaultValue:{compact:!1}}));n(()=>r.current[1]({compact:!0})),expect(r.current[0]).toEqual({compact:!0}),expect(window.localStorage.getItem(`settings`)).toBe(JSON.stringify({compact:!0}))}),it(`supports functional updates`,()=>{let{result:r}=t(()=>e(`count`,{defaultValue:1}));n(()=>r.current[1](e=>e+1)),expect(r.current[0]).toBe(2),expect(window.localStorage.getItem(`count`)).toBe(`2`)}),it(`syncs updates from storage events for the same key`,()=>{let{result:r}=t(()=>e(`settings`,{defaultValue:{compact:!1}}));n(()=>{window.dispatchEvent(new StorageEvent(`storage`,{key:`settings`,newValue:JSON.stringify({compact:!0}),storageArea:window.localStorage}))}),expect(r.current[0]).toEqual({compact:!0})}),it(`ignores storage events for other keys`,()=>{let{result:r}=t(()=>e(`settings`,{defaultValue:{compact:!1}}));n(()=>{window.dispatchEvent(new StorageEvent(`storage`,{key:`profile`,newValue:JSON.stringify({compact:!0}),storageArea:window.localStorage}))}),expect(r.current[0]).toEqual({compact:!1})}),it(`does not subscribe to storage events when sync is disabled`,()=>{let{result:r}=t(()=>e(`settings`,{defaultValue:{compact:!1},sync:!1}));n(()=>{window.dispatchEvent(new StorageEvent(`storage`,{key:`settings`,newValue:JSON.stringify({compact:!0}),storageArea:window.localStorage}))}),expect(r.current[0]).toEqual({compact:!1})})});
2
2
  //# sourceMappingURL=use-local-storage.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-local-storage.spec.js","names":[],"sources":["../../src/hooks/use-local-storage.spec.ts"],"sourcesContent":["import { act, renderHook } from '@testing-library/react'\n\nimport { useLocalStorage } from './use-local-storage'\n\ndescribe('useLocalStorage', () => {\n it('returns the default value when storage is empty', () => {\n const { result } = renderHook(() => useLocalStorage('settings', { defaultValue: { compact: false } }))\n\n expect(result.current[0]).toEqual({ compact: false })\n })\n\n it('reads an existing JSON value from localStorage', () => {\n window.localStorage.setItem('settings', JSON.stringify({ compact: true }))\n\n const { result } = renderHook(() => useLocalStorage('settings', { defaultValue: { compact: false } }))\n\n expect(result.current[0]).toEqual({ compact: true })\n })\n\n it('writes serialized values to localStorage', () => {\n const { result } = renderHook(() => useLocalStorage('settings', { defaultValue: { compact: false } }))\n\n act(() => result.current[1]({ compact: true }))\n\n expect(result.current[0]).toEqual({ compact: true })\n expect(window.localStorage.getItem('settings')).toBe(JSON.stringify({ compact: true }))\n })\n\n it('supports functional updates', () => {\n const { result } = renderHook(() => useLocalStorage('count', { defaultValue: 1 }))\n\n act(() => result.current[1]((current) => current + 1))\n\n expect(result.current[0]).toBe(2)\n expect(window.localStorage.getItem('count')).toBe('2')\n })\n\n it('syncs updates from storage events for the same key', () => {\n const { result } = renderHook(() => useLocalStorage('settings', { defaultValue: { compact: false } }))\n\n act(() => {\n window.dispatchEvent(\n new StorageEvent('storage', {\n key: 'settings',\n newValue: JSON.stringify({ compact: true }),\n storageArea: window.localStorage\n })\n )\n })\n\n expect(result.current[0]).toEqual({ compact: true })\n })\n\n it('ignores storage events for other keys', () => {\n const { result } = renderHook(() => useLocalStorage('settings', { defaultValue: { compact: false } }))\n\n act(() => {\n window.dispatchEvent(\n new StorageEvent('storage', {\n key: 'profile',\n newValue: JSON.stringify({ compact: true }),\n storageArea: window.localStorage\n })\n )\n })\n\n expect(result.current[0]).toEqual({ compact: false })\n })\n\n it('does not subscribe to storage events when sync is disabled', () => {\n const { result } = renderHook(() =>\n useLocalStorage('settings', {\n defaultValue: { compact: false },\n sync: false\n })\n )\n\n act(() => {\n window.dispatchEvent(\n new StorageEvent('storage', {\n key: 'settings',\n newValue: JSON.stringify({ compact: true }),\n storageArea: window.localStorage\n })\n )\n })\n\n expect(result.current[0]).toEqual({ compact: false })\n })\n})\n"],"mappings":"0IAIA,SAAS,sBAAyB,CAChC,GAAG,sDAAyD,CAC1D,GAAM,CAAE,UAAW,MAAiB,EAAgB,WAAY,CAAE,aAAc,CAAE,QAAS,GAAO,CAAE,CAAC,CAAC,CAEtG,OAAO,EAAO,QAAQ,GAAG,CAAC,QAAQ,CAAE,QAAS,GAAO,CAAC,EACrD,CAEF,GAAG,qDAAwD,CACzD,OAAO,aAAa,QAAQ,WAAY,KAAK,UAAU,CAAE,QAAS,GAAM,CAAC,CAAC,CAE1E,GAAM,CAAE,UAAW,MAAiB,EAAgB,WAAY,CAAE,aAAc,CAAE,QAAS,GAAO,CAAE,CAAC,CAAC,CAEtG,OAAO,EAAO,QAAQ,GAAG,CAAC,QAAQ,CAAE,QAAS,GAAM,CAAC,EACpD,CAEF,GAAG,+CAAkD,CACnD,GAAM,CAAE,UAAW,MAAiB,EAAgB,WAAY,CAAE,aAAc,CAAE,QAAS,GAAO,CAAE,CAAC,CAAC,CAEtG,MAAU,EAAO,QAAQ,GAAG,CAAE,QAAS,GAAM,CAAC,CAAC,CAE/C,OAAO,EAAO,QAAQ,GAAG,CAAC,QAAQ,CAAE,QAAS,GAAM,CAAC,CACpD,OAAO,OAAO,aAAa,QAAQ,WAAW,CAAC,CAAC,KAAK,KAAK,UAAU,CAAE,QAAS,GAAM,CAAC,CAAC,EACvF,CAEF,GAAG,kCAAqC,CACtC,GAAM,CAAE,UAAW,MAAiB,EAAgB,QAAS,CAAE,aAAc,EAAG,CAAC,CAAC,CAElF,MAAU,EAAO,QAAQ,GAAI,GAAY,EAAU,EAAE,CAAC,CAEtD,OAAO,EAAO,QAAQ,GAAG,CAAC,KAAK,EAAE,CACjC,OAAO,OAAO,aAAa,QAAQ,QAAQ,CAAC,CAAC,KAAK,IAAI,EACtD,CAEF,GAAG,yDAA4D,CAC7D,GAAM,CAAE,UAAW,MAAiB,EAAgB,WAAY,CAAE,aAAc,CAAE,QAAS,GAAO,CAAE,CAAC,CAAC,CAEtG,MAAU,CACR,OAAO,cACL,IAAI,aAAa,UAAW,CAC1B,IAAK,WACL,SAAU,KAAK,UAAU,CAAE,QAAS,GAAM,CAAC,CAC3C,YAAa,OAAO,aACrB,CAAC,CACH,EACD,CAEF,OAAO,EAAO,QAAQ,GAAG,CAAC,QAAQ,CAAE,QAAS,GAAM,CAAC,EACpD,CAEF,GAAG,4CAA+C,CAChD,GAAM,CAAE,UAAW,MAAiB,EAAgB,WAAY,CAAE,aAAc,CAAE,QAAS,GAAO,CAAE,CAAC,CAAC,CAEtG,MAAU,CACR,OAAO,cACL,IAAI,aAAa,UAAW,CAC1B,IAAK,UACL,SAAU,KAAK,UAAU,CAAE,QAAS,GAAM,CAAC,CAC3C,YAAa,OAAO,aACrB,CAAC,CACH,EACD,CAEF,OAAO,EAAO,QAAQ,GAAG,CAAC,QAAQ,CAAE,QAAS,GAAO,CAAC,EACrD,CAEF,GAAG,iEAAoE,CACrE,GAAM,CAAE,UAAW,MACjB,EAAgB,WAAY,CAC1B,aAAc,CAAE,QAAS,GAAO,CAChC,KAAM,GACP,CAAC,CACH,CAED,MAAU,CACR,OAAO,cACL,IAAI,aAAa,UAAW,CAC1B,IAAK,WACL,SAAU,KAAK,UAAU,CAAE,QAAS,GAAM,CAAC,CAC3C,YAAa,OAAO,aACrB,CAAC,CACH,EACD,CAEF,OAAO,EAAO,QAAQ,GAAG,CAAC,QAAQ,CAAE,QAAS,GAAO,CAAC,EACrD,EACF"}
1
+ {"version":3,"file":"use-local-storage.spec.js","names":[],"sources":["../../src/hooks/use-local-storage.spec.ts"],"sourcesContent":["import { act, renderHook } from '@testing-library/react'\n\nimport { useLocalStorage } from './use-local-storage'\n\ndescribe('useLocalStorage', () => {\n it('returns the default value when storage is empty', () => {\n const { result } = renderHook(() => useLocalStorage('settings', { defaultValue: { compact: false } }))\n\n expect(result.current[0]).toEqual({ compact: false })\n })\n\n it('reads an existing JSON value from localStorage', () => {\n window.localStorage.setItem('settings', JSON.stringify({ compact: true }))\n\n const { result } = renderHook(() => useLocalStorage('settings', { defaultValue: { compact: false } }))\n\n expect(result.current[0]).toEqual({ compact: true })\n })\n\n it('writes serialized values to localStorage', () => {\n const { result } = renderHook(() => useLocalStorage('settings', { defaultValue: { compact: false } }))\n\n act(() => result.current[1]({ compact: true }))\n\n expect(result.current[0]).toEqual({ compact: true })\n expect(window.localStorage.getItem('settings')).toBe(JSON.stringify({ compact: true }))\n })\n\n it('supports functional updates', () => {\n const { result } = renderHook(() => useLocalStorage('count', { defaultValue: 1 }))\n\n act(() => result.current[1]((current) => current + 1))\n\n expect(result.current[0]).toBe(2)\n expect(window.localStorage.getItem('count')).toBe('2')\n })\n\n it('syncs updates from storage events for the same key', () => {\n const { result } = renderHook(() => useLocalStorage('settings', { defaultValue: { compact: false } }))\n\n act(() => {\n window.dispatchEvent(\n new StorageEvent('storage', {\n key: 'settings',\n newValue: JSON.stringify({ compact: true }),\n storageArea: window.localStorage\n })\n )\n })\n\n expect(result.current[0]).toEqual({ compact: true })\n })\n\n it('ignores storage events for other keys', () => {\n const { result } = renderHook(() => useLocalStorage('settings', { defaultValue: { compact: false } }))\n\n act(() => {\n window.dispatchEvent(\n new StorageEvent('storage', {\n key: 'profile',\n newValue: JSON.stringify({ compact: true }),\n storageArea: window.localStorage\n })\n )\n })\n\n expect(result.current[0]).toEqual({ compact: false })\n })\n\n it('does not subscribe to storage events when sync is disabled', () => {\n const { result } = renderHook(() =>\n useLocalStorage('settings', {\n defaultValue: { compact: false },\n sync: false\n })\n )\n\n act(() => {\n window.dispatchEvent(\n new StorageEvent('storage', {\n key: 'settings',\n newValue: JSON.stringify({ compact: true }),\n storageArea: window.localStorage\n })\n )\n })\n\n expect(result.current[0]).toEqual({ compact: false })\n })\n})\n"],"mappings":"0IAIA,SAAS,sBAAyB,CAChC,GAAG,sDAAyD,CAC1D,GAAM,CAAE,UAAW,MAAiB,EAAgB,WAAY,CAAE,aAAc,CAAE,QAAS,EAAM,CAAE,CAAC,CAAC,EAErG,OAAO,EAAO,QAAQ,EAAE,EAAE,QAAQ,CAAE,QAAS,EAAM,CAAC,CACtD,CAAC,EAED,GAAG,qDAAwD,CACzD,OAAO,aAAa,QAAQ,WAAY,KAAK,UAAU,CAAE,QAAS,EAAK,CAAC,CAAC,EAEzE,GAAM,CAAE,UAAW,MAAiB,EAAgB,WAAY,CAAE,aAAc,CAAE,QAAS,EAAM,CAAE,CAAC,CAAC,EAErG,OAAO,EAAO,QAAQ,EAAE,EAAE,QAAQ,CAAE,QAAS,EAAK,CAAC,CACrD,CAAC,EAED,GAAG,+CAAkD,CACnD,GAAM,CAAE,UAAW,MAAiB,EAAgB,WAAY,CAAE,aAAc,CAAE,QAAS,EAAM,CAAE,CAAC,CAAC,EAErG,MAAU,EAAO,QAAQ,GAAG,CAAE,QAAS,EAAK,CAAC,CAAC,EAE9C,OAAO,EAAO,QAAQ,EAAE,EAAE,QAAQ,CAAE,QAAS,EAAK,CAAC,EACnD,OAAO,OAAO,aAAa,QAAQ,UAAU,CAAC,EAAE,KAAK,KAAK,UAAU,CAAE,QAAS,EAAK,CAAC,CAAC,CACxF,CAAC,EAED,GAAG,kCAAqC,CACtC,GAAM,CAAE,UAAW,MAAiB,EAAgB,QAAS,CAAE,aAAc,CAAE,CAAC,CAAC,EAEjF,MAAU,EAAO,QAAQ,GAAI,GAAY,EAAU,CAAC,CAAC,EAErD,OAAO,EAAO,QAAQ,EAAE,EAAE,KAAK,CAAC,EAChC,OAAO,OAAO,aAAa,QAAQ,OAAO,CAAC,EAAE,KAAK,GAAG,CACvD,CAAC,EAED,GAAG,yDAA4D,CAC7D,GAAM,CAAE,UAAW,MAAiB,EAAgB,WAAY,CAAE,aAAc,CAAE,QAAS,EAAM,CAAE,CAAC,CAAC,EAErG,MAAU,CACR,OAAO,cACL,IAAI,aAAa,UAAW,CAC1B,IAAK,WACL,SAAU,KAAK,UAAU,CAAE,QAAS,EAAK,CAAC,EAC1C,YAAa,OAAO,YACtB,CAAC,CACH,CACF,CAAC,EAED,OAAO,EAAO,QAAQ,EAAE,EAAE,QAAQ,CAAE,QAAS,EAAK,CAAC,CACrD,CAAC,EAED,GAAG,4CAA+C,CAChD,GAAM,CAAE,UAAW,MAAiB,EAAgB,WAAY,CAAE,aAAc,CAAE,QAAS,EAAM,CAAE,CAAC,CAAC,EAErG,MAAU,CACR,OAAO,cACL,IAAI,aAAa,UAAW,CAC1B,IAAK,UACL,SAAU,KAAK,UAAU,CAAE,QAAS,EAAK,CAAC,EAC1C,YAAa,OAAO,YACtB,CAAC,CACH,CACF,CAAC,EAED,OAAO,EAAO,QAAQ,EAAE,EAAE,QAAQ,CAAE,QAAS,EAAM,CAAC,CACtD,CAAC,EAED,GAAG,iEAAoE,CACrE,GAAM,CAAE,UAAW,MACjB,EAAgB,WAAY,CAC1B,aAAc,CAAE,QAAS,EAAM,EAC/B,KAAM,EACR,CAAC,CACH,EAEA,MAAU,CACR,OAAO,cACL,IAAI,aAAa,UAAW,CAC1B,IAAK,WACL,SAAU,KAAK,UAAU,CAAE,QAAS,EAAK,CAAC,EAC1C,YAAa,OAAO,YACtB,CAAC,CACH,CACF,CAAC,EAED,OAAO,EAAO,QAAQ,EAAE,EAAE,QAAQ,CAAE,QAAS,EAAM,CAAC,CACtD,CAAC,CACH,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { n as __name } from "../chunk-CHh1Zzun.js";
2
+ import { MaskOptions, MaskOptions as MaskOptions$1, ModifiedData, Modify, Replacement, Track, TrackingData } from "@react-input/mask";
3
+
4
+ //#region src/hooks/use-mask.d.ts
5
+ type UseMaskOptions = MaskOptions$1;
6
+ declare function useMask(options?: UseMaskOptions): import("react").MutableRefObject<HTMLInputElement>;
7
+ //#endregion
8
+ export { type MaskOptions, type ModifiedData, type Modify, type Replacement, type Track, type TrackingData, UseMaskOptions, useMask };
9
+ //# sourceMappingURL=use-mask.d.ts.map
@@ -0,0 +1,2 @@
1
+ import"../chunk-CHh1Zzun.js";import{useMask as e}from"@react-input/mask";const t={9:/\d/,a:/[A-Za-z]/,"*":/./};function useMask(n={}){let{replacement:r,...i}=n;return e({...i,replacement:r??t})}export{useMask};
2
+ //# sourceMappingURL=use-mask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-mask.js","names":["useReactInputMask"],"sources":["../../src/hooks/use-mask.ts"],"sourcesContent":["import type { MaskOptions, Replacement } from '@react-input/mask'\nimport { useMask as useReactInputMask } from '@react-input/mask'\n\nexport type { MaskOptions, ModifiedData, Modify, Replacement, Track, TrackingData } from '@react-input/mask'\n\nconst DEFAULT_REPLACEMENT: Replacement = {\n 9: /\\d/,\n a: /[A-Za-z]/,\n '*': /./\n}\n\nexport type UseMaskOptions = MaskOptions\n\nexport function useMask(options: UseMaskOptions = {}) {\n const { replacement, ...rest } = options\n return useReactInputMask({\n ...rest,\n replacement: replacement ?? DEFAULT_REPLACEMENT\n })\n}\n"],"mappings":"yEAKA,MAAM,EAAmC,CACvC,EAAG,KACH,EAAG,WACH,IAAK,GACP,EAIA,SAAgB,QAAQ,EAA0B,CAAC,EAAG,CACpD,GAAM,CAAE,cAAa,GAAG,GAAS,EACjC,OAAOA,EAAkB,CACvB,GAAG,EACH,YAAa,GAAe,CAC9B,CAAC,CACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-mobile.js","names":[],"sources":["../../src/hooks/use-mobile.ts"],"sourcesContent":["import * as React from 'react'\n\nconst MOBILE_BREAKPOINT = 768\n\nexport function useIsMobile() {\n const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)\n\n React.useEffect(() => {\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)\n const onChange = () => {\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)\n }\n mql.addEventListener('change', onChange)\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)\n return () => mql.removeEventListener('change', onChange)\n }, [])\n\n return !!isMobile\n}\n"],"mappings":"qDAIA,SAAgB,aAAc,CAC5B,GAAM,CAAC,EAAU,GAAe,EAAM,SAA8B,IAAA,GAAU,CAY9E,OAVA,EAAM,cAAgB,CACpB,IAAM,EAAM,OAAO,WAAW,qBAA0C,CAClE,aAAiB,CACrB,EAAY,OAAO,WAAa,IAAkB,EAIpD,OAFA,EAAI,iBAAiB,SAAU,SAAS,CACxC,EAAY,OAAO,WAAa,IAAkB,KACrC,EAAI,oBAAoB,SAAU,SAAS,EACvD,EAAE,CAAC,CAEC,CAAC,CAAC"}
1
+ {"version":3,"file":"use-mobile.js","names":[],"sources":["../../src/hooks/use-mobile.ts"],"sourcesContent":["import * as React from 'react'\n\nconst MOBILE_BREAKPOINT = 768\n\nexport function useIsMobile() {\n const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)\n\n React.useEffect(() => {\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)\n const onChange = () => {\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)\n }\n mql.addEventListener('change', onChange)\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)\n return () => mql.removeEventListener('change', onChange)\n }, [])\n\n return !!isMobile\n}\n"],"mappings":"qDAIA,SAAgB,aAAc,CAC5B,GAAM,CAAC,EAAU,GAAe,EAAM,SAA8B,IAAA,EAAS,EAY7E,OAVA,EAAM,cAAgB,CACpB,IAAM,EAAM,OAAO,WAAW,oBAAyC,EACjE,aAAiB,CACrB,EAAY,OAAO,WAAa,GAAiB,CACnD,EAGA,OAFA,EAAI,iBAAiB,SAAU,QAAQ,EACvC,EAAY,OAAO,WAAa,GAAiB,MACpC,EAAI,oBAAoB,SAAU,QAAQ,CACzD,EAAG,CAAC,CAAC,EAEE,CAAC,CAAC,CACX"}
@@ -1,2 +1,2 @@
1
- import"../chunk-CHh1Zzun.js";import{useIsMobile as e}from"./use-mobile.js";import{i as t,t as n}from"../react.esm-D_dNEsWM.js";describe(`useIsMobile`,()=>{it(`returns true below the mobile breakpoint`,()=>{globalThis.setTestViewportWidth(767);let{result:n}=t(()=>e());expect(n.current).toBe(!0)}),it(`returns false at the mobile breakpoint`,()=>{globalThis.setTestViewportWidth(768);let{result:n}=t(()=>e());expect(n.current).toBe(!1)}),it(`updates when the media query changes`,()=>{globalThis.setTestViewportWidth(1024);let{result:r}=t(()=>e());expect(r.current).toBe(!1),n(()=>{globalThis.setTestViewportWidth(500)}),expect(r.current).toBe(!0),n(()=>{globalThis.setTestViewportWidth(900)}),expect(r.current).toBe(!1)}),it(`removes the media query listener on unmount`,()=>{let n=vi.fn();vi.spyOn(window,`matchMedia`).mockReturnValue({matches:!1,media:`(max-width: 767px)`,onchange:null,addEventListener:vi.fn(),removeEventListener:n,dispatchEvent:vi.fn(),addListener:vi.fn(),removeListener:vi.fn()});let{unmount:r}=t(()=>e());r(),expect(n).toHaveBeenCalledWith(`change`,expect.any(Function))})});
1
+ import"../chunk-CHh1Zzun.js";import{useIsMobile as e}from"./use-mobile.js";import{i as t,t as n}from"../react.esm-BagSCtI3.js";describe(`useIsMobile`,()=>{it(`returns true below the mobile breakpoint`,()=>{globalThis.setTestViewportWidth(767);let{result:n}=t(()=>e());expect(n.current).toBe(!0)}),it(`returns false at the mobile breakpoint`,()=>{globalThis.setTestViewportWidth(768);let{result:n}=t(()=>e());expect(n.current).toBe(!1)}),it(`updates when the media query changes`,()=>{globalThis.setTestViewportWidth(1024);let{result:r}=t(()=>e());expect(r.current).toBe(!1),n(()=>{globalThis.setTestViewportWidth(500)}),expect(r.current).toBe(!0),n(()=>{globalThis.setTestViewportWidth(900)}),expect(r.current).toBe(!1)}),it(`removes the media query listener on unmount`,()=>{let n=vi.fn();vi.spyOn(window,`matchMedia`).mockReturnValue({matches:!1,media:`(max-width: 767px)`,onchange:null,addEventListener:vi.fn(),removeEventListener:n,dispatchEvent:vi.fn(),addListener:vi.fn(),removeListener:vi.fn()});let{unmount:r}=t(()=>e());r(),expect(n).toHaveBeenCalledWith(`change`,expect.any(Function))})});
2
2
  //# sourceMappingURL=use-mobile.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-mobile.spec.js","names":[],"sources":["../../src/hooks/use-mobile.spec.ts"],"sourcesContent":["import { act, renderHook } from '@testing-library/react'\n\nimport { useIsMobile } from './use-mobile'\n\ndescribe('useIsMobile', () => {\n it('returns true below the mobile breakpoint', () => {\n globalThis.setTestViewportWidth(767)\n\n const { result } = renderHook(() => useIsMobile())\n\n expect(result.current).toBe(true)\n })\n\n it('returns false at the mobile breakpoint', () => {\n globalThis.setTestViewportWidth(768)\n\n const { result } = renderHook(() => useIsMobile())\n\n expect(result.current).toBe(false)\n })\n\n it('updates when the media query changes', () => {\n globalThis.setTestViewportWidth(1024)\n const { result } = renderHook(() => useIsMobile())\n\n expect(result.current).toBe(false)\n\n act(() => {\n globalThis.setTestViewportWidth(500)\n })\n expect(result.current).toBe(true)\n\n act(() => {\n globalThis.setTestViewportWidth(900)\n })\n expect(result.current).toBe(false)\n })\n\n it('removes the media query listener on unmount', () => {\n const removeEventListener = vi.fn()\n\n vi.spyOn(window, 'matchMedia').mockReturnValue({\n matches: false,\n media: '(max-width: 767px)',\n onchange: null,\n addEventListener: vi.fn(),\n removeEventListener,\n dispatchEvent: vi.fn(),\n addListener: vi.fn(),\n removeListener: vi.fn()\n })\n\n const { unmount } = renderHook(() => useIsMobile())\n\n unmount()\n\n expect(removeEventListener).toHaveBeenCalledWith('change', expect.any(Function))\n })\n})\n"],"mappings":"+HAIA,SAAS,kBAAqB,CAC5B,GAAG,+CAAkD,CACnD,WAAW,qBAAqB,IAAI,CAEpC,GAAM,CAAE,UAAW,MAAiB,GAAa,CAAC,CAElD,OAAO,EAAO,QAAQ,CAAC,KAAK,GAAK,EACjC,CAEF,GAAG,6CAAgD,CACjD,WAAW,qBAAqB,IAAI,CAEpC,GAAM,CAAE,UAAW,MAAiB,GAAa,CAAC,CAElD,OAAO,EAAO,QAAQ,CAAC,KAAK,GAAM,EAClC,CAEF,GAAG,2CAA8C,CAC/C,WAAW,qBAAqB,KAAK,CACrC,GAAM,CAAE,UAAW,MAAiB,GAAa,CAAC,CAElD,OAAO,EAAO,QAAQ,CAAC,KAAK,GAAM,CAElC,MAAU,CACR,WAAW,qBAAqB,IAAI,EACpC,CACF,OAAO,EAAO,QAAQ,CAAC,KAAK,GAAK,CAEjC,MAAU,CACR,WAAW,qBAAqB,IAAI,EACpC,CACF,OAAO,EAAO,QAAQ,CAAC,KAAK,GAAM,EAClC,CAEF,GAAG,kDAAqD,CACtD,IAAM,EAAsB,GAAG,IAAI,CAEnC,GAAG,MAAM,OAAQ,aAAa,CAAC,gBAAgB,CAC7C,QAAS,GACT,MAAO,qBACP,SAAU,KACV,iBAAkB,GAAG,IAAI,CACzB,sBACA,cAAe,GAAG,IAAI,CACtB,YAAa,GAAG,IAAI,CACpB,eAAgB,GAAG,IAAI,CACxB,CAAC,CAEF,GAAM,CAAE,WAAY,MAAiB,GAAa,CAAC,CAEnD,GAAS,CAET,OAAO,EAAoB,CAAC,qBAAqB,SAAU,OAAO,IAAI,SAAS,CAAC,EAChF,EACF"}
1
+ {"version":3,"file":"use-mobile.spec.js","names":[],"sources":["../../src/hooks/use-mobile.spec.ts"],"sourcesContent":["import { act, renderHook } from '@testing-library/react'\n\nimport { useIsMobile } from './use-mobile'\n\ndescribe('useIsMobile', () => {\n it('returns true below the mobile breakpoint', () => {\n globalThis.setTestViewportWidth(767)\n\n const { result } = renderHook(() => useIsMobile())\n\n expect(result.current).toBe(true)\n })\n\n it('returns false at the mobile breakpoint', () => {\n globalThis.setTestViewportWidth(768)\n\n const { result } = renderHook(() => useIsMobile())\n\n expect(result.current).toBe(false)\n })\n\n it('updates when the media query changes', () => {\n globalThis.setTestViewportWidth(1024)\n const { result } = renderHook(() => useIsMobile())\n\n expect(result.current).toBe(false)\n\n act(() => {\n globalThis.setTestViewportWidth(500)\n })\n expect(result.current).toBe(true)\n\n act(() => {\n globalThis.setTestViewportWidth(900)\n })\n expect(result.current).toBe(false)\n })\n\n it('removes the media query listener on unmount', () => {\n const removeEventListener = vi.fn()\n\n vi.spyOn(window, 'matchMedia').mockReturnValue({\n matches: false,\n media: '(max-width: 767px)',\n onchange: null,\n addEventListener: vi.fn(),\n removeEventListener,\n dispatchEvent: vi.fn(),\n addListener: vi.fn(),\n removeListener: vi.fn()\n })\n\n const { unmount } = renderHook(() => useIsMobile())\n\n unmount()\n\n expect(removeEventListener).toHaveBeenCalledWith('change', expect.any(Function))\n })\n})\n"],"mappings":"+HAIA,SAAS,kBAAqB,CAC5B,GAAG,+CAAkD,CACnD,WAAW,qBAAqB,GAAG,EAEnC,GAAM,CAAE,UAAW,MAAiB,EAAY,CAAC,EAEjD,OAAO,EAAO,OAAO,EAAE,KAAK,EAAI,CAClC,CAAC,EAED,GAAG,6CAAgD,CACjD,WAAW,qBAAqB,GAAG,EAEnC,GAAM,CAAE,UAAW,MAAiB,EAAY,CAAC,EAEjD,OAAO,EAAO,OAAO,EAAE,KAAK,EAAK,CACnC,CAAC,EAED,GAAG,2CAA8C,CAC/C,WAAW,qBAAqB,IAAI,EACpC,GAAM,CAAE,UAAW,MAAiB,EAAY,CAAC,EAEjD,OAAO,EAAO,OAAO,EAAE,KAAK,EAAK,EAEjC,MAAU,CACR,WAAW,qBAAqB,GAAG,CACrC,CAAC,EACD,OAAO,EAAO,OAAO,EAAE,KAAK,EAAI,EAEhC,MAAU,CACR,WAAW,qBAAqB,GAAG,CACrC,CAAC,EACD,OAAO,EAAO,OAAO,EAAE,KAAK,EAAK,CACnC,CAAC,EAED,GAAG,kDAAqD,CACtD,IAAM,EAAsB,GAAG,GAAG,EAElC,GAAG,MAAM,OAAQ,YAAY,EAAE,gBAAgB,CAC7C,QAAS,GACT,MAAO,qBACP,SAAU,KACV,iBAAkB,GAAG,GAAG,EACxB,sBACA,cAAe,GAAG,GAAG,EACrB,YAAa,GAAG,GAAG,EACnB,eAAgB,GAAG,GAAG,CACxB,CAAC,EAED,GAAM,CAAE,WAAY,MAAiB,EAAY,CAAC,EAElD,EAAQ,EAER,OAAO,CAAmB,EAAE,qBAAqB,SAAU,OAAO,IAAI,QAAQ,CAAC,CACjF,CAAC,CACH,CAAC"}
package/dist/index.d.ts CHANGED
@@ -3,8 +3,11 @@ import { Button, ButtonProps, buttonVariants } from "./components/button.js";
3
3
  import { AlertDialog, AlertDialogAction, AlertDialogActionProps, AlertDialogCancel, AlertDialogCancelProps, AlertDialogContent, AlertDialogContentProps, AlertDialogDescription, AlertDialogDescriptionProps, AlertDialogFooter, AlertDialogFooterProps, AlertDialogHeader, AlertDialogHeaderProps, AlertDialogMedia, AlertDialogMediaProps, AlertDialogOverlay, AlertDialogOverlayProps, AlertDialogPortal, AlertDialogPortalProps, AlertDialogProps, AlertDialogTitle, AlertDialogTitleProps, AlertDialogTrigger, AlertDialogTriggerProps } from "./components/alert-dialog.js";
4
4
  import { Alert, AlertAction, AlertActionProps, AlertDescription, AlertDescriptionProps, AlertProps, AlertTitle, AlertTitleProps } from "./components/alert.js";
5
5
  import { Anchor, AnchorProps, anchorVariants } from "./components/anchor.js";
6
+ import { a as ChartLegendContent, c as ChartStyle, d as ChartTooltipContent, f as ChartTooltipContentProps, i as ChartLegend, l as ChartStyleProps, n as ChartContainer, o as ChartLegendContentProps, p as ChartTooltipProps, r as ChartContainerProps, s as ChartLegendProps, t as ChartConfig, u as ChartTooltip } from "./chart-DHS2QeM8.js";
7
+ import { AreaChart, AreaChartCurveType, AreaChartGridAxis, AreaChartProps, AreaChartSeries, AreaChartType } from "./components/area-chart.js";
6
8
  import { Avatar, AvatarBadge, AvatarBadgeProps, AvatarFallback, AvatarFallbackProps, AvatarGroup, AvatarGroupCount, AvatarGroupCountProps, AvatarGroupProps, AvatarImage, AvatarImageProps, AvatarProps } from "./components/avatar.js";
7
9
  import { Badge, BadgeProps, badgeVariants } from "./components/badge.js";
10
+ import { BarChart, BarChartGridAxis, BarChartOrientation, BarChartProps, BarChartSeries, BarChartType } from "./components/bar-chart.js";
8
11
  import { Breadcrumb, BreadcrumbEllipsis, BreadcrumbEllipsisProps, BreadcrumbItem, BreadcrumbItemProps, BreadcrumbLink, BreadcrumbLinkProps, BreadcrumbList, BreadcrumbListProps, BreadcrumbPage, BreadcrumbPageProps, BreadcrumbProps, BreadcrumbSeparator, BreadcrumbSeparatorProps } from "./components/breadcrumb.js";
9
12
  import { Separator, SeparatorProps } from "./components/separator.js";
10
13
  import { ButtonGroup, ButtonGroupProps, ButtonGroupSeparator, ButtonGroupSeparatorProps, ButtonGroupText, ButtonGroupTextProps, buttonGroupVariants } from "./components/button-group.js";
@@ -12,7 +15,6 @@ import { Calendar, CalendarDayButton, CalendarDayButtonProps, CalendarProps, Dat
12
15
  import { Card, CardAction, CardActionProps, CardContent, CardContentProps, CardDescription, CardDescriptionProps, CardFooter, CardFooterProps, CardHeader, CardHeaderProps, CardProps, CardTitle, CardTitleProps } from "./components/card.js";
13
16
  import { Carousel, CarouselApi, CarouselContent, CarouselContentProps, CarouselIndicators, CarouselIndicatorsProps, CarouselItem, CarouselItemProps, CarouselNext, CarouselNextProps, CarouselPrevious, CarouselPreviousProps, CarouselProps, useCarousel } from "./components/carousel.js";
14
17
  import { Center, CenterProps, centerVariants } from "./components/center.js";
15
- import { Bar, BarChart, CartesianGrid, ChartConfig, ChartContainer, ChartContainerProps, ChartLegend, ChartLegendContent, ChartLegendContentProps, ChartLegendProps, ChartStyle, ChartStyleProps, ChartTooltip, ChartTooltipContent, ChartTooltipContentProps, ChartTooltipProps, XAxis } from "./components/chart.js";
16
18
  import { UIColor, selectionControlColorVariants, uiColors } from "./lib/color.js";
17
19
  import { Label, LabelProps } from "./components/label.js";
18
20
  import { Checkbox, CheckboxProps } from "./components/checkbox.js";
@@ -22,8 +24,12 @@ import { Combobox, ComboboxChip, ComboboxChipProps, ComboboxChips, ComboboxChips
22
24
  import { Dialog, DialogClose, DialogCloseProps, DialogContent, DialogContentProps, DialogDescription, DialogDescriptionProps, DialogFooter, DialogFooterProps, DialogHeader, DialogHeaderProps, DialogOverlay, DialogOverlayProps, DialogPortal, DialogPortalProps, DialogProps, DialogTitle, DialogTitleProps, DialogTrigger, DialogTriggerProps } from "./components/dialog.js";
23
25
  import { Command, CommandDialog, CommandDialogProps, CommandEmpty, CommandEmptyProps, CommandGroup, CommandGroupProps, CommandInput, CommandInputProps, CommandItem, CommandItemProps, CommandList, CommandListProps, CommandProps, CommandSeparator, CommandSeparatorProps, CommandShortcut, CommandShortcutProps } from "./components/command.js";
24
26
  import { Container, ContainerProps, containerVariants } from "./components/container.js";
27
+ import { Table, TableBody, TableBodyProps, TableCaption, TableCaptionProps, TableCell, TableCellProps, TableContainer, TableContainerProps, TableFooter, TableFooterProps, TableHead, TableHeadProps, TableHeader, TableHeaderProps, TableProps, TableRow, TableRowProps, tableVariants } from "./components/table.js";
28
+ import { Column, ColumnDef, DataTable, DataTableBody, DataTableBodyProps, DataTableColumnHeader, DataTableColumnHeaderProps, DataTableHeader, DataTableHeaderProps, DataTableLabels, DataTablePagination, DataTablePaginationProps, DataTableProps, DataTableRoot, DataTableRootProps, DataTableToolbar, DataTableToolbarProps, DataTableViewOptions, DataTableViewOptionsProps, RowData, TanStackTable, UseDataTableOptions, createDataTableSelectColumn, defaultDataTableLabels, useDataTable, useDataTableContext } from "./components/data-table.js";
25
29
  import { Popover, PopoverAnchor, PopoverAnchorProps, PopoverContent, PopoverContentProps, PopoverDescription, PopoverDescriptionProps, PopoverHeader, PopoverHeaderProps, PopoverProps, PopoverTitle, PopoverTitleProps, PopoverTrigger, PopoverTriggerProps } from "./components/popover.js";
26
30
  import { DateRangePicker, DateRangePickerActions, DateRangePickerActionsProps, DateRangePickerApply, DateRangePickerApplyProps, DateRangePickerCalendar, DateRangePickerCalendarProps, DateRangePickerContent, DateRangePickerContentProps, DateRangePickerDateFields, DateRangePickerDateFieldsProps, DateRangePickerPreset, DateRangePickerPresetOption, DateRangePickerPresetProps, DateRangePickerPresets, DateRangePickerPresetsProps, DateRangePickerProps, DateRangePickerReset, DateRangePickerResetProps, DateRangePickerTrigger, DateRangePickerTriggerProps, DateRangePickerValue, DateRangePickerValueProps } from "./components/date-range-picker.js";
31
+ import { PieChart, PieChartBase, PieChartBaseProps, PieChartDatum, PieChartProps, buildPieConfig } from "./components/pie-chart.js";
32
+ import { DonutChart, DonutChartProps } from "./components/donut-chart.js";
27
33
  import { Drawer, DrawerBody, DrawerBodyProps, DrawerClose, DrawerCloseProps, DrawerContent, DrawerContentProps, DrawerDescription, DrawerDescriptionProps, DrawerFooter, DrawerFooterProps, DrawerHeader, DrawerHeaderProps, DrawerOverlay, DrawerOverlayProps, DrawerPortal, DrawerPortalProps, DrawerProps, DrawerTitle, DrawerTitleProps, DrawerTrigger, DrawerTriggerProps } from "./components/drawer.js";
28
34
  import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuCheckboxItemProps, DropdownMenuContent, DropdownMenuContentProps, DropdownMenuGroup, DropdownMenuGroupProps, DropdownMenuItem, DropdownMenuItemProps, DropdownMenuLabel, DropdownMenuLabelProps, DropdownMenuPortal, DropdownMenuPortalProps, DropdownMenuProps, DropdownMenuRadioGroup, DropdownMenuRadioGroupProps, DropdownMenuRadioItem, DropdownMenuRadioItemProps, DropdownMenuSeparator, DropdownMenuSeparatorProps, DropdownMenuShortcut, DropdownMenuShortcutProps, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubContentProps, DropdownMenuSubProps, DropdownMenuSubTrigger, DropdownMenuSubTriggerProps, DropdownMenuTrigger, DropdownMenuTriggerProps } from "./components/dropdown-menu.js";
29
35
  import { Dropzone, DropzoneArea, DropzoneAreaProps, DropzoneDescription, DropzoneDescriptionProps, DropzoneFileList, DropzoneFileListItem, DropzoneFileListItemProps, DropzoneFileListProps, DropzoneFileMessage, DropzoneFileMessageProps, DropzoneFileStatus, DropzoneMessage, DropzoneMessageProps, DropzoneProps, DropzoneRemoveFile, DropzoneRemoveFileProps, DropzoneRetryFile, DropzoneRetryFileProps, DropzoneTrigger, DropzoneTriggerProps, DropzoneUploadResult, DropzoneValidation, ErrorCode, FileError, FileStatus, InfiniteProgress, InfiniteProgressProps, UseDropzoneProps, UseDropzoneReturn, useDropzone } from "./components/dropzone.js";
@@ -39,6 +45,8 @@ import { InputOTP, InputOTPGroup, InputOTPGroupProps, InputOTPProps, InputOTPSep
39
45
  import { Input, InputProps } from "./components/input.js";
40
46
  import { Kbd, KbdGroup, KbdGroupProps, KbdProps } from "./components/kbd.js";
41
47
  import { List, ListIcon, ListIconProps, ListItem, ListItemProps, ListProps, listVariants } from "./components/list.js";
48
+ import { MaskOptions, ModifiedData, Modify, Replacement, Track, TrackingData, UseMaskOptions, useMask } from "./hooks/use-mask.js";
49
+ import { MaskInput, MaskInputProps } from "./components/mask-input.js";
42
50
  import { NativeSelect, NativeSelectOptGroup, NativeSelectOptGroupProps, NativeSelectOption, NativeSelectOptionProps, NativeSelectProps } from "./components/native-select.js";
43
51
  import { NavigationMenu, NavigationMenuContent, NavigationMenuContentProps, NavigationMenuIndicator, NavigationMenuIndicatorProps, NavigationMenuItem, NavigationMenuItemProps, NavigationMenuLink, NavigationMenuLinkProps, NavigationMenuList, NavigationMenuListProps, NavigationMenuProps, NavigationMenuTrigger, NavigationMenuTriggerProps, NavigationMenuViewport, NavigationMenuViewportProps, navigationMenuTriggerStyle } from "./components/navigation-menu.js";
44
52
  import { Pagination, PaginationContent, PaginationContentProps, PaginationEllipsis, PaginationEllipsisProps, PaginationItem, PaginationItemProps, PaginationLink, PaginationLinkProps, PaginationNext, PaginationNextProps, PaginationPrevious, PaginationPreviousProps, PaginationProps } from "./components/pagination.js";
@@ -56,7 +64,6 @@ import { Toaster, ToasterProps, toast } from "./components/sonner.js";
56
64
  import { Spinner, SpinnerProps, spinnerVariants } from "./components/spinner.js";
57
65
  import { Stack, StackProps, stackVariants } from "./components/stack.js";
58
66
  import { Switch, SwitchProps } from "./components/switch.js";
59
- import { Table, TableBody, TableBodyProps, TableCaption, TableCaptionProps, TableCell, TableCellProps, TableFooter, TableFooterProps, TableHead, TableHeadProps, TableHeader, TableHeaderProps, TableProps, TableRow, TableRowProps } from "./components/table.js";
60
67
  import { Tabs, TabsContent, TabsContentProps, TabsList, TabsListProps, TabsProps, TabsTrigger, TabsTriggerProps, tabsListVariants } from "./components/tabs.js";
61
68
  import { Text, TextProps, textVariants } from "./components/text.js";
62
69
  import { Textarea, TextareaProps } from "./components/textarea.js";
@@ -76,4 +83,4 @@ import { UseLocalStorageOptions, useLocalStorage } from "./hooks/use-local-stora
76
83
  import { useIsMobile } from "./hooks/use-mobile.js";
77
84
  import { ButtonColor, buttonColorVariants } from "./lib/button.js";
78
85
  import { cn, randomId } from "./lib/utils.js";
79
- export { Accordion, AccordionContent, AccordionContentProps, AccordionItem, AccordionItemProps, AccordionProps, AccordionTrigger, AccordionTriggerProps, Alert, AlertAction, AlertActionProps, AlertDescription, AlertDescriptionProps, AlertDialog, AlertDialogAction, AlertDialogActionProps, AlertDialogCancel, AlertDialogCancelProps, AlertDialogContent, AlertDialogContentProps, AlertDialogDescription, AlertDialogDescriptionProps, AlertDialogFooter, AlertDialogFooterProps, AlertDialogHeader, AlertDialogHeaderProps, AlertDialogMedia, AlertDialogMediaProps, AlertDialogOverlay, AlertDialogOverlayProps, AlertDialogPortal, AlertDialogPortalProps, AlertDialogProps, AlertDialogTitle, AlertDialogTitleProps, AlertDialogTrigger, AlertDialogTriggerProps, AlertProps, AlertTitle, AlertTitleProps, Anchor, AnchorProps, Avatar, AvatarBadge, AvatarBadgeProps, AvatarFallback, AvatarFallbackProps, AvatarGroup, AvatarGroupCount, AvatarGroupCountProps, AvatarGroupProps, AvatarImage, AvatarImageProps, AvatarProps, Badge, BadgeProps, Bar, BarChart, Breadcrumb, BreadcrumbEllipsis, BreadcrumbEllipsisProps, BreadcrumbItem, BreadcrumbItemProps, BreadcrumbLink, BreadcrumbLinkProps, BreadcrumbList, BreadcrumbListProps, BreadcrumbPage, BreadcrumbPageProps, BreadcrumbProps, BreadcrumbSeparator, BreadcrumbSeparatorProps, Breakpoint, Button, ButtonColor, ButtonGroup, ButtonGroupProps, ButtonGroupSeparator, ButtonGroupSeparatorProps, ButtonGroupText, ButtonGroupTextProps, ButtonProps, Calendar, CalendarDayButton, CalendarDayButtonProps, CalendarProps, Card, CardAction, CardActionProps, CardContent, CardContentProps, CardDescription, CardDescriptionProps, CardFooter, CardFooterProps, CardHeader, CardHeaderProps, CardProps, CardTitle, CardTitleProps, Carousel, CarouselApi, CarouselContent, CarouselContentProps, CarouselIndicators, CarouselIndicatorsProps, CarouselItem, CarouselItemProps, CarouselNext, CarouselNextProps, CarouselPrevious, CarouselPreviousProps, CarouselProps, CartesianGrid, Center, CenterProps, ChartConfig, ChartContainer, ChartContainerProps, ChartLegend, ChartLegendContent, ChartLegendContentProps, ChartLegendProps, ChartStyle, ChartStyleProps, ChartTooltip, ChartTooltipContent, ChartTooltipContentProps, ChartTooltipProps, Checkbox, CheckboxProps, Code, CodeProps, Collapsible, CollapsibleContent, CollapsibleContentProps, CollapsibleProps, CollapsibleTrigger, CollapsibleTriggerProps, Combobox, ComboboxChip, ComboboxChipProps, ComboboxChips, ComboboxChipsInput, ComboboxChipsInputProps, ComboboxChipsProps, ComboboxClear, ComboboxClearProps, ComboboxCollection, ComboboxCollectionProps, ComboboxContent, ComboboxContentProps, ComboboxEmpty, ComboboxEmptyProps, ComboboxGroup, ComboboxGroupProps, ComboboxInput, ComboboxInputProps, ComboboxItem, ComboboxItemProps, ComboboxLabel, ComboboxLabelProps, ComboboxList, ComboboxListProps, ComboboxProps, ComboboxSeparator, ComboboxSeparatorProps, ComboboxTrigger, ComboboxTriggerProps, ComboboxValue, ComboboxValueProps, Command, CommandDialog, CommandDialogProps, CommandEmpty, CommandEmptyProps, CommandGroup, CommandGroupProps, CommandInput, CommandInputProps, CommandItem, CommandItemProps, CommandList, CommandListProps, CommandProps, CommandSeparator, CommandSeparatorProps, CommandShortcut, CommandShortcutProps, Container, ContainerProps, DateRange, DateRangePicker, DateRangePickerActions, DateRangePickerActionsProps, DateRangePickerApply, DateRangePickerApplyProps, DateRangePickerCalendar, DateRangePickerCalendarProps, DateRangePickerContent, DateRangePickerContentProps, DateRangePickerDateFields, DateRangePickerDateFieldsProps, DateRangePickerPreset, DateRangePickerPresetOption, DateRangePickerPresetProps, DateRangePickerPresets, DateRangePickerPresetsProps, DateRangePickerProps, DateRangePickerReset, DateRangePickerResetProps, DateRangePickerTrigger, DateRangePickerTriggerProps, DateRangePickerValue, DateRangePickerValueProps, Dialog, DialogClose, DialogCloseProps, DialogContent, DialogContentProps, DialogDescription, DialogDescriptionProps, DialogFooter, DialogFooterProps, DialogHeader, DialogHeaderProps, DialogOverlay, DialogOverlayProps, DialogPortal, DialogPortalProps, DialogProps, DialogTitle, DialogTitleProps, DialogTrigger, DialogTriggerProps, Drawer, DrawerBody, DrawerBodyProps, DrawerClose, DrawerCloseProps, DrawerContent, DrawerContentProps, DrawerDescription, DrawerDescriptionProps, DrawerFooter, DrawerFooterProps, DrawerHeader, DrawerHeaderProps, DrawerOverlay, DrawerOverlayProps, DrawerPortal, DrawerPortalProps, DrawerProps, DrawerTitle, DrawerTitleProps, DrawerTrigger, DrawerTriggerProps, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuCheckboxItemProps, DropdownMenuContent, DropdownMenuContentProps, DropdownMenuGroup, DropdownMenuGroupProps, DropdownMenuItem, DropdownMenuItemProps, DropdownMenuLabel, DropdownMenuLabelProps, DropdownMenuPortal, DropdownMenuPortalProps, DropdownMenuProps, DropdownMenuRadioGroup, DropdownMenuRadioGroupProps, DropdownMenuRadioItem, DropdownMenuRadioItemProps, DropdownMenuSeparator, DropdownMenuSeparatorProps, DropdownMenuShortcut, DropdownMenuShortcutProps, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubContentProps, DropdownMenuSubProps, DropdownMenuSubTrigger, DropdownMenuSubTriggerProps, DropdownMenuTrigger, DropdownMenuTriggerProps, Dropzone, DropzoneArea, DropzoneAreaProps, DropzoneDescription, DropzoneDescriptionProps, DropzoneFileList, DropzoneFileListItem, DropzoneFileListItemProps, DropzoneFileListProps, DropzoneFileMessage, DropzoneFileMessageProps, DropzoneFileStatus, DropzoneMessage, DropzoneMessageProps, DropzoneProps, DropzoneRemoveFile, DropzoneRemoveFileProps, DropzoneRetryFile, DropzoneRetryFileProps, DropzoneTrigger, DropzoneTriggerProps, DropzoneUploadResult, DropzoneValidation, Empty, EmptyContent, EmptyContentProps, EmptyDescription, EmptyDescriptionProps, EmptyHeader, EmptyHeaderProps, EmptyMedia, EmptyMediaProps, EmptyProps, EmptyTitle, EmptyTitleProps, ErrorCode, Field, FieldContent, FieldContentProps, FieldDescription, FieldDescriptionProps, FieldError, FieldErrorProps, FieldGroup, FieldGroupProps, FieldLabel, FieldLabelProps, FieldLegend, FieldLegendProps, FieldProps, FieldSeparator, FieldSeparatorProps, FieldSet, FieldSetProps, FieldTitle, FieldTitleProps, FileError, FileStatus, Flex, FlexProps, Grid, GridItem, GridItemProps, GridProps, Group, GroupProps, Heading, HeadingProps, HiddenFrom, HiddenFromProps, HoverCard, HoverCardContent, HoverCardContentProps, HoverCardProps, HoverCardTrigger, HoverCardTriggerProps, InfiniteProgress, InfiniteProgressProps, Input, InputGroup, InputGroupAddon, InputGroupAddonProps, InputGroupButton, InputGroupButtonProps, InputGroupInput, InputGroupInputProps, InputGroupProps, InputGroupText, InputGroupTextProps, InputGroupTextarea, InputGroupTextareaProps, InputOTP, InputOTPGroup, InputOTPGroupProps, InputOTPProps, InputOTPSeparator, InputOTPSeparatorProps, InputOTPSlot, InputOTPSlotProps, InputProps, Kbd, KbdGroup, KbdGroupProps, KbdProps, Label, LabelProps, List, ListIcon, ListIconProps, ListItem, ListItemProps, ListProps, ModeToggle, ModeToggleProps, NativeSelect, NativeSelectOptGroup, NativeSelectOptGroupProps, NativeSelectOption, NativeSelectOptionProps, NativeSelectProps, NavigationMenu, NavigationMenuContent, NavigationMenuContentProps, NavigationMenuIndicator, NavigationMenuIndicatorProps, NavigationMenuItem, NavigationMenuItemProps, NavigationMenuLink, NavigationMenuLinkProps, NavigationMenuList, NavigationMenuListProps, NavigationMenuProps, NavigationMenuTrigger, NavigationMenuTriggerProps, NavigationMenuViewport, NavigationMenuViewportProps, Pagination, PaginationContent, PaginationContentProps, PaginationEllipsis, PaginationEllipsisProps, PaginationItem, PaginationItemProps, PaginationLink, PaginationLinkProps, PaginationNext, PaginationNextProps, PaginationPrevious, PaginationPreviousProps, PaginationProps, Popover, PopoverAnchor, PopoverAnchorProps, PopoverContent, PopoverContentProps, PopoverDescription, PopoverDescriptionProps, PopoverHeader, PopoverHeaderProps, PopoverProps, PopoverTitle, PopoverTitleProps, PopoverTrigger, PopoverTriggerProps, Progress, ProgressProps, REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS, RadioGroup, RadioGroupItem, RadioGroupItemProps, RadioGroupProps, ResizableHandle, ResizableHandleProps, ResizablePanel, ResizablePanelGroup, ResizablePanelGroupProps, ResizablePanelProps, ResponsiveValueMap, ScrollArea, ScrollAreaProps, ScrollBar, ScrollBarProps, Select, SelectContent, SelectContentProps, SelectGroup, SelectGroupProps, SelectItem, SelectItemProps, SelectLabel, SelectLabelProps, SelectProps, SelectScrollDownButton, SelectScrollDownButtonProps, SelectScrollUpButton, SelectScrollUpButtonProps, SelectSeparator, SelectSeparatorProps, SelectTrigger, SelectTriggerProps, SelectValue, SelectValueProps, Separator, SeparatorProps, Sidebar, SidebarContent, SidebarContentProps, SidebarFooter, SidebarFooterProps, SidebarGroup, SidebarGroupAction, SidebarGroupActionProps, SidebarGroupContent, SidebarGroupContentProps, SidebarGroupLabel, SidebarGroupLabelProps, SidebarGroupProps, SidebarHeader, SidebarHeaderProps, SidebarInput, SidebarInputProps, SidebarInset, SidebarInsetProps, SidebarMenu, SidebarMenuAction, SidebarMenuActionProps, SidebarMenuBadge, SidebarMenuBadgeProps, SidebarMenuButton, SidebarMenuButtonProps, SidebarMenuItem, SidebarMenuItemProps, SidebarMenuProps, SidebarMenuSkeleton, SidebarMenuSkeletonProps, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubButtonProps, SidebarMenuSubItem, SidebarMenuSubItemProps, SidebarMenuSubProps, SidebarProps, SidebarProvider, SidebarProviderProps, SidebarRail, SidebarRailProps, SidebarSeparator, SidebarSeparatorProps, SidebarTrigger, SidebarTriggerProps, SimpleGrid, SimpleGridProps, Skeleton, SkeletonProps, Slider, SliderProps, Spinner, SpinnerProps, Stack, StackProps, Switch, SwitchProps, Table, TableBody, TableBodyProps, TableCaption, TableCaptionProps, TableCell, TableCellProps, TableFooter, TableFooterProps, TableHead, TableHeadProps, TableHeader, TableHeaderProps, TableProps, TableRow, TableRowProps, Tabs, TabsContent, TabsContentProps, TabsList, TabsListProps, TabsProps, TabsTrigger, TabsTriggerProps, Text, TextProps, Textarea, TextareaProps, Theme, ThemeProvider, ThemeProviderProps, ThemeProviderState, Timeline, TimelineConnector, TimelineConnectorColor, TimelineConnectorProps, TimelineContent, TimelineContentProps, TimelineDescription, TimelineDescriptionProps, TimelineEmpty, TimelineEmptyProps, TimelineHeader, TimelineHeaderProps, TimelineIcon, TimelineIconColor, TimelineIconProps, TimelineIconSize, TimelineItem, TimelineItemProps, TimelineProps, TimelineStatus, TimelineTime, TimelineTimeProps, TimelineTitle, TimelineTitleProps, Toaster, ToasterProps, Toggle, ToggleGroup, ToggleGroupItem, ToggleGroupItemProps, ToggleGroupProps, ToggleProps, Tooltip, TooltipContent, TooltipContentProps, TooltipProps, TooltipProvider, TooltipProviderProps, TooltipRoot, TooltipRootProps, TooltipTrigger, TooltipTriggerProps, UIColor, UnstyledButton, UnstyledButtonProps, UseDisclosureHandlers, UseDisclosureOptions, UseDisclosureReturnValue, UseDropzoneProps, UseDropzoneReturn, UseIdleOptions, UseIntervalOptions, UseIntervalReturnValue, UseLocalStorageOptions, VisibleFrom, VisibleFromProps, XAxis, anchorVariants, badgeVariants, breakpointValues, buttonColorVariants, buttonGroupVariants, buttonVariants, centerVariants, cn, containerVariants, flexVariants, groupVariants, headingVariants, listVariants, locale, navigationMenuTriggerStyle, randomId, selectionControlColorVariants, spinnerVariants, stackVariants, tabsListVariants, textVariants, timelineVariants, toast, toggleVariants, uiColors, useBreakpoint, useBreakpointValue, useCarousel, useComboboxAnchor, useDisclosure, useDocumentVisibility, useDropzone, useFieldControlId, useIdle, useInterval, useIsMobile, useLocalStorage, useSidebar, useTheme };
86
+ export { Accordion, AccordionContent, AccordionContentProps, AccordionItem, AccordionItemProps, AccordionProps, AccordionTrigger, AccordionTriggerProps, Alert, AlertAction, AlertActionProps, AlertDescription, AlertDescriptionProps, AlertDialog, AlertDialogAction, AlertDialogActionProps, AlertDialogCancel, AlertDialogCancelProps, AlertDialogContent, AlertDialogContentProps, AlertDialogDescription, AlertDialogDescriptionProps, AlertDialogFooter, AlertDialogFooterProps, AlertDialogHeader, AlertDialogHeaderProps, AlertDialogMedia, AlertDialogMediaProps, AlertDialogOverlay, AlertDialogOverlayProps, AlertDialogPortal, AlertDialogPortalProps, AlertDialogProps, AlertDialogTitle, AlertDialogTitleProps, AlertDialogTrigger, AlertDialogTriggerProps, AlertProps, AlertTitle, AlertTitleProps, Anchor, AnchorProps, AreaChart, AreaChartCurveType, AreaChartGridAxis, AreaChartProps, AreaChartSeries, AreaChartType, Avatar, AvatarBadge, AvatarBadgeProps, AvatarFallback, AvatarFallbackProps, AvatarGroup, AvatarGroupCount, AvatarGroupCountProps, AvatarGroupProps, AvatarImage, AvatarImageProps, AvatarProps, Badge, BadgeProps, BarChart, BarChartGridAxis, BarChartOrientation, BarChartProps, BarChartSeries, BarChartType, Breadcrumb, BreadcrumbEllipsis, BreadcrumbEllipsisProps, BreadcrumbItem, BreadcrumbItemProps, BreadcrumbLink, BreadcrumbLinkProps, BreadcrumbList, BreadcrumbListProps, BreadcrumbPage, BreadcrumbPageProps, BreadcrumbProps, BreadcrumbSeparator, BreadcrumbSeparatorProps, Breakpoint, Button, ButtonColor, ButtonGroup, ButtonGroupProps, ButtonGroupSeparator, ButtonGroupSeparatorProps, ButtonGroupText, ButtonGroupTextProps, ButtonProps, Calendar, CalendarDayButton, CalendarDayButtonProps, CalendarProps, Card, CardAction, CardActionProps, CardContent, CardContentProps, CardDescription, CardDescriptionProps, CardFooter, CardFooterProps, CardHeader, CardHeaderProps, CardProps, CardTitle, CardTitleProps, Carousel, CarouselApi, CarouselContent, CarouselContentProps, CarouselIndicators, CarouselIndicatorsProps, CarouselItem, CarouselItemProps, CarouselNext, CarouselNextProps, CarouselPrevious, CarouselPreviousProps, CarouselProps, Center, CenterProps, ChartConfig, ChartContainer, ChartContainerProps, ChartLegend, ChartLegendContent, ChartLegendContentProps, ChartLegendProps, ChartStyle, ChartStyleProps, ChartTooltip, ChartTooltipContent, ChartTooltipContentProps, ChartTooltipProps, Checkbox, CheckboxProps, Code, CodeProps, Collapsible, CollapsibleContent, CollapsibleContentProps, CollapsibleProps, CollapsibleTrigger, CollapsibleTriggerProps, type Column, type ColumnDef, Combobox, ComboboxChip, ComboboxChipProps, ComboboxChips, ComboboxChipsInput, ComboboxChipsInputProps, ComboboxChipsProps, ComboboxClear, ComboboxClearProps, ComboboxCollection, ComboboxCollectionProps, ComboboxContent, ComboboxContentProps, ComboboxEmpty, ComboboxEmptyProps, ComboboxGroup, ComboboxGroupProps, ComboboxInput, ComboboxInputProps, ComboboxItem, ComboboxItemProps, ComboboxLabel, ComboboxLabelProps, ComboboxList, ComboboxListProps, ComboboxProps, ComboboxSeparator, ComboboxSeparatorProps, ComboboxTrigger, ComboboxTriggerProps, ComboboxValue, ComboboxValueProps, Command, CommandDialog, CommandDialogProps, CommandEmpty, CommandEmptyProps, CommandGroup, CommandGroupProps, CommandInput, CommandInputProps, CommandItem, CommandItemProps, CommandList, CommandListProps, CommandProps, CommandSeparator, CommandSeparatorProps, CommandShortcut, CommandShortcutProps, Container, ContainerProps, DataTable, DataTableBody, DataTableBodyProps, DataTableColumnHeader, DataTableColumnHeaderProps, DataTableHeader, DataTableHeaderProps, DataTableLabels, DataTablePagination, DataTablePaginationProps, DataTableProps, DataTableRoot, DataTableRootProps, DataTableToolbar, DataTableToolbarProps, DataTableViewOptions, DataTableViewOptionsProps, type DateRange, DateRangePicker, DateRangePickerActions, DateRangePickerActionsProps, DateRangePickerApply, DateRangePickerApplyProps, DateRangePickerCalendar, DateRangePickerCalendarProps, DateRangePickerContent, DateRangePickerContentProps, DateRangePickerDateFields, DateRangePickerDateFieldsProps, DateRangePickerPreset, DateRangePickerPresetOption, DateRangePickerPresetProps, DateRangePickerPresets, DateRangePickerPresetsProps, DateRangePickerProps, DateRangePickerReset, DateRangePickerResetProps, DateRangePickerTrigger, DateRangePickerTriggerProps, DateRangePickerValue, DateRangePickerValueProps, Dialog, DialogClose, DialogCloseProps, DialogContent, DialogContentProps, DialogDescription, DialogDescriptionProps, DialogFooter, DialogFooterProps, DialogHeader, DialogHeaderProps, DialogOverlay, DialogOverlayProps, DialogPortal, DialogPortalProps, DialogProps, DialogTitle, DialogTitleProps, DialogTrigger, DialogTriggerProps, DonutChart, DonutChartProps, Drawer, DrawerBody, DrawerBodyProps, DrawerClose, DrawerCloseProps, DrawerContent, DrawerContentProps, DrawerDescription, DrawerDescriptionProps, DrawerFooter, DrawerFooterProps, DrawerHeader, DrawerHeaderProps, DrawerOverlay, DrawerOverlayProps, DrawerPortal, DrawerPortalProps, DrawerProps, DrawerTitle, DrawerTitleProps, DrawerTrigger, DrawerTriggerProps, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuCheckboxItemProps, DropdownMenuContent, DropdownMenuContentProps, DropdownMenuGroup, DropdownMenuGroupProps, DropdownMenuItem, DropdownMenuItemProps, DropdownMenuLabel, DropdownMenuLabelProps, DropdownMenuPortal, DropdownMenuPortalProps, DropdownMenuProps, DropdownMenuRadioGroup, DropdownMenuRadioGroupProps, DropdownMenuRadioItem, DropdownMenuRadioItemProps, DropdownMenuSeparator, DropdownMenuSeparatorProps, DropdownMenuShortcut, DropdownMenuShortcutProps, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubContentProps, DropdownMenuSubProps, DropdownMenuSubTrigger, DropdownMenuSubTriggerProps, DropdownMenuTrigger, DropdownMenuTriggerProps, Dropzone, DropzoneArea, DropzoneAreaProps, DropzoneDescription, DropzoneDescriptionProps, DropzoneFileList, DropzoneFileListItem, DropzoneFileListItemProps, DropzoneFileListProps, DropzoneFileMessage, DropzoneFileMessageProps, DropzoneFileStatus, DropzoneMessage, DropzoneMessageProps, DropzoneProps, DropzoneRemoveFile, DropzoneRemoveFileProps, DropzoneRetryFile, DropzoneRetryFileProps, DropzoneTrigger, DropzoneTriggerProps, DropzoneUploadResult, DropzoneValidation, Empty, EmptyContent, EmptyContentProps, EmptyDescription, EmptyDescriptionProps, EmptyHeader, EmptyHeaderProps, EmptyMedia, EmptyMediaProps, EmptyProps, EmptyTitle, EmptyTitleProps, ErrorCode, Field, FieldContent, FieldContentProps, FieldDescription, FieldDescriptionProps, FieldError, FieldErrorProps, FieldGroup, FieldGroupProps, FieldLabel, FieldLabelProps, FieldLegend, FieldLegendProps, FieldProps, FieldSeparator, FieldSeparatorProps, FieldSet, FieldSetProps, FieldTitle, FieldTitleProps, type FileError, FileStatus, Flex, FlexProps, Grid, GridItem, GridItemProps, GridProps, Group, GroupProps, Heading, HeadingProps, HiddenFrom, HiddenFromProps, HoverCard, HoverCardContent, HoverCardContentProps, HoverCardProps, HoverCardTrigger, HoverCardTriggerProps, InfiniteProgress, InfiniteProgressProps, Input, InputGroup, InputGroupAddon, InputGroupAddonProps, InputGroupButton, InputGroupButtonProps, InputGroupInput, InputGroupInputProps, InputGroupProps, InputGroupText, InputGroupTextProps, InputGroupTextarea, InputGroupTextareaProps, InputOTP, InputOTPGroup, InputOTPGroupProps, InputOTPProps, InputOTPSeparator, InputOTPSeparatorProps, InputOTPSlot, InputOTPSlotProps, InputProps, Kbd, KbdGroup, KbdGroupProps, KbdProps, Label, LabelProps, List, ListIcon, ListIconProps, ListItem, ListItemProps, ListProps, MaskInput, MaskInputProps, type MaskOptions, ModeToggle, ModeToggleProps, type ModifiedData, type Modify, NativeSelect, NativeSelectOptGroup, NativeSelectOptGroupProps, NativeSelectOption, NativeSelectOptionProps, NativeSelectProps, NavigationMenu, NavigationMenuContent, NavigationMenuContentProps, NavigationMenuIndicator, NavigationMenuIndicatorProps, NavigationMenuItem, NavigationMenuItemProps, NavigationMenuLink, NavigationMenuLinkProps, NavigationMenuList, NavigationMenuListProps, NavigationMenuProps, NavigationMenuTrigger, NavigationMenuTriggerProps, NavigationMenuViewport, NavigationMenuViewportProps, Pagination, PaginationContent, PaginationContentProps, PaginationEllipsis, PaginationEllipsisProps, PaginationItem, PaginationItemProps, PaginationLink, PaginationLinkProps, PaginationNext, PaginationNextProps, PaginationPrevious, PaginationPreviousProps, PaginationProps, PieChart, PieChartBase, PieChartBaseProps, PieChartDatum, PieChartProps, Popover, PopoverAnchor, PopoverAnchorProps, PopoverContent, PopoverContentProps, PopoverDescription, PopoverDescriptionProps, PopoverHeader, PopoverHeaderProps, PopoverProps, PopoverTitle, PopoverTitleProps, PopoverTrigger, PopoverTriggerProps, Progress, ProgressProps, REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS, RadioGroup, RadioGroupItem, RadioGroupItemProps, RadioGroupProps, type Replacement, ResizableHandle, ResizableHandleProps, ResizablePanel, ResizablePanelGroup, ResizablePanelGroupProps, ResizablePanelProps, ResponsiveValueMap, type RowData, ScrollArea, ScrollAreaProps, ScrollBar, ScrollBarProps, Select, SelectContent, SelectContentProps, SelectGroup, SelectGroupProps, SelectItem, SelectItemProps, SelectLabel, SelectLabelProps, SelectProps, SelectScrollDownButton, SelectScrollDownButtonProps, SelectScrollUpButton, SelectScrollUpButtonProps, SelectSeparator, SelectSeparatorProps, SelectTrigger, SelectTriggerProps, SelectValue, SelectValueProps, Separator, SeparatorProps, Sidebar, SidebarContent, SidebarContentProps, SidebarFooter, SidebarFooterProps, SidebarGroup, SidebarGroupAction, SidebarGroupActionProps, SidebarGroupContent, SidebarGroupContentProps, SidebarGroupLabel, SidebarGroupLabelProps, SidebarGroupProps, SidebarHeader, SidebarHeaderProps, SidebarInput, SidebarInputProps, SidebarInset, SidebarInsetProps, SidebarMenu, SidebarMenuAction, SidebarMenuActionProps, SidebarMenuBadge, SidebarMenuBadgeProps, SidebarMenuButton, SidebarMenuButtonProps, SidebarMenuItem, SidebarMenuItemProps, SidebarMenuProps, SidebarMenuSkeleton, SidebarMenuSkeletonProps, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubButtonProps, SidebarMenuSubItem, SidebarMenuSubItemProps, SidebarMenuSubProps, SidebarProps, SidebarProvider, SidebarProviderProps, SidebarRail, SidebarRailProps, SidebarSeparator, SidebarSeparatorProps, SidebarTrigger, SidebarTriggerProps, SimpleGrid, SimpleGridProps, Skeleton, SkeletonProps, Slider, SliderProps, Spinner, SpinnerProps, Stack, StackProps, Switch, SwitchProps, Table, TableBody, TableBodyProps, TableCaption, TableCaptionProps, TableCell, TableCellProps, TableContainer, TableContainerProps, TableFooter, TableFooterProps, TableHead, TableHeadProps, TableHeader, TableHeaderProps, TableProps, TableRow, TableRowProps, Tabs, TabsContent, TabsContentProps, TabsList, TabsListProps, TabsProps, TabsTrigger, TabsTriggerProps, type TanStackTable, Text, TextProps, Textarea, TextareaProps, Theme, ThemeProvider, ThemeProviderProps, ThemeProviderState, Timeline, TimelineConnector, TimelineConnectorColor, TimelineConnectorProps, TimelineContent, TimelineContentProps, TimelineDescription, TimelineDescriptionProps, TimelineEmpty, TimelineEmptyProps, TimelineHeader, TimelineHeaderProps, TimelineIcon, TimelineIconColor, TimelineIconProps, TimelineIconSize, TimelineItem, TimelineItemProps, TimelineProps, TimelineStatus, TimelineTime, TimelineTimeProps, TimelineTitle, TimelineTitleProps, Toaster, ToasterProps, Toggle, ToggleGroup, ToggleGroupItem, ToggleGroupItemProps, ToggleGroupProps, ToggleProps, Tooltip, TooltipContent, TooltipContentProps, TooltipProps, TooltipProvider, TooltipProviderProps, TooltipRoot, TooltipRootProps, TooltipTrigger, TooltipTriggerProps, type Track, type TrackingData, UIColor, UnstyledButton, UnstyledButtonProps, UseDataTableOptions, UseDisclosureHandlers, UseDisclosureOptions, UseDisclosureReturnValue, UseDropzoneProps, UseDropzoneReturn, UseIdleOptions, UseIntervalOptions, UseIntervalReturnValue, UseLocalStorageOptions, UseMaskOptions, VisibleFrom, VisibleFromProps, anchorVariants, badgeVariants, breakpointValues, buildPieConfig, buttonColorVariants, buttonGroupVariants, buttonVariants, centerVariants, cn, containerVariants, createDataTableSelectColumn, defaultDataTableLabels, flexVariants, groupVariants, headingVariants, listVariants, locale, navigationMenuTriggerStyle, randomId, selectionControlColorVariants, spinnerVariants, stackVariants, tableVariants, tabsListVariants, textVariants, timelineVariants, toast, toggleVariants, uiColors, useBreakpoint, useBreakpointValue, useCarousel, useComboboxAnchor, useDataTable, useDataTableContext, useDisclosure, useDocumentVisibility, useDropzone, useFieldControlId, useIdle, useInterval, useIsMobile, useLocalStorage, useMask, useSidebar, useTheme };