@whity/ui 0.5.0 → 1.0.1

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 (208) hide show
  1. package/README.md +107 -107
  2. package/package.json +223 -192
  3. package/src/access-denied.stories.tsx +179 -179
  4. package/src/access-denied.tsx +305 -305
  5. package/src/action-proposal.tsx +338 -302
  6. package/src/actor-chip.tsx +71 -71
  7. package/src/agent-activity.tsx +163 -163
  8. package/src/agent-collaboration.stories.tsx +156 -156
  9. package/src/agent-run-status.tsx +196 -196
  10. package/src/alert-dialog.stories.tsx +45 -45
  11. package/src/alert-dialog.tsx +147 -147
  12. package/src/alert.stories.tsx +91 -91
  13. package/src/alert.tsx +89 -89
  14. package/src/app-sidebar.stories.tsx +195 -195
  15. package/src/app-sidebar.tsx +604 -500
  16. package/src/approval-queue.tsx +109 -108
  17. package/src/audience-group-picker.stories.tsx +198 -198
  18. package/src/audience-group-picker.tsx +362 -362
  19. package/src/audience-people-picker.stories.tsx +102 -102
  20. package/src/audience-people-picker.tsx +279 -279
  21. package/src/avatar-pattern.ts +138 -0
  22. package/src/avatar.tsx +125 -83
  23. package/src/badge.stories.tsx +105 -105
  24. package/src/badge.tsx +68 -68
  25. package/src/beta-warning.stories.tsx +79 -79
  26. package/src/beta-warning.tsx +189 -189
  27. package/src/bilingual-input.stories.tsx +82 -82
  28. package/src/bilingual-input.tsx +188 -183
  29. package/src/board.tsx +216 -0
  30. package/src/breadcrumb.stories.tsx +51 -51
  31. package/src/breadcrumb.tsx +90 -90
  32. package/src/built-on-whity.tsx +52 -0
  33. package/src/button.stories.tsx +87 -87
  34. package/src/button.tsx +125 -118
  35. package/src/card.stories.tsx +423 -423
  36. package/src/card.tsx +180 -180
  37. package/src/chart.stories.tsx +66 -66
  38. package/src/chart.tsx +228 -228
  39. package/src/checkbox.stories.tsx +62 -62
  40. package/src/checkbox.tsx +54 -54
  41. package/src/collapsible.stories.tsx +48 -48
  42. package/src/collapsible.tsx +34 -34
  43. package/src/color-card.stories.tsx +61 -61
  44. package/src/color-card.tsx +270 -270
  45. package/src/color-picker.stories.tsx +65 -65
  46. package/src/color-picker.tsx +425 -425
  47. package/src/column-matcher.tsx +84 -0
  48. package/src/command-palette.tsx +399 -306
  49. package/src/confirm-action.tsx +98 -0
  50. package/src/copy-block.stories.tsx +38 -38
  51. package/src/copy-block.tsx +85 -85
  52. package/src/data-table.stories.tsx +200 -200
  53. package/src/data-table.tsx +1687 -1106
  54. package/src/date-picker.stories.tsx +61 -61
  55. package/src/date-picker.tsx +457 -422
  56. package/src/design-cards.stories.tsx +551 -458
  57. package/src/dialog.stories.tsx +48 -48
  58. package/src/dialog.tsx +179 -166
  59. package/src/display-preferences.tsx +59 -0
  60. package/src/documents/barcode-svg.stories.tsx +72 -72
  61. package/src/documents/barcode-svg.tsx +79 -79
  62. package/src/dropdown-menu.stories.tsx +77 -77
  63. package/src/dropdown-menu.tsx +271 -271
  64. package/src/editor/agent-panel.tsx +222 -0
  65. package/src/editor/agents.stories.tsx +81 -0
  66. package/src/editor/agents.ts +55 -0
  67. package/src/editor/behaviour.ts +279 -279
  68. package/src/editor/block-ids.ts +44 -44
  69. package/src/editor/block-list.tsx +104 -101
  70. package/src/editor/block-toolbar.tsx +490 -477
  71. package/src/editor/bubble.tsx +119 -93
  72. package/src/editor/catalogue.ts +169 -103
  73. package/src/editor/collab-rail.tsx +746 -746
  74. package/src/editor/collab.stories.tsx +207 -207
  75. package/src/editor/collab.ts +87 -87
  76. package/src/editor/contract.ts +476 -408
  77. package/src/editor/convert.ts +414 -362
  78. package/src/editor/doc-editor.stories.tsx +98 -98
  79. package/src/editor/doc-editor.tsx +1492 -1287
  80. package/src/editor/editor.css +636 -536
  81. package/src/editor/extensions.ts +86 -86
  82. package/src/editor/field-bar.tsx +154 -0
  83. package/src/editor/field-picker.tsx +109 -107
  84. package/src/editor/fields.ts +100 -100
  85. package/src/editor/gutter.tsx +443 -367
  86. package/src/editor/index.ts +23 -22
  87. package/src/editor/label-sheet.tsx +289 -289
  88. package/src/editor/labels.ts +394 -310
  89. package/src/editor/link-tools.tsx +141 -141
  90. package/src/editor/node-views.tsx +461 -450
  91. package/src/editor/page-view.tsx +372 -353
  92. package/src/editor/phone.tsx +310 -0
  93. package/src/editor/plugin-block-view.tsx +230 -0
  94. package/src/editor/plugin-blocks.stories.tsx +96 -0
  95. package/src/editor/plugin-blocks.ts +52 -0
  96. package/src/editor/publish-check.tsx +201 -182
  97. package/src/editor/rich-blocks.stories.tsx +146 -146
  98. package/src/editor/sample.ts +40 -40
  99. package/src/editor/save-block-dialog.tsx +141 -0
  100. package/src/editor/saved-block-view.tsx +205 -0
  101. package/src/editor/saved-blocks.stories.tsx +105 -0
  102. package/src/editor/saved-parts.ts +192 -0
  103. package/src/editor/schema-rich.ts +156 -150
  104. package/src/editor/schema.ts +368 -315
  105. package/src/editor/services.tsx +205 -127
  106. package/src/editor/slash.ts +64 -64
  107. package/src/editor/suggesting.ts +372 -372
  108. package/src/editor/suggestions.ts +763 -763
  109. package/src/editor/table-keys.ts +66 -66
  110. package/src/editor/templates.stories.tsx +324 -324
  111. package/src/editor/toolbar.tsx +364 -358
  112. package/src/empty-state.stories.tsx +51 -51
  113. package/src/empty-state.tsx +126 -100
  114. package/src/empty-state.usage-notes.md +30 -30
  115. package/src/form.stories.tsx +112 -112
  116. package/src/form.tsx +176 -176
  117. package/src/globals.css +20 -20
  118. package/src/icon-button.tsx +85 -85
  119. package/src/icon-map.ts +335 -244
  120. package/src/icon.tsx +41 -41
  121. package/src/index.ts +92 -67
  122. package/src/input.stories.tsx +157 -157
  123. package/src/input.tsx +768 -759
  124. package/src/kpi-strip.tsx +47 -0
  125. package/src/localized-text.ts +76 -0
  126. package/src/locked-screen.stories.tsx +29 -29
  127. package/src/locked-screen.tsx +75 -61
  128. package/src/lockup.tsx +42 -0
  129. package/src/lottie.tsx +441 -0
  130. package/src/mark.tsx +62 -62
  131. package/src/math-text.stories.tsx +33 -33
  132. package/src/math-text.tsx +43 -43
  133. package/src/menu-bar.stories.tsx +198 -198
  134. package/src/menu-bar.tsx +373 -373
  135. package/src/message-thread.tsx +181 -0
  136. package/src/money/currency.ts +244 -230
  137. package/src/money/money-input.tsx +131 -0
  138. package/src/money/money.tsx +33 -0
  139. package/src/open-on-computer.tsx +150 -0
  140. package/src/otp-input.tsx +161 -0
  141. package/src/page-header.stories.tsx +95 -95
  142. package/src/page-header.tsx +122 -122
  143. package/src/page-shell.stories.tsx +42 -42
  144. package/src/page-shell.tsx +32 -32
  145. package/src/page-states.tsx +277 -0
  146. package/src/pagination.stories.tsx +45 -45
  147. package/src/pagination.tsx +98 -98
  148. package/src/paper-sheet.stories.tsx +88 -0
  149. package/src/paper-sheet.tsx +85 -0
  150. package/src/phone-input.tsx +252 -0
  151. package/src/phone-tab-bar.tsx +152 -0
  152. package/src/plugin-card.stories.tsx +208 -180
  153. package/src/plugin-card.tsx +931 -848
  154. package/src/popover.stories.tsx +48 -48
  155. package/src/popover.tsx +55 -55
  156. package/src/radio-group.stories.tsx +26 -26
  157. package/src/radio-group.tsx +44 -44
  158. package/src/role-summary.stories.tsx +143 -0
  159. package/src/role-summary.tsx +120 -0
  160. package/src/route-flow/editor.tsx +1087 -1014
  161. package/src/route-flow/model.ts +771 -716
  162. package/src/save-bar.tsx +94 -0
  163. package/src/scope-grant.tsx +139 -139
  164. package/src/screen-too-small.stories.tsx +61 -61
  165. package/src/screen-too-small.tsx +104 -104
  166. package/src/search-field.tsx +65 -0
  167. package/src/select.stories.tsx +44 -44
  168. package/src/select.tsx +197 -197
  169. package/src/separator.stories.tsx +34 -34
  170. package/src/separator.tsx +34 -34
  171. package/src/sheet.stories.tsx +49 -49
  172. package/src/sheet.tsx +168 -168
  173. package/src/skeleton.stories.tsx +28 -28
  174. package/src/skeleton.tsx +19 -19
  175. package/src/slider.stories.tsx +78 -78
  176. package/src/slider.tsx +300 -300
  177. package/src/spinner.stories.tsx +33 -33
  178. package/src/spinner.tsx +55 -55
  179. package/src/stepper.tsx +85 -0
  180. package/src/switch.stories.tsx +42 -42
  181. package/src/switch.tsx +41 -41
  182. package/src/switcher.stories.tsx +111 -111
  183. package/src/switcher.tsx +131 -131
  184. package/src/system-state.tsx +55 -0
  185. package/src/table.stories.tsx +48 -48
  186. package/src/table.tsx +121 -121
  187. package/src/tabs.stories.tsx +74 -74
  188. package/src/tabs.tsx +90 -90
  189. package/src/tag-input.stories.tsx +67 -67
  190. package/src/tag-input.tsx +117 -117
  191. package/src/tenant-logo.tsx +63 -63
  192. package/src/tenant-switcher.stories.tsx +38 -38
  193. package/src/tenant-switcher.tsx +185 -164
  194. package/src/textarea.stories.tsx +27 -27
  195. package/src/textarea.tsx +18 -18
  196. package/src/theme-mode.ts +74 -52
  197. package/src/time-grid.tsx +163 -0
  198. package/src/time-picker.stories.tsx +62 -62
  199. package/src/time-picker.tsx +616 -615
  200. package/src/toggle-group.tsx +139 -138
  201. package/src/tooltip.stories.tsx +43 -43
  202. package/src/tooltip.tsx +73 -73
  203. package/src/top-nav.stories.tsx +58 -58
  204. package/src/top-nav.tsx +324 -324
  205. package/src/undo-bar.tsx +107 -107
  206. package/src/utils.ts +45 -45
  207. package/src/view-toggle.stories.tsx +84 -84
  208. package/src/view-toggle.tsx +111 -110
