@42-central/ui-react 0.27.0 → 0.29.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 (180) hide show
  1. package/dist/{chunk-5H5YOPCF.js → chunk-2RQLPN4U.js} +6 -6
  2. package/dist/{chunk-5H5YOPCF.js.map → chunk-2RQLPN4U.js.map} +1 -1
  3. package/dist/{chunk-SOUDKESO.js → chunk-37HYN7PC.js} +3 -3
  4. package/dist/{chunk-SOUDKESO.js.map → chunk-37HYN7PC.js.map} +1 -1
  5. package/dist/{chunk-OVT2KZHY.js → chunk-3KARNPW4.js} +3 -3
  6. package/dist/{chunk-OVT2KZHY.js.map → chunk-3KARNPW4.js.map} +1 -1
  7. package/dist/{chunk-Y2G47ARQ.js → chunk-5EOMSWNO.js} +5 -5
  8. package/dist/{chunk-Y2G47ARQ.js.map → chunk-5EOMSWNO.js.map} +1 -1
  9. package/dist/chunk-6B2GNPJP.js +43 -0
  10. package/dist/chunk-6B2GNPJP.js.map +1 -0
  11. package/dist/{chunk-MCRTAUSZ.js → chunk-7FPSQBWB.js} +3 -3
  12. package/dist/{chunk-MCRTAUSZ.js.map → chunk-7FPSQBWB.js.map} +1 -1
  13. package/dist/{chunk-6IRMKF5T.js → chunk-B4GNSSHU.js} +4 -4
  14. package/dist/{chunk-6IRMKF5T.js.map → chunk-B4GNSSHU.js.map} +1 -1
  15. package/dist/{chunk-BMEJBY6H.js → chunk-B5YHYI7E.js} +22 -27
  16. package/dist/chunk-B5YHYI7E.js.map +1 -0
  17. package/dist/{chunk-WERJ44ZN.js → chunk-DTFSCR3U.js} +3 -3
  18. package/dist/{chunk-WERJ44ZN.js.map → chunk-DTFSCR3U.js.map} +1 -1
  19. package/dist/{chunk-PFZMB3US.js → chunk-FQJNQW3G.js} +3 -3
  20. package/dist/{chunk-PFZMB3US.js.map → chunk-FQJNQW3G.js.map} +1 -1
  21. package/dist/{chunk-X3YIHN2U.js → chunk-FSPS7TVD.js} +5 -5
  22. package/dist/{chunk-X3YIHN2U.js.map → chunk-FSPS7TVD.js.map} +1 -1
  23. package/dist/{chunk-7OGZT7U2.js → chunk-G3AD3NJG.js} +3 -3
  24. package/dist/{chunk-7OGZT7U2.js.map → chunk-G3AD3NJG.js.map} +1 -1
  25. package/dist/{chunk-MNYY7UU2.js → chunk-GEZYGBXY.js} +6 -6
  26. package/dist/{chunk-MNYY7UU2.js.map → chunk-GEZYGBXY.js.map} +1 -1
  27. package/dist/{chunk-ULF5LOBS.js → chunk-HMNXNKDA.js} +3 -3
  28. package/dist/{chunk-ULF5LOBS.js.map → chunk-HMNXNKDA.js.map} +1 -1
  29. package/dist/{chunk-NF2PBGD3.js → chunk-IANYMDKH.js} +3 -3
  30. package/dist/{chunk-NF2PBGD3.js.map → chunk-IANYMDKH.js.map} +1 -1
  31. package/dist/{chunk-QEMXXQQO.js → chunk-JKFPRQB2.js} +3 -3
  32. package/dist/{chunk-QEMXXQQO.js.map → chunk-JKFPRQB2.js.map} +1 -1
  33. package/dist/{chunk-ZVECQBGG.js → chunk-KNGSO7A3.js} +41 -13
  34. package/dist/chunk-KNGSO7A3.js.map +1 -0
  35. package/dist/{chunk-L24N5EON.js → chunk-MQHD3EJE.js} +3 -3
  36. package/dist/{chunk-L24N5EON.js.map → chunk-MQHD3EJE.js.map} +1 -1
  37. package/dist/{chunk-IUK7OJXZ.js → chunk-OBSZ4NE2.js} +5 -4
  38. package/dist/chunk-OBSZ4NE2.js.map +1 -0
  39. package/dist/{chunk-DJ72KP32.js → chunk-OXR7BXZA.js} +3 -3
  40. package/dist/{chunk-DJ72KP32.js.map → chunk-OXR7BXZA.js.map} +1 -1
  41. package/dist/{chunk-LIZWCWED.js → chunk-PQZSTI3R.js} +3 -3
  42. package/dist/{chunk-LIZWCWED.js.map → chunk-PQZSTI3R.js.map} +1 -1
  43. package/dist/{chunk-LKFHUDEW.js → chunk-QVOBLRCM.js} +3 -3
  44. package/dist/{chunk-LKFHUDEW.js.map → chunk-QVOBLRCM.js.map} +1 -1
  45. package/dist/{chunk-E52Z2FKU.js → chunk-S5CQRCTF.js} +5 -5
  46. package/dist/{chunk-E52Z2FKU.js.map → chunk-S5CQRCTF.js.map} +1 -1
  47. package/dist/{chunk-SCXXJDKQ.js → chunk-SP6LCCTZ.js} +21 -28
  48. package/dist/chunk-SP6LCCTZ.js.map +1 -0
  49. package/dist/{chunk-BGDVUC3B.js → chunk-TUP7WXQE.js} +3 -3
  50. package/dist/{chunk-BGDVUC3B.js.map → chunk-TUP7WXQE.js.map} +1 -1
  51. package/dist/{chunk-4D2V4JE4.js → chunk-V2QZG4IT.js} +4 -4
  52. package/dist/{chunk-4D2V4JE4.js.map → chunk-V2QZG4IT.js.map} +1 -1
  53. package/dist/{chunk-D2QIPQ74.js → chunk-W3XX7BYT.js} +2 -2
  54. package/dist/chunk-W3XX7BYT.js.map +1 -0
  55. package/dist/{chunk-F374BNL4.js → chunk-YVTM2KRR.js} +12 -8
  56. package/dist/chunk-YVTM2KRR.js.map +1 -0
  57. package/dist/colors.css +328 -0
  58. package/dist/components/action-icon/action-icon.d.ts +6 -5
  59. package/dist/components/action-icon/action-icon.d.ts.map +1 -1
  60. package/dist/components/action-icon/index.js +3 -2
  61. package/dist/components/alert/index.js +3 -3
  62. package/dist/components/ambient-background/index.js +1 -1
  63. package/dist/components/app-shell/index.js +6 -5
  64. package/dist/components/app-shell/index.js.map +1 -1
  65. package/dist/components/avatar/index.js +2 -2
  66. package/dist/components/badge/badge.d.ts +1 -1
  67. package/dist/components/badge/badge.d.ts.map +1 -1
  68. package/dist/components/badge/index.js +2 -1
  69. package/dist/components/button/button.d.ts +11 -9
  70. package/dist/components/button/button.d.ts.map +1 -1
  71. package/dist/components/button/index.js +3 -2
  72. package/dist/components/button-multi-select/index.js +4 -3
  73. package/dist/components/button-multi-select/index.js.map +1 -1
  74. package/dist/components/button-select/index.js +4 -3
  75. package/dist/components/button-select/index.js.map +1 -1
  76. package/dist/components/calendar/index.js +6 -5
  77. package/dist/components/calendar-heatmap/index.js +2 -2
  78. package/dist/components/camera/index.js +8 -7
  79. package/dist/components/carousel/index.js +2 -2
  80. package/dist/components/clipboard/index.js +3 -2
  81. package/dist/components/clipboard/index.js.map +1 -1
  82. package/dist/components/code-block/index.js +1 -1
  83. package/dist/components/code-block/static.js.map +1 -1
  84. package/dist/components/compare/index.js +2 -2
  85. package/dist/components/data-table/index.js +16 -15
  86. package/dist/components/data-table/index.js.map +1 -1
  87. package/dist/components/date-picker/index.js +11 -10
  88. package/dist/components/date-picker/index.js.map +1 -1
  89. package/dist/components/download-button/index.js +4 -3
  90. package/dist/components/drawer/index.js +6 -5
  91. package/dist/components/file-item/index.js +7 -6
  92. package/dist/components/file-preview/index.js +7 -6
  93. package/dist/components/file-preview/index.js.map +1 -1
  94. package/dist/components/file-trigger/index.js +4 -3
  95. package/dist/components/file-upload/index.js +7 -6
  96. package/dist/components/file-upload/index.js.map +1 -1
  97. package/dist/components/gallery/index.js +2 -2
  98. package/dist/components/image-cropper/index.js +7 -6
  99. package/dist/components/indicator/index.js +1 -1
  100. package/dist/components/kbd/index.js +3 -3
  101. package/dist/components/lightbox/index.js +9 -8
  102. package/dist/components/lightbox/index.js.map +1 -1
  103. package/dist/components/menu/index.js +2 -2
  104. package/dist/components/modal/index.js +6 -5
  105. package/dist/components/multi-select/index.js +3 -3
  106. package/dist/components/notification/index.js +3 -3
  107. package/dist/components/overlays/index.js +8 -7
  108. package/dist/components/overlays/index.js.map +1 -1
  109. package/dist/components/password-input/index.js +1 -1
  110. package/dist/components/phone-input/flag.d.ts +9 -0
  111. package/dist/components/phone-input/flag.d.ts.map +1 -0
  112. package/dist/components/phone-input/index.d.ts +4 -0
  113. package/dist/components/phone-input/index.d.ts.map +1 -0
  114. package/dist/components/phone-input/index.js +503 -0
  115. package/dist/components/phone-input/index.js.map +1 -0
  116. package/dist/components/phone-input/phone-input.d.ts +125 -0
  117. package/dist/components/phone-input/phone-input.d.ts.map +1 -0
  118. package/dist/components/phone-input/phone.d.ts +117 -0
  119. package/dist/components/phone-input/phone.d.ts.map +1 -0
  120. package/dist/components/photo-capture/index.js +11 -10
  121. package/dist/components/photo-capture/index.js.map +1 -1
  122. package/dist/components/pills-input/index.js +3 -3
  123. package/dist/components/schedule/index.js +7 -6
  124. package/dist/components/schedule/index.js.map +1 -1
  125. package/dist/components/segment-group/index.js +3 -3
  126. package/dist/components/spinner/index.js +1 -1
  127. package/dist/components/spinner/spinner.d.ts +1 -1
  128. package/dist/components/spinner/spinner.d.ts.map +1 -1
  129. package/dist/components/spotlight/index.js +8 -7
  130. package/dist/components/spotlight/index.js.map +1 -1
  131. package/dist/components/tabs/index.js +3 -3
  132. package/dist/components/tags-input/index.js +3 -3
  133. package/dist/components/theme-icon/index.js +1 -1
  134. package/dist/components/theme-icon/theme-icon.d.ts.map +1 -1
  135. package/dist/components/time-input/index.js +4 -4
  136. package/dist/components/timeline/index.d.ts +1 -1
  137. package/dist/components/timeline/index.d.ts.map +1 -1
  138. package/dist/components/timeline/index.js +40 -11
  139. package/dist/components/timeline/index.js.map +1 -1
  140. package/dist/components/timeline/timeline.d.ts +8 -3
  141. package/dist/components/timeline/timeline.d.ts.map +1 -1
  142. package/dist/components/tree-multi-select/index.js +3 -3
  143. package/dist/index.js +4 -4
  144. package/dist/lib/button-colors.d.ts +25 -0
  145. package/dist/lib/button-colors.d.ts.map +1 -0
  146. package/dist/lib/dev-warn.d.ts +1 -0
  147. package/dist/lib/dev-warn.d.ts.map +1 -1
  148. package/dist/lib/intl.d.ts +5 -0
  149. package/dist/lib/intl.d.ts.map +1 -1
  150. package/package.json +3 -1
  151. package/src/as-child.contract.test.tsx +2 -0
  152. package/src/colors.css +328 -0
  153. package/src/components/action-icon/action-icon.test.tsx +22 -0
  154. package/src/components/action-icon/action-icon.tsx +24 -28
  155. package/src/components/badge/badge.test.tsx +53 -10
  156. package/src/components/badge/badge.tsx +64 -11
  157. package/src/components/button/button.test.tsx +41 -5
  158. package/src/components/button/button.tsx +28 -33
  159. package/src/components/phone-input/flag.tsx +86 -0
  160. package/src/components/phone-input/index.ts +14 -0
  161. package/src/components/phone-input/phone-input.test.tsx +285 -0
  162. package/src/components/phone-input/phone-input.tsx +527 -0
  163. package/src/components/phone-input/phone.test.ts +187 -0
  164. package/src/components/phone-input/phone.ts +298 -0
  165. package/src/components/spinner/spinner.tsx +3 -3
  166. package/src/components/theme-icon/theme-icon.test.tsx +7 -0
  167. package/src/components/theme-icon/theme-icon.tsx +10 -6
  168. package/src/components/timeline/index.ts +1 -0
  169. package/src/components/timeline/timeline.test.tsx +105 -4
  170. package/src/components/timeline/timeline.tsx +46 -11
  171. package/src/lib/button-colors.ts +55 -0
  172. package/src/lib/dev-warn.ts +1 -1
  173. package/src/lib/intl-direction.test.tsx +23 -0
  174. package/src/lib/intl.tsx +8 -2
  175. package/dist/chunk-BMEJBY6H.js.map +0 -1
  176. package/dist/chunk-D2QIPQ74.js.map +0 -1
  177. package/dist/chunk-F374BNL4.js.map +0 -1
  178. package/dist/chunk-IUK7OJXZ.js.map +0 -1
  179. package/dist/chunk-SCXXJDKQ.js.map +0 -1
  180. package/dist/chunk-ZVECQBGG.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/file-upload/file-upload.tsx"],"names":["Ark"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmJA,IAAM,aAAA,GAAgB;AAAA,EACpB,MAAA,sBAAS,WAAA,EAAA,EAAY,SAAA,EAAW,GAAG,UAAA,EAAY,QAAQ,CAAA,EAAG,aAAA,EAAW,IAAA,EAAC;AACxE,CAAA;AA2DA,IAAM,iBAAA,GAAoB,CACxB,IAAA,EACA,EAAE,IAAA,EAAM,MAAM,WAAA,EAAa,WAAA,EAAa,QAAA,EAAS,KAEjD,KAAA,CAAM,IAAI,EACP,IAAA,CAAK,mBAAA,EAAqB,MAAM,CAAA,EAAG,IAAA,CAAK,IAAI,+BAA+B,CAAA,CAC3E,IAAA,CAAK,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AAA,MACE,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,MAClC,GAAG,SAAA;AAAA,MACJ,iBAAA,EAAiB,WAAW,UAAA,GAAa,MAAA;AAAA,MACzC,SAAA;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ","file":"index.js","sourcesContent":["\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { FileUpload as Ark } from \"@ark-ui/react/file-upload\"\nimport { UploadCloud } from \"lucide-react\"\nimport { type ComponentProps, type ReactNode, type Ref, useState } from \"react\"\nimport { match } from \"ts-pattern\"\nimport type { UnavailableProps } from \"../../lib/available-if\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { formatFileSize } from \"../../lib/files\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { useLocale } from \"../../lib/intl\"\nimport { props } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TYPOGRAPHY_SHADE_CLASSES } from \"../../lib/typography-size\"\nimport type { FileQueue } from \"../../lib/use-file-queue\"\nimport { Button } from \"../button/button\"\nimport { Field, type FieldProps, fieldA11yProps } from \"../field/field\"\nimport {\n FileItem,\n type FileItemIcons,\n type FileItemTranslations,\n isInFlight,\n} from \"../file-item/file-item\"\nimport {\n FileQueueSummary,\n type FileQueueSummaryTranslations,\n} from \"../file-queue-summary/file-queue-summary\"\n\n/**\n * FileUpload — a drag-and-drop file picker on Ark UI's FileUpload machine. It\n * renders a dashed dropzone with a browse button, then a list of accepted files,\n * each a `FileItem` row (an image thumbnail or a kind icon, name, human-readable\n * size, and a remove button). Drop, click-to-browse, keyboard, and the full ARIA\n * model come from Ark; the rows compose Ark's item parts through `asChild`, so\n * the remove button is still Ark's delete trigger.\n *\n * - Value is `File[]`; `onChange` hands you the accepted files directly,\n * matching the kit's value-based `FormControlProps` contract.\n * - `accept` (a MIME map / glob), `maxFiles`, and `maxFileSize` gate what the\n * machine accepts. Rejected files never reach `onChange`; `onReject` hands\n * them over with their error codes, to show in `error`.\n * - Label / description / error / required come from the built-in `Field`\n * wrapper, so a `FileUpload` is accessible and complete on its own.\n * - `name` wires the hidden native `<input type=\"file\">` into form submission.\n * - `queue` (a `useFileQueue()`) makes the list the queue's: picked files are added to it,\n * and each row shows its upload, cancels it from the ×, and retries a failure.\n *\n * Palette rides on `data-color` + the slot vars: the dropzone is palette-\n * independent at rest and only the drag-over accent (`--c-solid`) references the\n * active palette, so every color tints for free. `invalid` (or `error`) swaps\n * the border to red.\n */\n\ntype FileUploadClassNames = {\n field?: string\n root?: string\n dropzone?: string\n itemGroup?: string\n item?: string\n}\n\n/** The slice of `useFileQueue()`'s result FileUpload reads: any queue fits, whatever its\n * `upload` resolves with. */\nexport type FileUploadQueue = Pick<FileQueue, \"entries\" | \"busy\" | \"add\" | \"remove\" | \"itemProps\">\n\n/** Where the files live: in `value` (or Ark's own state), or in an upload queue. */\ntype FileUploadSource =\n | {\n /** Controlled accepted files. */\n value?: File[]\n queue?: undefined\n }\n | ({\n /** An upload queue (`useFileQueue`). The list is the queue's: a picked file is added to\n * it, and each row shows its status and progress, cancels while in flight, removes once\n * settled, and retries on error. */\n queue: FileUploadQueue\n } & UnavailableProps<\n { value?: File[] },\n \"the queue holds the files: read `queue.entries` instead of passing `value`\"\n >)\n\nexport type FileUploadProps = Pick<FieldProps, \"label\" | \"description\" | \"error\" | \"required\"> &\n WithTestId &\n FileUploadSource & {\n /** Fires with the accepted files whenever the selection changes. */\n onChange?: (files: File[]) => void\n /** Fires with the files `accept` / `maxFiles` / `maxFileSize` turned away, each with its\n * error codes (`\"FILE_INVALID_TYPE\"`, `\"FILE_TOO_LARGE\"`, `\"TOO_MANY_FILES\"`, …). */\n onReject?: (rejections: FileUploadRejection[]) => void\n /** Accepted types — a MIME map (`{ \"image/*\": [\".png\"] }`) or a glob string. */\n accept?: Record<string, string[]> | string | string[]\n /** Show a button as call to action */\n withButton?: boolean\n /** Max number of files. Defaults to `1` (single-file). */\n maxFiles?: number\n /** Max size per file, in bytes. */\n maxFileSize?: number\n /** Min size per file, in bytes — `1` turns away empty files. */\n minFileSize?: number\n /** Custom checks on top of `accept` / `maxFileSize`: return the error codes that turn the\n * file away (your own codes are fine, e.g. `\"NOT_A_PDF\"`), or `null` to accept it. */\n validate?: FileUploadValidate\n /** Stops a drop that misses the dropzone from opening the file in the tab. @default true */\n preventDocumentDrop?: boolean\n /** Opens a phone's camera, front (`\"user\"`) or back (`\"environment\"`), instead of the\n * library. Desktop browsers ignore it. */\n capture?: \"user\" | \"environment\"\n /** Accept directories (webkit only). */\n directory?: boolean\n /** Red invalid state, independent of (and OR'd with) `error`. */\n invalid?: boolean\n /** Dims and blocks interaction. */\n disabled?: boolean\n size?: Size\n /** Palette of the drag-over accent and the browse button. Inherits the surrounding\n * `data-color` when omitted; the dropzone itself is palette-independent at rest. */\n color?: Color\n /** Wires the hidden `<input type=\"file\">` into native form submission. */\n name?: string\n /** Explicit id for label association. */\n id?: string\n /** Lands on the hidden `<input>` for focus-on-error. */\n ref?: Ref<HTMLInputElement>\n /** Helper line inside the dropzone, beside the browse button. Defaults to\n * `translations.hint`, or `translations.buttonHint` with `withButton`. */\n hint?: ReactNode\n /** Show image files as thumbnails in the list. Off, every row shows its kind icon and no\n * object URL is made: for a picker that takes hundreds of photos at once. Thumbnails are\n * lazy either way, so rows scrolled out of view aren't decoded. @default true */\n thumbnails?: boolean\n /** Replaces the default icons: `upload` in the dropzone, plus `FileItem`'s (one per\n * `FileKind`, and `remove`) in the list. */\n icons?: FileUploadIcons\n className?: string\n classNames?: FileUploadClassNames\n /** Overrides the browse button's text and the accessible names — see\n * `FileUploadTranslations`. A partial override keeps the other defaults. */\n translations?: FileUploadTranslations\n }\n\n/** The dropzone's `upload` icon, plus every `FileItem` icon for the list. */\nexport type FileUploadIcons = FileItemIcons & IconMap<\"upload\">\n\nconst DEFAULT_ICONS = {\n upload: <UploadCloud className={cn(iconStroke, \"size-8\")} aria-hidden />,\n}\n\n/** Ark's own FileUpload `translations` type, derived structurally rather than imported from\n * `@zag-js/file-upload`: `deleteFile(file)` names each file's remove button (default\n * `` `Remove ${file.name}` ``), `dropzone` and `itemPreview(file)` keep Ark's English\n * defaults. Plus the kit's own keys:\n *\n * - `browseFiles`: the `withButton` trigger's text (default `\"Browse files\"`).\n * - `hint` / `buttonHint`: the dropzone's helper line without / with the browse button\n * (defaults `\"Drop files here or click to browse\"` / `\"Drag & drop files here, or\"`). The\n * `hint` prop still overrides either.\n * - `rejected(code, details)`: the line shown for a rejected file, per error code. Return\n * `undefined` to keep the English default for that code (so an override can handle only\n * its own `validate` codes), or `null` to show nothing for it.\n * - `moreRejected(count)`: the closing line once more files were rejected than are listed.\n *\n * And the upload strings, once a `queue` drives the list: the rows' own, `FileItem`'s keys\n * (`cancel`, `retry`, `queued`, `processing`, `done`, `failed`), and `summary(event)`, what\n * `FileQueueSummary` says about the upload as a whole. `deleteFile` names the × as\n * `FileItem`'s `remove` would. The rows don't announce, so `announcement` isn't one. */\nexport type FileUploadTranslations = NonNullable<ComponentProps<typeof Ark.Root>[\"translations\"]> &\n Omit<FileItemTranslations, \"remove\" | \"announcement\"> &\n FileQueueSummaryTranslations & {\n browseFiles?: ReactNode\n hint?: ReactNode\n buttonHint?: ReactNode\n rejected?: (code: FileUploadRejectionCode, details: FileUploadRejectionDetails) => ReactNode\n moreRejected?: (count: number) => ReactNode\n }\n\n/** One file the machine turned away, and why: Ark's own rejection shape, derived structurally\n * rather than imported from `@zag-js/file-upload`. */\nexport type FileUploadRejection = Parameters<\n NonNullable<ComponentProps<typeof Ark.Root>[\"onFileReject\"]>\n>[0][\"files\"][number]\n\n/** zag's codes — `FILE_INVALID_TYPE`, `FILE_TOO_LARGE`, `FILE_TOO_SMALL`, `FILE_INVALID`,\n * `FILE_EXISTS`, `TOO_MANY_FILES` — or any code your `validate` returns. */\nexport type FileUploadRejectionCode = FileUploadRejection[\"errors\"][number]\n\n/** What a `rejected` message can say. Sizes come formatted for the active locale, the same\n * way the item rows show them. */\nexport type FileUploadRejectionDetails = {\n /** The rejected file (for `TOO_MANY_FILES`, the first one turned away). */\n file: File\n /** The file's size, e.g. `\"12.4 MB\"`. */\n size: string\n /** The `maxFileSize` limit, formatted. Absent when there is none. */\n maxFileSize?: string\n /** The `minFileSize` limit, formatted. Absent when there is none. */\n minFileSize?: string\n maxFiles: number\n /** How many files this line covers: 1 per file, or every file `TOO_MANY_FILES` turned away. */\n count: number\n}\n\n/** Ark's own `validate` signature, derived structurally like the types above. */\nexport type FileUploadValidate = NonNullable<ComponentProps<typeof Ark.Root>[\"validate\"]>\n\nconst rejectedInEnglish = (\n code: FileUploadRejectionCode,\n { file, size, maxFileSize, minFileSize, maxFiles }: FileUploadRejectionDetails,\n): string =>\n match(code)\n .with(\"FILE_INVALID_TYPE\", () => `${file.name} isn't an accepted file type.`)\n .with(\"FILE_TOO_LARGE\", () => `${file.name} is too large (${size}, max ${maxFileSize}).`)\n .with(\"FILE_TOO_SMALL\", () => `${file.name} is too small (${size}, min ${minFileSize}).`)\n .with(\"FILE_EXISTS\", () => `${file.name} has already been added.`)\n .with(\"TOO_MANY_FILES\", () =>\n maxFiles === 1 ? \"Only one file can be added.\" : `Only ${maxFiles} files can be added.`,\n )\n .otherwise(() => `${file.name} can't be used.`)\n\nconst FILE_UPLOAD_DEFAULT_TRANSLATIONS = {\n deleteFile: (file: File) => `Remove ${file.name}`,\n browseFiles: \"Browse files\",\n hint: \"Drop files here or click to browse\",\n buttonHint: \"Drag & drop files here, or\",\n rejected: rejectedInEnglish,\n moreRejected: (count: number) =>\n count === 1 ? \"1 more file was rejected.\" : `${count} more files were rejected.`,\n} as const satisfies FileUploadTranslations\n\n/** Per-file lines listed before `moreRejected` sums up the rest. Three keeps the message a\n * glance — a whole folder dropped on the wrong field stays a short error, not a wall. */\nconst LISTED_REJECTIONS = 3\n\n/**\n * The built-in error for the current rejections, or `null` when there's nothing to say.\n *\n * Each file reads by its first reason: zag lists the type check first, and once a file is the\n * wrong type its size is beside the point. `TOO_MANY_FILES` is about the batch rather than any one\n * file — zag stamps it on every file of a pick that overflows `maxFiles` — so it is said once, up\n * front, instead of once per file. The rest list one line per file, up to `LISTED_REJECTIONS`.\n */\nconst rejectionMessage = (\n rejections: FileUploadRejection[],\n rejected: (code: FileUploadRejectionCode, details: FileUploadRejectionDetails) => ReactNode,\n moreRejected: (count: number) => ReactNode,\n limits: { maxFileSize?: number; minFileSize?: number; maxFiles: number },\n locale: string,\n): ReactNode => {\n const details = (file: File, count: number): FileUploadRejectionDetails => ({\n file,\n size: formatFileSize(file.size, locale),\n maxFileSize:\n limits.maxFileSize === undefined ? undefined : formatFileSize(limits.maxFileSize, locale),\n minFileSize:\n limits.minFileSize === undefined ? undefined : formatFileSize(limits.minFileSize, locale),\n maxFiles: limits.maxFiles,\n count,\n })\n const overflow = rejections.filter(({ errors }) => errors[0] === \"TOO_MANY_FILES\")\n const perFile = rejections.filter(({ errors }) => errors[0] !== \"TOO_MANY_FILES\")\n const lines = [\n ...overflow\n .slice(0, 1)\n .map(({ file }) => rejected(\"TOO_MANY_FILES\", details(file, overflow.length))),\n ...perFile\n .slice(0, LISTED_REJECTIONS)\n .map(({ file, errors }) => rejected(errors[0] ?? \"FILE_INVALID\", details(file, 1))),\n ...(perFile.length > LISTED_REJECTIONS\n ? [moreRejected(perFile.length - LISTED_REJECTIONS)]\n : []),\n ].filter((line) => line != null && line !== false && line !== \"\")\n if (lines.length === 0) return null\n if (lines.length === 1) return lines[0]\n // The trailing space is invisible at the end of a block line, but keeps the lines apart in the\n // error's text: screen readers announce \"…(1.23 MB, max 1 MB). notes.txt…\", not \"MB).notes\".\n return lines.map((line, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: rebuilt whole per pick, never reordered\n <span key={index} className=\"block\">\n {line}{\" \"}\n </span>\n ))\n}\n\n/** Mirrors a change of Ark's accepted files onto the queue: a picked file is added, and a file\n * Ark let go of (a single-file pick replacing the last one) is removed, aborting its upload. */\nconst syncQueue = (queue: FileUploadQueue, accepted: File[]) => {\n const kept = new Set(accepted)\n const known = new Set(queue.entries.map((entry) => entry.file))\n queue.entries\n .filter((entry) => !kept.has(entry.file))\n .forEach((entry) => {\n queue.remove(entry.id)\n })\n const added = accepted.filter((file) => !known.has(file))\n if (added.length > 0) queue.add(added)\n}\n\nexport const FileUpload = ({\n value,\n queue,\n onChange,\n onReject,\n accept,\n maxFiles = 1,\n maxFileSize,\n minFileSize,\n validate,\n preventDocumentDrop = true,\n capture,\n directory,\n invalid,\n disabled,\n required,\n size = \"md\",\n color,\n name,\n id,\n ref,\n label,\n description,\n error,\n withButton = false,\n hint,\n className,\n classNames,\n testId,\n translations,\n thumbnails = true,\n icons,\n}: FileUploadProps) => {\n const locale = useLocale()\n const {\n browseFiles,\n hint: dropHint,\n buttonHint,\n rejected,\n moreRejected,\n deleteFile,\n ...arkTranslations\n } = {\n ...FILE_UPLOAD_DEFAULT_TRANSLATIONS,\n ...translations,\n }\n // zag reports the rejections of every pick, and an empty list once a pick goes through, so\n // mirroring them here is what clears the built-in message — the same signal `onReject` gets.\n const [rejections, setRejections] = useState<FileUploadRejection[]>([])\n // An app's `error` always wins: it may already be saying something better about these files.\n const shownError =\n error ??\n rejectionMessage(\n rejections,\n // `undefined` from an override means \"keep the default for this code\".\n (code, details) => {\n const own = rejected(code, details)\n return own === undefined ? rejectedInEnglish(code, details) : own\n },\n moreRejected,\n { maxFileSize, minFileSize, maxFiles },\n locale,\n )\n // Red state is driven independently of the `Field` error slot so a form\n // library can flip it from `fieldState.invalid` (see FormControlProps).\n const isInvalid = invalid || shownError != null\n\n return (\n <Ark.Root\n acceptedFiles={queue ? queue.entries.map((entry) => entry.file) : value}\n accept={accept}\n maxFiles={maxFiles}\n maxFileSize={maxFileSize}\n minFileSize={minFileSize}\n validate={validate}\n preventDocumentDrop={preventDocumentDrop}\n // Ark already reads the `IntlProvider` locale from its `LocaleProvider`; passing the\n // resolved tag keeps the machine's own sizes on the exact value this component formats with.\n locale={locale}\n capture={capture}\n directory={directory}\n disabled={disabled}\n required={required}\n invalid={isInvalid}\n name={name}\n id={id}\n translations={{ ...arkTranslations, deleteFile }}\n data-color={color}\n onFileChange={\n queue || onChange\n ? (d) => {\n if (queue) syncQueue(queue, d.acceptedFiles)\n onChange?.(d.acceptedFiles)\n }\n : undefined\n }\n onFileReject={(d) => {\n setRejections(d.files)\n onReject?.(d.files)\n }}\n // `relative` contains the absolutely positioned hidden input, which would\n // otherwise escape any scroller this control sits in.\n className={cn(\"relative flex flex-col gap-3 grow\", className, classNames?.root)}\n >\n {/* Always a `Field`, never `FieldShell`'s bare fallback: a rejection can add an error to a\n FileUpload with no label, and switching from bare to wrapped would remount the dropzone\n — dropping the focus it holds once the file dialog closes. */}\n <Field\n label={label}\n description={description}\n error={shownError}\n required={required}\n disabled={disabled}\n size={size}\n className={classNames?.field}\n >\n <FileUploadDropzone\n labelled={label != null}\n testId={testId}\n className={cn(\n \"flex flex-col items-center justify-center gap-2 rounded-input border border-dashed p-6 text-center\",\n // The kit's hairline, dashed — translucent so the dropzone reads the\n // same inside a Card, a Drawer or a tinted panel as it does on the\n // page, where an opaque gray step was only ever right against one of\n // them. Same pair as `Input`'s shell / `Card` / `SegmentGroup`.\n \"border-brand-900/20 dark:border-white/15\",\n \"cursor-pointer transition-colors\",\n \"data-dragging:border-(--c-solid) data-dragging:bg-(--c-solid)/5 data-dragging:border-solid\",\n // Muted text as a translucent neutral wash (black in light, white in dark), the\n // same pairing as the hairline above, so it keeps its contrast on any surface.\n cn(\n \"data-invalid:border-red-500 data-invalid:text-red-900 dark:data-invalid:text-red-500\",\n TYPOGRAPHY_SHADE_CLASSES.muted,\n ),\n \"data-disabled:cursor-not-allowed data-disabled:opacity-60\",\n \"group\",\n classNames?.dropzone,\n )}\n >\n {mergeIcons<\"upload\">(DEFAULT_ICONS, icons).upload}\n <p className=\"text-sm font-medium\">{hint ?? (withButton ? buttonHint : dropHint)}</p>\n {withButton && (\n <Ark.Trigger asChild>\n <Button\n variant=\"outline\"\n color={isInvalid ? \"red\" : undefined}\n size={size}\n type=\"button\"\n disabled={disabled}\n >\n {browseFiles}\n </Button>\n </Ark.Trigger>\n )}\n <Ark.HiddenInput ref={ref} />\n </FileUploadDropzone>\n </Field>\n\n <Ark.ItemGroup className={cn(\"flex flex-col gap-2\", classNames?.itemGroup)}>\n <Ark.Context>\n {(api) =>\n // With a queue the rows are its entries, keyed by their ids, each with its upload\n // state; without one, Ark's accepted files.\n (queue\n ? queue.entries.map((entry) => ({\n key: entry.id,\n file: entry.file,\n item: queue.itemProps(entry.id),\n }))\n : api.acceptedFiles.map((file) => ({\n key: `${file.name}-${file.lastModified}`,\n file,\n item: undefined,\n }))\n ).map(({ key, file, item }) => (\n // Each row is a `FileItem` on Ark's item: Ark's parts lend their attributes and\n // behaviour through `asChild` (the delete trigger keeps its click and its\n // `deleteFile` name), and the row stays an `<li>` of Ark's `<ul>`.\n <Ark.Item key={key} file={file} asChild>\n <FileItem.Root\n file={file}\n status={item?.status}\n progress={item?.progress}\n error={item?.error}\n announce={item?.announce}\n thumbnails={thumbnails}\n icons={icons}\n // Only the keys you set, so FileItem keeps its defaults for the rest.\n translations={{ ...translations, remove: () => deleteFile(file) }}\n asChild\n className={classNames?.item}\n >\n <li>\n <FileItem.Preview />\n <FileItem.Body>\n <Ark.ItemName asChild>\n <FileItem.Name />\n </Ark.ItemName>\n <Ark.ItemSizeText asChild>\n <FileItem.Meta />\n </Ark.ItemSizeText>\n <FileItem.Progress />\n </FileItem.Body>\n {item ? (\n <>\n {item.status === \"error\" && item.onRetry && (\n <FileItem.Retry onClick={item.onRetry} />\n )}\n {/* The queue's own actions, not Ark's delete: Ark's trigger would name\n the × \"Remove\" even while it cancels an upload. */}\n <FileItem.Remove\n onClick={isInFlight(item.status) ? item.onCancel : item.onRemove}\n />\n </>\n ) : (\n <Ark.ItemDeleteTrigger asChild>\n <FileItem.Remove />\n </Ark.ItemDeleteTrigger>\n )}\n </li>\n </FileItem.Root>\n </Ark.Item>\n ))\n }\n </Ark.Context>\n </Ark.ItemGroup>\n {/* The upload's one voice, mounted with the queue so it exists, empty, before the first\n file is dropped. Inside the root, which is `relative`, for its sr-only box. */}\n {queue && <FileQueueSummary queue={queue} translations={translations} />}\n </Ark.Root>\n )\n}\n\n/**\n * `Ark.Dropzone` plus the `Field` wiring Ark leaves out: the dropzone is the one part a keyboard\n * or screen-reader user ever reaches (the native input is `aria-hidden`), yet Ark only describes\n * the hidden input. A component of its own because `useFieldContext()` resolves only below the\n * `Field` — the `XxxControl` pattern `fieldA11yProps` documents. The label id is used only when a\n * label renders; otherwise the dropzone keeps Ark's `aria-label`.\n */\nfunction FileUploadDropzone({\n labelled,\n testId,\n className,\n children,\n}: { labelled: boolean; className: string; children: ReactNode } & WithTestId) {\n const { \"aria-labelledby\": labelledBy, ...described } = fieldA11yProps(useFieldContext())\n return (\n <Ark.Dropzone\n {...props({ \"data-testid\": testId })}\n {...described}\n aria-labelledby={labelled ? labelledBy : undefined}\n className={className}\n >\n {children}\n </Ark.Dropzone>\n )\n}\n"]}
