@uselets/ui 1.7.2 → 1.9.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 (304) hide show
  1. package/README.md +10 -3
  2. package/dist/{chart-DHS2QeM8.d.ts → chart-lqgodZYQ.d.ts} +11 -7
  3. package/dist/cli/uselets.mjs.map +1 -1
  4. package/dist/components/accordion.d.ts +5 -5
  5. package/dist/components/accordion.js +1 -1
  6. package/dist/components/accordion.js.map +1 -1
  7. package/dist/components/alert-dialog.d.ts +13 -13
  8. package/dist/components/alert-dialog.js +1 -1
  9. package/dist/components/alert-dialog.js.map +1 -1
  10. package/dist/components/alert.d.ts +5 -5
  11. package/dist/components/alert.js +1 -1
  12. package/dist/components/alert.js.map +1 -1
  13. package/dist/components/anchor.d.ts +2 -2
  14. package/dist/components/anchor.js +1 -1
  15. package/dist/components/anchor.js.map +1 -1
  16. package/dist/components/area-chart.d.ts +7 -3
  17. package/dist/components/area-chart.js +1 -1
  18. package/dist/components/area-chart.js.map +1 -1
  19. package/dist/components/avatar.d.ts +7 -7
  20. package/dist/components/avatar.js +1 -1
  21. package/dist/components/avatar.js.map +1 -1
  22. package/dist/components/badge.d.ts +3 -3
  23. package/dist/components/badge.js +1 -1
  24. package/dist/components/badge.js.map +1 -1
  25. package/dist/components/bar-chart.d.ts +7 -3
  26. package/dist/components/bar-chart.js +1 -1
  27. package/dist/components/bar-chart.js.map +1 -1
  28. package/dist/components/breadcrumb.d.ts +8 -8
  29. package/dist/components/breadcrumb.js +1 -1
  30. package/dist/components/breadcrumb.js.map +1 -1
  31. package/dist/components/button-group.d.ts +4 -4
  32. package/dist/components/button-group.js +1 -1
  33. package/dist/components/button-group.js.map +1 -1
  34. package/dist/components/button.d.ts +3 -3
  35. package/dist/components/button.js +1 -1
  36. package/dist/components/button.js.map +1 -1
  37. package/dist/components/calendar.d.ts +3 -3
  38. package/dist/components/calendar.js +1 -1
  39. package/dist/components/calendar.js.map +1 -1
  40. package/dist/components/card.d.ts +9 -9
  41. package/dist/components/card.js +1 -1
  42. package/dist/components/card.js.map +1 -1
  43. package/dist/components/carousel.d.ts +7 -7
  44. package/dist/components/carousel.js +1 -1
  45. package/dist/components/carousel.js.map +1 -1
  46. package/dist/components/carousel.spec.js +1 -1
  47. package/dist/components/carousel.spec.js.map +1 -1
  48. package/dist/components/center.d.ts +2 -2
  49. package/dist/components/center.js +1 -1
  50. package/dist/components/center.js.map +1 -1
  51. package/dist/components/chart.d.ts +2 -2
  52. package/dist/components/chart.js +2 -2
  53. package/dist/components/chart.js.map +1 -1
  54. package/dist/components/checkbox.d.ts +2 -2
  55. package/dist/components/checkbox.js +1 -1
  56. package/dist/components/checkbox.js.map +1 -1
  57. package/dist/components/code.d.ts +2 -2
  58. package/dist/components/code.js +1 -1
  59. package/dist/components/code.js.map +1 -1
  60. package/dist/components/collapsible.d.ts +4 -4
  61. package/dist/components/collapsible.js +1 -1
  62. package/dist/components/collapsible.js.map +1 -1
  63. package/dist/components/combobox.d.ts +16 -16
  64. package/dist/components/combobox.js +1 -1
  65. package/dist/components/combobox.js.map +1 -1
  66. package/dist/components/command.d.ts +10 -10
  67. package/dist/components/command.js +1 -1
  68. package/dist/components/command.js.map +1 -1
  69. package/dist/components/container.d.ts +2 -2
  70. package/dist/components/container.js +1 -1
  71. package/dist/components/container.js.map +1 -1
  72. package/dist/components/data-table.d.ts +9 -9
  73. package/dist/components/data-table.js +1 -1
  74. package/dist/components/data-table.js.map +1 -1
  75. package/dist/components/date-range-picker.d.ts +12 -12
  76. package/dist/components/date-range-picker.js +1 -1
  77. package/dist/components/date-range-picker.js.map +1 -1
  78. package/dist/components/dialog.d.ts +12 -12
  79. package/dist/components/dialog.js +1 -1
  80. package/dist/components/dialog.js.map +1 -1
  81. package/dist/components/donut-chart.d.ts +2 -2
  82. package/dist/components/donut-chart.js +1 -1
  83. package/dist/components/donut-chart.js.map +1 -1
  84. package/dist/components/drawer.d.ts +14 -12
  85. package/dist/components/drawer.js +1 -1
  86. package/dist/components/drawer.js.map +1 -1
  87. package/dist/components/dropdown-menu.d.ts +16 -16
  88. package/dist/components/dropdown-menu.js +1 -1
  89. package/dist/components/dropdown-menu.js.map +1 -1
  90. package/dist/components/dropzone.d.ts +2 -2
  91. package/dist/components/dropzone.js +1 -1
  92. package/dist/components/dropzone.js.map +1 -1
  93. package/dist/components/empty.d.ts +7 -7
  94. package/dist/components/empty.js +1 -1
  95. package/dist/components/empty.js.map +1 -1
  96. package/dist/components/field.d.ts +11 -11
  97. package/dist/components/field.js +1 -1
  98. package/dist/components/field.js.map +1 -1
  99. package/dist/components/field.spec.js +1 -1
  100. package/dist/components/field.spec.js.map +1 -1
  101. package/dist/components/flex.d.ts +2 -2
  102. package/dist/components/flex.js +1 -1
  103. package/dist/components/flex.js.map +1 -1
  104. package/dist/components/grid.d.ts +3 -3
  105. package/dist/components/grid.js +1 -1
  106. package/dist/components/grid.js.map +1 -1
  107. package/dist/components/group.d.ts +2 -2
  108. package/dist/components/group.js +1 -1
  109. package/dist/components/group.js.map +1 -1
  110. package/dist/components/heading.d.ts +2 -2
  111. package/dist/components/heading.js +1 -1
  112. package/dist/components/heading.js.map +1 -1
  113. package/dist/components/hover-card.d.ts +4 -4
  114. package/dist/components/hover-card.js +1 -1
  115. package/dist/components/hover-card.js.map +1 -1
  116. package/dist/components/input-group.d.ts +7 -7
  117. package/dist/components/input-group.js +1 -1
  118. package/dist/components/input-group.js.map +1 -1
  119. package/dist/components/input-otp.d.ts +5 -5
  120. package/dist/components/input-otp.js +1 -1
  121. package/dist/components/input-otp.js.map +1 -1
  122. package/dist/components/input.d.ts +2 -2
  123. package/dist/components/input.js +1 -1
  124. package/dist/components/input.js.map +1 -1
  125. package/dist/components/kbd.d.ts +3 -3
  126. package/dist/components/kbd.js +1 -1
  127. package/dist/components/kbd.js.map +1 -1
  128. package/dist/components/label.d.ts +2 -2
  129. package/dist/components/label.js +1 -1
  130. package/dist/components/label.js.map +1 -1
  131. package/dist/components/list.d.ts +4 -4
  132. package/dist/components/list.js +1 -1
  133. package/dist/components/list.js.map +1 -1
  134. package/dist/components/mask-input.d.ts +2 -2
  135. package/dist/components/mask-input.js +1 -1
  136. package/dist/components/mask-input.js.map +1 -1
  137. package/dist/components/native-select.d.ts +4 -4
  138. package/dist/components/native-select.js +1 -1
  139. package/dist/components/native-select.js.map +1 -1
  140. package/dist/components/navigation-menu.d.ts +9 -9
  141. package/dist/components/navigation-menu.js +1 -1
  142. package/dist/components/navigation-menu.js.map +1 -1
  143. package/dist/components/pagination.d.ts +8 -8
  144. package/dist/components/pagination.js +1 -1
  145. package/dist/components/pagination.js.map +1 -1
  146. package/dist/components/pie-chart.d.ts +10 -4
  147. package/dist/components/pie-chart.js +1 -1
  148. package/dist/components/pie-chart.js.map +1 -1
  149. package/dist/components/popover.d.ts +8 -8
  150. package/dist/components/popover.js +1 -1
  151. package/dist/components/popover.js.map +1 -1
  152. package/dist/components/progress.d.ts +2 -2
  153. package/dist/components/progress.js +1 -1
  154. package/dist/components/progress.js.map +1 -1
  155. package/dist/components/radio-group.d.ts +3 -3
  156. package/dist/components/radio-group.js +1 -1
  157. package/dist/components/radio-group.js.map +1 -1
  158. package/dist/components/resizable.d.ts +4 -4
  159. package/dist/components/resizable.js +1 -1
  160. package/dist/components/resizable.js.map +1 -1
  161. package/dist/components/scroll-area.d.ts +3 -3
  162. package/dist/components/scroll-area.js +1 -1
  163. package/dist/components/scroll-area.js.map +1 -1
  164. package/dist/components/select.d.ts +11 -11
  165. package/dist/components/select.js +1 -1
  166. package/dist/components/select.js.map +1 -1
  167. package/dist/components/separator.d.ts +2 -2
  168. package/dist/components/separator.js +1 -1
  169. package/dist/components/separator.js.map +1 -1
  170. package/dist/components/sidebar.d.ts +25 -25
  171. package/dist/components/sidebar.js +1 -1
  172. package/dist/components/sidebar.js.map +1 -1
  173. package/dist/components/simple-grid.d.ts +2 -2
  174. package/dist/components/simple-grid.js +1 -1
  175. package/dist/components/simple-grid.js.map +1 -1
  176. package/dist/components/skeleton.d.ts +2 -2
  177. package/dist/components/skeleton.js +1 -1
  178. package/dist/components/skeleton.js.map +1 -1
  179. package/dist/components/skeleton.spec.js +1 -1
  180. package/dist/components/skeleton.spec.js.map +1 -1
  181. package/dist/components/slider.d.ts +2 -2
  182. package/dist/components/slider.js +1 -1
  183. package/dist/components/slider.js.map +1 -1
  184. package/dist/components/sonner.d.ts +2 -2
  185. package/dist/components/sonner.js +1 -1
  186. package/dist/components/sonner.js.map +1 -1
  187. package/dist/components/spinner.d.ts +2 -2
  188. package/dist/components/spinner.js +1 -1
  189. package/dist/components/spinner.js.map +1 -1
  190. package/dist/components/stack.d.ts +2 -2
  191. package/dist/components/stack.js +1 -1
  192. package/dist/components/stack.js.map +1 -1
  193. package/dist/components/switch.d.ts +2 -2
  194. package/dist/components/switch.js +1 -1
  195. package/dist/components/switch.js.map +1 -1
  196. package/dist/components/table.d.ts +10 -10
  197. package/dist/components/table.js +1 -1
  198. package/dist/components/table.js.map +1 -1
  199. package/dist/components/tabs.d.ts +5 -5
  200. package/dist/components/tabs.js +1 -1
  201. package/dist/components/tabs.js.map +1 -1
  202. package/dist/components/text.d.ts +2 -2
  203. package/dist/components/text.js +1 -1
  204. package/dist/components/text.js.map +1 -1
  205. package/dist/components/textarea.d.ts +2 -2
  206. package/dist/components/textarea.js +1 -1
  207. package/dist/components/textarea.js.map +1 -1
  208. package/dist/components/theme.d.ts +3 -3
  209. package/dist/components/theme.js +1 -1
  210. package/dist/components/theme.js.map +1 -1
  211. package/dist/components/timeline.d.ts +3 -3
  212. package/dist/components/timeline.js +1 -1
  213. package/dist/components/timeline.js.map +1 -1
  214. package/dist/components/toggle-group.d.ts +3 -3
  215. package/dist/components/toggle-group.js +1 -1
  216. package/dist/components/toggle-group.js.map +1 -1
  217. package/dist/components/toggle.d.ts +2 -2
  218. package/dist/components/toggle.js +1 -1
  219. package/dist/components/toggle.js.map +1 -1
  220. package/dist/components/tooltip.d.ts +6 -6
  221. package/dist/components/tooltip.js +1 -1
  222. package/dist/components/tooltip.js.map +1 -1
  223. package/dist/components/unstyled-button.d.ts +2 -2
  224. package/dist/components/unstyled-button.js +1 -1
  225. package/dist/components/unstyled-button.js.map +1 -1
  226. package/dist/components/visibility.d.ts +3 -3
  227. package/dist/components/visibility.js +1 -1
  228. package/dist/components/visibility.js.map +1 -1
  229. package/dist/{dist-C35vdEt2.js → dist-B-hwiqYg.js} +13 -13
  230. package/dist/dist-B-hwiqYg.js.map +1 -0
  231. package/dist/hooks/use-breakpoint-value.d.ts +1 -1
  232. package/dist/hooks/use-breakpoint-value.js +1 -1
  233. package/dist/hooks/use-breakpoint-value.js.map +1 -1
  234. package/dist/hooks/use-breakpoint-value.spec.js +1 -1
  235. package/dist/hooks/use-breakpoint-value.spec.js.map +1 -1
  236. package/dist/hooks/use-breakpoint.d.ts +1 -1
  237. package/dist/hooks/use-breakpoint.js +1 -1
  238. package/dist/hooks/use-breakpoint.js.map +1 -1
  239. package/dist/hooks/use-breakpoint.spec.js +1 -1
  240. package/dist/hooks/use-breakpoint.spec.js.map +1 -1
  241. package/dist/hooks/use-disclosure.d.ts +1 -1
  242. package/dist/hooks/use-disclosure.js +1 -1
  243. package/dist/hooks/use-disclosure.js.map +1 -1
  244. package/dist/hooks/use-disclosure.spec.js +1 -1
  245. package/dist/hooks/use-disclosure.spec.js.map +1 -1
  246. package/dist/hooks/use-document-visibility.d.ts +1 -1
  247. package/dist/hooks/use-document-visibility.js +1 -1
  248. package/dist/hooks/use-document-visibility.js.map +1 -1
  249. package/dist/hooks/use-document-visibility.spec.js +1 -1
  250. package/dist/hooks/use-document-visibility.spec.js.map +1 -1
  251. package/dist/hooks/use-idle.d.ts +1 -1
  252. package/dist/hooks/use-idle.js +1 -1
  253. package/dist/hooks/use-idle.js.map +1 -1
  254. package/dist/hooks/use-idle.spec.js +1 -1
  255. package/dist/hooks/use-idle.spec.js.map +1 -1
  256. package/dist/hooks/use-interval.d.ts +1 -1
  257. package/dist/hooks/use-interval.js +1 -1
  258. package/dist/hooks/use-interval.js.map +1 -1
  259. package/dist/hooks/use-interval.spec.js +1 -1
  260. package/dist/hooks/use-interval.spec.js.map +1 -1
  261. package/dist/hooks/use-local-storage.d.ts +1 -1
  262. package/dist/hooks/use-local-storage.js +1 -1
  263. package/dist/hooks/use-local-storage.js.map +1 -1
  264. package/dist/hooks/use-local-storage.spec.js +1 -1
  265. package/dist/hooks/use-local-storage.spec.js.map +1 -1
  266. package/dist/hooks/use-mask.d.ts +1 -1
  267. package/dist/hooks/use-mask.js +1 -1
  268. package/dist/hooks/use-mask.js.map +1 -1
  269. package/dist/hooks/use-mobile.d.ts +1 -1
  270. package/dist/hooks/use-mobile.js +1 -1
  271. package/dist/hooks/use-mobile.js.map +1 -1
  272. package/dist/hooks/use-mobile.spec.js +1 -1
  273. package/dist/hooks/use-mobile.spec.js.map +1 -1
  274. package/dist/index.d.ts +2 -2
  275. package/dist/index.js +1 -1
  276. package/dist/lib/badge.d.ts +11 -11
  277. package/dist/lib/badge.js +1 -1
  278. package/dist/lib/badge.js.map +1 -1
  279. package/dist/lib/button.d.ts +11 -11
  280. package/dist/lib/button.js +1 -1
  281. package/dist/lib/button.js.map +1 -1
  282. package/dist/lib/color.d.ts +11 -11
  283. package/dist/lib/color.js +1 -1
  284. package/dist/lib/color.js.map +1 -1
  285. package/dist/lib/compose-refs.d.ts +1 -1
  286. package/dist/lib/compose-refs.js +1 -1
  287. package/dist/lib/compose-refs.js.map +1 -1
  288. package/dist/lib/utils.d.ts +1 -1
  289. package/dist/lib/utils.js +1 -1
  290. package/dist/lib/utils.js.map +1 -1
  291. package/dist/{magic-string.es-C-uSEkg2.js → magic-string.es-DbBO8R0S.js} +2 -2
  292. package/dist/{magic-string.es-C-uSEkg2.js.map → magic-string.es-DbBO8R0S.js.map} +1 -1
  293. package/dist/{react.esm-BagSCtI3.js → react.esm-D88qr0ij.js} +12 -12
  294. package/dist/{react.esm-BagSCtI3.js.map → react.esm-D88qr0ij.js.map} +1 -1
  295. package/dist/skills/uselets-ui/references/component-catalog.md +8 -7
  296. package/dist/skills/uselets-ui/references/package-guide.md +7 -1
  297. package/dist/styles/gomax.css +16 -0
  298. package/dist/styles/max.css +16 -0
  299. package/dist/styles/theme.css +8 -0
  300. package/package.json +17 -14
  301. package/skills/uselets-ui/references/component-catalog.md +8 -7
  302. package/skills/uselets-ui/references/package-guide.md +7 -1
  303. package/dist/dist-C35vdEt2.js.map +0 -1
  304. /package/dist/{chunk-CHh1Zzun.js → rolldown-runtime-Bdj-bS2b.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"dropzone.js","names":["useReactDropzone"],"sources":["../../src/components/dropzone.tsx"],"sourcesContent":["import * as React from 'react'\nimport {\n type Accept,\n ErrorCode,\n type FileError,\n type FileRejection,\n useDropzone as useReactDropzone\n} from 'react-dropzone'\n\nimport { composeRefs } from '../lib/compose-refs'\nimport { cn } from '../lib/utils'\nimport { Button, type ButtonProps } from './button'\n\nconst dropzoneErrorCodes = [\n ErrorCode.FileInvalidType,\n ErrorCode.FileTooLarge,\n ErrorCode.FileTooSmall,\n ErrorCode.TooManyFiles\n]\n\ntype DropzoneAction<TUploadResult, TUploadError> =\n | {\n type: 'add'\n id: string\n fileName: string\n file: File\n }\n | {\n type: 'remove'\n id: string\n }\n | {\n type: 'update-status'\n id: string\n status: 'pending'\n }\n | {\n type: 'update-status'\n id: string\n status: 'error'\n error: TUploadError\n message?: string\n }\n | {\n type: 'update-status'\n id: string\n status: 'success'\n result: TUploadResult\n }\n\nexport type DropzoneUploadResult<TUploadResult, TUploadError> =\n | {\n status: 'error'\n error: TUploadError\n }\n | {\n status: 'success'\n result: TUploadResult\n }\n\nexport type DropzoneFileStatus<TUploadResult, TUploadError> = {\n id: string\n fileName: string\n file: File\n tries: number\n} & (\n | {\n status: 'pending'\n error?: undefined\n message?: undefined\n result?: undefined\n }\n | {\n status: 'error'\n error: TUploadError\n message?: string\n result?: undefined\n }\n | {\n status: 'success'\n result: TUploadResult\n error?: undefined\n message?: undefined\n }\n)\n\nexport type FileStatus<TUploadResult, TUploadError> = DropzoneFileStatus<TUploadResult, TUploadError>\n\nexport type DropzoneValidation = {\n accept?: Accept\n minSize?: number\n maxSize?: number\n maxFiles?: number\n}\n\nexport type UseDropzoneProps<TUploadResult, TUploadError = string> = {\n onDropFile: (file: File) => Promise<DropzoneUploadResult<TUploadResult, TUploadError>>\n onRemoveFile?: (id: string) => void | Promise<void>\n onFileUploaded?: (result: TUploadResult) => void\n onFileUploadError?: (error: TUploadError) => void\n onAllUploaded?: () => void\n onRootError?: (error: string | undefined) => void\n shapeUploadError?: (error: TUploadError) => string | undefined\n maxRetryCount?: number\n autoRetry?: boolean\n validation?: DropzoneValidation\n shiftOnMaxFiles?: boolean\n}\n\nexport interface UseDropzoneReturn<TUploadResult, TUploadError> {\n getRootProps: ReturnType<typeof useReactDropzone>['getRootProps']\n getInputProps: ReturnType<typeof useReactDropzone>['getInputProps']\n open: () => void\n onRemoveFile: (id: string) => Promise<void>\n onRetry: (id: string) => Promise<void>\n canRetry: (id: string) => boolean\n fileStatuses: DropzoneFileStatus<TUploadResult, TUploadError>[]\n isInvalid: boolean\n isDragActive: boolean\n rootError: string | undefined\n inputId: string\n rootMessageId: string\n rootDescriptionId: string\n getFileMessageId: (id: string) => string\n}\n\nexport type DropzoneProps<TUploadResult, TUploadError> = React.PropsWithChildren<\n UseDropzoneReturn<TUploadResult, TUploadError>\n>\n\nexport type DropzoneAreaProps = React.ComponentProps<'div'>\n\nexport type DropzoneDescriptionProps = React.ComponentProps<'p'>\n\nexport type DropzoneFileListProps = React.ComponentProps<'ol'>\n\nexport type DropzoneFileListItemProps<TUploadResult, TUploadError> = React.ComponentProps<'li'> & {\n file: DropzoneFileStatus<TUploadResult, TUploadError>\n}\n\nexport type DropzoneFileMessageProps = React.ComponentProps<'p'>\n\nexport type DropzoneMessageProps = React.ComponentProps<'p'>\n\nexport type DropzoneRemoveFileProps = ButtonProps\n\nexport type DropzoneRetryFileProps = ButtonProps\n\nexport type DropzoneTriggerProps = ButtonProps\n\nexport type InfiniteProgressProps = React.ComponentProps<'div'> & {\n status: 'pending' | 'success' | 'error'\n}\n\ntype DropzoneFileListContextValue<TUploadResult, TUploadError> = {\n onRemoveFile: () => Promise<void>\n onRetry: () => Promise<void>\n fileStatus: DropzoneFileStatus<TUploadResult, TUploadError>\n canRetry: boolean\n dropzoneId: string\n messageId: string\n}\n\nconst dropzoneErrorCodeSet = new Set<ErrorCode>(dropzoneErrorCodes)\n\nconst valueTextMap = {\n pending: 'indeterminate',\n success: '100%',\n error: 'error'\n} as const\n\nconst DropzoneContext = React.createContext<UseDropzoneReturn<unknown, unknown> | null>(null)\n\nconst DropzoneFileListContext = React.createContext<DropzoneFileListContextValue<unknown, unknown> | null>(null)\n\nfunction fileStatusReducer<TUploadResult, TUploadError>(\n state: DropzoneFileStatus<TUploadResult, TUploadError>[],\n action: DropzoneAction<TUploadResult, TUploadError>\n): DropzoneFileStatus<TUploadResult, TUploadError>[] {\n switch (action.type) {\n case 'add':\n return [\n ...state,\n {\n id: action.id,\n fileName: action.fileName,\n file: action.file,\n status: 'pending',\n tries: 1\n }\n ]\n case 'remove':\n return state.filter((fileStatus) => fileStatus.id !== action.id)\n case 'update-status':\n return state.map((fileStatus) => {\n if (fileStatus.id !== action.id) {\n return fileStatus\n }\n\n if (action.status === 'pending') {\n return {\n ...fileStatus,\n status: 'pending',\n error: undefined,\n message: undefined,\n result: undefined,\n tries: fileStatus.tries + 1\n }\n }\n\n if (action.status === 'error') {\n return {\n ...fileStatus,\n status: 'error',\n error: action.error,\n message: action.message,\n result: undefined\n }\n }\n\n return {\n ...fileStatus,\n status: 'success',\n result: action.result,\n error: undefined,\n message: undefined\n }\n })\n }\n}\n\nfunction formatAcceptedTypes(accept?: Accept) {\n if (!accept) {\n return undefined\n }\n\n const acceptedTypes = Object.entries(accept).flatMap(([mimeType, extensions]) => {\n return extensions.length > 0 ? extensions : [mimeType]\n })\n\n return acceptedTypes.length > 0 ? acceptedTypes.join(', ') : undefined\n}\n\nfunction getDropzoneErrorCodes(fileRejections: FileRejection[]) {\n const errorCodes = fileRejections.flatMap((rejection) =>\n rejection.errors.map((error) => error.code as ErrorCode).filter((errorCode) => dropzoneErrorCodeSet.has(errorCode))\n )\n\n return Array.from(new Set(errorCodes))\n}\n\nfunction getRootError(errorCodes: ErrorCode[], limits: DropzoneValidation) {\n const errors = errorCodes.flatMap((errorCode) => {\n switch (errorCode) {\n case 'file-invalid-type': {\n const acceptedTypes = formatAcceptedTypes(limits.accept)\n return acceptedTypes ? [`only ${acceptedTypes} files are allowed`] : ['this file type is not allowed']\n }\n case 'file-too-large': {\n if (!limits.maxSize) {\n return ['this file is too large']\n }\n\n return [`max size is ${(limits.maxSize / (1024 * 1024)).toFixed(2)} MB`]\n }\n case 'file-too-small': {\n if (!limits.minSize) {\n return ['this file is too small']\n }\n\n return [`min size is ${(limits.minSize / (1024 * 1024)).toFixed(2)} MB`]\n }\n case 'too-many-files':\n return limits.maxFiles ? [`max ${limits.maxFiles} files`] : ['too many files']\n default:\n return []\n }\n })\n\n if (errors.length === 0) {\n return 'Unable to add the selected files'\n }\n\n const [firstError, ...restErrors] = errors as [string, ...string[]]\n return `${firstError.charAt(0).toUpperCase()}${firstError.slice(1)}${restErrors.length > 0 ? `, ${restErrors.join(', ')}` : ''}`\n}\n\nfunction getRejectionMessage(fileRejections: FileRejection[], limits: DropzoneValidation) {\n const errorCodes = getDropzoneErrorCodes(fileRejections)\n\n if (errorCodes.length > 0) {\n return getRootError(errorCodes, limits)\n }\n\n return fileRejections[0]?.errors[0]?.message ?? 'Unable to add the selected files'\n}\n\nfunction getUploadErrorMessage<TUploadError>(\n error: TUploadError,\n shapeUploadError?: (error: TUploadError) => string | undefined\n) {\n if (shapeUploadError) {\n const message = shapeUploadError(error)\n if (message !== undefined) {\n return message\n }\n }\n\n if (typeof error === 'string') {\n return error\n }\n\n if (error instanceof Error) {\n return error.message\n }\n\n return undefined\n}\n\nfunction useDropzoneContext<TUploadResult, TUploadError>() {\n const context = React.useContext(DropzoneContext)\n\n if (!context) {\n throw new Error('Dropzone components must be used within a Dropzone.')\n }\n\n return context as UseDropzoneReturn<TUploadResult, TUploadError>\n}\n\nfunction useDropzoneFileListContext<TUploadResult, TUploadError>() {\n const context = React.useContext(DropzoneFileListContext)\n\n if (!context) {\n throw new Error('Dropzone file actions must be used within a DropzoneFileListItem.')\n }\n\n return context as DropzoneFileListContextValue<TUploadResult, TUploadError>\n}\n\nfunction useDropzone<TUploadResult, TUploadError = string>(\n props: UseDropzoneProps<TUploadResult, TUploadError>\n): UseDropzoneReturn<TUploadResult, TUploadError> {\n const {\n onDropFile: handleDropFile,\n onRemoveFile: handleRemoveFile,\n shapeUploadError,\n onFileUploaded,\n onFileUploadError,\n onAllUploaded,\n onRootError,\n maxRetryCount,\n autoRetry = false,\n validation,\n shiftOnMaxFiles = false\n } = props\n\n const inputId = React.useId()\n const rootMessageId = `${inputId}-message`\n const rootDescriptionId = `${inputId}-description`\n const [rootError, setRootErrorState] = React.useState<string | undefined>(undefined)\n\n const setRootError = React.useCallback(\n (error: string | undefined) => {\n setRootErrorState(error)\n onRootError?.(error)\n },\n [onRootError]\n )\n\n const [fileStatuses, dispatch] = React.useReducer(\n fileStatusReducer<TUploadResult, TUploadError>,\n [] as DropzoneFileStatus<TUploadResult, TUploadError>[]\n )\n\n const getFileMessageId = React.useCallback((id: string) => `${inputId}-${id}-message`, [inputId])\n\n const isInvalid = React.useMemo(() => {\n return rootError !== undefined || fileStatuses.some((fileStatus) => fileStatus.status === 'error')\n }, [fileStatuses, rootError])\n\n const uploadFile = React.useCallback(\n async (file: File, id: string, retryCount = 0) => {\n try {\n const result = await handleDropFile(file)\n\n if (result.status === 'error') {\n if (autoRetry && retryCount < (maxRetryCount ?? Number.POSITIVE_INFINITY)) {\n dispatch({ type: 'update-status', id, status: 'pending' })\n return uploadFile(file, id, retryCount + 1)\n }\n\n dispatch({\n type: 'update-status',\n id,\n status: 'error',\n error: result.error,\n message: getUploadErrorMessage(result.error, shapeUploadError)\n })\n onFileUploadError?.(result.error)\n return\n }\n\n dispatch({\n type: 'update-status',\n id,\n status: 'success',\n result: result.result\n })\n onFileUploaded?.(result.result)\n } catch (error) {\n const uploadError = error as TUploadError\n\n dispatch({\n type: 'update-status',\n id,\n status: 'error',\n error: uploadError,\n message: getUploadErrorMessage(uploadError, shapeUploadError)\n })\n onFileUploadError?.(uploadError)\n }\n },\n [autoRetry, handleDropFile, maxRetryCount, onFileUploadError, onFileUploaded, shapeUploadError]\n )\n\n const onRemoveFile = React.useCallback(\n async (id: string) => {\n await handleRemoveFile?.(id)\n dispatch({ type: 'remove', id })\n },\n [handleRemoveFile]\n )\n\n const canRetry = React.useCallback(\n (id: string) => {\n const fileStatus = fileStatuses.find((item) => item.id === id)\n\n return fileStatus?.status === 'error' && fileStatus.tries <= (maxRetryCount ?? Number.POSITIVE_INFINITY)\n },\n [fileStatuses, maxRetryCount]\n )\n\n const onRetry = React.useCallback(\n async (id: string) => {\n if (!canRetry(id)) {\n return\n }\n\n const fileStatus = fileStatuses.find((item) => item.id === id)\n\n if (!fileStatus || fileStatus.status !== 'error') {\n return\n }\n\n dispatch({ type: 'update-status', id, status: 'pending' })\n await uploadFile(fileStatus.file, id)\n },\n [canRetry, fileStatuses, uploadFile]\n )\n\n const dropzone = useReactDropzone({\n accept: validation?.accept,\n minSize: validation?.minSize,\n maxSize: validation?.maxSize,\n maxFiles: validation?.maxFiles,\n noClick: true,\n noKeyboard: true,\n onDropAccepted: async (acceptedFiles) => {\n setRootError(undefined)\n\n let nextFiles = acceptedFiles\n const maxFiles = validation?.maxFiles ?? Number.POSITIVE_INFINITY\n const overflow = Number.isFinite(maxFiles)\n ? Math.max(fileStatuses.length + acceptedFiles.length - maxFiles, 0)\n : 0\n\n if (overflow > 0) {\n if (shiftOnMaxFiles) {\n const filesToRemove = fileStatuses.slice(0, Math.min(overflow, fileStatuses.length))\n\n await Promise.all(filesToRemove.map((fileStatus) => onRemoveFile(fileStatus.id)))\n\n const remainingOverflow = overflow - filesToRemove.length\n if (remainingOverflow > 0) {\n nextFiles = acceptedFiles.slice(remainingOverflow)\n }\n } else {\n setRootError(getRootError([ErrorCode.TooManyFiles], validation ?? {}))\n const availableSlots = Math.max(maxFiles - fileStatuses.length, 0)\n nextFiles = acceptedFiles.slice(0, availableSlots)\n }\n }\n\n if (nextFiles.length === 0) {\n return\n }\n\n await Promise.all(\n nextFiles.map(async (file) => {\n const id = crypto.randomUUID()\n dispatch({ type: 'add', id, fileName: file.name, file })\n await uploadFile(file, id)\n })\n )\n\n onAllUploaded?.()\n },\n onDropRejected: (fileRejections) => {\n setRootError(getRejectionMessage(fileRejections, validation ?? {}))\n }\n })\n\n return {\n getRootProps: dropzone.getRootProps,\n getInputProps: dropzone.getInputProps,\n open: dropzone.open,\n onRemoveFile,\n onRetry,\n canRetry,\n fileStatuses,\n isInvalid,\n isDragActive: dropzone.isDragActive,\n rootError,\n inputId,\n rootMessageId,\n rootDescriptionId,\n getFileMessageId\n }\n}\n\nfunction Dropzone<TUploadResult, TUploadError>({ children, ...dropzone }: DropzoneProps<TUploadResult, TUploadError>) {\n return <DropzoneContext.Provider value={dropzone}>{children}</DropzoneContext.Provider>\n}\n\nconst DropzoneArea = React.forwardRef<HTMLDivElement, DropzoneAreaProps>(\n ({ className, children, ...props }, forwardedRef) => {\n const context = useDropzoneContext()\n const describedBy =\n [context.rootDescriptionId, context.isInvalid ? context.rootMessageId : undefined].filter(Boolean).join(' ') ||\n undefined\n\n const { ref: rootRef, ...rootProps } = context.getRootProps({\n ...props,\n 'data-slot': 'dropzone-area',\n 'aria-describedby': describedBy,\n 'aria-invalid': context.isInvalid || undefined,\n className: cn(\n 'flex min-h-44 flex-col items-center justify-center gap-4 rounded-xl border border-dashed border-input bg-muted/20 px-6 py-8 text-center transition-colors',\n context.isDragActive && 'border-primary bg-primary/5',\n context.isInvalid && 'border-destructive bg-destructive/5',\n className\n )\n }) as React.HTMLAttributes<HTMLDivElement> & {\n ref?: React.Ref<HTMLDivElement>\n }\n\n const inputProps = context.getInputProps({\n id: context.inputId,\n className: 'sr-only',\n 'aria-describedby': describedBy,\n 'aria-invalid': context.isInvalid,\n tabIndex: -1\n })\n\n return (\n <div {...rootProps} ref={composeRefs(forwardedRef, rootRef)}>\n <input {...inputProps} />\n {children}\n </div>\n )\n }\n)\n\nconst DropzoneDescription = React.forwardRef<HTMLParagraphElement, DropzoneDescriptionProps>(\n ({ className, ...props }, ref) => {\n const context = useDropzoneContext()\n\n return (\n <p\n ref={ref}\n id={context.rootDescriptionId}\n data-slot=\"dropzone-description\"\n className={cn('text-sm text-muted-foreground', className)}\n {...props}\n />\n )\n }\n)\n\nconst DropzoneFileList = React.forwardRef<HTMLOListElement, DropzoneFileListProps>(({ className, ...props }, ref) => {\n useDropzoneContext()\n\n return <ol ref={ref} data-slot=\"dropzone-file-list\" className={cn('space-y-3', className)} {...props} />\n})\n\nconst DropzoneFileListItem = React.forwardRef<HTMLLIElement, DropzoneFileListItemProps<unknown, unknown>>(\n ({ className, file, children, ...props }, ref) => {\n const context = useDropzoneContext()\n const messageId = context.getFileMessageId(file.id)\n const isInvalid = file.status === 'error'\n const canRetry = context.canRetry(file.id)\n\n const value = React.useMemo<DropzoneFileListContextValue<unknown, unknown>>(\n () => ({\n onRemoveFile: () => context.onRemoveFile(file.id),\n onRetry: () => context.onRetry(file.id),\n fileStatus: file,\n canRetry,\n dropzoneId: context.inputId,\n messageId\n }),\n [canRetry, context, file, messageId]\n )\n\n return (\n <DropzoneFileListContext.Provider value={value}>\n <li\n ref={ref}\n data-slot=\"dropzone-file-item\"\n data-status={file.status}\n aria-describedby={isInvalid ? messageId : undefined}\n className={cn(\n 'rounded-xl border bg-card px-4 py-3 shadow-xs',\n file.status === 'error' && 'border-destructive/50',\n className\n )}\n {...props}\n >\n {children}\n </li>\n </DropzoneFileListContext.Provider>\n )\n }\n)\n\nconst DropzoneFileMessage = React.forwardRef<HTMLParagraphElement, DropzoneFileMessageProps>(\n ({ className, children, ...props }, ref) => {\n const context = useDropzoneFileListContext()\n const body =\n context.fileStatus.status === 'error'\n ? (context.fileStatus.message ?? String(context.fileStatus.error))\n : children\n\n return (\n <p\n ref={ref}\n id={context.messageId}\n data-slot=\"dropzone-file-message\"\n className={cn(\n 'min-h-5 text-[0.8rem] font-medium',\n context.fileStatus.status === 'error' && 'text-destructive',\n className\n )}\n {...props}\n >\n {body}\n </p>\n )\n }\n)\n\nconst DropzoneMessage = React.forwardRef<HTMLParagraphElement, DropzoneMessageProps>(\n ({ className, children, ...props }, ref) => {\n const context = useDropzoneContext()\n const body = context.rootError ?? children\n\n return (\n <p\n ref={ref}\n id={context.rootMessageId}\n data-slot=\"dropzone-message\"\n className={cn('min-h-5 text-[0.8rem] font-medium text-destructive', className)}\n {...props}\n >\n {body}\n </p>\n )\n }\n)\n\nconst DropzoneRemoveFile = React.forwardRef<HTMLButtonElement, DropzoneRemoveFileProps>(\n ({ className, onClick, size = 'icon-sm', type = 'button', variant = 'ghost', ...props }, ref) => {\n const context = useDropzoneFileListContext()\n\n const handleClick = React.useCallback<React.MouseEventHandler<HTMLButtonElement>>(\n (event) => {\n onClick?.(event)\n if (event.defaultPrevented) {\n return\n }\n\n void context.onRemoveFile()\n },\n [context, onClick]\n )\n\n return (\n <Button\n ref={ref}\n data-slot=\"dropzone-remove-file\"\n className={cn(className)}\n onClick={handleClick}\n size={size}\n type={type}\n variant={variant}\n {...props}\n />\n )\n }\n)\n\nconst DropzoneRetryFile = React.forwardRef<HTMLButtonElement, DropzoneRetryFileProps>(\n ({ className, disabled, onClick, size = 'icon-sm', type = 'button', variant = 'ghost', ...props }, ref) => {\n const context = useDropzoneFileListContext()\n const isDisabled = disabled || !context.canRetry\n\n const handleClick = React.useCallback<React.MouseEventHandler<HTMLButtonElement>>(\n (event) => {\n onClick?.(event)\n if (event.defaultPrevented || isDisabled) {\n return\n }\n\n void context.onRetry()\n },\n [context, isDisabled, onClick]\n )\n\n return (\n <Button\n ref={ref}\n data-slot=\"dropzone-retry-file\"\n className={cn(className)}\n disabled={isDisabled}\n onClick={handleClick}\n size={size}\n type={type}\n variant={variant}\n {...props}\n />\n )\n }\n)\n\nconst DropzoneTrigger = React.forwardRef<HTMLButtonElement, DropzoneTriggerProps>(\n ({ className, onClick, size = 'sm', type = 'button', variant = 'subtle', ...props }, ref) => {\n const context = useDropzoneContext()\n const describedBy =\n [context.rootDescriptionId, context.isInvalid ? context.rootMessageId : undefined].filter(Boolean).join(' ') ||\n undefined\n\n const handleClick = React.useCallback<React.MouseEventHandler<HTMLButtonElement>>(\n (event) => {\n onClick?.(event)\n if (event.defaultPrevented) {\n return\n }\n\n context.open()\n },\n [context, onClick]\n )\n\n return (\n <Button\n ref={ref}\n aria-controls={context.inputId}\n aria-describedby={describedBy}\n aria-invalid={context.isInvalid || undefined}\n data-slot=\"dropzone-trigger\"\n className={cn(className)}\n onClick={handleClick}\n size={size}\n type={type}\n variant={variant}\n {...props}\n />\n )\n }\n)\n\nconst InfiniteProgress = React.forwardRef<HTMLDivElement, InfiniteProgressProps>(\n ({ className, status, ...props }, ref) => {\n const done = status === 'success' || status === 'error'\n const isError = status === 'error'\n\n return (\n <div\n ref={ref}\n aria-valuemax={100}\n aria-valuemin={0}\n aria-valuetext={valueTextMap[status]}\n data-slot=\"dropzone-progress\"\n data-status={status}\n role=\"progressbar\"\n className={cn('relative h-2 w-full overflow-hidden rounded-full bg-muted', className)}\n {...props}\n >\n <div\n className={cn(\n 'h-full w-full rounded-full bg-primary transition-transform',\n done ? 'translate-x-0' : 'animate-infinite-progress',\n isError && 'bg-destructive'\n )}\n />\n </div>\n )\n }\n)\n\nDropzone.displayName = 'Dropzone'\nDropzoneArea.displayName = 'DropzoneArea'\nDropzoneDescription.displayName = 'DropzoneDescription'\nDropzoneFileList.displayName = 'DropzoneFileList'\nDropzoneFileListItem.displayName = 'DropzoneFileListItem'\nDropzoneFileMessage.displayName = 'DropzoneFileMessage'\nDropzoneMessage.displayName = 'DropzoneMessage'\nDropzoneRemoveFile.displayName = 'DropzoneRemoveFile'\nDropzoneRetryFile.displayName = 'DropzoneRetryFile'\nDropzoneTrigger.displayName = 'DropzoneTrigger'\nInfiniteProgress.displayName = 'InfiniteProgress'\n\nexport {\n Dropzone,\n DropzoneArea,\n DropzoneDescription,\n DropzoneFileList,\n DropzoneFileListItem,\n DropzoneFileMessage,\n DropzoneMessage,\n DropzoneRemoveFile,\n DropzoneRetryFile,\n DropzoneTrigger,\n ErrorCode,\n type FileError,\n InfiniteProgress,\n useDropzone\n}\n"],"mappings":"kSAaA,MAAM,EAAqB,CACzB,EAAU,gBACV,EAAU,aACV,EAAU,aACV,EAAU,YACZ,EAiJM,EAAuB,IAAI,IAAe,CAAkB,EAE5D,EAAe,CACnB,QAAS,gBACT,QAAS,OACT,MAAO,OACT,EAEM,EAAkB,EAAM,cAA0D,IAAI,EAEtF,EAA0B,EAAM,cAAqE,IAAI,EAE/G,SAAS,kBACP,EACA,EACmD,CACnD,OAAQ,EAAO,KAAf,CACE,IAAK,MACH,MAAO,CACL,GAAG,EACH,CACE,GAAI,EAAO,GACX,SAAU,EAAO,SACjB,KAAM,EAAO,KACb,OAAQ,UACR,MAAO,CACT,CACF,EACF,IAAK,SACH,OAAO,EAAM,OAAQ,GAAe,EAAW,KAAO,EAAO,EAAE,EACjE,IAAK,gBACH,OAAO,EAAM,IAAK,GACZ,EAAW,KAAO,EAAO,GAIzB,EAAO,SAAW,UACb,CACL,GAAG,EACH,OAAQ,UACR,MAAO,IAAA,GACP,QAAS,IAAA,GACT,OAAQ,IAAA,GACR,MAAO,EAAW,MAAQ,CAC5B,EAGE,EAAO,SAAW,QACb,CACL,GAAG,EACH,OAAQ,QACR,MAAO,EAAO,MACd,QAAS,EAAO,QAChB,OAAQ,IAAA,EACV,EAGK,CACL,GAAG,EACH,OAAQ,UACR,OAAQ,EAAO,OACf,MAAO,IAAA,GACP,QAAS,IAAA,EACX,EA9BS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CACL,CAAA,CAEL,CACF,EAEM,EAAmB,EAAM,YAC5B,CAAE,YAAW,SAAQ,GAAG,GAAS,IAAQ,CACxC,IAAM,EAAO,IAAW,WAAa,IAAW,QAC1C,EAAU,IAAW,QAE3B,OACE,EAAC,MAAD,CACO,MACL,gBAAe,IACf,gBAAe,EACf,iBAAgB,EAAa,GAC7B,YAAU,oBACV,cAAa,EACb,KAAK,cACL,UAAW,EAAG,4DAA6D,CAAS,EACpF,GAAI,WAEJ,EAAC,MAAD,CACE,UAAW,EACT,6DACA,EAAO,gBAAkB,4BACzB,GAAW,gBACb,CACD,CAAA,CACE,CAAA,CAET,CACF,EAEA,SAAS,YAAc,WACvB,EAAa,YAAc,eAC3B,EAAoB,YAAc,sBAClC,EAAiB,YAAc,mBAC/B,EAAqB,YAAc,uBACnC,EAAoB,YAAc,sBAClC,EAAgB,YAAc,kBAC9B,EAAmB,YAAc,qBACjC,EAAkB,YAAc,oBAChC,EAAgB,YAAc,kBAC9B,EAAiB,YAAc"}