package/src/input.tsx CHANGED
@@ -1,759 +1,768 @@
1
- import * as React from "react"
2
- import {
3
- IconCalendarTime,
4
- IconCloudUpload,
5
- IconEye,
6
- IconEyeOff,
7
- IconInfoCircle,
8
- IconMinus,
9
- IconPaperclip,
10
- IconPlus,
11
- IconSearch,
12
- IconX,
13
- } from "@tabler/icons-react"
14
-
15
- import { cn } from "./utils"
16
- import { DatePicker } from "./date-picker"
17
- import { TimePicker } from "./time-picker"
18
- import { ColorPicker } from "./color-picker"
19
- import { Slider } from "./slider"
20
- import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip"
21
-
22
- export interface InputProps extends React.ComponentProps<"input"> {
23
- /**
24
- * Field label text or node displayed statically above the input field.
25
- */
26
- label?: React.ReactNode
27
- /**
28
- * Displays a required asterisk (*) next to the label.
29
- */
30
- required?: boolean
31
- /**
32
- * Tooltip message displayed in an interactive info icon next to the label.
33
- */
34
- tooltip?: React.ReactNode
35
- /**
36
- * Small informational note rendered below the input field.
37
- */
38
- helperText?: React.ReactNode
39
- /**
40
- * Error text rendered below the input field in destructive red.
41
- */
42
- errorText?: React.ReactNode
43
- /**
44
- * For type="password", automatically renders a toggle button to show/hide
45
- * password text. Defaults to true. Set to false to disable the toggle button.
46
- */
47
- showPasswordToggle?: boolean
48
- /**
49
- * For type="number", automatically removes default browser spinner arrows and
50
- * renders custom +/- stepper buttons. Defaults to true. Set to false to disable.
51
- */
52
- showNumberStepper?: boolean
53
- /**
54
- * For type="file", chooses between a prominent drag-and-drop upload zone ("dropzone", default)
55
- * or a compact inline file picker ("compact").
56
- */
57
- fileVariant?: "dropzone" | "compact"
58
- /** Accessible name for a tooltip trigger. Defaults to "More information". */
59
- tooltipTriggerLabel?: string
60
- /** Accessible name for the password reveal toggle, by state. */
61
- showPasswordLabel?: string
62
- hidePasswordLabel?: string
63
- /** Accessible names for the number stepper buttons. */
64
- decrementLabel?: string
65
- incrementLabel?: string
66
- /**
67
- * Prompt inside the file dropzone. A NODE, not a string, because the
68
- * default is one sentence with a link-styled span inside it ("Click to
69
- * browse or drag and drop files"). Splitting that into two string props
70
- * would hand a translator two fragments they cannot reorder, which is
71
- * exactly what a whole-sentence key avoids — so the caller passes the
72
- * finished node instead.
73
- */
74
- dropzonePrompt?: React.ReactNode
75
- /** Hint under the dropzone prompt, by `multiple`. */
76
- multipleFilesHint?: string
77
- singleFileHint?: string
78
- }
79
-
80
- function formatBytes(bytes: number): string {
81
- if (!bytes || bytes <= 0) return "0 B"
82
- const k = 1024
83
- const sizes = ["B", "KB", "MB", "GB"]
84
- const i = Math.floor(Math.log(bytes) / Math.log(k))
85
- return `${parseFloat((bytes / Math.pow(k, i)).toFixed(1))} ${sizes[i]}`
86
- }
87
-
88
- const Input = React.forwardRef<HTMLInputElement, InputProps>(
89
- (
90
- {
91
- className,
92
- type,
93
- label,
94
- required,
95
- tooltip,
96
- helperText,
97
- errorText,
98
- showPasswordToggle = true,
99
- showNumberStepper = true,
100
- fileVariant = "dropzone",
101
- tooltipTriggerLabel = "More information",
102
- showPasswordLabel = "Show password",
103
- hidePasswordLabel = "Hide password",
104
- decrementLabel = "Decrease value",
105
- incrementLabel = "Increase value",
106
- dropzonePrompt,
107
- multipleFilesHint = "Upload multiple files",
108
- singleFileHint = "Upload single file",
109
- disabled,
110
- id,
111
- ...props
112
- },
113
- ref
114
- ) => {
115
- const internalRef = React.useRef<HTMLInputElement>(null)
116
- React.useImperativeHandle(ref, () => internalRef.current!)
117
-
118
- // Generate a unique ID for the input if not provided and label exists.
119
- // This ensures proper label association for accessibility.
120
- // If id is provided, always use it. Otherwise, generate one only if label exists.
121
- const inputId = React.useMemo(() => {
122
- if (id) return id
123
- if (label) {
124
- return `input-${Math.random().toString(36).substr(2, 9)}`
125
- }
126
- return undefined
127
- }, [id, label])
128
-
129
- const [showPassword, setShowPassword] = React.useState(false)
130
- const [selectedFiles, setSelectedFiles] = React.useState<File[]>([])
131
- const [isDragging, setIsDragging] = React.useState(false)
132
-
133
- const handleStep = (direction: 1 | -1) => {
134
- const input = internalRef.current
135
- if (!input || disabled) return
136
- try {
137
- if (direction === 1) {
138
- input.stepUp()
139
- } else {
140
- input.stepDown()
141
- }
142
- } catch {
143
- const current = Number(input.value) || 0
144
- const step = Number(props.step) || 1
145
- input.value = String(current + direction * step)
146
- }
147
- const nativeSetter = Object.getOwnPropertyDescriptor(
148
- window.HTMLInputElement.prototype,
149
- "value"
150
- )?.set
151
- nativeSetter?.call(input, input.value)
152
- input.dispatchEvent(new Event("input", { bubbles: true }))
153
- input.dispatchEvent(new Event("change", { bubbles: true }))
154
- }
155
-
156
- const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
157
- if (e.target.files) {
158
- const filesArr = Array.from(e.target.files)
159
- setSelectedFiles(filesArr)
160
- }
161
- props.onChange?.(e)
162
- }
163
-
164
- const handleDropFiles = (droppedFiles: File[]) => {
165
- if (disabled || droppedFiles.length === 0) return
166
- let nextFiles = droppedFiles
167
- if (!props.multiple) {
168
- nextFiles = [droppedFiles[0]]
169
- } else {
170
- const existingKeys = new Set(selectedFiles.map((f) => `${f.name}-${f.size}`))
171
- const added = droppedFiles.filter((f) => !existingKeys.has(`${f.name}-${f.size}`))
172
- nextFiles = [...selectedFiles, ...added]
173
- }
174
- setSelectedFiles(nextFiles)
175
-
176
- const input = internalRef.current
177
- if (input) {
178
- const dt = new DataTransfer()
179
- nextFiles.forEach((f) => dt.items.add(f))
180
- const nativeSetter = Object.getOwnPropertyDescriptor(
181
- window.HTMLInputElement.prototype,
182
- "files"
183
- )?.set
184
- nativeSetter?.call(input, dt.files)
185
- input.dispatchEvent(new Event("input", { bubbles: true }))
186
- input.dispatchEvent(new Event("change", { bubbles: true }))
187
- }
188
- }
189
-
190
- const handleRemoveFile = (indexToRemove: number) => {
191
- const nextFiles = selectedFiles.filter((_, i) => i !== indexToRemove)
192
- setSelectedFiles(nextFiles)
193
-
194
- const input = internalRef.current
195
- if (input) {
196
- const dt = new DataTransfer()
197
- nextFiles.forEach((file) => dt.items.add(file))
198
- const nativeSetter = Object.getOwnPropertyDescriptor(
199
- window.HTMLInputElement.prototype,
200
- "files"
201
- )?.set
202
- nativeSetter?.call(input, dt.files)
203
- input.dispatchEvent(new Event("input", { bubbles: true }))
204
- input.dispatchEvent(new Event("change", { bubbles: true }))
205
- }
206
- }
207
-
208
- const isPassword = type === "password" && showPasswordToggle
209
- const isNumber = type === "number" && showNumberStepper
210
- const isFile = type === "file"
211
- const isDate = type === "date"
212
- const isTime = type === "time"
213
- const isColor = type === "color"
214
- const isDateTime = type === "datetime-local"
215
- const isSearch = type === "search"
216
- const isSlider = type === "range" || type === "slider"
217
-
218
- const renderInputControl = () => {
219
- if (isSlider) {
220
- return (
221
- <Slider
222
- disabled={disabled}
223
- className={className}
224
- min={props.min !== undefined ? Number(props.min) : 0}
225
- max={props.max !== undefined ? Number(props.max) : 100}
226
- step={props.step !== undefined ? Number(props.step) : 1}
227
- defaultValue={props.defaultValue !== undefined ? [Number(props.defaultValue)] : [0]}
228
- value={props.value !== undefined ? [Number(props.value)] : undefined}
229
- onValueChange={(vals) => {
230
- const val = String(vals[0])
231
- if (internalRef.current) {
232
- internalRef.current.value = val
233
- const nativeSetter = Object.getOwnPropertyDescriptor(
234
- window.HTMLInputElement.prototype,
235
- "value"
236
- )?.set
237
- nativeSetter?.call(internalRef.current, val)
238
- internalRef.current.dispatchEvent(new Event("input", { bubbles: true }))
239
- internalRef.current.dispatchEvent(new Event("change", { bubbles: true }))
240
- }
241
- }}
242
- />
243
- )
244
- }
245
-
246
- if (isColor) {
247
- return (
248
- <ColorPicker
249
- disabled={disabled}
250
- className={className}
251
- placeholder={props.placeholder}
252
- defaultValue={props.defaultValue as string}
253
- value={props.value as string}
254
- onChange={(c) => {
255
- if (internalRef.current) {
256
- const val = c || ""
257
- internalRef.current.value = val
258
- const nativeSetter = Object.getOwnPropertyDescriptor(
259
- window.HTMLInputElement.prototype,
260
- "value"
261
- )?.set
262
- nativeSetter?.call(internalRef.current, val)
263
- internalRef.current.dispatchEvent(new Event("input", { bubbles: true }))
264
- internalRef.current.dispatchEvent(new Event("change", { bubbles: true }))
265
- }
266
- }}
267
- />
268
- )
269
- }
270
-
271
- if (isDate) {
272
- return (
273
- <>
274
- {/*
275
- THE ELEMENT THE EVENT COMES FROM.
276
-
277
- The picker below reports a choice by writing to `internalRef` and
278
- dispatching a native event, which is how React's `onChange`
279
- receives it. Every other branch of this component renders the
280
- native input further down — these picker branches return early and
281
- never reached it, so `internalRef.current` was null, the whole
282
- dispatch body was skipped, and a chosen date never left the picker.
283
- The caller saw an empty value and a "required" error on a field
284
- they had just filled in.
285
-
286
- Uncontrolled on purpose: the dispatch sets `.value` through the
287
- native setter, and a React-controlled value would be reasserted
288
- over it on the next render.
289
-
290
- `type="date"` with the `hidden` ATTRIBUTE, not `type="hidden"`:
291
- React only tracks value changes for text-like inputs, and
292
- `hidden` is not one of them — the event would be dispatched onto
293
- an element React never listens to, and the same silent nothing
294
- would happen for a different reason.
295
- */}
296
- <input
297
- ref={internalRef}
298
- type="date"
299
- hidden
300
- name={props.name}
301
- onChange={props.onChange}
302
- />
303
- <DatePicker
304
- disabled={disabled}
305
- className={className}
306
- placeholder={props.placeholder}
307
- defaultValue={props.defaultValue as string}
308
- value={props.value as string}
309
- onChange={(d) => {
310
- if (internalRef.current) {
311
- const val = d ? d.toISOString().split("T")[0] : ""
312
- internalRef.current.value = val
313
- const nativeSetter = Object.getOwnPropertyDescriptor(
314
- window.HTMLInputElement.prototype,
315
- "value"
316
- )?.set
317
- nativeSetter?.call(internalRef.current, val)
318
- internalRef.current.dispatchEvent(new Event("input", { bubbles: true }))
319
- internalRef.current.dispatchEvent(new Event("change", { bubbles: true }))
320
- }
321
- }}
322
- />
323
- </>
324
- )
325
- }
326
-
327
- if (isTime) {
328
- return (
329
- <TimePicker
330
- disabled={disabled}
331
- className={className}
332
- placeholder={props.placeholder}
333
- defaultValue={props.defaultValue as string}
334
- value={props.value as string}
335
- onChange={(t) => {
336
- if (internalRef.current) {
337
- const val = t || ""
338
- internalRef.current.value = val
339
- const nativeSetter = Object.getOwnPropertyDescriptor(
340
- window.HTMLInputElement.prototype,
341
- "value"
342
- )?.set
343
- nativeSetter?.call(internalRef.current, val)
344
- internalRef.current.dispatchEvent(new Event("input", { bubbles: true }))
345
- internalRef.current.dispatchEvent(new Event("change", { bubbles: true }))
346
- }
347
- }}
348
- />
349
- )
350
- }
351
-
352
- if (isDateTime) {
353
- return (
354
- <div className="relative flex items-center w-full">
355
- <input
356
- ref={internalRef}
357
- id={inputId}
358
- type={type}
359
- data-slot="input"
360
- disabled={disabled}
361
- aria-invalid={!!errorText}
362
- aria-describedby={[
363
- errorText && inputId ? `${inputId}-error` : undefined,
364
- helperText && inputId ? `${inputId}-helper` : undefined,
365
- ]
366
- .filter(Boolean)
367
- .join(" ") || undefined}
368
- className={cn(
369
- "h-7 w-full min-w-0 rounded-md border border-input bg-card ps-2.5 pe-8 py-0.5 text-xs font-medium transition-colors outline-none placeholder:text-muted-foreground placeholder:text-xs focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 [&::-webkit-calendar-picker-indicator]:cursor-pointer [&::-webkit-calendar-picker-indicator]:opacity-0",
370
- className
371
- )}
372
- {...props}
373
- />
374
- <button
375
- type="button"
376
- tabIndex={-1}
377
- disabled={disabled}
378
- onClick={() => {
379
- const input = internalRef.current
380
- if (!input) return
381
- if ("showPicker" in input && typeof (input as any).showPicker === "function") {
382
- ;(input as any).showPicker()
383
- } else {
384
- input.focus()
385
- }
386
- }}
387
- className="absolute end-2.5 flex items-center justify-center size-3.5 text-muted-foreground hover:text-foreground focus-visible:outline-none rounded transition-colors disabled:pointer-events-none disabled:opacity-50 z-10"
388
- >
389
- <IconCalendarTime className="size-3.5 shrink-0" aria-hidden="true" />
390
- </button>
391
- </div>
392
- )
393
- }
394
-
395
- if (isSearch) {
396
- return (
397
- <div className="relative flex items-center w-full">
398
- <div className="absolute start-2.5 flex items-center justify-center size-3.5 text-muted-foreground pointer-events-none shrink-0 z-10">
399
- <IconSearch className="size-3.5 shrink-0" aria-hidden="true" />
400
- </div>
401
- <input
402
- ref={internalRef}
403
- id={inputId}
404
- type="search"
405
- data-slot="input"
406
- disabled={disabled}
407
- aria-invalid={!!errorText}
408
- aria-describedby={[
409
- errorText && inputId ? `${inputId}-error` : undefined,
410
- helperText && inputId ? `${inputId}-helper` : undefined,
411
- ]
412
- .filter(Boolean)
413
- .join(" ") || undefined}
414
- className={cn(
415
- "h-7 w-full min-w-0 rounded-md border border-input bg-card ps-8 pe-2.5 py-0.5 text-xs font-medium transition-colors outline-none placeholder:text-muted-foreground placeholder:text-xs focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 [&::-webkit-search-cancel-button]:cursor-pointer",
416
- className
417
- )}
418
- {...props}
419
- />
420
- </div>
421
- )
422
- }
423
-
424
- if (isPassword) {
425
- const inputType = showPassword ? "text" : "password"
426
- return (
427
- <div className="relative flex items-center w-full">
428
- <input
429
- ref={internalRef}
430
- id={inputId}
431
- type={inputType}
432
- data-slot="input"
433
- disabled={disabled}
434
- aria-invalid={!!errorText}
435
- aria-describedby={[
436
- errorText && inputId ? `${inputId}-error` : undefined,
437
- helperText && inputId ? `${inputId}-helper` : undefined,
438
- ]
439
- .filter(Boolean)
440
- .join(" ") || undefined}
441
- className={cn(
442
- "h-7 w-full min-w-0 rounded-md border border-input bg-card ps-2.5 pe-8 py-0.5 text-xs font-medium transition-colors outline-none placeholder:text-muted-foreground placeholder:text-xs focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20",
443
- className
444
- )}
445
- {...props}
446
- />
447
- <button
448
- type="button"
449
- disabled={disabled}
450
- onClick={() => setShowPassword((prev) => !prev)}
451
- aria-label={showPassword ? hidePasswordLabel : showPasswordLabel}
452
- title={showPassword ? hidePasswordLabel : showPasswordLabel}
453
- className="absolute end-2.5 flex items-center justify-center size-3.5 text-muted-foreground hover:text-foreground focus-visible:outline-none rounded transition-colors disabled:pointer-events-none disabled:opacity-50 z-10"
454
- >
455
- {showPassword ? (
456
- <IconEyeOff className="size-3.5 shrink-0" aria-hidden="true" />
457
- ) : (
458
- <IconEye className="size-3.5 shrink-0" aria-hidden="true" />
459
- )}
460
- </button>
461
- </div>
462
- )
463
- }
464
-
465
- if (isNumber) {
466
- return (
467
- <div className="relative flex items-center w-full">
468
- <button
469
- type="button"
470
- tabIndex={-1}
471
- disabled={disabled}
472
- onClick={() => handleStep(-1)}
473
- aria-label={decrementLabel}
474
- title={decrementLabel}
475
- className="absolute start-2.5 flex items-center justify-center size-3.5 text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 z-10"
476
- >
477
- <IconMinus className="size-3.5 shrink-0" aria-hidden="true" />
478
- </button>
479
- <input
480
- ref={internalRef}
481
- id={inputId}
482
- type="number"
483
- data-slot="input"
484
- disabled={disabled}
485
- aria-invalid={!!errorText}
486
- aria-describedby={[
487
- errorText && inputId ? `${inputId}-error` : undefined,
488
- helperText && inputId ? `${inputId}-helper` : undefined,
489
- ]
490
- .filter(Boolean)
491
- .join(" ") || undefined}
492
- className={cn(
493
- "h-7 w-full min-w-0 rounded-md border border-input bg-card px-8 py-0.5 text-center text-xs font-medium transition-colors outline-none [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none placeholder:text-muted-foreground placeholder:text-xs focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20",
494
- className
495
- )}
496
- {...props}
497
- />
498
- <button
499
- type="button"
500
- tabIndex={-1}
501
- disabled={disabled}
502
- onClick={() => handleStep(1)}
503
- aria-label={incrementLabel}
504
- title={incrementLabel}
505
- className="absolute end-2.5 flex items-center justify-center size-3.5 text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 z-10"
506
- >
507
- <IconPlus className="size-3.5 shrink-0" aria-hidden="true" />
508
- </button>
509
- </div>
510
- )
511
- }
512
-
513
- if (isFile && fileVariant === "dropzone") {
514
- return (
515
- <div className="flex flex-col gap-2.5 w-full">
516
- <div
517
- onDragOver={(e) => {
518
- e.preventDefault()
519
- e.stopPropagation()
520
- if (!disabled) setIsDragging(true)
521
- }}
522
- onDragLeave={(e) => {
523
- e.preventDefault()
524
- e.stopPropagation()
525
- setIsDragging(false)
526
- }}
527
- onDrop={(e) => {
528
- e.preventDefault()
529
- e.stopPropagation()
530
- setIsDragging(false)
531
- if (e.dataTransfer.files && e.dataTransfer.files.length > 0) {
532
- handleDropFiles(Array.from(e.dataTransfer.files))
533
- }
534
- }}
535
- onClick={() => internalRef.current?.click()}
536
- className={cn(
537
- "group flex flex-col items-center justify-center rounded-xl border-2 border-dashed border-input bg-card/60 p-5 text-center transition-all cursor-pointer hover:border-primary/60 hover:bg-muted/30 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30",
538
- isDragging && "border-primary bg-primary/10 ring-2 ring-primary/20",
539
- disabled && "pointer-events-none opacity-50",
540
- className
541
- )}
542
- >
543
- <input
544
- ref={internalRef}
545
- id={inputId}
546
- type="file"
547
- data-slot="input"
548
- disabled={disabled}
549
- onChange={handleFileChange}
550
- aria-invalid={!!errorText}
551
- aria-describedby={[
552
- errorText && inputId ? `${inputId}-error` : undefined,
553
- helperText && inputId ? `${inputId}-helper` : undefined,
554
- ]
555
- .filter(Boolean)
556
- .join(" ") || undefined}
557
- className="sr-only"
558
- {...props}
559
- />
560
- <div className="flex size-10 items-center justify-center rounded-full bg-primary/10 text-primary transition-transform group-hover:scale-105 mb-2">
561
- <IconCloudUpload className="size-5 shrink-0" aria-hidden="true" />
562
- </div>
563
- <p className="text-xs font-semibold text-foreground">
564
- {dropzonePrompt ?? (
565
- <>
566
- <span className="text-primary hover:underline">Click to browse</span> or drag
567
- and drop files
568
- </>
569
- )}
570
- </p>
571
- <p className="mt-0.5 text-[0.6875rem] text-muted-foreground">
572
- {props.multiple ? multipleFilesHint : singleFileHint}
573
- </p>
574
- </div>
575
-
576
- {selectedFiles.length > 0 && (
577
- <div className="flex flex-col gap-1.5 w-full">
578
- {selectedFiles.map((file, idx) => (
579
- <div
580
- key={`${file.name}-${idx}`}
581
- className="flex items-center justify-between gap-3 rounded-lg border border-border/70 bg-card p-2 shadow-2xs transition-colors"
582
- >
583
- <div className="flex items-center gap-2.5 min-w-0">
584
- <div className="flex size-7 shrink-0 items-center justify-center rounded-md bg-primary/10 text-primary">
585
- <IconPaperclip className="size-4" aria-hidden="true" />
586
- </div>
587
- <div className="flex flex-col min-w-0 text-start">
588
- <span className="truncate text-xs font-semibold text-foreground" title={file.name}>
589
- {file.name}
590
- </span>
591
- <span className="text-[0.625rem] text-muted-foreground font-mono">
592
- {formatBytes(file.size)}
593
- </span>
594
- </div>
595
- </div>
596
- <button
597
- type="button"
598
- disabled={disabled}
599
- onClick={(e) => {
600
- e.stopPropagation()
601
- handleRemoveFile(idx)
602
- }}
603
- aria-label={`Remove ${file.name}`}
604
- className="flex size-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
605
- >
606
- <IconX className="size-3.5" aria-hidden="true" />
607
- </button>
608
- </div>
609
- ))}
610
- </div>
611
- )}
612
- </div>
613
- )
614
- }
615
-
616
- if (isFile && fileVariant === "compact") {
617
- return (
618
- <div
619
- className={cn(
620
- "flex min-h-7 w-full flex-wrap items-center gap-1.5 rounded-md border border-input bg-card p-1 text-xs font-medium transition-colors focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/30",
621
- disabled && "pointer-events-none opacity-50",
622
- className
623
- )}
624
- >
625
- <input
626
- ref={internalRef}
627
- id={inputId}
628
- type="file"
629
- data-slot="input"
630
- disabled={disabled}
631
- onChange={handleFileChange}
632
- aria-invalid={!!errorText}
633
- aria-describedby={[
634
- errorText && inputId ? `${inputId}-error` : undefined,
635
- helperText && inputId ? `${inputId}-helper` : undefined,
636
- ]
637
- .filter(Boolean)
638
- .join(" ") || undefined}
639
- className="sr-only"
640
- {...props}
641
- />
642
- <button
643
- type="button"
644
- disabled={disabled}
645
- onClick={() => internalRef.current?.click()}
646
- className="flex h-6 items-center justify-center rounded border border-input/40 bg-muted px-2.5 text-xs font-semibold text-foreground transition-colors hover:bg-muted/80 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"
647
- >
648
- {props.multiple ? "Choose files" : "Choose file"}
649
- </button>
650
- {selectedFiles.length === 0 ? (
651
- <span className="text-xs text-muted-foreground ps-1">
652
- No {props.multiple ? "files" : "file"} chosen
653
- </span>
654
- ) : (
655
- <div className="flex flex-wrap items-center gap-1">
656
- {selectedFiles.map((file, idx) => (
657
- <span
658
- key={`${file.name}-${idx}`}
659
- className="inline-flex max-w-[200px] items-center gap-1 rounded-full border border-border/60 bg-muted/80 px-2 py-0.5 text-xs font-medium text-foreground"
660
- >
661
- <IconPaperclip className="size-3 shrink-0 text-muted-foreground" aria-hidden="true" />
662
- <span className="truncate" title={file.name}>
663
- {file.name}
664
- </span>
665
- <button
666
- type="button"
667
- tabIndex={-1}
668
- disabled={disabled}
669
- onClick={(e) => {
670
- e.stopPropagation()
671
- handleRemoveFile(idx)
672
- }}
673
- aria-label={`Remove ${file.name}`}
674
- className="ms-0.5 flex size-3.5 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted-foreground/20 hover:text-foreground"
675
- >
676
- <IconX className="size-3 shrink-0" aria-hidden="true" />
677
- </button>
678
- </span>
679
- ))}
680
- </div>
681
- )}
682
- </div>
683
- )
684
- }
685
-
686
- return (
687
- <input
688
- ref={ref}
689
- id={inputId}
690
- type={type}
691
- data-slot="input"
692
- disabled={disabled}
693
- aria-invalid={!!errorText}
694
- aria-describedby={[
695
- errorText && inputId ? `${inputId}-error` : undefined,
696
- helperText && inputId ? `${inputId}-helper` : undefined,
697
- ]
698
- .filter(Boolean)
699
- .join(" ") || undefined}
700
- className={cn(
701
- "h-7 w-full min-w-0 rounded-md border border-input bg-card px-2.5 py-0.5 text-xs font-medium transition-colors outline-none file:inline-flex file:h-full file:items-center file:border-0 file:border-e file:border-input/40 file:bg-muted file:px-2.5 file:text-xs file:font-semibold file:text-foreground hover:file:bg-muted/80 file:transition-colors file:cursor-pointer file:me-2 placeholder:text-muted-foreground placeholder:text-xs focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20",
702
- className
703
- )}
704
- {...props}
705
- />
706
- )
707
- }
708
-
709
- const hasHeader = label || tooltip || required
710
- const hasFooter = helperText || errorText
711
-
712
- if (!hasHeader && !hasFooter) {
713
- return renderInputControl()
714
- }
715
-
716
- return (
717
- <div className="flex flex-col gap-1 w-full text-start">
718
- {hasHeader && (
719
- <div className="flex items-center gap-1 text-xs font-semibold text-foreground">
720
- {label && inputId ? (
721
- <label htmlFor={inputId} className="cursor-pointer">
722
- {label}
723
- </label>
724
- ) : (
725
- label && <span>{label}</span>
726
- )}
727
- {required && <span className="text-destructive font-semibold ms-0.5">*</span>}
728
- {tooltip && (
729
- <TooltipProvider>
730
- <Tooltip>
731
- <TooltipTrigger asChild>
732
- <button
733
- type="button"
734
- aria-label={tooltipTriggerLabel}
735
- className="inline-flex items-center text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded p-0.5"
736
- >
737
- <IconInfoCircle className="size-3.5 shrink-0" aria-hidden="true" />
738
- </button>
739
- </TooltipTrigger>
740
- <TooltipContent>{tooltip}</TooltipContent>
741
- </Tooltip>
742
- </TooltipProvider>
743
- )}
744
- </div>
745
- )}
746
- {renderInputControl()}
747
- {errorText ? (
748
- <p id={inputId ? `${inputId}-error` : undefined} className="text-[0.6875rem] font-medium text-destructive">{errorText}</p>
749
- ) : (
750
- helperText && <p id={inputId ? `${inputId}-helper` : undefined} className="text-[0.6875rem] text-muted-foreground">{helperText}</p>
751
- )}
752
- </div>
753
- )
754
- }
755
- )
756
-
757
- Input.displayName = "Input"
758
-
759
- export { Input }
1
+ import * as React from "react"
2
+ import {
3
+ IconCalendarTime,
4
+ IconCloudUpload,
5
+ IconEye,
6
+ IconEyeOff,
7
+ IconInfoCircle,
8
+ IconMinus,
9
+ IconPaperclip,
10
+ IconPlus,
11
+ IconSearch,
12
+ IconX,
13
+ } from "@tabler/icons-react"
14
+
15
+ import { cn } from "./utils"
16
+ import { DatePicker } from "./date-picker"
17
+ import { TimePicker } from "./time-picker"
18
+ import { ColorPicker } from "./color-picker"
19
+ import { Slider } from "./slider"
20
+ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip"
21
+
22
+ export interface InputProps extends React.ComponentProps<"input"> {
23
+ /**
24
+ * Field label text or node displayed statically above the input field.
25
+ */
26
+ label?: React.ReactNode
27
+ /**
28
+ * Displays a required asterisk (*) next to the label.
29
+ */
30
+ required?: boolean
31
+ /**
32
+ * Tooltip message displayed in an interactive info icon next to the label.
33
+ */
34
+ tooltip?: React.ReactNode
35
+ /**
36
+ * Small informational note rendered below the input field.
37
+ */
38
+ helperText?: React.ReactNode
39
+ /**
40
+ * Error text rendered below the input field in destructive red.
41
+ */
42
+ errorText?: React.ReactNode
43
+ /**
44
+ * For type="password", automatically renders a toggle button to show/hide
45
+ * password text. Defaults to true. Set to false to disable the toggle button.
46
+ */
47
+ showPasswordToggle?: boolean
48
+ /**
49
+ * For type="number", automatically removes default browser spinner arrows and
50
+ * renders custom +/- stepper buttons. Defaults to true. Set to false to disable.
51
+ */
52
+ showNumberStepper?: boolean
53
+ /**
54
+ * For type="file", chooses between a prominent drag-and-drop upload zone ("dropzone", default)
55
+ * or a compact inline file picker ("compact").
56
+ */
57
+ fileVariant?: "dropzone" | "compact"
58
+ /** Accessible name for a tooltip trigger. Defaults to "More information". */
59
+ tooltipTriggerLabel?: string
60
+ /** For type="date": the picker's own words, for hosts that translate them. */
61
+ datePickerLabels?: {
62
+ /** The language of the calendar's month and weekday names (see DatePicker). */
63
+ locale?: string
64
+ placeholder?: string
65
+ clear?: string
66
+ today?: string
67
+ clearButton?: string
68
+ previousMonth?: string
69
+ nextMonth?: string
70
+ }
71
+ /** Accessible name for the password reveal toggle, by state. */
72
+ showPasswordLabel?: string
73
+ hidePasswordLabel?: string
74
+ /** Accessible names for the number stepper buttons. */
75
+ decrementLabel?: string
76
+ incrementLabel?: string
77
+ /**
78
+ * Prompt inside the file dropzone. A NODE, not a string, because the
79
+ * default is one sentence with a link-styled span inside it ("Click to
80
+ * browse or drag and drop files"). Splitting that into two string props
81
+ * would hand a translator two fragments they cannot reorder, which is
82
+ * exactly what a whole-sentence key avoids — so the caller passes the
83
+ * finished node instead.
84
+ */
85
+ dropzonePrompt?: React.ReactNode
86
+ /** Hint under the dropzone prompt, by `multiple`. */
87
+ multipleFilesHint?: string
88
+ singleFileHint?: string
89
+ }
90
+
91
+ function formatBytes(bytes: number): string {
92
+ if (!bytes || bytes <= 0) return "0 B"
93
+ const k = 1024
94
+ const sizes = ["B", "KB", "MB", "GB"]
95
+ const i = Math.floor(Math.log(bytes) / Math.log(k))
96
+ return `${parseFloat((bytes / Math.pow(k, i)).toFixed(1))} ${sizes[i]}`
97
+ }
98
+
99
+ /** The picked day as YYYY-MM-DD, as the person sees it. toISOString() would give UTC's day. */
100
+ function toDateValue(date: Date): string {
101
+ const month = String(date.getMonth() + 1).padStart(2, "0")
102
+ const day = String(date.getDate()).padStart(2, "0")
103
+
104
+ return `${String(date.getFullYear()).padStart(4, "0")}-${month}-${day}`
105
+ }
106
+
107
+ const Input = React.forwardRef<HTMLInputElement, InputProps>(
108
+ (
109
+ {
110
+ className,
111
+ type,
112
+ label,
113
+ required,
114
+ tooltip,
115
+ helperText,
116
+ errorText,
117
+ showPasswordToggle = true,
118
+ showNumberStepper = true,
119
+ fileVariant = "dropzone",
120
+ tooltipTriggerLabel = "More information",
121
+ datePickerLabels,
122
+ showPasswordLabel = "Show password",
123
+ hidePasswordLabel = "Hide password",
124
+ decrementLabel = "Decrease value",
125
+ incrementLabel = "Increase value",
126
+ dropzonePrompt,
127
+ multipleFilesHint = "Upload multiple files",
128
+ singleFileHint = "Upload single file",
129
+ disabled,
130
+ id,
131
+ ...props
132
+ },
133
+ ref
134
+ ) => {
135
+ const internalRef = React.useRef<HTMLInputElement>(null)
136
+ React.useImperativeHandle(ref, () => internalRef.current!)
137
+
138
+ // Generate a unique ID for the input if not provided and label exists.
139
+ // This ensures proper label association for accessibility.
140
+ // If id is provided, always use it. Otherwise, generate one only if label exists.
141
+ const inputId = React.useMemo(() => {
142
+ if (id) return id
143
+ if (label) {
144
+ return `input-${Math.random().toString(36).substr(2, 9)}`
145
+ }
146
+ return undefined
147
+ }, [id, label])
148
+
149
+ const [showPassword, setShowPassword] = React.useState(false)
150
+ const [selectedFiles, setSelectedFiles] = React.useState<File[]>([])
151
+ const [isDragging, setIsDragging] = React.useState(false)
152
+
153
+ const handleStep = (direction: 1 | -1) => {
154
+ const input = internalRef.current
155
+ if (!input || disabled) return
156
+ try {
157
+ if (direction === 1) {
158
+ input.stepUp()
159
+ } else {
160
+ input.stepDown()
161
+ }
162
+ } catch {
163
+ const current = Number(input.value) || 0
164
+ const step = Number(props.step) || 1
165
+ input.value = String(current + direction * step)
166
+ }
167
+ const nativeSetter = Object.getOwnPropertyDescriptor(
168
+ window.HTMLInputElement.prototype,
169
+ "value"
170
+ )?.set
171
+ nativeSetter?.call(input, input.value)
172
+ input.dispatchEvent(new Event("input", { bubbles: true }))
173
+ input.dispatchEvent(new Event("change", { bubbles: true }))
174
+ }
175
+
176
+ const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
177
+ if (e.target.files) {
178
+ const filesArr = Array.from(e.target.files)
179
+ setSelectedFiles(filesArr)
180
+ }
181
+ props.onChange?.(e)
182
+ }
183
+
184
+ const handleDropFiles = (droppedFiles: File[]) => {
185
+ if (disabled || droppedFiles.length === 0) return
186
+ let nextFiles = droppedFiles
187
+ if (!props.multiple) {
188
+ nextFiles = [droppedFiles[0]]
189
+ } else {
190
+ const existingKeys = new Set(selectedFiles.map((f) => `${f.name}-${f.size}`))
191
+ const added = droppedFiles.filter((f) => !existingKeys.has(`${f.name}-${f.size}`))
192
+ nextFiles = [...selectedFiles, ...added]
193
+ }
194
+ setSelectedFiles(nextFiles)
195
+
196
+ const input = internalRef.current
197
+ if (input) {
198
+ const dt = new DataTransfer()
199
+ nextFiles.forEach((f) => dt.items.add(f))
200
+ const nativeSetter = Object.getOwnPropertyDescriptor(
201
+ window.HTMLInputElement.prototype,
202
+ "files"
203
+ )?.set
204
+ nativeSetter?.call(input, dt.files)
205
+ input.dispatchEvent(new Event("input", { bubbles: true }))
206
+ input.dispatchEvent(new Event("change", { bubbles: true }))
207
+ }
208
+ }
209
+
210
+ const handleRemoveFile = (indexToRemove: number) => {
211
+ const nextFiles = selectedFiles.filter((_, i) => i !== indexToRemove)
212
+ setSelectedFiles(nextFiles)
213
+
214
+ const input = internalRef.current
215
+ if (input) {
216
+ const dt = new DataTransfer()
217
+ nextFiles.forEach((file) => dt.items.add(file))
218
+ const nativeSetter = Object.getOwnPropertyDescriptor(
219
+ window.HTMLInputElement.prototype,
220
+ "files"
221
+ )?.set
222
+ nativeSetter?.call(input, dt.files)
223
+ input.dispatchEvent(new Event("input", { bubbles: true }))
224
+ input.dispatchEvent(new Event("change", { bubbles: true }))
225
+ }
226
+ }
227
+
228
+ const isPassword = type === "password" && showPasswordToggle
229
+ const isNumber = type === "number" && showNumberStepper
230
+ const isFile = type === "file"
231
+ const isDate = type === "date"
232
+ const isTime = type === "time"
233
+ const isColor = type === "color"
234
+ const isDateTime = type === "datetime-local"
235
+ const isSearch = type === "search"
236
+ const isSlider = type === "range" || type === "slider"
237
+
238
+ /*
239
+ HOW A PICKER REPORTS A CHOICE.
240
+
241
+ The pickers are not inputs, so a choice reaches the caller's onChange as a
242
+ real change event from a hidden input, which also carries `name` for a
243
+ plain form post. React compares the input's value with the last one it saw,
244
+ through its own wrapper around `.value`. So the value has to be written with
245
+ the browser's setter ONLY: writing `.value` first tells React about it, the
246
+ event then looks like no change, and the choice is dropped with no error.
247
+ */
248
+ const reportPickerValue = (val: string) => {
249
+ const input = internalRef.current
250
+ if (!input) return
251
+ Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set?.call(
252
+ input,
253
+ val
254
+ )
255
+ input.dispatchEvent(new Event("input", { bubbles: true }))
256
+ }
257
+
258
+ /*
259
+ Follows the caller's value, so choosing the same day again after a form
260
+ reset still counts as a change.
261
+
262
+ Only a date keeps its own type. Time and colour pickers report forms a typed
263
+ input would blank ("03:30 PM"), and a range input would clamp to its limits.
264
+ */
265
+ const pickerInput = (backingType: "date" | "text") => (
266
+ <input
267
+ ref={internalRef}
268
+ type={backingType}
269
+ hidden
270
+ name={props.name}
271
+ {...(props.value !== undefined
272
+ ? { value: String(props.value), onChange: props.onChange ?? (() => undefined) }
273
+ : { defaultValue: props.defaultValue, onChange: props.onChange })}
274
+ />
275
+ )
276
+
277
+ const renderInputControl = () => {
278
+ if (isSlider) {
279
+ return (
280
+ <>
281
+ {pickerInput("text")}
282
+ <Slider
283
+ disabled={disabled}
284
+ className={className}
285
+ min={props.min !== undefined ? Number(props.min) : 0}
286
+ max={props.max !== undefined ? Number(props.max) : 100}
287
+ step={props.step !== undefined ? Number(props.step) : 1}
288
+ defaultValue={props.defaultValue !== undefined ? [Number(props.defaultValue)] : [0]}
289
+ value={props.value !== undefined ? [Number(props.value)] : undefined}
290
+ onValueChange={(vals) => {
291
+ reportPickerValue(String(vals[0]))
292
+ }}
293
+ />
294
+ </>
295
+ )
296
+ }
297
+
298
+ if (isColor) {
299
+ return (
300
+ <>
301
+ {pickerInput("text")}
302
+ <ColorPicker
303
+ id={inputId}
304
+ disabled={disabled}
305
+ className={className}
306
+ placeholder={props.placeholder}
307
+ defaultValue={props.defaultValue as string}
308
+ value={props.value as string}
309
+ onChange={(c) => {
310
+ reportPickerValue(c || "")
311
+ }}
312
+ />
313
+ </>
314
+ )
315
+ }
316
+
317
+ if (isDate) {
318
+ return (
319
+ <>
320
+ {pickerInput("date")}
321
+ <DatePicker
322
+ id={inputId}
323
+ disabled={disabled}
324
+ className={className}
325
+ placeholder={props.placeholder ?? datePickerLabels?.placeholder}
326
+ clearLabel={datePickerLabels?.clear}
327
+ todayLabel={datePickerLabels?.today}
328
+ clearButtonLabel={datePickerLabels?.clearButton}
329
+ previousMonthLabel={datePickerLabels?.previousMonth}
330
+ nextMonthLabel={datePickerLabels?.nextMonth}
331
+ locale={datePickerLabels?.locale}
332
+ defaultValue={props.defaultValue as string}
333
+ value={props.value as string}
334
+ onChange={(d) => {
335
+ reportPickerValue(d ? toDateValue(d) : "")
336
+ }}
337
+ />
338
+ </>
339
+ )
340
+ }
341
+
342
+ if (isTime) {
343
+ return (
344
+ <>
345
+ {pickerInput("text")}
346
+ <TimePicker
347
+ id={inputId}
348
+ disabled={disabled}
349
+ className={className}
350
+ placeholder={props.placeholder}
351
+ defaultValue={props.defaultValue as string}
352
+ value={props.value as string}
353
+ onChange={(t) => {
354
+ reportPickerValue(t || "")
355
+ }}
356
+ />
357
+ </>
358
+ )
359
+ }
360
+
361
+ if (isDateTime) {
362
+ return (
363
+ <div className="relative flex items-center w-full">
364
+ <input
365
+ ref={internalRef}
366
+ id={inputId}
367
+ type={type}
368
+ data-slot="input"
369
+ disabled={disabled}
370
+ aria-invalid={!!errorText}
371
+ aria-describedby={[
372
+ errorText && inputId ? `${inputId}-error` : undefined,
373
+ helperText && inputId ? `${inputId}-helper` : undefined,
374
+ ]
375
+ .filter(Boolean)
376
+ .join(" ") || undefined}
377
+ className={cn(
378
+ "h-10 w-full min-w-0 rounded-control border border-input bg-card ps-2.5 pe-8 py-0.5 text-sm transition-colors outline-none placeholder:text-muted-foreground placeholder:text-xs focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 [&::-webkit-calendar-picker-indicator]:cursor-pointer [&::-webkit-calendar-picker-indicator]:opacity-0",
379
+ className
380
+ )}
381
+ {...props}
382
+ />
383
+ <button
384
+ type="button"
385
+ tabIndex={-1}
386
+ disabled={disabled}
387
+ onClick={() => {
388
+ const input = internalRef.current
389
+ if (!input) return
390
+ if ("showPicker" in input && typeof (input as any).showPicker === "function") {
391
+ ;(input as any).showPicker()
392
+ } else {
393
+ input.focus()
394
+ }
395
+ }}
396
+ className="absolute end-2.5 flex items-center justify-center size-3.5 text-muted-foreground hover:text-foreground focus-visible:outline-none rounded transition-colors disabled:pointer-events-none disabled:opacity-50 z-10"
397
+ >
398
+ <IconCalendarTime className="size-3.5 shrink-0" aria-hidden="true" />
399
+ </button>
400
+ </div>
401
+ )
402
+ }
403
+
404
+ if (isSearch) {
405
+ return (
406
+ <div className="relative flex items-center w-full">
407
+ <div className="absolute start-2.5 flex items-center justify-center size-3.5 text-muted-foreground pointer-events-none shrink-0 z-10">
408
+ <IconSearch className="size-3.5 shrink-0" aria-hidden="true" />
409
+ </div>
410
+ <input
411
+ ref={internalRef}
412
+ id={inputId}
413
+ type="search"
414
+ data-slot="input"
415
+ disabled={disabled}
416
+ aria-invalid={!!errorText}
417
+ aria-describedby={[
418
+ errorText && inputId ? `${inputId}-error` : undefined,
419
+ helperText && inputId ? `${inputId}-helper` : undefined,
420
+ ]
421
+ .filter(Boolean)
422
+ .join(" ") || undefined}
423
+ className={cn(
424
+ "h-10 w-full min-w-0 rounded-control border border-input bg-card ps-8 pe-2.5 py-0.5 text-sm transition-colors outline-none placeholder:text-muted-foreground placeholder:text-xs focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 [&::-webkit-search-cancel-button]:cursor-pointer",
425
+ className
426
+ )}
427
+ {...props}
428
+ />
429
+ </div>
430
+ )
431
+ }
432
+
433
+ if (isPassword) {
434
+ const inputType = showPassword ? "text" : "password"
435
+ return (
436
+ <div className="relative flex items-center w-full">
437
+ <input
438
+ ref={internalRef}
439
+ id={inputId}
440
+ type={inputType}
441
+ data-slot="input"
442
+ disabled={disabled}
443
+ aria-invalid={!!errorText}
444
+ aria-describedby={[
445
+ errorText && inputId ? `${inputId}-error` : undefined,
446
+ helperText && inputId ? `${inputId}-helper` : undefined,
447
+ ]
448
+ .filter(Boolean)
449
+ .join(" ") || undefined}
450
+ className={cn(
451
+ "h-10 w-full min-w-0 rounded-control border border-input bg-card ps-2.5 pe-8 py-0.5 text-sm transition-colors outline-none placeholder:text-muted-foreground placeholder:text-xs focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20",
452
+ className
453
+ )}
454
+ {...props}
455
+ />
456
+ <button
457
+ type="button"
458
+ disabled={disabled}
459
+ onClick={() => setShowPassword((prev) => !prev)}
460
+ aria-label={showPassword ? hidePasswordLabel : showPasswordLabel}
461
+ title={showPassword ? hidePasswordLabel : showPasswordLabel}
462
+ className="absolute end-2.5 flex items-center justify-center size-3.5 text-muted-foreground hover:text-foreground focus-visible:outline-none rounded transition-colors disabled:pointer-events-none disabled:opacity-50 z-10"
463
+ >
464
+ {showPassword ? (
465
+ <IconEyeOff className="size-3.5 shrink-0" aria-hidden="true" />
466
+ ) : (
467
+ <IconEye className="size-3.5 shrink-0" aria-hidden="true" />
468
+ )}
469
+ </button>
470
+ </div>
471
+ )
472
+ }
473
+
474
+ if (isNumber) {
475
+ return (
476
+ <div className="relative flex items-center w-full">
477
+ <button
478
+ type="button"
479
+ tabIndex={-1}
480
+ disabled={disabled}
481
+ onClick={() => handleStep(-1)}
482
+ aria-label={decrementLabel}
483
+ title={decrementLabel}
484
+ className="absolute start-2.5 flex items-center justify-center size-3.5 text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 z-10"
485
+ >
486
+ <IconMinus className="size-3.5 shrink-0" aria-hidden="true" />
487
+ </button>
488
+ <input
489
+ ref={internalRef}
490
+ id={inputId}
491
+ type="number"
492
+ data-slot="input"
493
+ disabled={disabled}
494
+ aria-invalid={!!errorText}
495
+ aria-describedby={[
496
+ errorText && inputId ? `${inputId}-error` : undefined,
497
+ helperText && inputId ? `${inputId}-helper` : undefined,
498
+ ]
499
+ .filter(Boolean)
500
+ .join(" ") || undefined}
501
+ className={cn(
502
+ "h-10 w-full min-w-0 rounded-control border border-input bg-card px-8 py-0.5 text-center text-sm transition-colors outline-none [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none placeholder:text-muted-foreground placeholder:text-xs focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20",
503
+ className
504
+ )}
505
+ {...props}
506
+ />
507
+ <button
508
+ type="button"
509
+ tabIndex={-1}
510
+ disabled={disabled}
511
+ onClick={() => handleStep(1)}
512
+ aria-label={incrementLabel}
513
+ title={incrementLabel}
514
+ className="absolute end-2.5 flex items-center justify-center size-3.5 text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 z-10"
515
+ >
516
+ <IconPlus className="size-3.5 shrink-0" aria-hidden="true" />
517
+ </button>
518
+ </div>
519
+ )
520
+ }
521
+
522
+ if (isFile && fileVariant === "dropzone") {
523
+ return (
524
+ <div className="flex flex-col gap-2.5 w-full">
525
+ <div
526
+ onDragOver={(e) => {
527
+ e.preventDefault()
528
+ e.stopPropagation()
529
+ if (!disabled) setIsDragging(true)
530
+ }}
531
+ onDragLeave={(e) => {
532
+ e.preventDefault()
533
+ e.stopPropagation()
534
+ setIsDragging(false)
535
+ }}
536
+ onDrop={(e) => {
537
+ e.preventDefault()
538
+ e.stopPropagation()
539
+ setIsDragging(false)
540
+ if (e.dataTransfer.files && e.dataTransfer.files.length > 0) {
541
+ handleDropFiles(Array.from(e.dataTransfer.files))
542
+ }
543
+ }}
544
+ onClick={() => internalRef.current?.click()}
545
+ className={cn(
546
+ "group flex flex-col items-center justify-center rounded-xl border-2 border-dashed border-input bg-card/60 p-5 text-center transition-all cursor-pointer hover:border-primary/60 hover:bg-muted/30 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30",
547
+ isDragging && "border-primary bg-primary/10 ring-2 ring-primary/20",
548
+ disabled && "pointer-events-none opacity-50",
549
+ className
550
+ )}
551
+ >
552
+ <input
553
+ ref={internalRef}
554
+ id={inputId}
555
+ type="file"
556
+ data-slot="input"
557
+ disabled={disabled}
558
+ onChange={handleFileChange}
559
+ aria-invalid={!!errorText}
560
+ aria-describedby={[
561
+ errorText && inputId ? `${inputId}-error` : undefined,
562
+ helperText && inputId ? `${inputId}-helper` : undefined,
563
+ ]
564
+ .filter(Boolean)
565
+ .join(" ") || undefined}
566
+ className="sr-only"
567
+ {...props}
568
+ />
569
+ <div className="flex size-10 items-center justify-center rounded-full bg-primary/10 text-primary transition-transform group-hover:scale-105 mb-2">
570
+ <IconCloudUpload className="size-5 shrink-0" aria-hidden="true" />
571
+ </div>
572
+ <p className="text-xs font-semibold text-foreground">
573
+ {dropzonePrompt ?? (
574
+ <>
575
+ <span className="text-primary hover:underline">Click to browse</span> or drag
576
+ and drop files
577
+ </>
578
+ )}
579
+ </p>
580
+ <p className="mt-0.5 text-xs text-muted-foreground">
581
+ {props.multiple ? multipleFilesHint : singleFileHint}
582
+ </p>
583
+ </div>
584
+
585
+ {selectedFiles.length > 0 && (
586
+ <div className="flex flex-col gap-1.5 w-full">
587
+ {selectedFiles.map((file, idx) => (
588
+ <div
589
+ key={`${file.name}-${idx}`}
590
+ className="flex items-center justify-between gap-3 rounded-lg border border-border/70 bg-card p-2 shadow-2xs transition-colors"
591
+ >
592
+ <div className="flex items-center gap-2.5 min-w-0">
593
+ <div className="flex size-7 shrink-0 items-center justify-center rounded-md bg-primary/10 text-primary">
594
+ <IconPaperclip className="size-4" aria-hidden="true" />
595
+ </div>
596
+ <div className="flex flex-col min-w-0 text-start">
597
+ <span className="truncate text-xs font-semibold text-foreground" title={file.name}>
598
+ {file.name}
599
+ </span>
600
+ <span className="text-xs text-muted-foreground font-mono">
601
+ {formatBytes(file.size)}
602
+ </span>
603
+ </div>
604
+ </div>
605
+ <button
606
+ type="button"
607
+ disabled={disabled}
608
+ onClick={(e) => {
609
+ e.stopPropagation()
610
+ handleRemoveFile(idx)
611
+ }}
612
+ aria-label={`Remove ${file.name}`}
613
+ className="flex size-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
614
+ >
615
+ <IconX className="size-3.5" aria-hidden="true" />
616
+ </button>
617
+ </div>
618
+ ))}
619
+ </div>
620
+ )}
621
+ </div>
622
+ )
623
+ }
624
+
625
+ if (isFile && fileVariant === "compact") {
626
+ return (
627
+ <div
628
+ className={cn(
629
+ "flex min-h-10 w-full flex-wrap items-center gap-1.5 rounded-control border border-input bg-card p-inset-control text-sm transition-colors focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/30",
630
+ disabled && "pointer-events-none opacity-50",
631
+ className
632
+ )}
633
+ >
634
+ <input
635
+ ref={internalRef}
636
+ id={inputId}
637
+ type="file"
638
+ data-slot="input"
639
+ disabled={disabled}
640
+ onChange={handleFileChange}
641
+ aria-invalid={!!errorText}
642
+ aria-describedby={[
643
+ errorText && inputId ? `${inputId}-error` : undefined,
644
+ helperText && inputId ? `${inputId}-helper` : undefined,
645
+ ]
646
+ .filter(Boolean)
647
+ .join(" ") || undefined}
648
+ className="sr-only"
649
+ {...props}
650
+ />
651
+ <button
652
+ type="button"
653
+ disabled={disabled}
654
+ onClick={() => internalRef.current?.click()}
655
+ className="flex h-6 items-center justify-center rounded border border-input/40 bg-muted px-2.5 text-xs font-semibold text-foreground transition-colors hover:bg-muted/80 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"
656
+ >
657
+ {props.multiple ? "Choose files" : "Choose file"}
658
+ </button>
659
+ {selectedFiles.length === 0 ? (
660
+ <span className="text-xs text-muted-foreground ps-1">
661
+ No {props.multiple ? "files" : "file"} chosen
662
+ </span>
663
+ ) : (
664
+ <div className="flex flex-wrap items-center gap-1">
665
+ {selectedFiles.map((file, idx) => (
666
+ <span
667
+ key={`${file.name}-${idx}`}
668
+ className="inline-flex max-w-[200px] items-center gap-1 rounded-full border border-border/60 bg-muted/80 px-2 py-0.5 text-xs font-medium text-foreground"
669
+ >
670
+ <IconPaperclip className="size-3 shrink-0 text-muted-foreground" aria-hidden="true" />
671
+ <span className="truncate" title={file.name}>
672
+ {file.name}
673
+ </span>
674
+ <button
675
+ type="button"
676
+ tabIndex={-1}
677
+ disabled={disabled}
678
+ onClick={(e) => {
679
+ e.stopPropagation()
680
+ handleRemoveFile(idx)
681
+ }}
682
+ aria-label={`Remove ${file.name}`}
683
+ className="ms-0.5 flex size-3.5 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted-foreground/20 hover:text-foreground"
684
+ >
685
+ <IconX className="size-3 shrink-0" aria-hidden="true" />
686
+ </button>
687
+ </span>
688
+ ))}
689
+ </div>
690
+ )}
691
+ </div>
692
+ )
693
+ }
694
+
695
+ return (
696
+ <input
697
+ ref={ref}
698
+ id={inputId}
699
+ type={type}
700
+ data-slot="input"
701
+ disabled={disabled}
702
+ aria-invalid={!!errorText}
703
+ aria-describedby={[
704
+ errorText && inputId ? `${inputId}-error` : undefined,
705
+ helperText && inputId ? `${inputId}-helper` : undefined,
706
+ ]
707
+ .filter(Boolean)
708
+ .join(" ") || undefined}
709
+ className={cn(
710
+ "h-10 w-full min-w-0 rounded-control border border-input bg-card px-2.5 py-0.5 text-sm transition-colors outline-none file:inline-flex file:h-full file:items-center file:border-0 file:border-e file:border-input/40 file:bg-muted file:px-2.5 file:text-xs file:font-semibold file:text-foreground hover:file:bg-muted/80 file:transition-colors file:cursor-pointer file:me-2 placeholder:text-muted-foreground placeholder:text-xs focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20",
711
+ className
712
+ )}
713
+ {...props}
714
+ />
715
+ )
716
+ }
717
+
718
+ const hasHeader = label || tooltip || required
719
+ const hasFooter = helperText || errorText
720
+
721
+ if (!hasHeader && !hasFooter) {
722
+ return renderInputControl()
723
+ }
724
+
725
+ return (
726
+ <div className="flex flex-col gap-1 w-full text-start">
727
+ {hasHeader && (
728
+ <div className="flex items-center gap-1 text-xs font-semibold text-foreground">
729
+ {label && inputId ? (
730
+ <label htmlFor={inputId} className="cursor-pointer">
731
+ {label}
732
+ </label>
733
+ ) : (
734
+ label && <span>{label}</span>
735
+ )}
736
+ {required && <span className="text-destructive font-semibold ms-0.5">*</span>}
737
+ {tooltip && (
738
+ <TooltipProvider>
739
+ <Tooltip>
740
+ <TooltipTrigger asChild>
741
+ <button
742
+ type="button"
743
+ aria-label={tooltipTriggerLabel}
744
+ className="inline-flex items-center text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded p-0.5"
745
+ >
746
+ <IconInfoCircle className="size-3.5 shrink-0" aria-hidden="true" />
747
+ </button>
748
+ </TooltipTrigger>
749
+ <TooltipContent>{tooltip}</TooltipContent>
750
+ </Tooltip>
751
+ </TooltipProvider>
752
+ )}
753
+ </div>
754
+ )}
755
+ {renderInputControl()}
756
+ {errorText ? (
757
+ <p id={inputId ? `${inputId}-error` : undefined} className="text-xs font-medium text-destructive">{errorText}</p>
758
+ ) : (
759
+ helperText && <p id={inputId ? `${inputId}-helper` : undefined} className="text-xs text-muted-foreground">{helperText}</p>
760
+ )}
761
+ </div>
762
+ )
763
+ }
764
+ )
765
+
766
+ Input.displayName = "Input"
767
+
768
+ export { Input }