1
+ {"version":3,"sources":["../../../src/components/file-upload/file-upload.tsx"],"names":["Ark"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmJA,IAAM,aAAA,GAAgB;AAAA,EACpB,MAAA,sBAAS,WAAA,EAAA,EAAY,SAAA,EAAW,GAAG,UAAA,EAAY,QAAQ,CAAA,EAAG,aAAA,EAAW,IAAA,EAAC;AACxE,CAAA;AA2DA,IAAM,iBAAA,GAAoB,CACxB,IAAA,EACA,EAAE,IAAA,EAAM,MAAM,WAAA,EAAa,WAAA,EAAa,QAAA,EAAS,KAEjD,KAAA,CAAM,IAAI,EACP,IAAA,CAAK,mBAAA,EAAqB,MAAM,CAAA,EAAG,IAAA,CAAK,IAAI,+BAA+B,CAAA,CAC3E,IAAA,CAAK,gBAAA,EAAkB,MAAM,CAAA,EAAG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E,aAAA,EAAe,QAAQ,CAAA;AAAA,MAClC,GAAG,SAAA;AAAA,MACJ,iBAAA,EAAiB,WAAW,UAAA,GAAa,MAAA;AAAA,MACzC,SAAA;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ","file":"index.js","sourcesContent":["\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { FileUpload as Ark } from \"@ark-ui/react/file-upload\"\nimport { UploadCloud } from \"lucide-react\"\nimport { type ComponentProps, type ReactNode, type Ref, useState } from \"react\"\nimport { match } from \"ts-pattern\"\nimport type { UnavailableProps } from \"../../lib/available-if\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { formatFileSize } from \"../../lib/files\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { useLocale } from \"../../lib/intl\"\nimport { props } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TYPOGRAPHY_SHADE_CLASSES } from \"../../lib/typography-size\"\nimport type { FileQueue } from \"../../lib/use-file-queue\"\nimport { Button } from \"../button/button\"\nimport { Field, type FieldProps, fieldA11yProps } from \"../field/field\"\nimport {\n FileItem,\n type FileItemIcons,\n type FileItemTranslations,\n isInFlight,\n} from \"../file-item/file-item\"\nimport {\n FileQueueSummary,\n type FileQueueSummaryTranslations,\n} from \"../file-queue-summary/file-queue-summary\"\n\n/**\n * FileUpload — a drag-and-drop file picker on Ark UI's FileUpload machine. It\n * renders a dashed dropzone with a browse button, then a list of accepted files,\n * each a `FileItem` row (an image thumbnail or a kind icon, name, human-readable\n * size, and a remove button). Drop, click-to-browse, keyboard, and the full ARIA\n * model come from Ark; the rows compose Ark's item parts through `asChild`, so\n * the remove button is still Ark's delete trigger.\n *\n * - Value is `File[]`; `onChange` hands you the accepted files directly,\n * matching the kit's value-based `FormControlProps` contract.\n * - `accept` (a MIME map / glob), `maxFiles`, and `maxFileSize` gate what the\n * machine accepts. Rejected files never reach `onChange`; `onReject` hands\n * them over with their error codes, to show in `error`.\n * - Label / description / error / required come from the built-in `Field`\n * wrapper, so a `FileUpload` is accessible and complete on its own.\n * - `name` wires the hidden native `<input type=\"file\">` into form submission.\n * - `queue` (a `useFileQueue()`) makes the list the queue's: picked files are added to it,\n * and each row shows its upload, cancels it from the ×, and retries a failure.\n *\n * Palette rides on `data-color` + the slot vars: the dropzone is palette-\n * independent at rest and only the drag-over accent (`--c-solid`) references the\n * active palette, so every color tints for free. `invalid` (or `error`) swaps\n * the border to red.\n */\n\ntype FileUploadClassNames = {\n field?: string\n root?: string\n dropzone?: string\n itemGroup?: string\n item?: string\n}\n\n/** The slice of `useFileQueue()`'s result FileUpload reads: any queue fits, whatever its\n * `upload` resolves with. */\nexport type FileUploadQueue = Pick<FileQueue, \"entries\" | \"busy\" | \"add\" | \"remove\" | \"itemProps\">\n\n/** Where the files live: in `value` (or Ark's own state), or in an upload queue. */\ntype FileUploadSource =\n | {\n /** Controlled accepted files. */\n value?: File[]\n queue?: undefined\n }\n | ({\n /** An upload queue (`useFileQueue`). The list is the queue's: a picked file is added to\n * it, and each row shows its status and progress, cancels while in flight, removes once\n * settled, and retries on error. */\n queue: FileUploadQueue\n } & UnavailableProps<\n { value?: File[] },\n \"the queue holds the files: read `queue.entries` instead of passing `value`\"\n >)\n\nexport type FileUploadProps = Pick<FieldProps, \"label\" | \"description\" | \"error\" | \"required\"> &\n WithTestId &\n FileUploadSource & {\n /** Fires with the accepted files whenever the selection changes. */\n onChange?: (files: File[]) => void\n /** Fires with the files `accept` / `maxFiles` / `maxFileSize` turned away, each with its\n * error codes (`\"FILE_INVALID_TYPE\"`, `\"FILE_TOO_LARGE\"`, `\"TOO_MANY_FILES\"`, …). */\n onReject?: (rejections: FileUploadRejection[]) => void\n /** Accepted types — a MIME map (`{ \"image/*\": [\".png\"] }`) or a glob string. */\n accept?: Record<string, string[]> | string | string[]\n /** Show a button as call to action */\n withButton?: boolean\n /** Max number of files. Defaults to `1` (single-file). */\n maxFiles?: number\n /** Max size per file, in bytes. */\n maxFileSize?: number\n /** Min size per file, in bytes — `1` turns away empty files. */\n minFileSize?: number\n /** Custom checks on top of `accept` / `maxFileSize`: return the error codes that turn the\n * file away (your own codes are fine, e.g. `\"NOT_A_PDF\"`), or `null` to accept it. */\n validate?: FileUploadValidate\n /** Stops a drop that misses the dropzone from opening the file in the tab. @default true */\n preventDocumentDrop?: boolean\n /** Opens a phone's camera, front (`\"user\"`) or back (`\"environment\"`), instead of the\n * library. Desktop browsers ignore it. */\n capture?: \"user\" | \"environment\"\n /** Accept directories (webkit only). */\n directory?: boolean\n /** Red invalid state, independent of (and OR'd with) `error`. */\n invalid?: boolean\n /** Dims and blocks interaction. */\n disabled?: boolean\n size?: Size\n /** Palette of the drag-over accent and the browse button. Inherits the surrounding\n * `data-color` when omitted; the dropzone itself is palette-independent at rest. */\n color?: Color\n /** Wires the hidden `<input type=\"file\">` into native form submission. */\n name?: string\n /** Explicit id for label association. */\n id?: string\n /** Lands on the hidden `<input>` for focus-on-error. */\n ref?: Ref<HTMLInputElement>\n /** Helper line inside the dropzone, beside the browse button. Defaults to\n * `translations.hint`, or `translations.buttonHint` with `withButton`. */\n hint?: ReactNode\n /** Show image files as thumbnails in the list. Off, every row shows its kind icon and no\n * object URL is made: for a picker that takes hundreds of photos at once. Thumbnails are\n * lazy either way, so rows scrolled out of view aren't decoded. @default true */\n thumbnails?: boolean\n /** Replaces the default icons: `upload` in the dropzone, plus `FileItem`'s (one per\n * `FileKind`, and `remove`) in the list. */\n icons?: FileUploadIcons\n className?: string\n classNames?: FileUploadClassNames\n /** Overrides the browse button's text and the accessible names — see\n * `FileUploadTranslations`. A partial override keeps the other defaults. */\n translations?: FileUploadTranslations\n }\n\n/** The dropzone's `upload` icon, plus every `FileItem` icon for the list. */\nexport type FileUploadIcons = FileItemIcons & IconMap<\"upload\">\n\nconst DEFAULT_ICONS = {\n upload: <UploadCloud className={cn(iconStroke, \"size-8\")} aria-hidden />,\n}\n\n/** Ark's own FileUpload `translations` type, derived structurally rather than imported from\n * `@zag-js/file-upload`: `deleteFile(file)` names each file's remove button (default\n * `` `Remove ${file.name}` ``), `dropzone` and `itemPreview(file)` keep Ark's English\n * defaults. Plus the kit's own keys:\n *\n * - `browseFiles`: the `withButton` trigger's text (default `\"Browse files\"`).\n * - `hint` / `buttonHint`: the dropzone's helper line without / with the browse button\n * (defaults `\"Drop files here or click to browse\"` / `\"Drag & drop files here, or\"`). The\n * `hint` prop still overrides either.\n * - `rejected(code, details)`: the line shown for a rejected file, per error code. Return\n * `undefined` to keep the English default for that code (so an override can handle only\n * its own `validate` codes), or `null` to show nothing for it.\n * - `moreRejected(count)`: the closing line once more files were rejected than are listed.\n *\n * And the upload strings, once a `queue` drives the list: the rows' own, `FileItem`'s keys\n * (`cancel`, `retry`, `queued`, `processing`, `done`, `failed`), and `summary(event)`, what\n * `FileQueueSummary` says about the upload as a whole. `deleteFile` names the × as\n * `FileItem`'s `remove` would. The rows don't announce, so `announcement` isn't one. */\nexport type FileUploadTranslations = NonNullable<ComponentProps<typeof Ark.Root>[\"translations\"]> &\n Omit<FileItemTranslations, \"remove\" | \"announcement\"> &\n FileQueueSummaryTranslations & {\n browseFiles?: ReactNode\n hint?: ReactNode\n buttonHint?: ReactNode\n rejected?: (code: FileUploadRejectionCode, details: FileUploadRejectionDetails) => ReactNode\n moreRejected?: (count: number) => ReactNode\n }\n\n/** One file the machine turned away, and why: Ark's own rejection shape, derived structurally\n * rather than imported from `@zag-js/file-upload`. */\nexport type FileUploadRejection = Parameters<\n NonNullable<ComponentProps<typeof Ark.Root>[\"onFileReject\"]>\n>[0][\"files\"][number]\n\n/** zag's codes — `FILE_INVALID_TYPE`, `FILE_TOO_LARGE`, `FILE_TOO_SMALL`, `FILE_INVALID`,\n * `FILE_EXISTS`, `TOO_MANY_FILES` — or any code your `validate` returns. */\nexport type FileUploadRejectionCode = FileUploadRejection[\"errors\"][number]\n\n/** What a `rejected` message can say. Sizes come formatted for the active locale, the same\n * way the item rows show them. */\nexport type FileUploadRejectionDetails = {\n /** The rejected file (for `TOO_MANY_FILES`, the first one turned away). */\n file: File\n /** The file's size, e.g. `\"12.4 MB\"`. */\n size: string\n /** The `maxFileSize` limit, formatted. Absent when there is none. */\n maxFileSize?: string\n /** The `minFileSize` limit, formatted. Absent when there is none. */\n minFileSize?: string\n maxFiles: number\n /** How many files this line covers: 1 per file, or every file `TOO_MANY_FILES` turned away. */\n count: number\n}\n\n/** Ark's own `validate` signature, derived structurally like the types above. */\nexport type FileUploadValidate = NonNullable<ComponentProps<typeof Ark.Root>[\"validate\"]>\n\nconst rejectedInEnglish = (\n code: FileUploadRejectionCode,\n { file, size, maxFileSize, minFileSize, maxFiles }: FileUploadRejectionDetails,\n): string =>\n match(code)\n .with(\"FILE_INVALID_TYPE\", () => `${file.name} isn't an accepted file type.`)\n .with(\"FILE_TOO_LARGE\", () => `${file.name} is too large (${size}, max ${maxFileSize}).`)\n .with(\"FILE_TOO_SMALL\", () => `${file.name} is too small (${size}, min ${minFileSize}).`)\n .with(\"FILE_EXISTS\", () => `${file.name} has already been added.`)\n .with(\"TOO_MANY_FILES\", () =>\n maxFiles === 1 ? \"Only one file can be added.\" : `Only ${maxFiles} files can be added.`,\n )\n .otherwise(() => `${file.name} can't be used.`)\n\nconst FILE_UPLOAD_DEFAULT_TRANSLATIONS = {\n deleteFile: (file: File) => `Remove ${file.name}`,\n browseFiles: \"Browse files\",\n hint: \"Drop files here or click to browse\",\n buttonHint: \"Drag & drop files here, or\",\n rejected: rejectedInEnglish,\n moreRejected: (count: number) =>\n count === 1 ? \"1 more file was rejected.\" : `${count} more files were rejected.`,\n} as const satisfies FileUploadTranslations\n\n/** Per-file lines listed before `moreRejected` sums up the rest. Three keeps the message a\n * glance — a whole folder dropped on the wrong field stays a short error, not a wall. */\nconst LISTED_REJECTIONS = 3\n\n/**\n * The built-in error for the current rejections, or `null` when there's nothing to say.\n *\n * Each file reads by its first reason: zag lists the type check first, and once a file is the\n * wrong type its size is beside the point. `TOO_MANY_FILES` is about the batch rather than any one\n * file — zag stamps it on every file of a pick that overflows `maxFiles` — so it is said once, up\n * front, instead of once per file. The rest list one line per file, up to `LISTED_REJECTIONS`.\n */\nconst rejectionMessage = (\n rejections: FileUploadRejection[],\n rejected: (code: FileUploadRejectionCode, details: FileUploadRejectionDetails) => ReactNode,\n moreRejected: (count: number) => ReactNode,\n limits: { maxFileSize?: number; minFileSize?: number; maxFiles: number },\n locale: string,\n): ReactNode => {\n const details = (file: File, count: number): FileUploadRejectionDetails => ({\n file,\n size: formatFileSize(file.size, locale),\n maxFileSize:\n limits.maxFileSize === undefined ? undefined : formatFileSize(limits.maxFileSize, locale),\n minFileSize:\n limits.minFileSize === undefined ? undefined : formatFileSize(limits.minFileSize, locale),\n maxFiles: limits.maxFiles,\n count,\n })\n const overflow = rejections.filter(({ errors }) => errors[0] === \"TOO_MANY_FILES\")\n const perFile = rejections.filter(({ errors }) => errors[0] !== \"TOO_MANY_FILES\")\n const lines = [\n ...overflow\n .slice(0, 1)\n .map(({ file }) => rejected(\"TOO_MANY_FILES\", details(file, overflow.length))),\n ...perFile\n .slice(0, LISTED_REJECTIONS)\n .map(({ file, errors }) => rejected(errors[0] ?? \"FILE_INVALID\", details(file, 1))),\n ...(perFile.length > LISTED_REJECTIONS\n ? [moreRejected(perFile.length - LISTED_REJECTIONS)]\n : []),\n ].filter((line) => line != null && line !== false && line !== \"\")\n if (lines.length === 0) return null\n if (lines.length === 1) return lines[0]\n // The trailing space is invisible at the end of a block line, but keeps the lines apart in the\n // error's text: screen readers announce \"…(1.23 MB, max 1 MB). notes.txt…\", not \"MB).notes\".\n return lines.map((line, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: rebuilt whole per pick, never reordered\n <span key={index} className=\"block\">\n {line}{\" \"}\n </span>\n ))\n}\n\n/** Mirrors a change of Ark's accepted files onto the queue: a picked file is added, and a file\n * Ark let go of (a single-file pick replacing the last one) is removed, aborting its upload. */\nconst syncQueue = (queue: FileUploadQueue, accepted: File[]) => {\n const kept = new Set(accepted)\n const known = new Set(queue.entries.map((entry) => entry.file))\n queue.entries\n .filter((entry) => !kept.has(entry.file))\n .forEach((entry) => {\n queue.remove(entry.id)\n })\n const added = accepted.filter((file) => !known.has(file))\n if (added.length > 0) queue.add(added)\n}\n\nexport const FileUpload = ({\n value,\n queue,\n onChange,\n onReject,\n accept,\n maxFiles = 1,\n maxFileSize,\n minFileSize,\n validate,\n preventDocumentDrop = true,\n capture,\n directory,\n invalid,\n disabled,\n required,\n size = \"md\",\n color,\n name,\n id,\n ref,\n label,\n description,\n error,\n withButton = false,\n hint,\n className,\n classNames,\n testId,\n translations,\n thumbnails = true,\n icons,\n}: FileUploadProps) => {\n const locale = useLocale()\n const {\n browseFiles,\n hint: dropHint,\n buttonHint,\n rejected,\n moreRejected,\n deleteFile,\n ...arkTranslations\n } = {\n ...FILE_UPLOAD_DEFAULT_TRANSLATIONS,\n ...translations,\n }\n // zag reports the rejections of every pick, and an empty list once a pick goes through, so\n // mirroring them here is what clears the built-in message — the same signal `onReject` gets.\n const [rejections, setRejections] = useState<FileUploadRejection[]>([])\n // An app's `error` always wins: it may already be saying something better about these files.\n const shownError =\n error ??\n rejectionMessage(\n rejections,\n // `undefined` from an override means \"keep the default for this code\".\n (code, details) => {\n const own = rejected(code, details)\n return own === undefined ? rejectedInEnglish(code, details) : own\n },\n moreRejected,\n { maxFileSize, minFileSize, maxFiles },\n locale,\n )\n // Red state is driven independently of the `Field` error slot so a form\n // library can flip it from `fieldState.invalid` (see FormControlProps).\n const isInvalid = invalid || shownError != null\n\n return (\n <Ark.Root\n acceptedFiles={queue ? queue.entries.map((entry) => entry.file) : value}\n accept={accept}\n maxFiles={maxFiles}\n maxFileSize={maxFileSize}\n minFileSize={minFileSize}\n validate={validate}\n preventDocumentDrop={preventDocumentDrop}\n // Ark already reads the `IntlProvider` locale from its `LocaleProvider`; passing the\n // resolved tag keeps the machine's own sizes on the exact value this component formats with.\n locale={locale}\n capture={capture}\n directory={directory}\n disabled={disabled}\n required={required}\n invalid={isInvalid}\n name={name}\n id={id}\n translations={{ ...arkTranslations, deleteFile }}\n data-color={color}\n onFileChange={\n queue || onChange\n ? (d) => {\n if (queue) syncQueue(queue, d.acceptedFiles)\n onChange?.(d.acceptedFiles)\n }\n : undefined\n }\n onFileReject={(d) => {\n setRejections(d.files)\n onReject?.(d.files)\n }}\n // `relative` contains the absolutely positioned hidden input, which would\n // otherwise escape any scroller this control sits in.\n className={cn(\"relative flex flex-col gap-3 grow\", className, classNames?.root)}\n >\n {/* Always a `Field`, never `FieldShell`'s bare fallback: a rejection can add an error to a\n FileUpload with no label, and switching from bare to wrapped would remount the dropzone\n — dropping the focus it holds once the file dialog closes. */}\n <Field\n label={label}\n description={description}\n error={shownError}\n required={required}\n disabled={disabled}\n size={size}\n className={classNames?.field}\n >\n <FileUploadDropzone\n labelled={label != null}\n testId={testId}\n className={cn(\n \"flex flex-col items-center justify-center gap-2 rounded-input border border-dashed p-6 text-center\",\n // The kit's hairline, dashed — translucent so the dropzone reads the\n // same inside a Card, a Drawer or a tinted panel as it does on the\n // page, where an opaque gray step was only ever right against one of\n // them. Same pair as `Input`'s shell / `Card` / `SegmentGroup`.\n \"border-brand-900/20 dark:border-white/15\",\n \"cursor-pointer transition-colors\",\n \"data-dragging:border-(--c-solid) data-dragging:bg-(--c-solid)/5 data-dragging:border-solid\",\n // Muted text as a translucent neutral wash (black in light, white in dark), the\n // same pairing as the hairline above, so it keeps its contrast on any surface.\n cn(\n \"data-invalid:border-red-500 data-invalid:text-red-900 dark:data-invalid:text-red-500\",\n TYPOGRAPHY_SHADE_CLASSES.muted,\n ),\n \"data-disabled:cursor-not-allowed data-disabled:opacity-60\",\n \"group\",\n classNames?.dropzone,\n )}\n >\n {mergeIcons<\"upload\">(DEFAULT_ICONS, icons).upload}\n <p className=\"text-sm font-medium\">{hint ?? (withButton ? buttonHint : dropHint)}</p>\n {withButton && (\n <Ark.Trigger asChild>\n <Button\n variant=\"outline\"\n color={isInvalid ? \"red\" : undefined}\n size={size}\n type=\"button\"\n disabled={disabled}\n >\n {browseFiles}\n </Button>\n </Ark.Trigger>\n )}\n <Ark.HiddenInput ref={ref} />\n </FileUploadDropzone>\n </Field>\n\n <Ark.ItemGroup className={cn(\"flex flex-col gap-2\", classNames?.itemGroup)}>\n <Ark.Context>\n {(api) =>\n // With a queue the rows are its entries, keyed by their ids, each with its upload\n // state; without one, Ark's accepted files.\n (queue\n ? queue.entries.map((entry) => ({\n key: entry.id,\n file: entry.file,\n item: queue.itemProps(entry.id),\n }))\n : api.acceptedFiles.map((file) => ({\n key: `${file.name}-${file.lastModified}`,\n file,\n item: undefined,\n }))\n ).map(({ key, file, item }) => (\n // Each row is a `FileItem` on Ark's item: Ark's parts lend their attributes and\n // behaviour through `asChild` (the delete trigger keeps its click and its\n // `deleteFile` name), and the row stays an `<li>` of Ark's `<ul>`.\n <Ark.Item key={key} file={file} asChild>\n <FileItem.Root\n file={file}\n status={item?.status}\n progress={item?.progress}\n error={item?.error}\n announce={item?.announce}\n thumbnails={thumbnails}\n icons={icons}\n // Only the keys you set, so FileItem keeps its defaults for the rest.\n translations={{ ...translations, remove: () => deleteFile(file) }}\n asChild\n className={classNames?.item}\n >\n <li>\n <FileItem.Preview />\n <FileItem.Body>\n <Ark.ItemName asChild>\n <FileItem.Name />\n </Ark.ItemName>\n <Ark.ItemSizeText asChild>\n <FileItem.Meta />\n </Ark.ItemSizeText>\n <FileItem.Progress />\n </FileItem.Body>\n {item ? (\n <>\n {item.status === \"error\" && item.onRetry && (\n <FileItem.Retry onClick={item.onRetry} />\n )}\n {/* The queue's own actions, not Ark's delete: Ark's trigger would name\n the × \"Remove\" even while it cancels an upload. */}\n <FileItem.Remove\n onClick={isInFlight(item.status) ? item.onCancel : item.onRemove}\n />\n </>\n ) : (\n <Ark.ItemDeleteTrigger asChild>\n <FileItem.Remove />\n </Ark.ItemDeleteTrigger>\n )}\n </li>\n </FileItem.Root>\n </Ark.Item>\n ))\n }\n </Ark.Context>\n </Ark.ItemGroup>\n {/* The upload's one voice, mounted with the queue so it exists, empty, before the first\n file is dropped. Inside the root, which is `relative`, for its sr-only box. */}\n {queue && <FileQueueSummary queue={queue} translations={translations} />}\n </Ark.Root>\n )\n}\n\n/**\n * `Ark.Dropzone` plus the `Field` wiring Ark leaves out: the dropzone is the one part a keyboard\n * or screen-reader user ever reaches (the native input is `aria-hidden`), yet Ark only describes\n * the hidden input. A component of its own because `useFieldContext()` resolves only below the\n * `Field` — the `XxxControl` pattern `fieldA11yProps` documents. The label id is used only when a\n * label renders; otherwise the dropzone keeps Ark's `aria-label`.\n */\nfunction FileUploadDropzone({\n labelled,\n testId,\n className,\n children,\n}: { labelled: boolean; className: string; children: ReactNode } & WithTestId) {\n const { \"aria-labelledby\": labelledBy, ...described } = fieldA11yProps(useFieldContext())\n return (\n <Ark.Dropzone\n {...props({ \"data-testid\": testId })}\n {...described}\n aria-labelledby={labelled ? labelledBy : undefined}\n className={className}\n >\n {children}\n </Ark.Dropzone>\n )\n}\n"]}
@@ -7,8 +7,8 @@ import { useOpenIndexTrigger } from '../../chunk-RNRD6ER5.js';
7
7
  import { useElementSize } from '../../chunk-2LI3VPDP.js';