1
+ {"version":3,"file":"dropzone.js","names":["useReactDropzone"],"sources":["../../src/components/dropzone.tsx"],"sourcesContent":["import * as React from 'react'\nimport {\n type Accept,\n ErrorCode,\n type FileError,\n type FileRejection,\n useDropzone as useReactDropzone\n} from 'react-dropzone'\n\nimport { composeRefs } from '../lib/compose-refs'\nimport { cn } from '../lib/utils'\nimport { Button, type ButtonProps } from './button'\n\nconst dropzoneErrorCodes = [\n ErrorCode.FileInvalidType,\n ErrorCode.FileTooLarge,\n ErrorCode.FileTooSmall,\n ErrorCode.TooManyFiles\n]\n\ntype DropzoneAction<TUploadResult, TUploadError> =\n | {\n type: 'add'\n id: string\n fileName: string\n file: File\n }\n | {\n type: 'remove'\n id: string\n }\n | {\n type: 'update-status'\n id: string\n status: 'pending'\n }\n | {\n type: 'update-status'\n id: string\n status: 'error'\n error: TUploadError\n message?: string\n }\n | {\n type: 'update-status'\n id: string\n status: 'success'\n result: TUploadResult\n }\n\nexport type DropzoneUploadResult<TUploadResult, TUploadError> =\n | {\n status: 'error'\n error: TUploadError\n }\n | {\n status: 'success'\n result: TUploadResult\n }\n\nexport type DropzoneFileStatus<TUploadResult, TUploadError> = {\n id: string\n fileName: string\n file: File\n tries: number\n} & (\n | {\n status: 'pending'\n error?: undefined\n message?: undefined\n result?: undefined\n }\n | {\n status: 'error'\n error: TUploadError\n message?: string\n result?: undefined\n }\n | {\n status: 'success'\n result: TUploadResult\n error?: undefined\n message?: undefined\n }\n)\n\nexport type FileStatus<TUploadResult, TUploadError> = DropzoneFileStatus<TUploadResult, TUploadError>\n\nexport type DropzoneValidation = {\n accept?: Accept\n minSize?: number\n maxSize?: number\n maxFiles?: number\n}\n\nexport type UseDropzoneProps<TUploadResult, TUploadError = string> = {\n onDropFile: (file: File) => Promise<DropzoneUploadResult<TUploadResult, TUploadError>>\n onRemoveFile?: (id: string) => void | Promise<void>\n onFileUploaded?: (result: TUploadResult) => void\n onFileUploadError?: (error: TUploadError) => void\n onAllUploaded?: () => void\n onRootError?: (error: string | undefined) => void\n shapeUploadError?: (error: TUploadError) => string | undefined\n maxRetryCount?: number\n autoRetry?: boolean\n validation?: DropzoneValidation\n shiftOnMaxFiles?: boolean\n}\n\nexport interface UseDropzoneReturn<TUploadResult, TUploadError> {\n getRootProps: ReturnType<typeof useReactDropzone>['getRootProps']\n getInputProps: ReturnType<typeof useReactDropzone>['getInputProps']\n open: () => void\n onRemoveFile: (id: string) => Promise<void>\n onRetry: (id: string) => Promise<void>\n canRetry: (id: string) => boolean\n fileStatuses: DropzoneFileStatus<TUploadResult, TUploadError>[]\n isInvalid: boolean\n isDragActive: boolean\n rootError: string | undefined\n inputId: string\n rootMessageId: string\n rootDescriptionId: string\n getFileMessageId: (id: string) => string\n}\n\nexport type DropzoneProps<TUploadResult, TUploadError> = React.PropsWithChildren<\n UseDropzoneReturn<TUploadResult, TUploadError>\n>\n\nexport type DropzoneAreaProps = React.ComponentProps<'div'>\n\nexport type DropzoneDescriptionProps = React.ComponentProps<'p'>\n\nexport type DropzoneFileListProps = React.ComponentProps<'ol'>\n\nexport type DropzoneFileListItemProps<TUploadResult, TUploadError> = React.ComponentProps<'li'> & {\n file: DropzoneFileStatus<TUploadResult, TUploadError>\n}\n\nexport type DropzoneFileMessageProps = React.ComponentProps<'p'>\n\nexport type DropzoneMessageProps = React.ComponentProps<'p'>\n\nexport type DropzoneRemoveFileProps = ButtonProps\n\nexport type DropzoneRetryFileProps = ButtonProps\n\nexport type DropzoneTriggerProps = ButtonProps\n\nexport type InfiniteProgressProps = React.ComponentProps<'div'> & {\n status: 'pending' | 'success' | 'error'\n}\n\ntype DropzoneFileListContextValue<TUploadResult, TUploadError> = {\n onRemoveFile: () => Promise<void>\n onRetry: () => Promise<void>\n fileStatus: DropzoneFileStatus<TUploadResult, TUploadError>\n canRetry: boolean\n dropzoneId: string\n messageId: string\n}\n\nconst dropzoneErrorCodeSet = new Set<ErrorCode>(dropzoneErrorCodes)\n\nconst valueTextMap = {\n pending: 'indeterminate',\n success: '100%',\n error: 'error'\n} as const\n\nconst DropzoneContext = React.createContext<UseDropzoneReturn<unknown, unknown> | null>(null)\n\nconst DropzoneFileListContext = React.createContext<DropzoneFileListContextValue<unknown, unknown> | null>(null)\n\nfunction fileStatusReducer<TUploadResult, TUploadError>(\n state: DropzoneFileStatus<TUploadResult, TUploadError>[],\n action: DropzoneAction<TUploadResult, TUploadError>\n): DropzoneFileStatus<TUploadResult, TUploadError>[] {\n switch (action.type) {\n case 'add':\n return [\n ...state,\n {\n id: action.id,\n fileName: action.fileName,\n file: action.file,\n status: 'pending',\n tries: 1\n }\n ]\n case 'remove':\n return state.filter((fileStatus) => fileStatus.id !== action.id)\n case 'update-status':\n return state.map((fileStatus) => {\n if (fileStatus.id !== action.id) {\n return fileStatus\n }\n\n if (action.status === 'pending') {\n return {\n ...fileStatus,\n status: 'pending',\n error: undefined,\n message: undefined,\n result: undefined,\n tries: fileStatus.tries + 1\n }\n }\n\n if (action.status === 'error') {\n return {\n ...fileStatus,\n status: 'error',\n error: action.error,\n message: action.message,\n result: undefined\n }\n }\n\n return {\n ...fileStatus,\n status: 'success',\n result: action.result,\n error: undefined,\n message: undefined\n }\n })\n }\n}\n\nfunction formatAcceptedTypes(accept?: Accept) {\n if (!accept) {\n return undefined\n }\n\n const acceptedTypes = Object.entries(accept).flatMap(([mimeType, extensions]) => {\n return extensions.length > 0 ? extensions : [mimeType]\n })\n\n return acceptedTypes.length > 0 ? acceptedTypes.join(', ') : undefined\n}\n\nfunction getDropzoneErrorCodes(fileRejections: FileRejection[]) {\n const errorCodes = fileRejections.flatMap((rejection) =>\n rejection.errors.map((error) => error.code as ErrorCode).filter((errorCode) => dropzoneErrorCodeSet.has(errorCode))\n )\n\n return Array.from(new Set(errorCodes))\n}\n\nfunction getRootError(errorCodes: ErrorCode[], limits: DropzoneValidation) {\n const errors = errorCodes.flatMap((errorCode) => {\n switch (errorCode) {\n case 'file-invalid-type': {\n const acceptedTypes = formatAcceptedTypes(limits.accept)\n return acceptedTypes ? [`only ${acceptedTypes} files are allowed`] : ['this file type is not allowed']\n }\n case 'file-too-large': {\n if (!limits.maxSize) {\n return ['this file is too large']\n }\n\n return [`max size is ${(limits.maxSize / (1024 * 1024)).toFixed(2)} MB`]\n }\n case 'file-too-small': {\n if (!limits.minSize) {\n return ['this file is too small']\n }\n\n return [`min size is ${(limits.minSize / (1024 * 1024)).toFixed(2)} MB`]\n }\n case 'too-many-files':\n return limits.maxFiles ? [`max ${limits.maxFiles} files`] : ['too many files']\n default:\n return []\n }\n })\n\n if (errors.length === 0) {\n return 'Unable to add the selected files'\n }\n\n const [firstError, ...restErrors] = errors as [string, ...string[]]\n return `${firstError.charAt(0).toUpperCase()}${firstError.slice(1)}${restErrors.length > 0 ? `, ${restErrors.join(', ')}` : ''}`\n}\n\nfunction getRejectionMessage(fileRejections: FileRejection[], limits: DropzoneValidation) {\n const errorCodes = getDropzoneErrorCodes(fileRejections)\n\n if (errorCodes.length > 0) {\n return getRootError(errorCodes, limits)\n }\n\n return fileRejections[0]?.errors[0]?.message ?? 'Unable to add the selected files'\n}\n\nfunction getUploadErrorMessage<TUploadError>(\n error: TUploadError,\n shapeUploadError?: (error: TUploadError) => string | undefined\n) {\n if (shapeUploadError) {\n const message = shapeUploadError(error)\n if (message !== undefined) {\n return message\n }\n }\n\n if (typeof error === 'string') {\n return error\n }\n\n if (error instanceof Error) {\n return error.message\n }\n\n return undefined\n}\n\nfunction useDropzoneContext<TUploadResult, TUploadError>() {\n const context = React.useContext(DropzoneContext)\n\n if (!context) {\n throw new Error('Dropzone components must be used within a Dropzone.')\n }\n\n return context as UseDropzoneReturn<TUploadResult, TUploadError>\n}\n\nfunction useDropzoneFileListContext<TUploadResult, TUploadError>() {\n const context = React.useContext(DropzoneFileListContext)\n\n if (!context) {\n throw new Error('Dropzone file actions must be used within a DropzoneFileListItem.')\n }\n\n return context as DropzoneFileListContextValue<TUploadResult, TUploadError>\n}\n\nfunction useDropzone<TUploadResult, TUploadError = string>(\n props: UseDropzoneProps<TUploadResult, TUploadError>\n): UseDropzoneReturn<TUploadResult, TUploadError> {\n const {\n onDropFile: handleDropFile,\n onRemoveFile: handleRemoveFile,\n shapeUploadError,\n onFileUploaded,\n onFileUploadError,\n onAllUploaded,\n onRootError,\n maxRetryCount,\n autoRetry = false,\n validation,\n shiftOnMaxFiles = false\n } = props\n\n const inputId = React.useId()\n const rootMessageId = `${inputId}-message`\n const rootDescriptionId = `${inputId}-description`\n const [rootError, setRootErrorState] = React.useState<string | undefined>(undefined)\n\n const setRootError = React.useCallback(\n (error: string | undefined) => {\n setRootErrorState(error)\n onRootError?.(error)\n },\n [onRootError]\n )\n\n const [fileStatuses, dispatch] = React.useReducer(\n fileStatusReducer<TUploadResult, TUploadError>,\n [] as DropzoneFileStatus<TUploadResult, TUploadError>[]\n )\n\n const getFileMessageId = React.useCallback((id: string) => `${inputId}-${id}-message`, [inputId])\n\n const isInvalid = React.useMemo(() => {\n return rootError !== undefined || fileStatuses.some((fileStatus) => fileStatus.status === 'error')\n }, [fileStatuses, rootError])\n\n const uploadFile = React.useCallback(\n async (file: File, id: string, retryCount = 0) => {\n try {\n const result = await handleDropFile(file)\n\n if (result.status === 'error') {\n if (autoRetry && retryCount < (maxRetryCount ?? Number.POSITIVE_INFINITY)) {\n dispatch({ type: 'update-status', id, status: 'pending' })\n return uploadFile(file, id, retryCount + 1)\n }\n\n dispatch({\n type: 'update-status',\n id,\n status: 'error',\n error: result.error,\n message: getUploadErrorMessage(result.error, shapeUploadError)\n })\n onFileUploadError?.(result.error)\n return\n }\n\n dispatch({\n type: 'update-status',\n id,\n status: 'success',\n result: result.result\n })\n onFileUploaded?.(result.result)\n } catch (error) {\n const uploadError = error as TUploadError\n\n dispatch({\n type: 'update-status',\n id,\n status: 'error',\n error: uploadError,\n message: getUploadErrorMessage(uploadError, shapeUploadError)\n })\n onFileUploadError?.(uploadError)\n }\n },\n [autoRetry, handleDropFile, maxRetryCount, onFileUploadError, onFileUploaded, shapeUploadError]\n )\n\n const onRemoveFile = React.useCallback(\n async (id: string) => {\n await handleRemoveFile?.(id)\n dispatch({ type: 'remove', id })\n },\n [handleRemoveFile]\n )\n\n const canRetry = React.useCallback(\n (id: string) => {\n const fileStatus = fileStatuses.find((item) => item.id === id)\n\n return fileStatus?.status === 'error' && fileStatus.tries <= (maxRetryCount ?? Number.POSITIVE_INFINITY)\n },\n [fileStatuses, maxRetryCount]\n )\n\n const onRetry = React.useCallback(\n async (id: string) => {\n if (!canRetry(id)) {\n return\n }\n\n const fileStatus = fileStatuses.find((item) => item.id === id)\n\n if (fileStatus?.status !== 'error') {\n return\n }\n\n dispatch({ type: 'update-status', id, status: 'pending' })\n await uploadFile(fileStatus.file, id)\n },\n [canRetry, fileStatuses, uploadFile]\n )\n\n const dropzone = useReactDropzone({\n accept: validation?.accept,\n minSize: validation?.minSize,\n maxSize: validation?.maxSize,\n maxFiles: validation?.maxFiles,\n noClick: true,\n noKeyboard: true,\n onDropAccepted: async (acceptedFiles) => {\n setRootError(undefined)\n\n let nextFiles = acceptedFiles\n const maxFiles = validation?.maxFiles ?? Number.POSITIVE_INFINITY\n const overflow = Number.isFinite(maxFiles)\n ? Math.max(fileStatuses.length + acceptedFiles.length - maxFiles, 0)\n : 0\n\n if (overflow > 0) {\n if (shiftOnMaxFiles) {\n const filesToRemove = fileStatuses.slice(0, Math.min(overflow, fileStatuses.length))\n\n await Promise.all(filesToRemove.map((fileStatus) => onRemoveFile(fileStatus.id)))\n\n const remainingOverflow = overflow - filesToRemove.length\n if (remainingOverflow > 0) {\n nextFiles = acceptedFiles.slice(remainingOverflow)\n }\n } else {\n setRootError(getRootError([ErrorCode.TooManyFiles], validation ?? {}))\n const availableSlots = Math.max(maxFiles - fileStatuses.length, 0)\n nextFiles = acceptedFiles.slice(0, availableSlots)\n }\n }\n\n if (nextFiles.length === 0) {\n return\n }\n\n await Promise.all(\n nextFiles.map(async (file) => {\n const id = crypto.randomUUID()\n dispatch({ type: 'add', id, fileName: file.name, file })\n await uploadFile(file, id)\n })\n )\n\n onAllUploaded?.()\n },\n onDropRejected: (fileRejections) => {\n setRootError(getRejectionMessage(fileRejections, validation ?? {}))\n }\n })\n\n return {\n getRootProps: dropzone.getRootProps,\n getInputProps: dropzone.getInputProps,\n open: dropzone.open,\n onRemoveFile,\n onRetry,\n canRetry,\n fileStatuses,\n isInvalid,\n isDragActive: dropzone.isDragActive,\n rootError,\n inputId,\n rootMessageId,\n rootDescriptionId,\n getFileMessageId\n }\n}\n\nfunction Dropzone<TUploadResult, TUploadError>({ children, ...dropzone }: DropzoneProps<TUploadResult, TUploadError>) {\n return <DropzoneContext.Provider value={dropzone}>{children}</DropzoneContext.Provider>\n}\n\nconst DropzoneArea = React.forwardRef<HTMLDivElement, DropzoneAreaProps>(\n ({ className, children, ...props }, forwardedRef) => {\n const context = useDropzoneContext()\n const describedBy =\n [context.rootDescriptionId, context.isInvalid ? context.rootMessageId : undefined].filter(Boolean).join(' ') ||\n undefined\n\n const { ref: rootRef, ...rootProps } = context.getRootProps({\n ...props,\n 'data-slot': 'dropzone-area',\n 'aria-describedby': describedBy,\n 'aria-invalid': context.isInvalid || undefined,\n className: cn(\n 'flex min-h-44 flex-col items-center justify-center gap-4 rounded-xl border border-dashed border-input bg-muted/20 px-6 py-8 text-center transition-colors',\n context.isDragActive && 'border-primary bg-primary/5',\n context.isInvalid && 'border-destructive bg-destructive/5',\n className\n )\n }) as React.HTMLAttributes<HTMLDivElement> & {\n ref?: React.Ref<HTMLDivElement>\n }\n\n const inputProps = context.getInputProps({\n id: context.inputId,\n className: 'sr-only',\n 'aria-describedby': describedBy,\n 'aria-invalid': context.isInvalid,\n tabIndex: -1\n })\n\n return (\n <div {...rootProps} ref={composeRefs(forwardedRef, rootRef)}>\n <input {...inputProps} />\n {children}\n </div>\n )\n }\n)\n\nconst DropzoneDescription = React.forwardRef<HTMLParagraphElement, DropzoneDescriptionProps>(\n ({ className, ...props }, ref) => {\n const context = useDropzoneContext()\n\n return (\n <p\n ref={ref}\n id={context.rootDescriptionId}\n data-slot=\"dropzone-description\"\n className={cn('text-sm text-muted-foreground', className)}\n {...props}\n />\n )\n }\n)\n\nconst DropzoneFileList = React.forwardRef<HTMLOListElement, DropzoneFileListProps>(({ className, ...props }, ref) => {\n useDropzoneContext()\n\n return <ol ref={ref} data-slot=\"dropzone-file-list\" className={cn('space-y-3', className)} {...props} />\n})\n\nconst DropzoneFileListItem = React.forwardRef<HTMLLIElement, DropzoneFileListItemProps<unknown, unknown>>(\n ({ className, file, children, ...props }, ref) => {\n const context = useDropzoneContext()\n const messageId = context.getFileMessageId(file.id)\n const isInvalid = file.status === 'error'\n const canRetry = context.canRetry(file.id)\n\n const value = React.useMemo<DropzoneFileListContextValue<unknown, unknown>>(\n () => ({\n onRemoveFile: () => context.onRemoveFile(file.id),\n onRetry: () => context.onRetry(file.id),\n fileStatus: file,\n canRetry,\n dropzoneId: context.inputId,\n messageId\n }),\n [canRetry, context, file, messageId]\n )\n\n return (\n <DropzoneFileListContext.Provider value={value}>\n <li\n ref={ref}\n data-slot=\"dropzone-file-item\"\n data-status={file.status}\n aria-describedby={isInvalid ? messageId : undefined}\n className={cn(\n 'rounded-xl border bg-card px-4 py-3 shadow-xs',\n file.status === 'error' && 'border-destructive/50',\n className\n )}\n {...props}\n >\n {children}\n </li>\n </DropzoneFileListContext.Provider>\n )\n }\n)\n\nconst DropzoneFileMessage = React.forwardRef<HTMLParagraphElement, DropzoneFileMessageProps>(\n ({ className, children, ...props }, ref) => {\n const context = useDropzoneFileListContext()\n const body =\n context.fileStatus.status === 'error'\n ? (context.fileStatus.message ?? String(context.fileStatus.error))\n : children\n\n return (\n <p\n ref={ref}\n id={context.messageId}\n data-slot=\"dropzone-file-message\"\n className={cn(\n 'min-h-5 text-[0.8rem] font-medium',\n context.fileStatus.status === 'error' && 'text-destructive',\n className\n )}\n {...props}\n >\n {body}\n </p>\n )\n }\n)\n\nconst DropzoneMessage = React.forwardRef<HTMLParagraphElement, DropzoneMessageProps>(\n ({ className, children, ...props }, ref) => {\n const context = useDropzoneContext()\n const body = context.rootError ?? children\n\n return (\n <p\n ref={ref}\n id={context.rootMessageId}\n data-slot=\"dropzone-message\"\n className={cn('min-h-5 text-[0.8rem] font-medium text-destructive', className)}\n {...props}\n >\n {body}\n </p>\n )\n }\n)\n\nconst DropzoneRemoveFile = React.forwardRef<HTMLButtonElement, DropzoneRemoveFileProps>(\n ({ className, onClick, size = 'icon-sm', type = 'button', variant = 'ghost', ...props }, ref) => {\n const context = useDropzoneFileListContext()\n\n const handleClick = React.useCallback<React.MouseEventHandler<HTMLButtonElement>>(\n (event) => {\n onClick?.(event)\n if (event.defaultPrevented) {\n return\n }\n\n void context.onRemoveFile()\n },\n [context, onClick]\n )\n\n return (\n <Button\n ref={ref}\n data-slot=\"dropzone-remove-file\"\n className={cn(className)}\n onClick={handleClick}\n size={size}\n type={type}\n variant={variant}\n {...props}\n />\n )\n }\n)\n\nconst DropzoneRetryFile = React.forwardRef<HTMLButtonElement, DropzoneRetryFileProps>(\n ({ className, disabled, onClick, size = 'icon-sm', type = 'button', variant = 'ghost', ...props }, ref) => {\n const context = useDropzoneFileListContext()\n const isDisabled = disabled || !context.canRetry\n\n const handleClick = React.useCallback<React.MouseEventHandler<HTMLButtonElement>>(\n (event) => {\n onClick?.(event)\n if (event.defaultPrevented || isDisabled) {\n return\n }\n\n void context.onRetry()\n },\n [context, isDisabled, onClick]\n )\n\n return (\n <Button\n ref={ref}\n data-slot=\"dropzone-retry-file\"\n className={cn(className)}\n disabled={isDisabled}\n onClick={handleClick}\n size={size}\n type={type}\n variant={variant}\n {...props}\n />\n )\n }\n)\n\nconst DropzoneTrigger = React.forwardRef<HTMLButtonElement, DropzoneTriggerProps>(\n ({ className, onClick, size = 'sm', type = 'button', variant = 'subtle', ...props }, ref) => {\n const context = useDropzoneContext()\n const describedBy =\n [context.rootDescriptionId, context.isInvalid ? context.rootMessageId : undefined].filter(Boolean).join(' ') ||\n undefined\n\n const handleClick = React.useCallback<React.MouseEventHandler<HTMLButtonElement>>(\n (event) => {\n onClick?.(event)\n if (event.defaultPrevented) {\n return\n }\n\n context.open()\n },\n [context, onClick]\n )\n\n return (\n <Button\n ref={ref}\n aria-controls={context.inputId}\n aria-describedby={describedBy}\n aria-invalid={context.isInvalid || undefined}\n data-slot=\"dropzone-trigger\"\n className={cn(className)}\n onClick={handleClick}\n size={size}\n type={type}\n variant={variant}\n {...props}\n />\n )\n }\n)\n\nconst InfiniteProgress = React.forwardRef<HTMLDivElement, InfiniteProgressProps>(\n ({ className, status, ...props }, ref) => {\n const done = status === 'success' || status === 'error'\n const isError = status === 'error'\n\n return (\n <div\n ref={ref}\n aria-valuemax={100}\n aria-valuemin={0}\n aria-valuetext={valueTextMap[status]}\n data-slot=\"dropzone-progress\"\n data-status={status}\n role=\"progressbar\"\n className={cn('relative h-2 w-full overflow-hidden rounded-full bg-muted', className)}\n {...props}\n >\n <div\n className={cn(\n 'h-full w-full rounded-full bg-primary transition-transform',\n done ? 'translate-x-0' : 'animate-infinite-progress',\n isError && 'bg-destructive'\n )}\n />\n </div>\n )\n }\n)\n\nDropzone.displayName = 'Dropzone'\nDropzoneArea.displayName = 'DropzoneArea'\nDropzoneDescription.displayName = 'DropzoneDescription'\nDropzoneFileList.displayName = 'DropzoneFileList'\nDropzoneFileListItem.displayName = 'DropzoneFileListItem'\nDropzoneFileMessage.displayName = 'DropzoneFileMessage'\nDropzoneMessage.displayName = 'DropzoneMessage'\nDropzoneRemoveFile.displayName = 'DropzoneRemoveFile'\nDropzoneRetryFile.displayName = 'DropzoneRetryFile'\nDropzoneTrigger.displayName = 'DropzoneTrigger'\nInfiniteProgress.displayName = 'InfiniteProgress'\n\nexport {\n Dropzone,\n DropzoneArea,\n DropzoneDescription,\n DropzoneFileList,\n DropzoneFileListItem,\n DropzoneFileMessage,\n DropzoneMessage,\n DropzoneRemoveFile,\n DropzoneRetryFile,\n DropzoneTrigger,\n ErrorCode,\n type FileError,\n InfiniteProgress,\n useDropzone\n}\n"],"mappings":"6SAaA,MAAM,EAAqB,CACzB,EAAU,gBACV,EAAU,aACV,EAAU,aACV,EAAU,YACZ,EAiJM,EAAuB,IAAI,IAAe,CAAkB,EAE5D,EAAe,CACnB,QAAS,gBACT,QAAS,OACT,MAAO,OACT,EAEM,EAAkB,EAAM,cAA0D,IAAI,EAEtF,EAA0B,EAAM,cAAqE,IAAI,EAE/G,SAAS,kBACP,EACA,EACmD,CACnD,OAAQ,EAAO,KAAf,CACE,IAAK,MACH,MAAO,CACL,GAAG,EACH,CACE,GAAI,EAAO,GACX,SAAU,EAAO,SACjB,KAAM,EAAO,KACb,OAAQ,UACR,MAAO,CACT,CACF,EACF,IAAK,SACH,OAAO,EAAM,OAAQ,GAAe,EAAW,KAAO,EAAO,EAAE,EACjE,IAAK,gBACH,OAAO,EAAM,IAAK,GACZ,EAAW,KAAO,EAAO,GAIzB,EAAO,SAAW,UACb,CACL,GAAG,EACH,OAAQ,UACR,MAAO,IAAA,GAC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AO,CAAC,CAAC,KAAK,GAAG,GAC3G,IAAA,GAEI,EAAc,EAAM,YACvB,GAAU,CACT,IAAU,CAAK,EACX,GAAM,kBAIV,EAAQ,KAAK,CACf,EACA,CAAC,EAAS,CAAO,CACnB,EAEA,OACE,EAAC,EAAD,CACO,MACL,gBAAe,EAAQ,QACvB,mBAAkB,EAClB,eAAc,EAAQ,WAAa,IAAA,GACnC,YAAU,mBACV,UAAW,EAAG,CAAS,EACvB,QAAS,EACH,OACA,OACG,UACT,GAAI,CACL,CAAA,CAEL,CACF,EAEM,EAAmB,EAAM,YAC5B,CAAE,YAAW,SAAQ,GAAG,GAAS,IAAQ,CACxC,IAAM,EAAO,IAAW,WAAa,IAAW,QAC1C,EAAU,IAAW,QAE3B,OACE,EAAC,MAAD,CACO,MACL,gBAAe,IACf,gBAAe,EACf,iBAAgB,EAAa,GAC7B,YAAU,oBACV,cAAa,EACb,KAAK,cACL,UAAW,EAAG,4DAA6D,CAAS,EACpF,GAAI,WAEJ,EAAC,MAAD,CACE,UAAW,EACT,6DACA,EAAO,gBAAkB,4BACzB,GAAW,gBACb,CACD,CAAA,CACE,CAAA,CAET,CACF,EAEA,SAAS,YAAc,WACvB,EAAa,YAAc,eAC3B,EAAoB,YAAc,sBAClC,EAAiB,YAAc,mBAC/B,EAAqB,YAAc,uBACnC,EAAoB,YAAc,sBAClC,EAAgB,YAAc,kBAC9B,EAAmB,YAAc,qBACjC,EAAkB,YAAc,oBAChC,EAAgB,YAAc,kBAC9B,EAAiB,YAAc"}
@@ -1,4 +1,4 @@
1
- import { n as __name } from "../chunk-CHh1Zzun.js";
1
+ import { n as __name } from "../rolldown-runtime-Bdj-bS2b.js";
2
2
  import { VariantProps } from "class-variance-authority";
