@uselets/ui 1.20.4 → 2.0.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 (252) hide show
  1. package/README.md +309 -426
  2. package/dist/as-child-Dxg3Xo1G.d.ts +41 -0
  3. package/dist/cli/uselets.mjs +5 -4
  4. package/dist/cli/uselets.mjs.map +1 -1
  5. package/dist/components/accordion.d.ts +12 -8
  6. package/dist/components/accordion.js +1 -1
  7. package/dist/components/accordion.js.map +1 -1
  8. package/dist/components/alert-dialog.d.ts +20 -15
  9. package/dist/components/alert-dialog.js +1 -1
  10. package/dist/components/alert-dialog.js.map +1 -1
  11. package/dist/components/alert.d.ts +1 -1
  12. package/dist/components/anchor.d.ts +3 -5
  13. package/dist/components/anchor.js +1 -1
  14. package/dist/components/anchor.js.map +1 -1
  15. package/dist/components/area-chart.d.ts +54 -0
  16. package/dist/components/area-chart.js +1 -1
  17. package/dist/components/area-chart.js.map +1 -1
  18. package/dist/components/avatar.d.ts +12 -7
  19. package/dist/components/avatar.js +1 -1
  20. package/dist/components/avatar.js.map +1 -1
  21. package/dist/components/badge.d.ts +3 -5
  22. package/dist/components/badge.js +1 -1
  23. package/dist/components/badge.js.map +1 -1
  24. package/dist/components/bar-chart.d.ts +48 -0
  25. package/dist/components/bar-chart.js +1 -1
  26. package/dist/components/bar-chart.js.map +1 -1
  27. package/dist/components/bottom-nav.d.ts +7 -3
  28. package/dist/components/bottom-nav.js +1 -1
  29. package/dist/components/bottom-nav.js.map +1 -1
  30. package/dist/components/breadcrumb.d.ts +3 -4
  31. package/dist/components/breadcrumb.js +1 -1
  32. package/dist/components/breadcrumb.js.map +1 -1
  33. package/dist/components/button-group.d.ts +3 -4
  34. package/dist/components/button-group.js +1 -1
  35. package/dist/components/button-group.js.map +1 -1
  36. package/dist/components/button.d.ts +8 -4
  37. package/dist/components/button.js +1 -1
  38. package/dist/components/button.js.map +1 -1
  39. package/dist/components/calendar.d.ts +4 -0
  40. package/dist/components/calendar.js +1 -1
  41. package/dist/components/calendar.js.map +1 -1
  42. package/dist/components/card.d.ts +4 -0
  43. package/dist/components/card.js.map +1 -1
  44. package/dist/components/carousel.d.ts +11 -3
  45. package/dist/components/carousel.js +1 -1
  46. package/dist/components/carousel.js.map +1 -1
  47. package/dist/components/center.d.ts +1 -1
  48. package/dist/components/chart.js +4 -4
  49. package/dist/components/checkbox.d.ts +14 -4
  50. package/dist/components/checkbox.js +1 -1
  51. package/dist/components/checkbox.js.map +1 -1
  52. package/dist/components/collapsible.d.ts +8 -7
  53. package/dist/components/collapsible.js +1 -1
  54. package/dist/components/collapsible.js.map +1 -1
  55. package/dist/components/combobox.d.ts +48 -26
  56. package/dist/components/combobox.js +1 -1
  57. package/dist/components/combobox.js.map +1 -1
  58. package/dist/components/command.d.ts +16 -2
  59. package/dist/components/command.js +1 -1
  60. package/dist/components/command.js.map +1 -1
  61. package/dist/components/container.d.ts +1 -1
  62. package/dist/components/data-table.d.ts +39 -0
  63. package/dist/components/data-table.js +1 -1
  64. package/dist/components/data-table.js.map +1 -1
  65. package/dist/components/date-range-picker.d.ts +24 -2
  66. package/dist/components/date-range-picker.js +1 -1
  67. package/dist/components/date-range-picker.js.map +1 -1
  68. package/dist/components/dialog.d.ts +33 -15
  69. package/dist/components/dialog.js +1 -1
  70. package/dist/components/dialog.js.map +1 -1
  71. package/dist/components/direction.d.ts +7 -0
  72. package/dist/components/direction.js +1 -0
  73. package/dist/components/donut-chart.d.ts +12 -0
  74. package/dist/components/donut-chart.js +1 -1
  75. package/dist/components/donut-chart.js.map +1 -1
  76. package/dist/components/drawer.d.ts +33 -15
  77. package/dist/components/drawer.js +1 -1
  78. package/dist/components/drawer.js.map +1 -1
  79. package/dist/components/dropdown-menu.d.ts +36 -26
  80. package/dist/components/dropdown-menu.js +1 -1
  81. package/dist/components/dropdown-menu.js.map +1 -1
  82. package/dist/components/dropzone.d.ts +19 -0
  83. package/dist/components/dropzone.js +1 -1
  84. package/dist/components/dropzone.js.map +1 -1
  85. package/dist/components/field.d.ts +16 -4
  86. package/dist/components/field.js +1 -1
  87. package/dist/components/field.js.map +1 -1
  88. package/dist/components/flex.d.ts +1 -1
  89. package/dist/components/grid.d.ts +13 -0
  90. package/dist/components/grid.js.map +1 -1
  91. package/dist/components/group.d.ts +1 -1
  92. package/dist/components/heading.d.ts +3 -5
  93. package/dist/components/heading.js +1 -1
  94. package/dist/components/heading.js.map +1 -1
  95. package/dist/components/hover-card.d.ts +7 -6
  96. package/dist/components/hover-card.js +1 -1
  97. package/dist/components/hover-card.js.map +1 -1
  98. package/dist/components/input-group.d.ts +2 -2
  99. package/dist/components/input-group.js +1 -1
  100. package/dist/components/input-group.js.map +1 -1
  101. package/dist/components/input-otp.d.ts +4 -2
  102. package/dist/components/input-otp.js +1 -1
  103. package/dist/components/input-otp.js.map +1 -1
  104. package/dist/components/input.d.ts +1 -1
  105. package/dist/components/input.js +1 -1
  106. package/dist/components/input.js.map +1 -1
  107. package/dist/components/label.d.ts +3 -4
  108. package/dist/components/label.js +1 -1
  109. package/dist/components/label.js.map +1 -1
  110. package/dist/components/list.d.ts +8 -5
  111. package/dist/components/list.js +1 -1
  112. package/dist/components/list.js.map +1 -1
  113. package/dist/components/logo.d.ts +113 -0
  114. package/dist/components/marker.d.ts +4 -5
  115. package/dist/components/marker.js +1 -1
  116. package/dist/components/marker.js.map +1 -1
  117. package/dist/components/mask-input.d.ts +6 -0
  118. package/dist/components/mask-input.js.map +1 -1
  119. package/dist/components/native-select.d.ts +5 -1
  120. package/dist/components/native-select.js +1 -1
  121. package/dist/components/native-select.js.map +1 -1
  122. package/dist/components/navigation-menu.d.ts +19 -20
  123. package/dist/components/navigation-menu.js +1 -1
  124. package/dist/components/navigation-menu.js.map +1 -1
  125. package/dist/components/number-field.d.ts +18 -13
  126. package/dist/components/number-field.js +1 -1
  127. package/dist/components/number-field.js.map +1 -1
  128. package/dist/components/pagination.d.ts +9 -0
  129. package/dist/components/pagination.js +1 -1
  130. package/dist/components/pagination.js.map +1 -1
  131. package/dist/components/phone-input.d.ts +3 -0
  132. package/dist/components/phone-input.js +1 -1
  133. package/dist/components/phone-input.js.map +1 -1
  134. package/dist/components/pie-chart.d.ts +53 -0
  135. package/dist/components/pie-chart.js +1 -1
  136. package/dist/components/pie-chart.js.map +1 -1
  137. package/dist/components/popover.d.ts +13 -12
  138. package/dist/components/popover.js +1 -1
  139. package/dist/components/popover.js.map +1 -1
  140. package/dist/components/progress.d.ts +9 -3
  141. package/dist/components/progress.js +1 -1
  142. package/dist/components/progress.js.map +1 -1
  143. package/dist/components/radio-group.d.ts +20 -6
  144. package/dist/components/radio-group.js +1 -1
  145. package/dist/components/radio-group.js.map +1 -1
  146. package/dist/components/resizable.d.ts +1 -0
  147. package/dist/components/resizable.js.map +1 -1
  148. package/dist/components/ring-progress.d.ts +9 -1
  149. package/dist/components/ring-progress.js.map +1 -1
  150. package/dist/components/scroll-area.d.ts +3 -3
  151. package/dist/components/scroll-area.js +1 -1
  152. package/dist/components/scroll-area.js.map +1 -1
  153. package/dist/components/select.d.ts +25 -20
  154. package/dist/components/select.js +1 -1
  155. package/dist/components/select.js.map +1 -1
  156. package/dist/components/separator.d.ts +9 -4
  157. package/dist/components/separator.js +1 -1
  158. package/dist/components/separator.js.map +1 -1
  159. package/dist/components/sidebar.d.ts +63 -18
  160. package/dist/components/sidebar.js +1 -1
  161. package/dist/components/sidebar.js.map +1 -1
  162. package/dist/components/simple-grid.d.ts +7 -0
  163. package/dist/components/simple-grid.js +1 -1
  164. package/dist/components/simple-grid.js.map +1 -1
  165. package/dist/components/skeleton.d.ts +4 -0
  166. package/dist/components/skeleton.js.map +1 -1
  167. package/dist/components/slider.d.ts +2 -2
  168. package/dist/components/slider.js +1 -1
  169. package/dist/components/slider.js.map +1 -1
  170. package/dist/components/spinner.d.ts +1 -1
  171. package/dist/components/stack.d.ts +1 -1
  172. package/dist/components/stepper.d.ts +46 -25
  173. package/dist/components/stepper.js +1 -1
  174. package/dist/components/stepper.js.map +1 -1
  175. package/dist/components/switch.d.ts +17 -3
  176. package/dist/components/switch.js +1 -1
  177. package/dist/components/switch.js.map +1 -1
  178. package/dist/components/table.d.ts +10 -1
  179. package/dist/components/table.js +1 -1
  180. package/dist/components/table.js.map +1 -1
  181. package/dist/components/tabs.d.ts +14 -10
  182. package/dist/components/tabs.js +1 -1
  183. package/dist/components/tabs.js.map +1 -1
  184. package/dist/components/text.d.ts +3 -5
  185. package/dist/components/text.js +1 -1
  186. package/dist/components/text.js.map +1 -1
  187. package/dist/components/textarea.d.ts +1 -1
  188. package/dist/components/textarea.js +1 -1
  189. package/dist/components/textarea.js.map +1 -1
  190. package/dist/components/theme.d.ts +12 -0
  191. package/dist/components/theme.js +1 -1
  192. package/dist/components/theme.js.map +1 -1
  193. package/dist/components/timeline.d.ts +25 -1
  194. package/dist/components/timeline.js +1 -1
  195. package/dist/components/timeline.js.map +1 -1
  196. package/dist/components/toggle-group.d.ts +16 -6
  197. package/dist/components/toggle-group.js +1 -1
  198. package/dist/components/toggle-group.js.map +1 -1
  199. package/dist/components/toggle.d.ts +4 -4
  200. package/dist/components/toggle.js +1 -1
  201. package/dist/components/toggle.js.map +1 -1
  202. package/dist/components/tooltip.d.ts +15 -8
  203. package/dist/components/tooltip.js +1 -1
  204. package/dist/components/tooltip.js.map +1 -1
  205. package/dist/components/unstyled-button.d.ts +3 -5
  206. package/dist/components/unstyled-button.js +1 -1
  207. package/dist/components/unstyled-button.js.map +1 -1
  208. package/dist/components/visibility.d.ts +2 -0
  209. package/dist/components/visibility.js +1 -1
  210. package/dist/components/visibility.js.map +1 -1
  211. package/dist/hooks/use-breakpoint-value.d.ts +1 -0
  212. package/dist/hooks/use-breakpoint-value.js.map +1 -1
  213. package/dist/hooks/use-breakpoint.d.ts +1 -0
  214. package/dist/hooks/use-breakpoint.js.map +1 -1
  215. package/dist/hooks/use-disclosure.d.ts +3 -0
  216. package/dist/hooks/use-disclosure.js +1 -1
  217. package/dist/hooks/use-disclosure.js.map +1 -1
  218. package/dist/hooks/use-document-visibility.d.ts +1 -0
  219. package/dist/hooks/use-document-visibility.js.map +1 -1
  220. package/dist/hooks/use-hotkeys.d.ts +1 -1
  221. package/dist/hooks/use-idle.d.ts +9 -0
  222. package/dist/hooks/use-idle.js.map +1 -1
  223. package/dist/hooks/use-interval.d.ts +1 -0
  224. package/dist/hooks/use-interval.js.map +1 -1
  225. package/dist/hooks/use-local-storage.d.ts +6 -0
  226. package/dist/hooks/use-local-storage.js +1 -1
  227. package/dist/hooks/use-local-storage.js.map +1 -1
  228. package/dist/hooks/use-mask.d.ts +1 -0
  229. package/dist/hooks/use-mask.js.map +1 -1
  230. package/dist/hooks/use-mobile.d.ts +1 -0
  231. package/dist/hooks/use-mobile.js.map +1 -1
  232. package/dist/index.d.ts +7 -5
  233. package/dist/index.js +1 -1
  234. package/dist/lib/as-child.d.ts +2 -0
  235. package/dist/lib/as-child.js +2 -0
  236. package/dist/lib/as-child.js.map +1 -0
  237. package/dist/lib/utils.d.ts +1 -1
  238. package/dist/logo--R3_XDgA.js.map +1 -1
  239. package/dist/resolve-class-name-BurP8ngI.js +2 -0
  240. package/dist/resolve-class-name-BurP8ngI.js.map +1 -0
  241. package/dist/skills/uselets-ui/SKILL.md +8 -3
  242. package/dist/skills/uselets-ui/references/component-catalog.md +31 -16
  243. package/dist/skills/uselets-ui/references/migration-v1-to-v2.md +599 -0
  244. package/dist/skills/uselets-ui/references/package-guide.md +7 -7
  245. package/dist/styles/base.css +21 -0
  246. package/dist/{use-hotkeys-DOjcX9Tt.d.ts → use-hotkeys-D1_TEIwN.d.ts} +2 -1
  247. package/dist/use-hotkeys-YDJmGWX6.js.map +1 -1
  248. package/package.json +16 -17
  249. package/skills/uselets-ui/SKILL.md +8 -3
  250. package/skills/uselets-ui/references/component-catalog.md +31 -16
  251. package/skills/uselets-ui/references/migration-v1-to-v2.md +599 -0
  252. package/skills/uselets-ui/references/package-guide.md +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"native-select.js","names":["props","fieldControlId","useFieldControlId","id","cn","className","size","IconSelector"],"sources":["../../src/components/native-select.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { IconSelector } from '@tabler/icons-react'\n\nimport { cn } from '../lib/utils'\nimport { useFieldControlId } from './field'\n\nexport type NativeSelectProps = Omit<React.ComponentProps<'select'>, 'size'> & {\n size?: 'sm' | 'md'\n}\n\nexport type NativeSelectOptionProps = React.ComponentProps<'option'>\n\nexport type NativeSelectOptGroupProps = React.ComponentProps<'optgroup'>\n\nfunction NativeSelect({ className, id, size = 'md', ...props }: NativeSelectProps) {\n const fieldControlId = useFieldControlId(id)\n\n return (\n <div\n className={cn('group/native-select relative w-fit has-[select:disabled]:opacity-50', className)}\n data-slot=\"native-select-wrapper\"\n data-size={size}\n >\n <select\n id={fieldControlId}\n data-slot=\"native-select\"\n data-size={size}\n className={cn(\n 'border-input dark:bg-input/30 dark:hover:bg-input/50 h-8 w-full min-w-0 appearance-none rounded-lg border bg-transparent py-1 pr-8 pl-2.5 text-sm transition-colors select-none outline-none',\n 'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-3',\n 'aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-invalid:ring-3 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40',\n 'placeholder:text-placeholder selection:bg-primary selection:text-primary-foreground',\n 'data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5',\n 'disabled:pointer-events-none disabled:cursor-not-allowed'\n )}\n {...props}\n />\n <IconSelector\n className=\"text-muted-foreground top-1/2 right-2.5 size-4 -translate-y-1/2 pointer-events-none absolute select-none\"\n aria-hidden=\"true\"\n data-slot=\"native-select-icon\"\n />\n </div>\n )\n}\n\nfunction NativeSelectOption({ ...props }: NativeSelectOptionProps) {\n return <option data-slot=\"native-select-option\" {...props} />\n}\n\nfunction NativeSelectOptGroup({ className, ...props }: NativeSelectOptGroupProps) {\n return <optgroup data-slot=\"native-select-optgroup\" className={cn(className)} {...props} />\n}\n\nexport { NativeSelect, NativeSelectOptGroup, NativeSelectOption }\n"],"mappings":"iOAeA,SAAS,aAAa,CAAE,YAAW,KAAI,OAAO,KAAM,GAAGA,GAA4B,CACjF,IAAMC,EAAiBC,EAAkBC,CAAE,EAE3C,MACE,kBAAC,MAAD,CACE,UAAWC,EAAG,sEAAuEC,CAAS,EAC9F,YAAU,wBACV,YAAWC,EAHb,SAAA,CAKE,kBAAC,SAAD,CACE,GAAIL,EACJ,YAAU,gBACV,YAAWK,EACX,UAAWF,EACT,+LACA,4EACA,qKACA,sFACA,+FACA,0DACF,EACA,GAAIJ,CACL,CAAA,EACD,kBAACO,EAAD,CACE,UAAU,2GACV,cAAY,OACZ,YAAU,oBACX,CAAA,CACE,GAET,CAEA,SAAS,mBAAmB,CAAE,GAAGP,GAAkC,CACjE,MAAO,kBAAC,SAAD,CAAQ,YAAU,uBAAuB,GAAIA,CAAQ,CAAA,CAC9D,CAEA,SAAS,qBAAqB,CAAE,YAAW,GAAGA,GAAoC,CAChF,MAAO,kBAAC,WAAD,CAAU,YAAU,yBAAyB,UAAWI,EAAGC,CAAS,EAAG,GAAIL,CAAQ,CAAA,CAC5F"}