8
8
  import { useMergedRefs } from '../../chunk-HBWV5EPU.js';
9
9
  import { ratioStyle } from '../../chunk-AHM6SGEU.js';
10
- import { useLocale } from '../../chunk-IUK7OJXZ.js';
11
- import '../../chunk-LIZWCWED.js';
10
+ import { useLocale } from '../../chunk-OBSZ4NE2.js';
11
+ import '../../chunk-PQZSTI3R.js';
12
12
  import { useIsomorphicLayoutEffect } from '../../chunk-BUIHQJGE.js';
13
13
  import '../../chunk-XXOR34T4.js';
14
14
  import { props } from '../../chunk-WYCMIIRR.js';
@@ -1,18 +1,19 @@
1
1
  "use client";
2
- export { ImageCropper, useImageCropperContext } from '../../chunk-Y2G47ARQ.js';
2
+ export { ImageCropper, useImageCropperContext } from '../../chunk-5EOMSWNO.js';
3
3
  import '../../chunk-AKXALCUN.js';
4
4
  import '../../chunk-K6YASO4L.js';
5
5
  import '../../chunk-J43LSYQO.js';
6
6
  import '../../chunk-X6DESK37.js';
7
- import '../../chunk-WERJ44ZN.js';
7
+ import '../../chunk-DTFSCR3U.js';
8
8
  import '../../chunk-EIBDLRAR.js';