3
3
 
4
4
  //#region src/components/empty.d.ts
@@ -11,11 +11,11 @@ type EmptyContentProps = React.ComponentProps<'div'>;
11
11
  declare function Empty({
12
12
  className,
13
13
  ...props
14
- }: EmptyProps): import("react/jsx-runtime").JSX.Element;
14
+ }: EmptyProps): import("react").JSX.Element;
15
15
  declare function EmptyHeader({
16
16
  className,
17
17
  ...props
18
- }: EmptyHeaderProps): import("react/jsx-runtime").JSX.Element;
18
+ }: EmptyHeaderProps): import("react").JSX.Element;
19
19
  declare const emptyMediaVariants: (props?: ({
20
20
  variant?: "default" | "icon" | null | undefined;
21
21
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
@@ -23,19 +23,19 @@ declare function EmptyMedia({
23
23
  className,
24
24
  variant,
25
25
  ...props
26
- }: EmptyMediaProps): import("react/jsx-runtime").JSX.Element;
26
+ }: EmptyMediaProps): import("react").JSX.Element;
27
27
  declare function EmptyTitle({
28
28
  className,
29
29
  ...props
30
- }: EmptyTitleProps): import("react/jsx-runtime").JSX.Element;
30
+ }: EmptyTitleProps): import("react").JSX.Element;
31
31
  declare function EmptyDescription({
32
32
  className,
33
33
  ...props
34
- }: EmptyDescriptionProps): import("react/jsx-runtime").JSX.Element;
34
+ }: EmptyDescriptionProps): import("react").JSX.Element;
35
35
  declare function EmptyContent({
36
36
  className,
37
37
  ...props
38
- }: EmptyContentProps): import("react/jsx-runtime").JSX.Element;
38
+ }: EmptyContentProps): import("react").JSX.Element;
39
39
  //#endregion
