@42-central/ui-react 0.24.0 → 0.25.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 (208) hide show
  1. package/dist/{chunk-FUNTJZX7.js → chunk-2CL3FKEY.js} +3 -3
  2. package/dist/{chunk-FUNTJZX7.js.map → chunk-2CL3FKEY.js.map} +1 -1
  3. package/dist/{chunk-OZMSXYBX.js → chunk-36NWC4GV.js} +3 -3
  4. package/dist/{chunk-OZMSXYBX.js.map → chunk-36NWC4GV.js.map} +1 -1
  5. package/dist/{chunk-4FEOMQYR.js → chunk-54W6VAI3.js} +5 -5
  6. package/dist/{chunk-4FEOMQYR.js.map → chunk-54W6VAI3.js.map} +1 -1
  7. package/dist/{chunk-SZEOTXRZ.js → chunk-6II2DVYR.js} +5 -5
  8. package/dist/{chunk-SZEOTXRZ.js.map → chunk-6II2DVYR.js.map} +1 -1
  9. package/dist/{chunk-DJLNGWMM.js → chunk-6IRMKF5T.js} +3 -3
  10. package/dist/{chunk-DJLNGWMM.js.map → chunk-6IRMKF5T.js.map} +1 -1
  11. package/dist/{chunk-YPFSRZ3T.js → chunk-6UIQJJNJ.js} +3 -3
  12. package/dist/{chunk-YPFSRZ3T.js.map → chunk-6UIQJJNJ.js.map} +1 -1
  13. package/dist/{chunk-DT6LKNZF.js → chunk-7247WBTV.js} +5 -4
  14. package/dist/chunk-7247WBTV.js.map +1 -0
  15. package/dist/{chunk-6VYGK3Q3.js → chunk-7E7JNWOC.js} +16 -21
  16. package/dist/chunk-7E7JNWOC.js.map +1 -0
  17. package/dist/{chunk-C4NFRSOR.js → chunk-7HZBD4YZ.js} +4 -4
  18. package/dist/{chunk-C4NFRSOR.js.map → chunk-7HZBD4YZ.js.map} +1 -1
  19. package/dist/{chunk-JVG5ISPT.js → chunk-AHKMN3YQ.js} +3 -3
  20. package/dist/{chunk-JVG5ISPT.js.map → chunk-AHKMN3YQ.js.map} +1 -1
  21. package/dist/{chunk-UAYENYS2.js → chunk-AKXALCUN.js} +3 -3
  22. package/dist/{chunk-UAYENYS2.js.map → chunk-AKXALCUN.js.map} +1 -1
  23. package/dist/{chunk-BE2LWUHY.js → chunk-BMEJBY6H.js} +5 -3
  24. package/dist/chunk-BMEJBY6H.js.map +1 -0
  25. package/dist/{chunk-MXAACRWE.js → chunk-E52Z2FKU.js} +5 -5
  26. package/dist/{chunk-MXAACRWE.js.map → chunk-E52Z2FKU.js.map} +1 -1
  27. package/dist/chunk-F374BNL4.js +129 -0
  28. package/dist/chunk-F374BNL4.js.map +1 -0
  29. package/dist/{chunk-MRAJ45IM.js → chunk-FZSLSUSX.js} +4 -4
  30. package/dist/{chunk-MRAJ45IM.js.map → chunk-FZSLSUSX.js.map} +1 -1
  31. package/dist/{chunk-3L5GLI67.js → chunk-I4B3N3UX.js} +3 -3
  32. package/dist/{chunk-3L5GLI67.js.map → chunk-I4B3N3UX.js.map} +1 -1
  33. package/dist/{chunk-IPYHTCFL.js → chunk-IUK7OJXZ.js} +3 -3
  34. package/dist/{chunk-IPYHTCFL.js.map → chunk-IUK7OJXZ.js.map} +1 -1
  35. package/dist/{chunk-2MXWEIMD.js → chunk-KKLCHLCZ.js} +12 -11
  36. package/dist/chunk-KKLCHLCZ.js.map +1 -0
  37. package/dist/{chunk-YWTOW7PZ.js → chunk-LHUWOA2U.js} +8 -8
  38. package/dist/{chunk-YWTOW7PZ.js.map → chunk-LHUWOA2U.js.map} +1 -1
  39. package/dist/{chunk-6N6J2DOE.js → chunk-LIZWCWED.js} +3 -3
  40. package/dist/{chunk-6N6J2DOE.js.map → chunk-LIZWCWED.js.map} +1 -1
  41. package/dist/{chunk-O7LS6OZR.js → chunk-LMCUGYHT.js} +3 -3
  42. package/dist/{chunk-O7LS6OZR.js.map → chunk-LMCUGYHT.js.map} +1 -1
  43. package/dist/{chunk-DHJB4UJD.js → chunk-N5M4PDBK.js} +4 -4
  44. package/dist/{chunk-DHJB4UJD.js.map → chunk-N5M4PDBK.js.map} +1 -1
  45. package/dist/{chunk-DA4QII2N.js → chunk-NLSJ6T7V.js} +4 -4
  46. package/dist/{chunk-DA4QII2N.js.map → chunk-NLSJ6T7V.js.map} +1 -1
  47. package/dist/{chunk-UT3TOV2Q.js → chunk-OVT2KZHY.js} +3 -3
  48. package/dist/{chunk-UT3TOV2Q.js.map → chunk-OVT2KZHY.js.map} +1 -1
  49. package/dist/{chunk-SVKN5ZHX.js → chunk-PEHFWGTT.js} +16 -13
  50. package/dist/chunk-PEHFWGTT.js.map +1 -0
  51. package/dist/{chunk-J44FJ7PH.js → chunk-PFZMB3US.js} +4 -4
  52. package/dist/{chunk-J44FJ7PH.js.map → chunk-PFZMB3US.js.map} +1 -1
  53. package/dist/{chunk-IRNF274I.js → chunk-PI7X5YFJ.js} +3 -3
  54. package/dist/{chunk-IRNF274I.js.map → chunk-PI7X5YFJ.js.map} +1 -1
  55. package/dist/{chunk-F2FSHVO5.js → chunk-QZ4N5LYG.js} +7 -7
  56. package/dist/{chunk-F2FSHVO5.js.map → chunk-QZ4N5LYG.js.map} +1 -1
  57. package/dist/{chunk-E5H3YWZV.js → chunk-SAXWCGWR.js} +3 -3
  58. package/dist/{chunk-E5H3YWZV.js.map → chunk-SAXWCGWR.js.map} +1 -1
  59. package/dist/{chunk-SWVUXEBT.js → chunk-SCXXJDKQ.js} +3 -3
  60. package/dist/{chunk-SWVUXEBT.js.map → chunk-SCXXJDKQ.js.map} +1 -1
  61. package/dist/{chunk-D3JYDAUZ.js → chunk-T44RW5DW.js} +4 -4
  62. package/dist/{chunk-D3JYDAUZ.js.map → chunk-T44RW5DW.js.map} +1 -1
  63. package/dist/{chunk-FB2G4LNH.js → chunk-UDCCOUWR.js} +5 -5
  64. package/dist/{chunk-FB2G4LNH.js.map → chunk-UDCCOUWR.js.map} +1 -1
  65. package/dist/{chunk-TCFB23JT.js → chunk-WERJ44ZN.js} +3 -3
  66. package/dist/{chunk-TCFB23JT.js.map → chunk-WERJ44ZN.js.map} +1 -1
  67. package/dist/{chunk-QNKD2SQM.js → chunk-X3YIHN2U.js} +5 -5
  68. package/dist/{chunk-QNKD2SQM.js.map → chunk-X3YIHN2U.js.map} +1 -1
  69. package/dist/{chunk-VD6PB3VA.js → chunk-X6DESK37.js} +12 -3
  70. package/dist/chunk-X6DESK37.js.map +1 -0
  71. package/dist/{chunk-7AQ4MN4M.js → chunk-XUFCI262.js} +4 -4
  72. package/dist/{chunk-7AQ4MN4M.js.map → chunk-XUFCI262.js.map} +1 -1
  73. package/dist/{chunk-47LEAR6G.js → chunk-Y2G47ARQ.js} +6 -6
  74. package/dist/{chunk-47LEAR6G.js.map → chunk-Y2G47ARQ.js.map} +1 -1
  75. package/dist/{chunk-F342ZT7O.js → chunk-ZVECQBGG.js} +13 -7
  76. package/dist/chunk-ZVECQBGG.js.map +1 -0
  77. package/dist/components/action-icon/action-icon.d.ts.map +1 -1
  78. package/dist/components/action-icon/index.js +1 -1
  79. package/dist/components/alert/index.js +1 -1
  80. package/dist/components/ambient-background/index.js +5 -3
  81. package/dist/components/ambient-background/index.js.map +1 -1
  82. package/dist/components/ambient-background/starfield.d.ts.map +1 -1
  83. package/dist/components/app-shell/index.js +4 -4
  84. package/dist/components/autocomplete/index.js +3 -3
  85. package/dist/components/avatar/index.js +2 -2
  86. package/dist/components/badge/badge.d.ts.map +1 -1
  87. package/dist/components/badge/index.js +1 -1
  88. package/dist/components/button/index.js +1 -1
  89. package/dist/components/button-multi-select/index.js +3 -3
  90. package/dist/components/button-select/index.js +3 -3
  91. package/dist/components/calendar/index.js +4 -4
  92. package/dist/components/calendar-heatmap/index.js +2 -2
  93. package/dist/components/camera/index.js +10 -10
  94. package/dist/components/card/card.d.ts.map +1 -1
  95. package/dist/components/card/index.js +1 -1
  96. package/dist/components/carousel/index.js +2 -2
  97. package/dist/components/checkbox/checkbox.d.ts +3 -2
  98. package/dist/components/checkbox/checkbox.d.ts.map +1 -1
  99. package/dist/components/checkbox/index.js +2 -2
  100. package/dist/components/choice-card-group/index.js +2 -2
  101. package/dist/components/choice-card-group/index.js.map +1 -1
  102. package/dist/components/clipboard/index.js +3 -3
  103. package/dist/components/code-block/code-block.d.ts +6 -3
  104. package/dist/components/code-block/code-block.d.ts.map +1 -1
  105. package/dist/components/code-block/highlighter.d.ts +16 -15
  106. package/dist/components/code-block/highlighter.d.ts.map +1 -1
  107. package/dist/components/code-block/index.d.ts +2 -1
  108. package/dist/components/code-block/index.d.ts.map +1 -1
  109. package/dist/components/code-block/index.js +81 -10
  110. package/dist/components/code-block/index.js.map +1 -1
  111. package/dist/components/code-block/languages.d.ts +61 -0
  112. package/dist/components/code-block/languages.d.ts.map +1 -0
  113. package/dist/components/code-block/static.d.ts +2 -1
  114. package/dist/components/code-block/static.d.ts.map +1 -1
  115. package/dist/components/code-block/static.js +99 -10
  116. package/dist/components/code-block/static.js.map +1 -1
  117. package/dist/components/combobox/index.js +3 -3
  118. package/dist/components/combobox-list/index.js +5 -5
  119. package/dist/components/compare/index.js +2 -2
  120. package/dist/components/data-table/index.js +30 -30
  121. package/dist/components/data-table/index.js.map +1 -1
  122. package/dist/components/date-picker/index.js +12 -12
  123. package/dist/components/download-button/index.js +2 -2
  124. package/dist/components/drawer/index.js +4 -4
  125. package/dist/components/field/field.d.ts +3 -0
  126. package/dist/components/field/field.d.ts.map +1 -1
  127. package/dist/components/field/index.js +1 -1
  128. package/dist/components/file-item/index.js +5 -5
  129. package/dist/components/file-preview/index.js +5 -5
  130. package/dist/components/file-trigger/index.js +2 -2
  131. package/dist/components/file-upload/index.js +6 -6
  132. package/dist/components/gallery/index.js +2 -2
  133. package/dist/components/geodesic/a11y.d.ts +3 -3
  134. package/dist/components/geodesic/a11y.d.ts.map +1 -1
  135. package/dist/components/image-cropper/index.js +7 -7
  136. package/dist/components/indicator/index.js +1 -1
  137. package/dist/components/input/index.js +2 -2
  138. package/dist/components/kbd/index.js +3 -3
  139. package/dist/components/kbd/kbd.d.ts.map +1 -1
  140. package/dist/components/lightbox/index.js +7 -7
  141. package/dist/components/menu/index.js +2 -2
  142. package/dist/components/modal/index.js +4 -4
  143. package/dist/components/multi-combobox-list/index.js +5 -5
  144. package/dist/components/multi-select/index.js +6 -6
  145. package/dist/components/number-input/index.js +3 -3
  146. package/dist/components/overlays/index.js +6 -6
  147. package/dist/components/password-input/index.js +3 -3
  148. package/dist/components/photo-capture/index.js +14 -14
  149. package/dist/components/pills-input/index.js +5 -5
  150. package/dist/components/pin-input/index.js +2 -2
  151. package/dist/components/radio-group/index.js +1 -1
  152. package/dist/components/rating/index.js +1 -1
  153. package/dist/components/schedule/index.js +5 -5
  154. package/dist/components/segment-group/index.js +4 -4
  155. package/dist/components/select/index.js +4 -4
  156. package/dist/components/slider/index.js +2 -2
  157. package/dist/components/spotlight/index.js +9 -9
  158. package/dist/components/switch/index.js +14 -19
  159. package/dist/components/switch/index.js.map +1 -1
  160. package/dist/components/switch/switch.d.ts +1 -0
  161. package/dist/components/switch/switch.d.ts.map +1 -1
  162. package/dist/components/table/index.js +1 -1
  163. package/dist/components/table/table.d.ts.map +1 -1
  164. package/dist/components/tabs/index.js +3 -3
  165. package/dist/components/tags-input/index.js +5 -5
  166. package/dist/components/text-input/index.js +2 -2
  167. package/dist/components/textarea/index.js +2 -2
  168. package/dist/components/theme-icon/index.js +1 -1
  169. package/dist/components/theme-icon/theme-icon.d.ts.map +1 -1
  170. package/dist/components/time-input/index.js +7 -7
  171. package/dist/components/tree-multi-select/index.js +6 -6
  172. package/dist/components/tree-select/index.js +3 -3
  173. package/dist/index.js +4 -4
  174. package/dist/theme.css +28 -23
  175. package/package.json +1 -1
  176. package/src/components/action-icon/action-icon.tsx +3 -1
  177. package/src/components/ambient-background/starfield.tsx +4 -2
  178. package/src/components/badge/badge.tsx +11 -6
  179. package/src/components/button/button.tsx +1 -1
  180. package/src/components/card/card.tsx +10 -9
  181. package/src/components/checkbox/checkbox.test.tsx +17 -9
  182. package/src/components/checkbox/checkbox.tsx +26 -27
  183. package/src/components/choice-card-group/choice-card-group.tsx +3 -3
  184. package/src/components/code-block/code-block.tsx +7 -4
  185. package/src/components/code-block/highlighter.test.ts +79 -1
  186. package/src/components/code-block/highlighter.ts +76 -30
  187. package/src/components/code-block/index.ts +2 -0
  188. package/src/components/code-block/languages.ts +63 -0
  189. package/src/components/code-block/static.tsx +2 -1
  190. package/src/components/data-table/data-table-pagination.tsx +5 -5
  191. package/src/components/data-table/data-table-stack.tsx +2 -2
  192. package/src/components/field/field.tsx +14 -0
  193. package/src/components/kbd/kbd.tsx +2 -1
  194. package/src/components/switch/switch.test.tsx +15 -0
  195. package/src/components/switch/switch.tsx +27 -27
  196. package/src/components/table/table.test.tsx +1 -1
  197. package/src/components/table/table.tsx +14 -11
  198. package/src/components/theme-icon/theme-icon.tsx +46 -12
  199. package/src/theme.css +28 -23
  200. package/dist/chunk-2MXWEIMD.js.map +0 -1
  201. package/dist/chunk-6VYGK3Q3.js.map +0 -1
  202. package/dist/chunk-7CNDZZZ6.js +0 -95
  203. package/dist/chunk-7CNDZZZ6.js.map +0 -1
  204. package/dist/chunk-BE2LWUHY.js.map +0 -1
  205. package/dist/chunk-DT6LKNZF.js.map +0 -1
  206. package/dist/chunk-F342ZT7O.js.map +0 -1
  207. package/dist/chunk-SVKN5ZHX.js.map +0 -1
  208. package/dist/chunk-VD6PB3VA.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/button-select/button-select.tsx","../src/components/button-select/button-select-items.ts","../src/components/button-select/button-select-control.tsx"],"names":["Ark","props","jsx"],"mappings":";;;;;;;;;;;AAqDA,IAAM,2BAA2B,aAAA,CAAiC;AAAA,EAChE,OAAA,EAAS,OAAA;AAAA,EACT,eAAA,EAAiB,QAAA;AAAA,EACjB,IAAA,EAAM;AACR,CAAC,CAAA;AAUD,IAAM,WAAA,GACJ,yKAAA;AAsBF,IAAM,aAAa,CAAC,CAAA,EAAsB,CAAA,KACxC,CAAA,CAAE,WAAW,CAAA,CAAE,MAAA,IAAU,CAAA,CAAE,KAAA,CA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,EAAY,IAAA;AAAA,gBAEtB,QAAA,EAAA,UAAA,GACG,WAAW,IAAA,EAAM;AAAA,kBACf,QAAA,EAAU,KAAA,CAAM,QAAA,CAAS,IAAA,CAAK,KAAK,CAAA;AAAA,kBACnC,QAAA,EAAU,OAAA,CAAQ,QAAQ,CAAA,IAAK,IAAA,CAAK;AAAA,iBACrC,IACD,IAAA,CAAK;AAAA,eAAA;AAAA,cAfJ,IAAA,CAAK;AAAA,aAiBb;AAAA;AAAA,SACH;AAAA,wBACAA,GAAAA,CAAC,YAAA,EAAA,EAAa,IAAA,EAAY,OAAc,QAAA,EAAoB;AAAA;AAAA;AAAA,GAC9D;AAEJ","file":"chunk-7AQ4MN4M.js","sourcesContent":["\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { ToggleGroup as Ark, useToggleGroupContext } from \"@ark-ui/react/toggle-group\"\nimport {\n Children,\n cloneElement,\n createContext,\n type FocusEvent,\n type KeyboardEvent,\n type ReactElement,\n type ReactNode,\n type Ref,\n useContext,\n} from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport { Button, type ButtonProps, type ButtonSize, type ButtonVariant } from \"../button/button\"\nimport { buttonGroupVariants } from \"../button-group/button-group\"\nimport { fieldA11yProps } from \"../field/field\"\n\n/**\n * ButtonSelect / ButtonMultiSelect — compound parts.\n *\n * A row (or column) of real `Button`s joined like `ButtonGroup`, on Ark UI's\n * ToggleGroup machine. Every item renders through `Button` itself and only its\n * `variant` changes with the selection: unselected items take `variant`, the\n * selected ones `selectedVariant`. So the item styling — every variant × color,\n * sizes, `startSlot`/`endSlot`, hover, focus ring — has exactly one source, and\n * the join (flattened inner corners, collapsed hairlines, the hover/focus z-lift\n * and the filled/subtle seams) comes from `buttonGroupVariants` rather than a copy.\n *\n * Unlike `SegmentGroup` there is no sliding pill: a pill can't follow several\n * selected items at once, and the same parts back both the single and the\n * multiple form. The machine provides the semantics — `radiogroup` / `radio` +\n * `aria-checked` for single, `group` + `aria-pressed` for multiple — plus roving\n * focus with arrow keys and Home/End.\n *\n * `variant`, `selectedVariant` and `size` travel through a small context set once\n * on `Root`, so they aren't repeated on every `Item` (the Tabs pattern). `color`\n * is a plain `data-color` on `Root`, so it cascades to every item as CSS custom\n * properties; an item's own `color` re-stamps it on that one button.\n */\n\ntype StyleContextValue = {\n variant: ButtonVariant\n selectedVariant: ButtonVariant\n size: ButtonSize\n}\n\nconst ButtonSelectStyleContext = createContext<StyleContextValue>({\n variant: \"light\",\n selectedVariant: \"filled\",\n size: \"md\",\n})\n\n/**\n * The invalid cue is a ring on the whole group rather than red item borders: the\n * borderless `filled` / `subtle` items have no border to recolor, and the group\n * seams out-specify a per-item border anyway. A `ring` (box-shadow) is used, not\n * an `outline`, because the machine writes `outline: none` inline on the root.\n * `w-fit` keeps that ring hugging the items: inside `Field`'s flex column the\n * root would otherwise stretch to the field's full width.\n */\nconst invalidRing =\n \"w-fit rounded-button data-invalid:ring-1 data-invalid:ring-red-500 data-invalid:ring-offset-2 data-invalid:ring-offset-brand-50 dark:data-invalid:ring-offset-brand-950\"\n\ntype BaseRootProps = Omit<\n Ark.RootProps,\n \"color\" | \"multiple\" | \"value\" | \"defaultValue\" | \"onValueChange\" | \"deselectable\" | \"onChange\"\n> &\n WithTestId & {\n /** Palette for every item, as a `data-color` on the group. */\n color?: Color\n /** Treatment of the unselected items. */\n variant?: ButtonVariant\n /** Treatment of the selected items. */\n selectedVariant?: ButtonVariant\n size?: ButtonSize\n /** Red invalid ring around the group. */\n invalid?: boolean\n /** Lands on the group root, which forwards focus to its active item. Ark's\n * prop types carry no `ref`, so it is declared here. */\n ref?: Ref<HTMLDivElement>\n children?: ReactNode\n }\n\nconst sameValues = (a: readonly string[], b: readonly string[]) =>\n a.length === b.length && a.every((v, i) => v === b[i])\n\n/**\n * Tab entry for a single-choice group. Every item is `tabindex=-1` while focus is\n * outside, so Tab lands on the root, and zag then forwards focus to the *first*\n * item regardless of the selection. A radio group should land on the checked\n * radio instead, so in single mode the root's own focus is caught in the capture\n * phase and sent to the selected (enabled) item. `stopPropagation` there stops\n * the native event before React's bubble listener runs, which is what keeps\n * zag's `ROOT.FOCUS` (and its deferred focus-first) from firing. With nothing\n * selected, zag's own behaviour stands.\n */\nconst focusSelectedItem = (event: FocusEvent<HTMLDivElement>) => {\n if (event.target !== event.currentTarget) return\n const selected = event.currentTarget.querySelector<HTMLElement>(\n ':scope > [data-state=\"on\"]:not([disabled])',\n )\n if (!selected) return\n event.stopPropagation()\n selected.focus({ preventScroll: true })\n}\n\n/**\n * RTL arrow keys. zag's toggle-group reads `event.key` without passing `dir` to\n * `getEventKey` (its other machines do), so in a right-to-left locale ArrowLeft\n * moves focus visually *right*. In a horizontal RTL group the two keys are\n * caught in the capture phase, before zag's handler, and focus moves to the\n * visually adjacent enabled item instead; zag then picks up the new focus\n * through the item's own `onFocus`. `dir` is read off the root, where the\n * machine writes the locale's direction.\n */\nconst mirrorRtlArrows = (loop: boolean) => (event: KeyboardEvent<HTMLDivElement>) => {\n const root = event.currentTarget\n if (root.dir !== \"rtl\" || root.getAttribute(\"data-orientation\") !== \"horizontal\") return\n if (event.key !== \"ArrowLeft\" && event.key !== \"ArrowRight\") return\n const items = Array.from(\n root.querySelectorAll<HTMLElement>(':scope > [data-part=\"item\"]:not([disabled])'),\n )\n const index = items.indexOf(event.target as HTMLElement)\n if (index === -1) return\n event.preventDefault()\n event.stopPropagation()\n // Visually left is the next item in RTL, visually right the previous one.\n const step = event.key === \"ArrowLeft\" ? 1 : -1\n const next = loop\n ? items[(index + step + items.length) % items.length]\n : items[Math.min(Math.max(index + step, 0), items.length - 1)]\n next?.focus()\n}\n\n/** The shared root behind both `ButtonSelect.Root` and `ButtonMultiSelect.Root`. */\nexport const RootBase = ({\n multiple,\n value,\n defaultValue,\n onValueChange,\n deselectable,\n orientation = \"horizontal\",\n color,\n variant = \"light\",\n selectedVariant = \"filled\",\n size = \"md\",\n invalid,\n loopFocus = true,\n className,\n testId,\n children,\n ...rest\n}: BaseRootProps & {\n multiple: boolean\n value?: string[]\n defaultValue?: string[]\n onValueChange?: (value: string[]) => void\n deselectable?: boolean\n}) => {\n const field = useFieldContext()\n // Owned here so a change can be compared with the current value: in a\n // non-deselectable single group the machine re-emits the same value when the\n // selected item is clicked again, and that is not a change.\n const [selected, setSelected] = useUncontrolled<string[]>({\n value,\n defaultValue,\n finalValue: [],\n onChange: onValueChange,\n })\n return (\n <ButtonSelectStyleContext.Provider value={{ variant, selectedVariant, size }}>\n <Ark.Root\n multiple={multiple}\n value={selected}\n onValueChange={(details) => {\n if (!sameValues(details.value, selected)) setSelected(details.value)\n }}\n deselectable={deselectable}\n orientation={orientation}\n loopFocus={loopFocus}\n onFocusCapture={multiple ? undefined : focusSelectedItem}\n onKeyDownCapture={mirrorRtlArrows(loopFocus)}\n data-color={color}\n {...props({ \"aria-invalid\": invalid, \"data-invalid\": invalid, \"data-testid\": testId })}\n {...fieldA11yProps(field)}\n className={cn(buttonGroupVariants({ orientation }), invalidRing, className)}\n {...rest}\n >\n {children}\n </Ark.Root>\n </ButtonSelectStyleContext.Provider>\n )\n}\n\nexport type ButtonSelectRootProps = BaseRootProps & {\n /** Controlled value. `null` clears the selection. */\n value?: string | null\n /** Uncontrolled initial value. */\n defaultValue?: string | null\n /** Fires with the newly selected value — `null` only when `deselectable`. */\n onChange?: (value: string | null) => void\n /** Clicking the selected item clears the selection. Off by default, so the\n * group behaves like a radio group. */\n deselectable?: boolean\n}\n\nconst toArray = (value: string | null | undefined) =>\n value === undefined ? undefined : value === null ? [] : [value]\n\n/** Single-choice root: one selected item at most. */\nexport const Root = ({\n value,\n defaultValue,\n onChange,\n deselectable = false,\n ...rest\n}: ButtonSelectRootProps) => (\n <RootBase\n multiple={false}\n value={toArray(value)}\n defaultValue={toArray(defaultValue)}\n onValueChange={(next) => onChange?.(next[0] ?? null)}\n deselectable={deselectable}\n {...rest}\n />\n)\n\nexport type ButtonMultiSelectRootProps = BaseRootProps & {\n /** Controlled value. */\n value?: string[]\n /** Uncontrolled initial value. */\n defaultValue?: string[]\n /** Fires with every selected value, in selection order. */\n onChange?: (value: string[]) => void\n}\n\n/** Multiple-choice root: each item toggles independently. */\nexport const MultiRoot = ({ onChange, ...rest }: ButtonMultiSelectRootProps) => (\n <RootBase multiple onValueChange={onChange} {...rest} />\n)\n\n/** The props `Item` hands a custom control under `asChild`. */\ntype SelectableControlProps = { variant?: ButtonVariant; size?: ButtonSize }\n\nexport type ButtonSelectItemProps =\n | (Omit<ButtonProps, \"value\" | \"variant\" | \"size\" | \"loading\" | \"asChild\"> & {\n /** The value this item selects. */\n value: string\n asChild?: false\n })\n | {\n /** The value this item selects. */\n value: string\n disabled?: boolean\n /**\n * Render your own variant-aware control instead of a `Button` — e.g. an\n * `ActionIcon` for an icon-only toolbar. The single child receives the\n * selection-driven `variant` and the group `size` (its own `size` wins),\n * plus the machine's item props.\n */\n asChild: true\n children: ReactElement<SelectableControlProps>\n }\n\n/**\n * One option, rendered as a `Button`. Its `variant` follows the selection (from\n * `Root`'s `variant` / `selectedVariant`); every other `Button` prop — `color`,\n * `startSlot`, `endSlot`, `aria-label` for an icon-only item, `testId` — passes\n * through. The machine's item props land on the button via Ark's `asChild`.\n *\n * With `asChild`, the single child is rendered in place of the `Button` and\n * cloned with the same `variant` / `size`, so any control speaking the kit's\n * variant × size vocabulary (`ActionIcon`, a consumer's own) can be an item.\n */\nexport const Item = (props: ButtonSelectItemProps) => {\n const { variant, selectedVariant, size } = useContext(ButtonSelectStyleContext)\n const { value, disabled } = props\n const { pressed } = useToggleGroupContext().getItemState({ value, disabled })\n const resolvedVariant = pressed ? selectedVariant : variant\n if (props.asChild) {\n const child = Children.only(props.children)\n return (\n <Ark.Item value={value} disabled={disabled} asChild>\n {cloneElement(child, { variant: resolvedVariant, size: child.props.size ?? size })}\n </Ark.Item>\n )\n }\n const { value: _value, disabled: _disabled, asChild: _asChild, ...rest } = props\n return (\n <Ark.Item value={value} disabled={disabled} asChild>\n <Button variant={resolvedVariant} size={size} {...rest} />\n </Ark.Item>\n )\n}\n\n/**\n * One hidden input per selected value, so a native `<form>` submit carries the\n * selection under `name`. Rendered *beside* the root, never inside it: the join\n * selectors target the root's children by `:first-child` / `:last-child`, which a\n * trailing input would throw off.\n */\nexport const HiddenInputs = ({\n name,\n value,\n disabled,\n}: {\n name?: string\n value: readonly string[]\n disabled?: boolean\n}) =>\n name == null\n ? null\n : value.map((v) => <input key={v} type=\"hidden\" name={name} value={v} disabled={disabled} />)\n\nexport const Context = Ark.Context\n","import type { ReactNode } from \"react\"\nimport type { Color } from \"../../lib/colors\"\n\n/**\n * One option of a data-driven `ButtonSelect` / `ButtonMultiSelect`: a bare\n * value-as-label string, or a labelled object. `payload` is arbitrary data the\n * machine ignores; it reaches `renderItem` typed off the `data` shape — the same\n * contract as `SegmentGroup` and `Select`.\n */\nexport type ButtonSelectItem<P = unknown> =\n | string\n | {\n value: string\n label?: ReactNode\n /** Content before the label, e.g. an icon (Button's `startSlot`). */\n startSlot?: ReactNode\n /** Content after the label (Button's `endSlot`). */\n endSlot?: ReactNode\n disabled?: boolean\n /** Overrides the group palette for this item. */\n color?: Color\n /** Accessible name — required when `label` is an icon only. */\n \"aria-label\"?: string\n /** Arbitrary extra data, surfaced to `renderItem`. */\n payload?: P\n /** `data-testid` on the rendered button. Defaults to `` `item-${value}` ``. */\n testId?: string\n }\n\n/** The `data` array both components are generic over. */\nexport type ButtonSelectData<P = unknown> = ReadonlyArray<ButtonSelectItem<P>>\n\n/** The value-string union of a `ButtonSelectData` shape; a `const` type\n * parameter narrows it to the literal union. */\nexport type ButtonSelectValue<Data extends ButtonSelectData> = ItemValue<Data[number]>\ntype ItemValue<E> = E extends string ? E : E extends { value: infer V extends string } ? V : never\n\n/** The `payload` type carried by a `ButtonSelectData` shape. */\nexport type ButtonSelectPayload<Data extends ButtonSelectData> = PayloadOf<Data[number]>\ntype PayloadOf<T> = T extends string ? never : T extends { payload?: infer P } ? P : never\n\n/** The item handed to `renderItem`, narrowed to the data's value and payload. */\nexport type RenderableButtonSelectItem<Data extends ButtonSelectData> = {\n value: ButtonSelectValue<Data>\n label: ReactNode\n disabled: boolean\n color: Color | undefined\n payload: ButtonSelectPayload<Data> | undefined\n}\n\n/** Live item state passed alongside the item to `renderItem`. */\nexport type ButtonSelectItemState = {\n selected: boolean\n disabled: boolean\n}\n\n/**\n * Render an item's label yourself. The item keeps its button, sizing, variant\n * and selection wiring; you fill its content. In an RSC tree the function must\n * live in a `\"use client\"` module.\n */\nexport type RenderButtonSelectItem<Data extends ButtonSelectData> = (\n item: RenderableButtonSelectItem<Data>,\n state: ButtonSelectItemState,\n) => ReactNode\n\n/** A fully resolved item — every field present (`label` falls back to `value`). */\nexport type NormalizedButtonSelectItem = {\n value: string\n label: ReactNode\n startSlot: ReactNode\n endSlot: ReactNode\n disabled: boolean\n color: Color | undefined\n ariaLabel: string | undefined\n payload: unknown\n testId: string\n}\n\nexport const normalizeButtonSelectItem = (item: ButtonSelectItem): NormalizedButtonSelectItem =>\n typeof item === \"string\"\n ? {\n value: item,\n label: item,\n startSlot: undefined,\n endSlot: undefined,\n disabled: false,\n color: undefined,\n ariaLabel: undefined,\n payload: undefined,\n testId: `item-${item}`,\n }\n : {\n value: item.value,\n label: item.label ?? item.value,\n startSlot: item.startSlot,\n endSlot: item.endSlot,\n disabled: item.disabled ?? false,\n color: item.color,\n ariaLabel: item[\"aria-label\"],\n payload: item.payload,\n testId: item.testId ?? `item-${item.value}`,\n }\n","\"use client\"\n\nimport type { FocusEvent, Ref } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport type { ButtonSize, ButtonVariant } from \"../button/button\"\nimport { type FieldProps, FieldShell } from \"../field/field\"\nimport { HiddenInputs, Item, RootBase } from \"./button-select\"\nimport {\n type ButtonSelectData,\n normalizeButtonSelectItem,\n type RenderButtonSelectItem,\n} from \"./button-select-items\"\n\ntype ButtonSelectClassNames = {\n field?: string\n /** The label element itself — e.g. `\"sr-only\"` to keep the accessible name\n * without showing it. */\n label?: string\n root?: string\n item?: string\n}\n\n/** Props shared by the data-driven `ButtonSelect` and `ButtonMultiSelect`. */\nexport type ButtonSelectBaseProps<Data extends ButtonSelectData> = Pick<\n FieldProps,\n \"label\" | \"description\" | \"error\" | \"required\"\n> &\n WithTestId & {\n /** Items: bare strings (`value === label`) or `{ value, label?, startSlot?, … }`. */\n data: Data\n /** Render each item's content yourself, with its typed `payload`. */\n renderItem?: RenderButtonSelectItem<Data>\n /** Lay the items in a row (default) or a column. */\n orientation?: \"horizontal\" | \"vertical\"\n /** Red invalid state, independent of (and OR'd with) `error`. */\n invalid?: boolean\n /** Dims and blocks every item. */\n disabled?: boolean\n size?: ButtonSize\n /** Treatment of the unselected items. Defaults to `light`. */\n variant?: ButtonVariant\n /** Treatment of the selected items. Defaults to `filled`. */\n selectedVariant?: ButtonVariant\n color?: Color\n /** Renders a hidden input per selected value for native form submission. */\n name?: string\n /** Explicit id for the group root. */\n id?: string\n /** Lands on the group root, which forwards focus to its active item. */\n ref?: Ref<HTMLDivElement>\n /** Forwarded to the root; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLDivElement>) => void\n className?: string\n classNames?: ButtonSelectClassNames\n }\n\n/**\n * The rendering both data forms share: the `Field` wrapper, the group root, one\n * `Item` per entry and the hidden inputs. The public components only adapt their\n * value shape (`V | null` or `V[]`) onto the machine's `string[]`.\n */\nexport const ButtonSelectControl = ({\n multiple,\n deselectable,\n value,\n onValueChange,\n data,\n renderItem,\n orientation,\n invalid,\n disabled,\n required,\n size = \"md\",\n variant,\n selectedVariant,\n color,\n name,\n id,\n ref,\n onBlur,\n label,\n description,\n error,\n className,\n classNames,\n testId,\n}: ButtonSelectBaseProps<ButtonSelectData> & {\n multiple: boolean\n deselectable?: boolean\n value: readonly string[]\n onValueChange: (value: string[]) => void\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 || error != null\n const items = data.map(normalizeButtonSelectItem)\n\n return (\n <FieldShell\n label={label}\n description={description}\n error={error}\n required={required}\n disabled={disabled}\n size={size}\n className={classNames?.field}\n classNames={{ label: classNames?.label }}\n >\n <RootBase\n multiple={multiple}\n deselectable={deselectable}\n value={[...value]}\n onValueChange={onValueChange}\n orientation={orientation}\n disabled={disabled}\n invalid={isInvalid}\n size={size}\n variant={variant}\n selectedVariant={selectedVariant}\n color={color}\n id={id}\n ref={ref}\n onBlur={onBlur}\n testId={testId}\n className={cn(className, classNames?.root)}\n >\n {items.map((item) => (\n <Item\n key={item.value}\n value={item.value}\n disabled={item.disabled}\n color={item.color}\n startSlot={item.startSlot}\n endSlot={item.endSlot}\n aria-label={item.ariaLabel}\n testId={item.testId}\n className={classNames?.item}\n >\n {renderItem\n ? renderItem(item, {\n selected: value.includes(item.value),\n disabled: Boolean(disabled) || item.disabled,\n })\n : item.label}\n </Item>\n ))}\n </RootBase>\n <HiddenInputs name={name} value={value} disabled={disabled} />\n </FieldShell>\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/components/button-select/button-select.tsx","../src/components/button-select/button-select-items.ts","../src/components/button-select/button-select-control.tsx"],"names":["Ark","props","jsx"],"mappings":";;;;;;;;;;;AAqDA,IAAM,2BAA2B,aAAA,CAAiC;AAAA,EAChE,OAAA,EAAS,OAAA;AAAA,EACT,eAAA,EAAiB,QAAA;AAAA,EACjB,IAAA,EAAM;AACR,CAAC,CAAA;AAUD,IAAM,WAAA,GACJ,yKAAA;AAsBF,IAAM,aAAa,CAAC,CAAA,EAAsB,CAAA,KACxC,CAAA,CAAE,WAAW,CAAA,CAAE,MAAA,IAAU,CAAA,CAAE,KAAA,CAAM,CAAC,CAAA,EAAG,CAAA,KAAM,CAAA,KAAM,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GACG,WAAW,IAAA,EAAM;AAAA,kBACf,QAAA,EAAU,KAAA,CAAM,QAAA,CAAS,IAAA,CAAK,KAAK,CAAA;AAAA,kBACnC,QAAA,EAAU,OAAA,CAAQ,QAAQ,CAAA,IAAK,IAAA,CAAK;AAAA,iBACrC,IACD,IAAA,CAAK;AAAA,eAAA;AAAA,cAfJ,IAAA,CAAK;AAAA,aAiBb;AAAA;AAAA,SACH;AAAA,wBACAA,GAAAA,CAAC,YAAA,EAAA,EAAa,IAAA,EAAY,OAAc,QAAA,EAAoB;AAAA;AAAA;AAAA,GAC9D;AAEJ","file":"chunk-XUFCI262.js","sourcesContent":["\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { ToggleGroup as Ark, useToggleGroupContext } from \"@ark-ui/react/toggle-group\"\nimport {\n Children,\n cloneElement,\n createContext,\n type FocusEvent,\n type KeyboardEvent,\n type ReactElement,\n type ReactNode,\n type Ref,\n useContext,\n} from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport { Button, type ButtonProps, type ButtonSize, type ButtonVariant } from \"../button/button\"\nimport { buttonGroupVariants } from \"../button-group/button-group\"\nimport { fieldA11yProps } from \"../field/field\"\n\n/**\n * ButtonSelect / ButtonMultiSelect — compound parts.\n *\n * A row (or column) of real `Button`s joined like `ButtonGroup`, on Ark UI's\n * ToggleGroup machine. Every item renders through `Button` itself and only its\n * `variant` changes with the selection: unselected items take `variant`, the\n * selected ones `selectedVariant`. So the item styling — every variant × color,\n * sizes, `startSlot`/`endSlot`, hover, focus ring — has exactly one source, and\n * the join (flattened inner corners, collapsed hairlines, the hover/focus z-lift\n * and the filled/subtle seams) comes from `buttonGroupVariants` rather than a copy.\n *\n * Unlike `SegmentGroup` there is no sliding pill: a pill can't follow several\n * selected items at once, and the same parts back both the single and the\n * multiple form. The machine provides the semantics — `radiogroup` / `radio` +\n * `aria-checked` for single, `group` + `aria-pressed` for multiple — plus roving\n * focus with arrow keys and Home/End.\n *\n * `variant`, `selectedVariant` and `size` travel through a small context set once\n * on `Root`, so they aren't repeated on every `Item` (the Tabs pattern). `color`\n * is a plain `data-color` on `Root`, so it cascades to every item as CSS custom\n * properties; an item's own `color` re-stamps it on that one button.\n */\n\ntype StyleContextValue = {\n variant: ButtonVariant\n selectedVariant: ButtonVariant\n size: ButtonSize\n}\n\nconst ButtonSelectStyleContext = createContext<StyleContextValue>({\n variant: \"light\",\n selectedVariant: \"filled\",\n size: \"md\",\n})\n\n/**\n * The invalid cue is a ring on the whole group rather than red item borders: the\n * borderless `filled` / `subtle` items have no border to recolor, and the group\n * seams out-specify a per-item border anyway. A `ring` (box-shadow) is used, not\n * an `outline`, because the machine writes `outline: none` inline on the root.\n * `w-fit` keeps that ring hugging the items: inside `Field`'s flex column the\n * root would otherwise stretch to the field's full width.\n */\nconst invalidRing =\n \"w-fit rounded-button data-invalid:ring-1 data-invalid:ring-red-500 data-invalid:ring-offset-2 data-invalid:ring-offset-brand-50 dark:data-invalid:ring-offset-brand-950\"\n\ntype BaseRootProps = Omit<\n Ark.RootProps,\n \"color\" | \"multiple\" | \"value\" | \"defaultValue\" | \"onValueChange\" | \"deselectable\" | \"onChange\"\n> &\n WithTestId & {\n /** Palette for every item, as a `data-color` on the group. */\n color?: Color\n /** Treatment of the unselected items. */\n variant?: ButtonVariant\n /** Treatment of the selected items. */\n selectedVariant?: ButtonVariant\n size?: ButtonSize\n /** Red invalid ring around the group. */\n invalid?: boolean\n /** Lands on the group root, which forwards focus to its active item. Ark's\n * prop types carry no `ref`, so it is declared here. */\n ref?: Ref<HTMLDivElement>\n children?: ReactNode\n }\n\nconst sameValues = (a: readonly string[], b: readonly string[]) =>\n a.length === b.length && a.every((v, i) => v === b[i])\n\n/**\n * Tab entry for a single-choice group. Every item is `tabindex=-1` while focus is\n * outside, so Tab lands on the root, and zag then forwards focus to the *first*\n * item regardless of the selection. A radio group should land on the checked\n * radio instead, so in single mode the root's own focus is caught in the capture\n * phase and sent to the selected (enabled) item. `stopPropagation` there stops\n * the native event before React's bubble listener runs, which is what keeps\n * zag's `ROOT.FOCUS` (and its deferred focus-first) from firing. With nothing\n * selected, zag's own behaviour stands.\n */\nconst focusSelectedItem = (event: FocusEvent<HTMLDivElement>) => {\n if (event.target !== event.currentTarget) return\n const selected = event.currentTarget.querySelector<HTMLElement>(\n ':scope > [data-state=\"on\"]:not([disabled])',\n )\n if (!selected) return\n event.stopPropagation()\n selected.focus({ preventScroll: true })\n}\n\n/**\n * RTL arrow keys. zag's toggle-group reads `event.key` without passing `dir` to\n * `getEventKey` (its other machines do), so in a right-to-left locale ArrowLeft\n * moves focus visually *right*. In a horizontal RTL group the two keys are\n * caught in the capture phase, before zag's handler, and focus moves to the\n * visually adjacent enabled item instead; zag then picks up the new focus\n * through the item's own `onFocus`. `dir` is read off the root, where the\n * machine writes the locale's direction.\n */\nconst mirrorRtlArrows = (loop: boolean) => (event: KeyboardEvent<HTMLDivElement>) => {\n const root = event.currentTarget\n if (root.dir !== \"rtl\" || root.getAttribute(\"data-orientation\") !== \"horizontal\") return\n if (event.key !== \"ArrowLeft\" && event.key !== \"ArrowRight\") return\n const items = Array.from(\n root.querySelectorAll<HTMLElement>(':scope > [data-part=\"item\"]:not([disabled])'),\n )\n const index = items.indexOf(event.target as HTMLElement)\n if (index === -1) return\n event.preventDefault()\n event.stopPropagation()\n // Visually left is the next item in RTL, visually right the previous one.\n const step = event.key === \"ArrowLeft\" ? 1 : -1\n const next = loop\n ? items[(index + step + items.length) % items.length]\n : items[Math.min(Math.max(index + step, 0), items.length - 1)]\n next?.focus()\n}\n\n/** The shared root behind both `ButtonSelect.Root` and `ButtonMultiSelect.Root`. */\nexport const RootBase = ({\n multiple,\n value,\n defaultValue,\n onValueChange,\n deselectable,\n orientation = \"horizontal\",\n color,\n variant = \"light\",\n selectedVariant = \"filled\",\n size = \"md\",\n invalid,\n loopFocus = true,\n className,\n testId,\n children,\n ...rest\n}: BaseRootProps & {\n multiple: boolean\n value?: string[]\n defaultValue?: string[]\n onValueChange?: (value: string[]) => void\n deselectable?: boolean\n}) => {\n const field = useFieldContext()\n // Owned here so a change can be compared with the current value: in a\n // non-deselectable single group the machine re-emits the same value when the\n // selected item is clicked again, and that is not a change.\n const [selected, setSelected] = useUncontrolled<string[]>({\n value,\n defaultValue,\n finalValue: [],\n onChange: onValueChange,\n })\n return (\n <ButtonSelectStyleContext.Provider value={{ variant, selectedVariant, size }}>\n <Ark.Root\n multiple={multiple}\n value={selected}\n onValueChange={(details) => {\n if (!sameValues(details.value, selected)) setSelected(details.value)\n }}\n deselectable={deselectable}\n orientation={orientation}\n loopFocus={loopFocus}\n onFocusCapture={multiple ? undefined : focusSelectedItem}\n onKeyDownCapture={mirrorRtlArrows(loopFocus)}\n data-color={color}\n {...props({ \"aria-invalid\": invalid, \"data-invalid\": invalid, \"data-testid\": testId })}\n {...fieldA11yProps(field)}\n className={cn(buttonGroupVariants({ orientation }), invalidRing, className)}\n {...rest}\n >\n {children}\n </Ark.Root>\n </ButtonSelectStyleContext.Provider>\n )\n}\n\nexport type ButtonSelectRootProps = BaseRootProps & {\n /** Controlled value. `null` clears the selection. */\n value?: string | null\n /** Uncontrolled initial value. */\n defaultValue?: string | null\n /** Fires with the newly selected value — `null` only when `deselectable`. */\n onChange?: (value: string | null) => void\n /** Clicking the selected item clears the selection. Off by default, so the\n * group behaves like a radio group. */\n deselectable?: boolean\n}\n\nconst toArray = (value: string | null | undefined) =>\n value === undefined ? undefined : value === null ? [] : [value]\n\n/** Single-choice root: one selected item at most. */\nexport const Root = ({\n value,\n defaultValue,\n onChange,\n deselectable = false,\n ...rest\n}: ButtonSelectRootProps) => (\n <RootBase\n multiple={false}\n value={toArray(value)}\n defaultValue={toArray(defaultValue)}\n onValueChange={(next) => onChange?.(next[0] ?? null)}\n deselectable={deselectable}\n {...rest}\n />\n)\n\nexport type ButtonMultiSelectRootProps = BaseRootProps & {\n /** Controlled value. */\n value?: string[]\n /** Uncontrolled initial value. */\n defaultValue?: string[]\n /** Fires with every selected value, in selection order. */\n onChange?: (value: string[]) => void\n}\n\n/** Multiple-choice root: each item toggles independently. */\nexport const MultiRoot = ({ onChange, ...rest }: ButtonMultiSelectRootProps) => (\n <RootBase multiple onValueChange={onChange} {...rest} />\n)\n\n/** The props `Item` hands a custom control under `asChild`. */\ntype SelectableControlProps = { variant?: ButtonVariant; size?: ButtonSize }\n\nexport type ButtonSelectItemProps =\n | (Omit<ButtonProps, \"value\" | \"variant\" | \"size\" | \"loading\" | \"asChild\"> & {\n /** The value this item selects. */\n value: string\n asChild?: false\n })\n | {\n /** The value this item selects. */\n value: string\n disabled?: boolean\n /**\n * Render your own variant-aware control instead of a `Button` — e.g. an\n * `ActionIcon` for an icon-only toolbar. The single child receives the\n * selection-driven `variant` and the group `size` (its own `size` wins),\n * plus the machine's item props.\n */\n asChild: true\n children: ReactElement<SelectableControlProps>\n }\n\n/**\n * One option, rendered as a `Button`. Its `variant` follows the selection (from\n * `Root`'s `variant` / `selectedVariant`); every other `Button` prop — `color`,\n * `startSlot`, `endSlot`, `aria-label` for an icon-only item, `testId` — passes\n * through. The machine's item props land on the button via Ark's `asChild`.\n *\n * With `asChild`, the single child is rendered in place of the `Button` and\n * cloned with the same `variant` / `size`, so any control speaking the kit's\n * variant × size vocabulary (`ActionIcon`, a consumer's own) can be an item.\n */\nexport const Item = (props: ButtonSelectItemProps) => {\n const { variant, selectedVariant, size } = useContext(ButtonSelectStyleContext)\n const { value, disabled } = props\n const { pressed } = useToggleGroupContext().getItemState({ value, disabled })\n const resolvedVariant = pressed ? selectedVariant : variant\n if (props.asChild) {\n const child = Children.only(props.children)\n return (\n <Ark.Item value={value} disabled={disabled} asChild>\n {cloneElement(child, { variant: resolvedVariant, size: child.props.size ?? size })}\n </Ark.Item>\n )\n }\n const { value: _value, disabled: _disabled, asChild: _asChild, ...rest } = props\n return (\n <Ark.Item value={value} disabled={disabled} asChild>\n <Button variant={resolvedVariant} size={size} {...rest} />\n </Ark.Item>\n )\n}\n\n/**\n * One hidden input per selected value, so a native `<form>` submit carries the\n * selection under `name`. Rendered *beside* the root, never inside it: the join\n * selectors target the root's children by `:first-child` / `:last-child`, which a\n * trailing input would throw off.\n */\nexport const HiddenInputs = ({\n name,\n value,\n disabled,\n}: {\n name?: string\n value: readonly string[]\n disabled?: boolean\n}) =>\n name == null\n ? null\n : value.map((v) => <input key={v} type=\"hidden\" name={name} value={v} disabled={disabled} />)\n\nexport const Context = Ark.Context\n","import type { ReactNode } from \"react\"\nimport type { Color } from \"../../lib/colors\"\n\n/**\n * One option of a data-driven `ButtonSelect` / `ButtonMultiSelect`: a bare\n * value-as-label string, or a labelled object. `payload` is arbitrary data the\n * machine ignores; it reaches `renderItem` typed off the `data` shape — the same\n * contract as `SegmentGroup` and `Select`.\n */\nexport type ButtonSelectItem<P = unknown> =\n | string\n | {\n value: string\n label?: ReactNode\n /** Content before the label, e.g. an icon (Button's `startSlot`). */\n startSlot?: ReactNode\n /** Content after the label (Button's `endSlot`). */\n endSlot?: ReactNode\n disabled?: boolean\n /** Overrides the group palette for this item. */\n color?: Color\n /** Accessible name — required when `label` is an icon only. */\n \"aria-label\"?: string\n /** Arbitrary extra data, surfaced to `renderItem`. */\n payload?: P\n /** `data-testid` on the rendered button. Defaults to `` `item-${value}` ``. */\n testId?: string\n }\n\n/** The `data` array both components are generic over. */\nexport type ButtonSelectData<P = unknown> = ReadonlyArray<ButtonSelectItem<P>>\n\n/** The value-string union of a `ButtonSelectData` shape; a `const` type\n * parameter narrows it to the literal union. */\nexport type ButtonSelectValue<Data extends ButtonSelectData> = ItemValue<Data[number]>\ntype ItemValue<E> = E extends string ? E : E extends { value: infer V extends string } ? V : never\n\n/** The `payload` type carried by a `ButtonSelectData` shape. */\nexport type ButtonSelectPayload<Data extends ButtonSelectData> = PayloadOf<Data[number]>\ntype PayloadOf<T> = T extends string ? never : T extends { payload?: infer P } ? P : never\n\n/** The item handed to `renderItem`, narrowed to the data's value and payload. */\nexport type RenderableButtonSelectItem<Data extends ButtonSelectData> = {\n value: ButtonSelectValue<Data>\n label: ReactNode\n disabled: boolean\n color: Color | undefined\n payload: ButtonSelectPayload<Data> | undefined\n}\n\n/** Live item state passed alongside the item to `renderItem`. */\nexport type ButtonSelectItemState = {\n selected: boolean\n disabled: boolean\n}\n\n/**\n * Render an item's label yourself. The item keeps its button, sizing, variant\n * and selection wiring; you fill its content. In an RSC tree the function must\n * live in a `\"use client\"` module.\n */\nexport type RenderButtonSelectItem<Data extends ButtonSelectData> = (\n item: RenderableButtonSelectItem<Data>,\n state: ButtonSelectItemState,\n) => ReactNode\n\n/** A fully resolved item — every field present (`label` falls back to `value`). */\nexport type NormalizedButtonSelectItem = {\n value: string\n label: ReactNode\n startSlot: ReactNode\n endSlot: ReactNode\n disabled: boolean\n color: Color | undefined\n ariaLabel: string | undefined\n payload: unknown\n testId: string\n}\n\nexport const normalizeButtonSelectItem = (item: ButtonSelectItem): NormalizedButtonSelectItem =>\n typeof item === \"string\"\n ? {\n value: item,\n label: item,\n startSlot: undefined,\n endSlot: undefined,\n disabled: false,\n color: undefined,\n ariaLabel: undefined,\n payload: undefined,\n testId: `item-${item}`,\n }\n : {\n value: item.value,\n label: item.label ?? item.value,\n startSlot: item.startSlot,\n endSlot: item.endSlot,\n disabled: item.disabled ?? false,\n color: item.color,\n ariaLabel: item[\"aria-label\"],\n payload: item.payload,\n testId: item.testId ?? `item-${item.value}`,\n }\n","\"use client\"\n\nimport type { FocusEvent, Ref } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport type { ButtonSize, ButtonVariant } from \"../button/button\"\nimport { type FieldProps, FieldShell } from \"../field/field\"\nimport { HiddenInputs, Item, RootBase } from \"./button-select\"\nimport {\n type ButtonSelectData,\n normalizeButtonSelectItem,\n type RenderButtonSelectItem,\n} from \"./button-select-items\"\n\ntype ButtonSelectClassNames = {\n field?: string\n /** The label element itself — e.g. `\"sr-only\"` to keep the accessible name\n * without showing it. */\n label?: string\n root?: string\n item?: string\n}\n\n/** Props shared by the data-driven `ButtonSelect` and `ButtonMultiSelect`. */\nexport type ButtonSelectBaseProps<Data extends ButtonSelectData> = Pick<\n FieldProps,\n \"label\" | \"description\" | \"error\" | \"required\"\n> &\n WithTestId & {\n /** Items: bare strings (`value === label`) or `{ value, label?, startSlot?, … }`. */\n data: Data\n /** Render each item's content yourself, with its typed `payload`. */\n renderItem?: RenderButtonSelectItem<Data>\n /** Lay the items in a row (default) or a column. */\n orientation?: \"horizontal\" | \"vertical\"\n /** Red invalid state, independent of (and OR'd with) `error`. */\n invalid?: boolean\n /** Dims and blocks every item. */\n disabled?: boolean\n size?: ButtonSize\n /** Treatment of the unselected items. Defaults to `light`. */\n variant?: ButtonVariant\n /** Treatment of the selected items. Defaults to `filled`. */\n selectedVariant?: ButtonVariant\n color?: Color\n /** Renders a hidden input per selected value for native form submission. */\n name?: string\n /** Explicit id for the group root. */\n id?: string\n /** Lands on the group root, which forwards focus to its active item. */\n ref?: Ref<HTMLDivElement>\n /** Forwarded to the root; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLDivElement>) => void\n className?: string\n classNames?: ButtonSelectClassNames\n }\n\n/**\n * The rendering both data forms share: the `Field` wrapper, the group root, one\n * `Item` per entry and the hidden inputs. The public components only adapt their\n * value shape (`V | null` or `V[]`) onto the machine's `string[]`.\n */\nexport const ButtonSelectControl = ({\n multiple,\n deselectable,\n value,\n onValueChange,\n data,\n renderItem,\n orientation,\n invalid,\n disabled,\n required,\n size = \"md\",\n variant,\n selectedVariant,\n color,\n name,\n id,\n ref,\n onBlur,\n label,\n description,\n error,\n className,\n classNames,\n testId,\n}: ButtonSelectBaseProps<ButtonSelectData> & {\n multiple: boolean\n deselectable?: boolean\n value: readonly string[]\n onValueChange: (value: string[]) => void\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 || error != null\n const items = data.map(normalizeButtonSelectItem)\n\n return (\n <FieldShell\n label={label}\n description={description}\n error={error}\n required={required}\n disabled={disabled}\n size={size}\n className={classNames?.field}\n classNames={{ label: classNames?.label }}\n >\n <RootBase\n multiple={multiple}\n deselectable={deselectable}\n value={[...value]}\n onValueChange={onValueChange}\n orientation={orientation}\n disabled={disabled}\n invalid={isInvalid}\n size={size}\n variant={variant}\n selectedVariant={selectedVariant}\n color={color}\n id={id}\n ref={ref}\n onBlur={onBlur}\n testId={testId}\n className={cn(className, classNames?.root)}\n >\n {items.map((item) => (\n <Item\n key={item.value}\n value={item.value}\n disabled={item.disabled}\n color={item.color}\n startSlot={item.startSlot}\n endSlot={item.endSlot}\n aria-label={item.ariaLabel}\n testId={item.testId}\n className={classNames?.item}\n >\n {renderItem\n ? renderItem(item, {\n selected: value.includes(item.value),\n disabled: Boolean(disabled) || item.disabled,\n })\n : item.label}\n </Item>\n ))}\n </RootBase>\n <HiddenInputs name={name} value={value} disabled={disabled} />\n </FieldShell>\n )\n}\n"]}