9
9
  import '../../chunk-HBWV5EPU.js';
10
10
  import '../../chunk-AHM6SGEU.js';
11
- import '../../chunk-IUK7OJXZ.js';
12
- import '../../chunk-BMEJBY6H.js';
13
- import '../../chunk-LIZWCWED.js';
11
+ import '../../chunk-OBSZ4NE2.js';
12
+ import '../../chunk-B5YHYI7E.js';
13
+ import '../../chunk-6B2GNPJP.js';
14
+ import '../../chunk-PQZSTI3R.js';
14
15
  import '../../chunk-XXOR34T4.js';
15
- import '../../chunk-D2QIPQ74.js';
16
+ import '../../chunk-W3XX7BYT.js';
16
17
  import '../../chunk-R5LYFTHA.js';
17
18
  import '../../chunk-WYCMIIRR.js';
18
19
  import '../../chunk-C6NVU4F7.js';
@@ -1,4 +1,4 @@
1
- import { warnRenamedProp } from '../../chunk-LIZWCWED.js';
1
+ import { warnRenamedProp } from '../../chunk-PQZSTI3R.js';
2
2
  import { props } from '../../chunk-WYCMIIRR.js';
3
3
  import { cn } from '../../chunk-4ASNIDV7.js';
4
4
  import { cva } from 'class-variance-authority';
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- export { Kbd } from '../../chunk-DJ72KP32.js';
3
- export { KBD_DEFAULT_TRANSLATIONS } from '../../chunk-QEMXXQQO.js';
2
+ export { Kbd } from '../../chunk-OXR7BXZA.js';
3
+ export { KBD_DEFAULT_TRANSLATIONS } from '../../chunk-JKFPRQB2.js';
4
4
  import '../../chunk-HWBFRDX7.js';