40
40
  export { Empty, EmptyContent, EmptyContentProps, EmptyDescription, EmptyDescriptionProps, EmptyHeader, EmptyHeaderProps, EmptyMedia, EmptyMediaProps, EmptyProps, EmptyTitle, EmptyTitleProps };
41
41
  //# sourceMappingURL=empty.d.ts.map
@@ -1,2 +1,2 @@
1
- import"../chunk-CHh1Zzun.js";import{cn as e}from"../lib/utils.js";import{jsx as t}from"react/jsx-runtime";import{cva as n}from"class-variance-authority";function Empty({className:n,...r}){return t(`div`,{"data-slot":`empty`,className:e(`gap-4 rounded-xl border-dashed p-6 flex w-full min-w-0 flex-1 flex-col items-center justify-center text-center text-balance`,n),...r})}function EmptyHeader({className:n,...r}){return t(`div`,{"data-slot":`empty-header`,className:e(`gap-2 flex max-w-sm flex-col items-center`,n),...r})}const r=n(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`bg-muted text-foreground flex size-8 shrink-0 items-center justify-center rounded-lg [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{variant:`default`}});function EmptyMedia({className:n,variant:i=`default`,...a}){return t(`div`,{"data-slot":`empty-icon`,"data-variant":i,className:e(r({variant:i,className:n})),...a})}function EmptyTitle({className:n,...r}){return t(`div`,{"data-slot":`empty-title`,className:e(`text-sm font-medium tracking-tight`,n),...r})}function EmptyDescription({className:n,...r}){return t(`div`,{"data-slot":`empty-description`,className:e(`text-sm/relaxed text-muted-foreground [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4`,n),...r})}function EmptyContent({className:n,...r}){return t(`div`,{"data-slot":`empty-content`,className:e(`gap-2.5 text-sm flex w-full max-w-sm min-w-0 flex-col items-center text-balance`,n),...r})}export{Empty,EmptyContent,EmptyDescription,EmptyHeader,EmptyMedia,EmptyTitle};
1
+ import"../rolldown-runtime-Bdj-bS2b.js";import{cn as e}from"../lib/utils.js";import{jsx as t}from"react/jsx-runtime";import{cva as n}from"class-variance-authority";function Empty({className:n,...r}){return t(`div`,{"data-slot":`empty`,className:e(`gap-4 rounded-xl border-dashed p-6 flex w-full min-w-0 flex-1 flex-col items-center justify-center text-center text-balance`,n),...r})}function EmptyHeader({className:n,...r}){return t(`div`,{"data-slot":`empty-header`,className:e(`gap-2 flex max-w-sm flex-col items-center`,n),...r})}const r=n(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`bg-muted text-foreground flex size-8 shrink-0 items-center justify-center rounded-lg [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{variant:`default`}});function EmptyMedia({className:n,variant:i=`default`,...a}){return t(`div`,{"data-slot":`empty-icon`,"data-variant":i,className:e(r({variant:i,className:n})),...a})}function EmptyTitle({className:n,...r}){return t(`div`,{"data-slot":`empty-title`,className:e(`text-sm font-medium tracking-tight`,n),...r})}function EmptyDescription({className:n,...r}){return t(`div`,{"data-slot":`empty-description`,className:e(`text-sm/relaxed text-muted-foreground [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4`,n),...r})}function EmptyContent({className:n,...r}){return t(`div`,{"data-slot":`empty-content`,className:e(`gap-2.5 text-sm flex w-full max-w-sm min-w-0 flex-col items-center text-balance`,n),...r})}export{Empty,EmptyContent,EmptyDescription,EmptyHeader,EmptyMedia,EmptyTitle};
2
2
  //# sourceMappingURL=empty.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"empty.js","names":[],"sources":["../../src/components/empty.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../lib/utils'\n\nexport type EmptyProps = React.ComponentProps<'div'>\n\nexport type EmptyHeaderProps = React.ComponentProps<'div'>\n\nexport type EmptyMediaProps = React.ComponentProps<'div'> & VariantProps<typeof emptyMediaVariants>\n\nexport type EmptyTitleProps = React.ComponentProps<'div'>\n\nexport type EmptyDescriptionProps = React.ComponentProps<'p'>\n\nexport type EmptyContentProps = React.ComponentProps<'div'>\n\nfunction Empty({ className, ...props }: EmptyProps) {\n return (\n <div\n data-slot=\"empty\"\n className={cn(\n 'gap-4 rounded-xl border-dashed p-6 flex w-full min-w-0 flex-1 flex-col items-center justify-center text-center text-balance',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction EmptyHeader({ className, ...props }: EmptyHeaderProps) {\n return (\n <div data-slot=\"empty-header\" className={cn('gap-2 flex max-w-sm flex-col items-center', className)} {...props} />\n )\n}\n\nconst emptyMediaVariants = cva(\n 'mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0',\n {\n variants: {\n variant: {\n default: 'bg-transparent',\n icon: \"bg-muted text-foreground flex size-8 shrink-0 items-center justify-center rounded-lg [&_svg:not([class*='size-'])]:size-4\"\n }\n },\n defaultVariants: {\n variant: 'default'\n }\n }\n)\n\nfunction EmptyMedia({ className, variant = 'default', ...props }: EmptyMediaProps) {\n return (\n <div\n data-slot=\"empty-icon\"\n data-variant={variant}\n className={cn(emptyMediaVariants({ variant, className }))}\n {...props}\n />\n )\n}\n\nfunction EmptyTitle({ className, ...props }: EmptyTitleProps) {\n return <div data-slot=\"empty-title\" className={cn('text-sm font-medium tracking-tight', className)} {...props} />\n}\n\nfunction EmptyDescription({ className, ...props }: EmptyDescriptionProps) {\n return (\n <div\n data-slot=\"empty-description\"\n className={cn(\n 'text-sm/relaxed text-muted-foreground [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction EmptyContent({ className, ...props }: EmptyContentProps) {\n return (\n <div\n data-slot=\"empty-content\"\n className={cn('gap-2.5 text-sm flex w-full max-w-sm min-w-0 flex-col items-center text-balance', className)}\n {...props}\n />\n )\n}\n\nexport { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle }\n"],"mappings":"yJAgBA,SAAS,MAAM,CAAE,YAAW,GAAG,GAAqB,CAClD,OACE,EAAC,MAAD,CACE,YAAU,QACV,UAAW,EACT,8HACA,CACF,EACA,GAAI,CACL,CAAA,CAEL,CAEA,SAAS,YAAY,CAAE,YAAW,GAAG,GAA2B,CAC9D,OACE,EAAC,MAAD,CAAK,YAAU,eAAe,UAAW,EAAG,4CAA6C,CAAS,EAAG,GAAI,CAAQ,CAAA,CAErH,CAEA,MAAM,EAAqB,EACzB,8FACA,CACE,SAAU,CACR,QAAS,CACP,QAAS,iBACT,KAAM,2HACR,CACF,EACA,gBAAiB,CACf,QAAS,SACX,CACF,CACF,EAEA,SAAS,WAAW,CAAE,YAAW,UAAU,UAAW,GAAG,GAA0B,CACjF,OACE,EAAC,MAAD,CACE,YAAU,aACV,eAAc,EACd,UAAW,EAAG,EAAmB,CAAE,UAAS,WAAU,CAAC,CAAC,EACxD,GAAI,CACL,CAAA,CAEL,CAEA,SAAS,WAAW,CAAE,YAAW,GAAG,GAA0B,CAC5D,OAAO,EAAC,MAAD,CAAK,YAAU,cAAc,UAAW,EAAG,qCAAsC,CAAS,EAAG,GAAI,CAAQ,CAAA,CAClH,CAEA,SAAS,iBAAiB,CAAE,YAAW,GAAG,GAAgC,CACxE,OACE,EAAC,MAAD,CACE,YAAU,oBACV,UAAW,EACT,0GACA,CACF,EACA,GAAI,CACL,CAAA,CAEL,CAEA,SAAS,aAAa,CAAE,YAAW,GAAG,GAA4B,CAChE,OACE,EAAC,MAAD,CACE,YAAU,gBACV,UAAW,EAAG,kFAAmF,CAAS,EAC1G,GAAI,CACL,CAAA,CAEL"}
1
+ {"version":3,"file":"empty.js","names":[],"sources":["../../src/components/empty.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../lib/utils'\n\nexport type EmptyProps = React.ComponentProps<'div'>\n\nexport type EmptyHeaderProps = React.ComponentProps<'div'>\n\nexport type EmptyMediaProps = React.ComponentProps<'div'> & VariantProps<typeof emptyMediaVariants>\n\nexport type EmptyTitleProps = React.ComponentProps<'div'>\n\nexport type EmptyDescriptionProps = React.ComponentProps<'p'>\n\nexport type EmptyContentProps = React.ComponentProps<'div'>\n\nfunction Empty({ className, ...props }: EmptyProps) {\n return (\n <div\n data-slot=\"empty\"\n className={cn(\n 'gap-4 rounded-xl border-dashed p-6 flex w-full min-w-0 flex-1 flex-col items-center justify-center text-center text-balance',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction EmptyHeader({ className, ...props }: EmptyHeaderProps) {\n return (\n <div data-slot=\"empty-header\" className={cn('gap-2 flex max-w-sm flex-col items-center', className)} {...props} />\n )\n}\n\nconst emptyMediaVariants = cva(\n 'mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0',\n {\n variants: {\n variant: {\n default: 'bg-transparent',\n icon: \"bg-muted text-foreground flex size-8 shrink-0 items-center justify-center rounded-lg [&_svg:not([class*='size-'])]:size-4\"\n }\n },\n defaultVariants: {\n variant: 'default'\n }\n }\n)\n\nfunction EmptyMedia({ className, variant = 'default', ...props }: EmptyMediaProps) {\n return (\n <div\n data-slot=\"empty-icon\"\n data-variant={variant}\n className={cn(emptyMediaVariants({ variant, className }))}\n {...props}\n />\n )\n}\n\nfunction EmptyTitle({ className, ...props }: EmptyTitleProps) {\n return <div data-slot=\"empty-title\" className={cn('text-sm font-medium tracking-tight', className)} {...props} />\n}\n\nfunction EmptyDescription({ className, ...props }: EmptyDescriptionProps) {\n return (\n <div\n data-slot=\"empty-description\"\n className={cn(\n 'text-sm/relaxed text-muted-foreground [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction EmptyContent({ className, ...props }: EmptyContentProps) {\n return (\n <div\n data-slot=\"empty-content\"\n className={cn('gap-2.5 text-sm flex w-full max-w-sm min-w-0 flex-col items-center text-balance', className)}\n {...props}\n />\n )\n}\n\nexport { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle }\n"],"mappings":"oKAgBA,SAAS,MAAM,CAAE,YAAW,GAAG,GAAqB,CAClD,OACE,EAAC,MAAD,CACE,YAAU,QACV,UAAW,EACT,8HACA,CACF,EACA,GAAI,CACL,CAAA,CAEL,CAEA,SAAS,YAAY,CAAE,YAAW,GAAG,GAA2B,CAC9D,OACE,EAAC,MAAD,CAAK,YAAU,eAAe,UAAW,EAAG,4CAA6C,CAAS,EAAG,GAAI,CAAQ,CAAA,CAErH,CAEA,MAAM,EAAqB,EACzB,8FACA,CACE,SAAU,CACR,QAAS,CACP,QAAS,iBACT,KAAM,2HACR,CACF,EACA,gBAAiB,CACf,QAAS,SACX,CACF,CACF,EAEA,SAAS,WAAW,CAAE,YAAW,UAAU,UAAW,GAAG,GAA0B,CACjF,OACE,EAAC,MAAD,CACE,YAAU,aACV,eAAc,EACd,UAAW,EAAG,EAAmB,CAAE,UAAS,WAAU,CAAC,CAAC,EACxD,GAAI,CACL,CAAA,CAEL,CAEA,SAAS,WAAW,CAAE,YAAW,GAAG,GAA0B,CAC5D,OAAO,EAAC,MAAD,CAAK,YAAU,cAAc,UAAW,EAAG,qCAAsC,CAAS,EAAG,GAAI,CAAQ,CAAA,CAClH,CAEA,SAAS,iBAAiB,CAAE,YAAW,GAAG,GAAgC,CACxE,OACE,EAAC,MAAD,CACE,YAAU,oBACV,UAAW,EACT,0GACA,CACF,EACA,GAAI,CACL,CAAA,CAEL,CAEA,SAAS,aAAa,CAAE,YAAW,GAAG,GAA4B,CAChE,OACE,EAAC,MAAD,CACE,YAAU,gBACV,UAAW,EAAG,kFAAmF,CAAS,EAC1G,GAAI,CACL,CAAA,CAEL"}
@@ -1,4 +1,4 @@
1
- import { n as __name } from "../chunk-CHh1Zzun.js";
1
+ import { n as __name } from "../rolldown-runtime-Bdj-bS2b.js";
2
2
  import { Label } from "./label.js";
3
3
  import { VariantProps } from "class-variance-authority";
4
4
 
@@ -24,16 +24,16 @@ declare function useFieldControlId(id?: string): string | undefined;
24
24
  declare function FieldSet({
25
25
  className,
26
26
  ...props
27
- }: FieldSetProps): import("react/jsx-runtime").JSX.Element;
27
+ }: FieldSetProps): import("react").JSX.Element;
28
28
  declare function FieldLegend({
29
29
  className,
30
30
  variant,
31
31
  ...props
32
- }: FieldLegendProps): import("react/jsx-runtime").JSX.Element;
32
+ }: FieldLegendProps): import("react").JSX.Element;
33
33
  declare function FieldGroup({
34
34
  className,
35
35
  ...props
36
- }: FieldGroupProps): import("react/jsx-runtime").JSX.Element;
36
+ }: FieldGroupProps): import("react").JSX.Element;
37
37
  declare const fieldVariants: (props?: ({
38
38
  orientation?: "horizontal" | "vertical" | "responsive" | null | undefined;
39
39
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
@@ -42,35 +42,35 @@ declare function Field({
42
42
  className,
43
43
  orientation,
44
44
  ...props
45
- }: FieldProps): import("react/jsx-runtime").JSX.Element;
45
+ }: FieldProps): import("react").JSX.Element;
46
46
  declare function FieldContent({
47
47
  className,
48
48
  ...props
49
- }: FieldContentProps): import("react/jsx-runtime").JSX.Element;
49
+ }: FieldContentProps): import("react").JSX.Element;
50
50
  declare function FieldLabel({
51
51
  className,
52
52
  htmlFor,
53
53
  ...props
54
- }: FieldLabelProps): import("react/jsx-runtime").JSX.Element;
54
+ }: FieldLabelProps): import("react").JSX.Element;
55
55
  declare function FieldTitle({
56
56
  className,
57
57
  ...props
58
- }: FieldTitleProps): import("react/jsx-runtime").JSX.Element;
58
+ }: FieldTitleProps): import("react").JSX.Element;
59
59
  declare function FieldDescription({
60
60
  className,
61
61
  ...props
62
- }: FieldDescriptionProps): import("react/jsx-runtime").JSX.Element;
62
+ }: FieldDescriptionProps): import("react").JSX.Element;
63
63
  declare function FieldSeparator({
64
64
  children,
65
65
  className,
66
66
  ...props
67
- }: FieldSeparatorProps): import("react/jsx-runtime").JSX.Element;
67
+ }: FieldSeparatorProps): import("react").JSX.Element;
68
68
  declare function FieldError({
69
69
  className,
70
70
  children,
71
71
  errors,
72
72
  ...props
73
- }: FieldErrorProps): import("react/jsx-runtime").JSX.Element | null;
73
+ }: FieldErrorProps): import("react").JSX.Element | null;
74
74
  //#endregion
