@uselets/ui 1.12.0 → 1.14.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 (198) hide show
  1. package/README.md +6 -2
  2. package/dist/{chart-lqgodZYQ.d.ts → chart-CVe5-EWS.d.ts} +9 -39
  3. package/dist/components/accordion.d.ts +4 -19
  4. package/dist/components/accordion.js.map +1 -1
  5. package/dist/components/alert-dialog.d.ts +12 -53
  6. package/dist/components/alert-dialog.js.map +1 -1
  7. package/dist/components/alert.d.ts +4 -18
  8. package/dist/components/anchor.d.ts +2 -9
  9. package/dist/components/area-chart.d.ts +2 -26
  10. package/dist/components/area-chart.js.map +1 -1
  11. package/dist/components/avatar.d.ts +6 -26
  12. package/dist/components/badge.d.ts +4 -12
  13. package/dist/components/bar-chart.d.ts +2 -24
  14. package/dist/components/bar-chart.js.map +1 -1
  15. package/dist/components/breadcrumb.d.ts +7 -31
  16. package/dist/components/breadcrumb.js.map +1 -1
  17. package/dist/components/button-group.d.ts +3 -16
  18. package/dist/components/button.d.ts +4 -15
  19. package/dist/components/button.js.map +1 -1
  20. package/dist/components/calendar.d.ts +2 -19
  21. package/dist/components/calendar.js.map +1 -1
  22. package/dist/components/card.d.ts +7 -30
  23. package/dist/components/carousel.d.ts +6 -37
  24. package/dist/components/carousel.js +1 -1
  25. package/dist/components/carousel.js.map +1 -1
  26. package/dist/components/carousel.spec.d.ts +1 -1
  27. package/dist/components/carousel.spec.js +93 -1
  28. package/dist/components/carousel.spec.js.map +1 -1
  29. package/dist/components/center.d.ts +2 -8
  30. package/dist/components/chart.d.ts +1 -1
  31. package/dist/components/chart.js +1 -1
  32. package/dist/components/chart.js.map +1 -1
  33. package/dist/components/checkbox.d.ts +3 -12
  34. package/dist/components/checkbox.js +1 -1
  35. package/dist/components/checkbox.js.map +1 -1
  36. package/dist/components/code.d.ts +1 -5
  37. package/dist/components/collapsible.d.ts +3 -10
  38. package/dist/components/combobox.d.ts +15 -80
  39. package/dist/components/combobox.js.map +1 -1
  40. package/dist/components/command.d.ts +9 -43
  41. package/dist/components/command.js.map +1 -1
  42. package/dist/components/container.d.ts +2 -7
  43. package/dist/components/data-table.d.ts +8 -61
  44. package/dist/components/data-table.js.map +1 -1
  45. package/dist/components/date-range-picker.d.ts +11 -75
  46. package/dist/components/date-range-picker.js +1 -1
  47. package/dist/components/date-range-picker.js.map +1 -1
  48. package/dist/components/dialog.d.ts +12 -49
  49. package/dist/components/dialog.js.map +1 -1
  50. package/dist/components/donut-chart.d.ts +1 -10
  51. package/dist/components/donut-chart.js.map +1 -1
  52. package/dist/components/drawer.d.ts +13 -49
  53. package/dist/components/drawer.js.map +1 -1
  54. package/dist/components/dropdown-menu.d.ts +15 -66
  55. package/dist/components/dropdown-menu.js.map +1 -1
  56. package/dist/components/dropzone.d.ts +1 -5
  57. package/dist/components/dropzone.js.map +1 -1
  58. package/dist/components/empty.d.ts +6 -26
  59. package/dist/components/field.d.ts +11 -48
  60. package/dist/components/field.js.map +1 -1
  61. package/dist/components/field.spec.d.ts +1 -1
  62. package/dist/components/field.spec.js +1 -1
  63. package/dist/components/field.spec.js.map +1 -1
  64. package/dist/components/flex.d.ts +5 -14
  65. package/dist/components/grid.d.ts +2 -18
  66. package/dist/components/group.d.ts +4 -12
  67. package/dist/components/heading.d.ts +2 -8
  68. package/dist/components/hover-card.d.ts +3 -13
  69. package/dist/components/hover-card.js.map +1 -1
  70. package/dist/components/input-group.d.ts +8 -32
  71. package/dist/components/input-otp.d.ts +4 -19
  72. package/dist/components/input-otp.js.map +1 -1
  73. package/dist/components/input.d.ts +1 -7
  74. package/dist/components/kbd.d.ts +2 -9
  75. package/dist/components/label.d.ts +1 -5
  76. package/dist/components/list.d.ts +5 -22
  77. package/dist/components/list.js.map +1 -1
  78. package/dist/components/marker.d.ts +18 -0
  79. package/dist/components/marker.js +2 -0
  80. package/dist/components/marker.js.map +1 -0
  81. package/dist/components/mask-input.d.ts +1 -11
  82. package/dist/components/native-select.d.ts +3 -14
  83. package/dist/components/native-select.js.map +1 -1
  84. package/dist/components/navigation-menu.d.ts +8 -36
  85. package/dist/components/navigation-menu.js.map +1 -1
  86. package/dist/components/number-field.d.ts +35 -0
  87. package/dist/components/number-field.js +2 -0
  88. package/dist/components/number-field.js.map +1 -0
  89. package/dist/components/pagination.d.ts +7 -33
  90. package/dist/components/pagination.js.map +1 -1
  91. package/dist/components/phone-input.d.ts +13 -0
  92. package/dist/components/phone-input.js +2 -0
  93. package/dist/components/phone-input.js.map +1 -0
  94. package/dist/components/pie-chart.d.ts +2 -24
  95. package/dist/components/pie-chart.js.map +1 -1
  96. package/dist/components/popover.d.ts +7 -28
  97. package/dist/components/progress.d.ts +3 -10
  98. package/dist/components/progress.js.map +1 -1
  99. package/dist/components/radio-group.d.ts +4 -17
  100. package/dist/components/radio-group.js +1 -1
  101. package/dist/components/radio-group.js.map +1 -1
  102. package/dist/components/resizable.d.ts +3 -13
  103. package/dist/components/resizable.js.map +1 -1
  104. package/dist/components/ring-progress.d.ts +3 -11
  105. package/dist/components/ring-progress.js.map +1 -1
  106. package/dist/components/scroll-area.d.ts +2 -11
  107. package/dist/components/scroll-area.js.map +1 -1
  108. package/dist/components/select.d.ts +10 -46
  109. package/dist/components/select.js.map +1 -1
  110. package/dist/components/separator.d.ts +1 -7
  111. package/dist/components/sidebar.d.ts +24 -118
  112. package/dist/components/sidebar.js.map +1 -1
  113. package/dist/components/simple-grid.d.ts +1 -10
  114. package/dist/components/skeleton.d.ts +1 -7
  115. package/dist/components/skeleton.js.map +1 -1
  116. package/dist/components/skeleton.spec.d.ts +1 -1
  117. package/dist/components/skeleton.spec.js +1 -1
  118. package/dist/components/skeleton.spec.js.map +1 -1
  119. package/dist/components/slider.d.ts +1 -10
  120. package/dist/components/slider.js.map +1 -1
  121. package/dist/components/sonner.d.ts +0 -1
  122. package/dist/components/spinner.d.ts +2 -7
  123. package/dist/components/stack.d.ts +4 -11
  124. package/dist/components/stepper.d.ts +71 -0
  125. package/dist/components/stepper.js +2 -0
  126. package/dist/components/stepper.js.map +1 -0
  127. package/dist/components/switch.d.ts +1 -10
  128. package/dist/components/switch.js +1 -1
  129. package/dist/components/switch.js.map +1 -1
  130. package/dist/components/table.d.ts +10 -43
  131. package/dist/components/tabs.d.ts +5 -21
  132. package/dist/components/text.d.ts +2 -8
  133. package/dist/components/textarea.d.ts +1 -6
  134. package/dist/components/theme.d.ts +1 -7
  135. package/dist/components/theme.js.map +1 -1
  136. package/dist/components/timeline.d.ts +5 -6
  137. package/dist/components/timeline.js.map +1 -1
  138. package/dist/components/toggle-group.d.ts +2 -19
  139. package/dist/components/toggle-group.js.map +1 -1
  140. package/dist/components/toggle.d.ts +4 -11
  141. package/dist/components/tooltip.d.ts +5 -28
  142. package/dist/components/tooltip.js.map +1 -1
  143. package/dist/components/unstyled-button.d.ts +1 -7
  144. package/dist/components/visibility.d.ts +2 -9
  145. package/dist/hooks/use-breakpoint-value.d.ts +0 -1
  146. package/dist/hooks/use-breakpoint-value.spec.d.ts +1 -1
  147. package/dist/hooks/use-breakpoint-value.spec.js +1 -1
  148. package/dist/hooks/use-breakpoint-value.spec.js.map +1 -1
  149. package/dist/hooks/use-breakpoint.d.ts +0 -1
  150. package/dist/hooks/use-breakpoint.spec.d.ts +1 -1
  151. package/dist/hooks/use-breakpoint.spec.js +1 -1
  152. package/dist/hooks/use-disclosure.d.ts +0 -1
  153. package/dist/hooks/use-disclosure.spec.d.ts +1 -1
  154. package/dist/hooks/use-disclosure.spec.js +1 -1
  155. package/dist/hooks/use-document-visibility.d.ts +0 -1
  156. package/dist/hooks/use-document-visibility.spec.d.ts +1 -1
  157. package/dist/hooks/use-document-visibility.spec.js +1 -1
  158. package/dist/hooks/use-hotkeys.d.ts +1 -1
  159. package/dist/hooks/use-hotkeys.js +1 -1
  160. package/dist/hooks/use-hotkeys.spec.d.ts +1 -1
  161. package/dist/hooks/use-hotkeys.spec.js +1 -1
  162. package/dist/hooks/use-idle.d.ts +0 -1
  163. package/dist/hooks/use-idle.spec.d.ts +1 -1
  164. package/dist/hooks/use-idle.spec.js +1 -1
  165. package/dist/hooks/use-interval.d.ts +10 -8
  166. package/dist/hooks/use-interval.spec.d.ts +1 -1
  167. package/dist/hooks/use-interval.spec.js +1 -1
  168. package/dist/hooks/use-local-storage.d.ts +0 -1
  169. package/dist/hooks/use-local-storage.spec.d.ts +1 -1
  170. package/dist/hooks/use-local-storage.spec.js +1 -1
  171. package/dist/hooks/use-mask.d.ts +0 -1
  172. package/dist/hooks/use-mask.js +1 -1
  173. package/dist/hooks/use-mask.js.map +1 -1
  174. package/dist/hooks/use-mobile.d.ts +0 -1
  175. package/dist/hooks/use-mobile.spec.d.ts +1 -1
  176. package/dist/hooks/use-mobile.spec.js +1 -1
  177. package/dist/index.d.ts +7 -3
  178. package/dist/index.js +1 -1
  179. package/dist/lib/badge.d.ts +0 -1
  180. package/dist/lib/button.d.ts +0 -1
  181. package/dist/lib/color.d.ts +1 -2
  182. package/dist/lib/compose-refs.d.ts +0 -1
  183. package/dist/lib/progress.d.ts +0 -1
  184. package/dist/lib/utils.d.ts +0 -1
  185. package/dist/{magic-string.es-DbBO8R0S.js → magic-string.es-oADFB1hu.js} +2 -2
  186. package/dist/{magic-string.es-DbBO8R0S.js.map → magic-string.es-oADFB1hu.js.map} +1 -1
  187. package/dist/{react.esm-D88qr0ij.js → react.esm-D5AipFQb.js} +5 -5
  188. package/dist/{react.esm-D88qr0ij.js.map → react.esm-D5AipFQb.js.map} +1 -1
  189. package/dist/skills/uselets-ui/references/component-catalog.md +14 -2
  190. package/dist/{use-hotkeys-BOfOFxb5.js → use-hotkeys-C0d5t4yo.js} +2 -2
  191. package/dist/{use-hotkeys-BOfOFxb5.js.map → use-hotkeys-C0d5t4yo.js.map} +1 -1
  192. package/dist/{use-hotkeys-Cl1cV6e8.d.ts → use-hotkeys-DloZH-B4.d.ts} +1 -2
  193. package/dist/utils-Cj3IZeiu.js +37 -0
  194. package/dist/utils-Cj3IZeiu.js.map +1 -0
  195. package/package.json +17 -16
  196. package/skills/uselets-ui/references/component-catalog.md +14 -2
  197. package/dist/dist-B-hwiqYg.js +0 -129
  198. package/dist/dist-B-hwiqYg.js.map +0 -1