5
- import '../../chunk-LIZWCWED.js';
5
+ import '../../chunk-PQZSTI3R.js';
6
6
  import '../../chunk-BUIHQJGE.js';
7
7
  import '../../chunk-R5LYFTHA.js';
8
8
  import '../../chunk-WYCMIIRR.js';
@@ -1,27 +1,28 @@
1
1
  "use client";
2
- import { Modal } from '../../chunk-MCRTAUSZ.js';
3
- import { DownloadButton } from '../../chunk-6IRMKF5T.js';
2
+ import { Modal } from '../../chunk-7FPSQBWB.js';
3
+ import { DownloadButton } from '../../chunk-B4GNSSHU.js';
4
4
  import { durationOf, sampleEasing, frames, SPRINGS, animate, parseEasing, easingOf, EASINGS, spring, sampleSpring } from '../../chunk-HX3LNK26.js';
5
5
  import '../../chunk-AZ2VUAGX.js';
6
6
  import { Image, resolveSources } from '../../chunk-Y57NW6G7.js';
7
- import '../../chunk-4D2V4JE4.js';
7
+ import '../../chunk-V2QZG4IT.js';
8
8
  import '../../chunk-J43LSYQO.js';
9
- import '../../chunk-SCXXJDKQ.js';
9
+ import '../../chunk-SP6LCCTZ.js';
10
10
  import '../../chunk-EIBDLRAR.js';