75
75
  export { Field, FieldContent, FieldContentProps, FieldDescription, FieldDescriptionProps, FieldError, FieldErrorProps, FieldGroup, FieldGroupProps, FieldLabel, FieldLabelProps, FieldLegend, FieldLegendProps, FieldProps, FieldSeparator, FieldSeparatorProps, FieldSet, FieldSetProps, FieldTitle, FieldTitleProps, useFieldControlId };
76
76
  //# sourceMappingURL=field.d.ts.map
@@ -1,2 +1,2 @@
1
- import"../chunk-CHh1Zzun.js";import{cn as e}from"../lib/utils.js";import{Separator as t}from"./separator.js";import{Label as n}from"./label.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";import{cva as a}from"class-variance-authority";import{createContext as o,useContext as s,useId as c,useMemo as l}from"react";const u=o(null);function useFieldControlId(e){let t=s(u);return e??t?.controlId}function FieldSet({className:t,...n}){return r(`fieldset`,{"data-slot":`field-set`,className:e(`flex flex-col gap-4`,`has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,t),...n})}function FieldLegend({className:t,variant:n=`legend`,...i}){return r(`legend`,{"data-slot":`field-legend`,"data-variant":n,className:e(`mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base`,t),...i})}function FieldGroup({className:t,...n}){return r(`div`,{"data-slot":`field-group`,className:e(`group/field-group @container/field-group flex w-full flex-col gap-5`,`data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,t),...n})}const d=a(`data-[invalid=true]:text-destructive gap-1 group/field flex w-full`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:*:data-[slot=field-label]:flex-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function Field({className:t,orientation:n=`vertical`,...i}){let a=c(),o=l(()=>({controlId:a}),[a]);return r(u.Provider,{value:o,children:r(`div`,{"data-slot":`field`,"data-orientation":n,className:e(d({orientation:n}),t),...i})})}function FieldContent({className:t,...n}){return r(`div`,{"data-slot":`field-content`,className:e(`gap-0.5 group/field-content flex flex-1 flex-col leading-snug`,t),...n})}function FieldLabel({className:t,htmlFor:i,...a}){return r(n,{"data-slot":`field-label`,htmlFor:useFieldControlId(i),className:e(`group/field-label peer/field-label flex w-fit gap-2 leading-snug`,`has-data-checked:bg-primary/5 has-data-checked:border-primary/30 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5`,`group-data-[disabled=true]/field:opacity-50`,t),...a})}function FieldTitle({className:t,...n}){return r(`div`,{"data-slot":`field-label`,className:e(`gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50 flex w-fit items-center leading-snug`,t),...n})}function FieldDescription({className:t,...n}){return r(`p`,{"data-slot":`field-description`,className:e(`text-muted-foreground text-left text-xs leading-normal font-normal`,`[[data-variant=legend]+&]:-mt-1.5 group-has-data-horizontal/field:text-balance last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,t),...n})}function FieldSeparator({children:n,className:a,...o}){return i(`div`,{"data-slot":`field-separator`,"data-content":!!n,className:e(`-my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2 relative`,a),...o,children:[r(t,{className:`absolute inset-0 top-1/2`}),n&&r(`span`,{className:`text-muted-foreground px-2 bg-background relative mx-auto block w-fit`,"data-slot":`field-separator-content`,children:n})]})}function FieldError({className:t,children:n,errors:i,...a}){let o=l(()=>{if(n)return n;if(!i?.length)return null;let e=[...new Map(i.map(e=>[e?.message,e])).values()];return e?.length===1?e[0]?.message:r(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:e.map(e=>e?.message&&r(`li`,{children:e.message},e.message))})},[n,i]);return o?r(`div`,{role:`alert`,"data-slot":`field-error`,className:e(`text-destructive text-sm font-normal`,t),...a,children:o}):null}export{Field,FieldContent,FieldDescription,FieldError,FieldGroup,FieldLabel,FieldLegend,FieldSeparator,FieldSet,FieldTitle,useFieldControlId};
1
+ import"../rolldown-runtime-Bdj-bS2b.js";import{cn as e}from"../lib/utils.js";import{Separator as t}from"./separator.js";import{Label as n}from"./label.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";import{cva as a}from"class-variance-authority";import{createContext as o,useContext as s,useId as c,useMemo as l}from"react";const u=o(null);function useFieldControlId(e){let t=s(u);return e??t?.controlId}function FieldSet({className:t,...n}){return r(`fieldset`,{"data-slot":`field-set`,className:e(`flex flex-col gap-4`,`has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,t),...n})}function FieldLegend({className:t,variant:n=`legend`,...i}){return r(`legend`,{"data-slot":`field-legend`,"data-variant":n,className:e(`mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base`,t),...i})}function FieldGroup({className:t,...n}){return r(`div`,{"data-slot":`field-group`,className:e(`group/field-group @container/field-group flex w-full flex-col gap-5`,`data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,t),...n})}const d=a(`data-[invalid=true]:text-destructive gap-1 group/field flex w-full`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:*:data-[slot=field-label]:flex-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function Field({className:t,orientation:n=`vertical`,...i}){let a=c(),o=l(()=>({controlId:a}),[a]);return r(u.Provider,{value:o,children:r(`div`,{"data-slot":`field`,"data-orientation":n,className:e(d({orientation:n}),t),...i})})}function FieldContent({className:t,...n}){return r(`div`,{"data-slot":`field-content`,className:e(`gap-0.5 group/field-content flex flex-1 flex-col leading-snug`,t),...n})}function FieldLabel({className:t,htmlFor:i,...a}){return r(n,{"data-slot":`field-label`,htmlFor:useFieldControlId(i),className:e(`group/field-label peer/field-label flex w-fit gap-2 leading-snug`,`has-data-checked:bg-primary/5 has-data-checked:border-primary/30 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5`,`group-data-[disabled=true]/field:opacity-50`,t),...a})}function FieldTitle({className:t,...n}){return r(`div`,{"data-slot":`field-label`,className:e(`gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50 flex w-fit items-center leading-snug`,t),...n})}function FieldDescription({className:t,...n}){return r(`p`,{"data-slot":`field-description`,className:e(`text-muted-foreground text-left text-xs leading-normal font-normal`,`[[data-variant=legend]+&]:-mt-1.5 group-has-data-horizontal/field:text-balance last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,t),...n})}function FieldSeparator({children:n,className:a,...o}){return i(`div`,{"data-slot":`field-separator`,"data-content":!!n,className:e(`-my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2 relative`,a),...o,children:[r(t,{className:`absolute inset-0 top-1/2`}),n&&r(`span`,{className:`text-muted-foreground px-2 bg-background relative mx-auto block w-fit`,"data-slot":`field-separator-content`,children:n})]})}function FieldError({className:t,children:n,errors:i,...a}){let o=l(()=>{if(n)return n;if(!i?.length)return null;let e=[...new Map(i.map(e=>[e?.message,e])).values()];return e?.length===1?e[0]?.message:r(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:e.map(e=>e?.message&&r(`li`,{children:e.message},e.message))})},[n,i]);return o?r(`div`,{role:`alert`,"data-slot":`field-error`,className:e(`text-destructive text-sm font-normal`,t),...a,children:o}):null}export{Field,FieldContent,FieldDescription,FieldError,FieldGroup,FieldLabel,FieldLegend,FieldSeparator,FieldSet,FieldTitle,useFieldControlId};
2
2
  //# sourceMappingURL=field.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"field.js","names":[],"sources":["../../src/components/field.tsx"],"sourcesContent":["import { createContext, useContext, useId, useMemo } from 'react'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../lib/utils'\nimport { Label } from './label'\nimport { Separator } from './separator'\n\nexport type FieldSetProps = React.ComponentProps<'fieldset'>\n\nexport type FieldLegendProps = React.ComponentProps<'legend'> & { variant?: 'legend' | 'label' }\n\nexport type FieldGroupProps = React.ComponentProps<'div'>\n\nexport type FieldContentProps = React.ComponentProps<'div'>\n\nexport type FieldLabelProps = React.ComponentProps<typeof Label>\n\nexport type FieldTitleProps = React.ComponentProps<'div'>\n\nexport type FieldDescriptionProps = React.ComponentProps<'p'>\n\nexport type FieldSeparatorProps = React.ComponentProps<'div'> & {\n children?: React.ReactNode\n}\n\nexport type FieldErrorProps = React.ComponentProps<'div'> & {\n errors?: Array<{ message?: string } | undefined>\n}\n\ntype FieldContextValue = {\n controlId: string\n}\n\nconst FieldContext = createContext<FieldContextValue | null>(null)\n\nfunction useFieldControlId(id?: string) {\n const context = useContext(FieldContext)\n\n return id ?? context?.controlId\n}\n\nfunction FieldSet({ className, ...props }: FieldSetProps) {\n return (\n <fieldset\n data-slot=\"field-set\"\n className={cn(\n 'flex flex-col gap-4',\n 'has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldLegend({ className, variant = 'legend', ...props }: FieldLegendProps) {\n return (\n <legend\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn('mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base', className)}\n {...props}\n />\n )\n}\n\nfunction FieldGroup({ className, ...props }: FieldGroupProps) {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n 'group/field-group @container/field-group flex w-full flex-col gap-5',\n 'data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4',\n className\n )}\n {...props}\n />\n )\n}\n\nconst fieldVariants = cva('data-[invalid=true]:text-destructive gap-1 group/field flex w-full', {\n variants: {\n orientation: {\n vertical: 'flex-col *:w-full [&>.sr-only]:w-auto',\n horizontal:\n 'flex-row items-center *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n responsive:\n 'flex-col *:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:*:data-[slot=field-label]:flex-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px'\n }\n },\n defaultVariants: {\n orientation: 'vertical'\n }\n})\n\nexport type FieldProps = React.ComponentProps<'div'> & VariantProps<typeof fieldVariants>\n\nfunction Field({ className, orientation = 'vertical', ...props }: FieldProps) {\n const controlId = useId()\n const contextValue = useMemo(() => ({ controlId }), [controlId])\n\n return (\n <FieldContext.Provider value={contextValue}>\n <div\n data-slot=\"field\"\n data-orientation={orientation}\n className={cn(fieldVariants({ orientation }), className)}\n {...props}\n />\n </FieldContext.Provider>\n )\n}\n\nfunction FieldContent({ className, ...props }: FieldContentProps) {\n return (\n <div\n data-slot=\"field-content\"\n className={cn('gap-0.5 group/field-content flex flex-1 flex-col leading-snug', className)}\n {...props}\n />\n )\n}\n\nfunction FieldLabel({ className, htmlFor, ...props }: FieldLabelProps) {\n const fieldControlId = useFieldControlId(htmlFor)\n\n return (\n <Label\n data-slot=\"field-label\"\n htmlFor={fieldControlId}\n className={cn(\n 'group/field-label peer/field-label flex w-fit gap-2 leading-snug',\n 'has-data-checked:bg-primary/5 has-data-checked:border-primary/30 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10',\n 'has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5',\n 'group-data-[disabled=true]/field:opacity-50',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldTitle({ className, ...props }: FieldTitleProps) {\n return (\n <div\n data-slot=\"field-label\"\n className={cn(\n 'gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50 flex w-fit items-center leading-snug',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldDescription({ className, ...props }: FieldDescriptionProps) {\n return (\n <p\n data-slot=\"field-description\"\n className={cn(\n 'text-muted-foreground text-left text-xs leading-normal font-normal',\n '[[data-variant=legend]+&]:-mt-1.5 group-has-data-horizontal/field:text-balance last:mt-0 nth-last-2:-mt-1',\n '[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldSeparator({ children, className, ...props }: FieldSeparatorProps) {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn('-my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2 relative', className)}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span\n className=\"text-muted-foreground px-2 bg-background relative mx-auto block w-fit\"\n data-slot=\"field-separator-content\"\n >\n {children}\n </span>\n )}\n </div>\n )\n}\n\nfunction FieldError({ className, children, errors, ...props }: FieldErrorProps) {\n const content = useMemo(() => {\n if (children) {\n return children\n }\n\n if (!errors?.length) {\n return null\n }\n\n const uniqueErrors = [...new Map(errors.map((error) => [error?.message, error])).values()]\n\n if (uniqueErrors?.length === 1) {\n return uniqueErrors[0]?.message\n }\n\n return (\n <ul className=\"ml-4 flex list-disc flex-col gap-1\">\n {uniqueErrors.map((error) => error?.message && <li key={error.message}>{error.message}</li>)}\n </ul>\n )\n }, [children, errors])\n\n if (!content) {\n return null\n }\n\n return (\n <div\n role=\"alert\"\n data-slot=\"field-error\"\n className={cn('text-destructive text-sm font-normal', className)}\n {...props}\n >\n {content}\n </div>\n )\n}\n\nexport {\n Field,\n FieldContent,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLabel,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldTitle,\n useFieldControlId\n}\n"],"mappings":"+TAkCA,MAAM,EAAe,EAA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XE,IAaX"}