@@ -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?.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,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,CA+BV,CACL,CACF,CAEA,SAAS,oBAAoB,EAAiB,CAC5C,GAAI,CAAC,EACH,OAGF,IAAM,EAAgB,OAAO,QAAQ,CAAM,CAAC,CAAC,SAAS,CAAC,EAAU,KACxD,EAAW,OAAS,EAAI,EAAa,CAAC,CAAQ,CACtD,EAED,OAAO,EAAc,OAAS,EAAI,EAAc,K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D,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,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,E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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,EAEJ,SAAA,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,6 +1,5 @@
1
1
  import { n as __name } from "../rolldown-runtime-Bdj-bS2b.js";
2
2
  import { VariantProps } from "class-variance-authority";
3
-
4
3
  //#region src/components/empty.d.ts
5
4
  type EmptyProps = React.ComponentProps<'div'>;
6
5
  type EmptyHeaderProps = React.ComponentProps<'div'>;
@@ -8,34 +7,15 @@ type EmptyMediaProps = React.ComponentProps<'div'> & VariantProps<typeof emptyMe
8
7
  type EmptyTitleProps = React.ComponentProps<'div'>;
9
8
  type EmptyDescriptionProps = React.ComponentProps<'p'>;
10
9
  type EmptyContentProps = React.ComponentProps<'div'>;