1
+ {"version":3,"file":"native-select.js","names":["ariaInvalid","props","fieldControlId","useFieldControlId","id","invalid","useFieldInvalid","cn","className","size","IconSelector"],"sources":["../../src/components/native-select.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { IconSelector } from '@tabler/icons-react'\n\nimport { cn } from '../lib/utils'\nimport { useFieldControlId, useFieldInvalid } from './field'\n\nexport type NativeSelectProps = Omit<React.ComponentProps<'select'>, 'size'> & {\n /**\n * Height of the select.\n * @default 'md'\n */\n size?: 'sm' | 'md'\n}\n\nexport type NativeSelectOptionProps = React.ComponentProps<'option'>\n\nexport type NativeSelectOptGroupProps = React.ComponentProps<'optgroup'>\n\nfunction NativeSelect({ className, id, size = 'md', 'aria-invalid': ariaInvalid, ...props }: NativeSelectProps) {\n const fieldControlId = useFieldControlId(id)\n const invalid = useFieldInvalid(ariaInvalid)\n\n return (\n <div\n className={cn('group/native-select relative w-fit has-[select:disabled]:opacity-50', className)}\n data-slot=\"native-select-wrapper\"\n data-size={size}\n >\n <select\n id={fieldControlId}\n aria-invalid={invalid}\n data-slot=\"native-select\"\n data-size={size}\n className={cn(\n 'border-input dark:bg-input/30 dark:hover:bg-input/50 h-8 w-full min-w-0 appearance-none rounded-lg border bg-transparent py-1 pr-8 pl-2.5 text-sm transition-colors select-none outline-none',\n 'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-3',\n 'aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-invalid:ring-3 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40',\n 'placeholder:text-placeholder selection:bg-primary selection:text-primary-foreground',\n 'data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5',\n 'disabled:pointer-events-none disabled:cursor-not-allowed'\n )}\n {...props}\n />\n <IconSelector\n className=\"text-muted-foreground top-1/2 right-2.5 size-4 -translate-y-1/2 pointer-events-none absolute select-none\"\n aria-hidden=\"true\"\n data-slot=\"native-select-icon\"\n />\n </div>\n )\n}\n\nfunction NativeSelectOption({ ...props }: NativeSelectOptionProps) {\n return <option data-slot=\"native-select-option\" {...props} />\n}\n\nfunction NativeSelectOptGroup({ className, ...props }: NativeSelectOptGroupProps) {\n return <optgroup data-slot=\"native-select-optgroup\" className={cn(className)} {...props} />\n}\n\nexport { NativeSelect, NativeSelectOptGroup, NativeSelectOption }\n"],"mappings":"sPAmBA,SAAS,aAAa,CAAE,YAAW,KAAI,OAAO,KAAM,eAAgBA,EAAa,GAAGC,GAA4B,CAC9G,IAAMC,EAAiBC,EAAkBC,CAAE,EACrCC,EAAUC,EAAgBN,CAAW,EAE3C,MACE,kBAAC,MAAD,CACE,UAAWO,EAAG,sEAAuEC,CAAS,EAC9F,YAAU,wBACV,YAAWC,EAHb,SAAA,CAKE,kBAAC,SAAD,CACE,GAAIP,EACJ,eAAcG,EACd,YAAU,gBACV,YAAWI,EACX,UAAWF,EACT,+LACA,4EACA,qKACA,sFACA,+FACA,0DACF,EACA,GAAIN,CACL,CAAA,EACD,kBAACS,EAAD,CACE,UAAU,2GACV,cAAY,OACZ,YAAU,oBACX,CAAA,CACE,GAET,CAEA,SAAS,mBAAmB,CAAE,GAAGT,GAAkC,CACjE,MAAO,kBAAC,SAAD,CAAQ,YAAU,uBAAuB,GAAIA,CAAQ,CAAA,CAC9D,CAEA,SAAS,qBAAqB,CAAE,YAAW,GAAGA,GAAoC,CAChF,MAAO,kBAAC,WAAD,CAAU,YAAU,yBAAyB,UAAWM,EAAGC,CAAS,EAAG,GAAIP,CAAQ,CAAA,CAC5F"}
@@ -1,26 +1,25 @@
1
1
  import { t as __name } from "../rolldown-runtime-BhWHdk3m.js";
2
- import { NavigationMenu as NavigationMenu$1 } from "radix-ui";
2
+ import { t as AsChildPrimitiveProps } from "../as-child-Dxg3Xo1G.js";
3
3
  import * as React from "react";
4
+ import { NavigationMenu as NavigationMenu$1 } from "@base-ui/react/navigation-menu";
4
5
  //#region src/components/navigation-menu.d.ts
5
- export type NavigationMenuProps = React.ComponentProps<typeof NavigationMenu$1.Root> & {
6
- viewport?: boolean;
7
- };
8
- export type NavigationMenuListProps = React.ComponentProps<typeof NavigationMenu$1.List>;
9
- export type NavigationMenuItemProps = React.ComponentProps<typeof NavigationMenu$1.Item>;
10
- export type NavigationMenuTriggerProps = React.ComponentProps<typeof NavigationMenu$1.Trigger>;
11
- export type NavigationMenuContentProps = React.ComponentProps<typeof NavigationMenu$1.Content>;
12
- export type NavigationMenuViewportProps = React.ComponentProps<typeof NavigationMenu$1.Viewport>;
13
- export type NavigationMenuLinkProps = React.ComponentProps<typeof NavigationMenu$1.Link>;
14
- export type NavigationMenuIndicatorProps = React.ComponentProps<typeof NavigationMenu$1.Indicator>;
15
- declare function NavigationMenu({ className, children, viewport, ...props }: NavigationMenuProps): React.JSX.Element;
16
- declare function NavigationMenuList({ className, ...props }: NavigationMenuListProps): React.JSX.Element;
17
- declare function NavigationMenuItem({ className, ...props }: NavigationMenuItemProps): React.JSX.Element;
6
+ export type NavigationMenuProps = Omit<React.ComponentProps<typeof NavigationMenu$1.Root>, 'render'> & Pick<React.ComponentProps<typeof NavigationMenu$1.Positioner>, 'align'>;
7
+ export type NavigationMenuListProps = AsChildPrimitiveProps<typeof NavigationMenu$1.List>;
8
+ export type NavigationMenuItemProps = AsChildPrimitiveProps<typeof NavigationMenu$1.Item>;
9
+ export type NavigationMenuTriggerProps = AsChildPrimitiveProps<typeof NavigationMenu$1.Trigger>;
10
+ export type NavigationMenuContentProps = AsChildPrimitiveProps<typeof NavigationMenu$1.Content>;
11
+ export type NavigationMenuPositionerProps = Omit<React.ComponentProps<typeof NavigationMenu$1.Positioner>, 'render'> & Pick<React.ComponentProps<typeof NavigationMenu$1.Portal>, 'keepMounted'>;
12
+ export type NavigationMenuLinkProps = AsChildPrimitiveProps<typeof NavigationMenu$1.Link>;
13
+ export type NavigationMenuIndicatorProps = AsChildPrimitiveProps<typeof NavigationMenu$1.Icon>;
14
+ declare function NavigationMenu({ align, className, children, ...props }: NavigationMenuProps): React.JSX.Element;
15
+ declare function NavigationMenuList({ className, asChild, children, ...props }: NavigationMenuListProps): React.JSX.Element;
16
+ declare function NavigationMenuItem({ className, asChild, children, ...props }: NavigationMenuItemProps): React.JSX.Element;
18
17
  declare const navigationMenuTriggerStyle: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
19
- declare function NavigationMenuTrigger({ className, children, ...props }: NavigationMenuTriggerProps): React.JSX.Element;
20
- declare function NavigationMenuContent({ className, ...props }: NavigationMenuContentProps): React.JSX.Element;
21
- declare function NavigationMenuViewport({ className, ...props }: NavigationMenuViewportProps): React.JSX.Element;
22
- declare function NavigationMenuLink({ className, ...props }: NavigationMenuLinkProps): React.JSX.Element;
23
- declare function NavigationMenuIndicator({ className, ...props }: NavigationMenuIndicatorProps): React.JSX.Element;
18
+ declare function NavigationMenuTrigger({ className, children, asChild, ...props }: NavigationMenuTriggerProps): React.JSX.Element;
19
+ declare function NavigationMenuContent({ className, asChild, children, ...props }: NavigationMenuContentProps): React.JSX.Element;
20
+ declare function NavigationMenuPositioner({ className, side, sideOffset, align, alignOffset, keepMounted, ...props }: NavigationMenuPositionerProps): React.JSX.Element;
21
+ declare function NavigationMenuLink({ className, asChild, children, ...props }: NavigationMenuLinkProps): React.JSX.Element;
22
+ declare function NavigationMenuIndicator({ className, asChild, children, ...props }: NavigationMenuIndicatorProps): React.JSX.Element;
24
23
  //#endregion
25
- export { NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, navigationMenuTriggerStyle };
24
+ export { NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuPositioner, NavigationMenuTrigger, navigationMenuTriggerStyle };
26
25
  //# sourceMappingURL=navigation-menu.d.ts.map