1
+ {"version":3,"file":"field.js","names":[],"sources":["../../src/components/field.tsx"],"sourcesContent":["import { createContext, useContext, useId, useMemo } from 'react'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../lib/utils'\nimport { Label } from './label'\nimport { Separator } from './separator'\n\nexport type FieldSetProps = React.ComponentProps<'fieldset'>\n\nexport type FieldLegendProps = React.ComponentProps<'legend'> & { variant?: 'legend' | 'label' }\n\nexport type FieldGroupProps = React.ComponentProps<'div'>\n\nexport type FieldContentProps = React.ComponentProps<'div'>\n\nexport type FieldLabelProps = React.ComponentProps<typeof Label>\n\nexport type FieldTitleProps = React.ComponentProps<'div'>\n\nexport type FieldDescriptionProps = React.ComponentProps<'p'>\n\nexport type FieldSeparatorProps = React.ComponentProps<'div'> & {\n children?: React.ReactNode\n}\n\nexport type FieldErrorProps = React.ComponentProps<'div'> & {\n errors?: Array<{ message?: string } | undefined>\n}\n\ntype FieldContextValue = {\n controlId: string\n}\n\nconst FieldContext = createContext<FieldContextValue | null>(null)\n\nfunction useFieldControlId(id?: string) {\n const context = useContext(FieldContext)\n\n return id ?? context?.controlId\n}\n\nfunction FieldSet({ className, ...props }: FieldSetProps) {\n return (\n <fieldset\n data-slot=\"field-set\"\n className={cn(\n 'flex flex-col gap-4',\n 'has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldLegend({ className, variant = 'legend', ...props }: FieldLegendProps) {\n return (\n <legend\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn('mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base', className)}\n {...props}\n />\n )\n}\n\nfunction FieldGroup({ className, ...props }: FieldGroupProps) {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n 'group/field-group @container/field-group flex w-full flex-col gap-5',\n 'data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4',\n className\n )}\n {...props}\n />\n )\n}\n\nconst fieldVariants = cva('data-[invalid=true]:text-destructive gap-1 group/field flex w-full', {\n variants: {\n orientation: {\n vertical: 'flex-col *:w-full [&>.sr-only]:w-auto',\n horizontal:\n 'flex-row items-center *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n responsive:\n 'flex-col *:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:*:data-[slot=field-label]:flex-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px'\n }\n },\n defaultVariants: {\n orientation: 'vertical'\n }\n})\n\nexport type FieldProps = React.ComponentProps<'div'> & VariantProps<typeof fieldVariants>\n\nfunction Field({ className, orientation = 'vertical', ...props }: FieldProps) {\n const controlId = useId()\n const contextValue = useMemo(() => ({ controlId }), [controlId])\n\n return (\n <FieldContext.Provider value={contextValue}>\n <div\n data-slot=\"field\"\n data-orientation={orientation}\n className={cn(fieldVariants({ orientation }), className)}\n {...props}\n />\n </FieldContext.Provider>\n )\n}\n\nfunction FieldContent({ className, ...props }: FieldContentProps) {\n return (\n <div\n data-slot=\"field-content\"\n className={cn('gap-0.5 group/field-content flex flex-1 flex-col leading-snug', className)}\n {...props}\n />\n )\n}\n\nfunction FieldLabel({ className, htmlFor, ...props }: FieldLabelProps) {\n const fieldControlId = useFieldControlId(htmlFor)\n\n return (\n <Label\n data-slot=\"field-label\"\n htmlFor={fieldControlId}\n className={cn(\n 'group/field-label peer/field-label flex w-fit gap-2 leading-snug',\n 'has-data-checked:bg-primary/5 has-data-checked:border-primary/30 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10',\n 'has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5',\n 'group-data-[disabled=true]/field:opacity-50',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldTitle({ className, ...props }: FieldTitleProps) {\n return (\n <div\n data-slot=\"field-label\"\n className={cn(\n 'gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50 flex w-fit items-center leading-snug',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldDescription({ className, ...props }: FieldDescriptionProps) {\n return (\n <p\n data-slot=\"field-description\"\n className={cn(\n 'text-muted-foreground text-left text-xs leading-normal font-normal',\n '[[data-variant=legend]+&]:-mt-1.5 group-has-data-horizontal/field:text-balance last:mt-0 nth-last-2:-mt-1',\n '[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldSeparator({ children, className, ...props }: FieldSeparatorProps) {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn('-my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2 relative', className)}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span\n className=\"text-muted-foreground px-2 bg-background relative mx-auto block w-fit\"\n data-slot=\"field-separator-content\"\n >\n {children}\n </span>\n )}\n </div>\n )\n}\n\nfunction FieldError({ className, children, errors, ...props }: FieldErrorProps) {\n const content = useMemo(() => {\n if (children) {\n return children\n }\n\n if (!errors?.length) {\n return null\n }\n\n const uniqueErrors = [...new Map(errors.map((error) => [error?.message, error])).values()]\n\n if (uniqueErrors?.length === 1) {\n return uniqueErrors[0]?.message\n }\n\n return (\n <ul className=\"ml-4 flex list-disc flex-col gap-1\">\n {uniqueErrors.map((error) => error?.message && <li key={error.message}>{error.message}</li>)}\n </ul>\n )\n }, [children, errors])\n\n if (!content) {\n return null\n }\n\n return (\n <div\n role=\"alert\"\n data-slot=\"field-error\"\n className={cn('text-destructive text-sm font-normal', className)}\n {...props}\n >\n {content}\n </div>\n )\n}\n\nexport {\n Field,\n FieldContent,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLabel,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldTitle,\n useFieldControlId\n}\n"],"mappings":"0UAkCA,MAAM,EAAe,EAAwC,IAAI,EAEjE,SAAS,kBAAkB,EAAa,CACtC,IAAM,EAAU,EAAW,CAAY,EAEvC,OAAO,GAAM,GAAS,SACxB,CAEA,SAAS,SAAS,CAAE,YAAW,GAAG,GAAwB,CACxD,OACE,EAAC,WAAD,CACE,YAAU,YACV,UAAW,EACT,sBACA,+EACA,CACF,EACA,GAAI,CACL,CAAA,CAEL,CAEA,SAAS,YAAY,CAAE,YAAW,UAAU,SAAU,GAAG,GAA2B,CAClF,OACE,EAAC,SAAD,CACE,YAAU,eACV,eAAc,EACd,UAAW,EAAG,kFAAmF,CAAS,EAC1G,GAAI,CACL,CAAA,CAEL,CAEA,SAAS,WAAW,CAAE,YAAW,GAAG,GAA0B,CAC5D,OACE,EAAC,MAAD,CACE,YAAU,cACV,UAAW,EACT,sEACA,mEACA,CACF,EACA,GAAI,CACL,CAAA,CAEL,CAEA,MAAM,EAAgB,EAAI,qEAAsE,CAC9F,SAAU,CACR,YAAa,CACX,SAAU,wCACV,WACE,iLACF,WACE,+TACJ,CACF,EACA,gBAAiB,CACf,YAAa,UACf,CACF,CAAC,EAID,SAAS,MAAM,CAAE,YAAW,cAAc,WAAY,GAAG,GAAqB,CAC5E,IAAM,EAAY,EAAM,EAClB,EAAe,OAAe,CAAE,WAAU,GAAI,CAAC,CAAS,CAAC,EAE/D,OACE,EAAC,EAAa,SAAd,CAAuB,MAAO,WAC5B,EAAC,MAAD,CACE,YAAU,QACV,mBAAkB,EAClB,UAAW,EAAG,EAAc,CAAE,aAAY,CAAC,EAAG,CAAS,EACvD,GAAI,CACL,CAAA,CACoB,CAAA,CAE3B,CAEA,SAAS,aAAa,CAAE,YAAW,GAAG,GAA4B,CAChE,OACE,EAAC,MAAD,CACE,YAAU,gBACV,UAAW,EAAG,gEAAiE,CAAS,EACxF,GA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AU,CAAM,CAAC,EAMrB,OAJK,EAKH,EAAC,MAAD,CACE,KAAK,QACL,YAAU,cACV,UAAW,EAAG,uCAAwC,CAAS,EAC/D,GAAI,WAEH,CACE,CAAA,EAXE,IAaX"}
@@ -1,2 +1,2 @@
1
- import"../chunk-CHh1Zzun.js";import{Field as e,FieldLabel as t}from"./field.js";import{Checkbox as n}from"./checkbox.js";import{Input as r}from"./input.js";import{Textarea as i}from"./textarea.js";import{Select as a,SelectTrigger as o,SelectValue as s}from"./select.js";import{NativeSelect as c,NativeSelectOption as l}from"./native-select.js";import{a as u,r as d}from"../react.esm-BagSCtI3.js";import{Fragment as f,jsx as p,jsxs as m}from"react/jsx-runtime";describe(`Field automatic control ids`,()=>{it(`wires FieldLabel and Input with a generated id when ids are omitted`,()=>{d(m(e,{children:[p(t,{children:`Email`}),p(r,{})]}));let n=u.getByLabelText(`Email`),i=u.getByText(`Email`);expect(n.getAttribute(`id`)).toBeTruthy(),expect(i.getAttribute(`for`)).toBe(n.getAttribute(`id`))}),it(`preserves explicit input ids and label htmlFor values`,()=>{d(m(e,{children:[p(t,{htmlFor:`explicit-label-target`,children:`Email`}),p(r,{id:`explicit-input`})]})),expect(u.getByText(`Email`).getAttribute(`for`)).toBe(`explicit-label-target`),expect(document.getElementById(`explicit-input`)).not.toBeNull()}),it(`does not assign ids or throw outside Field`,()=>{let{container:e}=d(m(f,{children:[p(t,{children:`Email`}),p(r,{})]}));expect(e.querySelector(`[data-slot="field-label"]`)?.getAttribute(`for`)).toBeNull(),expect(e.querySelector(`[data-slot="input"]`)?.getAttribute(`id`)).toBeNull()}),it(`wires representative controls to the generated Field id`,()=>{d(m(f,{children:[m(e,{children:[p(t,{children:`Message`}),p(i,{})]}),m(e,{children:[p(t,{children:`Framework`}),p(c,{children:p(l,{value:`react`,children:`React`})})]}),m(e,{children:[p(t,{children:`Category`}),p(a,{children:p(o,{children:p(s,{placeholder:`Select a category`})})})]}),m(e,{children:[p(t,{children:`Terms`}),p(n,{})]})]}));for(let e of[`Message`,`Framework`,`Category`,`Terms`]){let t=u.getByText(e).getAttribute(`for`);expect(t).toBeTruthy(),expect(document.getElementById(t??``)).not.toBeNull()}})});
1
+ import"../rolldown-runtime-Bdj-bS2b.js";import{Field as e,FieldLabel as t}from"./field.js";import{Checkbox as n}from"./checkbox.js";import{Input as r}from"./input.js";import{Textarea as i}from"./textarea.js";import{Select as a,SelectTrigger as o,SelectValue as s}from"./select.js";import{NativeSelect as c,NativeSelectOption as l}from"./native-select.js";import{a as u,r as d}from"../react.esm-D88qr0ij.js";import{Fragment as f,jsx as p,jsxs as m}from"react/jsx-runtime";describe(`Field automatic control ids`,()=>{it(`wires FieldLabel and Input with a generated id when ids are omitted`,()=>{d(m(e,{children:[p(t,{children:`Email`}),p(r,{})]}));let n=u.getByLabelText(`Email`),i=u.getByText(`Email`);expect(n.getAttribute(`id`)).toBeTruthy(),expect(i.getAttribute(`for`)).toBe(n.getAttribute(`id`))}),it(`preserves explicit input ids and label htmlFor values`,()=>{d(m(e,{children:[p(t,{htmlFor:`explicit-label-target`,children:`Email`}),p(r,{id:`explicit-input`})]})),expect(u.getByText(`Email`).getAttribute(`for`)).toBe(`explicit-label-target`),expect(document.getElementById(`explicit-input`)).not.toBeNull()}),it(`does not assign ids or throw outside Field`,()=>{let{container:e}=d(m(f,{children:[p(t,{children:`Email`}),p(r,{})]}));expect(e.querySelector(`[data-slot="field-label"]`)?.getAttribute(`for`)).toBeNull(),expect(e.querySelector(`[data-slot="input"]`)?.getAttribute(`id`)).toBeNull()}),it(`wires representative controls to the generated Field id`,()=>{d(m(f,{children:[m(e,{children:[p(t,{children:`Message`}),p(i,{})]}),m(e,{children:[p(t,{children:`Framework`}),p(c,{children:p(l,{value:`react`,children:`React`})})]}),m(e,{children:[p(t,{children:`Category`}),p(a,{children:p(o,{children:p(s,{placeholder:`Select a category`})})})]}),m(e,{children:[p(t,{children:`Terms`}),p(n,{})]})]}));for(let e of[`Message`,`Framework`,`Category`,`Terms`]){let t=u.getByText(e).getAttribute(`for`);expect(t).toBeTruthy(),expect(document.getElementById(t??``)).not.toBeNull()}})});
2
2
  //# sourceMappingURL=field.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"field.spec.js","names":[],"sources":["../../src/components/field.spec.tsx"],"sourcesContent":["import { render, screen } from '@testing-library/react'\n\nimport { Checkbox } from './checkbox'\nimport { Field, FieldLabel } from './field'\nimport { Input } from './input'\nimport { NativeSelect, NativeSelectOption } from './native-select'\nimport { Select, SelectTrigger, SelectValue } from './select'\nimport { Textarea } from './textarea'\n\ndescribe('Field automatic control ids', () => {\n it('wires FieldLabel and Input with a generated id when ids are omitted', () => {\n render(\n <Field>\n <FieldLabel>Email</FieldLabel>\n <Input />\n </Field>\n )\n\n const input = screen.getByLabelText('Email')\n const label = screen.getByText('Email')\n\n expect(input.getAttribute('id')).toBeTruthy()\n expect(label.getAttribute('for')).toBe(input.getAttribute('id'))\n })\n\n it('preserves explicit input ids and label htmlFor values', () => {\n render(\n <Field>\n <FieldLabel htmlFor=\"explicit-label-target\">Email</FieldLabel>\n <Input id=\"explicit-input\" />\n </Field>\n )\n\n expect(screen.getByText('Email').getAttribute('for')).toBe('explicit-label-target')\n expect(document.getElementById('explicit-input')).not.toBeNull()\n })\n\n it('does not assign ids or throw outside Field', () => {\n const { container } = render(\n <>\n <FieldLabel>Email</FieldLabel>\n <Input />\n </>\n )\n\n expect(container.querySelector('[data-slot=\"field-label\"]')?.getAttribute('for')).toBeNull()\n expect(container.querySelector('[data-slot=\"input\"]')?.getAttribute('id')).toBeNull()\n })\n\n it('wires representative controls to the generated Field id', () => {\n render(\n <>\n <Field>\n <FieldLabel>Message</FieldLabel>\n <Textarea />\n </Field>\n\n <Field>\n <FieldLabel>Framework</FieldLabel>\n <NativeSelect>\n <NativeSelectOption value=\"react\">React</NativeSelectOption>\n </NativeSelect>\n </Field>\n\n <Field>\n <FieldLabel>Category</FieldLabel>\n <Select>\n <SelectTrigger>\n <SelectValue placeholder=\"Select a category\" />\n </SelectTrigger>\n </Select>\n </Field>\n\n <Field>\n <FieldLabel>Terms</FieldLabel>\n <Checkbox />\n </Field>\n </>\n )\n\n for (const label of ['Message', 'Framework', 'Category', 'Terms']) {\n const labelElement = screen.getByText(label)\n const controlId = labelElement.getAttribute('for')\n\n expect(controlId).toBeTruthy()\n expect(document.getElementById(controlId ?? '')).not.toBeNull()\n }\n })\n})\n"],"mappings":"4cASA,SAAS,kCAAqC,CAC5C,GAAG,0EAA6E,CAC9E,EACE,EAAC,EAAD,CAAA,SAAA,CACE,EAAC,EAAD,CAAA,SAAY,OAAiB,CAAA,EAC7B,EAAC,EAAD,CAAQ,CAAA,CACH,CAAA,CAAA,CACT,EAEA,IAAM,EAAQ,EAAO,eAAe,OAAO,EACrC,EAAQ,EAAO,UAAU,OAAO,EAEtC,OAAO,EAAM,aAAa,IAAI,CAAC,EAAE,WAAW,EAC5C,OAAO,EAAM,aAAa,KAAK,CAAC,EAAE,KAAK,EAAM,aAAa,IAAI,CAAC,CACjE,CAAC,EAED,GAAG,4DAA+D,CAChE,EACE,EAAC,EAAD,CAAA,SAAA,CACE,EAAC,EAAD,CAAY,QAAQ,iCAAwB,OAAiB,CAAA,EAC7D,EAAC,EAAD,CAAO,GAAG,gBAAkB,CAAA,CACvB,CAAA,CAAA,CACT,EAEA,OAAO,EAAO,UAAU,OAAO,EAAE,aAAa,KAAK,CAAC,EAAE,KAAK,uBAAuB,EAClF,OAAO,SAAS,eAAe,gBAAgB,CAAC,EAAE,IAAI,SAAS,CACjE,CAAC,EAED,GAAG,iDAAoD,CACrD,GAAM,CAAE,aAAc,EACpB,EAAA,EAAA,CAAA,SAAA,CACE,EAAC,EAAD,CAAA,SAAY,OAAiB,CAAA,EAC7B,EAAC,EAAD,CAAQ,CAAA,CACR,CAAA,CAAA,CACJ,EAEA,OAAO,EAAU,cAAc,2BAA2B,GAAG,aAAa,KAAK,CAAC,EAAE,SAAS,EAC3F,OAAO,EAAU,cAAc,qBAAqB,GAAG,aAAa,IAAI,CAAC,EAAE,SAAS,CACtF,CAAC,EAED,GAAG,8DAAiE,CAClE,EACE,EAAA,EAAA,CAAA,SAAA,CACE,EAAC,EAAD,CAAA,SAAA,CACE,EAAC,EAAD,CAAA,SAAY,SAAmB,CAAA,EAC/B,EAAC,EAAD,CAAW,CAAA,CACN,CAAA,CAAA,EAEP,EAAC,EAAD,CAAA,SAAA,CACE,EAAC,EAAD,CAAA,SAAY,WAAqB,CAAA,EACjC,EAAC,EAAD,CAAA,SACE,EAAC,EAAD,CAAoB,MAAM,iBAAQ,OAAyB,CAAA,CAC/C,CAAA,CACT,CAAA,CAAA,EAEP,EAAC,EAAD,CAAA,SAAA,CACE,EAAC,EAAD,CAAA,SAAY,UAAoB,CAAA,EAChC,EAAC,EAAD,CAAA,SACE,EAAC,EAAD,CAAA,SACE,EAAC,EAAD,CAAa,YAAY,mBAAqB,CAAA,CACjC,CAAA,CACT,CAAA,CACH,CAAA,CAAA,EAEP,EAAC,EAAD,CAAA,SAAA,CACE,EAAC,EAAD,CAAA,SAAY,OAAiB,CAAA,EAC7B,EAAC,EAAD,CAAW,CAAA,CACN,CAAA,CAAA,CACP,CAAA,CAAA,CACJ,EAEA,IAAK,IAAM,IAAS,CAAC,UAAW,YAAa,WAAY,OAAO,EAAG,CAEjE,IAAM,EADe,EAAO,UAAU,CACT,EAAE,aAAa,KAAK,EAEjD,OAAO,CAAS,EAAE,WAAW,EAC7B,OAAO,SAAS,eAAe,GAAa,EAAE,CAAC,EAAE,IAAI,SAAS,CAChE,CACF,CAAC,CACH,CAAC"}