@@ -1,11 +1,11 @@
1
- import { Slider } from './chunk-UAYENYS2.js';
1
+ import { Slider } from './chunk-AKXALCUN.js';
2
2
  import { cutoutMask } from './chunk-K6YASO4L.js';
3
3
  import { MEDIA_RADIUS } from './chunk-J43LSYQO.js';
4
- import { useObjectUrl } from './chunk-TCFB23JT.js';
4
+ import { useObjectUrl } from './chunk-WERJ44ZN.js';
5
5
  import { useMergedRefs } from './chunk-HBWV5EPU.js';
6
6
  import { ratioToNumber } from './chunk-AHM6SGEU.js';
7
- import { useLocale, useDirectionCheck } from './chunk-IPYHTCFL.js';
8
- import { ActionIcon } from './chunk-BE2LWUHY.js';
7
+ import { useLocale, useDirectionCheck } from './chunk-IUK7OJXZ.js';
8
+ import { ActionIcon } from './chunk-BMEJBY6H.js';
9
9
  import { iconStroke, mergeIcons } from './chunk-XXOR34T4.js';
10
10
  import { props } from './chunk-WYCMIIRR.js';
11
11
  import { focusStyles } from './chunk-C6NVU4F7.js';
@@ -433,5 +433,5 @@ var ImageCropper = Object.assign(ImageCropperComponent, {
433
433
  });