11
- declare function Empty({
12
- className,
13
- ...props
14
- }: EmptyProps): import("react").JSX.Element;
15
- declare function EmptyHeader({
16
- className,
17
- ...props
18
- }: EmptyHeaderProps): import("react").JSX.Element;
10
+ declare function Empty({ className, ...props }: EmptyProps): import("react").JSX.Element;
11
+ declare function EmptyHeader({ className, ...props }: EmptyHeaderProps): import("react").JSX.Element;
19
12
  declare const emptyMediaVariants: (props?: ({
20
13
  variant?: "default" | "icon" | null | undefined;
21
14
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
22
- declare function EmptyMedia({
23
- className,
24
- variant,
25
- ...props
26
- }: EmptyMediaProps): import("react").JSX.Element;
27
- declare function EmptyTitle({
28
- className,
29
- ...props
30
- }: EmptyTitleProps): import("react").JSX.Element;
31
- declare function EmptyDescription({
32
- className,
33
- ...props
34
- }: EmptyDescriptionProps): import("react").JSX.Element;
35
- declare function EmptyContent({
36
- className,
37
- ...props
38
- }: EmptyContentProps): import("react").JSX.Element;
15
+ declare function EmptyMedia({ className, variant, ...props }: EmptyMediaProps): import("react").JSX.Element;
16
+ declare function EmptyTitle({ className, ...props }: EmptyTitleProps): import("react").JSX.Element;
17
+ declare function EmptyDescription({ className, ...props }: EmptyDescriptionProps): import("react").JSX.Element;
18
+ declare function EmptyContent({ className, ...props }: EmptyContentProps): import("react").JSX.Element;
39
19
  //#endregion
40
20
  export { Empty, EmptyContent, EmptyContentProps, EmptyDescription, EmptyDescriptionProps, EmptyHeader, EmptyHeaderProps, EmptyMedia, EmptyMediaProps, EmptyProps, EmptyTitle, EmptyTitleProps };
41
21
  //# sourceMappingURL=empty.d.ts.map
@@ -1,7 +1,6 @@
1
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
-
5
4
  //#region src/components/field.d.ts
6
5
  type FieldSetProps = React.ComponentProps<'fieldset'>;
7
6
  type FieldLegendProps = React.ComponentProps<'legend'> & {
@@ -21,56 +20,20 @@ type FieldErrorProps = React.ComponentProps<'div'> & {
21
20
  } | undefined>;
22
21
  };
23
22
  declare function useFieldControlId(id?: string): string | undefined;
24
- declare function FieldSet({
25
- className,
26
- ...props
27
- }: FieldSetProps): import("react").JSX.Element;
28
- declare function FieldLegend({
29
- className,
30
- variant,
31
- ...props
32
- }: FieldLegendProps): import("react").JSX.Element;
33
- declare function FieldGroup({
34
- className,
35
- ...props
36
- }: FieldGroupProps): import("react").JSX.Element;
23
+ declare function FieldSet({ className, ...props }: FieldSetProps): import("react").JSX.Element;
24
+ declare function FieldLegend({ className, variant, ...props }: FieldLegendProps): import("react").JSX.Element;
25
+ declare function FieldGroup({ className, ...props }: FieldGroupProps): import("react").JSX.Element;
37
26
  declare const fieldVariants: (props?: ({
38
- orientation?: "horizontal" | "vertical" | "responsive" | null | undefined;
27
+ orientation?: "horizontal" | "responsive" | "vertical" | null | undefined;
39
28
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
40
29
  type FieldProps = React.ComponentProps<'div'> & VariantProps<typeof fieldVariants>;
41
- declare function Field({
42
- className,
43
- orientation,
44
- ...props
45
- }: FieldProps): import("react").JSX.Element;
46
- declare function FieldContent({
47
- className,
48
- ...props
49
- }: FieldContentProps): import("react").JSX.Element;
50
- declare function FieldLabel({
51
- className,
52
- htmlFor,
53
- ...props
54
- }: FieldLabelProps): import("react").JSX.Element;
55
- declare function FieldTitle({
56
- className,
57
- ...props
58
- }: FieldTitleProps): import("react").JSX.Element;
59
- declare function FieldDescription({
60
- className,
61
- ...props
62
- }: FieldDescriptionProps): import("react").JSX.Element;
63
- declare function FieldSeparator({
64
- children,
65
- className,
66
- ...props
67
- }: FieldSeparatorProps): import("react").JSX.Element;
68
- declare function FieldError({
69
- className,
70
- children,
71
- errors,
72
- ...props
73
- }: FieldErrorProps): import("react").JSX.Element | null;
30
+ declare function Field({ className, orientation, ...props }: FieldProps): import("react").JSX.Element;
31
+ declare function FieldContent({ className, ...props }: FieldContentProps): import("react").JSX.Element;
32
+ declare function FieldLabel({ className, htmlFor, ...props }: FieldLabelProps): import("react").JSX.Element;
33
+ declare function FieldTitle({ className, ...props }: FieldTitleProps): import("react").JSX.Element;
34
+ declare function FieldDescription({ className, ...props }: FieldDescriptionProps): import("react").JSX.Element;
35
+ declare function FieldSeparator({ children, className, ...props }: FieldSeparatorProps): import("react").JSX.Element;
36
+ declare function FieldError({ className, children, errors, ...props }: FieldErrorProps): import("react").JSX.Element | null;
74
37
  //#endregion
75
38
  export { Field, FieldContent, FieldContentProps, FieldDescription, FieldDescriptionProps, FieldError, FieldErrorProps, FieldGroup, FieldGroupProps, FieldLabel, FieldLabelProps, FieldLegend, FieldLegendProps, FieldProps, FieldSeparator, FieldSeparatorProps, FieldSet, FieldSetProps, FieldTitle, FieldTitleProps, useFieldControlId };
76
39
  //# sourceMappingURL=field.d.ts.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":"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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,GAET,CAEA,SAAS,WAAW,CAAE,YAAW,WAAU,SAAQ,GAAG,GAA0B,CAC9E,IAAM,EAAU,MAAc,CAC5B,GAAI,EACF,OAAO,EAGT,GAAI,CAAC,GAAQ,OACX,OAAO,KAGT,IAAM,EAAe,CAAC,GAAG,IAAI,IAAI,EAAO,IAAK,GAAU,CAAC,GAAO,QAAS,CAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAMzF,OAJI,GAAc,SAAW,EACpB,EAAa,EAAE,EAAE,QAIxB,EAAC,KAAD,CAAI,UAAU,8CACX,EAAa,IAAK,GAAU,GAAO,SAAW,EAAC,KAAD,CAAA,SAAyB,EAAM,OAAY,EAAlC,EAAM,OAA4B,CAAC,CACzF,CAAA,CAER,EAAG,CAAC,EAAU,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
+ {"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,mE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6E,CAAS,EACpG,GAAI,EAJN,SAAA,CAME,EAAC,EAAD,CAAW,UAAU,0BAA4B,CAAA,EAChD,GACC,EAAC,OAAD,CACE,UAAU,wEACV,YAAU,0BAET,UACG,CAAA,CAEL,GAET,CAEA,SAAS,WAAW,CAAE,YAAW,WAAU,SAAQ,GAAG,GAA0B,CAC9E,IAAM,EAAU,MAAc,CAC5B,GAAI,EACF,OAAO,EAGT,GAAI,CAAC,GAAQ,OACX,OAAO,KAGT,IAAM,EAAe,CAAC,GAAG,IAAI,IAAI,EAAO,IAAK,GAAU,CAAC,GAAO,QAAS,CAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAMzF,OAJI,GAAc,SAAW,EACpB,EAAa,EAAE,EAAE,QAIxB,EAAC,KAAD,CAAI,UAAU,qCACX,SAAA,EAAa,IAAK,GAAU,GAAO,SAAW,EAAC,KAAD,CAAA,SAAyB,EAAM,OAAY,EAAlC,EAAM,OAA4B,CAAC,CACzF,CAAA,CAER,EAAG,CAAC,EAAU,CAAM,CAAC,EAMrB,OAJK,EAKH,EAAC,MAAD,CACE,KAAK,QACL,YAAU,cACV,UAAW,EAAG,uCAAwC,CAAS,EAC/D,GAAI,EAEH,SAAA,CACE,CAAA,EAXE,IAaX"}
@@ -1 +1 @@
1
- export { };
1
+ export {}
@@ -1,2 +1,2 @@
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()}})});
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-D5AipFQb.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":"udASA,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,CAAC,CAAC,W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AC,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
+ {"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,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,CAAC,CAAC,WAAW,EAC5C,OAAO,EAAM,aAAa,KAAK,CAAC,CAAC,CAAC,KAAK,EAAM,aAAa,IAAI,CAAC,CACjE,CAAC,EAED,GAAG,4DAA+D,CAChE,EACE,EAAC,EAAD,CAAA,SAAA,CACE,EAAC,EAAD,CAAY,QAAQ,wBAAwB,SAAA,OAAiB,CAAA,EAC7D,EAAC,EAAD,CAAO,GAAG,gBAAkB,CAAA,CACvB,CAAA,CAAA,CACT,EAEA,OAAO,EAAO,UAAU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,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,25 +1,16 @@
1
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
-
5
4
  //#region src/components/flex.d.ts
6
5
  declare const flexVariants: (props?: ({
7
- direction?: "row" | "row-reverse" | "column" | "column-reverse" | null | undefined;
8
- align?: "center" | "end" | "start" | "baseline" | "stretch" | null | undefined;
9
- justify?: "center" | "end" | "start" | "between" | "around" | "evenly" | null | undefined;
6
+ direction?: "column" | "column-reverse" | "row" | "row-reverse" | null | undefined;
7
+ align?: "baseline" | "center" | "end" | "start" | "stretch" | null | undefined;
8
+ justify?: "around" | "between" | "center" | "end" | "evenly" | "start" | null | undefined;
10
9
  wrap?: boolean | null | undefined;
11
- gap?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
10
+ gap?: "lg" | "md" | "sm" | "xl" | "xs" | null | undefined;
12
11
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
13
12
  type FlexProps = React.ComponentProps<'div'> & VariantProps<typeof flexVariants>;
14
- declare function Flex({
15
- className,
16
- direction,
17
- align,
18
- justify,
19
- wrap,
20
- gap,
21
- ...props
22
- }: FlexProps): React.JSX.Element;
13
+ declare function Flex({ className, direction, align, justify, wrap, gap, ...props }: FlexProps): React.JSX.Element;
23
14
  //#endregion
24
15
  export { Flex, FlexProps, flexVariants };
25
16
  //# sourceMappingURL=flex.d.ts.map
@@ -1,6 +1,5 @@
1
1
  import { n as __name } from "../rolldown-runtime-Bdj-bS2b.js";
2
2
  import * as React from "react";
3
-
4
3
  //#region src/components/grid.d.ts
5
4
  type GridSpacing = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
6
5
  type GridProps = React.ComponentProps<'div'> & {
@@ -10,27 +9,12 @@ type GridProps = React.ComponentProps<'div'> & {
10
9
  templateRows?: string;
11
10
  templateColumns?: string;
12
11
  };
13
- declare function Grid({
14
- className,
15
- gap,
16
- rowGap,
17
- columnGap,
18
- templateRows,
19
- templateColumns,
20
- style,
21
- ...props
22
- }: GridProps): React.JSX.Element;
12
+ declare function Grid({ className, gap, rowGap, columnGap, templateRows, templateColumns, style, ...props }: GridProps): React.JSX.Element;
23
13
  type GridItemProps = React.ComponentProps<'div'> & {
24
14
  rowSpan?: number;
25
15
  colSpan?: number;
26
16
  };
27
- declare function GridItem({
28
- className,
29
- rowSpan,
30
- colSpan,
31
- style,
32
- ...props
33
- }: GridItemProps): React.JSX.Element;
17
+ declare function GridItem({ className, rowSpan, colSpan, style, ...props }: GridItemProps): React.JSX.Element;
34
18
  //#endregion
35
19
  export { Grid, GridItem, GridItemProps, GridProps };
36
20
  //# sourceMappingURL=grid.d.ts.map
@@ -1,23 +1,15 @@
1
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
-
5
4
  //#region src/components/group.d.ts
6
5
  declare const groupVariants: (props?: ({
7
- align?: "center" | "end" | "start" | "baseline" | "stretch" | null | undefined;
8
- justify?: "center" | "end" | "start" | "between" | "around" | "evenly" | null | undefined;
9
- gap?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
6
+ align?: "baseline" | "center" | "end" | "start" | "stretch" | null | undefined;
7
+ justify?: "around" | "between" | "center" | "end" | "evenly" | "start" | null | undefined;
8
+ gap?: "lg" | "md" | "sm" | "xl" | "xs" | null | undefined;
10
9
  wrap?: boolean | null | undefined;
11
10
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
12
11
  type GroupProps = React.ComponentProps<'div'> & VariantProps<typeof groupVariants>;
13
- declare function Group({
14
- className,
15
- align,
16
- justify,
17
- gap,
18
- wrap,
19
- ...props
20
- }: GroupProps): React.JSX.Element;
12
+ declare function Group({ className, align, justify, gap, wrap, ...props }: GroupProps): React.JSX.Element;
21
13
  //#endregion
22
14
  export { Group, GroupProps, groupVariants };
23
15
  //# sourceMappingURL=group.d.ts.map
@@ -1,20 +1,14 @@
1
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
-
5
4
  //#region src/components/heading.d.ts
6
5
  declare const headingVariants: (props?: ({
7
- size?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
6
+ size?: "lg" | "md" | "sm" | "xl" | "xs" | null | undefined;
8
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
9
8
  type HeadingProps = React.ComponentProps<'h2'> & VariantProps<typeof headingVariants> & {
10
9
  asChild?: boolean;
11
10
  };
12
- declare function Heading({
13
- className,
14
- size,
15
- asChild,
16
- ...props
17
- }: HeadingProps): React.JSX.Element;
11
+ declare function Heading({ className, size, asChild, ...props }: HeadingProps): React.JSX.Element;
18
12
  //#endregion
19
13
  export { Heading, HeadingProps, headingVariants };
20
14
  //# sourceMappingURL=heading.d.ts.map
@@ -1,23 +1,13 @@
1
1
  import { n as __name } from "../rolldown-runtime-Bdj-bS2b.js";
2
2
  import { HoverCard as HoverCard$1 } from "radix-ui";
3
3
  import * as React from "react";
4
-
5
4
  //#region src/components/hover-card.d.ts
6
5
  type HoverCardProps = React.ComponentProps<typeof HoverCard$1.Root>;
7
6
  type HoverCardTriggerProps = React.ComponentProps<typeof HoverCard$1.Trigger>;
8
7
  type HoverCardContentProps = React.ComponentProps<typeof HoverCard$1.Content>;
9
- declare function HoverCard({
10
- ...props
11
- }: HoverCardProps): React.JSX.Element;
12
- declare function HoverCardTrigger({
13
- ...props
14
- }: HoverCardTriggerProps): React.JSX.Element;
15
- declare function HoverCardContent({
16
- className,
17
- align,
18
- sideOffset,
19
- ...props
20
- }: HoverCardContentProps): React.JSX.Element;
8
+ declare function HoverCard({ ...props }: HoverCardProps): React.JSX.Element;
9
+ declare function HoverCardTrigger({ ...props }: HoverCardTriggerProps): React.JSX.Element;
10
+ declare function HoverCardContent({ className, align, sideOffset, ...props }: HoverCardContentProps): React.JSX.Element;
21
11
  //#endregion
22
12
  export { HoverCard, HoverCardContent, HoverCardContentProps, HoverCardProps, HoverCardTrigger, HoverCardTriggerProps };
23
13
  //# sourceMappingURL=hover-card.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hover-card.js","names":["HoverCardPrimitive"],"sources":["../../src/components/hover-card.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { HoverCard as HoverCardPrimitive } from 'radix-ui'\n\nimport { cn } from '../lib/utils'\n\nexport type HoverCardProps = React.ComponentProps<typeof HoverCardPrimitive.Root>\n\nexport type HoverCardTriggerProps = React.ComponentProps<typeof HoverCardPrimitive.Trigger>\n\nexport type HoverCardContentProps = React.ComponentProps<typeof HoverCardPrimitive.Content>\n\nfunction HoverCard({ ...props }: HoverCardProps) {\n return <HoverCardPrimitive.Root data-slot=\"hover-card\" {...props} />\n}\n\nfunction HoverCardTrigger({ ...props }: HoverCardTriggerProps) {\n return <HoverCardPrimitive.Trigger data-slot=\"hover-card-trigger\" {...props} />\n}\n\nfunction HoverCardContent({ className, align = 'center', sideOffset = 4, ...props }: HoverCardContentProps) {\n return (\n <HoverCardPrimitive.Portal data-slot=\"hover-card-portal\">\n <HoverCardPrimitive.Content\n data-slot=\"hover-card-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n 'z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n className\n )}\n {...props}\n />\n </HoverCardPrimitive.Portal>\n )\n}\n\nexport { HoverCard, HoverCardContent, HoverCardTrigger }\n"],"mappings":"0JAYA,SAAS,UAAU,CAAE,GAAG,GAAyB,CAC/C,OAAO,EAACA,EAAmB,KAApB,CAAyB,YAAU,aAAa,GAAI,CAAQ,CAAA,CACrE,CAEA,SAAS,iBAAiB,CAAE,GAAG,GAAgC,CAC7D,OAAO,EAACA,EAAmB,QAApB,CAA4B,YAAU,qBAAqB,GAAI,CAAQ,CAAA,CAChF,CAEA,SAAS,iBAAiB,CAAE,YAAW,QAAQ,SAAU,aAAa,EAAG,GAAG,GAAgC,CAC1G,OACE,EAACA,EAAmB,OAApB,CAA2B,YAAU,6BACnC,EAACA,EAAmB,QAApB,CACE,YAAU,qBACH,QACK,aACZ,UAAW,EACT,8dACA,CACF,EACA,GAAI,CACL,CAAA,CACwB,CAAA,CAE/B"}
1
+ {"version":3,"file":"hover-card.js","names":["HoverCardPrimitive"],"sources":["../../src/components/hover-card.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { HoverCard as HoverCardPrimitive } from 'radix-ui'\n\nimport { cn } from '../lib/utils'\n\nexport type HoverCardProps = React.ComponentProps<typeof HoverCardPrimitive.Root>\n\nexport type HoverCardTriggerProps = React.ComponentProps<typeof HoverCardPrimitive.Trigger>\n\nexport type HoverCardContentProps = React.ComponentProps<typeof HoverCardPrimitive.Content>\n\nfunction HoverCard({ ...props }: HoverCardProps) {\n return <HoverCardPrimitive.Root data-slot=\"hover-card\" {...props} />\n}\n\nfunction HoverCardTrigger({ ...props }: HoverCardTriggerProps) {\n return <HoverCardPrimitive.Trigger data-slot=\"hover-card-trigger\" {...props} />\n}\n\nfunction HoverCardContent({ className, align = 'center', sideOffset = 4, ...props }: HoverCardContentProps) {\n return (\n <HoverCardPrimitive.Portal data-slot=\"hover-card-portal\">\n <HoverCardPrimitive.Content\n data-slot=\"hover-card-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n 'z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n className\n )}\n {...props}\n />\n </HoverCardPrimitive.Portal>\n )\n}\n\nexport { HoverCard, HoverCardContent, HoverCardTrigger }\n"],"mappings":"0JAYA,SAAS,UAAU,CAAE,GAAG,GAAyB,CAC/C,OAAO,EAACA,EAAmB,KAApB,CAAyB,YAAU,aAAa,GAAI,CAAQ,CAAA,CACrE,CAEA,SAAS,iBAAiB,CAAE,GAAG,GAAgC,CAC7D,OAAO,EAACA,EAAmB,QAApB,CAA4B,YAAU,qBAAqB,GAAI,CAAQ,CAAA,CAChF,CAEA,SAAS,iBAAiB,CAAE,YAAW,QAAQ,SAAU,aAAa,EAAG,GAAG,GAAgC,CAC1G,OACE,EAACA,EAAmB,OAApB,CAA2B,YAAU,oBACnC,SAAA,EAACA,EAAmB,QAApB,CACE,YAAU,qBACH,QACK,aACZ,UAAW,EACT,8dACA,CACF,EACA,GAAI,CACL,CAAA,CACwB,CAAA,CAE/B"}
@@ -2,7 +2,6 @@ import { n as __name } from "../rolldown-runtime-Bdj-bS2b.js";
2
2
  import { Button } from "./button.js";
3
3
  import { VariantProps } from "class-variance-authority";
4
4
  import * as React from "react";
5
-
6
5
  //#region src/components/input-group.d.ts
7
6
  type InputGroupProps = React.ComponentProps<'div'>;
8
7
  type InputGroupAddonProps = React.ComponentProps<'div'> & VariantProps<typeof inputGroupAddonVariants>;
@@ -10,41 +9,18 @@ type InputGroupButtonProps = Omit<React.ComponentProps<typeof Button>, 'size'> &
10
9
  type InputGroupTextProps = React.ComponentProps<'span'>;
11
10
  type InputGroupInputProps = React.ComponentProps<'input'>;
12
11
  type InputGroupTextareaProps = React.ComponentProps<'textarea'>;
13
- declare function InputGroup({
14
- className,
15
- ...props
16
- }: InputGroupProps): React.JSX.Element;
12
+ declare function InputGroup({ className, ...props }: InputGroupProps): React.JSX.Element;
17
13
  declare const inputGroupAddonVariants: (props?: ({
18
- align?: "inline-start" | "inline-end" | "block-start" | "block-end" | null | undefined;
14
+ align?: "block-end" | "block-start" | "inline-end" | "inline-start" | null | undefined;
19
15
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
20
- declare function InputGroupAddon({
21
- className,
22
- align,
23
- ...props
24
- }: InputGroupAddonProps): React.JSX.Element;
16
+ declare function InputGroupAddon({ className, align, ...props }: InputGroupAddonProps): React.JSX.Element;
25
17
  declare const inputGroupButtonVariants: (props?: ({
26
- size?: "xs" | "sm" | "icon-xs" | "icon-sm" | null | undefined;
18
+ size?: "icon-sm" | "icon-xs" | "sm" | "xs" | null | undefined;
27
19
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
28
- declare function InputGroupButton({
29
- className,
30
- type,
31
- variant,
32
- size,
33
- color,
34
- ...props
35
- }: InputGroupButtonProps): React.JSX.Element;
36
- declare function InputGroupText({
37
- className,
38
- ...props
39
- }: InputGroupTextProps): React.JSX.Element;
40
- declare function InputGroupInput({
41
- className,
42
- ...props
43
- }: InputGroupInputProps): React.JSX.Element;
44
- declare function InputGroupTextarea({
45
- className,
46
- ...props
47
- }: InputGroupTextareaProps): React.JSX.Element;
20
+ declare function InputGroupButton({ className, type, variant, size, color, ...props }: InputGroupButtonProps): React.JSX.Element;
21
+ declare function InputGroupText({ className, ...props }: InputGroupTextProps): React.JSX.Element;
22
+ declare function InputGroupInput({ className, ...props }: InputGroupInputProps): React.JSX.Element;
23
+ declare function InputGroupTextarea({ className, ...props }: InputGroupTextareaProps): React.JSX.Element;
48
24
  //#endregion
49
25
  export { InputGroup, InputGroupAddon, InputGroupAddonProps, InputGroupButton, InputGroupButtonProps, InputGroupInput, InputGroupInputProps, InputGroupProps, InputGroupText, InputGroupTextProps, InputGroupTextarea, InputGroupTextareaProps };
50
26
  //# sourceMappingURL=input-group.d.ts.map