11
11
  import { useOpenIndexTrigger, OpenIndexProvider } from '../../chunk-RNRD6ER5.js';
12
12
  import { useReducedMotion } from '../../chunk-CQ4M4BSF.js';
13
13
  import '../../chunk-HDYORQZN.js';
14
14
  import { useMergedRefs } from '../../chunk-HBWV5EPU.js';
15
15
  import '../../chunk-AHM6SGEU.js';
16
- import { useDirectionCheck, useLocale } from '../../chunk-IUK7OJXZ.js';
16
+ import { useDirectionCheck, useLocale } from '../../chunk-OBSZ4NE2.js';
17
17
  import '../../chunk-HWBFRDX7.js';
18
18
  import { OverlayContainerProvider } from '../../chunk-SLUOF7XW.js';
19
- import '../../chunk-BMEJBY6H.js';
20
- import '../../chunk-LIZWCWED.js';
19
+ import '../../chunk-B5YHYI7E.js';
20
+ import '../../chunk-6B2GNPJP.js';
21
+ import '../../chunk-PQZSTI3R.js';
21
22
  import { useUncontrolled } from '../../chunk-PMUCGFY5.js';
22
23
  import { useIsomorphicLayoutEffect } from '../../chunk-BUIHQJGE.js';
23
24
  import { iconStroke, mergeIcons } from '../../chunk-XXOR34T4.js';
24
- import '../../chunk-D2QIPQ74.js';
25
+ import '../../chunk-W3XX7BYT.js';
25
26
  import '../../chunk-R5LYFTHA.js';
26
27
  import { props } from '../../chunk-WYCMIIRR.js';
27
28
  import { focusStyles } from '../../chunk-C6NVU4F7.js';