@@ -1,2 +1,2 @@
1
- import"../rolldown-runtime-BhWHdk3m.js";import{cn as e}from"../lib/utils.js";import{IconChevronDown as t}from"@tabler/icons-react";import{NavigationMenu as n}from"radix-ui";import{jsx as r,jsxs as i}from"react/jsx-runtime";import{cva as a}from"class-variance-authority";function NavigationMenu({className:t,children:a,viewport:o=!0,...s}){return/* @__PURE__ */ i(n.Root,{"data-slot":`navigation-menu`,"data-viewport":o,className:e(`group/navigation-menu relative flex max-w-max flex-1 items-center justify-center`,t),...s,children:[a,o&&/* @__PURE__ */ r(NavigationMenuViewport,{})]})}function NavigationMenuList({className:t,...i}){return/* @__PURE__ */ r(n.List,{"data-slot":`navigation-menu-list`,className:e(`group flex flex-1 list-none items-center justify-center gap-0`,t),...i})}function NavigationMenuItem({className:t,...i}){return/* @__PURE__ */ r(n.Item,{"data-slot":`navigation-menu-item`,className:e(`relative`,t),...i})}const o=a(`group/navigation-menu-trigger inline-flex h-9 w-max items-center justify-center rounded-lg bg-background px-2.5 py-1.5 text-sm font-medium transition-all outline-none hover:bg-muted focus:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-popup-open:bg-muted/50 data-popup-open:hover:bg-muted data-open:bg-muted/50 data-open:hover:bg-muted data-open:focus:bg-muted`);function NavigationMenuTrigger({className:a,children:s,...c}){return/* @__PURE__ */ i(n.Trigger,{"data-slot":`navigation-menu-trigger`,className:e(o(),`group`,a),...c,children:[s,` `,/* @__PURE__ */ r(t,{className:e(`relative top-px ml-1 size-3 transition duration-300`,`group-data-popup-open/navigation-menu-trigger:rotate-180`,`group-data-open/navigation-menu-trigger:rotate-180`),"aria-hidden":`true`})]})}function NavigationMenuContent({className:t,...i}){return/* @__PURE__ */ r(n.Content,{"data-slot":`navigation-menu-content`,className:e(`top-0 left-0 w-full p-1 ease-[cubic-bezier(0.22,1,0.36,1)] md:absolute md:w-auto`,`group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5`,`group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-lg`,`group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground`,`group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:ring-1`,`group-data-[viewport=false]/navigation-menu:ring-foreground/10 group-data-[viewport=false]/navigation-menu:duration-300`,`group-data-[viewport=false]/navigation-menu:data-open:animate-in`,`group-data-[viewport=false]/navigation-menu:data-open:fade-in-0`,`group-data-[viewport=false]/navigation-menu:data-open:zoom-in-95`,`group-data-[viewport=false]/navigation-menu:data-closed:animate-out`,`group-data-[viewport=false]/navigation-menu:data-closed:fade-out-0`,`group-data-[viewport=false]/navigation-menu:data-closed:zoom-out-95`,`data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52`,`data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52`,`data-[motion^=from-]:animate-in data-[motion^=from-]:fade-in`,`data-[motion^=to-]:animate-out data-[motion^=to-]:fade-out`,`**:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none`,t),...i})}function NavigationMenuViewport({className:t,...i}){return/* @__PURE__ */ r(`div`,{className:e(`absolute top-full left-0 isolate z-50 flex justify-center`),children:/* @__PURE__ */ r(n.Viewport,{"data-slot":`navigation-menu-viewport`,className:e(`origin-top-center relative mt-1.5 h-(--radix-navigation-menu-viewport-height) w-full overflow-hidden rounded-lg`,`bg-popover text-popover-foreground shadow ring-1 ring-foreground/10 duration-100`,`md:w-(--radix-navigation-menu-viewport-width)`,`data-open:animate-in data-open:zoom-in-90`,`data-closed:animate-out data-closed:zoom-out-90`,t),...i})})}function NavigationMenuLink({className:t,...i}){return/* @__PURE__ */ r(n.Link,{"data-slot":`navigation-menu-link`,className:e(`flex items-center gap-2 rounded-lg p-2 text-sm transition-all outline-none hover:bg-muted focus:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 in-data-[slot=navigation-menu-content]:rounded-md data-active:bg-muted/50 data-active:hover:bg-muted data-active:focus:bg-muted [&_svg:not([class*='size-'])]:size-4`,t),...i})}function NavigationMenuIndicator({className:t,...i}){return/* @__PURE__ */ r(n.Indicator,{"data-slot":`navigation-menu-indicator`,className:e(`top-full z-1 flex h-1.5 items-end justify-center overflow-hidden data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:animate-in data-[state=visible]:fade-in`,t),...i,children:/* @__PURE__ */ r(`div`,{className:`relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md`})})}export{NavigationMenu,NavigationMenuContent,NavigationMenuIndicator,NavigationMenuItem,NavigationMenuLink,NavigationMenuList,NavigationMenuTrigger,NavigationMenuViewport,o as navigationMenuTriggerStyle};
1
+ import"../rolldown-runtime-BhWHdk3m.js";import{toAsChildRenderProps as e}from"../lib/as-child.js";import{cn as t}from"../lib/utils.js";import{t as n}from"../resolve-class-name-BurP8ngI.js";import{IconChevronDown as r}from"@tabler/icons-react";import{Fragment as i,jsx as a,jsxs as o}from"react/jsx-runtime";import{cva as s}from"class-variance-authority";import{NavigationMenu as c}from"@base-ui/react/navigation-menu";function NavigationMenu({align:e=`start`,className:r,children:i,...s}){return/* @__PURE__ */ o(c.Root,{"data-slot":`navigation-menu`,className:e=>t(`group/navigation-menu relative flex max-w-max flex-1 items-center justify-center`,n(r,e)),...s,children:[i,/* @__PURE__ */ a(NavigationMenuPositioner,{align:e})]})}function NavigationMenuList({className:r,asChild:i,children:o,...s}){return/* @__PURE__ */ a(c.List,{"data-slot":`navigation-menu-list`,className:e=>t(`group flex flex-1 list-none items-center justify-center gap-0`,n(r,e)),...s,...e(i,o)})}function NavigationMenuItem({className:r,asChild:i,children:o,...s}){return/* @__PURE__ */ a(c.Item,{"data-slot":`navigation-menu-item`,className:e=>t(`relative`,n(r,e)),...s,...e(i,o)})}const l=s(`group/navigation-menu-trigger inline-flex h-9 w-max items-center justify-center rounded-lg bg-background px-2.5 py-1.5 text-sm font-medium transition-all outline-none hover:bg-muted focus:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-popup-open:bg-muted/50 data-popup-open:hover:bg-muted data-open:bg-muted/50 data-open:hover:bg-muted data-open:focus:bg-muted`);function NavigationMenuTrigger({className:s,children:u,asChild:d,...f}){return/* @__PURE__ */ o(c.Trigger,{"data-slot":`navigation-menu-trigger`,className:e=>t(l(),`group`,n(s,e)),...f,...e(d,u),children:[!d&&u,!d&&/* @__PURE__ */ o(i,{children:[` `,/* @__PURE__ */ a(r,{className:t(`relative top-px ml-1 size-3 transition duration-300`,`group-data-popup-open/navigation-menu-trigger:rotate-180`,`group-data-open/navigation-menu-trigger:rotate-180`),"aria-hidden":`true`})]})]})}function NavigationMenuContent({className:r,asChild:i,children:o,...s}){return/* @__PURE__ */ a(c.Content,{"data-slot":`navigation-menu-content`,className:e=>t(`h-full w-auto p-1 ease-[cubic-bezier(0.22,1,0.36,1)]`,`transition-[opacity,transform,translate] duration-[0.35s]`,`data-starting-style:opacity-0 data-ending-style:opacity-0`,`data-[activation-direction=left]:data-starting-style:-translate-x-1/2 data-[activation-direction=right]:data-starting-style:translate-x-1/2`,`data-[activation-direction=left]:data-ending-style:translate-x-1/2 data-[activation-direction=right]:data-ending-style:-translate-x-1/2`,`**:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none`,n(r,e)),...s,...e(i,o)})}function NavigationMenuPositioner({className:e,side:r=`bottom`,sideOffset:i=6,align:o=`start`,alignOffset:s=0,keepMounted:l,...u}){return/* @__PURE__ */ a(c.Portal,{keepMounted:l,children:/* @__PURE__ */ a(c.Positioner,{"data-slot":`navigation-menu-positioner`,side:r,sideOffset:i,align:o,alignOffset:s,className:r=>t(`isolate z-50 h-(--positioner-height) w-(--positioner-width) max-w-(--available-width)`,`transition-[top,left,right,bottom] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] data-instant:transition-none`,n(e,r)),...u,children:/* @__PURE__ */ a(c.Popup,{"data-slot":`navigation-menu-popup`,className:t(`relative h-(--popup-height) w-(--popup-width) origin-(--transform-origin) overflow-hidden rounded-lg outline-none`,`bg-popover text-popover-foreground shadow ring-1 ring-foreground/10`,`transition-[opacity,transform,width,height,scale,translate] duration-[0.35s] ease-[cubic-bezier(0.22,1,0.36,1)]`,`data-starting-style:scale-90 data-starting-style:opacity-0`,`data-ending-style:scale-90 data-ending-style:opacity-0 data-ending-style:duration-150`),children:/* @__PURE__ */ a(c.Viewport,{"data-slot":`navigation-menu-viewport`,className:`relative size-full overflow-hidden`})})})})}function NavigationMenuLink({className:r,asChild:i,children:o,...s}){return/* @__PURE__ */ a(c.Link,{"data-slot":`navigation-menu-link`,className:e=>t(`flex items-center gap-2 rounded-lg p-2 text-sm transition-all outline-none hover:bg-muted focus:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 in-data-[slot=navigation-menu-content]:rounded-md data-active:bg-muted/50 data-active:hover:bg-muted data-active:focus:bg-muted [&_svg:not([class*='size-'])]:size-4`,n(r,e)),...s,...e(i,o)})}function NavigationMenuIndicator({className:r,asChild:i,children:o,...s}){return/* @__PURE__ */ a(c.Icon,{"data-slot":`navigation-menu-indicator`,className:e=>t(`top-full z-1 flex h-1.5 items-end justify-center overflow-hidden`,n(r,e)),...s,...e(i,o),children:!i&&/* @__PURE__ */ a(`div`,{className:`relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md`})})}export{NavigationMenu,NavigationMenuContent,NavigationMenuIndicator,NavigationMenuItem,NavigationMenuLink,NavigationMenuList,NavigationMenuPositioner,NavigationMenuTrigger,l as navigationMenuTriggerStyle};
2
2
  //# sourceMappingURL=navigation-menu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"navigation-menu.js","names":["NavigationMenuPrimitive","NavigationMenu$1","props","viewport","cn","className","children","navigationMenuTriggerStyle","cva","IconChevronDown"],"sources":["../../src/components/navigation-menu.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { IconChevronDown } from '@tabler/icons-react'\nimport { cva } from 'class-variance-authority'\nimport { NavigationMenu as NavigationMenuPrimitive } from 'radix-ui'\n\nimport { cn } from '../lib/utils'\n\nexport type NavigationMenuProps = React.ComponentProps<typeof NavigationMenuPrimitive.Root> & {\n viewport?: boolean\n}\n\nexport type NavigationMenuListProps = React.ComponentProps<typeof NavigationMenuPrimitive.List>\n\nexport type NavigationMenuItemProps = React.ComponentProps<typeof NavigationMenuPrimitive.Item>\n\nexport type NavigationMenuTriggerProps = React.ComponentProps<typeof NavigationMenuPrimitive.Trigger>\n\nexport type NavigationMenuContentProps = React.ComponentProps<typeof NavigationMenuPrimitive.Content>\n\nexport type NavigationMenuViewportProps = React.ComponentProps<typeof NavigationMenuPrimitive.Viewport>\n\nexport type NavigationMenuLinkProps = React.ComponentProps<typeof NavigationMenuPrimitive.Link>\n\nexport type NavigationMenuIndicatorProps = React.ComponentProps<typeof NavigationMenuPrimitive.Indicator>\n\nfunction NavigationMenu({ className, children, viewport = true, ...props }: NavigationMenuProps) {\n return (\n <NavigationMenuPrimitive.Root\n data-slot=\"navigation-menu\"\n data-viewport={viewport}\n className={cn('group/navigation-menu relative flex max-w-max flex-1 items-center justify-center', className)}\n {...props}\n >\n {children}\n {viewport && <NavigationMenuViewport />}\n </NavigationMenuPrimitive.Root>\n )\n}\n\nfunction NavigationMenuList({ className, ...props }: NavigationMenuListProps) {\n return (\n <NavigationMenuPrimitive.List\n data-slot=\"navigation-menu-list\"\n className={cn('group flex flex-1 list-none items-center justify-center gap-0', className)}\n {...props}\n />\n )\n}\n\nfunction NavigationMenuItem({ className, ...props }: NavigationMenuItemProps) {\n return (\n <NavigationMenuPrimitive.Item data-slot=\"navigation-menu-item\" className={cn('relative', className)} {...props} />\n )\n}\n\nconst navigationMenuTriggerStyle = cva(\n 'group/navigation-menu-trigger inline-flex h-9 w-max items-center justify-center rounded-lg bg-background px-2.5 py-1.5 text-sm font-medium transition-all outline-none hover:bg-muted focus:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-popup-open:bg-muted/50 data-popup-open:hover:bg-muted data-open:bg-muted/50 data-open:hover:bg-muted data-open:focus:bg-muted'\n)\n\nfunction NavigationMenuTrigger({ className, children, ...props }: NavigationMenuTriggerProps) {\n return (\n <NavigationMenuPrimitive.Trigger\n data-slot=\"navigation-menu-trigger\"\n className={cn(navigationMenuTriggerStyle(), 'group', className)}\n {...props}\n >\n {children}{' '}\n <IconChevronDown\n className={cn(\n 'relative top-px ml-1 size-3 transition duration-300',\n 'group-data-popup-open/navigation-menu-trigger:rotate-180',\n 'group-data-open/navigation-menu-trigger:rotate-180'\n )}\n aria-hidden=\"true\"\n />\n </NavigationMenuPrimitive.Trigger>\n )\n}\n\nfunction NavigationMenuContent({ className, ...props }: NavigationMenuContentProps) {\n return (\n <NavigationMenuPrimitive.Content\n data-slot=\"navigation-menu-content\"\n className={cn(\n 'top-0 left-0 w-full p-1 ease-[cubic-bezier(0.22,1,0.36,1)] md:absolute md:w-auto',\n 'group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5',\n 'group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-lg',\n 'group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground',\n 'group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:ring-1',\n 'group-data-[viewport=false]/navigation-menu:ring-foreground/10 group-data-[viewport=false]/navigation-menu:duration-300',\n 'group-data-[viewport=false]/navigation-menu:data-open:animate-in',\n 'group-data-[viewport=false]/navigation-menu:data-open:fade-in-0',\n 'group-data-[viewport=false]/navigation-menu:data-open:zoom-in-95',\n 'group-data-[viewport=false]/navigation-menu:data-closed:animate-out',\n 'group-data-[viewport=false]/navigation-menu:data-closed:fade-out-0',\n 'group-data-[viewport=false]/navigation-menu:data-closed:zoom-out-95',\n 'data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52',\n 'data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52',\n 'data-[motion^=from-]:animate-in data-[motion^=from-]:fade-in',\n 'data-[motion^=to-]:animate-out data-[motion^=to-]:fade-out',\n '**:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction NavigationMenuViewport({ className, ...props }: NavigationMenuViewportProps) {\n return (\n <div className={cn('absolute top-full left-0 isolate z-50 flex justify-center')}>\n <NavigationMenuPrimitive.Viewport\n data-slot=\"navigation-menu-viewport\"\n className={cn(\n 'origin-top-center relative mt-1.5 h-(--radix-navigation-menu-viewport-height) w-full overflow-hidden rounded-lg',\n 'bg-popover text-popover-foreground shadow ring-1 ring-foreground/10 duration-100',\n 'md:w-(--radix-navigation-menu-viewport-width)',\n 'data-open:animate-in data-open:zoom-in-90',\n 'data-closed:animate-out data-closed:zoom-out-90',\n className\n )}\n {...props}\n />\n </div>\n )\n}\n\nfunction NavigationMenuLink({ className, ...props }: NavigationMenuLinkProps) {\n return (\n <NavigationMenuPrimitive.Link\n data-slot=\"navigation-menu-link\"\n className={cn(\n \"flex items-center gap-2 rounded-lg p-2 text-sm transition-all outline-none hover:bg-muted focus:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 in-data-[slot=navigation-menu-content]:rounded-md data-active:bg-muted/50 data-active:hover:bg-muted data-active:focus:bg-muted [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction NavigationMenuIndicator({ className, ...props }: NavigationMenuIndicatorProps) {\n return (\n <NavigationMenuPrimitive.Indicator\n data-slot=\"navigation-menu-indicator\"\n className={cn(\n 'top-full z-1 flex h-1.5 items-end justify-center overflow-hidden data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:animate-in data-[state=visible]:fade-in',\n className\n )}\n {...props}\n >\n <div className=\"relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md\" />\n </NavigationMenuPrimitive.Indicator>\n )\n}\n\nexport {\n NavigationMenu,\n NavigationMenuContent,\n NavigationMenuIndicator,\n NavigationMenuItem,\n NavigationMenuLink,\n NavigationMenuList,\n NavigationMenuTrigger,\n NavigationMenuViewport,\n navigationMenuTriggerStyle\n}\n"],"mappings":"8QA0BA,SAAS,eAAe,CAAE,YAAW,WAAU,WAAW,GAAM,GAAGE,GAA8B,CAC/F,MACE,kBAACF,EAAwB,KAAzB,CACE,YAAU,kBACV,gBAAeG,EACf,UAAWC,EAAG,mFA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W,GAAGA,GAAkC,CAC5E,MACE,kBAACF,EAAwB,KAAzB,CACE,YAAU,uBACV,UAAWI,EACT,wVACAC,CACF,EACA,GAAIH,CACL,CAAA,CAEL,CAEA,SAAS,wBAAwB,CAAE,YAAW,GAAGA,GAAuC,CACtF,MACE,kBAACF,EAAwB,UAAzB,CACE,YAAU,4BACV,UAAWI,EACT,6LACAC,CACF,EACA,GAAIH,EAEJ,SAAA,kBAAC,MAAD,CAAK,UAAU,wEAA0E,CAAA,CACxD,CAAA,CAEvC"}