434
434
 
435
435
  export { ImageCropper, useImageCropperContext };
436
- //# sourceMappingURL=chunk-47LEAR6G.js.map
437
- //# sourceMappingURL=chunk-47LEAR6G.js.map
436
+ //# sourceMappingURL=chunk-Y2G47ARQ.js.map
437
+ //# sourceMappingURL=chunk-Y2G47ARQ.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/image-cropper/image-cropper.tsx"],"names":["shape","Ark","useArkImageCropperContext"],"mappings":";;;;;;;;;;;;;;;;;;;AA+GO,IAAM,oBAAA,GAA2D;AAAA,EACtE,KAAA,EAAO,eAAA;AAAA,EACP,eAAA,EAAiB,eAAA;AAAA,EACjB,OAAA,EAAS,mBAAA;AAAA,EACT,OAAA,EAAS,CAAC,EAAE,IAAA,EAAM,UAAU,CAAA,EAAG,CAAA,EAAG,OAAO,MAAA,EAAO,KAC9C,QAAQ,IAAI,CAAA,UAAA,EAAa,QAAQ,CAAA,UAAA,EAAa,CAAC,wBAAwB,CAAC,CAAA,iBAAA,EAAoB,KAAK,CAAA,MAAA,EAAS,MAAM,CAAA,GAAA,CAAA;AAAA,EAClH,cAAA,EAAgB,CAAC,KAAA,KAAU,CAAA,gBAAA,EAAmB,KAAK,CAAA,CAAA,CAAA;AAAA,EACnD,wBAAA,EAA0B,WAAA;AAAA,EAC1B,qBAAA,EACE,8GAAA;AAAA,EACF,gBAAgB,CAAC,EAAE,KAAA,EAAO,CAAA,EAAG,GAAG,KAAA,EAAO,MAAA,EAAO,KAC5C,KAAA,CAAM,KAAK,CAAA,CACR,IAAA,CAAK,QAAA,EAAU,MAAM,cAAc,CAAC,CAAA,MAAA,EAAS,CAAC,CAAA,aAAA,EAAgB,KAAK,CAAA,GAAA,CAAK,CAAA,CACxE,IAAA,CA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AAA,EACf,UAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA,EAAS,QAAA;AAAA,EACT,GAAG;AACL,CAAA,qBACE,IAAA,CAAC,gBAAA,EAAA,EAAkB,GAAG,IAAA,EACpB,QAAA,EAAA;AAAA,kBAAA,IAAA,CAAC,oBAAA,EAAA,EAAqB,MAAA,EAAgB,SAAA,EAAW,UAAA,EAAY,QAAA,EAC3D,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,iBAAA,EAAA,EAAkB,GAAA,EAAU,WAAA,EAA0B,SAAA,EAAW,YAAY,KAAA,EAAO,CAAA;AAAA,oBACrF,GAAA,CAAC,qBAAA,EAAA,EAAsB,QAAA,EAAoB,SAAA,EAAW,YAAY,SAAA,EAAW;AAAA,GAAA,EAC/E,CAAA;AAAA,EACC,YAAA,oBAAgB,GAAA,CAAC,oBAAA,EAAA,EAAqB,SAAA,EAAW,YAAY,QAAA,EAAU,CAAA;AAAA,EACvE;AAAA,CAAA,EACH,CAAA;AAGK,IAAM,YAAA,GAAe,MAAA,CAAO,MAAA,CAAO,qBAAA,EAAuB;AAAA,EAC/D,IAAA,EAAM,gBAAA;AAAA,EACN,QAAA,EAAU,oBAAA;AAAA,EACV,KAAA,EAAO,iBAAA;AAAA,EACP,SAAA,EAAW,qBAAA;AAAA,EACX,MAAA,EAAQ,kBAAA;AAAA,EACR,IAAA,EAAM,gBAAA;AAAA,EACN,QAAA,EAAU,oBAAA;AAAA,EACV,OAAA,EAAS;AACX,CAAC","file":"chunk-47LEAR6G.js","sourcesContent":["\"use client\"\n\nimport {\n ImageCropper as Ark,\n type ImageCropperRootProps as ArkRootProps,\n type ImageCropperCropChangeDetails,\n type ImageCropperFlipState,\n type ImageCropperHandlePosition,\n type UseImageCropperContext,\n useImageCropperContext as useArkImageCropperContext,\n} from \"@ark-ui/react/image-cropper\"\nimport {\n FlipHorizontal2,\n FlipVertical2,\n RefreshCcw,\n RotateCcw,\n RotateCw,\n ZoomIn,\n ZoomOut,\n} from \"lucide-react\"\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type ReactNode,\n type Ref,\n useContext,\n useMemo,\n} from \"react\"\nimport { match } from \"ts-pattern\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { cutoutMask } from \"../../lib/cutout\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { useDirectionCheck, useLocale } from \"../../lib/intl\"\nimport { useMergedRefs } from \"../../lib/merge-refs\"\nimport { props } from \"../../lib/props\"\nimport { MEDIA_RADIUS, type MediaRadius } from \"../../lib/radius\"\nimport { type Ratio, ratioToNumber } from \"../../lib/ratio\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TYPOGRAPHY_SHADE_CLASSES } from \"../../lib/typography-size\"\nimport { useObjectUrl } from \"../../lib/use-object-url\"\nimport { ActionIcon } from \"../action-icon/action-icon\"\nimport { Slider } from \"../slider/slider\"\n\n/**\n * ImageCropper — pick the part of an image to keep: drag the selection, pull\n * its handles, pinch or wheel to zoom, rotate and flip, then export the crop.\n *\n * <ImageCropper src={file} ratio={1} shape=\"circle\" withControls>\n * <ImageCropper.Context>\n * {(api) => <Button onClick={() => api.getCroppedImage().then(upload)}>Save</Button>}\n * </ImageCropper.Context>\n * </ImageCropper>\n *\n * Built on Ark's image cropper (a \"preview\" component in Ark 5.39, see the\n * docs page), which owns the geometry, the gestures, the keyboard and the\n * canvas export. The kit adds the look (an outside dim, handles that survive\n * forced colors), the controls, `src` as a `Blob`, `ratio` in the media\n * components' shape, flattened callbacks and translations with\n * locale-formatted numbers.\n *\n * The result is read from `ImageCropper.Context`, not an imperative ref:\n * `getCroppedImage()` draws the crop to a canvas and resolves a `Blob` (or a\n * data URL), `getCropData()` returns the crop in the image's own pixels for a\n * server to cut.\n */\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport type ImageCropperShape = \"rectangle\" | \"circle\"\nexport type ImageCropperFlip = ImageCropperFlipState\n/** A crop rectangle, in px of the viewport. */\nexport type ImageCropperRect = ImageCropperCropChangeDetails[\"crop\"]\nexport type { ImageCropperHandlePosition }\n\n/** A crop rectangle with every number already formatted for the locale. */\nexport type ImageCropperFormattedRect = { x: string; y: string; width: string; height: string }\n\nexport type ImageCropperTranslations = {\n /** The cropper's accessible name. */\n label?: string\n /** What kind of thing the cropper is, announced with its name. */\n roleDescription?: string\n /** The cropper's description while the image loads. */\n loading?: string\n /** The cropper's description once the image is ready. `zoom` is a percent, `rotation` in degrees. */\n preview?: (details: ImageCropperFormattedRect & { zoom: string; rotation: string }) => string\n /** The selection's accessible name. */\n selectionLabel?: (shape: ImageCropperShape) => string\n /** What kind of thing the selection is. Ark's default is the APG \"2d slider\". */\n selectionRoleDescription?: string\n /** How to move it from the keyboard, read as the selection's description. */\n selectionInstructions?: string\n /** The selection's `aria-valuetext`: where it is and how big. */\n selectionValue?: (details: ImageCropperFormattedRect & { shape: ImageCropperShape }) => string\n /** Names the group of controls. */\n controlsLabel?: string\n zoomLabel?: string\n /** The zoom slider's `aria-valuetext`. `percent` is formatted (`\"150%\"`). */\n zoomValue?: (percent: string) => string\n rotateLeftLabel?: string\n rotateRightLabel?: string\n flipHorizontalLabel?: string\n flipVerticalLabel?: string\n resetLabel?: string\n}\n\nexport const DEFAULT_TRANSLATIONS: Required<ImageCropperTranslations> = {\n label: \"Image cropper\",\n roleDescription: \"image cropper\",\n loading: \"Loading the image\",\n preview: ({ zoom, rotation, x, y, width, height }) =>\n `Zoom ${zoom}, rotated ${rotation}. Crop at ${x}px from the left and ${y}px from the top, ${width}px by ${height}px.`,\n selectionLabel: (shape) => `Crop selection (${shape})`,\n selectionRoleDescription: \"2d slider\",\n selectionInstructions:\n \"Use the arrow keys to move the crop. Hold Alt with the arrow keys to resize it. Press plus or minus to zoom.\",\n selectionValue: ({ shape, x, y, width, height }) =>\n match(shape)\n .with(\"circle\", () => `Position X ${x}px, Y ${y}px. Diameter ${width}px.`)\n .with(\"rectangle\", () => `Position X ${x}px, Y ${y}px. Size ${width}px by ${height}px.`)\n .exhaustive(),\n controlsLabel: \"Crop controls\",\n zoomLabel: \"Zoom\",\n zoomValue: (percent) => percent,\n rotateLeftLabel: \"Rotate left\",\n rotateRightLabel: \"Rotate right\",\n flipHorizontalLabel: \"Flip horizontally\",\n flipVerticalLabel: \"Flip vertically\",\n resetLabel: \"Reset\",\n}\n\ntype ArkTranslations = NonNullable<ArkRootProps[\"translations\"]>\n\n/** What the Root shares with the parts Ark's context doesn't cover. */\nexport type ImageCropperIconSlot =\n | \"rotateLeft\"\n | \"rotateRight\"\n | \"flipHorizontal\"\n | \"flipVertical\"\n | \"zoomOut\"\n | \"zoomIn\"\n | \"reset\"\nexport type ImageCropperIcons = IconMap<ImageCropperIconSlot>\n\n/**\n * The default icons of `ImageCropper.Controls`, named like the\n * `translations` labels of the buttons they sit in. None of them points along\n * the inline axis (a rotation turns the same way in either direction, and the\n * zoom glyphs sit at the slider's start and end), so none mirrors under RTL.\n */\nexport const DEFAULT_ICONS: Record<ImageCropperIconSlot, ReactNode> = {\n rotateLeft: <RotateCcw className={iconStroke} />,\n rotateRight: <RotateCw className={iconStroke} />,\n flipHorizontal: <FlipHorizontal2 className={iconStroke} />,\n flipVertical: <FlipVertical2 className={iconStroke} />,\n zoomOut: <ZoomOut className={iconStroke} />,\n zoomIn: <ZoomIn className={iconStroke} />,\n reset: <RefreshCcw className={iconStroke} />,\n}\n\ntype Shared = {\n t: Required<ImageCropperTranslations>\n icons: Record<ImageCropperIconSlot, ReactNode>\n percent: (value: number) => string\n minZoom: number\n maxZoom: number\n shape: ImageCropperShape\n /** The locked width / height (1 for a circle), which the export holds to the pixel. */\n aspect: number | undefined\n}\n\nconst SharedContext = createContext<Shared>({\n t: DEFAULT_TRANSLATIONS,\n icons: DEFAULT_ICONS,\n percent: String,\n minZoom: 1,\n maxZoom: 5,\n shape: \"rectangle\",\n aspect: undefined,\n})\n\n// ---------------------------------------------------------------------------\n// Styles\n// ---------------------------------------------------------------------------\n\n/**\n * Each handle's hit box and visible mark, by position. Ark already places the\n * handle on the selection's edge (`top`/`left`/`right`/`bottom`, centered\n * with `translate`, edges at 96% of the side); this sizes the hit box and\n * shapes the mark, an `::after` centered in it, so the handle stays a bare\n * element any `asChild` child can become.\n *\n * The mark is the Slider thumb: a palette border on the page-tinted fill.\n * Corners are round thumbs, edges are pills along their side. The hit box is\n * 24px under a mouse and 44px (WCAG 2.5.8) under a finger, around the same\n * small mark.\n *\n * Physical sides, not logical ones: the crop is a rectangle in the image's own\n * space, where `e` is the image's right edge whatever the text direction, and\n * Ark positions the handles that way too.\n *\n * Corners sit above the edge bars (`z-1`), which overlap them at 96% of the\n * side, so a press near a corner resizes both ways. On a circle only the four\n * edge pills show: they're the points that touch it.\n */\nconst HANDLE: Record<ImageCropperHandlePosition, string> = {\n nw: \"z-1 size-6 pointer-coarse:size-11 after:size-3.5 in-data-[shape=circle]:after:hidden\",\n ne: \"z-1 size-6 pointer-coarse:size-11 after:size-3.5 in-data-[shape=circle]:after:hidden\",\n se: \"z-1 size-6 pointer-coarse:size-11 after:size-3.5 in-data-[shape=circle]:after:hidden\",\n sw: \"z-1 size-6 pointer-coarse:size-11 after:size-3.5 in-data-[shape=circle]:after:hidden\",\n n: \"h-6 pointer-coarse:h-11 after:h-2 after:w-6\",\n s: \"h-6 pointer-coarse:h-11 after:h-2 after:w-6\",\n e: \"w-6 pointer-coarse:w-11 after:h-6 after:w-2\",\n w: \"w-6 pointer-coarse:w-11 after:h-6 after:w-2\",\n}\n\n/** A ≥ 44px control (WCAG 2.5.8). */\nconst control = \"h-11 [&_svg]:size-5\"\n/** The zoom slider's end glyphs: decorative, the slider carries the name. */\nconst zoomIcon = \"flex shrink-0 [&_svg]:size-4\"\n\n// ---------------------------------------------------------------------------\n// Root\n// ---------------------------------------------------------------------------\n\nexport type ImageCropperRootProps = Omit<\n ArkRootProps,\n | \"aspectRatio\"\n | \"cropShape\"\n | \"translations\"\n | \"onZoomChange\"\n | \"onRotationChange\"\n | \"onFlipChange\"\n | \"onCropChange\"\n> &\n WithTestId & {\n /** Locks the selection to this width / height. Free when unset; a circle is always 1. */\n ratio?: Ratio\n /** A circle crop still exports a square: mask it where you show it. */\n shape?: ImageCropperShape\n /** Fires as the zoom changes, from 1 (fit) up. */\n onZoomChange?: (zoom: number) => void\n /** Fires as the rotation changes, in degrees. */\n onRotationChange?: (rotation: number) => void\n onFlipChange?: (flip: ImageCropperFlip) => void\n /** Fires as the selection moves or resizes, in px of the viewport. */\n onCropChange?: (crop: ImageCropperRect) => void\n translations?: ImageCropperTranslations\n /** Replaces the control icons: `rotateLeft`, `rotateRight`, `flipHorizontal`,\n * `flipVertical`, `zoomOut`, `zoomIn`, `reset`. Drawn as given, never restroked. */\n icons?: ImageCropperIcons\n /**\n * The palette of the selection's edge, handles, focus ring and zoom slider.\n * `brand` by default: on a photo, the kit's black-and-white default palette\n * would read as plain chrome rather than as a control.\n */\n color?: Color\n ref?: Ref<HTMLDivElement>\n }\n\n/** `\"16/9\"` → `1.777…`, and nothing for a ratio that can't lock a selection. */\nconst aspectRatioOf = (ratio: Ratio | undefined) => {\n const value = ratio === undefined ? Number.NaN : ratioToNumber(ratio)\n return Number.isFinite(value) && value > 0 ? value : undefined\n}\n\nconst ImageCropperRoot = ({\n ratio,\n shape,\n onZoomChange,\n onRotationChange,\n onFlipChange,\n onCropChange,\n translations,\n icons,\n minZoom = 1,\n maxZoom = 5,\n color = \"brand\",\n className,\n testId,\n ref,\n ...rest\n}: ImageCropperRootProps) => {\n const locale = useLocale()\n const direction = useDirectionCheck()\n\n const [shared, arkTranslations] = useMemo(() => {\n const t = { ...DEFAULT_TRANSLATIONS, ...translations }\n const pixels = new Intl.NumberFormat(locale, { maximumFractionDigits: 0 })\n const percent = new Intl.NumberFormat(locale, { style: \"percent\", maximumFractionDigits: 0 })\n const degrees = new Intl.NumberFormat(locale, {\n style: \"unit\",\n unit: \"degree\",\n maximumFractionDigits: 0,\n })\n const rect = ({ x, y, width, height }: ImageCropperRect): ImageCropperFormattedRect => ({\n x: pixels.format(x),\n y: pixels.format(y),\n width: pixels.format(width),\n height: pixels.format(height),\n })\n const ark: ArkTranslations = {\n rootLabel: t.label,\n rootRoleDescription: t.roleDescription,\n previewLoading: t.loading,\n previewDescription: ({ crop, zoom, rotation }) =>\n t.preview({\n ...rect(crop),\n zoom: percent.format(zoom ?? 1),\n rotation: degrees.format(rotation ?? 0),\n }),\n selectionLabel: ({ shape }) => t.selectionLabel(shape),\n selectionRoleDescription: t.selectionRoleDescription,\n selectionInstructions: t.selectionInstructions,\n selectionValueText: ({ shape, ...crop }) => t.selectionValue({ shape, ...rect(crop) }),\n }\n const value: Shared = {\n t,\n icons: mergeIcons(DEFAULT_ICONS, icons),\n percent: (n) => percent.format(n),\n minZoom,\n maxZoom,\n shape: shape ?? \"rectangle\",\n aspect: shape === \"circle\" ? 1 : aspectRatioOf(ratio),\n }\n return [value, ark] as const\n }, [translations, icons, locale, minZoom, maxZoom, shape, ratio])\n\n const rootRef = useMergedRefs(ref, direction)\n return (\n <SharedContext value={shared}>\n <Ark.Root\n ref={rootRef}\n aspectRatio={aspectRatioOf(ratio)}\n cropShape={shape}\n minZoom={minZoom}\n maxZoom={maxZoom}\n translations={arkTranslations}\n onZoomChange={onZoomChange && (({ zoom }) => onZoomChange(zoom))}\n onRotationChange={onRotationChange && (({ rotation }) => onRotationChange(rotation))}\n onFlipChange={onFlipChange && (({ flip }) => onFlipChange(flip))}\n onCropChange={onCropChange && (({ crop }) => onCropChange(crop))}\n data-color={color}\n className={cn(\"flex w-full flex-col gap-3\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n </SharedContext>\n )\n}\n\n// ---------------------------------------------------------------------------\n// Parts\n// ---------------------------------------------------------------------------\n\nexport type ImageCropperViewportProps = Ark.ViewportProps &\n WithTestId & {\n /** Corner radius, from the media scale. */\n radius?: MediaRadius\n }\n\n/** The frame the image is cropped in. Takes the pan, wheel and pinch gestures. */\nconst ImageCropperViewport = ({\n radius = \"xs\",\n className,\n testId,\n ...rest\n}: ImageCropperViewportProps) => (\n <Ark.Viewport\n className={cn(\n \"relative touch-none select-none overflow-clip bg-black/80\",\n MEDIA_RADIUS[radius],\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ImageCropperImageProps = NoAsChild<\n Omit<Ark.ImageProps, \"src\"> &\n WithTestId & {\n /** A URL, or a `Blob` / `File`, shown through an object URL that's revoked when it changes. */\n src: string | Blob\n }\n>\n\n/**\n * The image being cropped. Decorative to assistive technology: the cropper's\n * own description says what's selected. Fades in once Ark has measured it.\n *\n * A cross-origin URL needs `crossOrigin=\"anonymous\"` (and CORS headers on the\n * server) for `getCroppedImage()`; without them the canvas is tainted and the\n * export resolves `null`.\n */\nconst ImageCropperImage = ({\n src,\n className,\n testId,\n asChild: _asChild,\n ...rest\n}: ImageCropperImageProps) => {\n const url = useObjectUrl(src)\n return (\n <Ark.Image\n src={url}\n className={cn(\n \"block h-auto w-full max-w-none opacity-0 data-ready:opacity-100\",\n \"transition-opacity duration-(--duration-normal) ease-standard motion-reduce:transition-none\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n )\n}\n\nexport type ImageCropperSelectionProps = NoAsChild<\n Ark.SelectionProps &\n WithTestId & {\n /** Rule-of-thirds lines inside the selection, shown while it's dragged or resized. */\n withGrid?: boolean\n }\n>\n\n/** The selection's hole in the dim: Ark sets the crop rectangle as custom properties on the root. */\nconst CROP_RECT = {\n x: \"var(--crop-x)\",\n y: \"var(--crop-y)\",\n width: \"var(--crop-width)\",\n height: \"var(--crop-height)\",\n}\n\n/**\n * The crop area: a `role=\"slider\"` that moves with the arrow keys, resizes\n * with Alt + arrows and zooms with `+`/`-`.\n *\n * Everything outside it is dimmed like a Modal backdrop by an overlay drawn\n * just before it, with the selection cut out of it (`lib/cutout.ts`): a real\n * rectangle or circle, following the crop through Ark's `--crop-*` custom\n * properties without a render. The overlay steps aside in forced colors,\n * where it would paint `Canvas` over the image; the edge and the handles,\n * borders both, are repainted instead.\n */\nconst ImageCropperSelection = ({\n withGrid = true,\n className,\n testId,\n children,\n asChild: _asChild,\n ...rest\n}: ImageCropperSelectionProps) => {\n const { shape } = useContext(SharedContext)\n return (\n <>\n <div\n aria-hidden\n data-part=\"overlay\"\n data-shape={shape}\n // The Modal backdrop's dim, with a light blur: the frame stays legible\n // around the crop without competing with it.\n className=\"pointer-events-none absolute inset-0 bg-black/50 backdrop-blur-xs forced-colors:hidden\"\n style={cutoutMask(shape, CROP_RECT)}\n />\n <Ark.Selection\n className={cn(\n \"cursor-move border border-(--c-solid) data-[shape=circle]:rounded-full\",\n // A pale halo around the 1px palette edge: two tones, so it holds on a dark photo and a bright one.\n \"shadow-[0_0_0_1px_rgb(255_255_255/0.45)]\",\n \"data-disabled:cursor-default\",\n // Inset and gap-less: the selection can sit flush with the clipping viewport.\n focusStyles({ ring: \"palette\", offset: false, inset: true }),\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {withGrid && (\n <>\n <ImageCropperGrid axis=\"horizontal\" />\n <ImageCropperGrid axis=\"vertical\" />\n </>\n )}\n {Ark.handles.map((position) => (\n <ImageCropperHandle key={position} position={position} />\n ))}\n {children}\n </Ark.Selection>\n </>\n )\n}\n\nexport type ImageCropperHandleProps = Ark.HandleProps & WithTestId\n\n/** One resize handle. `Selection` renders all eight; use it when you compose your own. */\nconst ImageCropperHandle = ({ position, className, testId, ...rest }: ImageCropperHandleProps) => (\n <Ark.Handle\n position={position}\n className={cn(\n \"after:absolute after:top-1/2 after:left-1/2 after:-translate-1/2 after:rounded-full\",\n \"after:border-2 after:border-(--c-solid) after:bg-brand-50 after:shadow-sm dark:after:bg-brand-950\",\n // Grows a touch while held, like the Slider thumb.\n \"after:transition-[scale] after:duration-(--duration-fast) after:ease-standard motion-reduce:after:transition-none\",\n \"in-data-dragging:after:scale-110\",\n \"data-disabled:hidden\",\n HANDLE[position],\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ImageCropperGridProps = Ark.GridProps & WithTestId\n\n/** A pair of rule-of-thirds lines, along `axis`. Fades in while the crop is dragged, resized or panned. */\nconst ImageCropperGrid = ({ className, testId, ...rest }: ImageCropperGridProps) => (\n <Ark.Grid\n className={cn(\n \"border-white/50 data-[axis=horizontal]:border-y data-[axis=vertical]:border-x\",\n \"opacity-0 data-dragging:opacity-100 data-panning:opacity-100\",\n \"transition-opacity duration-(--duration-fast) ease-standard motion-reduce:transition-none\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ImageCropperControlsProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/**\n * Zoom slider, rotate ±90°, flip and reset, wired to the nearest cropper. Each\n * is a 44px button named from `translations`; the flips are toggle buttons.\n */\nconst ImageCropperControls = ({ className, testId, ...rest }: ImageCropperControlsProps) => {\n const api = useImageCropperContext()\n const { t, icons, percent, minZoom, maxZoom } = useContext(SharedContext)\n return (\n // biome-ignore lint/a11y/useSemanticElements: a `<fieldset>` brings UA border/padding/`min-inline-size` that fight this wrapping flex row, for the same `group` semantics\n <div\n role=\"group\"\n aria-label={t.controlsLabel}\n className={cn(\"flex flex-wrap items-center gap-1\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.rotateLeftLabel}\n onClick={() => api.rotateBy(-90)}\n >\n {icons.rotateLeft}\n </ActionIcon>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.rotateRightLabel}\n onClick={() => api.rotateBy(90)}\n >\n {icons.rotateRight}\n </ActionIcon>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.flipHorizontalLabel}\n aria-pressed={api.flip.horizontal}\n onClick={() => api.flipHorizontally()}\n >\n {icons.flipHorizontal}\n </ActionIcon>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.flipVerticalLabel}\n aria-pressed={api.flip.vertical}\n onClick={() => api.flipVertically()}\n >\n {icons.flipVertical}\n </ActionIcon>\n <div\n className={cn(\n \"flex min-w-40 flex-1 items-center gap-2 px-2\",\n TYPOGRAPHY_SHADE_CLASSES.muted,\n )}\n >\n <span aria-hidden className={zoomIcon}>\n {icons.zoomOut}\n </span>\n <Slider\n min={minZoom}\n max={maxZoom}\n step={0.01}\n value={api.zoom}\n onChange={(zoom) => api.setZoom(zoom)}\n aria-label={[t.zoomLabel]}\n getAriaValueText={({ value }) => t.zoomValue(percent(value))}\n classNames={{ field: \"flex-1\" }}\n />\n <span aria-hidden className={zoomIcon}>\n {icons.zoomIn}\n </span>\n </div>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.resetLabel}\n onClick={() => api.reset()}\n >\n {icons.reset}\n </ActionIcon>\n </div>\n )\n}\n\ntype CropExport = UseImageCropperContext[\"getCroppedImage\"]\n\n/** The size a `width × height` export should have at `aspect`: its short side stretched to match the long one. */\nconst exactSize = (width: number, height: number, aspect: number) =>\n width / height > aspect\n ? { width, height: Math.round(width / aspect) }\n : { width: Math.round(height * aspect), height }\n\n/**\n * Ark's export, held to a locked ratio. Ark sizes the canvas from the image's\n * rounded layout box, scaling each side on its own, so a 1:1 crop can come\n * out 511 × 512. When it does, the crop is exported again losslessly and\n * redrawn at the exact size, then encoded once as asked.\n */\nexport const exactExport =\n (getCroppedImage: CropExport, aspect: number | undefined): CropExport =>\n async (options) => {\n const blob = await getCroppedImage(options)\n if (aspect === undefined || !(blob instanceof Blob) || typeof createImageBitmap !== \"function\")\n return blob\n const shot = await createImageBitmap(blob)\n // Read the size before `close()`: a closed bitmap reports 0 × 0.\n const { width, height } = shot\n shot.close()\n const size = exactSize(width, height, aspect)\n if (size.width === width && size.height === height) return blob\n const lossless = await getCroppedImage({ ...options, type: \"image/png\" })\n if (!(lossless instanceof Blob)) return blob\n const source = await createImageBitmap(lossless)\n const canvas = document.createElement(\"canvas\")\n canvas.width = size.width\n canvas.height = size.height\n const context = canvas.getContext(\"2d\")\n if (!context) return blob\n context.drawImage(source, 0, 0, size.width, size.height)\n source.close()\n return new Promise<Blob | null>((resolve) =>\n canvas.toBlob(resolve, options?.type ?? \"image/png\", options?.quality ?? 1),\n )\n }\n\n/**\n * The nearest cropper's API: Ark's, with `getCroppedImage()` held to the\n * locked ratio (or the circle) to the pixel.\n */\nconst useImageCropperContext = (): UseImageCropperContext => {\n const api = useArkImageCropperContext()\n const { aspect } = useContext(SharedContext)\n return { ...api, getCroppedImage: exactExport(api.getCroppedImage, aspect) }\n}\n\nexport type ImageCropperContextProps = Ark.ContextProps\n\n/** Renders its child function with the cropper's API, for an export button. */\nconst ImageCropperContext = ({ children }: ImageCropperContextProps) =>\n children(useImageCropperContext())\n\n// ---------------------------------------------------------------------------\n// Convenience\n// ---------------------------------------------------------------------------\n\nexport type ImageCropperClassNames = {\n viewport?: string\n image?: string\n selection?: string\n controls?: string\n}\n\nexport type ImageCropperProps = NoAsChild<\n Omit<ImageCropperRootProps, \"children\"> & {\n /** The image to crop: a URL, or a `Blob` / `File` (a pick or a drop). */\n src: string | Blob\n /** Needed on a cross-origin URL for the export to read its pixels. */\n crossOrigin?: ImageCropperImageProps[\"crossOrigin\"]\n /** The viewport's corner radius, from the media scale. */\n radius?: MediaRadius\n /** Rule-of-thirds lines inside the selection, shown while it's dragged or resized. */\n withGrid?: boolean\n /** The zoom slider and the rotate, flip and reset buttons, under the image. */\n withControls?: boolean\n classNames?: ImageCropperClassNames\n /** Rendered last, inside the root: an `ImageCropper.Context` for the export. */\n children?: ReactNode\n }\n>\n\nconst ImageCropperComponent = ({\n src,\n crossOrigin,\n radius,\n withGrid,\n withControls = false,\n classNames,\n children,\n asChild: _asChild,\n ...rest\n}: ImageCropperProps) => (\n <ImageCropperRoot {...rest}>\n <ImageCropperViewport radius={radius} className={classNames?.viewport}>\n <ImageCropperImage src={src} crossOrigin={crossOrigin} className={classNames?.image} />\n <ImageCropperSelection withGrid={withGrid} className={classNames?.selection} />\n </ImageCropperViewport>\n {withControls && <ImageCropperControls className={classNames?.controls} />}\n {children}\n </ImageCropperRoot>\n)\n\nexport const ImageCropper = Object.assign(ImageCropperComponent, {\n Root: ImageCropperRoot,\n Viewport: ImageCropperViewport,\n Image: ImageCropperImage,\n Selection: ImageCropperSelection,\n Handle: ImageCropperHandle,\n Grid: ImageCropperGrid,\n Controls: ImageCropperControls,\n Context: ImageCropperContext,\n})\n\nexport { useImageCropperContext }\n"]}
1
+ {"version":3,"sources":["../src/components/image-cropper/image-cropper.tsx"],"names":["shape","Ark","useArkImageCropperContext"],"mappings":";;;;;;;;;;;;;;;;;;;AA+GO,IAAM,oBAAA,GAA2D;AAAA,EACtE,KAAA,EAAO,eAAA;AAAA,EACP,eAAA,EAAiB,eAAA;AAAA,EACjB,OAAA,EAAS,mBAAA;AAAA,EACT,OAAA,EAAS,CAAC,EAAE,IAAA,EAAM,UAAU,CAAA,EAAG,CAAA,EAAG,OAAO,MAAA,EAAO,KAC9C,QAAQ,IAAI,CAAA,UAAA,EAAa,QAAQ,CAAA,UAAA,EAAa,CAAC,wBAAwB,CAAC,CAAA,iBAAA,EAAoB,KAAK,CAAA,MAAA,EAAS,MAAM,CAAA,GAAA,CAAA;AAAA,EAClH,cAAA,EAAgB,CAAC,KAAA,KAAU,CAAA,gBAAA,EAAmB,KAAK,CAAA,CAAA,CAAA;AAAA,EACnD,wBAAA,EAA0B,WAAA;AAAA,EAC1B,qBAAA,EACE,8GAAA;AAAA,EACF,gBAAgB,CAAC,EAAE,KAAA,EAAO,CAAA,EAAG,GAAG,KAAA,EAAO,MAAA,EAAO,KAC5C,KAAA,CAAM,KAAK,CAAA,CACR,IAAA,CAAK,QAAA,EAAU,MAAM,cAAc,CAAC,CA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AAA;AAAA,EACA,WAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AAAA,EACA,YAAA,GAAe,KAAA;AAAA,EACf,UAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA,EAAS,QAAA;AAAA,EACT,GAAG;AACL,CAAA,qBACE,IAAA,CAAC,gBAAA,EAAA,EAAkB,GAAG,IAAA,EACpB,QAAA,EAAA;AAAA,kBAAA,IAAA,CAAC,oBAAA,EAAA,EAAqB,MAAA,EAAgB,SAAA,EAAW,UAAA,EAAY,QAAA,EAC3D,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,iBAAA,EAAA,EAAkB,GAAA,EAAU,WAAA,EAA0B,SAAA,EAAW,YAAY,KAAA,EAAO,CAAA;AAAA,oBACrF,GAAA,CAAC,qBAAA,EAAA,EAAsB,QAAA,EAAoB,SAAA,EAAW,YAAY,SAAA,EAAW;AAAA,GAAA,EAC/E,CAAA;AAAA,EACC,YAAA,oBAAgB,GAAA,CAAC,oBAAA,EAAA,EAAqB,SAAA,EAAW,YAAY,QAAA,EAAU,CAAA;AAAA,EACvE;AAAA,CAAA,EACH,CAAA;AAGK,IAAM,YAAA,GAAe,MAAA,CAAO,MAAA,CAAO,qBAAA,EAAuB;AAAA,EAC/D,IAAA,EAAM,gBAAA;AAAA,EACN,QAAA,EAAU,oBAAA;AAAA,EACV,KAAA,EAAO,iBAAA;AAAA,EACP,SAAA,EAAW,qBAAA;AAAA,EACX,MAAA,EAAQ,kBAAA;AAAA,EACR,IAAA,EAAM,gBAAA;AAAA,EACN,QAAA,EAAU,oBAAA;AAAA,EACV,OAAA,EAAS;AACX,CAAC","file":"chunk-Y2G47ARQ.js","sourcesContent":["\"use client\"\n\nimport {\n ImageCropper as Ark,\n type ImageCropperRootProps as ArkRootProps,\n type ImageCropperCropChangeDetails,\n type ImageCropperFlipState,\n type ImageCropperHandlePosition,\n type UseImageCropperContext,\n useImageCropperContext as useArkImageCropperContext,\n} from \"@ark-ui/react/image-cropper\"\nimport {\n FlipHorizontal2,\n FlipVertical2,\n RefreshCcw,\n RotateCcw,\n RotateCw,\n ZoomIn,\n ZoomOut,\n} from \"lucide-react\"\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type ReactNode,\n type Ref,\n useContext,\n useMemo,\n} from \"react\"\nimport { match } from \"ts-pattern\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { cutoutMask } from \"../../lib/cutout\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { useDirectionCheck, useLocale } from \"../../lib/intl\"\nimport { useMergedRefs } from \"../../lib/merge-refs\"\nimport { props } from \"../../lib/props\"\nimport { MEDIA_RADIUS, type MediaRadius } from \"../../lib/radius\"\nimport { type Ratio, ratioToNumber } from \"../../lib/ratio\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TYPOGRAPHY_SHADE_CLASSES } from \"../../lib/typography-size\"\nimport { useObjectUrl } from \"../../lib/use-object-url\"\nimport { ActionIcon } from \"../action-icon/action-icon\"\nimport { Slider } from \"../slider/slider\"\n\n/**\n * ImageCropper — pick the part of an image to keep: drag the selection, pull\n * its handles, pinch or wheel to zoom, rotate and flip, then export the crop.\n *\n * <ImageCropper src={file} ratio={1} shape=\"circle\" withControls>\n * <ImageCropper.Context>\n * {(api) => <Button onClick={() => api.getCroppedImage().then(upload)}>Save</Button>}\n * </ImageCropper.Context>\n * </ImageCropper>\n *\n * Built on Ark's image cropper (a \"preview\" component in Ark 5.39, see the\n * docs page), which owns the geometry, the gestures, the keyboard and the\n * canvas export. The kit adds the look (an outside dim, handles that survive\n * forced colors), the controls, `src` as a `Blob`, `ratio` in the media\n * components' shape, flattened callbacks and translations with\n * locale-formatted numbers.\n *\n * The result is read from `ImageCropper.Context`, not an imperative ref:\n * `getCroppedImage()` draws the crop to a canvas and resolves a `Blob` (or a\n * data URL), `getCropData()` returns the crop in the image's own pixels for a\n * server to cut.\n */\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport type ImageCropperShape = \"rectangle\" | \"circle\"\nexport type ImageCropperFlip = ImageCropperFlipState\n/** A crop rectangle, in px of the viewport. */\nexport type ImageCropperRect = ImageCropperCropChangeDetails[\"crop\"]\nexport type { ImageCropperHandlePosition }\n\n/** A crop rectangle with every number already formatted for the locale. */\nexport type ImageCropperFormattedRect = { x: string; y: string; width: string; height: string }\n\nexport type ImageCropperTranslations = {\n /** The cropper's accessible name. */\n label?: string\n /** What kind of thing the cropper is, announced with its name. */\n roleDescription?: string\n /** The cropper's description while the image loads. */\n loading?: string\n /** The cropper's description once the image is ready. `zoom` is a percent, `rotation` in degrees. */\n preview?: (details: ImageCropperFormattedRect & { zoom: string; rotation: string }) => string\n /** The selection's accessible name. */\n selectionLabel?: (shape: ImageCropperShape) => string\n /** What kind of thing the selection is. Ark's default is the APG \"2d slider\". */\n selectionRoleDescription?: string\n /** How to move it from the keyboard, read as the selection's description. */\n selectionInstructions?: string\n /** The selection's `aria-valuetext`: where it is and how big. */\n selectionValue?: (details: ImageCropperFormattedRect & { shape: ImageCropperShape }) => string\n /** Names the group of controls. */\n controlsLabel?: string\n zoomLabel?: string\n /** The zoom slider's `aria-valuetext`. `percent` is formatted (`\"150%\"`). */\n zoomValue?: (percent: string) => string\n rotateLeftLabel?: string\n rotateRightLabel?: string\n flipHorizontalLabel?: string\n flipVerticalLabel?: string\n resetLabel?: string\n}\n\nexport const DEFAULT_TRANSLATIONS: Required<ImageCropperTranslations> = {\n label: \"Image cropper\",\n roleDescription: \"image cropper\",\n loading: \"Loading the image\",\n preview: ({ zoom, rotation, x, y, width, height }) =>\n `Zoom ${zoom}, rotated ${rotation}. Crop at ${x}px from the left and ${y}px from the top, ${width}px by ${height}px.`,\n selectionLabel: (shape) => `Crop selection (${shape})`,\n selectionRoleDescription: \"2d slider\",\n selectionInstructions:\n \"Use the arrow keys to move the crop. Hold Alt with the arrow keys to resize it. Press plus or minus to zoom.\",\n selectionValue: ({ shape, x, y, width, height }) =>\n match(shape)\n .with(\"circle\", () => `Position X ${x}px, Y ${y}px. Diameter ${width}px.`)\n .with(\"rectangle\", () => `Position X ${x}px, Y ${y}px. Size ${width}px by ${height}px.`)\n .exhaustive(),\n controlsLabel: \"Crop controls\",\n zoomLabel: \"Zoom\",\n zoomValue: (percent) => percent,\n rotateLeftLabel: \"Rotate left\",\n rotateRightLabel: \"Rotate right\",\n flipHorizontalLabel: \"Flip horizontally\",\n flipVerticalLabel: \"Flip vertically\",\n resetLabel: \"Reset\",\n}\n\ntype ArkTranslations = NonNullable<ArkRootProps[\"translations\"]>\n\n/** What the Root shares with the parts Ark's context doesn't cover. */\nexport type ImageCropperIconSlot =\n | \"rotateLeft\"\n | \"rotateRight\"\n | \"flipHorizontal\"\n | \"flipVertical\"\n | \"zoomOut\"\n | \"zoomIn\"\n | \"reset\"\nexport type ImageCropperIcons = IconMap<ImageCropperIconSlot>\n\n/**\n * The default icons of `ImageCropper.Controls`, named like the\n * `translations` labels of the buttons they sit in. None of them points along\n * the inline axis (a rotation turns the same way in either direction, and the\n * zoom glyphs sit at the slider's start and end), so none mirrors under RTL.\n */\nexport const DEFAULT_ICONS: Record<ImageCropperIconSlot, ReactNode> = {\n rotateLeft: <RotateCcw className={iconStroke} />,\n rotateRight: <RotateCw className={iconStroke} />,\n flipHorizontal: <FlipHorizontal2 className={iconStroke} />,\n flipVertical: <FlipVertical2 className={iconStroke} />,\n zoomOut: <ZoomOut className={iconStroke} />,\n zoomIn: <ZoomIn className={iconStroke} />,\n reset: <RefreshCcw className={iconStroke} />,\n}\n\ntype Shared = {\n t: Required<ImageCropperTranslations>\n icons: Record<ImageCropperIconSlot, ReactNode>\n percent: (value: number) => string\n minZoom: number\n maxZoom: number\n shape: ImageCropperShape\n /** The locked width / height (1 for a circle), which the export holds to the pixel. */\n aspect: number | undefined\n}\n\nconst SharedContext = createContext<Shared>({\n t: DEFAULT_TRANSLATIONS,\n icons: DEFAULT_ICONS,\n percent: String,\n minZoom: 1,\n maxZoom: 5,\n shape: \"rectangle\",\n aspect: undefined,\n})\n\n// ---------------------------------------------------------------------------\n// Styles\n// ---------------------------------------------------------------------------\n\n/**\n * Each handle's hit box and visible mark, by position. Ark already places the\n * handle on the selection's edge (`top`/`left`/`right`/`bottom`, centered\n * with `translate`, edges at 96% of the side); this sizes the hit box and\n * shapes the mark, an `::after` centered in it, so the handle stays a bare\n * element any `asChild` child can become.\n *\n * The mark is the Slider thumb: a palette border on the page-tinted fill.\n * Corners are round thumbs, edges are pills along their side. The hit box is\n * 24px under a mouse and 44px (WCAG 2.5.8) under a finger, around the same\n * small mark.\n *\n * Physical sides, not logical ones: the crop is a rectangle in the image's own\n * space, where `e` is the image's right edge whatever the text direction, and\n * Ark positions the handles that way too.\n *\n * Corners sit above the edge bars (`z-1`), which overlap them at 96% of the\n * side, so a press near a corner resizes both ways. On a circle only the four\n * edge pills show: they're the points that touch it.\n */\nconst HANDLE: Record<ImageCropperHandlePosition, string> = {\n nw: \"z-1 size-6 pointer-coarse:size-11 after:size-3.5 in-data-[shape=circle]:after:hidden\",\n ne: \"z-1 size-6 pointer-coarse:size-11 after:size-3.5 in-data-[shape=circle]:after:hidden\",\n se: \"z-1 size-6 pointer-coarse:size-11 after:size-3.5 in-data-[shape=circle]:after:hidden\",\n sw: \"z-1 size-6 pointer-coarse:size-11 after:size-3.5 in-data-[shape=circle]:after:hidden\",\n n: \"h-6 pointer-coarse:h-11 after:h-2 after:w-6\",\n s: \"h-6 pointer-coarse:h-11 after:h-2 after:w-6\",\n e: \"w-6 pointer-coarse:w-11 after:h-6 after:w-2\",\n w: \"w-6 pointer-coarse:w-11 after:h-6 after:w-2\",\n}\n\n/** A ≥ 44px control (WCAG 2.5.8). */\nconst control = \"h-11 [&_svg]:size-5\"\n/** The zoom slider's end glyphs: decorative, the slider carries the name. */\nconst zoomIcon = \"flex shrink-0 [&_svg]:size-4\"\n\n// ---------------------------------------------------------------------------\n// Root\n// ---------------------------------------------------------------------------\n\nexport type ImageCropperRootProps = Omit<\n ArkRootProps,\n | \"aspectRatio\"\n | \"cropShape\"\n | \"translations\"\n | \"onZoomChange\"\n | \"onRotationChange\"\n | \"onFlipChange\"\n | \"onCropChange\"\n> &\n WithTestId & {\n /** Locks the selection to this width / height. Free when unset; a circle is always 1. */\n ratio?: Ratio\n /** A circle crop still exports a square: mask it where you show it. */\n shape?: ImageCropperShape\n /** Fires as the zoom changes, from 1 (fit) up. */\n onZoomChange?: (zoom: number) => void\n /** Fires as the rotation changes, in degrees. */\n onRotationChange?: (rotation: number) => void\n onFlipChange?: (flip: ImageCropperFlip) => void\n /** Fires as the selection moves or resizes, in px of the viewport. */\n onCropChange?: (crop: ImageCropperRect) => void\n translations?: ImageCropperTranslations\n /** Replaces the control icons: `rotateLeft`, `rotateRight`, `flipHorizontal`,\n * `flipVertical`, `zoomOut`, `zoomIn`, `reset`. Drawn as given, never restroked. */\n icons?: ImageCropperIcons\n /**\n * The palette of the selection's edge, handles, focus ring and zoom slider.\n * `brand` by default: on a photo, the kit's black-and-white default palette\n * would read as plain chrome rather than as a control.\n */\n color?: Color\n ref?: Ref<HTMLDivElement>\n }\n\n/** `\"16/9\"` → `1.777…`, and nothing for a ratio that can't lock a selection. */\nconst aspectRatioOf = (ratio: Ratio | undefined) => {\n const value = ratio === undefined ? Number.NaN : ratioToNumber(ratio)\n return Number.isFinite(value) && value > 0 ? value : undefined\n}\n\nconst ImageCropperRoot = ({\n ratio,\n shape,\n onZoomChange,\n onRotationChange,\n onFlipChange,\n onCropChange,\n translations,\n icons,\n minZoom = 1,\n maxZoom = 5,\n color = \"brand\",\n className,\n testId,\n ref,\n ...rest\n}: ImageCropperRootProps) => {\n const locale = useLocale()\n const direction = useDirectionCheck()\n\n const [shared, arkTranslations] = useMemo(() => {\n const t = { ...DEFAULT_TRANSLATIONS, ...translations }\n const pixels = new Intl.NumberFormat(locale, { maximumFractionDigits: 0 })\n const percent = new Intl.NumberFormat(locale, { style: \"percent\", maximumFractionDigits: 0 })\n const degrees = new Intl.NumberFormat(locale, {\n style: \"unit\",\n unit: \"degree\",\n maximumFractionDigits: 0,\n })\n const rect = ({ x, y, width, height }: ImageCropperRect): ImageCropperFormattedRect => ({\n x: pixels.format(x),\n y: pixels.format(y),\n width: pixels.format(width),\n height: pixels.format(height),\n })\n const ark: ArkTranslations = {\n rootLabel: t.label,\n rootRoleDescription: t.roleDescription,\n previewLoading: t.loading,\n previewDescription: ({ crop, zoom, rotation }) =>\n t.preview({\n ...rect(crop),\n zoom: percent.format(zoom ?? 1),\n rotation: degrees.format(rotation ?? 0),\n }),\n selectionLabel: ({ shape }) => t.selectionLabel(shape),\n selectionRoleDescription: t.selectionRoleDescription,\n selectionInstructions: t.selectionInstructions,\n selectionValueText: ({ shape, ...crop }) => t.selectionValue({ shape, ...rect(crop) }),\n }\n const value: Shared = {\n t,\n icons: mergeIcons(DEFAULT_ICONS, icons),\n percent: (n) => percent.format(n),\n minZoom,\n maxZoom,\n shape: shape ?? \"rectangle\",\n aspect: shape === \"circle\" ? 1 : aspectRatioOf(ratio),\n }\n return [value, ark] as const\n }, [translations, icons, locale, minZoom, maxZoom, shape, ratio])\n\n const rootRef = useMergedRefs(ref, direction)\n return (\n <SharedContext value={shared}>\n <Ark.Root\n ref={rootRef}\n aspectRatio={aspectRatioOf(ratio)}\n cropShape={shape}\n minZoom={minZoom}\n maxZoom={maxZoom}\n translations={arkTranslations}\n onZoomChange={onZoomChange && (({ zoom }) => onZoomChange(zoom))}\n onRotationChange={onRotationChange && (({ rotation }) => onRotationChange(rotation))}\n onFlipChange={onFlipChange && (({ flip }) => onFlipChange(flip))}\n onCropChange={onCropChange && (({ crop }) => onCropChange(crop))}\n data-color={color}\n className={cn(\"flex w-full flex-col gap-3\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n </SharedContext>\n )\n}\n\n// ---------------------------------------------------------------------------\n// Parts\n// ---------------------------------------------------------------------------\n\nexport type ImageCropperViewportProps = Ark.ViewportProps &\n WithTestId & {\n /** Corner radius, from the media scale. */\n radius?: MediaRadius\n }\n\n/** The frame the image is cropped in. Takes the pan, wheel and pinch gestures. */\nconst ImageCropperViewport = ({\n radius = \"xs\",\n className,\n testId,\n ...rest\n}: ImageCropperViewportProps) => (\n <Ark.Viewport\n className={cn(\n \"relative touch-none select-none overflow-clip bg-black/80\",\n MEDIA_RADIUS[radius],\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ImageCropperImageProps = NoAsChild<\n Omit<Ark.ImageProps, \"src\"> &\n WithTestId & {\n /** A URL, or a `Blob` / `File`, shown through an object URL that's revoked when it changes. */\n src: string | Blob\n }\n>\n\n/**\n * The image being cropped. Decorative to assistive technology: the cropper's\n * own description says what's selected. Fades in once Ark has measured it.\n *\n * A cross-origin URL needs `crossOrigin=\"anonymous\"` (and CORS headers on the\n * server) for `getCroppedImage()`; without them the canvas is tainted and the\n * export resolves `null`.\n */\nconst ImageCropperImage = ({\n src,\n className,\n testId,\n asChild: _asChild,\n ...rest\n}: ImageCropperImageProps) => {\n const url = useObjectUrl(src)\n return (\n <Ark.Image\n src={url}\n className={cn(\n \"block h-auto w-full max-w-none opacity-0 data-ready:opacity-100\",\n \"transition-opacity duration-(--duration-normal) ease-standard motion-reduce:transition-none\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n )\n}\n\nexport type ImageCropperSelectionProps = NoAsChild<\n Ark.SelectionProps &\n WithTestId & {\n /** Rule-of-thirds lines inside the selection, shown while it's dragged or resized. */\n withGrid?: boolean\n }\n>\n\n/** The selection's hole in the dim: Ark sets the crop rectangle as custom properties on the root. */\nconst CROP_RECT = {\n x: \"var(--crop-x)\",\n y: \"var(--crop-y)\",\n width: \"var(--crop-width)\",\n height: \"var(--crop-height)\",\n}\n\n/**\n * The crop area: a `role=\"slider\"` that moves with the arrow keys, resizes\n * with Alt + arrows and zooms with `+`/`-`.\n *\n * Everything outside it is dimmed like a Modal backdrop by an overlay drawn\n * just before it, with the selection cut out of it (`lib/cutout.ts`): a real\n * rectangle or circle, following the crop through Ark's `--crop-*` custom\n * properties without a render. The overlay steps aside in forced colors,\n * where it would paint `Canvas` over the image; the edge and the handles,\n * borders both, are repainted instead.\n */\nconst ImageCropperSelection = ({\n withGrid = true,\n className,\n testId,\n children,\n asChild: _asChild,\n ...rest\n}: ImageCropperSelectionProps) => {\n const { shape } = useContext(SharedContext)\n return (\n <>\n <div\n aria-hidden\n data-part=\"overlay\"\n data-shape={shape}\n // The Modal backdrop's dim, with a light blur: the frame stays legible\n // around the crop without competing with it.\n className=\"pointer-events-none absolute inset-0 bg-black/50 backdrop-blur-xs forced-colors:hidden\"\n style={cutoutMask(shape, CROP_RECT)}\n />\n <Ark.Selection\n className={cn(\n \"cursor-move border border-(--c-solid) data-[shape=circle]:rounded-full\",\n // A pale halo around the 1px palette edge: two tones, so it holds on a dark photo and a bright one.\n \"shadow-[0_0_0_1px_rgb(255_255_255/0.45)]\",\n \"data-disabled:cursor-default\",\n // Inset and gap-less: the selection can sit flush with the clipping viewport.\n focusStyles({ ring: \"palette\", offset: false, inset: true }),\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {withGrid && (\n <>\n <ImageCropperGrid axis=\"horizontal\" />\n <ImageCropperGrid axis=\"vertical\" />\n </>\n )}\n {Ark.handles.map((position) => (\n <ImageCropperHandle key={position} position={position} />\n ))}\n {children}\n </Ark.Selection>\n </>\n )\n}\n\nexport type ImageCropperHandleProps = Ark.HandleProps & WithTestId\n\n/** One resize handle. `Selection` renders all eight; use it when you compose your own. */\nconst ImageCropperHandle = ({ position, className, testId, ...rest }: ImageCropperHandleProps) => (\n <Ark.Handle\n position={position}\n className={cn(\n \"after:absolute after:top-1/2 after:left-1/2 after:-translate-1/2 after:rounded-full\",\n \"after:border-2 after:border-(--c-solid) after:bg-brand-50 after:shadow-sm dark:after:bg-brand-950\",\n // Grows a touch while held, like the Slider thumb.\n \"after:transition-[scale] after:duration-(--duration-fast) after:ease-standard motion-reduce:after:transition-none\",\n \"in-data-dragging:after:scale-110\",\n \"data-disabled:hidden\",\n HANDLE[position],\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ImageCropperGridProps = Ark.GridProps & WithTestId\n\n/** A pair of rule-of-thirds lines, along `axis`. Fades in while the crop is dragged, resized or panned. */\nconst ImageCropperGrid = ({ className, testId, ...rest }: ImageCropperGridProps) => (\n <Ark.Grid\n className={cn(\n \"border-white/50 data-[axis=horizontal]:border-y data-[axis=vertical]:border-x\",\n \"opacity-0 data-dragging:opacity-100 data-panning:opacity-100\",\n \"transition-opacity duration-(--duration-fast) ease-standard motion-reduce:transition-none\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ImageCropperControlsProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/**\n * Zoom slider, rotate ±90°, flip and reset, wired to the nearest cropper. Each\n * is a 44px button named from `translations`; the flips are toggle buttons.\n */\nconst ImageCropperControls = ({ className, testId, ...rest }: ImageCropperControlsProps) => {\n const api = useImageCropperContext()\n const { t, icons, percent, minZoom, maxZoom } = useContext(SharedContext)\n return (\n // biome-ignore lint/a11y/useSemanticElements: a `<fieldset>` brings UA border/padding/`min-inline-size` that fight this wrapping flex row, for the same `group` semantics\n <div\n role=\"group\"\n aria-label={t.controlsLabel}\n className={cn(\"flex flex-wrap items-center gap-1\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.rotateLeftLabel}\n onClick={() => api.rotateBy(-90)}\n >\n {icons.rotateLeft}\n </ActionIcon>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.rotateRightLabel}\n onClick={() => api.rotateBy(90)}\n >\n {icons.rotateRight}\n </ActionIcon>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.flipHorizontalLabel}\n aria-pressed={api.flip.horizontal}\n onClick={() => api.flipHorizontally()}\n >\n {icons.flipHorizontal}\n </ActionIcon>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.flipVerticalLabel}\n aria-pressed={api.flip.vertical}\n onClick={() => api.flipVertically()}\n >\n {icons.flipVertical}\n </ActionIcon>\n <div\n className={cn(\n \"flex min-w-40 flex-1 items-center gap-2 px-2\",\n TYPOGRAPHY_SHADE_CLASSES.muted,\n )}\n >\n <span aria-hidden className={zoomIcon}>\n {icons.zoomOut}\n </span>\n <Slider\n min={minZoom}\n max={maxZoom}\n step={0.01}\n value={api.zoom}\n onChange={(zoom) => api.setZoom(zoom)}\n aria-label={[t.zoomLabel]}\n getAriaValueText={({ value }) => t.zoomValue(percent(value))}\n classNames={{ field: \"flex-1\" }}\n />\n <span aria-hidden className={zoomIcon}>\n {icons.zoomIn}\n </span>\n </div>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.resetLabel}\n onClick={() => api.reset()}\n >\n {icons.reset}\n </ActionIcon>\n </div>\n )\n}\n\ntype CropExport = UseImageCropperContext[\"getCroppedImage\"]\n\n/** The size a `width × height` export should have at `aspect`: its short side stretched to match the long one. */\nconst exactSize = (width: number, height: number, aspect: number) =>\n width / height > aspect\n ? { width, height: Math.round(width / aspect) }\n : { width: Math.round(height * aspect), height }\n\n/**\n * Ark's export, held to a locked ratio. Ark sizes the canvas from the image's\n * rounded layout box, scaling each side on its own, so a 1:1 crop can come\n * out 511 × 512. When it does, the crop is exported again losslessly and\n * redrawn at the exact size, then encoded once as asked.\n */\nexport const exactExport =\n (getCroppedImage: CropExport, aspect: number | undefined): CropExport =>\n async (options) => {\n const blob = await getCroppedImage(options)\n if (aspect === undefined || !(blob instanceof Blob) || typeof createImageBitmap !== \"function\")\n return blob\n const shot = await createImageBitmap(blob)\n // Read the size before `close()`: a closed bitmap reports 0 × 0.\n const { width, height } = shot\n shot.close()\n const size = exactSize(width, height, aspect)\n if (size.width === width && size.height === height) return blob\n const lossless = await getCroppedImage({ ...options, type: \"image/png\" })\n if (!(lossless instanceof Blob)) return blob\n const source = await createImageBitmap(lossless)\n const canvas = document.createElement(\"canvas\")\n canvas.width = size.width\n canvas.height = size.height\n const context = canvas.getContext(\"2d\")\n if (!context) return blob\n context.drawImage(source, 0, 0, size.width, size.height)\n source.close()\n return new Promise<Blob | null>((resolve) =>\n canvas.toBlob(resolve, options?.type ?? \"image/png\", options?.quality ?? 1),\n )\n }\n\n/**\n * The nearest cropper's API: Ark's, with `getCroppedImage()` held to the\n * locked ratio (or the circle) to the pixel.\n */\nconst useImageCropperContext = (): UseImageCropperContext => {\n const api = useArkImageCropperContext()\n const { aspect } = useContext(SharedContext)\n return { ...api, getCroppedImage: exactExport(api.getCroppedImage, aspect) }\n}\n\nexport type ImageCropperContextProps = Ark.ContextProps\n\n/** Renders its child function with the cropper's API, for an export button. */\nconst ImageCropperContext = ({ children }: ImageCropperContextProps) =>\n children(useImageCropperContext())\n\n// ---------------------------------------------------------------------------\n// Convenience\n// ---------------------------------------------------------------------------\n\nexport type ImageCropperClassNames = {\n viewport?: string\n image?: string\n selection?: string\n controls?: string\n}\n\nexport type ImageCropperProps = NoAsChild<\n Omit<ImageCropperRootProps, \"children\"> & {\n /** The image to crop: a URL, or a `Blob` / `File` (a pick or a drop). */\n src: string | Blob\n /** Needed on a cross-origin URL for the export to read its pixels. */\n crossOrigin?: ImageCropperImageProps[\"crossOrigin\"]\n /** The viewport's corner radius, from the media scale. */\n radius?: MediaRadius\n /** Rule-of-thirds lines inside the selection, shown while it's dragged or resized. */\n withGrid?: boolean\n /** The zoom slider and the rotate, flip and reset buttons, under the image. */\n withControls?: boolean\n classNames?: ImageCropperClassNames\n /** Rendered last, inside the root: an `ImageCropper.Context` for the export. */\n children?: ReactNode\n }\n>\n\nconst ImageCropperComponent = ({\n src,\n crossOrigin,\n radius,\n withGrid,\n withControls = false,\n classNames,\n children,\n asChild: _asChild,\n ...rest\n}: ImageCropperProps) => (\n <ImageCropperRoot {...rest}>\n <ImageCropperViewport radius={radius} className={classNames?.viewport}>\n <ImageCropperImage src={src} crossOrigin={crossOrigin} className={classNames?.image} />\n <ImageCropperSelection withGrid={withGrid} className={classNames?.selection} />\n </ImageCropperViewport>\n {withControls && <ImageCropperControls className={classNames?.controls} />}\n {children}\n </ImageCropperRoot>\n)\n\nexport const ImageCropper = Object.assign(ImageCropperComponent, {\n Root: ImageCropperRoot,\n Viewport: ImageCropperViewport,\n Image: ImageCropperImage,\n Selection: ImageCropperSelection,\n Handle: ImageCropperHandle,\n Grid: ImageCropperGrid,\n Controls: ImageCropperControls,\n Context: ImageCropperContext,\n})\n\nexport { useImageCropperContext }\n"]}
@@ -12,7 +12,13 @@ var badgeVariants = cva(
12
12
  "inline-flex items-center",
13
13
  "whitespace-nowrap select-none",
14
14
  "font-sans font-medium",
15
- "border border-transparent",
15
+ // Figma strokes every badge at 0.5px, inside the box. A CSS border cannot
16
+ // draw that: Chrome rounds any border-width under 1px up to 1px. An inset
17
+ // ring (box-shadow) is not rounded — one device pixel on a 2x screen, a
18
+ // half-strength pixel at 1x, as Figma antialiases it — and takes no layout.
19
+ // Forced colours drop every box-shadow, so there a real 1px border in the
20
+ // system text colour keeps the chip's edge.
21
+ "inset-ring-[0.5px] inset-ring-transparent forced-colors:border forced-colors:border-[CanvasText]",
16
22
  "[&_svg]:shrink-0 [&_svg]:pointer-events-none",
17
23
  // Inert on the default non-focusable <span> — `:focus-visible` never
18
24
  // matches it — and lights up as soon as `asChild` renders Badge onto a
@@ -38,16 +44,16 @@ var badgeVariants = cva(
38
44
  light: [
39
45
  "bg-black/8 dark:bg-white/16",
40
46
  TEXT_COLOR_CLASSES.primary,
41
- "border-black/8 dark:border-white/15",
42
- "data-color:bg-(--c-solid)/30 data-color:text-(--c-text) data-color:border-(--c-solid)",
47
+ "inset-ring-black/8 dark:inset-ring-white/15",
48
+ "data-color:bg-(--c-solid)/30 data-color:text-(--c-text) data-color:inset-ring-(--c-solid)",
43
49
  "data-[color=neutral]:bg-(--c-soft)"
44
50
  ],
45
- outline: "bg-transparent text-(--c-text) border-(--c-solid)",
51
+ outline: "bg-transparent text-(--c-text) inset-ring-(--c-solid)",
46
52
  subtle: "bg-transparent text-(--c-text)",
47
53
  // from-*/to-* are the CSS defaults for --tw-gradient-from/to and the
48
54
  // --tw-gradient-stops composition chain. Props only override the individual
49
55
  // vars they provide — the chain resolves them lazily without JS defaults.
50
- gradient: "bg-origin-border bg-linear-to-r from-purple-300 to-pink-400 text-black border-white/20"
56
+ gradient: "bg-linear-to-r from-purple-300 to-pink-400 text-black inset-ring-white/20"
51
57
  },
52
58
  // Figma (node 14950-143827) defines sm/md/lg; xs/xl extrapolate one
53
59
  // step past either end. Radius follows Figma on every step
@@ -100,5 +106,5 @@ var Badge = ({
100
106
  };
101
107
 
102
108
  export { Badge };
103
- //# sourceMappingURL=chunk-F342ZT7O.js.map
104
- //# sourceMappingURL=chunk-F342ZT7O.js.map
109
+ //# sourceMappingURL=chunk-ZVECQBGG.js.map
110
+ //# sourceMappingURL=chunk-ZVECQBGG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/badge/badge.tsx"],"names":[],"mappings":";;;;;;;;;AAsCA,IAAM,aAAA,GAAgB,GAAA;AAAA,EACpB;AAAA,IACE,0BAAA;AAAA,IACA,+BAAA;AAAA,IACA,uBAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOA,kGAAA;AAAA,IACA,8CAAA;AAAA;AAAA;AAAA;AAAA,IAIA,WAAA;AAAY,GACd;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,MAAA,EAAQ,oCAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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A;AAAA,QAC9D;AAAA,OACF;AAAA,MACC,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,MAClC,GAAG;AAAA;AAAA,GACN;AAEJ","file":"chunk-ZVECQBGG.js","sourcesContent":["import { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport {\n buildGradientVars,\n GRADIENT_DIR_CLASS,\n type GradientDir,\n type GradientProps,\n} from \"../../lib/gradient\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\n\n/**\n * Badge — compact inline label for a status, a count or a tag.\n *\n * Pure React Server Component. It borrows Button's (variant × color) system so\n * a chip and an action speak the same accent language, but it is a display\n * element: no hover treatment, no click handling, and it renders a `<span>`.\n *\n * `asChild` (from `HTMLArkProps`) renders the single child as the root with\n * Badge's styling merged in, which is how a badge becomes a real control —\n * either standalone or collapsed into another component's trigger:\n *\n * ```tsx\n * <HoverCard.Trigger asChild>\n * <Badge asChild variant=\"light\" aria-label=\"12 campuses\">\n * <button type=\"button\">12</button>\n * </Badge>\n * </HoverCard.Trigger>\n * ```\n *\n * That yields one DOM node that *is* the badge, keyboard-reachable, carrying\n * the kit's focus ring (`focusStyles`) and Badge's own radius — the caller\n * supplies no `className` for any of it.\n */\nconst badgeVariants = cva(\n [\n \"inline-flex items-center\",\n \"whitespace-nowrap select-none\",\n \"font-sans font-medium\",\n // Figma strokes every badge at 0.5px, inside the box. A CSS border cannot\n // draw that: Chrome rounds any border-width under 1px up to 1px. An inset\n // ring (box-shadow) is not rounded — one device pixel on a 2x screen, a\n // half-strength pixel at 1x, as Figma antialiases it — and takes no layout.\n // Forced colours drop every box-shadow, so there a real 1px border in the\n // system text colour keeps the chip's edge.\n \"inset-ring-[0.5px] inset-ring-transparent forced-colors:border forced-colors:border-[CanvasText]\",\n \"[&_svg]:shrink-0 [&_svg]:pointer-events-none\",\n // Inert on the default non-focusable <span> — `:focus-visible` never\n // matches it — and lights up as soon as `asChild` renders Badge onto a\n // real <button>/<a>, which is the composition the docs recommend.\n focusStyles(),\n ],\n {\n variants: {\n variant: {\n filled: \"bg-(--c-solid) text-(--c-on-solid)\",\n // Neutral by default; a `data-color` tint overrides it. Those rules\n // compile to `&[data-color]` (specificity 0,2,0), which beats both\n // the plain and the `dark:` neutral classes below (0,1,0 — `dark:`\n // is a `:where()` variant) regardless of source order.\n //\n // Figma (node 14950-143827) tints a hued badge with its solid shade\n // at 30% and borders it with the solid shade itself. `--c-soft` is\n // the wrong base for that: it is the -50/-950 end of the scale, so\n // at any opacity it fades into the page in both themes. Neutral is\n // the exception — Figma fills it with the translucent overlay that\n // neutral's own `--c-soft` already is (white/16 dark, black/16\n // light), so it takes that slot as-is.\n light: [\n \"bg-black/8 dark:bg-white/16\",\n TEXT_COLOR_CLASSES.primary,\n \"inset-ring-black/8 dark:inset-ring-white/15\",\n \"data-color:bg-(--c-solid)/30 data-color:text-(--c-text) data-color:inset-ring-(--c-solid)\",\n \"data-[color=neutral]:bg-(--c-soft)\",\n ],\n outline: \"bg-transparent text-(--c-text) inset-ring-(--c-solid)\",\n subtle: \"bg-transparent text-(--c-text)\",\n // from-*/to-* are the CSS defaults for --tw-gradient-from/to and the\n // --tw-gradient-stops composition chain. Props only override the individual\n // vars they provide — the chain resolves them lazily without JS defaults.\n gradient: \"bg-linear-to-r from-purple-300 to-pink-400 text-black inset-ring-white/20\",\n },\n // Figma (node 14950-143827) defines sm/md/lg; xs/xl extrapolate one\n // step past either end. Radius follows Figma on every step\n // (`rounded-badge`, 4px), as do md's height and padding. The rest of\n // the scale departs from Figma on purpose (3b408c4c), so there the\n // design catches up to the kit, not the reverse: sm is 12px text, 3px gap, 22px tall\n // (Figma 10/4/20); md has a 6px gap (4); lg is 16px text, 8px gap,\n // 8px padding (14/4/10). Icon size ([&_svg]:size-*) isn't in the\n // Figma spec — scaled by eye to each step, same convention as\n // Button's own size variant.\n size: {\n xs: \"min-h-5 px-0.5 text-[10px] leading-2.5 gap-0.5 rounded-badge [&_svg]:size-2.5\",\n sm: \"min-h-5.5 px-1 text-xs gap-0.75 rounded-badge [&_svg]:size-3\",\n md: \"min-h-6 px-1.5 text-sm gap-1.5 rounded-badge [&_svg]:size-3\",\n lg: \"min-h-7 px-2 text-md gap-2 rounded-badge [&_svg]:size-3.5\",\n xl: \"min-h-8 px-2.5 text-lg gap-3.5 rounded-badge [&_svg]:size-4\",\n },\n },\n defaultVariants: {\n variant: \"light\",\n size: \"md\",\n },\n },\n)\n\nexport type BadgeVariant = NonNullable<VariantProps<typeof badgeVariants>[\"variant\"]>\nexport type BadgeSize = NonNullable<VariantProps<typeof badgeVariants>[\"size\"]>\n\nexport type { GradientDir, GradientProps }\n\nexport type BadgeProps = Omit<HTMLArkProps<\"span\">, \"color\"> &\n VariantProps<typeof badgeVariants> &\n WithTestId & {\n /** Accent palette. Re-exported as `Color` from `@42/ui-react`. */\n color?: Color\n /**\n * Gradient config. Only applied when `variant=\"gradient\"`.\n * Mirrors Tailwind's from-* / to-* / via-* utilities: sets the individual\n * CSS vars so the existing --tw-gradient-stops chain picks them up.\n * Unset fields fall back to the CVA defaults (purple-300 → pink-400, to-r).\n */\n gradient?: GradientProps\n }\n\nexport const Badge = ({\n className,\n variant,\n size,\n color,\n gradient,\n style,\n testId,\n ...rest\n}: BadgeProps) => {\n const isGradient = variant === \"gradient\"\n\n return (\n <ark.span\n data-color={!isGradient ? color : undefined}\n style={isGradient && gradient ? { ...buildGradientVars(gradient), ...style } : style}\n className={cn(\n badgeVariants({ variant, size }),\n isGradient && gradient?.dir && GRADIENT_DIR_CLASS[gradient.dir],\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n )\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"action-icon.d.ts","sourceRoot":"","sources":["../../../src/components/action-icon/action-icon.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAG7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAGnD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,QAAA,MAAM,kBAAkB;;;;8EAyDvB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,kBAAkB,CAAC,CAAC,SAAS,CAAC,CAAC,CAAA;AAC/F,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AACzF,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,kBAAkB,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAA;AAE7F,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,GACjE,YAAY,CAAC,OAAO,kBAAkB,CAAC,GACvC,UAAU,GAAG;IACX,kEAAkE;IAClE,KAAK,CAAC,EAAE,KAAK,CAAA;IACb;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAQH,eAAO,MAAM,UAAU,sHAcpB,eAAe,gCAgCjB,CAAA"}
1
+ {"version":3,"file":"action-icon.d.ts","sourceRoot":"","sources":["../../../src/components/action-icon/action-icon.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAG7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAGnD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,QAAA,MAAM,kBAAkB;;;;8EA2DvB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,kBAAkB,CAAC,CAAC,SAAS,CAAC,CAAC,CAAA;AAC/F,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AACzF,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,kBAAkB,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAA;AAE7F,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,GACjE,YAAY,CAAC,OAAO,kBAAkB,CAAC,GACvC,UAAU,GAAG;IACX,kEAAkE;IAClE,KAAK,CAAC,EAAE,KAAK,CAAA;IACb;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAQH,eAAO,MAAM,UAAU,sHAcpB,eAAe,gCAgCjB,CAAA"}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- export { ActionIcon } from '../../chunk-BE2LWUHY.js';
2
+ export { ActionIcon } from '../../chunk-BMEJBY6H.js';
3
3
  import '../../chunk-D2QIPQ74.js';
4
4
  import '../../chunk-R5LYFTHA.js';
5
5
  import '../../chunk-WYCMIIRR.js';
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { NOTIFICATION_DEFAULT_TRANSLATIONS, CloseTrigger, ActionTrigger, Description, Title, Icon, TOAST_STATUS } from '../../chunk-LKFHUDEW.js';
3
- import { devWarn } from '../../chunk-6N6J2DOE.js';
3
+ import { devWarn } from '../../chunk-LIZWCWED.js';
4
4
  import '../../chunk-PMUCGFY5.js';
5
5
  import '../../chunk-BUIHQJGE.js';
6
6
  import '../../chunk-6YNLRQ25.js';
@@ -1,4 +1,4 @@
1
- import { warnRenamedProp } from '../../chunk-6N6J2DOE.js';
1
+ import { warnRenamedProp } from '../../chunk-LIZWCWED.js';
2
2
  import { props } from '../../chunk-WYCMIIRR.js';
3
3
  import { cn } from '../../chunk-4ASNIDV7.js';
4
4
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
@@ -57,8 +57,10 @@ var inLayer = (viewport, offset = 0) => `${round((viewport + offset) / SPAN * 10
57
57
  var cloud = ({ rx, ry, x, y }, { color, strength }) => `radial-gradient(ellipse ${inLayer(rx)} ${inLayer(ry)} at ${inLayer(x, BLEED)} ${inLayer(y, BLEED)}, color-mix(in oklab, var(${color}) ${strength}%, transparent), color-mix(in oklab, var(${color}) ${strength * 0.45}%, transparent) 45%, transparent 100%)`;
58
58
  var CLOUDS = [
59
59
  {
60
- at: { rx: 42, ry: 34, x: 30, y: 64 },
61
- dark: { color: "--color-purple-400", strength: 9 },
60
+ // Moved down-left, narrowed and brightened (9 → 17) against Figma's « Background / Cosmos »,
61
+ // whose lower-left glows violet behind the first column (2026-10-29).
62
+ at: { rx: 35, ry: 34, x: 23, y: 72 },
63
+ dark: { color: "--color-purple-400", strength: 17 },
62
64
  light: { color: "--color-purple-200", strength: 14 },
63
65
  drift: { x: "6vw", y: "-4vh", scale: 1.12, fade: 0.7, duration: "70s", delay: "-20s" }
64
66
  },