1
+ {"version":3,"file":"field.spec.js","names":[],"sources":["../../src/components/field.spec.tsx"],"sourcesContent":["import { render, screen } from '@testing-library/react'\n\nimport { Checkbox } from './checkbox'\nimport { Field, FieldLabel } from './field'\nimport { Input } from './input'\nimport { NativeSelect, NativeSelectOption } from './native-select'\nimport { Select, SelectTrigger, SelectValue } from './select'\nimport { Textarea } from './textarea'\n\ndescribe('Field automatic control ids', () => {\n it('wires FieldLabel and Input with a generated id when ids are omitted', () => {\n render(\n <Field>\n <FieldLabel>Email</FieldLabel>\n <Input />\n </Field>\n )\n\n const input = screen.getByLabelText('Email')\n const label = screen.getByText('Email')\n\n expect(input.getAttribute('id')).toBeTruthy()\n expect(label.getAttribute('for')).toBe(input.getAttribute('id'))\n })\n\n it('preserves explicit input ids and label htmlFor values', () => {\n render(\n <Field>\n <FieldLabel htmlFor=\"explicit-label-target\">Email</FieldLabel>\n <Input id=\"explicit-input\" />\n </Field>\n )\n\n expect(screen.getByText('Email').getAttribute('for')).toBe('explicit-label-target')\n expect(document.getElementById('explicit-input')).not.toBeNull()\n })\n\n it('does not assign ids or throw outside Field', () => {\n const { container } = render(\n <>\n <FieldLabel>Email</FieldLabel>\n <Input />\n </>\n )\n\n expect(container.querySelector('[data-slot=\"field-label\"]')?.getAttribute('for')).toBeNull()\n expect(container.querySelector('[data-slot=\"input\"]')?.getAttribute('id')).toBeNull()\n })\n\n it('wires representative controls to the generated Field id', () => {\n render(\n <>\n <Field>\n <FieldLabel>Message</FieldLabel>\n <Textarea />\n </Field>\n\n <Field>\n <FieldLabel>Framework</FieldLabel>\n <NativeSelect>\n <NativeSelectOption value=\"react\">React</NativeSelectOption>\n </NativeSelect>\n </Field>\n\n <Field>\n <FieldLabel>Category</FieldLabel>\n <Select>\n <SelectTrigger>\n <SelectValue placeholder=\"Select a category\" />\n </SelectTrigger>\n </Select>\n </Field>\n\n <Field>\n <FieldLabel>Terms</FieldLabel>\n <Checkbox />\n </Field>\n </>\n )\n\n for (const label of ['Message', 'Framework', 'Category', 'Terms']) {\n const labelElement = screen.getByText(label)\n const controlId = labelElement.getAttribute('for')\n\n expect(controlId).toBeTruthy()\n expect(document.getElementById(controlId ?? '')).not.toBeNull()\n }\n })\n})\n"],"mappings":"udASA,SAAS,kCAAqC,CAC5C,GAAG,0EAA6E,CAC9E,EACE,EAAC,EAAD,CAAA,SAAA,CACE,EAAC,EAAD,CAAA,SAAY,O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SACE,EAAC,EAAD,CAAoB,MAAM,iBAAQ,OAAyB,CAAA,CAC/C,CAAA,CACT,CAAA,CAAA,EAEP,EAAC,EAAD,CAAA,SAAA,CACE,EAAC,EAAD,CAAA,SAAY,UAAoB,CAAA,EAChC,EAAC,EAAD,CAAA,SACE,EAAC,EAAD,CAAA,SACE,EAAC,EAAD,CAAa,YAAY,mBAAqB,CAAA,CACjC,CAAA,CACT,CAAA,CACH,CAAA,CAAA,EAEP,EAAC,EAAD,CAAA,SAAA,CACE,EAAC,EAAD,CAAA,SAAY,OAAiB,CAAA,EAC7B,EAAC,EAAD,CAAW,CAAA,CACN,CAAA,CAAA,CACP,CAAA,CAAA,CACJ,EAEA,IAAK,IAAM,IAAS,CAAC,UAAW,YAAa,WAAY,OAAO,EAAG,CAEjE,IAAM,EADe,EAAO,UAAU,CACT,CAAC,CAAC,aAAa,KAAK,EAEjD,OAAO,CAAS,CAAC,CAAC,WAAW,EAC7B,OAAO,SAAS,eAAe,GAAa,EAAE,CAAC,CAAC,CAAC,IAAI,SAAS,CAChE,CACF,CAAC,CACH,CAAC"}
@@ -1,4 +1,4 @@
1
- import { n as __name } from "../chunk-CHh1Zzun.js";
1
+ import { n as __name } from "../rolldown-runtime-Bdj-bS2b.js";
2
2
  import { VariantProps } from "class-variance-authority";
3
3
  import * as React from "react";
4
4
 
@@ -19,7 +19,7 @@ declare function Flex({
19
19
  wrap,
20
20
  gap,
21
21
  ...props
22
- }: FlexProps): import("react/jsx-runtime").JSX.Element;
22
+ }: FlexProps): React.JSX.Element;
23
23
  //#endregion
24
24
  export { Flex, FlexProps, flexVariants };
25
25
  //# sourceMappingURL=flex.d.ts.map
@@ -1,2 +1,2 @@
1
- import"../chunk-CHh1Zzun.js";import{cn as e}from"../lib/utils.js";import{jsx as t}from"react/jsx-runtime";import{cva as n}from"class-variance-authority";const r=n(`flex min-w-0`,{variants:{direction:{row:`flex-row`,"row-reverse":`flex-row-reverse`,column:`flex-col`,"column-reverse":`flex-col-reverse`},align:{start:`items-start`,end:`items-end`,center:`items-center`,baseline:`items-baseline`,stretch:`items-stretch`},justify:{start:`justify-start`,end:`justify-end`,center:`justify-center`,between:`justify-between`,around:`justify-around`,evenly:`justify-evenly`},wrap:{true:`flex-wrap`,false:`flex-nowrap`},gap:{xs:`gap-1`,sm:`gap-2`,md:`gap-4`,lg:`gap-6`,xl:`gap-8`}},defaultVariants:{direction:`row`,wrap:!1}});function Flex({className:n,direction:i=`row`,align:a,justify:o,wrap:s=!1,gap:c,...l}){return t(`div`,{"data-slot":`flex`,"data-direction":i,"data-align":a,"data-justify":o,"data-wrap":s?`true`:`false`,"data-gap":c,className:e(r({direction:i,align:a,justify:o,wrap:s,gap:c}),n),...l})}export{Flex,r as flexVariants};
1
+ import"../rolldown-runtime-Bdj-bS2b.js";import{cn as e}from"../lib/utils.js";import{jsx as t}from"react/jsx-runtime";import{cva as n}from"class-variance-authority";const r=n(`flex min-w-0`,{variants:{direction:{row:`flex-row`,"row-reverse":`flex-row-reverse`,column:`flex-col`,"column-reverse":`flex-col-reverse`},align:{start:`items-start`,end:`items-end`,center:`items-center`,baseline:`items-baseline`,stretch:`items-stretch`},justify:{start:`justify-start`,end:`justify-end`,center:`justify-center`,between:`justify-between`,around:`justify-around`,evenly:`justify-evenly`},wrap:{true:`flex-wrap`,false:`flex-nowrap`},gap:{xs:`gap-1`,sm:`gap-2`,md:`gap-4`,lg:`gap-6`,xl:`gap-8`}},defaultVariants:{direction:`row`,wrap:!1}});function Flex({className:n,direction:i=`row`,align:a,justify:o,wrap:s=!1,gap:c,...l}){return t(`div`,{"data-slot":`flex`,"data-direction":i,"data-align":a,"data-justify":o,"data-wrap":s?`true`:`false`,"data-gap":c,className:e(r({direction:i,align:a,justify:o,wrap:s,gap:c}),n),...l})}export{Flex,r as flexVariants};
2
2
  //# sourceMappingURL=flex.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flex.js","names":[],"sources":["../../src/components/flex.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../lib/utils'\n\nconst flexVariants = cva('flex min-w-0', {\n variants: {\n direction: {\n row: 'flex-row',\n 'row-reverse': 'flex-row-reverse',\n column: 'flex-col',\n 'column-reverse': 'flex-col-reverse'\n },\n align: {\n start: 'items-start',\n end: 'items-end',\n center: 'items-center',\n baseline: 'items-baseline',\n stretch: 'items-stretch'\n },\n justify: {\n start: 'justify-start',\n end: 'justify-end',\n center: 'justify-center',\n between: 'justify-between',\n around: 'justify-around',\n evenly: 'justify-evenly'\n },\n wrap: {\n true: 'flex-wrap',\n false: 'flex-nowrap'\n },\n gap: {\n xs: 'gap-1',\n sm: 'gap-2',\n md: 'gap-4',\n lg: 'gap-6',\n xl: 'gap-8'\n }\n },\n defaultVariants: {\n direction: 'row',\n wrap: false\n }\n})\n\nexport type FlexProps = React.ComponentProps<'div'> & VariantProps<typeof flexVariants>\n\nfunction Flex({ className, direction = 'row', align, justify, wrap = false, gap, ...props }: FlexProps) {\n return (\n <div\n data-slot=\"flex\"\n data-direction={direction}\n data-align={align}\n data-justify={justify}\n data-wrap={wrap ? 'true' : 'false'}\n data-gap={gap}\n className={cn(flexVariants({ direction, align, justify, wrap, gap }), className)}\n {...props}\n />\n )\n}\n\nexport { Flex, flexVariants }\n"],"mappings":"yJAMA,MAAM,EAAe,EAAI,eAAgB,CACvC,SAAU,CACR,UAAW,CACT,IAAK,WACL,cAAe,mBACf,OAAQ,WACR,iBAAkB,kBACpB,EACA,MAAO,CACL,MAAO,cACP,IAAK,YACL,OAAQ,eACR,SAAU,iBACV,QAAS,eACX,EACA,QAAS,CACP,MAAO,gBACP,IAAK,cACL,OAAQ,iBACR,QAAS,kBACT,OAAQ,iBACR,OAAQ,gBACV,EACA,KAAM,CACJ,KAAM,YACN,MAAO,aACT,EACA,IAAK,CACH,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,OACN,CACF,EACA,gBAAiB,CACf,UAAW,MACX,KAAM,EACR,CACF,CAAC,EAID,SAAS,KAAK,CAAE,YAAW,YAAY,MAAO,QAAO,UAAS,OAAO,GAAO,MAAK,GAAG,GAAoB,CACtG,OACE,EAAC,MAAD,CACE,YAAU,OACV,iBAAgB,EAChB,aAAY,EACZ,eAAc,EACd,YAAW,EAAO,OAAS,QAC3B,WAAU,EACV,UAAW,EAAG,EAAa,CAAE,YAAW,QAAO,UAAS,OAAM,KAAI,CAAC,EAAG,CAAS,EAC/E,GAAI,CACL,CAAA,CAEL"}
1
+ {"version":3,"file":"flex.js","names":[],"sources":["../../src/components/flex.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../lib/utils'\n\nconst flexVariants = cva('flex min-w-0', {\n variants: {\n direction: {\n row: 'flex-row',\n 'row-reverse': 'flex-row-reverse',\n column: 'flex-col',\n 'column-reverse': 'flex-col-reverse'\n },\n align: {\n start: 'items-start',\n end: 'items-end',\n center: 'items-center',\n baseline: 'items-baseline',\n stretch: 'items-stretch'\n },\n justify: {\n start: 'justify-start',\n end: 'justify-end',\n center: 'justify-center',\n between: 'justify-between',\n around: 'justify-around',\n evenly: 'justify-evenly'\n },\n wrap: {\n true: 'flex-wrap',\n false: 'flex-nowrap'\n },\n gap: {\n xs: 'gap-1',\n sm: 'gap-2',\n md: 'gap-4',\n lg: 'gap-6',\n xl: 'gap-8'\n }\n },\n defaultVariants: {\n direction: 'row',\n wrap: false\n }\n})\n\nexport type FlexProps = React.ComponentProps<'div'> & VariantProps<typeof flexVariants>\n\nfunction Flex({ className, direction = 'row', align, justify, wrap = false, gap, ...props }: FlexProps) {\n return (\n <div\n data-slot=\"flex\"\n data-direction={direction}\n data-align={align}\n data-justify={justify}\n data-wrap={wrap ? 'true' : 'false'}\n data-gap={gap}\n className={cn(flexVariants({ direction, align, justify, wrap, gap }), className)}\n {...props}\n />\n )\n}\n\nexport { Flex, flexVariants }\n"],"mappings":"oKAMA,MAAM,EAAe,EAAI,eAAgB,CACvC,SAAU,CACR,UAAW,CACT,IAAK,WACL,cAAe,mBACf,OAAQ,WACR,iBAAkB,kBACpB,EACA,MAAO,CACL,MAAO,cACP,IAAK,YACL,OAAQ,eACR,SAAU,iBACV,QAAS,eACX,EACA,QAAS,CACP,MAAO,gBACP,IAAK,cACL,OAAQ,iBACR,QAAS,kBACT,OAAQ,iBACR,OAAQ,gBACV,EACA,KAAM,CACJ,KAAM,YACN,MAAO,aACT,EACA,IAAK,CACH,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,OACN,CACF,EACA,gBAAiB,CACf,UAAW,MACX,KAAM,EACR,CACF,CAAC,EAID,SAAS,KAAK,CAAE,YAAW,YAAY,MAAO,QAAO,UAAS,OAAO,GAAO,MAAK,GAAG,GAAoB,CACtG,OACE,EAAC,MAAD,CACE,YAAU,OACV,iBAAgB,EAChB,aAAY,EACZ,eAAc,EACd,YAAW,EAAO,OAAS,QAC3B,WAAU,EACV,UAAW,EAAG,EAAa,CAAE,YAAW,QAAO,UAAS,OAAM,KAAI,CAAC,EAAG,CAAS,EAC/E,GAAI,CACL,CAAA,CAEL"}
@@ -1,4 +1,4 @@
1
- import { n as __name } from "../chunk-CHh1Zzun.js";
1
+ import { n as __name } from "../rolldown-runtime-Bdj-bS2b.js";
2
2
  import * as React from "react";
3
3
 
4
4
  //#region src/components/grid.d.ts
@@ -19,7 +19,7 @@ declare function Grid({
19
19
  templateColumns,
20
20
  style,
21
21
  ...props
22
- }: GridProps): import("react/jsx-runtime").JSX.Element;
22
+ }: GridProps): React.JSX.Element;
23
23
  type GridItemProps = React.ComponentProps<'div'> & {
24
24
  rowSpan?: number;
25
25
  colSpan?: number;
@@ -30,7 +30,7 @@ declare function GridItem({
30
30
  colSpan,
31
31
  style,
32
32
  ...props
33
- }: GridItemProps): import("react/jsx-runtime").JSX.Element;
33
+ }: GridItemProps): React.JSX.Element;
34
34
  //#endregion
35
35
  export { Grid, GridItem, GridItemProps, GridProps };
36
36
  //# sourceMappingURL=grid.d.ts.map