1
+ {"version":3,"file":"navigation-menu.js","names":["NavigationMenuPrimitive","resolveClassName","NavigationMenu$1","props","cn","className","state","children","toAsChildRenderProps","asChild","navigationMenuTriggerStyle","cva","Fragment","IconChevronDown"],"sources":["../../src/components/navigation-menu.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { NavigationMenu as NavigationMenuPrimitive } from '@base-ui/react/navigation-menu'\nimport { IconChevronDown } from '@tabler/icons-react'\nimport { cva } from 'class-variance-authority'\n\nimport { type AsChildPrimitiveProps, toAsChildRenderProps } from '../lib/as-child'\nimport { cn } from '../lib/utils'\nimport { resolveClassName } from '../utils/resolve-class-name'\n\nexport type NavigationMenuProps = Omit<React.ComponentProps<typeof NavigationMenuPrimitive.Root>, 'render'> &\n Pick<React.ComponentProps<typeof NavigationMenuPrimitive.Positioner>, 'align'>\n\nexport type NavigationMenuListProps = AsChildPrimitiveProps<typeof NavigationMenuPrimitive.List>\n\nexport type NavigationMenuItemProps = AsChildPrimitiveProps<typeof NavigationMenuPrimitive.Item>\n\nexport type NavigationMenuTriggerProps = AsChildPrimitiveProps<typeof NavigationMenuPrimitive.Trigger>\n\nexport type NavigationMenuContentProps = AsChildPrimitiveProps<typeof NavigationMenuPrimitive.Content>\n\nexport type NavigationMenuPositionerProps = Omit<\n React.ComponentProps<typeof NavigationMenuPrimitive.Positioner>,\n 'render'\n> &\n Pick<React.ComponentProps<typeof NavigationMenuPrimitive.Portal>, 'keepMounted'>\n\nexport type NavigationMenuLinkProps = AsChildPrimitiveProps<typeof NavigationMenuPrimitive.Link>\n\nexport type NavigationMenuIndicatorProps = AsChildPrimitiveProps<typeof NavigationMenuPrimitive.Icon>\n\nfunction NavigationMenu({ align = 'start', className, children, ...props }: NavigationMenuProps) {\n return (\n <NavigationMenuPrimitive.Root\n data-slot=\"navigation-menu\"\n className={(state) =>\n cn(\n 'group/navigation-menu relative flex max-w-max flex-1 items-center justify-center',\n resolveClassName(className, state)\n )\n }\n {...props}\n >\n {children}\n <NavigationMenuPositioner align={align} />\n </NavigationMenuPrimitive.Root>\n )\n}\n\nfunction NavigationMenuList({ className, asChild, children, ...props }: NavigationMenuListProps) {\n return (\n <NavigationMenuPrimitive.List\n data-slot=\"navigation-menu-list\"\n className={(state) =>\n cn('group flex flex-1 list-none items-center justify-center gap-0', resolveClassName(className, state))\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction NavigationMenuItem({ className, asChild, children, ...props }: NavigationMenuItemProps) {\n return (\n <NavigationMenuPrimitive.Item\n data-slot=\"navigation-menu-item\"\n className={(state) => cn('relative', resolveClassName(className, state))}\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nconst navigationMenuTriggerStyle = cva(\n 'group/navigation-menu-trigger inline-flex h-9 w-max items-center justify-center rounded-lg bg-background px-2.5 py-1.5 text-sm font-medium transition-all outline-none hover:bg-muted focus:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-popup-open:bg-muted/50 data-popup-open:hover:bg-muted data-open:bg-muted/50 data-open:hover:bg-muted data-open:focus:bg-muted'\n)\n\nfunction NavigationMenuTrigger({ className, children, asChild, ...props }: NavigationMenuTriggerProps) {\n return (\n <NavigationMenuPrimitive.Trigger\n data-slot=\"navigation-menu-trigger\"\n className={(state) => cn(navigationMenuTriggerStyle(), 'group', resolveClassName(className, state))}\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n >\n {!asChild && children}\n {!asChild && (\n <>\n {' '}\n <IconChevronDown\n className={cn(\n 'relative top-px ml-1 size-3 transition duration-300',\n 'group-data-popup-open/navigation-menu-trigger:rotate-180',\n 'group-data-open/navigation-menu-trigger:rotate-180'\n )}\n aria-hidden=\"true\"\n />\n </>\n )}\n </NavigationMenuPrimitive.Trigger>\n )\n}\n\nfunction NavigationMenuContent({ className, asChild, children, ...props }: NavigationMenuContentProps) {\n return (\n <NavigationMenuPrimitive.Content\n data-slot=\"navigation-menu-content\"\n className={(state) =>\n cn(\n 'h-full w-auto p-1 ease-[cubic-bezier(0.22,1,0.36,1)]',\n 'transition-[opacity,transform,translate] duration-[0.35s]',\n 'data-starting-style:opacity-0 data-ending-style:opacity-0',\n 'data-[activation-direction=left]:data-starting-style:-translate-x-1/2 data-[activation-direction=right]:data-starting-style:translate-x-1/2',\n 'data-[activation-direction=left]:data-ending-style:translate-x-1/2 data-[activation-direction=right]:data-ending-style:-translate-x-1/2',\n '**:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none',\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction NavigationMenuPositioner({\n className,\n side = 'bottom',\n sideOffset = 6,\n align = 'start',\n alignOffset = 0,\n keepMounted,\n ...props\n}: NavigationMenuPositionerProps) {\n return (\n <NavigationMenuPrimitive.Portal keepMounted={keepMounted}>\n <NavigationMenuPrimitive.Positioner\n data-slot=\"navigation-menu-positioner\"\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n className={(state) =>\n cn(\n 'isolate z-50 h-(--positioner-height) w-(--positioner-width) max-w-(--available-width)',\n 'transition-[top,left,right,bottom] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] data-instant:transition-none',\n resolveClassName(className, state)\n )\n }\n {...props}\n >\n <NavigationMenuPrimitive.Popup\n data-slot=\"navigation-menu-popup\"\n className={cn(\n 'relative h-(--popup-height) w-(--popup-width) origin-(--transform-origin) overflow-hidden rounded-lg outline-none',\n 'bg-popover text-popover-foreground shadow ring-1 ring-foreground/10',\n 'transition-[opacity,transform,width,height,scale,translate] duration-[0.35s] ease-[cubic-bezier(0.22,1,0.36,1)]',\n 'data-starting-style:scale-90 data-starting-style:opacity-0',\n 'data-ending-style:scale-90 data-ending-style:opacity-0 data-ending-style:duration-150'\n )}\n >\n <NavigationMenuPrimitive.Viewport\n data-slot=\"navigation-menu-viewport\"\n className=\"relative size-full overflow-hidden\"\n />\n </NavigationMenuPrimitive.Popup>\n </NavigationMenuPrimitive.Positioner>\n </NavigationMenuPrimitive.Portal>\n )\n}\n\nfunction NavigationMenuLink({ className, asChild, children, ...props }: NavigationMenuLinkProps) {\n return (\n <NavigationMenuPrimitive.Link\n data-slot=\"navigation-menu-link\"\n className={(state) =>\n cn(\n \"flex items-center gap-2 rounded-lg p-2 text-sm transition-all outline-none hover:bg-muted focus:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 in-data-[slot=navigation-menu-content]:rounded-md data-active:bg-muted/50 data-active:hover:bg-muted data-active:focus:bg-muted [&_svg:not([class*='size-'])]:size-4\",\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction NavigationMenuIndicator({ className, asChild, children, ...props }: NavigationMenuIndicatorProps) {\n return (\n <NavigationMenuPrimitive.Icon\n data-slot=\"navigation-menu-indicator\"\n className={(state) =>\n cn('top-full z-1 flex h-1.5 items-end justify-center overflow-hidden', resolveClassName(className, state))\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n >\n {!asChild && <div className=\"relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md\" />}\n </NavigationMenuPrimitive.Icon>\n )\n}\n\nexport {\n NavigationMenu,\n NavigationMenuContent,\n NavigationMenuIndicator,\n NavigationMenuItem,\n NavigationMenuLink,\n NavigationMenuList,\n N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0E,CAAA,CAC1E,CAAA,CAElC"}
@@ -1,6 +1,8 @@
1
1
  import { t as __name } from "../rolldown-runtime-BhWHdk3m.js";
2
- import { VariantProps } from "class-variance-authority";
2
+ import { t as AsChildPrimitiveProps } from "../as-child-Dxg3Xo1G.js";
3
+ import * as React from "react";
3
4
  import { ReactNode } from "react";
5
+ import { VariantProps } from "class-variance-authority";
4
6
  import { NumberField as NumberField$1 } from "@base-ui/react/number-field";
5
7
  //#region src/components/number-field.d.ts
6
8
  declare const numberFieldGroupVariants: (props?: ({
@@ -12,24 +14,27 @@ declare const numberFieldButtonVariants: (props?: ({
12
14
  declare const numberFieldInputVariants: (props?: ({
13
15
  size?: "lg" | "md" | "sm" | null | undefined;
14
16
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
15
- export type NumberFieldProps = NumberField$1.Root.Props & VariantProps<typeof numberFieldGroupVariants>;
16
- declare function NumberField({ id, className, size, ...props }: NumberFieldProps): import("react").JSX.Element;
17
- export type NumberFieldGroupProps = NumberField$1.Group.Props & Partial<VariantProps<typeof numberFieldGroupVariants>>;
18
- declare function NumberFieldGroup({ className, size: sizeProp, ...props }: NumberFieldGroupProps): import("react").JSX.Element;
19
- export type NumberFieldDecrementProps = NumberField$1.Decrement.Props & Partial<VariantProps<typeof numberFieldButtonVariants>> & {
17
+ export type NumberFieldProps = Omit<NumberField$1.Root.Props, 'render'> & VariantProps<typeof numberFieldGroupVariants>;
18
+ declare function NumberField({ id, className, size, 'aria-invalid': ariaInvalid, ...props }: NumberFieldProps): React.JSX.Element;
19
+ export type NumberFieldGroupProps = AsChildPrimitiveProps<typeof NumberField$1.Group> & Partial<VariantProps<typeof numberFieldGroupVariants>>;
20
+ declare function NumberFieldGroup({ className, size: sizeProp, asChild, children, ...props }: NumberFieldGroupProps): React.JSX.Element;
21
+ export type NumberFieldDecrementProps = AsChildPrimitiveProps<typeof NumberField$1.Decrement> & Partial<VariantProps<typeof numberFieldButtonVariants>> & {
22
+ /** Replaces the default minus icon. */
20
23
  children?: React.ReactNode;
21
24
  };
22
- declare function NumberFieldDecrement({ className, size: sizeProp, children, ...props }: NumberFieldDecrementProps): import("react").JSX.Element;
23
- export type NumberFieldIncrementProps = NumberField$1.Increment.Props & Partial<VariantProps<typeof numberFieldButtonVariants>> & {
25
+ declare function NumberFieldDecrement({ className, size: sizeProp, children, asChild, ...props }: NumberFieldDecrementProps): React.JSX.Element;
26
+ export type NumberFieldIncrementProps = AsChildPrimitiveProps<typeof NumberField$1.Increment> & Partial<VariantProps<typeof numberFieldButtonVariants>> & {
27
+ /** Replaces the default plus icon. */
24
28
  children?: ReactNode;
25
29
  };
26
- declare function NumberFieldIncrement({ className, size: sizeProp, children, ...props }: NumberFieldIncrementProps): import("react").JSX.Element;
27
- export type NumberFieldInputProps = NumberField$1.Input.Props & Partial<VariantProps<typeof numberFieldInputVariants>>;
28
- declare function NumberFieldInput({ id, className, size: sizeProp, ...props }: NumberFieldInputProps): import("react").JSX.Element;
29
- export type NumberFieldScrubAreaProps = NumberField$1.ScrubArea.Props & {
30
+ declare function NumberFieldIncrement({ className, size: sizeProp, children, asChild, ...props }: NumberFieldIncrementProps): React.JSX.Element;
31
+ export type NumberFieldInputProps = Omit<NumberField$1.Input.Props, 'render'> & Partial<VariantProps<typeof numberFieldInputVariants>>;
32
+ declare function NumberFieldInput({ id, className, size: sizeProp, ...props }: NumberFieldInputProps): React.JSX.Element;
33
+ export type NumberFieldScrubAreaProps = Omit<React.ComponentProps<typeof NumberField$1.ScrubArea>, 'render'> & {
34
+ /** Visible label; dragging it changes the value. */
30
35
  label: string;
31
36
  };
32
- declare function NumberFieldScrubArea({ className, label, ...props }: NumberFieldScrubAreaProps): import("react").JSX.Element;
37
+ declare function NumberFieldScrubArea({ className, label, ...props }: NumberFieldScrubAreaProps): React.JSX.Element;
33
38
  //#endregion
34
39
  export { NumberField, NumberFieldDecrement, NumberFieldGroup, NumberFieldIncrement, NumberFieldInput, NumberFieldScrubArea };
35
40
  //# sourceMappingURL=number-field.d.ts.map
@@ -1,2 +1,2 @@
1
- import"../rolldown-runtime-BhWHdk3m.js";import{cn as e}from"../lib/utils.js";import{Label as t}from"./label.js";import{useFieldControlId as n}from"./field.js";import{IconMinus as r,IconPlus as i}from"@tabler/icons-react";import{jsx as a,jsxs as o}from"react/jsx-runtime";import{cva as s}from"class-variance-authority";import{createContext as c,useContext as l,useId as u}from"react";import{NumberField as d}from"@base-ui/react/number-field";const f=c(null),p=s(`relative flex w-full justify-between border border-input data-disabled:pointer-events-none data-disabled:opacity-50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive focus-within:has-aria-invalid:border-destructive focus-within:has-aria-invalid:ring-destructive/20 dark:focus-within:has-aria-invalid:ring-destructive/40 rounded-lg bg-transparent dark:bg-input/30 transition-colors focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-3`,{variants:{size:{sm:`h-7 text-sm`,md:`h-8 text-sm`,lg:`h-9 text-sm`}},defaultVariants:{size:`md`}}),m=s(`relative flex shrink-0 cursor-pointer items-center justify-center transition-colors pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:bg-accent`,{variants:{size:{sm:`px-1.5 [&_svg:not([class*='size-'])]:size-3.5`,md:`px-2 [&_svg:not([class*='size-'])]:size-4`,lg:`px-2.5 [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{size:`md`}}),h=s(`w-full min-w-0 flex-1 bg-transparent text-center tabular-nums outline-none`,{variants:{size:{sm:`px-2 py-0.5`,md:`px-2.5 py-1`,lg:`px-2.5 py-1.5`}},defaultVariants:{size:`md`}});function NumberField({id:t,className:r,size:i=`md`,...o}){let s=u(),c=n(t)??s,l=i??`md`;return/* @__PURE__ */ a(f.Provider,{value:{fieldId:c,size:l},children:/* @__PURE__ */ a(d.Root,{className:e(`flex w-full flex-col items-start gap-2`,r),"data-size":l,"data-slot":`number-field`,...o})})}function NumberFieldGroup({className:t,size:n,...r}){let i=l(f);if(!i)throw Error(`NumberFieldGroup must be used within a NumberField component.`);let o=n??i.size;return/* @__PURE__ */ a(d.Group,{className:e(p({size:o}),t),"data-slot":`number-field-group`,...r})}function NumberFieldDecrement({className:t,size:n,children:i,...o}){let s=l(f);if(!s)throw Error(`NumberFieldDecrement must be used within a NumberField component.`);let c=n??s.size;return/* @__PURE__ */ a(d.Decrement,{className:e(m({size:c}),`rounded-s-lg border-e-0`,t),"data-slot":`number-field-decrement`,...o,children:i??/* @__PURE__ */ a(r,{})})}function NumberFieldIncrement({className:t,size:n,children:r,...o}){let s=l(f);if(!s)throw Error(`NumberFieldIncrement must be used within a NumberField component.`);let c=n??s.size;return/* @__PURE__ */ a(d.Increment,{className:e(m({size:c}),`rounded-e-lg border-s-0`,t),"data-slot":`number-field-increment`,...o,children:r??/* @__PURE__ */ a(i,{})})}function NumberFieldInput({id:t,className:n,size:r,...i}){let o=l(f);if(!o)throw Error(`NumberFieldInput must be used within a NumberField component.`);let s=r??o.size;return/* @__PURE__ */ a(d.Input,{id:t??o.fieldId,className:e(h({size:s}),n),"data-slot":`number-field-input`,...i})}function NumberFieldScrubArea({className:n,label:r,...i}){let s=l(f);if(!s)throw Error(`NumberFieldScrubArea must be used within a NumberField component for accessibility.`);return/* @__PURE__ */ o(d.ScrubArea,{className:e(`flex cursor-ew-resize`,n),"data-slot":`number-field-scrub-area`,...i,children:[/* @__PURE__ */ a(t,{className:`cursor-ew-resize`,htmlFor:s.fieldId,children:r}),/* @__PURE__ */ a(d.ScrubAreaCursor,{className:`drop-shadow-[0_1px_1px_#0008] filter`,children:/* @__PURE__ */ a(CursorGrowIcon,{})})]})}function CursorGrowIcon(e){return/* @__PURE__ */ a(`svg`,{"aria-hidden":`true`,fill:`black`,height:`14`,stroke:`white`,viewBox:`0 0 24 14`,width:`26`,xmlns:`http://www.w3.org/2000/svg`,...e,children:/* @__PURE__ */ a(`path`,{d:`M19.5 5.5L6.49737 5.51844V2L1 6.9999L6.5 12L6.49737 8.5L19.5 8.5V12L25 6.9999L19.5 2V5.5Z`})})}export{NumberField,NumberFieldDecrement,NumberFieldGroup,NumberFieldIncrement,NumberFieldInput,NumberFieldScrubArea};
1
+ import"../rolldown-runtime-BhWHdk3m.js";import{toAsChildRenderProps as e}from"../lib/as-child.js";import{cn as t}from"../lib/utils.js";import{t as n}from"../resolve-class-name-BurP8ngI.js";import{Label as r}from"./label.js";import{useFieldControlId as i,useFieldInvalid as a}from"./field.js";import{IconMinus as o,IconPlus as s}from"@tabler/icons-react";import{createContext as c,useContext as l,useId as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{cva as p}from"class-variance-authority";import{NumberField as m}from"@base-ui/react/number-field";const h=c(null),g=p([`relative flex w-full justify-between rounded-lg border border-input bg-transparent transition-colors dark:bg-input/30`,`data-disabled:pointer-events-none data-disabled:opacity-50`,`focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,`has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40`],{variants:{size:{sm:`h-7 text-sm`,md:`h-8 text-sm`,lg:`h-9 text-sm`}},defaultVariants:{size:`md`}}),_=p(`relative flex shrink-0 cursor-pointer items-center justify-center transition-colors pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:bg-accent`,{variants:{size:{sm:`px-1.5 [&_svg:not([class*='size-'])]:size-3.5`,md:`px-2 [&_svg:not([class*='size-'])]:size-4`,lg:`px-2.5 [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{size:`md`}}),v=p(`w-full min-w-0 flex-1 bg-transparent text-center tabular-nums outline-none`,{variants:{size:{sm:`px-2 py-0.5`,md:`px-2.5 py-1`,lg:`px-2.5 py-1.5`}},defaultVariants:{size:`md`}});function NumberField({id:e,className:r,size:o=`md`,"aria-invalid":s,...c}){let l=u(),f=i(e),p=a(s),g=f??l,_=o??`md`;return/* @__PURE__ */ d(h.Provider,{value:{fieldId:g,size:_,invalid:p},children:/* @__PURE__ */ d(m.Root,{className:e=>t(`flex w-full flex-col items-start gap-2`,n(r,e)),"data-size":_,"data-slot":`number-field`,...c})})}function NumberFieldGroup({className:r,size:i,asChild:a,children:o,...s}){let c=l(h);if(!c)throw Error(`NumberFieldGroup must be used within a NumberField component.`);let u=i??c.size;return/* @__PURE__ */ d(m.Group,{className:e=>t(g({size:u}),n(r,e)),"data-slot":`number-field-group`,...s,...e(a,o)})}function NumberFieldDecrement({className:r,size:i,children:a,asChild:s,...c}){let u=l(h);if(!u)throw Error(`NumberFieldDecrement must be used within a NumberField component.`);let f=i??u.size;return/* @__PURE__ */ d(m.Decrement,{className:e=>t(_({size:f}),`rounded-s-lg border-e-0`,n(r,e)),"data-slot":`number-field-decrement`,...c,...e(s,a),children:!s&&(a??/* @__PURE__ */ d(o,{}))})}function NumberFieldIncrement({className:r,size:i,children:a,asChild:o,...c}){let u=l(h);if(!u)throw Error(`NumberFieldIncrement must be used within a NumberField component.`);let f=i??u.size;return/* @__PURE__ */ d(m.Increment,{className:e=>t(_({size:f}),`rounded-e-lg border-s-0`,n(r,e)),"data-slot":`number-field-increment`,...c,...e(o,a),children:!o&&(a??/* @__PURE__ */ d(s,{}))})}function NumberFieldInput({id:e,className:r,size:i,...a}){let o=l(h);if(!o)throw Error(`NumberFieldInput must be used within a NumberField component.`);let s=i??o.size;return/* @__PURE__ */ d(m.Input,{id:e??o.fieldId,"aria-invalid":o.invalid,className:e=>t(v({size:s}),n(r,e)),"data-slot":`number-field-input`,...a})}function NumberFieldScrubArea({className:e,label:i,...a}){let o=l(h);if(!o)throw Error(`NumberFieldScrubArea must be used within a NumberField component for accessibility.`);return/* @__PURE__ */ f(m.ScrubArea,{className:r=>t(`flex cursor-ew-resize`,n(e,r)),"data-slot":`number-field-scrub-area`,...a,children:[/* @__PURE__ */ d(r,{className:`cursor-ew-resize`,htmlFor:o.fieldId,children:i}),/* @__PURE__ */ d(m.ScrubAreaCursor,{className:`drop-shadow-[0_1px_1px_#0008] filter`,children:/* @__PURE__ */ d(CursorGrowIcon,{})})]})}function CursorGrowIcon(e){return/* @__PURE__ */ d(`svg`,{"aria-hidden":`true`,fill:`black`,height:`14`,stroke:`white`,viewBox:`0 0 24 14`,width:`26`,xmlns:`http://www.w3.org/2000/svg`,...e,children:/* @__PURE__ */ d(`path`,{d:`M19.5 5.5L6.49737 5.51844V2L1 6.9999L6.5 12L6.49737 8.5L19.5 8.5V12L25 6.9999L19.5 2V5.5Z`})})}export{NumberField,NumberFieldDecrement,NumberFieldGroup,NumberFieldIncrement,NumberFieldInput,NumberFieldScrubArea};
2
2
  //# sourceMappingURL=number-field.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"number-field.js","names":["NumberFieldPrimitive","NumberField$1","NumberFieldContext","createContext","numberFieldGroupVariants","cva","numberFieldButtonVariants","numberFieldInputVariants","props","generatedId","useId","fieldId","useFieldControlId","id","sizeValue","size","cn","className","sizeProp","context","useContext","children","IconMinus","IconPlus","Label","label"],"sources":["../../src/components/number-field.tsx"],"sourcesContent":["import { createContext, type ReactNode, useContext, useId } from 'react'\n\nimport { NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field'\nimport { IconMinus, IconPlus } from '@tabler/icons-react'\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../lib/utils'\nimport { useFieldControlId } from './field'\nimport { Label } from './label'\n\nconst NumberFieldContext = createContext<{\n fieldId: string\n size: 'sm' | 'md' | 'lg'\n} | null>(null)\n\nconst numberFieldGroupVariants = cva(\n 'relative flex w-full justify-between border border-input data-disabled:pointer-events-none data-disabled:opacity-50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive focus-within:has-aria-invalid:border-destructive focus-within:has-aria-invalid:ring-destructive/20 dark:focus-within:has-aria-invalid:ring-destructive/40 rounded-lg bg-transparent dark:bg-input/30 transition-colors focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-3',\n {\n variants: {\n size: {\n sm: 'h-7 text-sm',\n md: 'h-8 text-sm',\n lg: 'h-9 text-sm'\n }\n },\n defaultVariants: {\n size: 'md'\n }\n }\n)\n\nconst numberFieldButtonVariants = cva(\n 'relative flex shrink-0 cursor-pointer items-center justify-center transition-colors pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:bg-accent',\n {\n variants: {\n size: {\n sm: \"px-1.5 [&_svg:not([class*='size-'])]:size-3.5\",\n md: \"px-2 [&_svg:not([class*='size-'])]:size-4\",\n lg: \"px-2.5 [&_svg:not([class*='size-'])]:size-4\"\n }\n },\n defaultVariants: {\n size: 'md'\n }\n }\n)\n\nconst numberFieldInputVariants = cva('w-full min-w-0 flex-1 bg-transparent text-center tabular-nums outline-none', {\n variants: {\n size: {\n sm: 'px-2 py-0.5',\n md: 'px-2.5 py-1',\n lg: 'px-2.5 py-1.5'\n }\n },\n defaultVariants: {\n size: 'md'\n }\n})\n\nexport type NumberFieldProps = NumberFieldPrimitive.Root.Props & VariantProps<typeof numberFieldGroupVariants>\n\nfunction NumberField({ id, className, size = 'md', ...props }: NumberFieldProps) {\n const generatedId = useId()\n const fieldControlId = useFieldControlId(id)\n const fieldId = fieldControlId ?? generatedId\n const sizeValue = size ?? 'md'\n\n return (\n <NumberFieldContext.Provider value={{ fieldId, size: sizeValue }}>\n <NumberFieldPrimitive.Root\n className={cn('flex w-full flex-col items-start gap-2', className)}\n data-size={sizeValue}\n data-slot=\"number-field\"\n {...props}\n />\n </NumberFieldContext.Provider>\n )\n}\n\nexport type NumberFieldGroupProps = NumberFieldPrimitive.Group.Props &\n Partial<VariantProps<typeof numberFieldGroupVariants>>\n\nfunction NumberFieldGroup({ className, size: sizeProp, ...props }: NumberFieldGroupProps) {\n const context = useContext(NumberFieldContext)\n if (!context) {\n throw new Error('NumberFieldGroup must be used within a NumberField component.')\n }\n const size = sizeProp ?? context.size\n\n return (\n <NumberFieldPrimitive.Group\n className={cn(numberFieldGroupVariants({ size }), className)}\n data-slot=\"number-field-group\"\n {...props}\n />\n )\n}\n\nexport type NumberFieldDecrementProps = NumberFieldPrimitive.Decrement.Props &\n Partial<VariantProps<typeof numberFieldButtonVariants>> & {\n children?: React.ReactNode\n }\n\nfunction NumberFieldDecrement({ className, size: sizeProp, children, ...props }: NumberFieldDecrementProps) {\n const context = useContext(NumberFieldContext)\n if (!context) {\n throw new Error('NumberFieldDecrement must be used within a NumberField component.')\n }\n const size = sizeProp ?? context.size\n\n return (\n <NumberFieldPrimitive.Decrement\n className={cn(numberFieldButtonVariants({ size }), 'rounded-s-lg border-e-0', className)}\n data-slot=\"number-field-decrement\"\n {...props}\n >\n {children ?? <IconMinus />}\n </NumberFieldPrimitive.Decrement>\n )\n}\n\nexport type NumberFieldIncrementProps = NumberFieldPrimitive.Increment.Props &\n Partial<VariantProps<typeof numberFieldButtonVariants>> & {\n children?: ReactNode\n }\n\nfunction NumberFieldIncrement({ className, size: sizeProp, children, ...props }: NumberFieldIncrementProps) {\n const context = useContext(NumberFieldContext)\n if (!context) {\n throw new Error('NumberFieldIncrement must be used within a NumberField component.')\n }\n const size = sizeProp ?? context.size\n\n return (\n <NumberFieldPrimitive.Increment\n className={cn(numberFieldButtonVariants({ size }), 'rounded-e-lg border-s-0', className)}\n data-slot=\"number-field-increment\"\n {...props}\n >\n {children ?? <IconPlus />}\n </NumberFieldPrimitive.Increment>\n )\n}\n\nexport type NumberFieldInputProps = NumberFieldPrimitive.Input.Props &\n Partial<VariantProps<typeof numberFieldInputVariants>>\n\nfunction NumberFieldInput({ id, className, size: sizeProp, ...props }: NumberFieldInputProps) {\n const context = useContext(NumberFieldContext)\n if (!context) {\n throw new Error('NumberFieldInput must be used within a NumberField component.')\n }\n const size = sizeProp ?? context.size\n\n return (\n <NumberFieldPrimitive.Input\n id={id ?? context.fieldId}\n className={cn(numberFieldInputVariants({ size }), className)}\n data-slot=\"number-field-input\"\n {...props}\n />\n )\n}\n\nexport type NumberFieldScrubAreaProps = NumberFieldPrimitive.ScrubArea.Props & {\n label: string\n}\n\nfunction NumberFieldScrubArea({ className, label, ...props }: NumberFieldScrubAreaProps) {\n const context = useContext(NumberFieldContext)\n if (!context) {\n throw new Error('NumberFieldScrubArea must be used within a NumberField component for accessibility.')\n }\n\n return (\n <NumberFieldPrimitive.ScrubArea\n className={cn('flex cursor-ew-resize', className)}\n data-slot=\"number-field-scrub-area\"\n {...props}\n >\n <Label className=\"cursor-ew-resize\" htmlFor={context.fieldId}>\n {label}\n </Label>\n <NumberFieldPrimitive.ScrubAreaCursor className=\"drop-shadow-[0_1px_1px_#0008] filter\">\n <CursorGrowIcon />\n </NumberFieldPrimitive.ScrubAreaCursor>\n </NumberFieldPrimitive.ScrubArea>\n )\n}\n\nfunction CursorGrowIcon(props: React.ComponentProps<'svg'>) {\n return (\n <svg\n aria-hidden=\"true\"\n fill=\"black\"\n height=\"14\"\n stroke=\"white\"\n viewBox=\"0 0 24 14\"\n width=\"26\"\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <path d=\"M19.5 5.5L6.49737 5.51844V2L1 6.9999L6.5 12L6.49737 8.5L19.5 8.5V12L25 6.9999L19.5 2V5.5Z\" />\n </svg>\n )\n}\n\nexport {\n NumberField,\n NumberFieldDecrement,\n NumberFieldGroup,\n NumberFieldIncrement,\n NumberFieldInput,\n NumberFieldScrubArea\n}\n"],"mappings":"ybAUA,MAAME,EAAqBC,EAGjB,IAAI,EAERC,EAA2BC,EAC/B,2fACA,CACE,SAAU,CACR,KAAM,CACJ,GAAI,cACJ,GAAI,cACJ,GAAI,aACN,CACF,EACA,gBAAiB,CACf,KAAM,IACR,CACF,CACF,EAEMC,EAA4BD,EAChC,+NACA,CACE,SAAU,CACR,KAAM,CACJ,GAAI,gDACJ,GAAI,4CACJ,GAAI,6CACN,CACF,EACA,gBAAiB,CACf,KAAM,IACR,CACF,CACF,EAEME,EAA2BF,EAAI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,EAEJ,SAAA,kBAAC,OAAD,CAAM,EAAE,2FAA6F,CAAA,CAClG,CAAA,CAET"}
1
+ {"version":3,"file":"number-field.js","names":["NumberFieldPrimitive","resolveClassName","NumberField$1","NumberFieldContext","createContext","numberFieldGroupVariants","cva","numberFieldButtonVariants","numberFieldInputVariants","ariaInvalid","props","generatedId","useId","fieldControlId","useFieldControlId","id","invalid","useFieldInvalid","fieldId","sizeValue","size","cn","className","state","sizeProp","context","useContext","toAsChildRenderProps","asChild","children","IconMinus","IconPlus","Label","label"],"sources":["../../src/components/number-field.tsx"],"sourcesContent":["import type * as React from 'react'\nimport { createContext, type ReactNode, useContext, useId } from 'react'\n\nimport { NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field'\nimport { IconMinus, IconPlus } from '@tabler/icons-react'\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { type AsChildPrimitiveProps, toAsChildRenderProps } from '../lib/as-child'\nimport { cn } from '../lib/utils'\nimport { resolveClassName } from '../utils/resolve-class-name'\nimport { useFieldControlId, useFieldInvalid } from './field'\nimport { Label } from './label'\n\nconst NumberFieldContext = createContext<{\n fieldId: string\n size: 'sm' | 'md' | 'lg'\n invalid: React.AriaAttributes['aria-invalid']\n} | null>(null)\n\nconst numberFieldGroupVariants = cva(\n [\n 'relative flex w-full justify-between rounded-lg border border-input bg-transparent transition-colors dark:bg-input/30',\n 'data-disabled:pointer-events-none data-disabled:opacity-50',\n 'focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50',\n 'has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40'\n ],\n {\n variants: {\n size: {\n sm: 'h-7 text-sm',\n md: 'h-8 text-sm',\n lg: 'h-9 text-sm'\n }\n },\n defaultVariants: {\n size: 'md'\n }\n }\n)\n\nconst numberFieldButtonVariants = cva(\n 'relative flex shrink-0 cursor-pointer items-center justify-center transition-colors pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:bg-accent',\n {\n variants: {\n size: {\n sm: \"px-1.5 [&_svg:not([class*='size-'])]:size-3.5\",\n md: \"px-2 [&_svg:not([class*='size-'])]:size-4\",\n lg: \"px-2.5 [&_svg:not([class*='size-'])]:size-4\"\n }\n },\n defaultVariants: {\n size: 'md'\n }\n }\n)\n\nconst numberFieldInputVariants = cva('w-full min-w-0 flex-1 bg-transparent text-center tabular-nums outline-none', {\n variants: {\n size: {\n sm: 'px-2 py-0.5',\n md: 'px-2.5 py-1',\n lg: 'px-2.5 py-1.5'\n }\n },\n defaultVariants: {\n size: 'md'\n }\n})\n\nexport type NumberFieldProps = Omit<NumberFieldPrimitive.Root.Props, 'render'> &\n VariantProps<typeof numberFieldGroupVariants>\n\nfunction NumberField({ id, className, size = 'md', 'aria-invalid': ariaInvalid, ...props }: NumberFieldProps) {\n const generatedId = useId()\n const fieldControlId = useFieldControlId(id)\n const invalid = useFieldInvalid(ariaInvalid)\n const fieldId = fieldControlId ?? generatedId\n const sizeValue = size ?? 'md'\n\n return (\n <NumberFieldContext.Provider value={{ fieldId, size: sizeValue, invalid }}>\n <NumberFieldPrimitive.Root\n className={(state) => cn('flex w-full flex-col items-start gap-2', resolveClassName(className, state))}\n data-size={sizeValue}\n data-slot=\"number-field\"\n {...props}\n />\n </NumberFieldContext.Provider>\n )\n}\n\nexport type NumberFieldGroupProps = AsChildPrimitiveProps<typeof NumberFieldPrimitive.Group> &\n Partial<VariantProps<typeof numberFieldGroupVariants>>\n\nfunction NumberFieldGroup({ className, size: sizeProp, asChild, children, ...props }: NumberFieldGroupProps) {\n const context = useContext(NumberFieldContext)\n if (!context) {\n throw new Error('NumberFieldGroup must be used within a NumberField component.')\n }\n const size = sizeProp ?? context.size\n\n return (\n <NumberFieldPrimitive.Group\n className={(state) => cn(numberFieldGroupVariants({ size }), resolveClassName(className, state))}\n data-slot=\"number-field-group\"\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nexport type NumberFieldDecrementProps = AsChildPrimitiveProps<typeof NumberFieldPrimitive.Decrement> &\n Partial<VariantProps<typeof numberFieldButtonVariants>> & {\n /** Replaces the default minus icon. */\n children?: React.ReactNode\n }\n\nfunction NumberFieldDecrement({ className, size: sizeProp, children, asChild, ...props }: NumberFieldDecrementProps) {\n const context = useContext(NumberFieldContext)\n if (!context) {\n throw new Error('NumberFieldDecrement must be used within a NumberField component.')\n }\n const size = sizeProp ?? context.size\n return (\n <NumberFieldPrimitive.Decrement\n className={(state) =>\n cn(numberFieldButtonVariants({ size }), 'rounded-s-lg border-e-0', resolveClassName(className, state))\n }\n data-slot=\"number-field-decrement\"\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n >\n {!asChild && (children ?? <IconMinus />)}\n </NumberFieldPrimitive.Decrement>\n )\n}\n\nexport type NumberFieldIncrementProps = AsChildPrimitiveProps<typeof NumberFieldPrimitive.Increment> &\n Partial<VariantProps<typeof numberFieldButtonVariants>> & {\n /** Replaces the default plus icon. */\n children?: ReactNode\n }\n\nfunction NumberFieldIncrement({ className, size: sizeProp, children, asChild, ...props }: NumberFieldIncrementProps) {\n const context = useContext(NumberFieldContext)\n if (!context) {\n throw new Error('NumberFieldIncrement must be used within a NumberField component.')\n }\n const size = sizeProp ?? context.size\n return (\n <NumberFieldPrimitive.Increment\n className={(state) =>\n cn(numberFieldButtonVariants({ size }), 'rounded-e-lg border-s-0', resolveClassName(className, state))\n }\n data-slot=\"number-field-increment\"\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n >\n {!asChild && (children ?? <IconPlus />)}\n </NumberFieldPrimitive.Increment>\n )\n}\n\nexport type NumberFieldInputProps = Omit<NumberFieldPrimitive.Input.Props, 'render'> &\n Partial<VariantProps<typeof numberFieldInputVariants>>\n\nfunction NumberFieldInput({ id, className, size: sizeProp, ...props }: NumberFieldInputProps) {\n const context = useContext(NumberFieldContext)\n if (!context) {\n throw new Error('NumberFieldInput must be used within a NumberField component.')\n }\n const size = sizeProp ?? context.size\n\n return (\n <NumberFieldPrimitive.Input\n id={id ?? context.fieldId}\n aria-invalid={context.invalid}\n className={(state) => cn(numberFieldInputVariants({ size }), resolveClassName(className, state))}\n data-slot=\"number-field-input\"\n {...props}\n />\n )\n}\n\nexport type NumberFieldScrubAreaProps = Omit<React.ComponentProps<typeof NumberFieldPrimitive.ScrubArea>, 'render'> & {\n /** Visible label; dragging it changes the value. */\n label: string\n}\n\nfunction NumberFieldScrubArea({ className, label, ...props }: NumberFieldScrubAreaProps) {\n const context = useContext(NumberFieldContext)\n if (!context) {\n throw new Error('NumberFieldScrubArea must be used within a NumberField component for accessibility.')\n }\n\n return (\n <NumberFieldPrimitive.ScrubArea\n className={(state) => cn('flex cursor-ew-resize', resolveClassName(className, state))}\n data-slot=\"number-field-scrub-area\"\n {...props}\n >\n <Label className=\"cursor-ew-resize\" htmlFor={context.fieldId}>\n {label}\n </Label>\n <NumberFieldPrimitive.ScrubAreaCursor className=\"drop-shadow-[0_1px_1px_#0008] filter\">\n <CursorGrowIcon />\n </NumberFieldPrimitive.ScrubAreaCursor>\n </NumberFieldPrimitive.ScrubArea>\n )\n}\n\nfunction CursorGrowIcon(props: React.ComponentProps<'svg'>) {\n return (\n <svg\n aria-hidden=\"true\"\n fill=\"black\"\n height=\"14\"\n stroke=\"white\"\n viewBox=\"0 0 24 14\"\n width=\"26\"\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <path d=\"M19.5 5.5L6.49737 5.51844V2L1 6.9999L6.5 12L6.49737 8.5L19.5 8.5V12L25 6.9999L19.5 2V5.5Z\" />\n </svg>\n )\n}\n\nexport {\n NumberField,\n NumberFieldDecrement,\n NumberFieldGroup,\n NumberFieldIncrement,\n NumberFieldInput,\n NumberFieldScrubArea\n}\n"],"mappings":"8jBAaA,MAAMG,EAAqBC,EAIjB,IAAI,EAERC,EAA2BC,EAC/B,CACE,wHACA,6DACA,yEACA,wLACF,E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AC,EAAGP,EAAiBqB,EAAWC,CAAK,CAAC,EAC/F,YAAU,qBACV,GAAIb,CACL,CAAA,CAEL,CAOA,SAAS,qBAAqB,CAAE,YAAW,QAAO,GAAGA,GAAoC,CACvF,IAAMe,EAAUC,EAAWvB,CAAkB,EAC7C,GAAI,CAACsB,EACH,MAAU,MAAM,qFAAqF,EAGvG,MACE,kBAACzB,EAAqB,UAAtB,CACE,UAAY,GAAUqB,EAAG,wBAAyBpB,EAAiBqB,EAAWC,CAAK,CAAC,EACpF,YAAU,0BACV,GAAIb,EAHN,SAAA,CAKE,kBAACsB,EAAD,CAAO,UAAU,mBAAmB,QAASP,EAAQ,QAClD,SAAAQ,CACI,CAAA,EACP,kBAACjC,EAAqB,gBAAtB,CAAsC,UAAU,uCAC9C,SAAA,kBAAC,eAAD,CAAiB,CAAA,CACmB,CAAA,CACR,GAEpC,CAEA,SAAS,eAAe,EAAoC,CAC1D,MACE,kBAAC,MAAD,CACE,cAAY,OACZ,KAAK,QACL,OAAO,KACP,OAAO,QACP,QAAQ,YACR,MAAM,KACN,MAAM,6BACN,GAAIU,EAEJ,SAAA,kBAAC,OAAD,CAAM,EAAE,2FAA6F,CAAA,CAClG,CAAA,CAET"}
@@ -6,12 +6,21 @@ export type PaginationProps = React.ComponentProps<'nav'> & Pick<React.Component
6
6
  export type PaginationContentProps = React.ComponentProps<'ul'>;
7
7
  export type PaginationItemProps = React.ComponentProps<'li'>;
8
8
  export type PaginationLinkProps = {
9
+ /** Marks the link as the current page. */
9
10
  isActive?: boolean;
10
11
  } & Pick<React.ComponentProps<typeof Button>, 'size' | 'color'> & React.ComponentProps<'a'>;
11
12
  export type PaginationPreviousProps = React.ComponentProps<typeof PaginationLink> & {
13
+ /**
14
+ * Label next to the arrow, shown from `sm` up.
15
+ * @default ''
16
+ */
12
17
  text?: string;
13
18
  };
14
19
  export type PaginationNextProps = React.ComponentProps<typeof PaginationLink> & {
20
+ /**
21
+ * Label next to the arrow, shown from `sm` up.
22
+ * @default ''
23
+ */
15
24
  text?: string;
16
25
  };
17
26
  export type PaginationEllipsisProps = React.ComponentProps<'span'>;
@@ -1,2 +1,2 @@
1
- import"../rolldown-runtime-BhWHdk3m.js";import{cn as e}from"../lib/utils.js";import{Button as t}from"./button.js";import{IconChevronLeft as n,IconChevronRight as r,IconDots as i}from"@tabler/icons-react";import{jsx as a,jsxs as o}from"react/jsx-runtime";import*as s from"react";const c=s.createContext({color:`primary`});function Pagination({className:t,color:n,children:r,...i}){return/* @__PURE__ */ a(c.Provider,{value:{color:n},children:/* @__PURE__ */ a(`nav`,{"aria-label":`pagination`,"data-slot":`pagination`,"data-color":n,className:e(`mx-auto flex w-full justify-center`,t),...i,children:r})})}function PaginationContent({className:t,...n}){return/* @__PURE__ */ a(`ul`,{"data-slot":`pagination-content`,className:e(`flex items-center gap-0.5`,t),...n})}function PaginationItem({...e}){return/* @__PURE__ */ a(`li`,{"data-slot":`pagination-item`,...e})}function PaginationLink({className:n,isActive:r,size:i=`icon`,color:o=`primary`,...l}){let u=s.useContext(c);return/* @__PURE__ */ a(t,{asChild:!0,variant:r?`solid`:`secondary`,color:u.color||o,size:i,className:e(n),children:/* @__PURE__ */ a(`a`,{"aria-current":r?`page`:void 0,"data-slot":`pagination-link`,"data-active":r,...l})})}function PaginationPrevious({className:t,text:r=``,...i}){return/* @__PURE__ */ o(PaginationLink,{"aria-label":`Go to previous page`,size:r?`md`:`icon`,className:e(r&&`pl-1.5!`,t),...i,children:[/* @__PURE__ */ a(n,{"data-icon":`inline-start`}),r&&/* @__PURE__ */ a(`span`,{className:`hidden sm:block`,children:r})]})}function PaginationNext({className:t,text:n=``,...i}){return/* @__PURE__ */ o(PaginationLink,{"aria-label":`Go to next page`,size:n?`md`:`icon`,className:e(n&&`pr-1.5!`,t),...i,children:[n&&/* @__PURE__ */ a(`span`,{className:`hidden sm:block`,children:n}),/* @__PURE__ */ a(r,{"data-icon":`inline-end`})]})}function PaginationEllipsis({className:t,...n}){return/* @__PURE__ */ o(`span`,{"aria-hidden":!0,"data-slot":`pagination-ellipsis`,className:e(`flex size-8 items-center justify-center [&_svg:not([class*='size-'])]:size-4`,t),...n,children:[/* @__PURE__ */ a(i,{}),/* @__PURE__ */ a(`span`,{className:`sr-only`,children:`More pages`})]})}export{Pagination,PaginationContent,PaginationEllipsis,PaginationItem,PaginationLink,PaginationNext,PaginationPrevious};
1
+ import"../rolldown-runtime-BhWHdk3m.js";import{cn as e}from"../lib/utils.js";import{Button as t}from"./button.js";import{IconChevronLeft as n,IconChevronRight as r,IconDots as i}from"@tabler/icons-react";import*as a from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";const c=a.createContext({});function Pagination({className:t,color:n,children:r,...i}){return/* @__PURE__ */ o(c.Provider,{value:{color:n},children:/* @__PURE__ */ o(`nav`,{"aria-label":`pagination`,"data-slot":`pagination`,"data-color":n,className:e(`mx-auto flex w-full justify-center`,t),...i,children:r})})}function PaginationContent({className:t,...n}){return/* @__PURE__ */ o(`ul`,{"data-slot":`pagination-content`,className:e(`flex items-center gap-0.5`,t),...n})}function PaginationItem({...e}){return/* @__PURE__ */ o(`li`,{"data-slot":`pagination-item`,...e})}function PaginationLink({className:n,isActive:r,size:i=`icon`,color:s,...l}){let u=a.useContext(c);return/* @__PURE__ */ o(t,{asChild:!0,variant:r?`solid`:`secondary`,color:s??u.color??`primary`,size:i,className:e(n),children:/* @__PURE__ */ o(`a`,{"aria-current":r?`page`:void 0,"data-slot":`pagination-link`,"data-active":r,...l})})}function PaginationPrevious({className:t,text:r=``,...i}){return/* @__PURE__ */ s(PaginationLink,{"aria-label":`Go to previous page`,size:r?`md`:`icon`,className:e(r&&`pl-1.5!`,t),...i,children:[/* @__PURE__ */ o(n,{"data-icon":`inline-start`}),r&&/* @__PURE__ */ o(`span`,{className:`hidden sm:block`,children:r})]})}function PaginationNext({className:t,text:n=``,...i}){return/* @__PURE__ */ s(PaginationLink,{"aria-label":`Go to next page`,size:n?`md`:`icon`,className:e(n&&`pr-1.5!`,t),...i,children:[n&&/* @__PURE__ */ o(`span`,{className:`hidden sm:block`,children:n}),/* @__PURE__ */ o(r,{"data-icon":`inline-end`})]})}function PaginationEllipsis({className:t,...n}){return/* @__PURE__ */ s(`span`,{"aria-hidden":!0,"data-slot":`pagination-ellipsis`,className:e(`flex size-8 items-center justify-center [&_svg:not([class*='size-'])]:size-4`,t),...n,children:[/* @__PURE__ */ o(i,{}),/* @__PURE__ */ o(`span`,{className:`sr-only`,children:`More pages`})]})}export{Pagination,PaginationContent,PaginationEllipsis,PaginationItem,PaginationLink,PaginationNext,PaginationPrevious};
2
2
  //# sourceMappingURL=pagination.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.js","names":["React","PaginationContext","props","color","cn","className","context","Button","isActive","text","IconChevronLeft","IconChevronRight","IconDots"],"sources":["../../src/components/pagination.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { IconChevronLeft, IconChevronRight, IconDots } from '@tabler/icons-react'\n\nimport { cn } from '../lib/utils'\nimport { Button } from './button'\n\nconst PaginationContext = React.createContext<Pick<React.ComponentProps<typeof Button>, 'color'>>({\n color: 'primary'\n})\n\nexport type PaginationProps = React.ComponentProps<'nav'> & Pick<React.ComponentProps<typeof Button>, 'color'>\n\nexport type PaginationContentProps = React.ComponentProps<'ul'>\n\nexport type PaginationItemProps = React.ComponentProps<'li'>\n\nexport type PaginationLinkProps = {\n isActive?: boolean\n} & Pick<React.ComponentProps<typeof Button>, 'size' | 'color'> &\n React.ComponentProps<'a'>\n\nexport type PaginationPreviousProps = React.ComponentProps<typeof PaginationLink> & {\n text?: string\n}\n\nexport type PaginationNextProps = React.ComponentProps<typeof PaginationLink> & {\n text?: string\n}\n\nexport type PaginationEllipsisProps = React.ComponentProps<'span'>\n\nfunction Pagination({ className, color, children, ...props }: PaginationProps) {\n return (\n <PaginationContext.Provider value={{ color }}>\n <nav\n aria-label=\"pagination\"\n data-slot=\"pagination\"\n data-color={color}\n className={cn('mx-auto flex w-full justify-center', className)}\n {...props}\n >\n {children}\n </nav>\n </PaginationContext.Provider>\n )\n}\n\nfunction PaginationContent({ className, ...props }: PaginationContentProps) {\n return <ul data-slot=\"pagination-content\" className={cn('flex items-center gap-0.5', className)} {...props} />\n}\n\nfunction PaginationItem({ ...props }: PaginationItemProps) {\n return <li data-slot=\"pagination-item\" {...props} />\n}\n\nfunction PaginationLink({ className, isActive, size = 'icon', color = 'primary', ...props }: PaginationLinkProps) {\n const context = React.useContext(PaginationContext)\n\n return (\n <Button\n asChild\n variant={isActive ? 'solid' : 'secondary'}\n color={context.color || color}\n size={size}\n className={cn(className)}\n >\n <a aria-current={isActive ? 'page' : undefined} data-slot=\"pagination-link\" data-active={isActive} {...props} />\n </Button>\n )\n}\n\nfunction PaginationPrevious({ className, text = '', ...props }: PaginationPreviousProps) {\n return (\n <PaginationLink\n aria-label=\"Go to previous page\"\n size={text ? 'md' : 'icon'}\n className={cn(text && 'pl-1.5!', className)}\n {...props}\n >\n <IconChevronLeft data-icon=\"inline-start\" />\n {text && <span className=\"hidden sm:block\">{text}</span>}\n </PaginationLink>\n )\n}\n\nfunction PaginationNext({ className, text = '', ...props }: PaginationNextProps) {\n return (\n <PaginationLink\n aria-label=\"Go to next page\"\n size={text ? 'md' : 'icon'}\n className={cn(text && 'pr-1.5!', className)}\n {...props}\n >\n {text && <span className=\"hidden sm:block\">{text}</span>}\n <IconChevronRight data-icon=\"inline-end\" />\n </PaginationLink>\n )\n}\n\nfunction PaginationEllipsis({ className, ...props }: PaginationEllipsisProps) {\n return (\n <span\n aria-hidden\n data-slot=\"pagination-ellipsis\"\n className={cn(\"flex size-8 items-center justify-center [&_svg:not([class*='size-'])]:size-4\", className)}\n {...props}\n >\n <IconDots />\n <span className=\"sr-only\">More pages</span>\n </span>\n )\n}\n\nexport {\n Pagination,\n PaginationContent,\n PaginationEllipsis,\n PaginationItem,\n PaginationLink,\n PaginationNext,\n PaginationPrevious\n}\n"],"mappings":"sRAOA,MAAMC,EAAoBD,EAAM,cA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EpB,CAEA,SAAS,eAAe,CAAE,YAAW,OAAO,GAAI,GAAGP,GAA8B,CAC/E,MACE,kBAAC,eAAD,CACE,aAAW,kBACX,KAAMO,EAAO,KAAO,OACpB,UAAWL,EAAGK,GAAQ,UAAWJ,CAAS,EAC1C,GAAIH,EAJN,SAAA,CAMGO,GAAQ,kBAAC,OAAD,CAAM,UAAU,kBAAmB,SAAAA,CAAW,CAAA,EACvD,kBAACE,EAAD,CAAkB,YAAU,YAAc,CAAA,CAC5B,GAEpB,CAEA,SAAS,mBAAmB,CAAE,YAAW,GAAGT,GAAkC,CAC5E,MACE,kBAAC,OAAD,CACE,cAAA,GACA,YAAU,sBACV,UAAWE,EAAG,+EAAgFC,CAAS,EACvG,GAAIH,EAJN,SAAA,CAME,kBAACU,EAAD,CAAW,CAAA,EACX,kBAAC,OAAD,CAAM,UAAU,UAAU,SAAA,YAAgB,CAAA,CACtC,GAEV"}
1
+ {"version":3,"file":"pagination.js","names":["React","PaginationContext","props","color","cn","className","context","Button","isActive","text","IconChevronLeft","IconChevronRight","IconDots"],"sources":["../../src/components/pagination.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { IconChevronLeft, IconChevronRight, IconDots } from '@tabler/icons-react'\n\nimport { cn } from '../lib/utils'\nimport { Button } from './button'\n\nconst PaginationContext = React.createContext<Pick<React.ComponentProps<typeof Button>, 'color'>>({})\n\nexport type PaginationProps = React.ComponentProps<'nav'> & Pick<React.ComponentProps<typeof Button>, 'color'>\n\nexport type PaginationContentProps = React.ComponentProps<'ul'>\n\nexport type PaginationItemProps = React.ComponentProps<'li'>\n\nexport type PaginationLinkProps = {\n /** Marks the link as the current page. */\n isActive?: boolean\n} & Pick<React.ComponentProps<typeof Button>, 'size' | 'color'> &\n React.ComponentProps<'a'>\n\nexport type PaginationPreviousProps = React.ComponentProps<typeof PaginationLink> & {\n /**\n * Label next to the arrow, shown from `sm` up.\n * @default ''\n */\n text?: string\n}\n\nexport type PaginationNextProps = React.ComponentProps<typeof PaginationLink> & {\n /**\n * Label next to the arrow, shown from `sm` up.\n * @default ''\n */\n text?: string\n}\n\nexport type PaginationEllipsisProps = React.ComponentProps<'span'>\n\nfunction Pagination({ className, color, children, ...props }: PaginationProps) {\n return (\n <PaginationContext.Provider value={{ color }}>\n <nav\n aria-label=\"pagination\"\n data-slot=\"pagination\"\n data-color={color}\n className={cn('mx-auto flex w-full justify-center', className)}\n {...props}\n >\n {children}\n </nav>\n </PaginationContext.Provider>\n )\n}\n\nfunction PaginationContent({ className, ...props }: PaginationContentProps) {\n return <ul data-slot=\"pagination-content\" className={cn('flex items-center gap-0.5', className)} {...props} />\n}\n\nfunction PaginationItem({ ...props }: PaginationItemProps) {\n return <li data-slot=\"pagination-item\" {...props} />\n}\n\nfunction PaginationLink({ className, isActive, size = 'icon', color, ...props }: PaginationLinkProps) {\n const context = React.useContext(PaginationContext)\n\n return (\n <Button\n asChild\n variant={isActive ? 'solid' : 'secondary'}\n color={color ?? context.color ?? 'primary'}\n size={size}\n className={cn(className)}\n >\n <a aria-current={isActive ? 'page' : undefined} data-slot=\"pagination-link\" data-active={isActive} {...props} />\n </Button>\n )\n}\n\nfunction PaginationPrevious({ className, text = '', ...props }: PaginationPreviousProps) {\n return (\n <PaginationLink\n aria-label=\"Go to previous page\"\n size={text ? 'md' : 'icon'}\n className={cn(text && 'pl-1.5!', className)}\n {...props}\n >\n <IconChevronLeft data-icon=\"inline-start\" />\n {text && <span className=\"hidden sm:block\">{text}</span>}\n </PaginationLink>\n )\n}\n\nfunction PaginationNext({ className, text = '', ...props }: PaginationNextProps) {\n return (\n <PaginationLink\n aria-label=\"Go to next page\"\n size={text ? 'md' : 'icon'}\n className={cn(text && 'pr-1.5!', className)}\n {...props}\n >\n {text && <span className=\"hidden sm:block\">{text}</span>}\n <IconChevronRight data-icon=\"inline-end\" />\n </PaginationLink>\n )\n}\n\nfunction PaginationEllipsis({ className, ...props }: PaginationEllipsisProps) {\n return (\n <span\n aria-hidden\n data-slot=\"pagination-ellipsis\"\n className={cn(\"flex size-8 items-center justify-center [&_svg:not([class*='size-'])]:size-4\", className)}\n {...props}\n >\n <IconDots />\n <span className=\"sr-only\">More pages</span>\n </span>\n )\n}\n\nexport {\n Pagination,\n PaginationContent,\n PaginationEllipsis,\n PaginationItem,\n PaginationLink,\n PaginationNext,\n PaginationPrevious\n}\n"],"mappings":"sRAOA,MAAMC,EAAoBD,EAAM,cAAkE,CAAC,CAAC,EAgCpG,SAAS,WAAW,CAAE,YAAW,QAAO,WAAU,GAAGE,GAA0B,CAC7E,MACE,kBAACD,EAAkB,SAAnB,CAA4B,MAAO,CAAE,OAAM,EACzC,SAAA,kBAAC,MAAD,CACE,aAAW,aACX,YAAU,aACV,aAAYE,EACZ,UAAWC,EAAG,qCAAsCC,CAAS,EAC7D,GAAIH,EAEH,UACE,CAAA,CACqB,CAAA,CAEhC,CAEA,SAAS,kBAAkB,CAAE,YAAW,GAAGA,GAAiC,CAC1E,MAAO,kBAAC,KAAD,CAAI,YAAU,qBAAqB,UAAWE,EAAG,4BAA6BC,CAAS,EAAG,GAAIH,CAAQ,CAAA,CAC/G,CAEA,SAAS,eAAe,CAAE,GAAGA,GAA8B,CACzD,MAAO,kBAAC,KAAD,CAAI,YAAU,kBAAkB,GAAIA,CAAQ,CAAA,CACrD,CAEA,SAAS,eAAe,CAAE,YAAW,WAAU,OAAO,OAAQ,QAAO,GAAGA,GAA8B,CACpG,IAAMI,EAAUN,EAAM,WAAWC,CAAiB,EAElD,MACE,kBAACM,EAAD,CACE,QAAA,GACA,QAASC,EAAW,QAAU,YAC9B,MAAOL,GAASG,EAAQ,OAAS,UAC3B,OACN,UAAWF,EAAGC,CAAS,EAEvB,SAAA,kBAAC,IAAD,CAAG,eAAcG,EAAW,OAAS,IAAA,GAAW,YAAU,kBAAkB,cAAaA,EAAU,GAAIN,CAAQ,CAAA,CACzG,CAAA,CAEZ,CAEA,SAAS,mBAAmB,CAAE,YAAW,OAAO,GAAI,GAAGA,GAAkC,CACvF,MACE,kBAAC,eAAD,CACE,aAAW,sBACX,KAAMO,EAAO,KAAO,OACpB,UAAWL,EAAGK,GAAQ,UAAWJ,CAAS,EAC1C,GAAIH,EAJN,SAAA,CAME,kBAACQ,EAAD,CAAiB,YAAU,cAAgB,CAAA,EAC1CD,GAAQ,kBAAC,OAAD,CAAM,UAAU,kBAAmB,SAAAA,CAAW,CAAA,CACzC,GAEpB,CAEA,SAAS,eAAe,CAAE,YAAW,OAAO,GAAI,GAAGP,GAA8B,CAC/E,MACE,kBAAC,eAAD,CACE,aAAW,kBACX,KAAMO,EAAO,KAAO,OACpB,UAAWL,EAAGK,GAAQ,UAAWJ,CAAS,EAC1C,GAAIH,EAJN,SAAA,CAMGO,GAAQ,kBAAC,OAAD,CAAM,UAAU,kBAAmB,SAAAA,CAAW,CAAA,EACvD,kBAACE,EAAD,CAAkB,YAAU,YAAc,CAAA,CAC5B,GAEpB,CAEA,SAAS,mBAAmB,CAAE,YAAW,GAAGT,GAAkC,CAC5E,MACE,kBAAC,OAAD,CACE,cAAA,GACA,YAAU,sBACV,UAAWE,EAAG,+EAAgFC,CAAS,EACvG,GAAIH,EAJN,SAAA,CAME,kBAACU,EAAD,CAAW,CAAA,EACX,kBAAC,OAAD,CAAM,UAAU,UAAU,SAAA,YAAgB,CAAA,CACtC,GAEV"}
@@ -3,8 +3,11 @@ import { ComponentProps } from "react";
3
3
  import * as BasePhoneInput from "react-phone-number-input";
4
4
  //#region src/components/phone-input.d.ts
5
5
  export type PhoneInputProps = Omit<ComponentProps<'input'>, 'onChange' | 'value' | 'ref'> & Omit<BasePhoneInput.Props<typeof BasePhoneInput.default>, 'onChange' | 'popupClassName' | 'scrollAreaClassName'> & {
6
+ /** Called with the number in E.164 format, or an empty string when the input is cleared. */
6
7
  onChange?: (value: BasePhoneInput.Value) => void;
8
+ /** Classes for the country list popup. */
7
9
  popupClassName?: string;
10
+ /** Classes for the scrollable area of the country list. */
8
11
  scrollAreaClassName?: string;
9
12
  };
10
13
  export type PhoneInputValue = BasePhoneInput.Value;
@@ -1,2 +1,2 @@
1
- import"../rolldown-runtime-BhWHdk3m.js";import{cn as e}from"../lib/utils.js";import{Button as t}from"./button.js";import{Input as n}from"./input.js";import{Combobox as r,ComboboxContent as i,ComboboxEmpty as a,ComboboxInput as o,ComboboxItem as s,ComboboxList as c,ComboboxSeparator as l,ComboboxTrigger as u,ComboboxValue as d}from"./combobox.js";import{ScrollArea as f}from"./scroll-area.js";import{IconWorld as p}from"@tabler/icons-react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import{createContext as g,useContext as _,useMemo as v,useState as y}from"react";import*as b from"react-phone-number-input";import x from"react-phone-number-input/flags";const S=g({popupClassName:void 0,scrollAreaClassName:void 0});function PhoneInput({className:t,popupClassName:n,scrollAreaClassName:r,onChange:i,value:a,...o}){return/* @__PURE__ */ m(S.Provider,{value:{popupClassName:n,scrollAreaClassName:r},children:/* @__PURE__ */ m(b.default,{className:e(`flex`,o[`aria-invalid`]&&`[&_*[data-slot=combobox-trigger]]:border-destructive [&_*[data-slot=combobox-trigger]]:ring-destructive/50`,t),flagComponent:FlagComponent,countrySelectComponent:CountrySelect,inputComponent:InputComponent,smartCaret:!1,defaultCountry:`BR`,value:a||void 0,onChange:e=>i?.(e||``),...o})})}function InputComponent({className:t,...r}){return/* @__PURE__ */ m(n,{className:e(`rounded-s-none focus:z-1`,t),...r})}function CountrySelect({disabled:n,value:p,options:g,onChange:x}){let{popupClassName:C}=_(S),[w,T]=y(``),E=v(()=>w?g.filter(({label:e})=>e.toLowerCase().includes(w.toLowerCase())):g,[g,w]);return/* @__PURE__ */ h(r,{items:E,value:p||``,onValueChange:e=>{e&&x(e)},children:[/* @__PURE__ */ m(u,{render:/* @__PURE__ */ h(t,{variant:`outline`,color:`zinc`,className:e(`flex h-8 items-center gap-1 rounded-s-lg rounded-e-none border-e-0 border-input px-2.5 py-0 leading-none dark:bg-input/30`,`hover:bg-transparent focus:z-10 data-pressed:bg-transparent`,n&&`opacity-50`),disabled:n,children:[/* @__PURE__ */ m(`span`,{className:`sr-only`,children:/* @__PURE__ */ m(d,{})}),/* @__PURE__ */ m(FlagComponent,{country:p,countryName:p})]})}),/* @__PURE__ */ h(i,{className:e(`w-xs *:data-[slot=input-group]:bg-transparent`,C),children:[/* @__PURE__ */ m(o,{placeholder:`e.g. United States`,value:w,onChange:e=>T(e.target.value),showTrigger:!1,className:`border-input focus-visible:border-border rounded-none border-0 px-0 py-2.5 shadow-none ring-0! outline-none! focus-visible:ring-0 focus-visible:ring-offset-0`}),/* @__PURE__ */ m(l,{}),/* @__PURE__ */ m(a,{className:`px-4 py-2.5 text-sm`,children:`Nenhum país encontrado.`}),/* @__PURE__ */ m(c,{children:/* @__PURE__ */ m(`div`,{className:`relative flex max-h-full`,children:/* @__PURE__ */ m(`div`,{className:`flex max-h-[min(var(--available-height),24rem)] w-full scroll-pt-2 scroll-pb-2 flex-col overscroll-contain`,children:/* @__PURE__ */ m(f,{className:`size-full min-h-0 **:data-[slot=scroll-area-scrollbar]:m-0 **:data-[slot=scroll-area-viewport]:h-full **:data-[slot=scroll-area-viewport]:overscroll-contain`,children:E.map(e=>e.value?/* @__PURE__ */ h(s,{value:e.value,className:`flex items-center gap-2`,children:[/* @__PURE__ */ m(FlagComponent,{country:e.value,countryName:e.label}),/* @__PURE__ */ m(`span`,{className:`flex-1 text-sm`,children:e.label}),/* @__PURE__ */ m(`span`,{className:`text-foreground/50 text-sm`,children:`+${b.getCountryCallingCode(e.value)}`})]},e.value):null)})})})})]})]})}function FlagComponent({country:e,countryName:t}){let n=x[e];return/* @__PURE__ */ m(`span`,{className:`flex h-4 w-4 items-center justify-center [&_svg:not([class*='size-'])]:size-full! [&_svg:not([class*='size-'])]:rounded-[5px]`,children:n?/* @__PURE__ */ m(n,{title:t}):/* @__PURE__ */ m(p,{className:`size-4 opacity-60`})})}export{PhoneInput};
1
+ import"../rolldown-runtime-BhWHdk3m.js";import{cn as e}from"../lib/utils.js";import{Button as t}from"./button.js";import{useFieldInvalid as n}from"./field.js";import{Input as r}from"./input.js";import{Combobox as i,ComboboxContent as a,ComboboxEmpty as o,ComboboxInput as s,ComboboxItem as c,ComboboxList as l,ComboboxSeparator as u,ComboboxTrigger as d,ComboboxValue as f}from"./combobox.js";import{ScrollArea as p}from"./scroll-area.js";import{IconWorld as m}from"@tabler/icons-react";import{createContext as h,useContext as g,useMemo as _,useState as v}from"react";import{jsx as y,jsxs as b}from"react/jsx-runtime";import*as x from"react-phone-number-input";import S from"react-phone-number-input/flags";const C=h({popupClassName:void 0,scrollAreaClassName:void 0});function PhoneInput({className:t,popupClassName:r,scrollAreaClassName:i,onChange:a,value:o,...s}){let c=n(s[`aria-invalid`]);return/* @__PURE__ */ y(C.Provider,{value:{popupClassName:r,scrollAreaClassName:i},children:/* @__PURE__ */ y(x.default,{className:e(`flex`,c&&c!==`false`&&`[&_*[data-slot=combobox-trigger]]:border-destructive [&_*[data-slot=combobox-trigger]]:ring-destructive/50`,t),flagComponent:FlagComponent,countrySelectComponent:CountrySelect,inputComponent:InputComponent,smartCaret:!1,defaultCountry:`BR`,value:o||void 0,onChange:e=>a?.(e||``),...s})})}function InputComponent({className:t,...n}){return/* @__PURE__ */ y(r,{className:e(`rounded-s-none focus:z-1`,t),...n})}function CountrySelect({disabled:n,value:r,options:m,onChange:h}){let{popupClassName:S}=g(C),[w,T]=v(``),E=_(()=>w?m.filter(({label:e})=>e.toLowerCase().includes(w.toLowerCase())):m,[m,w]);return/* @__PURE__ */ b(i,{items:E,value:r||``,onValueChange:e=>{e&&h(e)},children:[/* @__PURE__ */ y(d,{asChild:!0,children:/* @__PURE__ */ b(t,{variant:`outline`,color:`zinc`,className:e(`flex h-8 items-center gap-1 rounded-s-lg rounded-e-none border-e-0 border-input px-2.5 py-0 leading-none dark:bg-input/30`,`hover:bg-transparent focus:z-10 data-pressed:bg-transparent`,n&&`opacity-50`),disabled:n,children:[/* @__PURE__ */ y(`span`,{className:`sr-only`,children:/* @__PURE__ */ y(f,{})}),/* @__PURE__ */ y(FlagComponent,{country:r,countryName:r})]})}),/* @__PURE__ */ b(a,{className:e(`w-xs *:data-[slot=input-group]:bg-transparent`,S),children:[/* @__PURE__ */ y(s,{placeholder:`e.g. United States`,value:w,onChange:e=>T(e.target.value),showTrigger:!1,className:`border-input focus-visible:border-border rounded-none border-0 px-0 py-2.5 shadow-none ring-0! outline-none! focus-visible:ring-0 focus-visible:ring-offset-0`}),/* @__PURE__ */ y(u,{}),/* @__PURE__ */ y(o,{className:`px-4 py-2.5 text-sm`,children:`Nenhum país encontrado.`}),/* @__PURE__ */ y(l,{className:`max-h-none overflow-visible`,children:/* @__PURE__ */ y(`div`,{className:`relative flex max-h-full`,children:/* @__PURE__ */ y(`div`,{className:`flex max-h-[min(calc(var(--available-height)-(--spacing(9))),24rem)] w-full scroll-pt-2 scroll-pb-2 flex-col overscroll-contain`,children:/* @__PURE__ */ y(p,{className:`size-full min-h-0 **:data-[slot=scroll-area-scrollbar]:m-0 **:data-[slot=scroll-area-viewport]:h-full **:data-[slot=scroll-area-viewport]:overscroll-contain`,children:E.map(e=>e.value?/* @__PURE__ */ b(c,{value:e.value,className:`flex items-center gap-2`,children:[/* @__PURE__ */ y(FlagComponent,{country:e.value,countryName:e.label}),/* @__PURE__ */ y(`span`,{className:`flex-1 text-sm`,children:e.label}),/* @__PURE__ */ y(`span`,{className:`text-foreground/50 text-sm`,children:`+${x.getCountryCallingCode(e.value)}`})]},e.value):null)})})})})]})]})}function FlagComponent({country:e,countryName:t}){let n=S[e];return/* @__PURE__ */ y(`span`,{className:`flex h-4 w-4 items-center justify-center [&_svg:not([class*='size-'])]:size-full! [&_svg:not([class*='size-'])]:rounded-[5px]`,children:n?/* @__PURE__ */ y(n,{title:t}):/* @__PURE__ */ y(m,{className:`size-4 opacity-60`})})}export{PhoneInput};
2
2
  //# sourceMappingURL=phone-input.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"phone-input.js","names":["BasePhoneInput","flags","PhoneInputContext","createContext","props","cn","className","value","onChange","Input","selectedCountry","countryList","useContext","searchValue","setSearchValue","useState","filteredCountries","useMemo","label","Combobox","country","ComboboxTrigger","Button","disabled","ComboboxValue","ComboboxContent","popupClassName","ComboboxInput","ComboboxSeparator","ComboboxEmpty","ComboboxList","ScrollArea","item","ComboboxItem","Flag","countryName","IconWorld"],"sources":["../../src/components/phone-input.tsx"],"sourcesContent":["import { type ComponentProps, createContext, useContext, useMemo, useState } from 'react'\nimport * as BasePhoneInput from 'react-phone-number-input'\nimport flags from 'react-phone-number-input/flags'\n\nimport { IconWorld } from '@tabler/icons-react'\n\nimport { cn } from '../lib/utils'\nimport { Button } from './button'\nimport {\n Combobox,\n ComboboxContent,\n ComboboxEmpty,\n ComboboxInput,\n ComboboxItem,\n ComboboxList,\n ComboboxSeparator,\n ComboboxTrigger,\n ComboboxValue\n} from './combobox'\nimport { Input } from './input'\nimport { ScrollArea } from './scroll-area'\n\nconst PhoneInputContext = createContext<{\n popupClassName?: string\n scrollAreaClassName?: string\n}>({\n popupClassName: undefined,\n scrollAreaClassName: undefined\n})\n\nexport type PhoneInputProps = Omit<ComponentProps<'input'>, 'onChange' | 'value' | 'ref'> &\n Omit<BasePhoneInput.Props<typeof BasePhoneInput.default>, 'onChange' | 'popupClassName' | 'scrollAreaClassName'> & {\n onChange?: (value: BasePhoneInput.Value) => void\n popupClassName?: string\n scrollAreaClassName?: string\n }\n\nexport type PhoneInputValue = BasePhoneInput.Value\nexport type PhoneInputCountry = BasePhoneInput.Country\nexport type PhoneInputLabels = BasePhoneInput.Labels\n\nfunction PhoneInput({ className, popupClassName, scrollAreaClassName, onChange, value, ...props }: PhoneInputProps) {\n return (\n <PhoneInputContext.Provider value={{ popupClassName, scrollAreaClassName }}>\n <BasePhoneInput.default\n className={cn(\n 'flex',\n props['aria-invalid'] &&\n '[&_*[data-slot=combobox-trigger]]:border-destructive [&_*[data-slot=combobox-trigger]]:ring-destructive/50',\n className\n )}\n flagComponent={FlagComponent}\n countrySelectComponent={CountrySelect}\n inputComponent={InputComponent}\n smartCaret={false}\n defaultCountry=\"BR\"\n value={value || undefined}\n onChange={(value) => onChange?.(value || ('' as BasePhoneInput.Value))}\n {...props}\n />\n </PhoneInputContext.Provider>\n )\n}\n\nfunction InputComponent({ className, ...props }: ComponentProps<typeof Input>) {\n return <Input className={cn('rounded-s-none focus:z-1', className)} {...props} />\n}\n\ntype CountryEntry = { label: string; value: BasePhoneInput.Country | undefined }\n\ntype CountrySelectProps = {\n disabled?: boolean\n value: BasePhoneInput.Country\n options: CountryEntry[]\n onChange: (country: BasePhoneInput.Country) => void\n}\n\nfunction CountrySelect({ disabled, value: selectedCountry, options: countryList, onChange }: CountrySelectProps) {\n const { popupClassName } = useContext(PhoneInputContext)\n const [searchValue, setSearchValue] = useState('')\n\n const filteredCountries = useMemo(() => {\n if (!searchValue) return countryList\n return countryList.filter(({ label }) => label.toLowerCase().includes(searchValue.toLowerCase()))\n }, [countryList, searchValue])\n\n return (\n <Combobox\n items={filteredCountries}\n value={selectedCountry || ''}\n onValueChange={(country: BasePhoneInput.Country | null) => {\n if (country) {\n onChange(country)\n }\n }}\n >\n <ComboboxTrigger\n render={\n <Button\n variant=\"outline\"\n color=\"zinc\"\n className={cn(\n 'flex h-8 items-center gap-1 rounded-s-lg rounded-e-none border-e-0 border-input px-2.5 py-0 leading-none dark:bg-input/30',\n 'hover:bg-transparent focus:z-10 data-pressed:bg-transparent',\n disabled && 'opacity-50'\n )}\n disabled={disabled}\n >\n <span className=\"sr-only\">\n <ComboboxValue />\n </span>\n <FlagComponent country={selectedCountry} countryName={selectedCountry} />\n </Button>\n }\n />\n <ComboboxContent className={cn('w-xs *:data-[slot=input-group]:bg-transparent', popupClassName)}>\n <ComboboxInput\n placeholder=\"e.g. United States\"\n value={searchValue}\n onChange={(e) => setSearchValue(e.target.value)}\n showTrigger={false}\n className=\"border-input focus-visible:border-border rounded-none border-0 px-0 py-2.5 shadow-none ring-0! outline-none! focus-visible:ring-0 focus-visible:ring-offset-0\"\n />\n <ComboboxSeparator />\n <ComboboxEmpty className=\"px-4 py-2.5 text-sm\">Nenhum país encontrado.</ComboboxEmpty>\n <ComboboxList>\n <div className=\"relative flex max-h-full\">\n <div className=\"flex max-h-[min(var(--available-height),24rem)] w-full scroll-pt-2 scroll-pb-2 flex-col overscroll-contain\">\n <ScrollArea className=\"size-full min-h-0 **:data-[slot=scroll-area-scrollbar]:m-0 **:data-[slot=scroll-area-viewport]:h-full **:data-[slot=scroll-area-viewport]:overscroll-contain\">\n {filteredCountries.map((item: CountryEntry) =>\n item.value ? (\n <ComboboxItem key={item.value} value={item.value} className=\"flex items-center gap-2\">\n <FlagComponent country={item.value} countryName={item.label} />\n <span className=\"flex-1 text-sm\">{item.label}</span>\n <span className=\"text-foreground/50 text-sm\">\n {`+${BasePhoneInput.getCountryCallingCode(item.value)}`}\n </span>\n </ComboboxItem>\n ) : null\n )}\n </ScrollArea>\n </div>\n </div>\n </ComboboxList>\n </ComboboxContent>\n </Combobox>\n )\n}\n\nfunction FlagComponent({ country, countryName }: BasePhoneInput.FlagProps) {\n const Flag = flags[country]\n\n return (\n <span className=\"flex h-4 w-4 items-center justify-center [&_svg:not([class*='size-'])]:size-full! [&_svg:not([class*='size-'])]:rounded-[5px]\">\n {Flag ? <Flag title={countryName} /> : <IconWorld className=\"size-4 opacity-60\" />}\n </span>\n )\n}\n\nexport { PhoneInput }\n"],"mappings":"spBAsBA,MAAME,EAAoBC,EAGvB,CACD,eAAgB,IAAA,GAChB,oBAAqB,IAAA,EACvB,CAAC,EAaD,SAAS,WAAW,CAAE,YAAW,iBAAgB,sBAAqB,WAAU,QAAO,GAAGC,GAA0B,CAClH,MACE,kBAACF,EAAkB,SAAnB,CAA4B,MAAO,CAAE,iBAAgB,qBAAoB,EACvE,SAAA,kBAACF,EAAe,QAAhB,CACE,UAAWK,EACT,OACAD,EAAM,iBACJ,6GACFE,CACF,EACA,cAAe,cACf,uBAAwB,cACxB,eAAgB,eAChB,WAAY,GACZ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A,yBAAsC,CAAA,EACrF,kBAACC,EAAD,CAAA,SACE,kBAAC,MAAD,CAAK,UAAU,2BACb,SAAA,kBAAC,MAAD,CAAK,UAAU,6GACb,SAAA,kBAACC,EAAD,CAAY,UAAU,+JACnB,SAAAf,EAAkB,IAAK,GACtBgB,EAAK,MACH,kBAACC,EAAD,CAA+B,MAAOD,EAAK,MAAO,UAAU,0BAA5D,SAAA,CACE,kBAAC,cAAD,CAAe,QAASA,EAAK,MAAO,YAAaA,EAAK,KAAQ,CAAA,EAC9D,kBAAC,OAAD,CAAM,UAAU,iBAAkB,SAAAA,EAAK,KAAY,CAAA,EACnD,kBAAC,OAAD,CAAM,UAAU,6BACb,SAAA,IAAIhC,EAAe,sBAAsBgC,EAAK,KAAK,GAChD,CAAA,CACM,CANK,EAAAA,EAAK,KAMV,EACZ,IACN,CACU,CAAA,CACT,CAAA,CACF,CAAA,CACO,CAAA,CACC,CACT,CAAA,CAAA,GAEd,CAEA,SAAS,cAAc,CAAE,UAAS,eAAyC,CACzE,IAAME,EAAOjC,EAAMmB,GAEnB,MACE,kBAAC,OAAD,CAAM,UAAU,gIACb,SAAAc,EAAO,kBAACA,EAAD,CAAM,MAAOC,CAAc,CAAA,EAAI,kBAACC,EAAD,CAAW,UAAU,mBAAqB,CAAA,CAC7E,CAAA,CAEV"}
1
+ {"version":3,"file":"phone-input.js","names":["BasePhoneInput","flags","PhoneInputContext","createContext","props","invalid","useFieldInvalid","cn","className","value","onChange","Input","selectedCountry","countryList","useContext","searchValue","setSearchValue","useState","filteredCountries","useMemo","label","Combobox","country","ComboboxTrigger","Button","disabled","ComboboxValue","ComboboxContent","popupClassName","ComboboxInput","ComboboxSeparator","ComboboxEmpty","ComboboxList","ScrollArea","item","ComboboxItem","Flag","countryName","IconWorld"],"sources":["../../src/components/phone-input.tsx"],"sourcesContent":["import { type ComponentProps, createContext, useContext, useMemo, useState } from 'react'\nimport * as BasePhoneInput from 'react-phone-number-input'\nimport flags from 'react-phone-number-input/flags'\n\nimport { IconWorld } from '@tabler/icons-react'\n\nimport { cn } from '../lib/utils'\nimport { Button } from './button'\nimport {\n Combobox,\n ComboboxContent,\n ComboboxEmpty,\n ComboboxInput,\n ComboboxItem,\n ComboboxList,\n ComboboxSeparator,\n ComboboxTrigger,\n ComboboxValue\n} from './combobox'\nimport { useFieldInvalid } from './field'\nimport { Input } from './input'\nimport { ScrollArea } from './scroll-area'\n\nconst PhoneInputContext = createContext<{\n popupClassName?: string\n scrollAreaClassName?: string\n}>({\n popupClassName: undefined,\n scrollAreaClassName: undefined\n})\n\nexport type PhoneInputProps = Omit<ComponentProps<'input'>, 'onChange' | 'value' | 'ref'> &\n Omit<BasePhoneInput.Props<typeof BasePhoneInput.default>, 'onChange' | 'popupClassName' | 'scrollAreaClassName'> & {\n /** Called with the number in E.164 format, or an empty string when the input is cleared. */\n onChange?: (value: BasePhoneInput.Value) => void\n /** Classes for the country list popup. */\n popupClassName?: string\n /** Classes for the scrollable area of the country list. */\n scrollAreaClassName?: string\n }\n\nexport type PhoneInputValue = BasePhoneInput.Value\nexport type PhoneInputCountry = BasePhoneInput.Country\nexport type PhoneInputLabels = BasePhoneInput.Labels\n\nfunction PhoneInput({ className, popupClassName, scrollAreaClassName, onChange, value, ...props }: PhoneInputProps) {\n const invalid = useFieldInvalid(props['aria-invalid'])\n\n return (\n <PhoneInputContext.Provider value={{ popupClassName, scrollAreaClassName }}>\n <BasePhoneInput.default\n className={cn(\n 'flex',\n invalid &&\n invalid !== 'false' &&\n '[&_*[data-slot=combobox-trigger]]:border-destructive [&_*[data-slot=combobox-trigger]]:ring-destructive/50',\n className\n )}\n flagComponent={FlagComponent}\n countrySelectComponent={CountrySelect}\n inputComponent={InputComponent}\n smartCaret={false}\n defaultCountry=\"BR\"\n value={value || undefined}\n onChange={(value) => onChange?.(value || ('' as BasePhoneInput.Value))}\n {...props}\n />\n </PhoneInputContext.Provider>\n )\n}\n\nfunction InputComponent({ className, ...props }: ComponentProps<typeof Input>) {\n return <Input className={cn('rounded-s-none focus:z-1', className)} {...props} />\n}\n\ntype CountryEntry = { label: string; value: BasePhoneInput.Country | undefined }\n\ntype CountrySelectProps = {\n disabled?: boolean\n value: BasePhoneInput.Country\n options: CountryEntry[]\n onChange: (country: BasePhoneInput.Country) => void\n}\n\nfunction CountrySelect({ disabled, value: selectedCountry, options: countryList, onChange }: CountrySelectProps) {\n const { popupClassName } = useContext(PhoneInputContext)\n const [searchValue, setSearchValue] = useState('')\n\n const filteredCountries = useMemo(() => {\n if (!searchValue) return countryList\n return countryList.filter(({ label }) => label.toLowerCase().includes(searchValue.toLowerCase()))\n }, [countryList, searchValue])\n\n return (\n <Combobox\n items={filteredCountries}\n value={selectedCountry || ''}\n onValueChange={(country: BasePhoneInput.Country | null) => {\n if (country) {\n onChange(country)\n }\n }}\n >\n <ComboboxTrigger asChild>\n <Button\n variant=\"outline\"\n color=\"zinc\"\n className={cn(\n 'flex h-8 items-center gap-1 rounded-s-lg rounded-e-none border-e-0 border-input px-2.5 py-0 leading-none dark:bg-input/30',\n 'hover:bg-transparent focus:z-10 data-pressed:bg-transparent',\n disabled && 'opacity-50'\n )}\n disabled={disabled}\n >\n <span className=\"sr-only\">\n <ComboboxValue />\n </span>\n <FlagComponent country={selectedCountry} countryName={selectedCountry} />\n </Button>\n </ComboboxTrigger>\n <ComboboxContent className={cn('w-xs *:data-[slot=input-group]:bg-transparent', popupClassName)}>\n <ComboboxInput\n placeholder=\"e.g. United States\"\n value={searchValue}\n onChange={(e) => setSearchValue(e.target.value)}\n showTrigger={false}\n className=\"border-input focus-visible:border-border rounded-none border-0 px-0 py-2.5 shadow-none ring-0! outline-none! focus-visible:ring-0 focus-visible:ring-offset-0\"\n />\n <ComboboxSeparator />\n <ComboboxEmpty className=\"px-4 py-2.5 text-sm\">Nenhum país encontrado.</ComboboxEmpty>\n <ComboboxList className=\"max-h-none overflow-visible\">\n <div className=\"relative flex max-h-full\">\n <div className=\"flex max-h-[min(calc(var(--available-height)-(--spacing(9))),24rem)] w-full scroll-pt-2 scroll-pb-2 flex-col overscroll-contain\">\n <ScrollArea className=\"size-full min-h-0 **:data-[slot=scroll-area-scrollbar]:m-0 **:data-[slot=scroll-area-viewport]:h-full **:data-[slot=scroll-area-viewport]:overscroll-contain\">\n {filteredCountries.map((item: CountryEntry) =>\n item.value ? (\n <ComboboxItem key={item.value} value={item.value} className=\"flex items-center gap-2\">\n <FlagComponent country={item.value} countryName={item.label} />\n <span className=\"flex-1 text-sm\">{item.label}</span>\n <span className=\"text-foreground/50 text-sm\">\n {`+${BasePhoneInput.getCountryCallingCode(item.value)}`}\n </span>\n </ComboboxItem>\n ) : null\n )}\n </ScrollArea>\n </div>\n </div>\n </ComboboxList>\n </ComboboxContent>\n </Combobox>\n )\n}\n\nfunction FlagComponent({ country, countryName }: BasePhoneInput.FlagProps) {\n const Flag = flags[country]\n\n return (\n <span className=\"flex h-4 w-4 items-center justify-center [&_svg:not([class*='size-'])]:size-full! [&_svg:not([class*='size-'])]:rounded-[5px]\">\n {Flag ? <Flag title={countryName} /> : <IconWorld className=\"size-4 opacity-60\" />}\n </span>\n )\n}\n\nexport { PhoneInput }\n"],"mappings":"msBAuBA,MAAME,EAAoBC,EAGvB,CACD,eAAgB,IAAA,GAChB,oBAAqB,IAAA,EACvB,CAAC,EAgBD,SAAS,WAAW,CAAE,YAAW,iBAAgB,sBAAqB,WAAU,QAAO,GAAGC,GAA0B,CAClH,IAAMC,EAAUC,EAAgBF,EAAM,eAAe,EAErD,MACE,kBAACF,EAAkB,SAAnB,CAA4B,MAAO,CAAE,iBAAgB,qBAAoB,EACvE,SAAA,kBAACF,EAAe,QAAhB,CACE,UAAWO,EACT,OACAF,GACEA,IAAY,SACZ,6GACFG,CACF,EACA,cAAe,cACf,uBAAwB,cACxB,eAAgB,eAChB,WAAY,GACZ,eAAe,KACf,MAAOC,GAAS,IAAA,GAChB,SAAW,GAAUC,IAAWD,GAAU,EAA2B,EACrE,GAAIL,CACL,CAAA,CACyB,CAAA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BAAC,MAAD,CAAK,UAAU,kIACb,SAAA,kBAACC,EAAD,CAAY,UAAU,+JACnB,SAAAf,EAAkB,IAAK,GACtBgB,EAAK,MACH,kBAACC,EAAD,CAA+B,MAAOD,EAAK,MAAO,UAAU,0BAA5D,SAAA,CACE,kBAAC,cAAD,CAAe,QAASA,EAAK,MAAO,YAAaA,EAAK,KAAQ,CAAA,EAC9D,kBAAC,OAAD,CAAM,UAAU,iBAAkB,SAAAA,EAAK,KAAY,CAAA,EACnD,kBAAC,OAAD,CAAM,UAAU,6BACb,SAAA,IAAIlC,EAAe,sBAAsBkC,EAAK,KAAK,GAChD,CAAA,CACM,CANK,EAAAA,EAAK,KAMV,EACZ,IACN,CACU,CAAA,CACT,CAAA,CACF,CAAA,CACO,CAAA,CACC,CACT,CAAA,CAAA,GAEd,CAEA,SAAS,cAAc,CAAE,UAAS,eAAyC,CACzE,IAAME,EAAOnC,EAAMqB,GAEnB,MACE,kBAAC,OAAD,CAAM,UAAU,gIACb,SAAAc,EAAO,kBAACA,EAAD,CAAM,MAAOC,CAAc,CAAA,EAAI,kBAACC,EAAD,CAAW,UAAU,mBAAqB,CAAA,CAC7E,CAAA,CAEV"}
@@ -4,27 +4,80 @@ import * as React from "react";
4
4
  import { Pie } from "recharts";
5
5
  //#region src/components/pie-chart.d.ts
6
6
  export type PieChartDatum = {
7
+ /** Slice name, shown in the tooltip and legend. */
7
8
  name: string;
9
+ /** Slice value. */
8
10
  value: number;
11
+ /** Any CSS color. Wins over `colorKey`. */
9
12
  color?: string;
13
+ /** Palette family, resolved to its semantic color `var(--{key})`. */
10
14
  colorKey?: ChartColorKey;
11
15
  };
12
16
  export type PieChartProps = Omit<React.ComponentProps<'div'>, 'children'> & {
17
+ /** Slices to draw. */
13
18
  data: PieChartDatum[];
19
+ /**
20
+ * Shows a tooltip on hover.
21
+ * @default true
22
+ */
14
23
  withTooltip?: boolean;
24
+ /**
25
+ * Shows the legend.
26
+ * @default false
27
+ */
15
28
  withLegend?: boolean;
29
+ /**
30
+ * Shows the value of each slice.
31
+ * @default false
32
+ */
16
33
  withLabels?: boolean;
34
+ /**
35
+ * Where the labels go.
36
+ * @default 'outside'
37
+ */
17
38
  labelsPosition?: 'inside' | 'outside';
39
+ /**
40
+ * Angle where the first slice starts.
41
+ * @default 90
42
+ */
18
43
  startAngle?: number;
44
+ /**
45
+ * Angle where the last slice ends.
46
+ * @default -270
47
+ */
19
48
  endAngle?: number;
49
+ /**
50
+ * Space between slices, in degrees.
51
+ * @default 0
52
+ */
20
53
  paddingAngle?: number;
54
+ /**
55
+ * Width of the gap between slices.
56
+ * @default 1
57
+ */
21
58
  strokeWidth?: number;
59
+ /**
60
+ * Color of the gap between slices (palette family or CSS color).
61
+ * @default 'var(--background)'
62
+ */
22
63
  strokeColor?: ChartColorKey | string;
64
+ /**
65
+ * Inner radius; above `0` it becomes a ring.
66
+ * @default 0
67
+ */
23
68
  innerRadius?: number | string;
69
+ /**
70
+ * Outer radius (px or %).
71
+ * @default '80%'
72
+ */
24
73
  outerRadius?: number | string;
74
+ /** Animation length in ms. */
25
75
  animationDuration?: number;
76
+ /** Props for the tooltip content. */
26
77
  tooltipProps?: ChartTooltipContentProps;
78
+ /** Props for the legend content. */
27
79
  legendProps?: ChartLegendContentProps;
80
+ /** Props for the Recharts `<Pie>`. */
28
81
  pieProps?: Partial<React.ComponentProps<typeof Pie>>;
29
82
  children?: React.ReactNode;
30
83
  };
@@ -1,2 +1,2 @@
1
- import"../rolldown-runtime-BhWHdk3m.js";import{cn as e}from"../lib/utils.js";import{ChartContainer as t,ChartLegendContent as n,ChartTooltipContent as r,DEFAULT_CHART_PALETTE as i,resolveChartColor as a}from"./chart.js";import{jsx as o,jsxs as s}from"react/jsx-runtime";import*as c from"react";import{Legend as l,Pie as u,PieChart as d,Tooltip as f}from"recharts";function buildPieConfig(e){return e.reduce((e,t,n)=>(e[t.name]={label:t.name,color:t.color??a(t.colorKey)??i[n%i.length]},e),{})}function PieChartBase({className:i,data:p,withTooltip:m=!0,withLegend:h=!1,withLabels:g=!1,labelsPosition:_=`outside`,startAngle:v=90,endAngle:y=-270,paddingAngle:b=0,strokeWidth:x=1,strokeColor:S=`var(--background)`,innerRadius:C=0,outerRadius:w=`80%`,animationDuration:T,tooltipProps:E,legendProps:D,pieProps:O,dataSlot:k,centerSlot:A,...j}){let M=c.useMemo(()=>buildPieConfig(p),[p]),N=a(S)??S,P=c.useMemo(()=>p.map(e=>({...e,fill:M[e.name]?.color,stroke:N})),[p,N,M]);return/* @__PURE__ */ o(t,{"data-slot":k,className:e(`relative aspect-square w-full`,i),config:M,...j,children:/* @__PURE__ */ s(d,{children:[m&&/* @__PURE__ */ o(f,{cursor:!1,content:/* @__PURE__ */ o(r,{hideLabel:!0,...E})}),h&&/* @__PURE__ */ o(l,{content:/* @__PURE__ */ o(n,{nameKey:`name`,...D})}),/* @__PURE__ */ o(u,{data:P,dataKey:`value`,nameKey:`name`,startAngle:v,endAngle:y,innerRadius:C,outerRadius:w,paddingAngle:b,strokeWidth:x,label:g?{fontSize:12}:void 0,labelLine:g&&_===`outside`,animationDuration:T,isAnimationActive:T!==0,...O,children:A})]})})}function PieChart(e){return/* @__PURE__ */ o(PieChartBase,{...e,dataSlot:`pie-chart`})}export{PieChart,PieChartBase,buildPieConfig};
1
+ import"../rolldown-runtime-BhWHdk3m.js";import{cn as e}from"../lib/utils.js";import{ChartContainer as t,ChartLegendContent as n,ChartTooltipContent as r,DEFAULT_CHART_PALETTE as i,resolveChartColor as a}from"./chart.js";import*as o from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import{Legend as l,Pie as u,PieChart as d,Tooltip as f}from"recharts";function buildPieConfig(e){return e.reduce((e,t,n)=>(e[t.name]={label:t.name,color:t.color??a(t.colorKey)??i[n%i.length]},e),{})}function PieChartBase({className:i,data:p,withTooltip:m=!0,withLegend:h=!1,withLabels:g=!1,labelsPosition:_=`outside`,startAngle:v=90,endAngle:y=-270,paddingAngle:b=0,strokeWidth:x=1,strokeColor:S=`var(--background)`,innerRadius:C=0,outerRadius:w=`80%`,animationDuration:T,tooltipProps:E,legendProps:D,pieProps:O,dataSlot:k,centerSlot:A,...j}){let M=o.useMemo(()=>buildPieConfig(p),[p]),N=a(S)??S,P=o.useMemo(()=>p.map(e=>({...e,fill:M[e.name]?.color,stroke:N})),[p,N,M]);return/* @__PURE__ */ s(t,{"data-slot":k,className:e(`relative aspect-square w-full`,i),config:M,...j,children:/* @__PURE__ */ c(d,{children:[m&&/* @__PURE__ */ s(f,{cursor:!1,content:/* @__PURE__ */ s(r,{hideLabel:!0,...E})}),h&&/* @__PURE__ */ s(l,{content:/* @__PURE__ */ s(n,{nameKey:`name`,...D})}),/* @__PURE__ */ s(u,{data:P,dataKey:`value`,nameKey:`name`,startAngle:v,endAngle:y,innerRadius:C,outerRadius:w,paddingAngle:b,strokeWidth:x,label:g?_===`inside`?{position:`inside`,fontSize:12,fontWeight:500,fill:`var(--background)`}:{fontSize:12}:void 0,labelLine:g&&_===`outside`,animationDuration:T,isAnimationActive:T!==0,...O,children:A})]})})}function PieChart(e){return/* @__PURE__ */ s(PieChartBase,{...e,dataSlot:`pie-chart`})}export{PieChart,PieChartBase,buildPieConfig};
2
2
  //# sourceMappingURL=pie-chart.js.map