@@ -1,2 +1,2 @@
1
- import"../chunk-CHh1Zzun.js";import{cn as e}from"../lib/utils.js";import{jsx as t}from"react/jsx-runtime";const n={xs:1,sm:2,md:4,lg:6,xl:8};function toSpacingValue(e){return`calc(var(--spacing) * ${n[e]})`}function Grid({className:n,gap:r,rowGap:i,columnGap:a,templateRows:o,templateColumns:s=`repeat(12, minmax(0, 1fr))`,style:c,...l}){return t(`div`,{"data-slot":`grid`,className:e(`grid min-w-0`,`grid-cols-(--grid-template-columns) grid-rows-(--grid-template-rows)`,`gap-(--grid-gap) gap-y-(--grid-row-gap) gap-x-(--grid-column-gap)`,n),style:{"--grid-template-columns":s,"--grid-template-rows":o,"--grid-gap":r?toSpacingValue(r):`0px`,"--grid-row-gap":i?toSpacingValue(i):`var(--grid-gap)`,"--grid-column-gap":a?toSpacingValue(a):`var(--grid-gap)`,...c},...l})}function GridItem({className:n,rowSpan:r,colSpan:i=12,style:a,...o}){return t(`div`,{"data-slot":`grid-item`,className:e(`min-w-0`,`col-[span_var(--grid-item-col-span)/span_var(--grid-item-col-span)]`,`row-[span_var(--grid-item-row-span)/span_var(--grid-item-row-span)]`,n),style:{"--grid-item-col-span":i,"--grid-item-row-span":r,...a},...o})}export{Grid,GridItem};
1
+ import"../rolldown-runtime-Bdj-bS2b.js";import{cn as e}from"../lib/utils.js";import{jsx as t}from"react/jsx-runtime";const n={xs:1,sm:2,md:4,lg:6,xl:8};function toSpacingValue(e){return`calc(var(--spacing) * ${n[e]})`}function Grid({className:n,gap:r,rowGap:i,columnGap:a,templateRows:o,templateColumns:s=`repeat(12, minmax(0, 1fr))`,style:c,...l}){return t(`div`,{"data-slot":`grid`,className:e(`grid min-w-0`,`grid-cols-(--grid-template-columns) grid-rows-(--grid-template-rows)`,`gap-(--grid-gap) gap-y-(--grid-row-gap) gap-x-(--grid-column-gap)`,n),style:{"--grid-template-columns":s,"--grid-template-rows":o,"--grid-gap":r?toSpacingValue(r):`0px`,"--grid-row-gap":i?toSpacingValue(i):`var(--grid-gap)`,"--grid-column-gap":a?toSpacingValue(a):`var(--grid-gap)`,...c},...l})}function GridItem({className:n,rowSpan:r,colSpan:i=12,style:a,...o}){return t(`div`,{"data-slot":`grid-item`,className:e(`min-w-0`,`col-[span_var(--grid-item-col-span)/span_var(--grid-item-col-span)]`,`row-[span_var(--grid-item-row-span)/span_var(--grid-item-row-span)]`,n),style:{"--grid-item-col-span":i,"--grid-item-row-span":r,...a},...o})}export{Grid,GridItem};
2
2
  //# sourceMappingURL=grid.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"grid.js","names":[],"sources":["../../src/components/grid.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { cn } from '../lib/utils'\n\ntype GridSpacing = 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n\nconst spacingScale: Record<GridSpacing, number> = {\n xs: 1,\n sm: 2,\n md: 4,\n lg: 6,\n xl: 8\n}\n\nfunction toSpacingValue(spacing: GridSpacing) {\n return `calc(var(--spacing) * ${spacingScale[spacing]})`\n}\n\nexport type GridProps = React.ComponentProps<'div'> & {\n gap?: GridSpacing\n rowGap?: GridSpacing\n columnGap?: GridSpacing\n templateRows?: string\n templateColumns?: string\n}\n\nfunction Grid({\n className,\n gap,\n rowGap,\n columnGap,\n templateRows,\n templateColumns = 'repeat(12, minmax(0, 1fr))',\n style,\n ...props\n}: GridProps) {\n return (\n <div\n data-slot=\"grid\"\n className={cn(\n 'grid min-w-0',\n 'grid-cols-(--grid-template-columns) grid-rows-(--grid-template-rows)',\n 'gap-(--grid-gap) gap-y-(--grid-row-gap) gap-x-(--grid-column-gap)',\n className\n )}\n style={\n {\n '--grid-template-columns': templateColumns,\n '--grid-template-rows': templateRows,\n '--grid-gap': gap ? toSpacingValue(gap) : '0px',\n '--grid-row-gap': rowGap ? toSpacingValue(rowGap) : 'var(--grid-gap)',\n '--grid-column-gap': columnGap ? toSpacingValue(columnGap) : 'var(--grid-gap)',\n ...style\n } as React.CSSProperties\n }\n {...props}\n />\n )\n}\n\nexport type GridItemProps = React.ComponentProps<'div'> & {\n rowSpan?: number\n colSpan?: number\n}\n\nfunction GridItem({ className, rowSpan, colSpan = 12, style, ...props }: GridItemProps) {\n return (\n <div\n data-slot=\"grid-item\"\n className={cn(\n 'min-w-0',\n 'col-[span_var(--grid-item-col-span)/span_var(--grid-item-col-span)]',\n 'row-[span_var(--grid-item-row-span)/span_var(--grid-item-row-span)]',\n className\n )}\n style={\n {\n '--grid-item-col-span': colSpan,\n '--grid-item-row-span': rowSpan,\n ...style\n } as React.CSSProperties\n }\n {...props}\n />\n )\n}\n\nexport { Grid, GridItem }\n"],"mappings":"0GAMA,MAAM,EAA4C,CAChD,GAAI,EACJ,GAAI,EACJ,GAAI,EACJ,GAAI,EACJ,GAAI,CACN,EAEA,SAAS,eAAe,EAAsB,CAC5C,MAAO,yBAAyB,EAAa,GAAS,EACxD,CAUA,SAAS,KAAK,CACZ,YACA,MACA,SACA,YACA,eACA,kBAAkB,6BAClB,QACA,GAAG,GACS,CACZ,OACE,EAAC,MAAD,CACE,YAAU,OACV,UAAW,EACT,eACA,uEACA,oEACA,CACF,EACA,MACE,CACE,0BAA2B,EAC3B,uBAAwB,EACxB,aAAc,EAAM,eAAe,CAAG,EAAI,MAC1C,iBAAkB,EAAS,eAAe,CAAM,EAAI,kBACpD,oBAAqB,EAAY,eAAe,CAAS,EAAI,kBAC7D,GAAG,CACL,EAEF,GAAI,CACL,CAAA,CAEL,CAOA,SAAS,SAAS,CAAE,YAAW,UAAS,UAAU,GAAI,QAAO,GAAG,GAAwB,CACtF,OACE,EAAC,MAAD,CACE,YAAU,YACV,UAAW,EACT,UACA,sEACA,sEACA,CACF,EACA,MACE,CACE,uBAAwB,EACxB,uBAAwB,EACxB,GAAG,CACL,EAEF,GAAI,CACL,CAAA,CAEL"}
1
+ {"version":3,"file":"grid.js","names":[],"sources":["../../src/components/grid.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { cn } from '../lib/utils'\n\ntype GridSpacing = 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n\nconst spacingScale: Record<GridSpacing, number> = {\n xs: 1,\n sm: 2,\n md: 4,\n lg: 6,\n xl: 8\n}\n\nfunction toSpacingValue(spacing: GridSpacing) {\n return `calc(var(--spacing) * ${spacingScale[spacing]})`\n}\n\nexport type GridProps = React.ComponentProps<'div'> & {\n gap?: GridSpacing\n rowGap?: GridSpacing\n columnGap?: GridSpacing\n templateRows?: string\n templateColumns?: string\n}\n\nfunction Grid({\n className,\n gap,\n rowGap,\n columnGap,\n templateRows,\n templateColumns = 'repeat(12, minmax(0, 1fr))',\n style,\n ...props\n}: GridProps) {\n return (\n <div\n data-slot=\"grid\"\n className={cn(\n 'grid min-w-0',\n 'grid-cols-(--grid-template-columns) grid-rows-(--grid-template-rows)',\n 'gap-(--grid-gap) gap-y-(--grid-row-gap) gap-x-(--grid-column-gap)',\n className\n )}\n style={\n {\n '--grid-template-columns': templateColumns,\n '--grid-template-rows': templateRows,\n '--grid-gap': gap ? toSpacingValue(gap) : '0px',\n '--grid-row-gap': rowGap ? toSpacingValue(rowGap) : 'var(--grid-gap)',\n '--grid-column-gap': columnGap ? toSpacingValue(columnGap) : 'var(--grid-gap)',\n ...style\n } as React.CSSProperties\n }\n {...props}\n />\n )\n}\n\nexport type GridItemProps = React.ComponentProps<'div'> & {\n rowSpan?: number\n colSpan?: number\n}\n\nfunction GridItem({ className, rowSpan, colSpan = 12, style, ...props }: GridItemProps) {\n return (\n <div\n data-slot=\"grid-item\"\n className={cn(\n 'min-w-0',\n 'col-[span_var(--grid-item-col-span)/span_var(--grid-item-col-span)]',\n 'row-[span_var(--grid-item-row-span)/span_var(--grid-item-row-span)]',\n className\n )}\n style={\n {\n '--grid-item-col-span': colSpan,\n '--grid-item-row-span': rowSpan,\n ...style\n } as React.CSSProperties\n }\n {...props}\n />\n )\n}\n\nexport { Grid, GridItem }\n"],"mappings":"qHAMA,MAAM,EAA4C,CAChD,GAAI,EACJ,GAAI,EACJ,GAAI,EACJ,GAAI,EACJ,GAAI,CACN,EAEA,SAAS,eAAe,EAAsB,CAC5C,MAAO,yBAAyB,EAAa,GAAS,EACxD,CAUA,SAAS,KAAK,CACZ,YACA,MACA,SACA,YACA,eACA,kBAAkB,6BAClB,QACA,GAAG,GACS,CACZ,OACE,EAAC,MAAD,CACE,YAAU,OACV,UAAW,EACT,eACA,uEACA,oEACA,CACF,EACA,MACE,CACE,0BAA2B,EAC3B,uBAAwB,EACxB,aAAc,EAAM,eAAe,CAAG,EAAI,MAC1C,iBAAkB,EAAS,eAAe,CAAM,EAAI,kBACpD,oBAAqB,EAAY,eAAe,CAAS,EAAI,kBAC7D,GAAG,CACL,EAEF,GAAI,CACL,CAAA,CAEL,CAOA,SAAS,SAAS,CAAE,YAAW,UAAS,UAAU,GAAI,QAAO,GAAG,GAAwB,CACtF,OACE,EAAC,MAAD,CACE,YAAU,YACV,UAAW,EACT,UACA,sEACA,sEACA,CACF,EACA,MACE,CACE,uBAAwB,EACxB,uBAAwB,EACxB,GAAG,CACL,EAEF,GAAI,CACL,CAAA,CAEL"}
@@ -1,4 +1,4 @@
1
- import { n as __name } from "../chunk-CHh1Zzun.js";
1
+ import { n as __name } from "../rolldown-runtime-Bdj-bS2b.js";
2
2
  import { VariantProps } from "class-variance-authority";
3
3
  import * as React from "react";
4
4
 
@@ -17,7 +17,7 @@ declare function Group({
17
17
  gap,
18
18
  wrap,
19
19
  ...props
20
- }: GroupProps): import("react/jsx-runtime").JSX.Element;
20
+ }: GroupProps): React.JSX.Element;
21
21
  //#endregion
22
22
  export { Group, GroupProps, groupVariants };
23
23
  //# sourceMappingURL=group.d.ts.map
@@ -1,2 +1,2 @@
1
- import"../chunk-CHh1Zzun.js";import{cn as e}from"../lib/utils.js";import{jsx as t}from"react/jsx-runtime";import{cva as n}from"class-variance-authority";const r=n(`flex flex-row`,{variants:{align:{start:`items-start`,end:`items-end`,center:`items-center`,baseline:`items-baseline`,stretch:`items-stretch`},justify:{start:`justify-start`,end:`justify-end`,center:`justify-center`,between:`justify-between`,around:`justify-around`,evenly:`justify-evenly`},gap:{xs:`gap-1`,sm:`gap-2`,md:`gap-4`,lg:`gap-6`,xl:`gap-8`},wrap:{true:`flex-wrap`,false:`flex-nowrap`}},defaultVariants:{align:`center`,gap:`md`,wrap:!1}});function Group({className:n,align:i=`center`,justify:a,gap:o=`md`,wrap:s=!0,...c}){return t(`div`,{"data-slot":`group`,"data-align":i,"data-justify":a,"data-gap":o,"data-wrap":s?`true`:`false`,className:e(r({align:i,justify:a,gap:o,wrap:s}),n),...c})}export{Group,r as groupVariants};
1
+ import"../rolldown-runtime-Bdj-bS2b.js";import{cn as e}from"../lib/utils.js";import{jsx as t}from"react/jsx-runtime";import{cva as n}from"class-variance-authority";const r=n(`flex flex-row`,{variants:{align:{start:`items-start`,end:`items-end`,center:`items-center`,baseline:`items-baseline`,stretch:`items-stretch`},justify:{start:`justify-start`,end:`justify-end`,center:`justify-center`,between:`justify-between`,around:`justify-around`,evenly:`justify-evenly`},gap:{xs:`gap-1`,sm:`gap-2`,md:`gap-4`,lg:`gap-6`,xl:`gap-8`},wrap:{true:`flex-wrap`,false:`flex-nowrap`}},defaultVariants:{align:`center`,gap:`md`,wrap:!1}});function Group({className:n,align:i=`center`,justify:a,gap:o=`md`,wrap:s=!0,...c}){return t(`div`,{"data-slot":`group`,"data-align":i,"data-justify":a,"data-gap":o,"data-wrap":s?`true`:`false`,className:e(r({align:i,justify:a,gap:o,wrap:s}),n),...c})}export{Group,r as groupVariants};
2
2
  //# sourceMappingURL=group.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"group.js","names":[],"sources":["../../src/components/group.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../lib/utils'\n\nconst groupVariants = cva('flex flex-row', {\n variants: {\n align: {\n start: 'items-start',\n end: 'items-end',\n center: 'items-center',\n baseline: 'items-baseline',\n stretch: 'items-stretch'\n },\n justify: {\n start: 'justify-start',\n end: 'justify-end',\n center: 'justify-center',\n between: 'justify-between',\n around: 'justify-around',\n evenly: 'justify-evenly'\n },\n gap: {\n xs: 'gap-1',\n sm: 'gap-2',\n md: 'gap-4',\n lg: 'gap-6',\n xl: 'gap-8'\n },\n wrap: {\n true: 'flex-wrap',\n false: 'flex-nowrap'\n }\n },\n defaultVariants: {\n align: 'center',\n gap: 'md',\n wrap: false\n }\n})\n\nexport type GroupProps = React.ComponentProps<'div'> & VariantProps<typeof groupVariants>\n\nfunction Group({ className, align = 'center', justify, gap = 'md', wrap = true, ...props }: GroupProps) {\n return (\n <div\n data-slot=\"group\"\n data-align={align}\n data-justify={justify}\n data-gap={gap}\n data-wrap={wrap ? 'true' : 'false'}\n className={cn(groupVariants({ align, justify, gap, wrap }), className)}\n {...props}\n />\n )\n}\n\nexport { Group, groupVariants }\n"],"mappings":"yJAMA,MAAM,EAAgB,EAAI,gBAAiB,CACzC,SAAU,CACR,MAAO,CACL,MAAO,cACP,IAAK,YACL,OAAQ,eACR,SAAU,iBACV,QAAS,eACX,EACA,QAAS,CACP,MAAO,gBACP,IAAK,cACL,OAAQ,iBACR,QAAS,kBACT,OAAQ,iBACR,OAAQ,gBACV,EACA,IAAK,CACH,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,OACN,EACA,KAAM,CACJ,KAAM,YACN,MAAO,aACT,CACF,EACA,gBAAiB,CACf,MAAO,SACP,IAAK,KACL,KAAM,EACR,CACF,CAAC,EAID,SAAS,MAAM,CAAE,YAAW,QAAQ,SAAU,UAAS,MAAM,KAAM,OAAO,GAAM,GAAG,GAAqB,CACtG,OACE,EAAC,MAAD,CACE,YAAU,QACV,aAAY,EACZ,eAAc,EACd,WAAU,EACV,YAAW,EAAO,OAAS,QAC3B,UAAW,EAAG,EAAc,CAAE,QAAO,UAAS,MAAK,MAAK,CAAC,EAAG,CAAS,EACrE,GAAI,CACL,CAAA,CAEL"}
1
+ {"version":3,"file":"group.js","names":[],"sources":["../../src/components/group.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../lib/utils'\n\nconst groupVariants = cva('flex flex-row', {\n variants: {\n align: {\n start: 'items-start',\n end: 'items-end',\n center: 'items-center',\n baseline: 'items-baseline',\n stretch: 'items-stretch'\n },\n justify: {\n start: 'justify-start',\n end: 'justify-end',\n center: 'justify-center',\n between: 'justify-between',\n around: 'justify-around',\n evenly: 'justify-evenly'\n },\n gap: {\n xs: 'gap-1',\n sm: 'gap-2',\n md: 'gap-4',\n lg: 'gap-6',\n xl: 'gap-8'\n },\n wrap: {\n true: 'flex-wrap',\n false: 'flex-nowrap'\n }\n },\n defaultVariants: {\n align: 'center',\n gap: 'md',\n wrap: false\n }\n})\n\nexport type GroupProps = React.ComponentProps<'div'> & VariantProps<typeof groupVariants>\n\nfunction Group({ className, align = 'center', justify, gap = 'md', wrap = true, ...props }: GroupProps) {\n return (\n <div\n data-slot=\"group\"\n data-align={align}\n data-justify={justify}\n data-gap={gap}\n data-wrap={wrap ? 'true' : 'false'}\n className={cn(groupVariants({ align, justify, gap, wrap }), className)}\n {...props}\n />\n )\n}\n\nexport { Group, groupVariants }\n"],"mappings":"oKAMA,MAAM,EAAgB,EAAI,gBAAiB,CACzC,SAAU,CACR,MAAO,CACL,MAAO,cACP,IAAK,YACL,OAAQ,eACR,SAAU,iBACV,QAAS,eACX,EACA,QAAS,CACP,MAAO,gBACP,IAAK,cACL,OAAQ,iBACR,QAAS,kBACT,OAAQ,iBACR,OAAQ,gBACV,EACA,IAAK,CACH,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,OACN,EACA,KAAM,CACJ,KAAM,YACN,MAAO,aACT,CACF,EACA,gBAAiB,CACf,MAAO,SACP,IAAK,KACL,KAAM,EACR,CACF,CAAC,EAID,SAAS,MAAM,CAAE,YAAW,QAAQ,SAAU,UAAS,MAAM,KAAM,OAAO,GAAM,GAAG,GAAqB,CACtG,OACE,EAAC,MAAD,CACE,YAAU,QACV,aAAY,EACZ,eAAc,EACd,WAAU,EACV,YAAW,EAAO,OAAS,QAC3B,UAAW,EAAG,EAAc,CAAE,QAAO,UAAS,MAAK,MAAK,CAAC,EAAG,CAAS,EACrE,GAAI,CACL,CAAA,CAEL"}
@@ -1,4 +1,4 @@
1
- import { n as __name } from "../chunk-CHh1Zzun.js";
1
+ import { n as __name } from "../rolldown-runtime-Bdj-bS2b.js";
2
2
  import { VariantProps } from "class-variance-authority";
3
3
  import * as React from "react";
4
4
 
@@ -14,7 +14,7 @@ declare function Heading({
14
14
  size,
15
15
  asChild,
16
16
  ...props
17
- }: HeadingProps): import("react/jsx-runtime").JSX.Element;
17
+ }: HeadingProps): React.JSX.Element;
18
18
  //#endregion
19
19
  export { Heading, HeadingProps, headingVariants };
20
20
  //# sourceMappingURL=heading.d.ts.map
@@ -1,2 +1,2 @@
1
- import"../chunk-CHh1Zzun.js";import{cn as e}from"../lib/utils.js";import{Slot as t}from"radix-ui";import{jsx as n}from"react/jsx-runtime";import{cva as r}from"class-variance-authority";const i=r(`text-foreground font-semibold tracking-tight`,{variants:{size:{xs:`text-lg`,sm:`text-xl`,md:`text-2xl`,lg:`text-3xl`,xl:`text-4xl`}},defaultVariants:{size:`md`}});function Heading({className:r,size:a=`md`,asChild:o=!1,...s}){return n(o?t.Root:`h2`,{"data-slot":`heading`,"data-size":a,className:e(i({size:a}),r),...s})}export{Heading,i as headingVariants};
1
+ import"../rolldown-runtime-Bdj-bS2b.js";import{cn as e}from"../lib/utils.js";import{Slot as t}from"radix-ui";import{jsx as n}from"react/jsx-runtime";import{cva as r}from"class-variance-authority";const i=r(`text-foreground font-semibold tracking-tight`,{variants:{size:{xs:`text-lg`,sm:`text-xl`,md:`text-2xl`,lg:`text-3xl`,xl:`text-4xl`}},defaultVariants:{size:`md`}});function Heading({className:r,size:a=`md`,asChild:o=!1,...s}){return n(o?t.Root:`h2`,{"data-slot":`heading`,"data-size":a,className:e(i({size:a}),r),...s})}export{Heading,i as headingVariants};
2
2
  //# sourceMappingURL=heading.js.map