@povio/ui 5.0.0-rc.2 → 5.0.0-rc.4

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 (436) hide show
  1. package/.rulesync/rules/ui-buttons-and-content.md +3 -1
  2. package/README.md +50 -7
  3. package/dist/{Accordion-CzFKi8Bp.js → Accordion-BzwO4_ml.js} +20 -136
  4. package/dist/{Alert-T25LY8ZL.js → Alert-CnvEb1D_.js} +16 -12
  5. package/dist/{Alert-f1dG-4Uy.d.ts → Alert-DfiJbKH0.d.ts} +2 -1
  6. package/dist/{AlertDialog-B6R2MbNg.d.ts → AlertDialog-OWTbR4km.d.ts} +3 -3
  7. package/dist/{Autocomplete-CQ63Cynd.d.ts → Autocomplete-BwNHp8fy.d.ts} +1 -1
  8. package/dist/{Badge-YKlKz-Jy.d.ts → Badge-CBNpj823.d.ts} +8 -5
  9. package/dist/BadgeButton-Ccgt3oGO.d.ts +15 -0
  10. package/dist/{BottomSheet-DvqBvth_.js → BottomSheet-BXLE3161.js} +7 -6
  11. package/dist/{BottomSheet-xaymO7aQ.d.ts → BottomSheet-DbQuzfAB.d.ts} +1 -1
  12. package/dist/{BottomSheet.lazy-CGBRPve_.d.ts → BottomSheet.lazy-D9LCEo7s.d.ts} +1 -1
  13. package/dist/{Breadcrumbs-DyriI-Bi.d.ts → Breadcrumbs-CUV6CU8Q.d.ts} +1 -1
  14. package/dist/{Breadcrumbs-DiIYJAWf.js → Breadcrumbs-FF8hMfXd.js} +24 -38
  15. package/dist/Button-C5rv4Cr2.js +506 -0
  16. package/dist/{Button-BZ3is6IU.d.ts → Button-D-4qb0IR.d.ts} +3 -3
  17. package/dist/{ButtonContent-B2_dZ6vA.js → ButtonContent-c7lJayVQ.js} +10 -8
  18. package/dist/{Calendar-DzQApBCy.js → Calendar-BTjajO6i.js} +25 -148
  19. package/dist/{CheckContent-DZ7Gk8GS.js → CheckContent-D7sZPmzx.js} +2 -2
  20. package/dist/{Checkbox-BepzfVfK.js → Checkbox-CV1ILXXO.js} +6 -6
  21. package/dist/{Checkbox-CHpgW3fI.d.ts → Checkbox-DVTWaMKa.d.ts} +1 -1
  22. package/dist/{CheckboxCheckmark-B3lnOjsU.js → CheckboxCheckmark-CpC3wlMs.js} +11 -11
  23. package/dist/{CheckboxGroup-CXrR3A-c.d.ts → CheckboxGroup-DGF12cmB.d.ts} +3 -3
  24. package/dist/ComponentGallery-BWiPGUL8.js +3665 -0
  25. package/dist/{DatePicker-B3l9TEjW.d.ts → DatePicker-8xSs_jNd.d.ts} +3 -3
  26. package/dist/{DatePicker-CI87jC4_.js → DatePicker-DOLL7mkc.js} +17 -16
  27. package/dist/{DatePickerInput-UBZcTmdv.js → DatePickerInput-BLBcySA2.js} +16 -26
  28. package/dist/{DatePickerInput-CZTEsrS0.d.ts → DatePickerInput-D81ZJ3fT.d.ts} +3 -3
  29. package/dist/{DateRangePicker-BX2O5zA8.js → DateRangePicker-BF-1CztH.js} +23 -194
  30. package/dist/{DateRangePicker-DKkc2B3n.d.ts → DateRangePicker-Bfq-yDm7.d.ts} +3 -3
  31. package/dist/{DateTimePicker-CVfkp45w.js → DateTimePicker-Cj0qvJUz.js} +16 -15
  32. package/dist/{DateTimePicker-IHr-wPq8.d.ts → DateTimePicker-D4lHyf6P.d.ts} +3 -3
  33. package/dist/{Dialog-DdRP4YFC.js → Dialog-9manOgMA.js} +4 -4
  34. package/dist/{Dialog-CXoVeIkU.js → Dialog-CKLkS00H.js} +10 -2
  35. package/dist/{Dialog-DEbI_9S-.d.ts → Dialog-CW93T9X1.d.ts} +3 -2
  36. package/dist/{DropdownMenu-zrodtd44.js → DropdownMenu-5jmtgLXd.js} +8 -6
  37. package/dist/{DropdownMenu-CWDhk3XA.d.ts → DropdownMenu-JNpYT4-3.d.ts} +3 -2
  38. package/dist/{DropdownMenuDesktop-CGYxsavQ.js → DropdownMenuDesktop-Cl9gZVq0.js} +9 -38
  39. package/dist/{FileInput-Dz1eESr_.js → FileInput-Br5DQaGQ.js} +10 -9
  40. package/dist/{FileInput-BQbn77bE.d.ts → FileInput-C4CE5kuP.d.ts} +5 -4
  41. package/dist/{FileTrigger-CDXcQthK.js → FileTrigger-Cthk5_Wp.js} +1 -30
  42. package/dist/{FileUpload-D3Io7Is5.js → FileUpload--7ub3EZO.js} +53 -140
  43. package/dist/{FileUpload-qySCMcLn.d.ts → FileUpload-CR7bZxV1.d.ts} +1 -1
  44. package/dist/{FileUploadContainer-qOyGvb5J.d.ts → FileUploadContainer-042ztsaL.d.ts} +1 -1
  45. package/dist/{Form-u_N_6mwo.d.ts → Form-BJ12MjE-.d.ts} +1 -1
  46. package/dist/{FormField-CHD4OJOt.js → FormField-B99dLt8o.js} +9 -9
  47. package/dist/{FormField-B0miX3gu.d.ts → FormField-Byiehm9y.d.ts} +1 -1
  48. package/dist/{FormFieldError-QRAFHUTt.js → FormFieldError-DeOHHLo2.js} +1 -1
  49. package/dist/FormFieldHeaderTooltip-BV2Ju4oB.js +17 -0
  50. package/dist/{IconButton-KXecZgYX.d.ts → IconButton-D4thBurp.d.ts} +2 -2
  51. package/dist/IconSlot-DSK7qNxc.js +79 -0
  52. package/dist/{InlineIconButton-CbKZ2U_a.d.ts → InlineIconButton-BeJCjl-q.d.ts} +2 -2
  53. package/dist/{InlineTooltipWrapper-g5yoeH1B.js → InlineTooltipWrapper-BpApaGXV.js} +3 -3
  54. package/dist/{Input-efmPwk8f.d.ts → Input-DOanwj3l.d.ts} +3 -3
  55. package/dist/{InputContent-DuBa9FuI.d.ts → InputContent-CXuP1ghQ.d.ts} +3 -3
  56. package/dist/{InputItem-2zf6QI5L.js → InputItem-CIxbTxZu.js} +11 -11
  57. package/dist/{Inputs-C-w03Q_F.d.ts → Inputs-DA73LmLc.d.ts} +1 -1
  58. package/dist/{Inputs-BceDTmdT.js → Inputs-DJSKiaWY.js} +1 -1
  59. package/dist/{Link-QYpprkN1.d.ts → Link-Ow9H7kNv.d.ts} +3 -2
  60. package/dist/{ListBox-B7DW1S7n.js → ListBox-CL8Ar4Q_.js} +5 -4
  61. package/dist/{MenuItem--Mjd_yK8.d.ts → MenuItem-DHyqOqln.d.ts} +1 -1
  62. package/dist/{Modal-CoFt5PGP.js → Modal-w60dVQcb.js} +1 -1
  63. package/dist/{NumberField-z2JatYK0.d.ts → NumberField-Cb9Gf6QJ.d.ts} +3 -3
  64. package/dist/NumberFormatter-CLDS_LRZ.js +265 -0
  65. package/dist/{NumberRangeInput-BxVrHq8R.js → NumberRangeInput-B8-LHfg3.js} +9 -8
  66. package/dist/{NumberRangeInput-Chai3iEi.d.ts → NumberRangeInput-BfbJQqzn.d.ts} +2 -2
  67. package/dist/{Pagination-CXtIDclf.d.ts → Pagination-CwQu5Py8.d.ts} +1 -1
  68. package/dist/{PaginationList-CXG4jWFD.d.ts → PaginationList-DMRUGtf8.d.ts} +1 -1
  69. package/dist/{PaginationList-0bAmvXC0.js → PaginationList-DtvuP63b.js} +2 -2
  70. package/dist/{PasswordInput-ub2TQxef.d.ts → PasswordInput-CLwFUgl0.d.ts} +1 -1
  71. package/dist/{Popover-DUKH0q9u.d.ts → Popover-BTHPteIh.d.ts} +2 -2
  72. package/dist/{Progress-DQWiFP0L.js → Progress-B3mY9rIP.js} +2 -2
  73. package/dist/{Progress-Dho39FDs.d.ts → Progress-CjWOR38H.d.ts} +2 -1
  74. package/dist/{QuerySelect-Bo1K6gi_.d.ts → QuerySelect-BGxb6Y0K.d.ts} +2 -2
  75. package/dist/{RadioGroup-B_zJdn4y.d.ts → RadioGroup-CZg2kIMk.d.ts} +3 -3
  76. package/dist/{RadioGroup-SSZYch-J.js → RadioGroup-DOw3PRoX.js} +13 -13
  77. package/dist/{RichTextEditor-D6RewmRj.js → RichTextEditor-D4yN7Wj7.js} +52 -133
  78. package/dist/{RichTextEditor-B_JX3nor.d.ts → RichTextEditor-YxuRUlI7.d.ts} +1 -1
  79. package/dist/{Select-CuZDkeQs.js → Select-UR0ec2Ux.js} +5 -4
  80. package/dist/{Select-DeapZMYx.d.ts → Select-pHbyJdZJ.d.ts} +1 -1
  81. package/dist/{SelectBase-7SE9Za2r.d.ts → SelectBase-Omiq2D3M.d.ts} +3 -3
  82. package/dist/{Slider-DJ9K_a-x.js → Slider-CzEmKYBF.js} +11 -11
  83. package/dist/{Slider-BFViQmM3.d.ts → Slider-EYlGCLWe.d.ts} +1 -1
  84. package/dist/{Spinner-BEYBu85B.js → Spinner-BeVTUzzx.js} +1 -1
  85. package/dist/{Spinner-BbcI6IOb.d.ts → Spinner-DbXeDOa2.d.ts} +2 -1
  86. package/dist/{SplitButton-lL87EcBL.d.ts → SplitButton-D9ngY1rJ.d.ts} +3 -3
  87. package/dist/{Stepper-C1YPgTBG.js → Stepper-Cp5vbL5g.js} +4 -117
  88. package/dist/{Stepper-hlhViuaK.d.ts → Stepper-TATlHZhQ.d.ts} +9 -8
  89. package/dist/{Switch-JxRmH1dX.js → Switch-CqnGEdeD.js} +11 -11
  90. package/dist/{Switch-DPftmB1b.d.ts → Switch-s_EPn0Jz.d.ts} +1 -1
  91. package/dist/Table-piX1SWvN.js +689 -0
  92. package/dist/Tag-AHfV_XSf.d.ts +44 -0
  93. package/dist/{Tag-HiDH438e.js → Tag-DPg5sL1Z.js} +22 -21
  94. package/dist/{TextArea-gikUKKDl.js → TextArea-D8WkKsGn.js} +7 -7
  95. package/dist/{TextArea-BhrCBGbq.d.ts → TextArea-l_keyLK7.d.ts} +2 -2
  96. package/dist/{TextButton-DnXRykhF.d.ts → TextButton-XUhV_1s0.d.ts} +4 -4
  97. package/dist/{TimePicker-CmT89X7v.d.ts → TimePicker-B1POvGWs.d.ts} +2 -2
  98. package/dist/{TimePicker-DtNTOOGr.js → TimePicker-C4taAOFQ.js} +15 -14
  99. package/dist/Toast-DtG3pA61.js +53 -0
  100. package/dist/{Toast-B4cXs2rj.d.ts → Toast-ruXqONDA.d.ts} +1 -1
  101. package/dist/{ToastContainer-BbsMIwtC.js → ToastContainer-qgpzMFD4.js} +4 -3
  102. package/dist/{ToggleButton-BGuzPJDO.d.ts → ToggleButton-7aP8Jb11.d.ts} +2 -2
  103. package/dist/{ToggleGroup-D9CFdM5-.d.ts → ToggleGroup-CRFDIPGZ.d.ts} +1 -1
  104. package/dist/{ToggleGroup-Cl0NS3fe.js → ToggleGroup-DOk27fgI.js} +29 -123
  105. package/dist/{Tooltip-aE1Vswxz.js → Tooltip-CpG1nz7Y.js} +8 -49
  106. package/dist/{Tooltip-D7dNwGy9.d.ts → Tooltip-DHv6vAqW.d.ts} +6 -5
  107. package/dist/{TooltipWrapper-CRf-JFeo.js → TooltipWrapper-3jyN0Wss.js} +4 -4
  108. package/dist/{Typography-B0Gp1lpc.js → Typography-LU4z2pR1.js} +2 -2
  109. package/dist/{Typography-BiuidzDC.d.ts → Typography-XljT9s02.d.ts} +1 -1
  110. package/dist/accordion.cva-CL1bVscW.js +129 -0
  111. package/dist/{autocomplete-BJ7rqWa4.d.ts → autocomplete-DeERHN8W.d.ts} +2 -2
  112. package/dist/badgeButton.cva-B2bgCQP6.d.ts +41 -0
  113. package/dist/badgeButton.cva-CvN4CTx5.js +300 -0
  114. package/dist/breadcrumbs.cva-7zzdDhVR.js +27 -0
  115. package/dist/{button.cva-BvRI-3Gn.d.ts → button.cva-C7kEhgoA.d.ts} +7 -6
  116. package/dist/{buttonContent.cva-BDT_CReI.d.ts → buttonContent.cva-DPIlROA9.d.ts} +2 -2
  117. package/dist/{checkbox-BfcE8J5P.d.ts → checkbox-DxIPDTK5.d.ts} +1 -1
  118. package/dist/{checkbox-group-CHs2wFHS.d.ts → checkbox-group-B3BOVshI.d.ts} +1 -1
  119. package/dist/{checkbox.cva-gv87kr1W.d.ts → checkbox.cva-t1Ox50hy.d.ts} +4 -3
  120. package/dist/components/accordion.js +1 -1
  121. package/dist/components/alert-dialog.d.ts +1 -1
  122. package/dist/components/alert-dialog.js +4 -4
  123. package/dist/components/alert.d.ts +1 -1
  124. package/dist/components/alert.js +1 -1
  125. package/dist/components/autocomplete.d.ts +1 -1
  126. package/dist/components/autocomplete.js +5 -4
  127. package/dist/components/badge-button.d.ts +2 -0
  128. package/dist/components/{pill-button.js → badge-button.js} +13 -12
  129. package/dist/components/badge.d.ts +1 -1
  130. package/dist/components/badge.js +56 -37
  131. package/dist/components/bottom-sheet.d.ts +2 -2
  132. package/dist/components/bottom-sheet.js +2 -2
  133. package/dist/components/breadcrumbs.d.ts +1 -1
  134. package/dist/components/breadcrumbs.js +1 -1
  135. package/dist/components/button.d.ts +2 -2
  136. package/dist/components/button.js +1 -1
  137. package/dist/components/checkbox-group.d.ts +1 -1
  138. package/dist/components/checkbox-group.js +6 -6
  139. package/dist/components/checkbox.d.ts +1 -1
  140. package/dist/components/checkbox.js +1 -1
  141. package/dist/components/date-picker.d.ts +1 -1
  142. package/dist/components/date-picker.js +1 -1
  143. package/dist/components/date-range-picker.d.ts +1 -1
  144. package/dist/components/date-range-picker.js +1 -1
  145. package/dist/components/date-time-picker.d.ts +1 -1
  146. package/dist/components/date-time-picker.js +1 -1
  147. package/dist/components/dialog.d.ts +1 -1
  148. package/dist/components/dialog.js +1 -1
  149. package/dist/components/drawer.js +3 -3
  150. package/dist/components/dropdown-menu.d.ts +2 -2
  151. package/dist/components/dropdown-menu.js +2 -2
  152. package/dist/components/file-input.d.ts +1 -1
  153. package/dist/components/file-input.js +1 -1
  154. package/dist/components/file-upload-container.d.ts +2 -2
  155. package/dist/components/file-upload-container.js +1 -1
  156. package/dist/components/file-upload.d.ts +2 -2
  157. package/dist/components/file-upload.js +1 -1
  158. package/dist/components/form-field.d.ts +1 -1
  159. package/dist/components/form-field.js +1 -1
  160. package/dist/components/icon-button.d.ts +1 -1
  161. package/dist/components/icon-button.js +2 -2
  162. package/dist/components/icon-slot.d.ts +2 -0
  163. package/dist/components/icon-slot.js +2 -0
  164. package/dist/components/inline-icon-button.d.ts +1 -1
  165. package/dist/components/inline-icon-button.js +1 -1
  166. package/dist/components/input.d.ts +1 -1
  167. package/dist/components/input.js +7 -7
  168. package/dist/components/link.d.ts +1 -1
  169. package/dist/components/link.js +32 -1
  170. package/dist/components/number-field.d.ts +1 -1
  171. package/dist/components/number-field.js +10 -9
  172. package/dist/components/number-range-input.d.ts +1 -1
  173. package/dist/components/number-range-input.js +1 -1
  174. package/dist/components/pagination-list.d.ts +1 -1
  175. package/dist/components/pagination-list.js +1 -1
  176. package/dist/components/pagination.d.ts +1 -1
  177. package/dist/components/pagination.js +34 -30
  178. package/dist/components/password-input.d.ts +1 -1
  179. package/dist/components/popover.d.ts +1 -1
  180. package/dist/components/popover.js +6 -5
  181. package/dist/components/progress.d.ts +1 -1
  182. package/dist/components/progress.js +1 -1
  183. package/dist/components/query-autocomplete.d.ts +2 -2
  184. package/dist/components/query-autocomplete.js +2 -2
  185. package/dist/components/query-select.d.ts +1 -1
  186. package/dist/components/query-select.js +3 -3
  187. package/dist/components/radio-group.d.ts +1 -1
  188. package/dist/components/radio-group.js +1 -1
  189. package/dist/components/select.d.ts +2 -2
  190. package/dist/components/select.js +1 -1
  191. package/dist/components/slider.d.ts +1 -1
  192. package/dist/components/slider.js +1 -1
  193. package/dist/components/spinner.d.ts +1 -1
  194. package/dist/components/spinner.js +1 -1
  195. package/dist/components/split-button.d.ts +1 -1
  196. package/dist/components/split-button.js +3 -3
  197. package/dist/components/stepper.d.ts +1 -1
  198. package/dist/components/stepper.js +1 -1
  199. package/dist/components/switch.d.ts +1 -1
  200. package/dist/components/switch.js +1 -1
  201. package/dist/components/tag.d.ts +1 -1
  202. package/dist/components/tag.js +1 -1
  203. package/dist/components/text-area.d.ts +1 -1
  204. package/dist/components/text-area.js +1 -1
  205. package/dist/components/text-button.d.ts +1 -1
  206. package/dist/components/text-button.js +1 -1
  207. package/dist/components/time-picker.d.ts +1 -1
  208. package/dist/components/time-picker.js +1 -1
  209. package/dist/components/toast.d.ts +2 -2
  210. package/dist/components/toast.js +2 -2
  211. package/dist/components/toggle-button.d.ts +1 -1
  212. package/dist/components/toggle-button.js +1 -1
  213. package/dist/components/toggle-group.d.ts +2 -2
  214. package/dist/components/toggle-group.js +1 -1
  215. package/dist/components/tooltip-ellipsis.js +1 -1
  216. package/dist/components/tooltip.d.ts +1 -1
  217. package/dist/components/tooltip.js +1 -1
  218. package/dist/components/typography.d.ts +2 -2
  219. package/dist/components/typography.js +1 -1
  220. package/dist/components/use-toast.d.ts +1 -1
  221. package/dist/components/use-toast.js +2 -2
  222. package/dist/config/confirmation.d.ts +1 -1
  223. package/dist/config/link-context.d.ts +2 -2
  224. package/dist/config/ui-config.d.ts +2 -2
  225. package/dist/config/ui-config.js +1 -1
  226. package/dist/config/ui-configurator-theme.d.ts +2 -0
  227. package/dist/config/ui-configurator-theme.js +2 -0
  228. package/dist/config/ui-configurator-vite.d.ts +10 -0
  229. package/dist/config/ui-configurator-vite.js +174 -0
  230. package/dist/config/ui-configurator.d.ts +934 -0
  231. package/dist/config/ui-configurator.js +4555 -0
  232. package/dist/config/ui-overrides.d.ts +1 -1
  233. package/dist/config/ui-overrides.js +1 -1
  234. package/dist/config/ui-router.js +1 -1
  235. package/dist/{confirmation.context-DPAKsLYl.d.ts → confirmation.context-BOeEVczb.d.ts} +1 -1
  236. package/dist/{date-picker-BYFWSbN8.d.ts → date-picker-DnxDmlOW.d.ts} +1 -1
  237. package/dist/{date-range-picker-BaaXOObm.d.ts → date-range-picker-DHDOSvHN.d.ts} +1 -1
  238. package/dist/{date-time-picker-D42cTCgx.d.ts → date-time-picker-UkTa0OJ8.d.ts} +1 -1
  239. package/dist/datePickerInput.cva-Cd7UUN61.js +14 -0
  240. package/dist/{datePickerValue.utils-CFCY-fRJ.js → datePickerValue.utils-DCgoSrP3.js} +9 -9
  241. package/dist/{dialog.cva---xiOXMQ.js → dialog.cva-COhDZaVl.js} +4 -4
  242. package/dist/{dist-B8h0VT0E.js → dist-CAdwxJbe.js} +1 -208
  243. package/dist/{dom.utils-DjuRTR6U.js → dom.utils-D1AopHx9.js} +1 -1
  244. package/dist/dropdownMenu.cva-DvEmX0bs.js +34 -0
  245. package/dist/{dynamicInputs-wEEikYeg.d.ts → dynamicInputs-iP39lVKf.d.ts} +102 -100
  246. package/dist/{fieldAdapter-C0lCFmf0.js → fieldAdapter-DjYls12j.js} +1 -1
  247. package/dist/{file-input-C56GXRwz.d.ts → file-input-DkbkdI7l.d.ts} +1 -1
  248. package/dist/{file-upload-Bx0X534g.d.ts → file-upload-CTsPhxJk.d.ts} +2 -2
  249. package/dist/fileUpload.cva-ujmStxB1.js +42 -0
  250. package/dist/{fileUpload.types-DWuQKA2l.d.ts → fileUpload.types-n5FxK_F-.d.ts} +2 -2
  251. package/dist/hooks/use-filters.js +1 -1
  252. package/dist/iconSlot.cva-CnpFzAOR.d.ts +21 -0
  253. package/dist/icons.d.ts +2 -1
  254. package/dist/icons.js +2 -1
  255. package/dist/index.d.ts +87 -86
  256. package/dist/index.js +57 -46
  257. package/dist/info-iUmX3uDk.js +32 -0
  258. package/dist/{input-D2kGX0hW.d.ts → input-CdQNCPgH.d.ts} +1 -1
  259. package/dist/{input.cva-BhDJxc7r.d.ts → input.cva-BsHgYa-L.d.ts} +3 -2
  260. package/dist/{input.cva-BcXyC1vZ.js → input.cva-DJA8ovm_.js} +9 -9
  261. package/dist/{link.context-CDZn6oL2.d.ts → link.context-D5qyz9Rf.d.ts} +1 -1
  262. package/dist/link.cva-DMTHZiJG.js +12 -0
  263. package/dist/{number-field-Bw2GKr0s.d.ts → number-field-CUDbenNV.d.ts} +1 -1
  264. package/dist/{number-range-input-Dqe6x2dR.d.ts → number-range-input-DZGrcvjL.d.ts} +1 -1
  265. package/dist/numberStatic.utils-BX50PSee.js +421 -0
  266. package/dist/{password-input-DepKyhh3.d.ts → password-input-fYN20cQO.d.ts} +1 -1
  267. package/dist/{popover.cva-BJSkLndY.js → popover.cva-Bhud1wnp.js} +1 -1
  268. package/dist/popoverAnimation-DEZSvKP8.js +4 -0
  269. package/dist/{query-autocomplete-BSpHin_R.d.ts → query-autocomplete-CfuQeiYG.d.ts} +2 -2
  270. package/dist/{query-select-m1DCp4UF.d.ts → query-select-CuT_sE6a.d.ts} +2 -2
  271. package/dist/{queryAutocomplete.types-CrbVUmvl.d.ts → queryAutocomplete.types-tl3r6iaY.d.ts} +2 -2
  272. package/dist/{radio-group-Civ3Fb70.d.ts → radio-group-B3ccPf0p.d.ts} +1 -1
  273. package/dist/{radio.cva-BlOrmxzf.d.ts → radio.cva-DN9VQ3Kb.d.ts} +4 -3
  274. package/dist/rhf/autocomplete.d.ts +2 -2
  275. package/dist/rhf/autocomplete.js +1 -1
  276. package/dist/rhf/checkbox-group.d.ts +2 -2
  277. package/dist/rhf/checkbox-group.js +1 -1
  278. package/dist/rhf/checkbox.d.ts +2 -2
  279. package/dist/rhf/checkbox.js +2 -2
  280. package/dist/rhf/date-picker.d.ts +2 -2
  281. package/dist/rhf/date-picker.js +2 -2
  282. package/dist/rhf/date-range-picker.d.ts +2 -2
  283. package/dist/rhf/date-range-picker.js +2 -2
  284. package/dist/rhf/date-time-picker.d.ts +2 -2
  285. package/dist/rhf/date-time-picker.js +2 -2
  286. package/dist/rhf/file-input.d.ts +2 -2
  287. package/dist/rhf/file-input.js +2 -2
  288. package/dist/rhf/file-upload.d.ts +2 -2
  289. package/dist/rhf/file-upload.js +2 -2
  290. package/dist/rhf/input.d.ts +2 -2
  291. package/dist/rhf/input.js +1 -1
  292. package/dist/rhf/inputs.d.ts +2 -2
  293. package/dist/rhf/number-field.d.ts +2 -2
  294. package/dist/rhf/number-field.js +1 -1
  295. package/dist/rhf/number-range-input.d.ts +2 -2
  296. package/dist/rhf/number-range-input.js +2 -2
  297. package/dist/rhf/password-input.d.ts +2 -2
  298. package/dist/rhf/password-input.js +1 -1
  299. package/dist/rhf/query-autocomplete.d.ts +1 -1
  300. package/dist/rhf/query-autocomplete.js +1 -1
  301. package/dist/rhf/query-select.d.ts +1 -1
  302. package/dist/rhf/query-select.js +1 -1
  303. package/dist/rhf/radio-group.d.ts +2 -2
  304. package/dist/rhf/radio-group.js +2 -2
  305. package/dist/rhf/rich-text-editor.d.ts +2 -2
  306. package/dist/rhf/rich-text-editor.js +2 -2
  307. package/dist/rhf/select.d.ts +2 -2
  308. package/dist/rhf/select.js +2 -2
  309. package/dist/rhf/slider.d.ts +2 -2
  310. package/dist/rhf/slider.js +2 -2
  311. package/dist/rhf/switch.d.ts +2 -2
  312. package/dist/rhf/switch.js +2 -2
  313. package/dist/rhf/text-area.d.ts +2 -2
  314. package/dist/rhf/text-area.js +2 -2
  315. package/dist/rhf/time-picker.d.ts +2 -2
  316. package/dist/rhf/time-picker.js +2 -2
  317. package/dist/rhf/toggle-group.d.ts +2 -2
  318. package/dist/rhf/toggle-group.js +2 -2
  319. package/dist/{rhf-D8B7mLO1.js → rhf-t348TCCL.js} +1 -1
  320. package/dist/rhf.d.ts +87 -86
  321. package/dist/rhf.js +57 -46
  322. package/dist/{rich-text-editor-DvNEOIux.d.ts → rich-text-editor-B-Onl7T8.d.ts} +1 -1
  323. package/dist/rich-text-editor.d.ts +1 -1
  324. package/dist/rich-text-editor.js +1 -1
  325. package/dist/{router.context-B0jTMtE0.js → router.context-B4FvsTim.js} +2 -2
  326. package/dist/{select-DY5QtwqI.d.ts → select-B4a52eWW.d.ts} +2 -2
  327. package/dist/selectDesktop.cva-CHAMxhfO.js +69 -0
  328. package/dist/{slider-CrB-Gkcv.d.ts → slider-dNj9jruO.d.ts} +1 -1
  329. package/dist/staticDateTimeSegments-DtU63_dw.js +1764 -0
  330. package/dist/{staticSelect.utils-Cm7MoDVG.js → staticSelect.utils-uHa8f_c6.js} +33 -231
  331. package/dist/stepper.cva-CZ0Kj-s7.js +116 -0
  332. package/dist/style-merge.util-zLimKwt6.d.ts +40 -0
  333. package/dist/styles/color-utilities.css +13 -25
  334. package/dist/styles/configurator.css +2365 -0
  335. package/dist/styles/input.d.ts +1 -1
  336. package/dist/{switch-8WzXfTS8.d.ts → switch-C--iWnY8.d.ts} +1 -1
  337. package/dist/switch.cva-CWNzmdRc.d.ts +16 -0
  338. package/dist/table.cva-DlMT-zLD.js +48 -0
  339. package/dist/tanstack/autocomplete.d.ts +1 -1
  340. package/dist/tanstack/checkbox-group.d.ts +1 -1
  341. package/dist/tanstack/checkbox.d.ts +1 -1
  342. package/dist/tanstack/checkbox.js +1 -1
  343. package/dist/tanstack/date-picker.d.ts +1 -1
  344. package/dist/tanstack/date-picker.js +1 -1
  345. package/dist/tanstack/date-range-picker.d.ts +1 -1
  346. package/dist/tanstack/date-range-picker.js +1 -1
  347. package/dist/tanstack/date-time-picker.d.ts +1 -1
  348. package/dist/tanstack/date-time-picker.js +1 -1
  349. package/dist/tanstack/file-input.d.ts +1 -1
  350. package/dist/tanstack/file-input.js +1 -1
  351. package/dist/tanstack/file-upload.d.ts +2 -2
  352. package/dist/tanstack/file-upload.js +1 -1
  353. package/dist/tanstack/form.d.ts +1 -1
  354. package/dist/tanstack/form.js +1 -1
  355. package/dist/tanstack/input.d.ts +1 -1
  356. package/dist/tanstack/inputs.d.ts +3 -3
  357. package/dist/tanstack/inputs.js +1 -1
  358. package/dist/tanstack/number-field.d.ts +1 -1
  359. package/dist/tanstack/number-range-input.d.ts +1 -1
  360. package/dist/tanstack/number-range-input.js +1 -1
  361. package/dist/tanstack/password-input.d.ts +1 -1
  362. package/dist/tanstack/query-select.d.ts +1 -1
  363. package/dist/tanstack/radio-group.d.ts +1 -1
  364. package/dist/tanstack/radio-group.js +1 -1
  365. package/dist/tanstack/rich-text-editor.d.ts +1 -1
  366. package/dist/tanstack/rich-text-editor.js +1 -1
  367. package/dist/tanstack/select.d.ts +1 -1
  368. package/dist/tanstack/select.js +1 -1
  369. package/dist/tanstack/slider.d.ts +1 -1
  370. package/dist/tanstack/slider.js +1 -1
  371. package/dist/tanstack/switch.d.ts +1 -1
  372. package/dist/tanstack/switch.js +1 -1
  373. package/dist/tanstack/table.d.ts +1 -1
  374. package/dist/tanstack/table.js +2 -1
  375. package/dist/tanstack/text-area.d.ts +1 -1
  376. package/dist/tanstack/text-area.js +1 -1
  377. package/dist/tanstack/time-picker.d.ts +1 -1
  378. package/dist/tanstack/time-picker.js +1 -1
  379. package/dist/tanstack/toggle-group.d.ts +2 -2
  380. package/dist/tanstack/toggle-group.js +1 -1
  381. package/dist/tanstack.d.ts +71 -70
  382. package/dist/tanstack.js +68 -55
  383. package/dist/{text-area-CqnKRWKq.d.ts → text-area-DQAtpOQp.d.ts} +1 -1
  384. package/dist/theme-model-DtYPxNvH.js +406 -0
  385. package/dist/theme-model-T1zIdBg8.d.ts +12 -0
  386. package/dist/{time-picker-Cz1GIzpF.d.ts → time-picker-DoGfbil6.d.ts} +1 -1
  387. package/dist/{toast.cva-Cj6o2Rmu.d.ts → toast.cva-By5lvAfr.d.ts} +3 -2
  388. package/dist/toast.cva-C_L_RffH.js +163 -0
  389. package/dist/{toast.runtime-CIKvmkjo.js → toast.runtime-cxex9e4E.js} +2 -1
  390. package/dist/{toggle-group-CPkKHm1t.d.ts → toggle-group-C1nMDOwz.d.ts} +1 -1
  391. package/dist/toggleGroup.cva-MbpaEBg1.js +35 -0
  392. package/dist/{toggleGroup.types-DD6uRI5G.d.ts → toggleGroup.types-Bp43zbSQ.d.ts} +2 -1
  393. package/dist/tooltip.cva-BIzlOXHH.js +48 -0
  394. package/dist/{tooltipWrapper.cva-CUu8pI-a.js → tooltipWrapper.cva-BBQ4ic3D.js} +1 -1
  395. package/dist/{typography.cva-jtp6WWUH.d.ts → typography.cva-D1JOEYl-.d.ts} +2 -1
  396. package/dist/{typography.cva-CJZZSGXW.js → typography.cva-iD15k56p.js} +1 -1
  397. package/dist/{uiConfig.context-D2eUIPHn.js → uiConfig.context-BS3r_kTS.js} +1 -1
  398. package/dist/{uiConfig.context-aoarCLYX.d.ts → uiConfig.context-DeBX2beU.d.ts} +8 -8
  399. package/dist/{uiOverrides.context-Bfm2n-n8.js → uiOverrides.context-BTCH9y5a.js} +2 -2
  400. package/dist/{uiOverrides.context-C3xb4Ttq.d.ts → uiOverrides.context-DEp139He.d.ts} +11 -44
  401. package/dist/underline-66hmELxa.js +81 -0
  402. package/dist/upload-CXU83BJ4.js +30 -0
  403. package/dist/{useBreakpoint-BOA-MyoT.js → useBreakpoint-DQoMN-BG.js} +1 -1
  404. package/dist/useControlledState-CzXkZCX8.js +30 -0
  405. package/dist/{useFieldAccessibility-D2_Qm26-.js → useFieldAccessibility-ScC6Mtd5.js} +15 -8
  406. package/dist/{useFilters-kkEUFKmQ.js → useFilters-XNH27Md2.js} +1 -1
  407. package/dist/{useFormAutosave-BYFn3LH8.js → useFormAutosave-DfuP7drj.js} +2 -2
  408. package/dist/{useStaticInputHandoff-DB9PgioW.js → useStaticInputHandoff-NeZVnci-.js} +14 -11
  409. package/dist/useTableColumnConfig-BTGZiluz.js +892 -0
  410. package/dist/{useTableNav-D9mICzNW.d.ts → useTableNav-Ckj5PBRk.d.ts} +3 -2
  411. package/dist/{useToast-DMSm59Y6.d.ts → useToast-yreVCUer.d.ts} +1 -1
  412. package/package.json +31 -5
  413. package/src/configurator/README.md +71 -0
  414. package/dist/Button-sn52l1Yv.js +0 -506
  415. package/dist/FocusScope-CO9oJ1sc.js +0 -343
  416. package/dist/FormFieldHeaderTooltip-Dl24v4_j.js +0 -45
  417. package/dist/Link-Btxj2gzg.js +0 -42
  418. package/dist/PillButton-DASBXLFB.d.ts +0 -15
  419. package/dist/Tag-Cch_68QO.d.ts +0 -43
  420. package/dist/chain-DIXr2VAT.js +0 -10
  421. package/dist/components/pill-button.d.ts +0 -2
  422. package/dist/focusSafely-DCGrr2bb.js +0 -447
  423. package/dist/getScrollParent-kSR7EtoT.js +0 -47
  424. package/dist/numberStatic.utils-BMgRzyd3.js +0 -902
  425. package/dist/openLink-CQhMhfzO.js +0 -121
  426. package/dist/pillButton.cva-BEWuu0qm.d.ts +0 -34
  427. package/dist/pillButton.cva-DlP5tOT5.js +0 -197
  428. package/dist/platform-BXNIIAfU.js +0 -42
  429. package/dist/staticDateTimeSegments-DR8bJw-F.js +0 -3605
  430. package/dist/switch.cva-8T0fw31t.d.ts +0 -15
  431. package/dist/useControlledState-DQxX6LMN.js +0 -189
  432. package/dist/useFocusable-Bd0UsrQ7.js +0 -63
  433. package/dist/useFormValidationState-D3z-gafz.js +0 -1341
  434. package/dist/useLayoutEffect-B2-1tbPJ.js +0 -83
  435. package/dist/useSyncRef-RGMv0rXK.js +0 -338
  436. package/dist/useTableColumnConfig-CcJxu14U.js +0 -1625
@@ -0,0 +1,4555 @@
1
+ import { t as createLucideIcon } from "../createLucideIcon-LcezOE4z.js";
2
+ import { t as UIConfig } from "../uiConfig.context-BS3r_kTS.js";
3
+ import { t as Check } from "../check-DYMBkp_Z.js";
4
+ import { t as ChevronDown } from "../chevron-down-B4Pr8bD3.js";
5
+ import { t as ChevronRight } from "../chevron-right-3nKJR5Bb.js";
6
+ import { t as Info } from "../info-iUmX3uDk.js";
7
+ import { a as checkboxDefinition, i as checkboxContentWrapperDefinition, o as checkboxGroupLabelDefinition, r as checkboxContentRowDefinition, s as checkboxIconDefinition, u as Minus } from "../CheckboxCheckmark-CpC3wlMs.js";
8
+ import { i as Search, n as selectListBoxItemDefinition, r as selectInputTagsContentWrapperDefinition, t as selectPopoverDefinition } from "../selectDesktop.cva-CHAMxhfO.js";
9
+ import { t as Upload } from "../upload-CXU83BJ4.js";
10
+ import { t as clsx } from "../clsx-CnD0nOiA.js";
11
+ import { n as StyleMergeUtils, r as cva, t as UIOverrides } from "../uiOverrides.context-BTCH9y5a.js";
12
+ import { c as $7230ffa83bc0c2cf$export$ef03459518577ad4, i as $7230ffa83bc0c2cf$export$9d4c57ee4c6ffdd8, l as $7230ffa83bc0c2cf$export$fabf2dc03a41866e, n as $7230ffa83bc0c2cf$export$29f1550f4b0d4415, r as $7230ffa83bc0c2cf$export$4d86445c2cf5e3, s as $7230ffa83bc0c2cf$export$df3a06d6289f983e, t as $7230ffa83bc0c2cf$export$2881499e37b75b9a } from "../utils-Czcqspm7.js";
13
+ import { c as $542a13ca2fa5b484$export$5b6b19405a83ff9d, d as $53e61d82d8b8611d$export$8b251419efc915eb, l as $542a13ca2fa5b484$export$9b9a0cd73afb7ca4, n as $f2ff30fde7b014be$export$3ddf2d174ce01153, r as $f2ff30fde7b014be$export$d2f961adcb0afbe } from "../Dialog-CKLkS00H.js";
14
+ import { t as $43a3b93638fe5db9$export$75b6ee27786ba447 } from "../Label-B2-B-uFY.js";
15
+ import { n as $7705c033048f6da7$export$353f5b6fc5456de1, t as $7705c033048f6da7$export$24d547caef80ccd1 } from "../Button-D6KlWSFL.js";
16
+ import { t as $2ec61d1d4f780267$export$a8a3e93435678ff9 } from "../Heading-nI1_VOaE.js";
17
+ import { t as $efe09c6d1c304b50$export$9afb8bc826b033ea } from "../Text-D2MPZ3sY.js";
18
+ import { n as $1f3c3b1a70cec653$export$ff05c3ac10437e03, t as $cdaed739b1139372$export$c24727297075ec6a } from "../Form-DlQcyN1f.js";
19
+ import { t as Checkbox } from "../Checkbox-CV1ILXXO.js";
20
+ import { a as $928221da08ecbc62$export$dca12b0bb56e4fc, i as $928221da08ecbc62$export$a11e76429ed99b4, n as $928221da08ecbc62$export$7c5906fe4f1f2af2, r as $928221da08ecbc62$export$7ff8f37d2d81a48d, t as $928221da08ecbc62$export$41f133550aa26f48 } from "../ListBox-CL8Ar4Q_.js";
21
+ import { n as $8b8d26808cb8cb53$export$8948f78d83984c69, t as $8b8d26808cb8cb53$export$2b77a92f1a5ad772 } from "../Modal-w60dVQcb.js";
22
+ import { i as radioDefinition, n as radioContentRowDefinition, r as radioContentWrapperDefinition, t as RadioGroup } from "../RadioGroup-DOw3PRoX.js";
23
+ import { n as switchDefinition, t as Switch } from "../Switch-CqnGEdeD.js";
24
+ import { n as textAreaWrapperDefinition, t as TextArea } from "../TextArea-D8WkKsGn.js";
25
+ import { a as breadcrumbsDefinition, i as breadcrumbSegmentDefinition, n as breadcrumbIconDefinition, r as breadcrumbItemDefinition, t as breadcrumbChevronDefinition } from "../breadcrumbs.cva-7zzdDhVR.js";
26
+ import { i as menuPopoverWrapperDefinition, n as menuItemDefinition, r as menuPopoverDefinition, t as dropdownMenuDefinition } from "../dropdownMenu.cva-DvEmX0bs.js";
27
+ import { i as tooltipTextDefinition, n as tooltipPointerHorizontalDefinition, r as tooltipPointerVerticalDefinition, t as tooltipDefinition } from "../tooltip.cva-BIzlOXHH.js";
28
+ import { t as typographyDefinition } from "../typography.cva-iD15k56p.js";
29
+ import { a as buttonSizeDefinition, i as buttonIconSizeDefinition, n as buttonContentDefinition, r as buttonDefinition, t as Button } from "../Button-C5rv4Cr2.js";
30
+ import { r as badgeButtonDefinition } from "../badgeButton.cva-CvN4CTx5.js";
31
+ import { BadgeButton } from "../components/badge-button.js";
32
+ import { n as formFieldErrorDefinition } from "../FormFieldError-DeOHHLo2.js";
33
+ import { a as formFieldHeaderDefinition, i as labelDefinition, n as formFieldHelperDefinition } from "../FormField-B99dLt8o.js";
34
+ import { n as tagDefinition, t as Tag } from "../Tag-DPg5sL1Z.js";
35
+ import { a as inputSizeDefinition, i as inputSideDefinition, n as inputClearClassDefinition, r as inputContentWrapperDefinition, t as inputBaseDefinition } from "../input.cva-DJA8ovm_.js";
36
+ import { t as popoverDefinition } from "../popover.cva-Bhud1wnp.js";
37
+ import { Input } from "../components/input.js";
38
+ import { t as datePickerInputContentRowDefinition } from "../datePickerInput.cva-Cd7UUN61.js";
39
+ import { a as progressTrackWrapperDefinition, i as progressTrackDefinition, n as progressDefinition, o as progressValueDefinition, r as progressFillDefinition, t as Progress } from "../Progress-B3mY9rIP.js";
40
+ import { t as fileUploadDropZoneDefinition } from "../fileUpload.cva-ujmStxB1.js";
41
+ import { n as toggleGroupItemDefinition, t as toggleGroupDefinition } from "../toggleGroup.cva-MbpaEBg1.js";
42
+ import { a as accordionHeadingTitleDefinition, c as accordionPanelContentDefinition, i as accordionHeadingSubtitleDefinition, l as accordionPanelDefinition, n as accordionDefinition, o as accordionIconDefinition, r as accordionHeadingDefinition, s as accordionItemDefinition, t as accordionChevronDefinition, u as accordionTriggerDefinition } from "../accordion.cva-CL1bVscW.js";
43
+ import { a as stepperSeparatorDefinition, i as stepperNumberDefinition, n as stepperIconDefinition, o as stepperSubtextDefinition, r as stepperItemDefinition, s as stepperTitleDefinition, t as stepperDefinition } from "../stepper.cva-CZ0Kj-s7.js";
44
+ import { i as dialogOverlayDefinition, n as dialogMainDefinition, t as dialogContentDefinition } from "../dialog.cva-COhDZaVl.js";
45
+ import { i as alertDefinition, n as statusIconDefinition, r as statusSeparatorDefinition, t as Alert } from "../Alert-CnvEb1D_.js";
46
+ import { a as toastDefinition, i as toastContainerDefinition } from "../toast.cva-C_L_RffH.js";
47
+ import { a as tableHeaderTextDefinition, i as tableHeadRowDefinition, n as tableDataDefinition, o as tableRowDefinition, r as tableHeadDataDefinition, s as theadDefinition, t as tableCellTextDefinition } from "../table.cva-DlMT-zLD.js";
48
+ import { t as linkDefinition } from "../link.cva-DMTHZiJG.js";
49
+ import { t as tooltipWrapperTriggerDefinition } from "../tooltipWrapper.cva-BBQ4ic3D.js";
50
+ import { C as validToken, S as toRgb, _ as parseThemeCss, a as generateShades, b as spacingLevels, c as isFontSizeToken, d as layoutKindFor, f as layoutKinds, g as listedLayoutToken, h as linkedLayoutTokens, i as exportCss, l as isRgb, m as layoutScales, n as controlHeightCounterpart, o as groupFor, p as layoutLevelFor, r as emptyTheme, s as groups, t as baseColorNames, u as labelFor, v as previewTokens, x as toHex, y as runtimeCss } from "../theme-model-DtYPxNvH.js";
51
+ import $ahdqC$react, { Suspense, createContext, lazy, use, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
52
+ import { c } from "react/compiler-runtime";
53
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
54
+ import { mergeProps } from "react-aria/mergeProps";
55
+ import { CollectionBuilder } from "react-aria/CollectionBuilder";
56
+ import { filterDOMProps } from "react-aria/filterDOMProps";
57
+ import { useFocusRing } from "react-aria/useFocusRing";
58
+ import { createHideableComponent } from "react-aria/private/collections/Hidden";
59
+ import "react-aria/useLocalizedStringFormatter";
60
+ import "react-aria/useListFormatter";
61
+ import { HiddenSelect, useSelect } from "react-aria/useSelect";
62
+ import { useSelectState } from "react-stately/useSelectState";
63
+ //#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/arrow-down-to-line.mjs
64
+ /**
65
+ * @license lucide-react v1.43.0 - ISC
66
+ *
67
+ * This source code is licensed under the ISC license.
68
+ * See the LICENSE file in the root directory of this source tree.
69
+ */
70
+ const __iconData$5 = {
71
+ name: "arrow-down-to-line",
72
+ size: 24,
73
+ node: [
74
+ ["path", {
75
+ d: "M12 17V3",
76
+ key: "1cwfxf"
77
+ }],
78
+ ["path", {
79
+ d: "m6 11 6 6 6-6",
80
+ key: "12ii2o"
81
+ }],
82
+ ["path", {
83
+ d: "M19 21H5",
84
+ key: "150jfl"
85
+ }]
86
+ ]
87
+ };
88
+ __iconData$5.node;
89
+ const ArrowDownToLine = createLucideIcon(__iconData$5);
90
+ //#endregion
91
+ //#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/chevrons-up-down.mjs
92
+ /**
93
+ * @license lucide-react v1.43.0 - ISC
94
+ *
95
+ * This source code is licensed under the ISC license.
96
+ * See the LICENSE file in the root directory of this source tree.
97
+ */
98
+ const __iconData$4 = {
99
+ name: "chevrons-up-down",
100
+ size: 24,
101
+ node: [["path", {
102
+ d: "m7 15 5 5 5-5",
103
+ key: "1hf1tw"
104
+ }], ["path", {
105
+ d: "m7 9 5-5 5 5",
106
+ key: "sgt6xg"
107
+ }]]
108
+ };
109
+ __iconData$4.node;
110
+ const ChevronsUpDown = createLucideIcon(__iconData$4);
111
+ //#endregion
112
+ //#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/moon.mjs
113
+ /**
114
+ * @license lucide-react v1.43.0 - ISC
115
+ *
116
+ * This source code is licensed under the ISC license.
117
+ * See the LICENSE file in the root directory of this source tree.
118
+ */
119
+ const __iconData$3 = {
120
+ name: "moon",
121
+ size: 24,
122
+ node: [["path", {
123
+ d: "M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",
124
+ key: "kfwtm"
125
+ }]]
126
+ };
127
+ __iconData$3.node;
128
+ const Moon = createLucideIcon(__iconData$3);
129
+ //#endregion
130
+ //#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/plus.mjs
131
+ /**
132
+ * @license lucide-react v1.43.0 - ISC
133
+ *
134
+ * This source code is licensed under the ISC license.
135
+ * See the LICENSE file in the root directory of this source tree.
136
+ */
137
+ const __iconData$2 = {
138
+ name: "plus",
139
+ size: 24,
140
+ node: [["path", {
141
+ d: "M5 12h14",
142
+ key: "1ays0h"
143
+ }], ["path", {
144
+ d: "M12 5v14",
145
+ key: "s699le"
146
+ }]]
147
+ };
148
+ __iconData$2.node;
149
+ const Plus = createLucideIcon(__iconData$2);
150
+ //#endregion
151
+ //#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/rotate-ccw.mjs
152
+ /**
153
+ * @license lucide-react v1.43.0 - ISC
154
+ *
155
+ * This source code is licensed under the ISC license.
156
+ * See the LICENSE file in the root directory of this source tree.
157
+ */
158
+ const __iconData$1 = {
159
+ name: "rotate-ccw",
160
+ size: 24,
161
+ node: [["path", {
162
+ d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",
163
+ key: "1357e3"
164
+ }], ["path", {
165
+ d: "M3 3v5h5",
166
+ key: "1xhq8a"
167
+ }]]
168
+ };
169
+ __iconData$1.node;
170
+ const RotateCcw = createLucideIcon(__iconData$1);
171
+ //#endregion
172
+ //#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/sun.mjs
173
+ /**
174
+ * @license lucide-react v1.43.0 - ISC
175
+ *
176
+ * This source code is licensed under the ISC license.
177
+ * See the LICENSE file in the root directory of this source tree.
178
+ */
179
+ const __iconData = {
180
+ name: "sun",
181
+ size: 24,
182
+ node: [
183
+ ["circle", {
184
+ cx: "12",
185
+ cy: "12",
186
+ r: "4",
187
+ key: "4exip2"
188
+ }],
189
+ ["path", {
190
+ d: "M12 2v2",
191
+ key: "tus03m"
192
+ }],
193
+ ["path", {
194
+ d: "M12 20v2",
195
+ key: "1lh1kg"
196
+ }],
197
+ ["path", {
198
+ d: "m4.93 4.93 1.41 1.41",
199
+ key: "149t6j"
200
+ }],
201
+ ["path", {
202
+ d: "m17.66 17.66 1.41 1.41",
203
+ key: "ptbguv"
204
+ }],
205
+ ["path", {
206
+ d: "M2 12h2",
207
+ key: "1t8f8n"
208
+ }],
209
+ ["path", {
210
+ d: "M20 12h2",
211
+ key: "1q8mjw"
212
+ }],
213
+ ["path", {
214
+ d: "m6.34 17.66-1.41 1.41",
215
+ key: "1m8zz5"
216
+ }],
217
+ ["path", {
218
+ d: "m19.07 4.93-1.41 1.41",
219
+ key: "1shlcs"
220
+ }]
221
+ ]
222
+ };
223
+ __iconData.node;
224
+ const Sun = createLucideIcon(__iconData);
225
+ //#endregion
226
+ //#region ../../node_modules/.bun/react-aria-components@1.21.1+67f6792bdf102c28/node_modules/react-aria-components/dist/private/Select.mjs
227
+ const $c8bb816105474884$export$7540cee5be7dc19b = /*#__PURE__*/ createContext(null);
228
+ const $c8bb816105474884$export$ef445b55be0601bd = /*#__PURE__*/ createContext(null);
229
+ const $c8bb816105474884$export$ef9b1a59e592288f = /*#__PURE__*/ createHideableComponent(function Select(props, ref) {
230
+ [props, ref] = $7230ffa83bc0c2cf$export$29f1550f4b0d4415(props, ref, $c8bb816105474884$export$7540cee5be7dc19b);
231
+ let { children, isDisabled = false, isInvalid = false, isRequired = false } = props;
232
+ let content = useMemo(() => typeof children === "function" ? children({
233
+ isOpen: false,
234
+ isDisabled,
235
+ isInvalid,
236
+ isRequired,
237
+ isFocused: false,
238
+ isFocusVisible: false,
239
+ defaultChildren: null
240
+ }) : children, [
241
+ children,
242
+ isDisabled,
243
+ isInvalid,
244
+ isRequired
245
+ ]);
246
+ return /*#__PURE__*/ $ahdqC$react.createElement(CollectionBuilder, { content }, (collection) => /*#__PURE__*/ $ahdqC$react.createElement($c8bb816105474884$var$SelectInner, {
247
+ props,
248
+ collection,
249
+ selectRef: ref
250
+ }));
251
+ });
252
+ const $c8bb816105474884$var$CLEAR_CONTEXTS = [
253
+ $43a3b93638fe5db9$export$75b6ee27786ba447,
254
+ $7705c033048f6da7$export$24d547caef80ccd1,
255
+ $efe09c6d1c304b50$export$9afb8bc826b033ea
256
+ ];
257
+ function $c8bb816105474884$var$SelectInner({ props, selectRef: ref, collection }) {
258
+ let { validationBehavior: formValidationBehavior } = $7230ffa83bc0c2cf$export$fabf2dc03a41866e($cdaed739b1139372$export$c24727297075ec6a) || {};
259
+ let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? "native";
260
+ let state = useSelectState({
261
+ ...props,
262
+ collection,
263
+ children: void 0,
264
+ validationBehavior
265
+ });
266
+ let { isFocusVisible, focusProps } = useFocusRing({ within: true });
267
+ let buttonRef = useRef(null);
268
+ let [labelRef, label] = $7230ffa83bc0c2cf$export$9d4c57ee4c6ffdd8(!props["aria-label"] && !props["aria-labelledby"]);
269
+ let { labelProps, triggerProps, valueProps, menuProps, descriptionProps, errorMessageProps, hiddenSelectProps, ...validation } = useSelect({
270
+ ...$7230ffa83bc0c2cf$export$ef03459518577ad4(props),
271
+ label,
272
+ validationBehavior
273
+ }, state, buttonRef);
274
+ let renderPropsState = useMemo(() => ({
275
+ isOpen: state.isOpen,
276
+ isFocused: state.isFocused,
277
+ isFocusVisible,
278
+ isDisabled: props.isDisabled || false,
279
+ isInvalid: validation.isInvalid || false,
280
+ isRequired: props.isRequired || false
281
+ }), [
282
+ state.isOpen,
283
+ state.isFocused,
284
+ isFocusVisible,
285
+ props.isDisabled,
286
+ validation.isInvalid,
287
+ props.isRequired
288
+ ]);
289
+ let renderProps = $7230ffa83bc0c2cf$export$4d86445c2cf5e3({
290
+ ...props,
291
+ values: renderPropsState,
292
+ defaultClassName: "react-aria-Select"
293
+ });
294
+ let DOMProps = filterDOMProps(props, { global: true });
295
+ delete DOMProps.id;
296
+ let scrollRef = useRef(null);
297
+ return /*#__PURE__*/ $ahdqC$react.createElement($7230ffa83bc0c2cf$export$2881499e37b75b9a, { values: [
298
+ [$c8bb816105474884$export$7540cee5be7dc19b, props],
299
+ [$c8bb816105474884$export$ef445b55be0601bd, state],
300
+ [$c8bb816105474884$export$f8f745c04421623f, valueProps],
301
+ [$43a3b93638fe5db9$export$75b6ee27786ba447, {
302
+ ...labelProps,
303
+ ref: labelRef,
304
+ elementType: "span"
305
+ }],
306
+ [$7705c033048f6da7$export$24d547caef80ccd1, {
307
+ ...triggerProps,
308
+ ref: buttonRef,
309
+ isPressed: state.isOpen,
310
+ autoFocus: props.autoFocus
311
+ }],
312
+ [$f2ff30fde7b014be$export$d2f961adcb0afbe, state],
313
+ [$542a13ca2fa5b484$export$9b9a0cd73afb7ca4, {
314
+ trigger: "Select",
315
+ triggerRef: buttonRef,
316
+ scrollRef,
317
+ placement: "bottom start",
318
+ "aria-labelledby": menuProps["aria-labelledby"],
319
+ clearContexts: $c8bb816105474884$var$CLEAR_CONTEXTS
320
+ }],
321
+ [$928221da08ecbc62$export$7ff8f37d2d81a48d, {
322
+ ...menuProps,
323
+ ref: scrollRef
324
+ }],
325
+ [$928221da08ecbc62$export$7c5906fe4f1f2af2, state],
326
+ [$efe09c6d1c304b50$export$9afb8bc826b033ea, { slots: {
327
+ description: descriptionProps,
328
+ errorMessage: errorMessageProps
329
+ } }],
330
+ [$1f3c3b1a70cec653$export$ff05c3ac10437e03, validation]
331
+ ] }, /*#__PURE__*/ $ahdqC$react.createElement($7230ffa83bc0c2cf$export$df3a06d6289f983e.div, {
332
+ ...mergeProps(DOMProps, renderProps, focusProps),
333
+ ref,
334
+ slot: props.slot || void 0,
335
+ "data-focused": state.isFocused || void 0,
336
+ "data-focus-visible": isFocusVisible || void 0,
337
+ "data-open": state.isOpen || void 0,
338
+ "data-disabled": props.isDisabled || void 0,
339
+ "data-invalid": validation.isInvalid || void 0,
340
+ "data-required": props.isRequired || void 0
341
+ }, renderProps.children, /*#__PURE__*/ $ahdqC$react.createElement(HiddenSelect, {
342
+ ...hiddenSelectProps,
343
+ autoComplete: props.autoComplete
344
+ })));
345
+ }
346
+ const $c8bb816105474884$export$f8f745c04421623f = /*#__PURE__*/ createContext(null);
347
+ //#endregion
348
+ //#region src/configurator/cva-definitions.ts
349
+ const cvaDefinitions = {
350
+ "datePickerInput.contentRowCva": datePickerInputContentRowDefinition,
351
+ "select.tagsContentWrapperCva": selectInputTagsContentWrapperDefinition,
352
+ "tooltip.pointerHorizontalCva": tooltipPointerHorizontalDefinition,
353
+ "accordion.chevronCva": accordionChevronDefinition,
354
+ "accordion.cva": accordionDefinition,
355
+ "accordion.headingCva": accordionHeadingDefinition,
356
+ "accordion.headingSubtitleCva": accordionHeadingSubtitleDefinition,
357
+ "accordion.headingTitleCva": accordionHeadingTitleDefinition,
358
+ "accordion.iconCva": accordionIconDefinition,
359
+ "accordion.itemCva": accordionItemDefinition,
360
+ "accordion.panelContentCva": accordionPanelContentDefinition,
361
+ "accordion.panelCva": accordionPanelDefinition,
362
+ "accordion.triggerCva": accordionTriggerDefinition,
363
+ "alert.cva": alertDefinition,
364
+ "breadcrumbs.chevronCva": breadcrumbChevronDefinition,
365
+ "breadcrumbs.cva": breadcrumbsDefinition,
366
+ "breadcrumbs.iconCva": breadcrumbIconDefinition,
367
+ "breadcrumbs.itemCva": breadcrumbItemDefinition,
368
+ "breadcrumbs.segmentCva": breadcrumbSegmentDefinition,
369
+ "button.contentCva": buttonContentDefinition,
370
+ "button.cva": buttonDefinition,
371
+ "button.iconSize": buttonIconSizeDefinition,
372
+ "button.sizeCva": buttonSizeDefinition,
373
+ "checkbox.contentRowCva": checkboxContentRowDefinition,
374
+ "checkbox.contentWrapperCva": checkboxContentWrapperDefinition,
375
+ "checkbox.cva": checkboxDefinition,
376
+ "checkbox.groupLabelCva": checkboxGroupLabelDefinition,
377
+ "checkbox.iconCva": checkboxIconDefinition,
378
+ "dialog.contentCva": dialogContentDefinition,
379
+ "dialog.mainCva": dialogMainDefinition,
380
+ "dialog.overlayCva": dialogOverlayDefinition,
381
+ "dropdownMenu.cva": dropdownMenuDefinition,
382
+ "dropdownMenu.itemCva": menuItemDefinition,
383
+ "dropdownMenu.popoverCva": menuPopoverDefinition,
384
+ "dropdownMenu.popoverWrapperCva": menuPopoverWrapperDefinition,
385
+ "fileUpload.dropZoneCva": fileUploadDropZoneDefinition,
386
+ "formField.errorLabelCva": formFieldErrorDefinition,
387
+ "formField.headerCva": formFieldHeaderDefinition,
388
+ "formField.helperLabelCva": formFieldHelperDefinition,
389
+ "input.baseCva": inputBaseDefinition,
390
+ "input.clearClassCva": inputClearClassDefinition,
391
+ "input.contentWrapperCva": inputContentWrapperDefinition,
392
+ "input.sideCva": inputSideDefinition,
393
+ "input.sizeCva": inputSizeDefinition,
394
+ "label.cva": labelDefinition,
395
+ "link.cva": linkDefinition,
396
+ "badgeButton.cva": badgeButtonDefinition,
397
+ "popover.cva": popoverDefinition,
398
+ "progress.cva": progressDefinition,
399
+ "progress.fillCva": progressFillDefinition,
400
+ "progress.trackCva": progressTrackDefinition,
401
+ "progress.trackWrapperCva": progressTrackWrapperDefinition,
402
+ "progress.valueCva": progressValueDefinition,
403
+ "radio.contentRowCva": radioContentRowDefinition,
404
+ "radio.contentWrapperCva": radioContentWrapperDefinition,
405
+ "radio.cva": radioDefinition,
406
+ "select.listBoxItemCva": selectListBoxItemDefinition,
407
+ "select.popoverCva": selectPopoverDefinition,
408
+ "status.iconCva": statusIconDefinition,
409
+ "status.separatorCva": statusSeparatorDefinition,
410
+ "stepper.cva": stepperDefinition,
411
+ "stepper.iconCva": stepperIconDefinition,
412
+ "stepper.itemCva": stepperItemDefinition,
413
+ "stepper.numberCva": stepperNumberDefinition,
414
+ "stepper.separatorCva": stepperSeparatorDefinition,
415
+ "stepper.subtextCva": stepperSubtextDefinition,
416
+ "stepper.titleCva": stepperTitleDefinition,
417
+ "switch.cva": switchDefinition,
418
+ "table.cellTextCva": tableCellTextDefinition,
419
+ "table.dataCva": tableDataDefinition,
420
+ "table.headDataCva": tableHeadDataDefinition,
421
+ "table.headRowCva": tableHeadRowDefinition,
422
+ "table.headerTextCva": tableHeaderTextDefinition,
423
+ "table.rowCva": tableRowDefinition,
424
+ "table.theadCva": theadDefinition,
425
+ "tag.cva": tagDefinition,
426
+ "textArea.wrapperCva": textAreaWrapperDefinition,
427
+ "toast.containerCva": toastContainerDefinition,
428
+ "toast.cva": toastDefinition,
429
+ "toggleGroup.cva": toggleGroupDefinition,
430
+ "toggleGroup.itemCva": toggleGroupItemDefinition,
431
+ "tooltip.cva": tooltipDefinition,
432
+ "tooltip.pointerVerticalCva": tooltipPointerVerticalDefinition,
433
+ "tooltip.textCva": tooltipTextDefinition,
434
+ "tooltipWrapper.triggerCva": tooltipWrapperTriggerDefinition,
435
+ "typography.cva": typographyDefinition
436
+ };
437
+ //#endregion
438
+ //#region src/configurator/cva-model.ts
439
+ function resolveCvaDefinition(slot, inherited) {
440
+ const [component, part] = slot.split(".");
441
+ const override = (inherited?.[component])?.[part];
442
+ if (typeof override === "function") return null;
443
+ const fallback = cvaDefinitions[slot];
444
+ const definition = override && typeof override === "object" && "mode" in override ? StyleMergeUtils.mergeCvaDefinition(fallback, override) : fallback;
445
+ const config = definition.config;
446
+ return {
447
+ base: [...definition.base],
448
+ config: {
449
+ variants: Object.fromEntries(Object.entries(config?.variants ?? {}).map(([name, options]) => [name, Object.fromEntries(Object.entries(options).map(([value, classes]) => [value, clsx(classes)]))])),
450
+ defaultVariants: config?.defaultVariants ?? {},
451
+ compoundVariants: (config?.compoundVariants ?? []).map(({ class: classes, className, ...selectors }) => Object.assign(selectors, { className: clsx(classes, className) }))
452
+ }
453
+ };
454
+ }
455
+ function applyCvaEdits(inherited, edits = {}) {
456
+ const result = { ...inherited };
457
+ for (const [slot, definition] of Object.entries(edits)) {
458
+ const [component, part] = slot.split(".");
459
+ const key = component;
460
+ result[key] = {
461
+ ...result[key],
462
+ [part]: {
463
+ mode: "overrideCva",
464
+ ...definition
465
+ }
466
+ };
467
+ }
468
+ return result;
469
+ }
470
+ function exportCvaEdits(edits = {}) {
471
+ const overrides = applyCvaEdits(void 0, edits);
472
+ const components = Object.keys(overrides).map((name) => ` ${name}: { ...existing.${name}, ...edited.${name} },`).join("\n");
473
+ return `import { UIOverrides } from "@povio/ui/ui-overrides";\n\nconst edited = ${JSON.stringify(overrides, null, 2)} satisfies UIOverrides.Config;\n\nexport function withUIOverrides(existing: UIOverrides.Config = {}): UIOverrides.Config {\n return {\n ...existing,\n${components}\n };\n}\n\n// <UIOverrides.Provider config={withUIOverrides(appOverrides)}>{children}</UIOverrides.Provider>\n`;
474
+ }
475
+ //#endregion
476
+ //#region src/configurator/configuration.context.tsx
477
+ const emptyConfiguration = () => ({
478
+ theme: emptyTheme(),
479
+ config: {}
480
+ });
481
+ const ConfigurationContext = createContext(null);
482
+ function UIConfigurationProvider(t0) {
483
+ const $ = c(34);
484
+ const { defaults, initialValue, onApply, children } = t0;
485
+ const inheritedOverrides = UIOverrides.useConfig();
486
+ const [applied, setApplied] = useState(initialValue ?? emptyConfiguration);
487
+ const [draft, setDraft] = useState(applied);
488
+ const [isOpen, setOpen] = useState(false);
489
+ const [revision, setRevision] = useState(0);
490
+ const active = isOpen ? draft : applied;
491
+ let t1;
492
+ if ($[0] !== applied) {
493
+ t1 = () => {
494
+ setDraft(structuredClone(applied));
495
+ setRevision(_temp$6);
496
+ setOpen(true);
497
+ };
498
+ $[0] = applied;
499
+ $[1] = t1;
500
+ } else t1 = $[1];
501
+ const open = t1;
502
+ let t2;
503
+ if ($[2] !== applied) {
504
+ t2 = () => {
505
+ setDraft(structuredClone(applied));
506
+ setOpen(false);
507
+ };
508
+ $[2] = applied;
509
+ $[3] = t2;
510
+ } else t2 = $[3];
511
+ const cancel = t2;
512
+ let t3;
513
+ if ($[4] !== draft || $[5] !== onApply) {
514
+ t3 = () => {
515
+ onApply?.(structuredClone(draft));
516
+ setApplied(structuredClone(draft));
517
+ setOpen(false);
518
+ };
519
+ $[4] = draft;
520
+ $[5] = onApply;
521
+ $[6] = t3;
522
+ } else t3 = $[6];
523
+ const apply = t3;
524
+ let t4;
525
+ if ($[7] !== active.overrides || $[8] !== inheritedOverrides) {
526
+ t4 = applyCvaEdits(inheritedOverrides, active.overrides);
527
+ $[7] = active.overrides;
528
+ $[8] = inheritedOverrides;
529
+ $[9] = t4;
530
+ } else t4 = $[9];
531
+ const overrides = t4;
532
+ let t5;
533
+ if ($[10] !== apply || $[11] !== cancel || $[12] !== defaults || $[13] !== draft || $[14] !== inheritedOverrides || $[15] !== isOpen || $[16] !== open || $[17] !== revision) {
534
+ t5 = {
535
+ defaults,
536
+ inheritedOverrides,
537
+ draft,
538
+ setDraft,
539
+ isOpen,
540
+ open,
541
+ cancel,
542
+ apply,
543
+ revision
544
+ };
545
+ $[10] = apply;
546
+ $[11] = cancel;
547
+ $[12] = defaults;
548
+ $[13] = draft;
549
+ $[14] = inheritedOverrides;
550
+ $[15] = isOpen;
551
+ $[16] = open;
552
+ $[17] = revision;
553
+ $[18] = t5;
554
+ } else t5 = $[18];
555
+ const contextValue = t5;
556
+ let t6;
557
+ if ($[19] !== active.theme || $[20] !== defaults) {
558
+ t6 = runtimeCss(defaults, active.theme);
559
+ $[19] = active.theme;
560
+ $[20] = defaults;
561
+ $[21] = t6;
562
+ } else t6 = $[21];
563
+ let t7;
564
+ if ($[22] !== t6) {
565
+ t7 = /* @__PURE__ */ jsx("style", {
566
+ "data-povio-ui-configuration": true,
567
+ children: t6
568
+ });
569
+ $[22] = t6;
570
+ $[23] = t7;
571
+ } else t7 = $[23];
572
+ let t8;
573
+ if ($[24] !== active.config || $[25] !== children) {
574
+ t8 = /* @__PURE__ */ jsx(UIConfig.Provider, {
575
+ config: active.config,
576
+ children
577
+ });
578
+ $[24] = active.config;
579
+ $[25] = children;
580
+ $[26] = t8;
581
+ } else t8 = $[26];
582
+ let t9;
583
+ if ($[27] !== overrides || $[28] !== t8) {
584
+ t9 = /* @__PURE__ */ jsx(UIOverrides.Provider, {
585
+ config: overrides,
586
+ children: t8
587
+ });
588
+ $[27] = overrides;
589
+ $[28] = t8;
590
+ $[29] = t9;
591
+ } else t9 = $[29];
592
+ let t10;
593
+ if ($[30] !== contextValue || $[31] !== t7 || $[32] !== t9) {
594
+ t10 = /* @__PURE__ */ jsxs(ConfigurationContext.Provider, {
595
+ value: contextValue,
596
+ children: [t7, t9]
597
+ });
598
+ $[30] = contextValue;
599
+ $[31] = t7;
600
+ $[32] = t9;
601
+ $[33] = t10;
602
+ } else t10 = $[33];
603
+ return t10;
604
+ }
605
+ function _temp$6(value) {
606
+ return value + 1;
607
+ }
608
+ function useUIConfiguration() {
609
+ const context = use(ConfigurationContext);
610
+ if (!context) throw new Error("useUIConfiguration requires UIConfigurationProvider");
611
+ return context;
612
+ }
613
+ //#endregion
614
+ //#region src/configurator/ContextualPreview.tsx
615
+ function CvaPreview(t0) {
616
+ const $ = c(84);
617
+ const { slot, variants, setVariants } = t0;
618
+ const overrides = UIOverrides.useConfig();
619
+ const [disabled, setDisabled] = useState(false);
620
+ const [selected, setSelected] = useState(false);
621
+ const [text, setText] = useState("Example value");
622
+ let component;
623
+ let definition;
624
+ let sample;
625
+ let t1;
626
+ let t2;
627
+ let t3;
628
+ if ($[0] !== disabled || $[1] !== overrides || $[2] !== selected || $[3] !== slot || $[4] !== text || $[5] !== variants) {
629
+ definition = resolveCvaDefinition(slot, overrides);
630
+ component = slot.split(".")[0];
631
+ const props = {
632
+ ...definition?.config.defaultVariants,
633
+ ...Object.fromEntries(Object.entries(variants).filter(_temp$5).map(_temp2$2))
634
+ };
635
+ const classes = (key, t4) => {
636
+ const extra = t4 === void 0 ? {} : t4;
637
+ const [group, part] = key.split(".");
638
+ const inherited = (overrides?.[group])?.[part];
639
+ if (typeof inherited === "function") return inherited({
640
+ ...props,
641
+ ...extra
642
+ });
643
+ const resolved = resolveCvaDefinition(key, overrides);
644
+ return cva(resolved.base, resolved.config)({
645
+ ...props,
646
+ ...extra
647
+ });
648
+ };
649
+ const exact = classes(slot);
650
+ bb0: switch (component) {
651
+ case "button":
652
+ sample = /* @__PURE__ */ jsx(Button, {
653
+ ...props,
654
+ isDisabled: disabled,
655
+ icon: Plus,
656
+ children: "Example button"
657
+ });
658
+ break bb0;
659
+ case "badgeButton":
660
+ sample = /* @__PURE__ */ jsx(BadgeButton, {
661
+ ...props,
662
+ isDisabled: disabled,
663
+ icon: Plus,
664
+ children: "Example badge button"
665
+ });
666
+ break bb0;
667
+ case "input":
668
+ case "label":
669
+ case "formField":
670
+ case "tooltipWrapper":
671
+ sample = /* @__PURE__ */ jsx(Input, {
672
+ ...props,
673
+ label: "Example input",
674
+ value: text,
675
+ onChange: setText,
676
+ isDisabled: disabled,
677
+ isClearable: true,
678
+ leadingIcon: Info,
679
+ tooltipText: "Helpful field information",
680
+ ...component === "tooltipWrapper" ? { as: "inline" } : {},
681
+ helperText: "Helpful supporting text",
682
+ error: slot === "formField.errorLabelCva" ? "This field needs attention." : void 0
683
+ });
684
+ break bb0;
685
+ case "checkbox":
686
+ sample = /* @__PURE__ */ jsxs("div", {
687
+ className: classes("checkbox.contentWrapperCva"),
688
+ children: [/* @__PURE__ */ jsx("span", {
689
+ className: classes("checkbox.groupLabelCva"),
690
+ children: "Example group"
691
+ }), /* @__PURE__ */ jsx("div", {
692
+ className: classes("checkbox.contentRowCva"),
693
+ children: /* @__PURE__ */ jsx(Checkbox, {
694
+ ...props,
695
+ isDisabled: disabled,
696
+ isSelected: selected,
697
+ onChange: setSelected,
698
+ children: "Example checkbox"
699
+ })
700
+ })]
701
+ });
702
+ break bb0;
703
+ case "switch":
704
+ sample = /* @__PURE__ */ jsx(Switch, {
705
+ ...props,
706
+ isDisabled: disabled,
707
+ isSelected: selected,
708
+ onChange: setSelected,
709
+ children: "Example switch"
710
+ });
711
+ break bb0;
712
+ case "tag":
713
+ sample = /* @__PURE__ */ jsx(Tag, {
714
+ ...props,
715
+ isDisabled: disabled,
716
+ children: "Example tag"
717
+ });
718
+ break bb0;
719
+ case "alert":
720
+ case "status": {
721
+ let t5;
722
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
723
+ t5 = /* @__PURE__ */ jsx(Button, {
724
+ variant: "text",
725
+ children: "View"
726
+ });
727
+ $[12] = t5;
728
+ } else t5 = $[12];
729
+ sample = /* @__PURE__ */ jsx(Alert, {
730
+ ...props,
731
+ text: "Your changes have been saved.",
732
+ icon: Info,
733
+ hasSeparator: true,
734
+ rightContent: t5
735
+ });
736
+ break bb0;
737
+ }
738
+ case "progress":
739
+ sample = /* @__PURE__ */ jsx(Progress, {
740
+ ...props,
741
+ progress: 65
742
+ });
743
+ break bb0;
744
+ case "typography": {
745
+ let t5;
746
+ if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
747
+ t5 = /* @__PURE__ */ jsx("br", {});
748
+ $[13] = t5;
749
+ } else t5 = $[13];
750
+ sample = /* @__PURE__ */ jsxs("div", {
751
+ className: exact,
752
+ children: [
753
+ "The quick brown fox jumps over the lazy dog.",
754
+ t5,
755
+ "Aa Bb Cc · 0123456789"
756
+ ]
757
+ });
758
+ break bb0;
759
+ }
760
+ case "link":
761
+ sample = /* @__PURE__ */ jsx("a", {
762
+ className: exact,
763
+ href: "#preview",
764
+ onClick: _temp3$2,
765
+ children: "Example link"
766
+ });
767
+ break bb0;
768
+ case "table": {
769
+ let t5;
770
+ if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
771
+ t5 = { width: "100%" };
772
+ $[14] = t5;
773
+ } else t5 = $[14];
774
+ sample = /* @__PURE__ */ jsxs("table", {
775
+ style: t5,
776
+ children: [/* @__PURE__ */ jsx("thead", {
777
+ className: classes("table.theadCva"),
778
+ children: /* @__PURE__ */ jsxs("tr", {
779
+ className: classes("table.headRowCva"),
780
+ children: [/* @__PURE__ */ jsx("th", {
781
+ className: classes("table.headDataCva"),
782
+ children: /* @__PURE__ */ jsx("span", {
783
+ className: classes("table.headerTextCva"),
784
+ children: "Workspace"
785
+ })
786
+ }), /* @__PURE__ */ jsx("th", {
787
+ className: classes("table.headDataCva"),
788
+ children: "Status"
789
+ })]
790
+ })
791
+ }), /* @__PURE__ */ jsx("tbody", { children: ["Design system", "Website"].map((name_0) => /* @__PURE__ */ jsxs("tr", {
792
+ className: classes("table.rowCva"),
793
+ "data-selected": selected || void 0,
794
+ children: [/* @__PURE__ */ jsx("td", {
795
+ className: classes("table.dataCva"),
796
+ children: /* @__PURE__ */ jsx("span", {
797
+ className: classes("table.cellTextCva"),
798
+ children: name_0
799
+ })
800
+ }), /* @__PURE__ */ jsx("td", {
801
+ className: classes("table.dataCva"),
802
+ children: "Active"
803
+ })]
804
+ }, name_0)) })]
805
+ });
806
+ break bb0;
807
+ }
808
+ case "tooltip": {
809
+ let t5;
810
+ if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
811
+ t5 = /* @__PURE__ */ jsx("path", { d: "M0 0 L6 6 L12 0 Z" });
812
+ $[15] = t5;
813
+ } else t5 = $[15];
814
+ sample = /* @__PURE__ */ jsxs("div", {
815
+ className: classes("tooltip.cva"),
816
+ children: [/* @__PURE__ */ jsx("div", {
817
+ className: classes("tooltip.textCva"),
818
+ children: "Helpful tooltip text"
819
+ }), /* @__PURE__ */ jsx("svg", {
820
+ width: "12",
821
+ height: "6",
822
+ className: classes(slot === "tooltip.pointerHorizontalCva" ? slot : "tooltip.pointerVerticalCva"),
823
+ children: t5
824
+ })]
825
+ });
826
+ break bb0;
827
+ }
828
+ case "textArea": {
829
+ let t5;
830
+ if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
831
+ t5 = (event_0) => setText(event_0.target.value);
832
+ $[16] = t5;
833
+ } else t5 = $[16];
834
+ let t6;
835
+ if ($[17] !== disabled || $[18] !== text) {
836
+ t6 = /* @__PURE__ */ jsx("textarea", {
837
+ "aria-label": "Example text area",
838
+ value: text,
839
+ onChange: t5,
840
+ disabled
841
+ });
842
+ $[17] = disabled;
843
+ $[18] = text;
844
+ $[19] = t6;
845
+ } else t6 = $[19];
846
+ sample = /* @__PURE__ */ jsx("div", {
847
+ className: exact,
848
+ children: t6
849
+ });
850
+ break bb0;
851
+ }
852
+ case "radio": {
853
+ let t5;
854
+ if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
855
+ t5 = [{
856
+ label: "First option",
857
+ value: "first"
858
+ }, {
859
+ label: "Second option",
860
+ value: "second"
861
+ }];
862
+ $[20] = t5;
863
+ } else t5 = $[20];
864
+ let t6;
865
+ if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
866
+ t6 = (value_1) => setSelected(value_1 === "second");
867
+ $[21] = t6;
868
+ } else t6 = $[21];
869
+ sample = /* @__PURE__ */ jsx(RadioGroup, {
870
+ ...props,
871
+ label: "Choose an option",
872
+ options: t5,
873
+ value: selected ? "second" : "first",
874
+ onChange: t6,
875
+ isDisabled: disabled
876
+ });
877
+ break bb0;
878
+ }
879
+ case "accordion": {
880
+ let t5;
881
+ if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
882
+ t5 = { width: "100%" };
883
+ $[22] = t5;
884
+ } else t5 = $[22];
885
+ let t6;
886
+ if ($[23] !== selected) {
887
+ t6 = () => setSelected(!selected);
888
+ $[23] = selected;
889
+ $[24] = t6;
890
+ } else t6 = $[24];
891
+ sample = /* @__PURE__ */ jsxs("div", {
892
+ style: t5,
893
+ className: `${classes("accordion.cva")} ${classes("accordion.itemCva")}`,
894
+ children: [/* @__PURE__ */ jsxs("button", {
895
+ className: classes("accordion.triggerCva"),
896
+ onClick: t6,
897
+ "aria-expanded": selected,
898
+ disabled,
899
+ children: [
900
+ /* @__PURE__ */ jsx(Info, { className: classes("accordion.iconCva") }),
901
+ /* @__PURE__ */ jsxs("div", {
902
+ className: classes("accordion.headingCva"),
903
+ children: [/* @__PURE__ */ jsx("div", {
904
+ className: classes("accordion.headingTitleCva"),
905
+ children: "Account settings"
906
+ }), /* @__PURE__ */ jsx("div", {
907
+ className: classes("accordion.headingSubtitleCva"),
908
+ children: "Manage your preferences"
909
+ })]
910
+ }),
911
+ /* @__PURE__ */ jsx(Check, { className: classes("accordion.chevronCva") })
912
+ ]
913
+ }), /* @__PURE__ */ jsx("div", {
914
+ className: classes("accordion.panelCva"),
915
+ children: /* @__PURE__ */ jsx("div", {
916
+ className: classes("accordion.panelContentCva"),
917
+ children: "Update your account preferences here."
918
+ })
919
+ })]
920
+ });
921
+ break bb0;
922
+ }
923
+ case "breadcrumbs":
924
+ sample = /* @__PURE__ */ jsxs("nav", {
925
+ "aria-label": "Preview breadcrumbs",
926
+ className: classes("breadcrumbs.cva"),
927
+ children: [/* @__PURE__ */ jsxs("div", {
928
+ className: classes("breadcrumbs.itemCva"),
929
+ children: [
930
+ /* @__PURE__ */ jsx(Info, { className: classes("breadcrumbs.iconCva") }),
931
+ /* @__PURE__ */ jsx("span", {
932
+ className: classes("breadcrumbs.segmentCva"),
933
+ children: "Workspace"
934
+ }),
935
+ /* @__PURE__ */ jsx("span", {
936
+ className: classes("breadcrumbs.chevronCva"),
937
+ children: "›"
938
+ })
939
+ ]
940
+ }), /* @__PURE__ */ jsx("div", {
941
+ className: classes("breadcrumbs.itemCva"),
942
+ children: /* @__PURE__ */ jsx("span", {
943
+ className: classes("breadcrumbs.segmentCva"),
944
+ children: "Settings"
945
+ })
946
+ })]
947
+ });
948
+ break bb0;
949
+ case "stepper":
950
+ sample = /* @__PURE__ */ jsx("div", {
951
+ className: classes("stepper.cva"),
952
+ children: ["Details", "Review"].map((label_2, index) => /* @__PURE__ */ jsxs("div", {
953
+ className: classes("stepper.itemCva"),
954
+ children: [
955
+ /* @__PURE__ */ jsx(Info, { className: classes("stepper.iconCva") }),
956
+ /* @__PURE__ */ jsx("span", {
957
+ className: classes("stepper.numberCva"),
958
+ children: index + 1
959
+ }),
960
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
961
+ className: classes("stepper.titleCva"),
962
+ children: label_2
963
+ }), /* @__PURE__ */ jsx("div", {
964
+ className: classes("stepper.subtextCva"),
965
+ children: "Step description"
966
+ })] }),
967
+ /* @__PURE__ */ jsx("div", { className: classes("stepper.separatorCva") })
968
+ ]
969
+ }, label_2))
970
+ });
971
+ break bb0;
972
+ case "toggleGroup":
973
+ sample = /* @__PURE__ */ jsx("div", {
974
+ className: classes("toggleGroup.cva"),
975
+ children: [
976
+ "Day",
977
+ "Week",
978
+ "Month"
979
+ ].map((label_1) => /* @__PURE__ */ jsx("button", {
980
+ className: classes("toggleGroup.itemCva"),
981
+ "data-selected": text === label_1 || void 0,
982
+ onClick: () => setText(label_1),
983
+ disabled,
984
+ children: label_1
985
+ }, label_1))
986
+ });
987
+ break bb0;
988
+ case "select":
989
+ sample = slot === "select.tagsContentWrapperCva" ? /* @__PURE__ */ jsxs("div", {
990
+ className: exact,
991
+ children: [/* @__PURE__ */ jsx(Tag, { children: "Design" }), /* @__PURE__ */ jsx(Tag, { children: "Engineering" })]
992
+ }) : /* @__PURE__ */ jsx("div", {
993
+ className: classes("select.popoverCva"),
994
+ role: "listbox",
995
+ "aria-label": "Preview options",
996
+ children: [
997
+ "Design",
998
+ "Engineering",
999
+ "Marketing"
1000
+ ].map((label_0) => /* @__PURE__ */ jsx("div", {
1001
+ role: "option",
1002
+ "aria-selected": text === label_0,
1003
+ className: classes("select.listBoxItemCva"),
1004
+ "data-selected": text === label_0 || void 0,
1005
+ onClick: () => setText(label_0),
1006
+ tabIndex: 0,
1007
+ onKeyDown: (event) => {
1008
+ if (event.key === "Enter" || event.key === " ") {
1009
+ event.preventDefault();
1010
+ setText(label_0);
1011
+ }
1012
+ },
1013
+ children: label_0
1014
+ }, label_0))
1015
+ });
1016
+ break bb0;
1017
+ case "dropdownMenu":
1018
+ sample = /* @__PURE__ */ jsx("div", {
1019
+ className: classes("dropdownMenu.popoverWrapperCva"),
1020
+ children: /* @__PURE__ */ jsx("div", {
1021
+ className: classes("dropdownMenu.popoverCva"),
1022
+ children: /* @__PURE__ */ jsx("div", {
1023
+ className: classes("dropdownMenu.cva"),
1024
+ children: [
1025
+ "Edit",
1026
+ "Duplicate",
1027
+ "Delete"
1028
+ ].map((label) => /* @__PURE__ */ jsx("button", {
1029
+ className: classes("dropdownMenu.itemCva"),
1030
+ disabled,
1031
+ children: label
1032
+ }, label))
1033
+ })
1034
+ })
1035
+ });
1036
+ break bb0;
1037
+ case "dialog": {
1038
+ let t5;
1039
+ let t6;
1040
+ let t7;
1041
+ if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
1042
+ t5 = /* @__PURE__ */ jsx("strong", { children: "Save changes?" });
1043
+ t6 = /* @__PURE__ */ jsx("p", { children: "Your preferences will be updated." });
1044
+ t7 = /* @__PURE__ */ jsx(Button, { children: "Save" });
1045
+ $[25] = t5;
1046
+ $[26] = t6;
1047
+ $[27] = t7;
1048
+ } else {
1049
+ t5 = $[25];
1050
+ t6 = $[26];
1051
+ t7 = $[27];
1052
+ }
1053
+ sample = /* @__PURE__ */ jsxs("div", {
1054
+ className: "studio-mini-dialog",
1055
+ children: [/* @__PURE__ */ jsx("div", { className: classes("dialog.overlayCva") }), /* @__PURE__ */ jsx("div", {
1056
+ className: classes("dialog.mainCva"),
1057
+ children: /* @__PURE__ */ jsxs("div", {
1058
+ className: classes("dialog.contentCva"),
1059
+ children: [
1060
+ t5,
1061
+ t6,
1062
+ t7
1063
+ ]
1064
+ })
1065
+ })]
1066
+ });
1067
+ break bb0;
1068
+ }
1069
+ case "popover": {
1070
+ let t5;
1071
+ let t6;
1072
+ let t7;
1073
+ if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
1074
+ t5 = /* @__PURE__ */ jsx("strong", { children: "Quick settings" });
1075
+ t6 = /* @__PURE__ */ jsx("p", { children: "Adjust preferences for this workspace." });
1076
+ t7 = /* @__PURE__ */ jsx(Checkbox, { children: "Enable notifications" });
1077
+ $[28] = t5;
1078
+ $[29] = t6;
1079
+ $[30] = t7;
1080
+ } else {
1081
+ t5 = $[28];
1082
+ t6 = $[29];
1083
+ t7 = $[30];
1084
+ }
1085
+ sample = /* @__PURE__ */ jsxs("div", {
1086
+ className: exact,
1087
+ children: [
1088
+ t5,
1089
+ t6,
1090
+ t7
1091
+ ]
1092
+ });
1093
+ break bb0;
1094
+ }
1095
+ case "toast": {
1096
+ let t5;
1097
+ let t6;
1098
+ if ($[31] === Symbol.for("react.memo_cache_sentinel")) {
1099
+ t5 = /* @__PURE__ */ jsx(Info, {});
1100
+ t6 = /* @__PURE__ */ jsx("span", { children: "Your changes have been saved." });
1101
+ $[31] = t5;
1102
+ $[32] = t6;
1103
+ } else {
1104
+ t5 = $[31];
1105
+ t6 = $[32];
1106
+ }
1107
+ sample = /* @__PURE__ */ jsx("div", {
1108
+ className: classes("toast.containerCva"),
1109
+ children: /* @__PURE__ */ jsxs("div", {
1110
+ className: classes("toast.cva"),
1111
+ children: [t5, t6]
1112
+ })
1113
+ });
1114
+ break bb0;
1115
+ }
1116
+ case "datePickerInput": {
1117
+ let t5;
1118
+ let t6;
1119
+ let t7;
1120
+ let t8;
1121
+ let t9;
1122
+ if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
1123
+ t5 = /* @__PURE__ */ jsx("span", { children: "24" });
1124
+ t6 = /* @__PURE__ */ jsx("span", { children: "/" });
1125
+ t7 = /* @__PURE__ */ jsx("span", { children: "09" });
1126
+ t8 = /* @__PURE__ */ jsx("span", { children: "/" });
1127
+ t9 = /* @__PURE__ */ jsx("span", { children: "2026" });
1128
+ $[33] = t5;
1129
+ $[34] = t6;
1130
+ $[35] = t7;
1131
+ $[36] = t8;
1132
+ $[37] = t9;
1133
+ } else {
1134
+ t5 = $[33];
1135
+ t6 = $[34];
1136
+ t7 = $[35];
1137
+ t8 = $[36];
1138
+ t9 = $[37];
1139
+ }
1140
+ let t10;
1141
+ if ($[38] !== exact) {
1142
+ t10 = /* @__PURE__ */ jsxs("div", {
1143
+ className: exact,
1144
+ children: [
1145
+ t5,
1146
+ t6,
1147
+ t7,
1148
+ t8,
1149
+ t9
1150
+ ]
1151
+ });
1152
+ $[38] = exact;
1153
+ $[39] = t10;
1154
+ } else t10 = $[39];
1155
+ sample = t10;
1156
+ break bb0;
1157
+ }
1158
+ case "fileUpload": {
1159
+ let t5;
1160
+ let t6;
1161
+ let t7;
1162
+ if ($[40] === Symbol.for("react.memo_cache_sentinel")) {
1163
+ t5 = /* @__PURE__ */ jsx(Plus, {});
1164
+ t6 = /* @__PURE__ */ jsx("strong", { children: "Drop files here" });
1165
+ t7 = /* @__PURE__ */ jsx("div", { children: "or choose a file" });
1166
+ $[40] = t5;
1167
+ $[41] = t6;
1168
+ $[42] = t7;
1169
+ } else {
1170
+ t5 = $[40];
1171
+ t6 = $[41];
1172
+ t7 = $[42];
1173
+ }
1174
+ let t8;
1175
+ if ($[43] !== exact) {
1176
+ t8 = /* @__PURE__ */ jsxs("div", {
1177
+ className: exact,
1178
+ children: [
1179
+ t5,
1180
+ t6,
1181
+ t7
1182
+ ]
1183
+ });
1184
+ $[43] = exact;
1185
+ $[44] = t8;
1186
+ } else t8 = $[44];
1187
+ sample = t8;
1188
+ break bb0;
1189
+ }
1190
+ default: {
1191
+ let t5;
1192
+ if ($[45] !== exact) {
1193
+ t5 = /* @__PURE__ */ jsx("div", {
1194
+ className: exact,
1195
+ children: "Example"
1196
+ });
1197
+ $[45] = exact;
1198
+ $[46] = t5;
1199
+ } else t5 = $[46];
1200
+ sample = t5;
1201
+ }
1202
+ }
1203
+ if (slot === "input.sideCva") {
1204
+ let t5;
1205
+ if ($[47] !== disabled || $[48] !== props || $[49] !== text) {
1206
+ t5 = /* @__PURE__ */ jsx(TextArea, {
1207
+ ...props,
1208
+ as: "floating",
1209
+ label: "Example text area",
1210
+ value: text,
1211
+ onChange: setText,
1212
+ isDisabled: disabled
1213
+ });
1214
+ $[47] = disabled;
1215
+ $[48] = props;
1216
+ $[49] = text;
1217
+ $[50] = t5;
1218
+ } else t5 = $[50];
1219
+ sample = t5;
1220
+ }
1221
+ t2 = "cva-preview";
1222
+ t3 = slot;
1223
+ let t5;
1224
+ if ($[51] === Symbol.for("react.memo_cache_sentinel")) {
1225
+ t5 = /([a-z])([A-Z])/g;
1226
+ $[51] = t5;
1227
+ } else t5 = $[51];
1228
+ t1 = component.replace(t5, "$1 $2");
1229
+ $[0] = disabled;
1230
+ $[1] = overrides;
1231
+ $[2] = selected;
1232
+ $[3] = slot;
1233
+ $[4] = text;
1234
+ $[5] = variants;
1235
+ $[6] = component;
1236
+ $[7] = definition;
1237
+ $[8] = sample;
1238
+ $[9] = t1;
1239
+ $[10] = t2;
1240
+ $[11] = t3;
1241
+ } else {
1242
+ component = $[6];
1243
+ definition = $[7];
1244
+ sample = $[8];
1245
+ t1 = $[9];
1246
+ t2 = $[10];
1247
+ t3 = $[11];
1248
+ }
1249
+ let t4;
1250
+ if ($[52] !== t1) {
1251
+ t4 = /* @__PURE__ */ jsx("h3", { children: t1 });
1252
+ $[52] = t1;
1253
+ $[53] = t4;
1254
+ } else t4 = $[53];
1255
+ let t5;
1256
+ if ($[54] !== definition?.config.variants) {
1257
+ t5 = Object.entries(definition?.config.variants ?? {});
1258
+ $[54] = definition?.config.variants;
1259
+ $[55] = t5;
1260
+ } else t5 = $[55];
1261
+ let t6;
1262
+ if ($[56] !== setVariants || $[57] !== t5 || $[58] !== variants) {
1263
+ t6 = t5.map((t7) => {
1264
+ const [name_1, options] = t7;
1265
+ return /* @__PURE__ */ jsxs("label", { children: [/* @__PURE__ */ jsx("span", { children: name_1 }), /* @__PURE__ */ jsxs("select", {
1266
+ "aria-label": `Preview ${name_1}`,
1267
+ value: variants[name_1] ?? "",
1268
+ onChange: (event_2) => setVariants({
1269
+ ...variants,
1270
+ [name_1]: event_2.target.value
1271
+ }),
1272
+ children: [/* @__PURE__ */ jsx("option", {
1273
+ value: "",
1274
+ children: "Default"
1275
+ }), Object.keys(options).map(_temp4$2)]
1276
+ })] }, name_1);
1277
+ });
1278
+ $[56] = setVariants;
1279
+ $[57] = t5;
1280
+ $[58] = variants;
1281
+ $[59] = t6;
1282
+ } else t6 = $[59];
1283
+ let t7;
1284
+ if ($[60] !== component || $[61] !== disabled) {
1285
+ t7 = [
1286
+ "button",
1287
+ "badgeButton",
1288
+ "input",
1289
+ "label",
1290
+ "formField",
1291
+ "tooltipWrapper",
1292
+ "checkbox",
1293
+ "switch",
1294
+ "tag",
1295
+ "radio",
1296
+ "textArea",
1297
+ "dropdownMenu",
1298
+ "toggleGroup",
1299
+ "accordion"
1300
+ ].includes(component) && /* @__PURE__ */ jsxs("label", { children: [/* @__PURE__ */ jsx("span", { children: "Disabled" }), /* @__PURE__ */ jsx("input", {
1301
+ type: "checkbox",
1302
+ checked: disabled,
1303
+ onChange: (event_3) => setDisabled(event_3.target.checked)
1304
+ })] });
1305
+ $[60] = component;
1306
+ $[61] = disabled;
1307
+ $[62] = t7;
1308
+ } else t7 = $[62];
1309
+ let t8;
1310
+ if ($[63] !== component || $[64] !== selected) {
1311
+ t8 = [
1312
+ "checkbox",
1313
+ "switch",
1314
+ "radio",
1315
+ "table"
1316
+ ].includes(component) && /* @__PURE__ */ jsxs("label", { children: [/* @__PURE__ */ jsx("span", { children: "Selected" }), /* @__PURE__ */ jsx("input", {
1317
+ type: "checkbox",
1318
+ checked: selected,
1319
+ onChange: (event_4) => setSelected(event_4.target.checked)
1320
+ })] });
1321
+ $[63] = component;
1322
+ $[64] = selected;
1323
+ $[65] = t8;
1324
+ } else t8 = $[65];
1325
+ let t9;
1326
+ if ($[66] !== t6 || $[67] !== t7 || $[68] !== t8) {
1327
+ t9 = /* @__PURE__ */ jsxs("div", {
1328
+ className: "studio-preview-controls",
1329
+ children: [
1330
+ t6,
1331
+ t7,
1332
+ t8
1333
+ ]
1334
+ });
1335
+ $[66] = t6;
1336
+ $[67] = t7;
1337
+ $[68] = t8;
1338
+ $[69] = t9;
1339
+ } else t9 = $[69];
1340
+ let t10;
1341
+ if ($[70] !== sample) {
1342
+ t10 = /* @__PURE__ */ jsx("div", {
1343
+ className: "studio-cva-stage",
1344
+ "data-testid": "cva-preview-stage",
1345
+ children: sample
1346
+ });
1347
+ $[70] = sample;
1348
+ $[71] = t10;
1349
+ } else t10 = $[71];
1350
+ let t11;
1351
+ if ($[72] !== slot) {
1352
+ let t12;
1353
+ if ($[74] === Symbol.for("react.memo_cache_sentinel")) {
1354
+ t12 = /Cva$/;
1355
+ $[74] = t12;
1356
+ } else t12 = $[74];
1357
+ t11 = slot.split(".")[1].replace(t12, "");
1358
+ $[72] = slot;
1359
+ $[73] = t11;
1360
+ } else t11 = $[73];
1361
+ let t12;
1362
+ if ($[75] !== t11) {
1363
+ t12 = /* @__PURE__ */ jsxs("div", {
1364
+ className: "studio-preview-caption",
1365
+ children: [t11, " · Preview controls don’t change your configuration."]
1366
+ });
1367
+ $[75] = t11;
1368
+ $[76] = t12;
1369
+ } else t12 = $[76];
1370
+ let t13;
1371
+ if ($[77] !== t10 || $[78] !== t12 || $[79] !== t2 || $[80] !== t3 || $[81] !== t4 || $[82] !== t9) {
1372
+ t13 = /* @__PURE__ */ jsxs("div", {
1373
+ "data-testid": t2,
1374
+ "data-slot": t3,
1375
+ children: [
1376
+ t4,
1377
+ t9,
1378
+ t10,
1379
+ t12
1380
+ ]
1381
+ });
1382
+ $[77] = t10;
1383
+ $[78] = t12;
1384
+ $[79] = t2;
1385
+ $[80] = t3;
1386
+ $[81] = t4;
1387
+ $[82] = t9;
1388
+ $[83] = t13;
1389
+ } else t13 = $[83];
1390
+ return t13;
1391
+ }
1392
+ function _temp4$2(value_2) {
1393
+ return /* @__PURE__ */ jsx("option", { children: value_2 }, value_2);
1394
+ }
1395
+ function _temp3$2(event_1) {
1396
+ return event_1.preventDefault();
1397
+ }
1398
+ function _temp2$2(t0) {
1399
+ const [name, value_0] = t0;
1400
+ return [name, value_0 === "true" ? true : value_0 === "false" ? false : value_0];
1401
+ }
1402
+ function _temp$5(t0) {
1403
+ const [, value] = t0;
1404
+ return value !== "";
1405
+ }
1406
+ function ContextualPreview(t0) {
1407
+ const $ = c(18);
1408
+ const { section, slot, mode, entries, variants, setVariants } = t0;
1409
+ const { defaults, draft } = useUIConfiguration();
1410
+ let t1;
1411
+ if ($[0] !== defaults || $[1] !== draft.theme || $[2] !== mode) {
1412
+ t1 = previewTokens(defaults, draft.theme, mode);
1413
+ $[0] = defaults;
1414
+ $[1] = draft.theme;
1415
+ $[2] = mode;
1416
+ $[3] = t1;
1417
+ } else t1 = $[3];
1418
+ const tokens = t1;
1419
+ let t2;
1420
+ if ($[4] !== defaults || $[5] !== entries || $[6] !== section) {
1421
+ t2 = section === "Typography" ? [...new Map(entries.map((t3) => {
1422
+ const [name, original] = t3;
1423
+ const base = name.replace(/--(?:line-height|letter-spacing)$/, "");
1424
+ return [base, [base, defaults.theme[base] ?? original]];
1425
+ })).values()] : entries;
1426
+ $[4] = defaults;
1427
+ $[5] = entries;
1428
+ $[6] = section;
1429
+ $[7] = t2;
1430
+ } else t2 = $[7];
1431
+ const samples = t2;
1432
+ const t3 = `studio-context-preview ${mode}`;
1433
+ let t4;
1434
+ if ($[8] !== samples || $[9] !== section || $[10] !== setVariants || $[11] !== slot || $[12] !== variants) {
1435
+ t4 = section === "Variants & overrides" ? /* @__PURE__ */ jsx(CvaPreview, {
1436
+ slot,
1437
+ variants,
1438
+ setVariants
1439
+ }, slot) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("h3", { children: section }), /* @__PURE__ */ jsxs("div", {
1440
+ className: "studio-token-samples",
1441
+ children: [samples.map((t5) => {
1442
+ const [name_0, original_0] = t5;
1443
+ const value = `var(${name_0})`;
1444
+ let style;
1445
+ let content = "";
1446
+ if (section === "Colors") style = {
1447
+ background: name_0.endsWith("-base") && (/^\d+\s+\d+\s+\d+$/.test(original_0) || original_0.startsWith("var(")) ? `rgb(${value})` : value,
1448
+ height: 44
1449
+ };
1450
+ else if (section === "Typography" || section === "Font size") {
1451
+ style = name_0.startsWith("--text-") ? {
1452
+ fontSize: value,
1453
+ lineHeight: `var(${name_0}--line-height, 1.4)`,
1454
+ letterSpacing: `var(${name_0}--letter-spacing, normal)`
1455
+ } : name_0.startsWith("--font-weight-") ? { fontWeight: value } : name_0.startsWith("--font-") ? { fontFamily: value } : { letterSpacing: value };
1456
+ content = "The quick brown fox";
1457
+ } else if (section === "Radius") style = {
1458
+ borderRadius: value,
1459
+ height: 56,
1460
+ background: "rgb(var(--interactive-primary-background-base))"
1461
+ };
1462
+ else if (section === "Effects") {
1463
+ style = {
1464
+ height: 56,
1465
+ background: "rgb(var(--surface-default-card-base))",
1466
+ ...name_0.startsWith("--blur-") ? { filter: `blur(${value})` } : { boxShadow: value }
1467
+ };
1468
+ content = "Aa";
1469
+ } else style = {
1470
+ width: value,
1471
+ maxWidth: "100%",
1472
+ minWidth: 1,
1473
+ height: 20,
1474
+ background: "rgb(var(--interactive-primary-background-base))"
1475
+ };
1476
+ return /* @__PURE__ */ jsxs("div", {
1477
+ className: "studio-token-sample",
1478
+ children: [/* @__PURE__ */ jsx("span", { children: labelFor(name_0) }), /* @__PURE__ */ jsx("div", {
1479
+ className: "studio-token-specimen",
1480
+ style,
1481
+ children: content
1482
+ })]
1483
+ }, name_0);
1484
+ }), !samples.length && /* @__PURE__ */ jsx("div", { children: "No matching tokens." })]
1485
+ })] });
1486
+ $[8] = samples;
1487
+ $[9] = section;
1488
+ $[10] = setVariants;
1489
+ $[11] = slot;
1490
+ $[12] = variants;
1491
+ $[13] = t4;
1492
+ } else t4 = $[13];
1493
+ let t5;
1494
+ if ($[14] !== t3 || $[15] !== t4 || $[16] !== tokens) {
1495
+ t5 = /* @__PURE__ */ jsx("div", {
1496
+ className: t3,
1497
+ style: tokens,
1498
+ "data-testid": "component-preview",
1499
+ children: t4
1500
+ });
1501
+ $[14] = t3;
1502
+ $[15] = t4;
1503
+ $[16] = tokens;
1504
+ $[17] = t5;
1505
+ } else t5 = $[17];
1506
+ return t5;
1507
+ }
1508
+ //#endregion
1509
+ //#region src/configurator/CvaEditor.tsx
1510
+ const title = (value) => value.replace(/Cva$/, "").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/^cva$/, "Appearance");
1511
+ function ClassField(t0) {
1512
+ const $ = c(18);
1513
+ const { label, value, onCommit, onFocus } = t0;
1514
+ const [text, setText] = useState(value);
1515
+ let t1;
1516
+ let t2;
1517
+ if ($[0] !== value) {
1518
+ t1 = () => setText(value);
1519
+ t2 = [value];
1520
+ $[0] = value;
1521
+ $[1] = t1;
1522
+ $[2] = t2;
1523
+ } else {
1524
+ t1 = $[1];
1525
+ t2 = $[2];
1526
+ }
1527
+ useEffect(t1, t2);
1528
+ let t3;
1529
+ if ($[3] !== label) {
1530
+ t3 = /* @__PURE__ */ jsx("span", { children: label });
1531
+ $[3] = label;
1532
+ $[4] = t3;
1533
+ } else t3 = $[4];
1534
+ let t4;
1535
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
1536
+ t4 = (event) => setText(event.target.value);
1537
+ $[5] = t4;
1538
+ } else t4 = $[5];
1539
+ let t5;
1540
+ if ($[6] !== onCommit || $[7] !== text || $[8] !== value) {
1541
+ t5 = () => {
1542
+ if (text !== value) onCommit(text.trim());
1543
+ };
1544
+ $[6] = onCommit;
1545
+ $[7] = text;
1546
+ $[8] = value;
1547
+ $[9] = t5;
1548
+ } else t5 = $[9];
1549
+ let t6;
1550
+ if ($[10] !== label || $[11] !== onFocus || $[12] !== t5 || $[13] !== text) {
1551
+ t6 = /* @__PURE__ */ jsx("input", {
1552
+ "aria-label": label,
1553
+ value: text,
1554
+ spellCheck: false,
1555
+ onFocus,
1556
+ onChange: t4,
1557
+ onBlur: t5,
1558
+ onKeyDown: _temp$4
1559
+ });
1560
+ $[10] = label;
1561
+ $[11] = onFocus;
1562
+ $[12] = t5;
1563
+ $[13] = text;
1564
+ $[14] = t6;
1565
+ } else t6 = $[14];
1566
+ let t7;
1567
+ if ($[15] !== t3 || $[16] !== t6) {
1568
+ t7 = /* @__PURE__ */ jsxs("label", {
1569
+ className: "studio-cva-field",
1570
+ tabIndex: -1,
1571
+ children: [t3, t6]
1572
+ });
1573
+ $[15] = t3;
1574
+ $[16] = t6;
1575
+ $[17] = t7;
1576
+ } else t7 = $[17];
1577
+ return t7;
1578
+ }
1579
+ function _temp$4(event_0) {
1580
+ if (event_0.key === "Enter" && !event_0.nativeEvent.isComposing) {
1581
+ event_0.preventDefault();
1582
+ event_0.currentTarget.parentElement?.focus();
1583
+ }
1584
+ }
1585
+ function CvaEditor(t0) {
1586
+ const $ = c(69);
1587
+ const { slot, setSlot, onPreview } = t0;
1588
+ const { draft, setDraft, inheritedOverrides } = useUIConfiguration();
1589
+ let t1;
1590
+ if ($[0] !== slot) {
1591
+ t1 = slot.split(".");
1592
+ $[0] = slot;
1593
+ $[1] = t1;
1594
+ } else t1 = $[1];
1595
+ const component = t1[0];
1596
+ let definition;
1597
+ let original;
1598
+ let slots;
1599
+ let t2;
1600
+ let t3;
1601
+ let t4;
1602
+ let t5;
1603
+ let t6;
1604
+ let t7;
1605
+ let t8;
1606
+ let t9;
1607
+ let update;
1608
+ if ($[2] !== component || $[3] !== draft.overrides || $[4] !== inheritedOverrides || $[5] !== setDraft || $[6] !== setSlot || $[7] !== slot) {
1609
+ slots = Object.keys(cvaDefinitions);
1610
+ const components = [...new Set(slots.map(_temp2$1))];
1611
+ let t10;
1612
+ if ($[20] !== inheritedOverrides || $[21] !== slot) {
1613
+ t10 = resolveCvaDefinition(slot, inheritedOverrides);
1614
+ $[20] = inheritedOverrides;
1615
+ $[21] = slot;
1616
+ $[22] = t10;
1617
+ } else t10 = $[22];
1618
+ original = t10;
1619
+ definition = draft.overrides?.[slot] ?? original;
1620
+ let t11;
1621
+ if ($[23] !== definition || $[24] !== setDraft || $[25] !== slot) {
1622
+ t11 = (change) => {
1623
+ if (!definition) return;
1624
+ const next = structuredClone(definition);
1625
+ change(next);
1626
+ setDraft((current) => ({
1627
+ ...current,
1628
+ overrides: {
1629
+ ...current.overrides,
1630
+ [slot]: next
1631
+ }
1632
+ }));
1633
+ };
1634
+ $[23] = definition;
1635
+ $[24] = setDraft;
1636
+ $[25] = slot;
1637
+ $[26] = t11;
1638
+ } else t11 = $[26];
1639
+ update = t11;
1640
+ t9 = "studio-cva-editor";
1641
+ t8 = "studio-settings";
1642
+ t6 = "studio-setting";
1643
+ if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
1644
+ t7 = /* @__PURE__ */ jsx("span", { children: "Component" });
1645
+ $[27] = t7;
1646
+ } else t7 = $[27];
1647
+ t2 = "CVA component";
1648
+ t3 = component;
1649
+ t4 = (event) => {
1650
+ const next_0 = event.target.value;
1651
+ setSlot(slots.find((key_0) => key_0.startsWith(`${next_0}.`)));
1652
+ };
1653
+ t5 = components.map(_temp3$1);
1654
+ $[2] = component;
1655
+ $[3] = draft.overrides;
1656
+ $[4] = inheritedOverrides;
1657
+ $[5] = setDraft;
1658
+ $[6] = setSlot;
1659
+ $[7] = slot;
1660
+ $[8] = definition;
1661
+ $[9] = original;
1662
+ $[10] = slots;
1663
+ $[11] = t2;
1664
+ $[12] = t3;
1665
+ $[13] = t4;
1666
+ $[14] = t5;
1667
+ $[15] = t6;
1668
+ $[16] = t7;
1669
+ $[17] = t8;
1670
+ $[18] = t9;
1671
+ $[19] = update;
1672
+ } else {
1673
+ definition = $[8];
1674
+ original = $[9];
1675
+ slots = $[10];
1676
+ t2 = $[11];
1677
+ t3 = $[12];
1678
+ t4 = $[13];
1679
+ t5 = $[14];
1680
+ t6 = $[15];
1681
+ t7 = $[16];
1682
+ t8 = $[17];
1683
+ t9 = $[18];
1684
+ update = $[19];
1685
+ }
1686
+ let t10;
1687
+ if ($[28] !== t2 || $[29] !== t3 || $[30] !== t4 || $[31] !== t5) {
1688
+ t10 = /* @__PURE__ */ jsx("select", {
1689
+ "aria-label": t2,
1690
+ value: t3,
1691
+ onChange: t4,
1692
+ children: t5
1693
+ });
1694
+ $[28] = t2;
1695
+ $[29] = t3;
1696
+ $[30] = t4;
1697
+ $[31] = t5;
1698
+ $[32] = t10;
1699
+ } else t10 = $[32];
1700
+ let t11;
1701
+ if ($[33] !== t10 || $[34] !== t6 || $[35] !== t7) {
1702
+ t11 = /* @__PURE__ */ jsxs("label", {
1703
+ className: t6,
1704
+ children: [t7, t10]
1705
+ });
1706
+ $[33] = t10;
1707
+ $[34] = t6;
1708
+ $[35] = t7;
1709
+ $[36] = t11;
1710
+ } else t11 = $[36];
1711
+ let t12;
1712
+ if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
1713
+ t12 = /* @__PURE__ */ jsx("span", { children: "Slot" });
1714
+ $[37] = t12;
1715
+ } else t12 = $[37];
1716
+ let t13;
1717
+ if ($[38] !== setSlot) {
1718
+ t13 = (event_0) => setSlot(event_0.target.value);
1719
+ $[38] = setSlot;
1720
+ $[39] = t13;
1721
+ } else t13 = $[39];
1722
+ let t14;
1723
+ if ($[40] !== component || $[41] !== slots) {
1724
+ t14 = slots.filter((key_1) => key_1.startsWith(`${component}.`)).map(_temp4$1);
1725
+ $[40] = component;
1726
+ $[41] = slots;
1727
+ $[42] = t14;
1728
+ } else t14 = $[42];
1729
+ let t15;
1730
+ if ($[43] !== slot || $[44] !== t13 || $[45] !== t14) {
1731
+ t15 = /* @__PURE__ */ jsxs("label", {
1732
+ className: "studio-setting",
1733
+ children: [t12, /* @__PURE__ */ jsx("select", {
1734
+ "aria-label": "CVA slot",
1735
+ value: slot,
1736
+ onChange: t13,
1737
+ children: t14
1738
+ })]
1739
+ });
1740
+ $[43] = slot;
1741
+ $[44] = t13;
1742
+ $[45] = t14;
1743
+ $[46] = t15;
1744
+ } else t15 = $[46];
1745
+ let t16;
1746
+ if ($[47] !== t11 || $[48] !== t15 || $[49] !== t8) {
1747
+ t16 = /* @__PURE__ */ jsxs("div", {
1748
+ className: t8,
1749
+ children: [t11, t15]
1750
+ });
1751
+ $[47] = t11;
1752
+ $[48] = t15;
1753
+ $[49] = t8;
1754
+ $[50] = t16;
1755
+ } else t16 = $[50];
1756
+ let t17;
1757
+ if ($[51] === Symbol.for("react.memo_cache_sentinel")) {
1758
+ t17 = /* @__PURE__ */ jsx("p", {
1759
+ className: "studio-help",
1760
+ children: "Edits replace this slot’s effective definition, including app overrides. Classes must already be compiled by Tailwind to preview live."
1761
+ });
1762
+ $[51] = t17;
1763
+ } else t17 = $[51];
1764
+ let t18;
1765
+ if ($[52] !== definition || $[53] !== onPreview || $[54] !== original || $[55] !== slot || $[56] !== update) {
1766
+ t18 = !original ? /* @__PURE__ */ jsx("p", { children: "This slot uses a function override. Edit it in the application source; it cannot be inspected here." }) : definition && /* @__PURE__ */ jsxs("div", { children: [
1767
+ /* @__PURE__ */ jsx(ClassField, {
1768
+ label: "Base classes",
1769
+ onFocus: () => onPreview({}),
1770
+ value: definition.base.join(" "),
1771
+ onCommit: (value) => update((next_1) => {
1772
+ next_1.base = [value];
1773
+ })
1774
+ }),
1775
+ Object.entries(definition.config.variants).map((t19) => {
1776
+ const [variant, options] = t19;
1777
+ return /* @__PURE__ */ jsxs("fieldset", {
1778
+ className: "studio-token-group",
1779
+ children: [
1780
+ /* @__PURE__ */ jsx("legend", { children: title(variant) }),
1781
+ /* @__PURE__ */ jsxs("label", {
1782
+ className: "studio-setting",
1783
+ children: [/* @__PURE__ */ jsx("span", { children: "Default" }), /* @__PURE__ */ jsxs("select", {
1784
+ "aria-label": `Default ${variant}`,
1785
+ onFocus: () => onPreview({}),
1786
+ value: String(definition.config.defaultVariants[variant] ?? ""),
1787
+ onChange: (event_1) => update((next_2) => {
1788
+ const value_0 = event_1.target.value;
1789
+ next_2.config.defaultVariants[variant] = value_0 === "" ? null : value_0 === "true" ? true : value_0 === "false" ? false : value_0;
1790
+ }),
1791
+ children: [/* @__PURE__ */ jsx("option", {
1792
+ value: "",
1793
+ children: "None"
1794
+ }), Object.keys(options).map(_temp5)]
1795
+ })]
1796
+ }),
1797
+ Object.entries(options).map((t20) => {
1798
+ const [value_2, classes] = t20;
1799
+ return /* @__PURE__ */ jsx(ClassField, {
1800
+ label: `${variant}: ${value_2}`,
1801
+ onFocus: () => onPreview({ [variant]: value_2 }),
1802
+ value: classes,
1803
+ onCommit: (classes_0) => update((next_3) => {
1804
+ next_3.config.variants[variant][value_2] = classes_0;
1805
+ })
1806
+ }, value_2);
1807
+ })
1808
+ ]
1809
+ }, variant);
1810
+ }),
1811
+ definition.config.compoundVariants.length > 0 && /* @__PURE__ */ jsxs("fieldset", {
1812
+ className: "studio-token-group",
1813
+ children: [/* @__PURE__ */ jsx("legend", { children: "Compound variants" }), definition.config.compoundVariants.map((entry, index) => /* @__PURE__ */ jsx(ClassField, {
1814
+ label: Object.entries(entry).filter(_temp7).map(_temp8).join(", "),
1815
+ value: String(entry.className ?? ""),
1816
+ onFocus: () => onPreview(Object.fromEntries(Object.entries(entry).filter(_temp9).map(_temp0))),
1817
+ onCommit: (classes_1) => update((next_4) => {
1818
+ next_4.config.compoundVariants[index].className = classes_1;
1819
+ })
1820
+ }, JSON.stringify(Object.entries(entry).filter(_temp6))))]
1821
+ })
1822
+ ] }, slot);
1823
+ $[52] = definition;
1824
+ $[53] = onPreview;
1825
+ $[54] = original;
1826
+ $[55] = slot;
1827
+ $[56] = update;
1828
+ $[57] = t18;
1829
+ } else t18 = $[57];
1830
+ const t19 = !draft.overrides?.[slot];
1831
+ let t20;
1832
+ if ($[58] !== setDraft || $[59] !== slot) {
1833
+ t20 = () => setDraft((current_0) => {
1834
+ const overrides = { ...current_0.overrides };
1835
+ delete overrides[slot];
1836
+ return {
1837
+ ...current_0,
1838
+ overrides
1839
+ };
1840
+ });
1841
+ $[58] = setDraft;
1842
+ $[59] = slot;
1843
+ $[60] = t20;
1844
+ } else t20 = $[60];
1845
+ let t21;
1846
+ if ($[61] !== t19 || $[62] !== t20) {
1847
+ t21 = /* @__PURE__ */ jsx("button", {
1848
+ className: "studio-cva-reset",
1849
+ disabled: t19,
1850
+ onClick: t20,
1851
+ children: "Reset slot"
1852
+ });
1853
+ $[61] = t19;
1854
+ $[62] = t20;
1855
+ $[63] = t21;
1856
+ } else t21 = $[63];
1857
+ let t22;
1858
+ if ($[64] !== t16 || $[65] !== t18 || $[66] !== t21 || $[67] !== t9) {
1859
+ t22 = /* @__PURE__ */ jsxs("div", {
1860
+ className: t9,
1861
+ children: [
1862
+ t16,
1863
+ t17,
1864
+ t18,
1865
+ t21
1866
+ ]
1867
+ });
1868
+ $[64] = t16;
1869
+ $[65] = t18;
1870
+ $[66] = t21;
1871
+ $[67] = t9;
1872
+ $[68] = t22;
1873
+ } else t22 = $[68];
1874
+ return t22;
1875
+ }
1876
+ function _temp0(t0) {
1877
+ const [key_7, value_4] = t0;
1878
+ return [key_7, String(Array.isArray(value_4) ? value_4[0] : value_4)];
1879
+ }
1880
+ function _temp9(t0) {
1881
+ const [key_6] = t0;
1882
+ return key_6 !== "className";
1883
+ }
1884
+ function _temp8(t0) {
1885
+ const [key_5, value_3] = t0;
1886
+ return `${key_5}: ${Array.isArray(value_3) ? value_3.join(" / ") : value_3}`;
1887
+ }
1888
+ function _temp7(t0) {
1889
+ const [key_4] = t0;
1890
+ return key_4 !== "className";
1891
+ }
1892
+ function _temp6(t0) {
1893
+ const [key_3] = t0;
1894
+ return key_3 !== "className";
1895
+ }
1896
+ function _temp5(value_1) {
1897
+ return /* @__PURE__ */ jsx("option", {
1898
+ value: value_1,
1899
+ children: value_1
1900
+ }, value_1);
1901
+ }
1902
+ function _temp4$1(key_2) {
1903
+ return /* @__PURE__ */ jsx("option", {
1904
+ value: key_2,
1905
+ children: title(key_2.split(".")[1])
1906
+ }, key_2);
1907
+ }
1908
+ function _temp3$1(name) {
1909
+ return /* @__PURE__ */ jsx("option", {
1910
+ value: name,
1911
+ children: title(name)
1912
+ }, name);
1913
+ }
1914
+ function _temp2$1(key) {
1915
+ return key.split(".")[0];
1916
+ }
1917
+ //#endregion
1918
+ //#region src/configurator/theme-writer-protocol.ts
1919
+ /** Shared by the browser configurator and the isolated Node Vite entry. */
1920
+ const themeWriterMetaName = "povio-ui-theme-writer";
1921
+ const themeWriterTokenHeader = "x-povio-ui-theme-token";
1922
+ //#endregion
1923
+ //#region src/configurator/theme-writer-client.ts
1924
+ function getThemeWriter() {
1925
+ if (typeof document === "undefined") return null;
1926
+ const content = document.querySelector(`meta[name="${themeWriterMetaName}"]`)?.content;
1927
+ if (!content) return null;
1928
+ try {
1929
+ const connection = JSON.parse(content);
1930
+ if (typeof connection.endpoint === "string" && connection.endpoint.startsWith("/") && !connection.endpoint.startsWith("//") && typeof connection.token === "string" && typeof connection.file === "string") return connection;
1931
+ } catch {}
1932
+ return null;
1933
+ }
1934
+ async function saveThemeCss(connection, css) {
1935
+ const response = await fetch(connection.endpoint, {
1936
+ method: "POST",
1937
+ headers: {
1938
+ "Content-Type": "application/json",
1939
+ [themeWriterTokenHeader]: connection.token
1940
+ },
1941
+ body: JSON.stringify({ css })
1942
+ });
1943
+ if (!response.ok) {
1944
+ const result = await response.json().catch(() => null);
1945
+ throw new Error(result?.error ?? `Theme save failed (${response.status}).`);
1946
+ }
1947
+ }
1948
+ //#endregion
1949
+ //#region src/configurator/ColorModeSwitch.tsx
1950
+ /** Controlled color-mode switch, shared by configurators and application settings. */
1951
+ function ColorModeSwitch(t0) {
1952
+ const $ = c(7);
1953
+ const { value, onChange, label: t1 } = t0;
1954
+ const label = t1 === void 0 ? "Color mode" : t1;
1955
+ let t2;
1956
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1957
+ t2 = ["light", "dark"];
1958
+ $[0] = t2;
1959
+ } else t2 = $[0];
1960
+ let t3;
1961
+ if ($[1] !== onChange || $[2] !== value) {
1962
+ t3 = t2.map((mode) => /* @__PURE__ */ jsxs("button", {
1963
+ type: "button",
1964
+ "aria-pressed": value === mode,
1965
+ onClick: () => onChange(mode),
1966
+ children: [mode === "light" ? /* @__PURE__ */ jsx(Sun, {
1967
+ size: 14,
1968
+ "aria-hidden": "true"
1969
+ }) : /* @__PURE__ */ jsx(Moon, {
1970
+ size: 14,
1971
+ "aria-hidden": "true"
1972
+ }), mode]
1973
+ }, mode));
1974
+ $[1] = onChange;
1975
+ $[2] = value;
1976
+ $[3] = t3;
1977
+ } else t3 = $[3];
1978
+ let t4;
1979
+ if ($[4] !== label || $[5] !== t3) {
1980
+ t4 = /* @__PURE__ */ jsx("div", {
1981
+ className: "studio-mode studio-color-mode",
1982
+ role: "group",
1983
+ "aria-label": label,
1984
+ children: t3
1985
+ });
1986
+ $[4] = label;
1987
+ $[5] = t3;
1988
+ $[6] = t4;
1989
+ } else t4 = $[6];
1990
+ return t4;
1991
+ }
1992
+ //#endregion
1993
+ //#region src/configurator/AlphaColorField.tsx
1994
+ /** Whether a token value is an 8-digit hex color with an alpha channel, e.g. `#00000066`. */
1995
+ const isAlphaHex = (value) => /^#[0-9a-f]{8}$/i.test(value.trim());
1996
+ const toPercent = (alpha) => Math.round(parseInt(alpha, 16) / 255 * 100);
1997
+ const toAlpha = (percent) => Math.round(Math.min(Math.max(percent, 0), 100) / 100 * 255).toString(16).padStart(2, "0");
1998
+ /**
1999
+ * Edits a translucent color the way Figma shows it: a half solid, half checkerboard swatch, the hex color and its
2000
+ * opacity as a percentage. The value is kept as an 8-digit hex so exports are unchanged.
2001
+ */
2002
+ function AlphaColorField(t0) {
2003
+ const $ = c(23);
2004
+ const { name, label, value, onChange } = t0;
2005
+ const color = value.trim().slice(1, 7);
2006
+ const alpha = value.trim().slice(7, 9);
2007
+ const [hexText, setHexText] = useState(null);
2008
+ const [percentText, setPercentText] = useState(null);
2009
+ const commitHex = () => {
2010
+ if (hexText === null) return;
2011
+ const entered = hexText.trim().replace(/^#/, "");
2012
+ setHexText(null);
2013
+ const hex = /^[0-9a-f]{3}$/i.test(entered) ? entered.replace(/./g, "$&$&") : entered;
2014
+ if (/^[0-9a-f]{6}$/i.test(hex)) onChange(`#${hex.toLowerCase()}${alpha}`);
2015
+ };
2016
+ const commitPercent = () => {
2017
+ if (percentText === null) return;
2018
+ const entered_0 = Number.parseFloat(percentText.replace("%", ""));
2019
+ setPercentText(null);
2020
+ if (Number.isFinite(entered_0)) onChange(`#${color}${toAlpha(entered_0)}`);
2021
+ };
2022
+ const blurOnEnter = _temp$3;
2023
+ const t1 = `#${color}`;
2024
+ let t2;
2025
+ if ($[0] !== t1 || $[1] !== value) {
2026
+ t2 = {
2027
+ "--swatch-solid": t1,
2028
+ "--swatch-color": value
2029
+ };
2030
+ $[0] = t1;
2031
+ $[1] = value;
2032
+ $[2] = t2;
2033
+ } else t2 = $[2];
2034
+ const t3 = `token-${name}`;
2035
+ const t4 = `${label} color`;
2036
+ const t5 = hexText ?? `#${color.toUpperCase()}`;
2037
+ let t6;
2038
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
2039
+ t6 = (event_1) => setHexText(event_1.target.value);
2040
+ $[3] = t6;
2041
+ } else t6 = $[3];
2042
+ let t7;
2043
+ if ($[4] !== blurOnEnter || $[5] !== commitHex || $[6] !== t3 || $[7] !== t4 || $[8] !== t5) {
2044
+ t7 = /* @__PURE__ */ jsx("input", {
2045
+ id: t3,
2046
+ className: "studio-alpha-hex",
2047
+ "aria-label": t4,
2048
+ value: t5,
2049
+ spellCheck: false,
2050
+ onChange: t6,
2051
+ onBlur: commitHex,
2052
+ onKeyDown: blurOnEnter
2053
+ });
2054
+ $[4] = blurOnEnter;
2055
+ $[5] = commitHex;
2056
+ $[6] = t3;
2057
+ $[7] = t4;
2058
+ $[8] = t5;
2059
+ $[9] = t7;
2060
+ } else t7 = $[9];
2061
+ const t8 = "studio-alpha-opacity";
2062
+ const t9 = `${label} opacity`;
2063
+ const t10 = "numeric";
2064
+ const t11 = percentText ?? `${toPercent(alpha)}%`;
2065
+ let t12;
2066
+ if ($[10] !== setPercentText) {
2067
+ t12 = (event_2) => setPercentText(event_2.target.value);
2068
+ $[10] = setPercentText;
2069
+ $[11] = t12;
2070
+ } else t12 = $[11];
2071
+ let t13;
2072
+ if ($[12] !== alpha || $[13] !== blurOnEnter || $[14] !== color || $[15] !== onChange) {
2073
+ t13 = (event_3) => {
2074
+ const step = event_3.key === "ArrowUp" ? 1 : event_3.key === "ArrowDown" ? -1 : 0;
2075
+ if (step) {
2076
+ event_3.preventDefault();
2077
+ onChange(`#${color}${toAlpha(toPercent(alpha) + step * (event_3.shiftKey ? 10 : 1))}`);
2078
+ } else blurOnEnter(event_3);
2079
+ };
2080
+ $[12] = alpha;
2081
+ $[13] = blurOnEnter;
2082
+ $[14] = color;
2083
+ $[15] = onChange;
2084
+ $[16] = t13;
2085
+ } else t13 = $[16];
2086
+ let t14;
2087
+ if ($[17] !== commitPercent || $[18] !== t11 || $[19] !== t12 || $[20] !== t13 || $[21] !== t9) {
2088
+ t14 = /* @__PURE__ */ jsx("span", {
2089
+ className: t8,
2090
+ children: /* @__PURE__ */ jsx("input", {
2091
+ "aria-label": t9,
2092
+ inputMode: t10,
2093
+ value: t11,
2094
+ onChange: t12,
2095
+ onBlur: commitPercent,
2096
+ onKeyDown: t13
2097
+ })
2098
+ });
2099
+ $[17] = commitPercent;
2100
+ $[18] = t11;
2101
+ $[19] = t12;
2102
+ $[20] = t13;
2103
+ $[21] = t9;
2104
+ $[22] = t14;
2105
+ } else t14 = $[22];
2106
+ return /* @__PURE__ */ jsxs("div", {
2107
+ className: "studio-alpha-color",
2108
+ children: [
2109
+ /* @__PURE__ */ jsx("span", {
2110
+ className: "studio-alpha-swatch",
2111
+ style: t2,
2112
+ children: /* @__PURE__ */ jsx("input", {
2113
+ type: "color",
2114
+ "aria-label": `Pick ${label}`,
2115
+ value: `#${color}`,
2116
+ onChange: (event_0) => onChange(`${event_0.target.value}${alpha}`)
2117
+ })
2118
+ }),
2119
+ t7,
2120
+ t14
2121
+ ]
2122
+ });
2123
+ }
2124
+ function _temp$3(event) {
2125
+ if (event.key === "Enter" && !event.nativeEvent.isComposing) event.currentTarget.blur();
2126
+ }
2127
+ //#endregion
2128
+ //#region src/configurator/PaletteSelect.tsx
2129
+ const customPaletteKey = "custom";
2130
+ /** Groups `--primary-800-base` style tokens by palette, darkest step first, as a design tool's swatch list does. */
2131
+ function paletteFamilies(options) {
2132
+ const families = /* @__PURE__ */ new Map();
2133
+ for (const option of options) {
2134
+ const [, family = option.name, step = "0"] = option.name.match(/^--(.+)-(\d+)-base$/) ?? [];
2135
+ if (!families.has(family)) families.set(family, []);
2136
+ families.get(family).push({
2137
+ step: Number(step),
2138
+ option
2139
+ });
2140
+ }
2141
+ return [...families].map(([family, steps]) => ({
2142
+ family,
2143
+ steps: steps.sort((a, b) => b.step - a.step)
2144
+ }));
2145
+ }
2146
+ /** Centres the selected color when the list opens; the list is its own scroll container. */
2147
+ function scrollSelectedIntoView(list) {
2148
+ if (!list) return;
2149
+ requestAnimationFrame(() => {
2150
+ const item = list.querySelector("[data-selected]");
2151
+ if (item) list.scrollTop = item.offsetTop - (list.clientHeight - item.offsetHeight) / 2;
2152
+ });
2153
+ }
2154
+ /** Picks a base palette color for a semantic token, showing each option's swatch, step and hex value. */
2155
+ function PaletteSelect(t0) {
2156
+ const $ = c(28);
2157
+ const { id, label, options, selected, onSelect } = t0;
2158
+ let current;
2159
+ let t1;
2160
+ if ($[0] !== options || $[1] !== selected) {
2161
+ let t2;
2162
+ if ($[4] !== selected) {
2163
+ t2 = (option) => option.name === selected;
2164
+ $[4] = selected;
2165
+ $[5] = t2;
2166
+ } else t2 = $[5];
2167
+ current = options.find(t2);
2168
+ t1 = current?.name.match(/^--(.+)-(\d+)-base$/) ?? [];
2169
+ $[0] = options;
2170
+ $[1] = selected;
2171
+ $[2] = current;
2172
+ $[3] = t1;
2173
+ } else {
2174
+ current = $[2];
2175
+ t1 = $[3];
2176
+ }
2177
+ const [, family, step] = t1;
2178
+ const t2 = `studio-palette-picker ${current ? "" : "is-custom"}`;
2179
+ let t3;
2180
+ if ($[6] !== onSelect) {
2181
+ t3 = (key) => key !== null && onSelect(String(key));
2182
+ $[6] = onSelect;
2183
+ $[7] = t3;
2184
+ } else t3 = $[7];
2185
+ let t4;
2186
+ if ($[8] !== current || $[9] !== family || $[10] !== step) {
2187
+ t4 = current && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
2188
+ className: "studio-palette-swatch",
2189
+ style: { backgroundColor: `rgb(${current.value})` },
2190
+ "aria-hidden": "true"
2191
+ }), /* @__PURE__ */ jsxs("span", {
2192
+ className: "studio-palette-trigger-label",
2193
+ children: [
2194
+ family,
2195
+ " ",
2196
+ step
2197
+ ]
2198
+ })] });
2199
+ $[8] = current;
2200
+ $[9] = family;
2201
+ $[10] = step;
2202
+ $[11] = t4;
2203
+ } else t4 = $[11];
2204
+ let t5;
2205
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
2206
+ t5 = /* @__PURE__ */ jsx(ChevronDown, {
2207
+ size: 13,
2208
+ "aria-hidden": "true"
2209
+ });
2210
+ $[12] = t5;
2211
+ } else t5 = $[12];
2212
+ let t6;
2213
+ if ($[13] !== t4) {
2214
+ t6 = /* @__PURE__ */ jsxs($7705c033048f6da7$export$353f5b6fc5456de1, {
2215
+ className: "studio-palette-trigger",
2216
+ children: [t4, t5]
2217
+ });
2218
+ $[13] = t4;
2219
+ $[14] = t6;
2220
+ } else t6 = $[14];
2221
+ let t7;
2222
+ if ($[15] !== options) {
2223
+ t7 = paletteFamilies(options).map(_temp$2);
2224
+ $[15] = options;
2225
+ $[16] = t7;
2226
+ } else t7 = $[16];
2227
+ let t8;
2228
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
2229
+ t8 = /* @__PURE__ */ jsx($928221da08ecbc62$export$dca12b0bb56e4fc, {
2230
+ id: "other",
2231
+ children: /* @__PURE__ */ jsx($928221da08ecbc62$export$a11e76429ed99b4, {
2232
+ id: customPaletteKey,
2233
+ className: "studio-palette-item is-custom",
2234
+ children: "Custom value…"
2235
+ })
2236
+ });
2237
+ $[17] = t8;
2238
+ } else t8 = $[17];
2239
+ let t9;
2240
+ if ($[18] !== t7) {
2241
+ t9 = /* @__PURE__ */ jsx($542a13ca2fa5b484$export$5b6b19405a83ff9d, {
2242
+ className: "studio-palette-popover",
2243
+ placement: "bottom end",
2244
+ children: /* @__PURE__ */ jsxs($928221da08ecbc62$export$41f133550aa26f48, {
2245
+ className: "studio-palette-list",
2246
+ ref: scrollSelectedIntoView,
2247
+ children: [t7, t8]
2248
+ })
2249
+ });
2250
+ $[18] = t7;
2251
+ $[19] = t9;
2252
+ } else t9 = $[19];
2253
+ let t10;
2254
+ if ($[20] !== id || $[21] !== label || $[22] !== selected || $[23] !== t2 || $[24] !== t3 || $[25] !== t6 || $[26] !== t9) {
2255
+ t10 = /* @__PURE__ */ jsxs($c8bb816105474884$export$ef9b1a59e592288f, {
2256
+ id,
2257
+ "aria-label": label,
2258
+ className: t2,
2259
+ selectedKey: selected,
2260
+ onSelectionChange: t3,
2261
+ children: [t6, t9]
2262
+ });
2263
+ $[20] = id;
2264
+ $[21] = label;
2265
+ $[22] = selected;
2266
+ $[23] = t2;
2267
+ $[24] = t3;
2268
+ $[25] = t6;
2269
+ $[26] = t9;
2270
+ $[27] = t10;
2271
+ } else t10 = $[27];
2272
+ return t10;
2273
+ }
2274
+ function _temp$2(t0) {
2275
+ const { family: name, steps } = t0;
2276
+ return /* @__PURE__ */ jsxs($928221da08ecbc62$export$dca12b0bb56e4fc, {
2277
+ id: name,
2278
+ children: [/* @__PURE__ */ jsxs($53e61d82d8b8611d$export$8b251419efc915eb, { children: ["Base palette / ", name] }), steps.map((t1) => {
2279
+ const { step: value, option: option_0 } = t1;
2280
+ return /* @__PURE__ */ jsxs($928221da08ecbc62$export$a11e76429ed99b4, {
2281
+ id: option_0.name,
2282
+ textValue: `${name} ${value}`,
2283
+ "aria-label": `${name} ${value}`,
2284
+ className: "studio-palette-item",
2285
+ children: [
2286
+ /* @__PURE__ */ jsx("span", {
2287
+ className: "studio-palette-swatch",
2288
+ style: { backgroundColor: `rgb(${option_0.value})` },
2289
+ "aria-hidden": "true"
2290
+ }),
2291
+ /* @__PURE__ */ jsx("span", { children: value }),
2292
+ /* @__PURE__ */ jsx("code", { children: toHex(option_0.value).toUpperCase() })
2293
+ ]
2294
+ }, option_0.name);
2295
+ })]
2296
+ }, name);
2297
+ }
2298
+ //#endregion
2299
+ //#region src/configurator/PanelResizeHandle.tsx
2300
+ const keyboardStep = 16;
2301
+ /**
2302
+ * A draggable divider between two configurator panels. It reports the width of the panel on its left; the parent owns
2303
+ * the width and its limits. Double-click (or Enter) restores the default layout.
2304
+ */
2305
+ function PanelResizeHandle(t0) {
2306
+ const $ = c(28);
2307
+ const { label, column, width, min, max, onResize, onReset } = t0;
2308
+ const drag = useRef(null);
2309
+ let t1;
2310
+ if ($[0] !== max || $[1] !== min) {
2311
+ t1 = (next) => Math.round(Math.min(Math.max(next, min), Math.max(min, max())));
2312
+ $[0] = max;
2313
+ $[1] = min;
2314
+ $[2] = t1;
2315
+ } else t1 = $[2];
2316
+ const clamp = t1;
2317
+ let t2;
2318
+ if ($[3] !== column || $[4] !== min) {
2319
+ t2 = (handle) => (handle.parentElement?.children[column - 2])?.getBoundingClientRect().width ?? min;
2320
+ $[3] = column;
2321
+ $[4] = min;
2322
+ $[5] = t2;
2323
+ } else t2 = $[5];
2324
+ const measured = t2;
2325
+ let t3;
2326
+ if ($[6] !== measured) {
2327
+ t3 = (event) => {
2328
+ if (event.button !== 0) return;
2329
+ event.preventDefault();
2330
+ event.currentTarget.setPointerCapture(event.pointerId);
2331
+ drag.current = {
2332
+ x: event.clientX,
2333
+ width: measured(event.currentTarget)
2334
+ };
2335
+ };
2336
+ $[6] = measured;
2337
+ $[7] = t3;
2338
+ } else t3 = $[7];
2339
+ const onPointerDown = t3;
2340
+ let t4;
2341
+ if ($[8] !== clamp || $[9] !== onResize) {
2342
+ t4 = (event_0) => {
2343
+ if (drag.current) onResize(clamp(drag.current.width + event_0.clientX - drag.current.x));
2344
+ };
2345
+ $[8] = clamp;
2346
+ $[9] = onResize;
2347
+ $[10] = t4;
2348
+ } else t4 = $[10];
2349
+ const onPointerMove = t4;
2350
+ let t5;
2351
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
2352
+ t5 = (event_1) => {
2353
+ drag.current = null;
2354
+ event_1.currentTarget.releasePointerCapture(event_1.pointerId);
2355
+ };
2356
+ $[11] = t5;
2357
+ } else t5 = $[11];
2358
+ const onPointerUp = t5;
2359
+ let t6;
2360
+ if ($[12] !== clamp || $[13] !== measured || $[14] !== onReset || $[15] !== onResize) {
2361
+ t6 = (event_2) => {
2362
+ const step = event_2.key === "ArrowLeft" ? -16 : event_2.key === "ArrowRight" ? keyboardStep : 0;
2363
+ if (step) {
2364
+ event_2.preventDefault();
2365
+ onResize(clamp(measured(event_2.currentTarget) + step));
2366
+ } else if (event_2.key === "Enter") {
2367
+ event_2.preventDefault();
2368
+ onReset();
2369
+ }
2370
+ };
2371
+ $[12] = clamp;
2372
+ $[13] = measured;
2373
+ $[14] = onReset;
2374
+ $[15] = onResize;
2375
+ $[16] = t6;
2376
+ } else t6 = $[16];
2377
+ const onKeyDown = t6;
2378
+ let t7;
2379
+ if ($[17] !== column) {
2380
+ t7 = { gridColumn: column };
2381
+ $[17] = column;
2382
+ $[18] = t7;
2383
+ } else t7 = $[18];
2384
+ let t8;
2385
+ if ($[19] !== label || $[20] !== min || $[21] !== onKeyDown || $[22] !== onPointerDown || $[23] !== onPointerMove || $[24] !== onReset || $[25] !== t7 || $[26] !== width) {
2386
+ t8 = /* @__PURE__ */ jsx("div", {
2387
+ className: "studio-resize-handle",
2388
+ style: t7,
2389
+ role: "separator",
2390
+ "aria-orientation": "vertical",
2391
+ "aria-label": label,
2392
+ "aria-valuenow": width,
2393
+ "aria-valuemin": min,
2394
+ tabIndex: 0,
2395
+ title: "Drag to resize · double-click to reset",
2396
+ onPointerDown,
2397
+ onPointerMove,
2398
+ onPointerUp,
2399
+ onPointerCancel: onPointerUp,
2400
+ onDoubleClick: onReset,
2401
+ onKeyDown
2402
+ });
2403
+ $[19] = label;
2404
+ $[20] = min;
2405
+ $[21] = onKeyDown;
2406
+ $[22] = onPointerDown;
2407
+ $[23] = onPointerMove;
2408
+ $[24] = onReset;
2409
+ $[25] = t7;
2410
+ $[26] = width;
2411
+ $[27] = t8;
2412
+ } else t8 = $[27];
2413
+ return t8;
2414
+ }
2415
+ //#endregion
2416
+ //#region src/configurator/FontRoleCard.tsx
2417
+ const unquote = (family) => family.trim().replace(/^["']|["']$/g, "");
2418
+ /** Generic stacks that are available everywhere, for apps without their own fonts. */
2419
+ const systemFonts = [
2420
+ {
2421
+ name: "system:sans",
2422
+ label: "System sans-serif",
2423
+ value: "system-ui, sans-serif",
2424
+ group: "System fonts"
2425
+ },
2426
+ {
2427
+ name: "system:serif",
2428
+ label: "System serif",
2429
+ value: "ui-serif, Georgia, serif",
2430
+ group: "System fonts"
2431
+ },
2432
+ {
2433
+ name: "system:mono",
2434
+ label: "System monospace",
2435
+ value: "ui-monospace, monospace",
2436
+ group: "System fonts"
2437
+ }
2438
+ ];
2439
+ /**
2440
+ * The font families the app has loaded (its `@font-face` rules, such as Fontsource packages). A family with a matching
2441
+ * `--font-<name>-base` variable is referenced through it, so the theme keeps a single place that names the font.
2442
+ */
2443
+ function useLoadedFonts() {
2444
+ const $ = c(7);
2445
+ let t0;
2446
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2447
+ t0 = [];
2448
+ $[0] = t0;
2449
+ } else t0 = $[0];
2450
+ const [fonts, setFonts] = useState(t0);
2451
+ const [revision, setRevision] = useState(0);
2452
+ let t1;
2453
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
2454
+ t1 = () => setRevision(_temp$1);
2455
+ $[1] = t1;
2456
+ } else t1 = $[1];
2457
+ const refresh = t1;
2458
+ let t2;
2459
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
2460
+ t2 = () => {
2461
+ let active = true;
2462
+ document.fonts.ready.then(() => {
2463
+ if (!active) return;
2464
+ const root = getComputedStyle(document.documentElement);
2465
+ const families = [...new Set([...document.fonts].map(_temp2))];
2466
+ setFonts(families.map((family) => {
2467
+ const base = `--font-${family.split(/\s+/)[0].toLowerCase()}-base`;
2468
+ const value_0 = unquote(root.getPropertyValue(base)) === family ? `var(${base}), sans-serif` : `"${family}", sans-serif`;
2469
+ const group = uploadedFamilies.has(family) ? "Uploaded fonts" : "Loaded fonts";
2470
+ return {
2471
+ name: `loaded:${family}`,
2472
+ label: familyName(value_0),
2473
+ value: value_0,
2474
+ group
2475
+ };
2476
+ }));
2477
+ });
2478
+ return () => {
2479
+ active = false;
2480
+ };
2481
+ };
2482
+ $[2] = t2;
2483
+ } else t2 = $[2];
2484
+ let t3;
2485
+ if ($[3] !== revision) {
2486
+ t3 = [revision];
2487
+ $[3] = revision;
2488
+ $[4] = t3;
2489
+ } else t3 = $[4];
2490
+ useEffect(t2, t3);
2491
+ let t4;
2492
+ if ($[5] !== fonts) {
2493
+ t4 = [fonts, refresh];
2494
+ $[5] = fonts;
2495
+ $[6] = t4;
2496
+ } else t4 = $[6];
2497
+ return t4;
2498
+ }
2499
+ /** Families added through the upload button in this page session. */
2500
+ function _temp2(face) {
2501
+ return unquote(face.family);
2502
+ }
2503
+ function _temp$1(value) {
2504
+ return value + 1;
2505
+ }
2506
+ const uploadedFamilies = /* @__PURE__ */ new Set();
2507
+ const fontFileTypes = ".woff2,.woff,.ttf,.otf";
2508
+ /**
2509
+ * Registers a font file with the page through the FontFace API, so it can be picked for a role and previewed right
2510
+ * away. The family is named after the file. It lasts for this page session; the app still needs the file and an
2511
+ * `@font-face` rule for a saved theme to use it.
2512
+ */
2513
+ function FontUpload(t0) {
2514
+ const $ = c(8);
2515
+ const { onUpload } = t0;
2516
+ const inputRef = useRef(null);
2517
+ const [message, setMessage] = useState("");
2518
+ let t1;
2519
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2520
+ t1 = /* @__PURE__ */ jsxs("button", {
2521
+ type: "button",
2522
+ className: "studio-gallery-back",
2523
+ onClick: () => inputRef.current?.click(),
2524
+ children: [/* @__PURE__ */ jsx(Upload, {
2525
+ size: 13,
2526
+ "aria-hidden": "true"
2527
+ }), "Upload font"]
2528
+ });
2529
+ $[0] = t1;
2530
+ } else t1 = $[0];
2531
+ let t2;
2532
+ if ($[1] !== onUpload) {
2533
+ t2 = /* @__PURE__ */ jsx("input", {
2534
+ ref: inputRef,
2535
+ type: "file",
2536
+ accept: fontFileTypes,
2537
+ hidden: true,
2538
+ onChange: async (event) => {
2539
+ const file = event.target.files?.[0];
2540
+ event.target.value = "";
2541
+ if (!file) return;
2542
+ const family = file.name.replace(/\.[^.]+$/, "").replace(/[-_]+/g, " ").trim();
2543
+ try {
2544
+ const face = await new FontFace(family, await file.arrayBuffer()).load();
2545
+ document.fonts.add(face);
2546
+ uploadedFamilies.add(family);
2547
+ onUpload(family);
2548
+ setMessage(`Added ${family}. Pick it for Heading or Body above.`);
2549
+ } catch {
2550
+ setMessage(`${file.name} is not a font this browser can read. Use WOFF2, WOFF, TTF or OTF.`);
2551
+ }
2552
+ }
2553
+ });
2554
+ $[1] = onUpload;
2555
+ $[2] = t2;
2556
+ } else t2 = $[2];
2557
+ const t3 = message || "WOFF2, WOFF, TTF or OTF. Uploaded fonts last for this session; add the file to your app with @font-face before saving the theme.";
2558
+ let t4;
2559
+ if ($[3] !== t3) {
2560
+ t4 = /* @__PURE__ */ jsx("p", {
2561
+ className: "studio-font-upload-note",
2562
+ role: "status",
2563
+ children: t3
2564
+ });
2565
+ $[3] = t3;
2566
+ $[4] = t4;
2567
+ } else t4 = $[4];
2568
+ let t5;
2569
+ if ($[5] !== t2 || $[6] !== t4) {
2570
+ t5 = /* @__PURE__ */ jsxs("div", {
2571
+ className: "studio-font-upload",
2572
+ children: [
2573
+ t1,
2574
+ t2,
2575
+ t4
2576
+ ]
2577
+ });
2578
+ $[5] = t2;
2579
+ $[6] = t4;
2580
+ $[7] = t5;
2581
+ } else t5 = $[7];
2582
+ return t5;
2583
+ }
2584
+ /** The family name a font stack starts with, such as "Inter" for `var(--font-inter-base), sans-serif`. */
2585
+ function familyName(value) {
2586
+ const first = value.split(",")[0].trim();
2587
+ return (first.match(/^var\(--font-([\w-]+?)(?:-base)?\)$/)?.[1] ?? unquote(first)).replace(/(^|-)(\w)/g, (_, dash, letter) => `${dash ? " " : ""}${letter.toUpperCase()}`);
2588
+ }
2589
+ /**
2590
+ * A font role (heading, body) shown as a card with its family name and a sample; the whole card opens a list of the
2591
+ * theme's font families, like a design tool's font picker.
2592
+ */
2593
+ function FontRoleCard(t0) {
2594
+ const $ = c(44);
2595
+ const { label, value, options, changed, onChange, onReset } = t0;
2596
+ let t1;
2597
+ if ($[0] !== options || $[1] !== value) {
2598
+ let t2;
2599
+ if ($[3] !== value) {
2600
+ t2 = (option) => option.value === value;
2601
+ $[3] = value;
2602
+ $[4] = t2;
2603
+ } else t2 = $[4];
2604
+ t1 = options.find(t2);
2605
+ $[0] = options;
2606
+ $[1] = value;
2607
+ $[2] = t1;
2608
+ } else t1 = $[2];
2609
+ const selected = t1;
2610
+ let t2;
2611
+ if ($[5] !== label) {
2612
+ t2 = /* @__PURE__ */ jsx("span", { children: label });
2613
+ $[5] = label;
2614
+ $[6] = t2;
2615
+ } else t2 = $[6];
2616
+ let t3;
2617
+ if ($[7] !== selected?.label || $[8] !== value) {
2618
+ t3 = selected?.label ?? familyName(value);
2619
+ $[7] = selected?.label;
2620
+ $[8] = value;
2621
+ $[9] = t3;
2622
+ } else t3 = $[9];
2623
+ let t4;
2624
+ if ($[10] !== t3) {
2625
+ t4 = /* @__PURE__ */ jsx("strong", { children: t3 });
2626
+ $[10] = t3;
2627
+ $[11] = t4;
2628
+ } else t4 = $[11];
2629
+ let t5;
2630
+ if ($[12] !== t2 || $[13] !== t4) {
2631
+ t5 = /* @__PURE__ */ jsxs("span", {
2632
+ className: "studio-font-role-text",
2633
+ children: [t2, t4]
2634
+ });
2635
+ $[12] = t2;
2636
+ $[13] = t4;
2637
+ $[14] = t5;
2638
+ } else t5 = $[14];
2639
+ let t6;
2640
+ if ($[15] !== value) {
2641
+ t6 = /* @__PURE__ */ jsx("span", {
2642
+ className: "studio-font-role-sample",
2643
+ style: { fontFamily: value },
2644
+ "aria-hidden": "true",
2645
+ children: "Aa"
2646
+ });
2647
+ $[15] = value;
2648
+ $[16] = t6;
2649
+ } else t6 = $[16];
2650
+ const t7 = `${label} font`;
2651
+ const t8 = selected?.name ?? "";
2652
+ let t9;
2653
+ if ($[17] !== onChange || $[18] !== options) {
2654
+ t9 = (event) => {
2655
+ const option_0 = options.find((t10) => {
2656
+ const { name } = t10;
2657
+ return name === event.target.value;
2658
+ });
2659
+ if (option_0) onChange(option_0.value);
2660
+ };
2661
+ $[17] = onChange;
2662
+ $[18] = options;
2663
+ $[19] = t9;
2664
+ } else t9 = $[19];
2665
+ let t10;
2666
+ if ($[20] !== selected) {
2667
+ t10 = !selected && /* @__PURE__ */ jsx("option", {
2668
+ value: "",
2669
+ disabled: true,
2670
+ children: "Custom"
2671
+ });
2672
+ $[20] = selected;
2673
+ $[21] = t10;
2674
+ } else t10 = $[21];
2675
+ let t11;
2676
+ if ($[22] !== options) {
2677
+ t11 = new Set(options.map(_temp3));
2678
+ $[22] = options;
2679
+ $[23] = t11;
2680
+ } else t11 = $[23];
2681
+ let t12;
2682
+ if ($[24] !== t11) {
2683
+ t12 = [...t11];
2684
+ $[24] = t11;
2685
+ $[25] = t12;
2686
+ } else t12 = $[25];
2687
+ let t13;
2688
+ if ($[26] !== options || $[27] !== t12) {
2689
+ t13 = t12.map((group_0) => /* @__PURE__ */ jsx("optgroup", {
2690
+ label: group_0,
2691
+ children: options.filter((option_1) => option_1.group === group_0).map(_temp4)
2692
+ }, group_0));
2693
+ $[26] = options;
2694
+ $[27] = t12;
2695
+ $[28] = t13;
2696
+ } else t13 = $[28];
2697
+ let t14;
2698
+ if ($[29] !== t10 || $[30] !== t13 || $[31] !== t7 || $[32] !== t8 || $[33] !== t9) {
2699
+ t14 = /* @__PURE__ */ jsxs("select", {
2700
+ className: "studio-font-role-select",
2701
+ "aria-label": t7,
2702
+ value: t8,
2703
+ onChange: t9,
2704
+ children: [t10, t13]
2705
+ });
2706
+ $[29] = t10;
2707
+ $[30] = t13;
2708
+ $[31] = t7;
2709
+ $[32] = t8;
2710
+ $[33] = t9;
2711
+ $[34] = t14;
2712
+ } else t14 = $[34];
2713
+ let t15;
2714
+ if ($[35] !== changed || $[36] !== label || $[37] !== onReset) {
2715
+ t15 = changed && /* @__PURE__ */ jsx("button", {
2716
+ type: "button",
2717
+ className: "studio-font-role-reset",
2718
+ "aria-label": `Reset ${label} font`,
2719
+ title: "Reset to the theme default",
2720
+ onClick: onReset,
2721
+ children: /* @__PURE__ */ jsx(RotateCcw, {
2722
+ size: 13,
2723
+ "aria-hidden": "true"
2724
+ })
2725
+ });
2726
+ $[35] = changed;
2727
+ $[36] = label;
2728
+ $[37] = onReset;
2729
+ $[38] = t15;
2730
+ } else t15 = $[38];
2731
+ let t16;
2732
+ if ($[39] !== t14 || $[40] !== t15 || $[41] !== t5 || $[42] !== t6) {
2733
+ t16 = /* @__PURE__ */ jsxs("div", {
2734
+ className: "studio-font-role",
2735
+ children: [
2736
+ t5,
2737
+ t6,
2738
+ t14,
2739
+ t15
2740
+ ]
2741
+ });
2742
+ $[39] = t14;
2743
+ $[40] = t15;
2744
+ $[41] = t5;
2745
+ $[42] = t6;
2746
+ $[43] = t16;
2747
+ } else t16 = $[43];
2748
+ return t16;
2749
+ }
2750
+ function _temp4(option_2) {
2751
+ return /* @__PURE__ */ jsx("option", {
2752
+ value: option_2.name,
2753
+ children: option_2.label
2754
+ }, option_2.name);
2755
+ }
2756
+ function _temp3(t0) {
2757
+ const { group } = t0;
2758
+ return group;
2759
+ }
2760
+ //#endregion
2761
+ //#region src/configurator/LayoutScaleControl.tsx
2762
+ const copy = {
2763
+ Radius: {
2764
+ title: "Global rounding",
2765
+ description: "Scales every radius from the theme defaults"
2766
+ },
2767
+ Spacing: {
2768
+ title: "Global spacing",
2769
+ description: "Scales padding and gaps from the theme defaults"
2770
+ },
2771
+ Sizing: {
2772
+ title: "Global sizing",
2773
+ description: "Scales button and input heights, avatars, icons, minimum widths and container widths"
2774
+ },
2775
+ "Font size": {
2776
+ title: "Global font size",
2777
+ description: "Scales every text style; line heights follow"
2778
+ }
2779
+ };
2780
+ /**
2781
+ * Steps every token of a layout tab up or down together. A custom level means individual tokens were edited, so the
2782
+ * next step starts again from the theme defaults.
2783
+ */
2784
+ function LayoutScaleControl(t0) {
2785
+ const $ = c(50);
2786
+ const { kind, level, onChange } = t0;
2787
+ const { levels, defaultLevel } = layoutScales[kind];
2788
+ const current = level ?? defaultLevel;
2789
+ const factor = level === void 0 ? 1 : levels[level].factor;
2790
+ const { title, description } = copy[kind];
2791
+ let t1;
2792
+ if ($[0] !== kind) {
2793
+ t1 = kind.toLowerCase().replace(" ", "-");
2794
+ $[0] = kind;
2795
+ $[1] = t1;
2796
+ } else t1 = $[1];
2797
+ const t2 = `studio-rounding-preview studio-scale-preview-${t1}`;
2798
+ let t3;
2799
+ if ($[2] !== factor || $[3] !== kind) {
2800
+ t3 = kind === "Radius" ? { borderTopLeftRadius: factor === Infinity ? "999px" : `${factor * 6}px` } : kind === "Spacing" ? { gap: `${Math.round(factor * 4)}px` } : kind === "Font size" ? { fontSize: `${Math.round(factor * 14)}px` } : { scale: String(factor) };
2801
+ $[2] = factor;
2802
+ $[3] = kind;
2803
+ $[4] = t3;
2804
+ } else t3 = $[4];
2805
+ const t4 = kind === "Font size" && "Aa";
2806
+ let t5;
2807
+ if ($[5] !== kind) {
2808
+ t5 = kind === "Spacing" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("i", {}), /* @__PURE__ */ jsx("i", {})] });
2809
+ $[5] = kind;
2810
+ $[6] = t5;
2811
+ } else t5 = $[6];
2812
+ let t6;
2813
+ if ($[7] !== t2 || $[8] !== t3 || $[9] !== t4 || $[10] !== t5) {
2814
+ t6 = /* @__PURE__ */ jsxs("span", {
2815
+ className: t2,
2816
+ "aria-hidden": "true",
2817
+ style: t3,
2818
+ children: [t4, t5]
2819
+ });
2820
+ $[7] = t2;
2821
+ $[8] = t3;
2822
+ $[9] = t4;
2823
+ $[10] = t5;
2824
+ $[11] = t6;
2825
+ } else t6 = $[11];
2826
+ let t7;
2827
+ if ($[12] !== title) {
2828
+ t7 = /* @__PURE__ */ jsx("strong", { children: title });
2829
+ $[12] = title;
2830
+ $[13] = t7;
2831
+ } else t7 = $[13];
2832
+ let t8;
2833
+ if ($[14] !== description) {
2834
+ t8 = /* @__PURE__ */ jsx("span", { children: description });
2835
+ $[14] = description;
2836
+ $[15] = t8;
2837
+ } else t8 = $[15];
2838
+ let t9;
2839
+ if ($[16] !== t7 || $[17] !== t8) {
2840
+ t9 = /* @__PURE__ */ jsxs("div", {
2841
+ className: "studio-rounding-text",
2842
+ children: [t7, t8]
2843
+ });
2844
+ $[16] = t7;
2845
+ $[17] = t8;
2846
+ $[18] = t9;
2847
+ } else t9 = $[18];
2848
+ let t10;
2849
+ if ($[19] !== title) {
2850
+ t10 = title.toLowerCase();
2851
+ $[19] = title;
2852
+ $[20] = t10;
2853
+ } else t10 = $[20];
2854
+ const t11 = `Decrease ${t10}`;
2855
+ const t12 = level === 0;
2856
+ let t13;
2857
+ if ($[21] !== current || $[22] !== onChange) {
2858
+ t13 = () => onChange(current - 1);
2859
+ $[21] = current;
2860
+ $[22] = onChange;
2861
+ $[23] = t13;
2862
+ } else t13 = $[23];
2863
+ let t14;
2864
+ if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
2865
+ t14 = /* @__PURE__ */ jsx(Minus, {
2866
+ size: 13,
2867
+ "aria-hidden": "true"
2868
+ });
2869
+ $[24] = t14;
2870
+ } else t14 = $[24];
2871
+ let t15;
2872
+ if ($[25] !== t11 || $[26] !== t12 || $[27] !== t13) {
2873
+ t15 = /* @__PURE__ */ jsx("button", {
2874
+ type: "button",
2875
+ "aria-label": t11,
2876
+ disabled: t12,
2877
+ onClick: t13,
2878
+ children: t14
2879
+ });
2880
+ $[25] = t11;
2881
+ $[26] = t12;
2882
+ $[27] = t13;
2883
+ $[28] = t15;
2884
+ } else t15 = $[28];
2885
+ const t16 = level === void 0 ? "Custom" : levels[level].label;
2886
+ let t17;
2887
+ if ($[29] !== t16) {
2888
+ t17 = /* @__PURE__ */ jsx("output", {
2889
+ "aria-live": "polite",
2890
+ children: t16
2891
+ });
2892
+ $[29] = t16;
2893
+ $[30] = t17;
2894
+ } else t17 = $[30];
2895
+ let t18;
2896
+ if ($[31] !== title) {
2897
+ t18 = title.toLowerCase();
2898
+ $[31] = title;
2899
+ $[32] = t18;
2900
+ } else t18 = $[32];
2901
+ const t19 = `Increase ${t18}`;
2902
+ const t20 = level === levels.length - 1;
2903
+ let t21;
2904
+ if ($[33] !== current || $[34] !== onChange) {
2905
+ t21 = () => onChange(current + 1);
2906
+ $[33] = current;
2907
+ $[34] = onChange;
2908
+ $[35] = t21;
2909
+ } else t21 = $[35];
2910
+ let t22;
2911
+ if ($[36] === Symbol.for("react.memo_cache_sentinel")) {
2912
+ t22 = /* @__PURE__ */ jsx(Plus, {
2913
+ size: 13,
2914
+ "aria-hidden": "true"
2915
+ });
2916
+ $[36] = t22;
2917
+ } else t22 = $[36];
2918
+ let t23;
2919
+ if ($[37] !== t19 || $[38] !== t20 || $[39] !== t21) {
2920
+ t23 = /* @__PURE__ */ jsx("button", {
2921
+ type: "button",
2922
+ "aria-label": t19,
2923
+ disabled: t20,
2924
+ onClick: t21,
2925
+ children: t22
2926
+ });
2927
+ $[37] = t19;
2928
+ $[38] = t20;
2929
+ $[39] = t21;
2930
+ $[40] = t23;
2931
+ } else t23 = $[40];
2932
+ let t24;
2933
+ if ($[41] !== t15 || $[42] !== t17 || $[43] !== t23) {
2934
+ t24 = /* @__PURE__ */ jsxs("div", {
2935
+ className: "studio-rounding-stepper",
2936
+ children: [
2937
+ t15,
2938
+ t17,
2939
+ t23
2940
+ ]
2941
+ });
2942
+ $[41] = t15;
2943
+ $[42] = t17;
2944
+ $[43] = t23;
2945
+ $[44] = t24;
2946
+ } else t24 = $[44];
2947
+ let t25;
2948
+ if ($[45] !== t24 || $[46] !== t6 || $[47] !== t9 || $[48] !== title) {
2949
+ t25 = /* @__PURE__ */ jsxs("div", {
2950
+ className: "studio-rounding",
2951
+ role: "group",
2952
+ "aria-label": title,
2953
+ children: [
2954
+ t6,
2955
+ t9,
2956
+ t24
2957
+ ]
2958
+ });
2959
+ $[45] = t24;
2960
+ $[46] = t6;
2961
+ $[47] = t9;
2962
+ $[48] = title;
2963
+ $[49] = t25;
2964
+ } else t25 = $[49];
2965
+ return t25;
2966
+ }
2967
+ //#endregion
2968
+ //#region src/configurator/presets.ts
2969
+ /** Both copies of a token that Tailwind reads as `--spacing-*` (padding, height) and `--container-*` (width). */
2970
+ const layoutPair = (name, value) => ({
2971
+ [`--spacing-${name}`]: value,
2972
+ [`--container-${name}`]: value
2973
+ });
2974
+ /** Tailwind's neutral scale, as RGB channels for one of the theme's base palettes. */
2975
+ const neutralPalette = (palette) => Object.fromEntries(Object.entries({
2976
+ 50: "250 250 250",
2977
+ 100: "245 245 245",
2978
+ 200: "229 229 229",
2979
+ 300: "212 212 212",
2980
+ 400: "161 161 161",
2981
+ 500: "115 115 115",
2982
+ 600: "82 82 82",
2983
+ 700: "64 64 64",
2984
+ 800: "38 38 38",
2985
+ 900: "23 23 23",
2986
+ 950: "10 10 10"
2987
+ }).map(([step, value]) => [`--${palette}-${step}-base`, value]));
2988
+ const themePresets = [{
2989
+ id: "shadcn",
2990
+ label: "shadcn/ui",
2991
+ description: "Neutral palette, near-black primary, Geist 14px, 8px controls radius, 36px buttons and inputs.",
2992
+ edits: {
2993
+ light: {
2994
+ ...neutralPalette("primary"),
2995
+ ...neutralPalette("neutral"),
2996
+ "--surface-default-background-base": "var(--neutral-10-base)",
2997
+ "--surface-default-card-base": "var(--neutral-10-base)",
2998
+ "--surface-default-card-foreground-base": "var(--neutral-950-base)",
2999
+ "--surface-default-foreground-base": "var(--neutral-950-base)",
3000
+ "--surface-default-popover-foreground-base": "var(--neutral-500-base)",
3001
+ "--border-default-subtle-base": "var(--neutral-200-base)",
3002
+ "--border-default-input-base": "var(--neutral-200-base)",
3003
+ "--interactive-primary-background-base": "var(--neutral-900-base)",
3004
+ "--interactive-primary-foreground-base": "var(--neutral-50-base)",
3005
+ "--interactive-subtle-primary-background-base": "var(--neutral-100-base)",
3006
+ "--interactive-subtle-primary-foreground-base": "var(--neutral-900-base)",
3007
+ "--interactive-subtle-secondary-background-base": "var(--neutral-100-base)",
3008
+ "--interactive-subtle-secondary-foreground-base": "var(--neutral-900-base)",
3009
+ "--interactive-ring-base": "var(--neutral-400-base)",
3010
+ "--states-hover-opacity": "10%"
3011
+ },
3012
+ dark: {
3013
+ "--surface-default-background-base": "var(--neutral-950-base)",
3014
+ "--surface-default-card-base": "var(--neutral-900-base)",
3015
+ "--surface-default-card-foreground-base": "var(--neutral-50-base)",
3016
+ "--surface-default-foreground-base": "var(--neutral-50-base)",
3017
+ "--surface-default-popover-foreground-base": "var(--neutral-400-base)",
3018
+ "--border-default-subtle-base": "var(--neutral-800-base)",
3019
+ "--border-default-input-base": "var(--neutral-700-base)",
3020
+ "--interactive-primary-background-base": "var(--neutral-200-base)",
3021
+ "--interactive-primary-foreground-base": "var(--neutral-900-base)",
3022
+ "--interactive-subtle-primary-background-base": "var(--neutral-800-base)",
3023
+ "--interactive-subtle-primary-foreground-base": "var(--neutral-50-base)",
3024
+ "--interactive-subtle-secondary-background-base": "var(--neutral-800-base)",
3025
+ "--interactive-subtle-secondary-foreground-base": "var(--neutral-50-base)",
3026
+ "--interactive-ring-base": "var(--neutral-500-base)",
3027
+ "--states-hover-opacity": "10%"
3028
+ },
3029
+ theme: {
3030
+ "--font-titles": "var(--font-geist-base, \"Geist Variable\"), sans-serif",
3031
+ "--font-body": "var(--font-geist-base, \"Geist Variable\"), sans-serif",
3032
+ "--text-body": "0.875rem",
3033
+ "--text-body--line-height": "1.4286",
3034
+ "--radius-global-rounding-xs": "0.25rem",
3035
+ "--radius-global-rounding-s": "0.375rem",
3036
+ "--radius-global-rounding-m": "0.5rem",
3037
+ "--radius-global-rounding-l": "0.625rem",
3038
+ "--radius-global-rounding-xl": "0.875rem",
3039
+ "--radius-button-rounding-default": "0.5rem",
3040
+ "--radius-button-rounding-small": "0.5rem",
3041
+ "--radius-button-focus-rounding-default": "0.625rem",
3042
+ "--radius-button-focus-rounding-small": "0.625rem",
3043
+ "--radius-input-rounding-default": "0.5rem",
3044
+ "--radius-floating-label-input-rounding-default": "0.5rem",
3045
+ "--radius-list-rounding-dropdown": "0.5rem",
3046
+ "--radius-tooltip-rounding-default": "0.5rem",
3047
+ "--radius-badge-rounding-default": "0.5rem",
3048
+ "--radius-toast-rounding-default": "0.5rem",
3049
+ "--radius-modal-rounding-default": "0.625rem",
3050
+ "--radius-alert-rounding-default": "0.625rem",
3051
+ "--radius-file-upload-container-rounding-default": "0.625rem",
3052
+ "--radius-file-upload-file-card-rounding-default": "0.5rem",
3053
+ "--radius-segmented-control-rounding-segment": "0.5rem",
3054
+ "--radius-segmented-control-rounding-segmented-control": "0.625rem",
3055
+ ...layoutPair("button-height-default", "0.4375rem"),
3056
+ ...layoutPair("button-height-small", "0.3125rem"),
3057
+ ...layoutPair("button-side-default", "1rem"),
3058
+ ...layoutPair("button-side-small", "0.75rem")
3059
+ }
3060
+ }
3061
+ }, {
3062
+ id: "compact",
3063
+ label: "Compact",
3064
+ description: "Keeps your colors and fonts. 36px default and 28px small controls, padding and gaps at ×0.75.",
3065
+ edits: (defaults) => ({
3066
+ light: {},
3067
+ dark: {},
3068
+ theme: {
3069
+ ...layoutScales.Spacing.scale(defaults, spacingLevels.findIndex(({ factor }) => factor === .75)),
3070
+ ...layoutPair("button-height-default", "0.4375rem"),
3071
+ ...layoutPair("button-height-small", "0.1875rem")
3072
+ }
3073
+ })
3074
+ }];
3075
+ /**
3076
+ * A preset's edits for this theme: tokens the theme does not define are skipped, and values equal to the theme's own
3077
+ * are left out, so the result reads like edits made by hand.
3078
+ */
3079
+ function presetEdits(preset, defaults) {
3080
+ const edits = emptyTheme();
3081
+ const values = typeof preset.edits === "function" ? preset.edits(defaults) : preset.edits;
3082
+ for (const bucket of [
3083
+ "light",
3084
+ "dark",
3085
+ "theme"
3086
+ ]) for (const [name, value] of Object.entries(values[bucket])) if (name in defaults[bucket] && defaults[bucket][name] !== value) edits[bucket][name] = value;
3087
+ return edits;
3088
+ }
3089
+ /** Whether the current edits are exactly this preset applied to the theme. */
3090
+ function isPresetActive(preset, defaults, current) {
3091
+ const expected = presetEdits(preset, defaults);
3092
+ return [
3093
+ "light",
3094
+ "dark",
3095
+ "theme"
3096
+ ].every((bucket) => {
3097
+ const [a, b] = [expected[bucket], current[bucket]];
3098
+ return Object.keys(a).length === Object.keys(b).length && Object.entries(a).every(([name, value]) => b[name] === value);
3099
+ });
3100
+ }
3101
+ //#endregion
3102
+ //#region src/configurator/ShadesGenerator.tsx
3103
+ /**
3104
+ * Generates a whole base palette scale from one color, which becomes its 500 step.
3105
+ */
3106
+ function ShadesGenerator(t0) {
3107
+ const $ = c(52);
3108
+ const { title, steps, initial, onApply } = t0;
3109
+ let t1;
3110
+ if ($[0] !== initial) {
3111
+ t1 = isRgb(initial) ? toHex(initial).slice(1).toUpperCase() : "";
3112
+ $[0] = initial;
3113
+ $[1] = t1;
3114
+ } else t1 = $[1];
3115
+ const [text, setText] = useState(t1);
3116
+ let base;
3117
+ let pending;
3118
+ let shades;
3119
+ let t10;
3120
+ let t2;
3121
+ let t3;
3122
+ let t4;
3123
+ let t5;
3124
+ let t6;
3125
+ let t7;
3126
+ let t8;
3127
+ let t9;
3128
+ if ($[2] !== initial || $[3] !== steps || $[4] !== text || $[5] !== title) {
3129
+ const hex = text.trim().replace(/^#/, "");
3130
+ base = /^[0-9a-f]{6}$/i.test(hex) ? toRgb(`#${hex}`) : /^[0-9a-f]{3}$/i.test(hex) ? toRgb(`#${hex.replace(/./g, "$&$&")}`) : null;
3131
+ shades = base ? generateShades(base, steps.map(_temp)) : null;
3132
+ pending = !!shades && base !== initial;
3133
+ t8 = "studio-shades";
3134
+ t9 = "group";
3135
+ t10 = `Generate ${title} shades`;
3136
+ t5 = "studio-shades-input";
3137
+ const t11 = `shades-${title}`;
3138
+ if ($[18] !== t11) {
3139
+ t6 = /* @__PURE__ */ jsx("label", {
3140
+ htmlFor: t11,
3141
+ children: "Base color (500)"
3142
+ });
3143
+ $[18] = t11;
3144
+ $[19] = t6;
3145
+ } else t6 = $[19];
3146
+ let t12;
3147
+ if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
3148
+ t12 = /* @__PURE__ */ jsx("span", {
3149
+ "aria-hidden": "true",
3150
+ children: "#"
3151
+ });
3152
+ $[20] = t12;
3153
+ } else t12 = $[20];
3154
+ const t13 = `shades-${title}`;
3155
+ const t14 = !base;
3156
+ let t15;
3157
+ if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
3158
+ t15 = (event) => setText(event.target.value.replace(/^#/, ""));
3159
+ $[21] = t15;
3160
+ } else t15 = $[21];
3161
+ if ($[22] !== t13 || $[23] !== t14 || $[24] !== text) {
3162
+ t7 = /* @__PURE__ */ jsxs("span", {
3163
+ className: "studio-token-input",
3164
+ children: [t12, /* @__PURE__ */ jsx("input", {
3165
+ id: t13,
3166
+ value: text,
3167
+ "aria-invalid": t14,
3168
+ spellCheck: false,
3169
+ onChange: t15
3170
+ })]
3171
+ });
3172
+ $[22] = t13;
3173
+ $[23] = t14;
3174
+ $[24] = text;
3175
+ $[25] = t7;
3176
+ } else t7 = $[25];
3177
+ t2 = "color";
3178
+ t3 = "Pick base color";
3179
+ t4 = base ? toHex(base) : "#000000";
3180
+ $[2] = initial;
3181
+ $[3] = steps;
3182
+ $[4] = text;
3183
+ $[5] = title;
3184
+ $[6] = base;
3185
+ $[7] = pending;
3186
+ $[8] = shades;
3187
+ $[9] = t10;
3188
+ $[10] = t2;
3189
+ $[11] = t3;
3190
+ $[12] = t4;
3191
+ $[13] = t5;
3192
+ $[14] = t6;
3193
+ $[15] = t7;
3194
+ $[16] = t8;
3195
+ $[17] = t9;
3196
+ } else {
3197
+ base = $[6];
3198
+ pending = $[7];
3199
+ shades = $[8];
3200
+ t10 = $[9];
3201
+ t2 = $[10];
3202
+ t3 = $[11];
3203
+ t4 = $[12];
3204
+ t5 = $[13];
3205
+ t6 = $[14];
3206
+ t7 = $[15];
3207
+ t8 = $[16];
3208
+ t9 = $[17];
3209
+ }
3210
+ let t11;
3211
+ if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
3212
+ t11 = (event_0) => setText(event_0.target.value.slice(1).toUpperCase());
3213
+ $[26] = t11;
3214
+ } else t11 = $[26];
3215
+ let t12;
3216
+ if ($[27] !== t2 || $[28] !== t3 || $[29] !== t4) {
3217
+ t12 = /* @__PURE__ */ jsx("input", {
3218
+ type: t2,
3219
+ "aria-label": t3,
3220
+ value: t4,
3221
+ onChange: t11
3222
+ });
3223
+ $[27] = t2;
3224
+ $[28] = t3;
3225
+ $[29] = t4;
3226
+ $[30] = t12;
3227
+ } else t12 = $[30];
3228
+ const t13 = !pending;
3229
+ let t14;
3230
+ if ($[31] !== onApply || $[32] !== shades || $[33] !== steps) {
3231
+ t14 = () => {
3232
+ if (shades) onApply(Object.fromEntries(steps.map((t15) => {
3233
+ const { name, step: step_0 } = t15;
3234
+ return [name, shades[step_0]];
3235
+ })));
3236
+ };
3237
+ $[31] = onApply;
3238
+ $[32] = shades;
3239
+ $[33] = steps;
3240
+ $[34] = t14;
3241
+ } else t14 = $[34];
3242
+ let t15;
3243
+ if ($[35] !== t13 || $[36] !== t14) {
3244
+ t15 = /* @__PURE__ */ jsx("div", {
3245
+ className: "studio-shades-actions",
3246
+ children: /* @__PURE__ */ jsx("button", {
3247
+ type: "button",
3248
+ className: "studio-primary",
3249
+ disabled: t13,
3250
+ onClick: t14,
3251
+ children: "Change shades"
3252
+ })
3253
+ });
3254
+ $[35] = t13;
3255
+ $[36] = t14;
3256
+ $[37] = t15;
3257
+ } else t15 = $[37];
3258
+ let t16;
3259
+ if ($[38] !== t12 || $[39] !== t15 || $[40] !== t5 || $[41] !== t6 || $[42] !== t7) {
3260
+ t16 = /* @__PURE__ */ jsxs("div", {
3261
+ className: t5,
3262
+ children: [
3263
+ t6,
3264
+ t7,
3265
+ t12,
3266
+ t15
3267
+ ]
3268
+ });
3269
+ $[38] = t12;
3270
+ $[39] = t15;
3271
+ $[40] = t5;
3272
+ $[41] = t6;
3273
+ $[42] = t7;
3274
+ $[43] = t16;
3275
+ } else t16 = $[43];
3276
+ let t17;
3277
+ if ($[44] !== base) {
3278
+ t17 = !base && /* @__PURE__ */ jsx("p", {
3279
+ className: "studio-error",
3280
+ children: "Enter a hex color such as #75ACFF."
3281
+ });
3282
+ $[44] = base;
3283
+ $[45] = t17;
3284
+ } else t17 = $[45];
3285
+ let t18;
3286
+ if ($[46] !== t10 || $[47] !== t16 || $[48] !== t17 || $[49] !== t8 || $[50] !== t9) {
3287
+ t18 = /* @__PURE__ */ jsxs("div", {
3288
+ className: t8,
3289
+ role: t9,
3290
+ "aria-label": t10,
3291
+ children: [t16, t17]
3292
+ });
3293
+ $[46] = t10;
3294
+ $[47] = t16;
3295
+ $[48] = t17;
3296
+ $[49] = t8;
3297
+ $[50] = t9;
3298
+ $[51] = t18;
3299
+ } else t18 = $[51];
3300
+ return t18;
3301
+ }
3302
+ function _temp(t0) {
3303
+ const { step } = t0;
3304
+ return step;
3305
+ }
3306
+ //#endregion
3307
+ //#region src/configurator/UIConfigurator.tsx
3308
+ const colorNamespaces = {
3309
+ surface: "Surfaces",
3310
+ border: "Borders",
3311
+ interactive: "Interactive",
3312
+ support: "Support",
3313
+ states: "States",
3314
+ shadow: "Shadows"
3315
+ };
3316
+ const componentNamespaces = [
3317
+ ["floating-label-input", "Floating label inputs"],
3318
+ ["file-upload", "File upload"],
3319
+ ["segmented-control", "Segmented controls"],
3320
+ ["global", "Global"],
3321
+ ["button", "Buttons"],
3322
+ ["input", "Inputs"],
3323
+ ["list", "Lists"],
3324
+ ["modal", "Modals"],
3325
+ ["toast", "Toasts"],
3326
+ ["tooltip", "Tooltips"],
3327
+ ["avatar", "Avatars"],
3328
+ ["table", "Tables"],
3329
+ ["alert", "Alerts"],
3330
+ ["badge", "Badges"],
3331
+ ["pill", "Pills"],
3332
+ ["progress", "Progress"],
3333
+ ["slider", "Sliders"],
3334
+ ["stepper", "Steppers"],
3335
+ ["accordion", "Accordions"],
3336
+ ["breadcrumbs", "Breadcrumbs"],
3337
+ ["pagination", "Pagination"],
3338
+ ["icons", "Icons"],
3339
+ ["icon", "Icons"]
3340
+ ];
3341
+ function componentToken(name) {
3342
+ const token = name.replace(/^--(?:spacing|radius|container)-/, "");
3343
+ const namespace = componentNamespaces.find(([prefix]) => token === prefix || token.startsWith(`${prefix}-`));
3344
+ return {
3345
+ title: namespace?.[1] ?? "Base scale",
3346
+ label: (namespace ? token.slice(namespace[0].length + 1) : token).replace(/(?:^|-)rounding-/g, "-").replace(/^-/, "").replaceAll("-", " ")
3347
+ };
3348
+ }
3349
+ function effectToken(name) {
3350
+ const namespace = [
3351
+ ["--drop-shadow-", "Drop shadows"],
3352
+ ["--shadow-", "Shadows"],
3353
+ ["--blur-", "Blur"]
3354
+ ].find(([prefix]) => name.startsWith(prefix));
3355
+ const label = namespace ? name.slice(namespace[0].length).replaceAll("-", " ") : labelFor(name);
3356
+ return {
3357
+ title: namespace?.[1] ?? "Other effects",
3358
+ label: /^\d+$/.test(label) ? `Level ${label}` : label
3359
+ };
3360
+ }
3361
+ const textStylesTab = "Text styles";
3362
+ /** Text styles share a tab; font families, weights and letter spacing each get their own. */
3363
+ const typographyTabFor = (groupKey) => groupKey.startsWith("--text-") ? textStylesTab : groupKey;
3364
+ const baseSystemTab = "Base system";
3365
+ const semanticPaletteTab = "Semantic palette";
3366
+ /** Radius, spacing and sizing share one Layout tab, with a sub-tab each. */
3367
+ const navSections = [
3368
+ "Colors",
3369
+ "Typography",
3370
+ "Layout",
3371
+ "Effects"
3372
+ ];
3373
+ const isLayoutKind = (section) => layoutKinds.includes(section);
3374
+ /** The editor section that lists a token; font sizes open in Typography, their home section. */
3375
+ function sectionFor(name) {
3376
+ const kind = layoutKindFor(name);
3377
+ return kind && kind !== "Font size" ? kind : groupFor(name);
3378
+ }
3379
+ /** Presets, component defaults, CVA overrides and export share one Advanced tab, with a sub-tab each. */
3380
+ const advancedSections = [
3381
+ ["Presets", "Presets"],
3382
+ ["Components", "Defaults & behavior"],
3383
+ ["Variants & overrides", "Variants & overrides"],
3384
+ ["Export", "Export"]
3385
+ ];
3386
+ const isAdvancedSection = (section) => advancedSections.some(([key]) => key === section);
3387
+ /** The app's own theme, so a preset can be undone without resetting component settings. */
3388
+ const appThemePreset = {
3389
+ id: "app",
3390
+ label: "App theme",
3391
+ description: "The theme defined in this app's theme.css, without edits.",
3392
+ edits: {
3393
+ light: {},
3394
+ dark: {},
3395
+ theme: {}
3396
+ }
3397
+ };
3398
+ /** Sections that list theme tokens; Font size lists the Typography font sizes again under Layout. */
3399
+ const isTokenSection = (section) => groups.includes(section) || isLayoutKind(section);
3400
+ /** The editor group a token is listed under within its section. */
3401
+ function groupKeyFor(section, name, defaults) {
3402
+ const textStyle = section === "Typography" ? name.match(/^--text-(.+?)(?:--.+)?$/)?.[1] : void 0;
3403
+ return textStyle ? `--text-${textStyle}` : section === "Typography" ? name.startsWith("--font-weight-") ? "Font weights" : name.startsWith("--font-") ? "Font families" : "Letter spacing" : section === "Colors" ? baseColorNames(defaults).has(name) ? `Base system · ${name.slice(2).split("-")[0]}` : colorNamespaces[name.slice(2).split("-")[0]] ?? "Other" : section === "Spacing" || section === "Radius" || section === "Sizing" ? componentToken(name).title : section === "Effects" ? effectToken(name).title : "tokens";
3404
+ }
3405
+ const ComponentGallery = lazy(() => import("../ComponentGallery-BWiPGUL8.js"));
3406
+ function ComponentPreview(t0) {
3407
+ const $ = c(14);
3408
+ const { value, mode, inspector } = t0;
3409
+ const { defaults } = useUIConfiguration();
3410
+ const t1 = value.config;
3411
+ const t2 = `studio-sample ${mode}`;
3412
+ let t3;
3413
+ if ($[0] !== defaults || $[1] !== mode || $[2] !== value.theme) {
3414
+ t3 = previewTokens(defaults, value.theme, mode);
3415
+ $[0] = defaults;
3416
+ $[1] = mode;
3417
+ $[2] = value.theme;
3418
+ $[3] = t3;
3419
+ } else t3 = $[3];
3420
+ const t4 = t3;
3421
+ let t5;
3422
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
3423
+ t5 = /* @__PURE__ */ jsx("p", {
3424
+ className: "studio-gallery-loading",
3425
+ children: "Loading components…"
3426
+ });
3427
+ $[4] = t5;
3428
+ } else t5 = $[4];
3429
+ let t6;
3430
+ if ($[5] !== inspector) {
3431
+ t6 = /* @__PURE__ */ jsx(Suspense, {
3432
+ fallback: t5,
3433
+ children: /* @__PURE__ */ jsx(ComponentGallery, { inspector })
3434
+ });
3435
+ $[5] = inspector;
3436
+ $[6] = t6;
3437
+ } else t6 = $[6];
3438
+ let t7;
3439
+ if ($[7] !== t2 || $[8] !== t4 || $[9] !== t6) {
3440
+ t7 = /* @__PURE__ */ jsx("div", {
3441
+ className: t2,
3442
+ style: t4,
3443
+ "data-testid": "component-preview",
3444
+ children: t6
3445
+ });
3446
+ $[7] = t2;
3447
+ $[8] = t4;
3448
+ $[9] = t6;
3449
+ $[10] = t7;
3450
+ } else t7 = $[10];
3451
+ let t8;
3452
+ if ($[11] !== t7 || $[12] !== value.config) {
3453
+ t8 = /* @__PURE__ */ jsx(UIConfig.Provider, {
3454
+ config: t1,
3455
+ children: t7
3456
+ });
3457
+ $[11] = t7;
3458
+ $[12] = value.config;
3459
+ $[13] = t8;
3460
+ } else t8 = $[13];
3461
+ return t8;
3462
+ }
3463
+ /** Changing a text style's font size sets its line height to this multiple of it; the line height stays editable. */
3464
+ const fontSizeLineHeight = "1.5";
3465
+ const remPresets = [
3466
+ 0,
3467
+ .0625,
3468
+ .125,
3469
+ .1875,
3470
+ .25,
3471
+ .375,
3472
+ .5,
3473
+ .625,
3474
+ .75,
3475
+ .875,
3476
+ 1,
3477
+ 1.25,
3478
+ 1.5,
3479
+ 2,
3480
+ 2.5,
3481
+ 3,
3482
+ 4,
3483
+ 5,
3484
+ 6
3485
+ ];
3486
+ function TokenField({ name, value, original, changed, onChange, onReset, onValidity, invalidValue, compactLabel, sizeUnit, fontSize, highlighted, paletteOptions, aliasOptions }) {
3487
+ const [text, setText] = useState(invalidValue ?? value);
3488
+ const [invalid, setInvalid] = useState(invalidValue !== void 0);
3489
+ const [editingText, setEditingText] = useState(null);
3490
+ const [customPaletteValue, setCustomPaletteValue] = useState(invalidValue !== void 0);
3491
+ const [syncedValue, setSyncedValue] = useState(value);
3492
+ if (value !== syncedValue) {
3493
+ setSyncedValue(value);
3494
+ if (!invalid) setText(value);
3495
+ }
3496
+ const hasSizePresets = /^-?(?:\d*\.)?\d+(?:rem|px)$/.test(original) || !!aliasOptions?.length;
3497
+ const literalSize = hasSizePresets ? text.trim().match(/^(-?(?:\d*\.)?\d+)(rem|px)$/) : null;
3498
+ const rootFontSize = typeof document === "undefined" ? 16 : parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;
3499
+ const storedUnit = original.endsWith("px") ? "px" : "rem";
3500
+ const toStoredUnit = (amount, unit) => `${Number((unit === storedUnit ? amount : unit === "px" ? amount / rootFontSize : amount * rootFontSize).toFixed(6))}${storedUnit}`;
3501
+ const fontSizePx = fontSize?.trim().match(/^(-?(?:\d*\.)?\d+)(rem|px)$/);
3502
+ const fontPx = fontSizePx ? Number(fontSizePx[1]) * (fontSizePx[2] === "rem" ? rootFontSize : 1) : 0;
3503
+ const relativeSuffix = name.endsWith("--line-height") ? "" : name.endsWith("--letter-spacing") ? "em" : null;
3504
+ const relativeSize = sizeUnit === "px" && fontPx && relativeSuffix !== null ? text.trim().match(new RegExp(`^(-?(?:\\d*\\.)?\\d+)${relativeSuffix}$`)) : null;
3505
+ const displayedSize = literalSize ? `${Number((Number(literalSize[1]) * (literalSize[2] === sizeUnit ? 1 : sizeUnit === "px" ? rootFontSize : 1 / rootFontSize)).toFixed(6))}` : relativeSize ? `${Number((Number(relativeSize[1]) * fontPx).toFixed(2))}` : text;
3506
+ const alias = aliasOptions?.find((option) => text.trim() === `var(${option.name})`);
3507
+ const inUnit = (size) => {
3508
+ const match = size.trim().match(/^(-?(?:\d*\.)?\d+)(rem|px)$/);
3509
+ if (!match) return size;
3510
+ const amount_0 = Number(match[1]) * (match[2] === sizeUnit ? 1 : sizeUnit === "px" ? rootFontSize : 1 / rootFontSize);
3511
+ return `${Number(amount_0.toFixed(4))}${sizeUnit}`;
3512
+ };
3513
+ const rgb = isRgb(original);
3514
+ const displayed = alias ? alias.label : rgb && !invalid && isRgb(text) ? toHex(text).toUpperCase() : displayedSize;
3515
+ const showsUnit = literalSize || relativeSize || alias;
3516
+ const color = rgb || /^#[0-9a-f]{6}$/i.test(original);
3517
+ const alphaColor = isAlphaHex(original) && isAlphaHex(text);
3518
+ const paletteAlias = !!paletteOptions?.length && /^var\(--[\w-]+\)$/.test(original);
3519
+ const selectedPalette = text.match(/^var\((--[\w-]+)\)$/)?.[1];
3520
+ const selectedOption = paletteOptions?.find((option_0) => option_0.name === selectedPalette);
3521
+ const showCustomValue = !paletteAlias || customPaletteValue || !selectedOption;
3522
+ const update = (next) => {
3523
+ setText(next);
3524
+ if (paletteAlias) setCustomPaletteValue(!paletteOptions?.some((option_1) => `var(${option_1.name})` === next));
3525
+ const valid = validToken(name, next, original);
3526
+ setInvalid(!valid);
3527
+ onValidity(name, !valid, next);
3528
+ if (valid) onChange(next);
3529
+ };
3530
+ return /* @__PURE__ */ jsxs("div", {
3531
+ className: `studio-token ${changed ? "is-changed" : ""} ${highlighted ? "is-highlighted" : ""}`,
3532
+ children: [
3533
+ /* @__PURE__ */ jsx("label", {
3534
+ htmlFor: paletteAlias && !showCustomValue ? `palette-${name}` : `token-${name}`,
3535
+ children: /* @__PURE__ */ jsx("span", { children: compactLabel ?? labelFor(name) })
3536
+ }),
3537
+ /* @__PURE__ */ jsxs("div", {
3538
+ className: "studio-token-value",
3539
+ children: [
3540
+ color && /* @__PURE__ */ jsx("input", {
3541
+ "aria-label": `Pick ${labelFor(name)}`,
3542
+ type: "color",
3543
+ value: rgb ? toHex(value) : value,
3544
+ onChange: (event) => update(rgb ? toRgb(event.target.value) : event.target.value)
3545
+ }),
3546
+ paletteAlias && /* @__PURE__ */ jsx(PaletteSelect, {
3547
+ id: `palette-${name}`,
3548
+ label: `Base color for ${labelFor(name)}`,
3549
+ options: paletteOptions,
3550
+ selected: showCustomValue ? "custom" : selectedOption.name,
3551
+ onSelect: (key) => {
3552
+ if (key === "custom") setCustomPaletteValue(true);
3553
+ else update(`var(${key})`);
3554
+ }
3555
+ }),
3556
+ alphaColor && /* @__PURE__ */ jsx(AlphaColorField, {
3557
+ name,
3558
+ label: labelFor(name),
3559
+ value: text,
3560
+ onChange: update
3561
+ }),
3562
+ showCustomValue && !alphaColor && /* @__PURE__ */ jsxs("span", {
3563
+ className: "studio-token-input",
3564
+ tabIndex: -1,
3565
+ children: [/* @__PURE__ */ jsx("input", {
3566
+ id: `token-${name}`,
3567
+ "aria-label": compactLabel ? labelFor(name) : void 0,
3568
+ value: editingText ?? displayed,
3569
+ "aria-invalid": invalid,
3570
+ "aria-describedby": [invalid ? `error-${name}` : "", showsUnit ? `unit-${name}` : ""].filter(Boolean).join(" ") || void 0,
3571
+ onChange: (event_0) => setEditingText(event_0.target.value),
3572
+ onKeyDown: (event_1) => {
3573
+ if (event_1.key === "Enter" && !event_1.nativeEvent.isComposing) {
3574
+ event_1.preventDefault();
3575
+ event_1.currentTarget.parentElement?.focus();
3576
+ }
3577
+ },
3578
+ onBlur: () => {
3579
+ if (editingText === null) return;
3580
+ const entered = editingText.trim();
3581
+ setEditingText(null);
3582
+ if (alias && entered === alias.label) return;
3583
+ const hex = rgb ? entered.match(/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i)?.[1] : void 0;
3584
+ if (hex) {
3585
+ update(toRgb(`#${hex.length === 3 ? hex.replace(/./g, "$&$&") : hex}`));
3586
+ return;
3587
+ }
3588
+ const bare = /^-?(?:\d*\.)?\d+$/.test(entered);
3589
+ update(hasSizePresets && bare ? toStoredUnit(Number(entered), sizeUnit) : relativeSize && bare ? `${Number((Number(entered) / fontPx).toFixed(4))}${relativeSuffix}` : entered);
3590
+ },
3591
+ spellCheck: false
3592
+ }), showsUnit && /* @__PURE__ */ jsx("span", {
3593
+ className: "studio-token-unit",
3594
+ id: `unit-${name}`,
3595
+ children: alias ? inUnit(alias.value) : sizeUnit
3596
+ })]
3597
+ }),
3598
+ hasSizePresets && /* @__PURE__ */ jsxs("select", {
3599
+ className: "studio-size-presets",
3600
+ "aria-label": `Standard sizes for ${labelFor(name)}`,
3601
+ title: "Choose a standard size",
3602
+ value: "",
3603
+ onChange: (event_2) => update(event_2.target.value.startsWith("var(") ? event_2.target.value : toStoredUnit(parseFloat(event_2.target.value), "rem")),
3604
+ children: [
3605
+ /* @__PURE__ */ jsx("option", {
3606
+ value: "",
3607
+ disabled: true,
3608
+ children: "Choose a size"
3609
+ }),
3610
+ !!aliasOptions?.length && /* @__PURE__ */ jsx("optgroup", {
3611
+ label: "Global tokens",
3612
+ children: aliasOptions.map((option_2) => /* @__PURE__ */ jsx("option", {
3613
+ value: `var(${option_2.name})`,
3614
+ children: `${option_2.label} · ${inUnit(option_2.value)}`
3615
+ }, option_2.name))
3616
+ }),
3617
+ /* @__PURE__ */ jsx("optgroup", {
3618
+ label: "Standard sizes",
3619
+ children: remPresets.map((rem) => /* @__PURE__ */ jsx("option", {
3620
+ value: `${rem}rem`,
3621
+ children: `${Number((rem * rootFontSize).toFixed(2))}px · ${rem}rem${name.startsWith("--spacing-") ? ` · spacing ${rem * 4}` : ""}`
3622
+ }, rem))
3623
+ })
3624
+ ]
3625
+ }),
3626
+ /* @__PURE__ */ jsx("button", {
3627
+ type: "button",
3628
+ "aria-label": `Reset ${labelFor(name)}`,
3629
+ disabled: !changed && !invalid,
3630
+ onClick: () => {
3631
+ setText(original);
3632
+ setInvalid(false);
3633
+ setCustomPaletteValue(false);
3634
+ onValidity(name, false);
3635
+ onReset();
3636
+ },
3637
+ children: /* @__PURE__ */ jsx(RotateCcw, { size: 13 })
3638
+ })
3639
+ ]
3640
+ }),
3641
+ invalid && /* @__PURE__ */ jsx("small", {
3642
+ id: `error-${name}`,
3643
+ className: "studio-error",
3644
+ children: rgb ? "Use a hex color such as #1A2B3C, or three RGB values from 0 to 255." : "Enter a valid CSS value, including units where needed."
3645
+ })
3646
+ ]
3647
+ });
3648
+ }
3649
+ function ConfigurationModalContent({ memory }) {
3650
+ const inherited = UIConfig.useConfig();
3651
+ const { defaults, draft, setDraft, isOpen, cancel, apply, revision } = useUIConfiguration();
3652
+ const remembered = memory.current;
3653
+ const [mode, setMode] = useState(remembered.mode ?? "light");
3654
+ const [sizeUnit, setSizeUnit] = useState(remembered.sizeUnit ?? "px");
3655
+ const [loadedFonts, refreshLoadedFonts] = useLoadedFonts();
3656
+ const [editorWidth, setEditorWidth] = useState(remembered.editorWidth);
3657
+ const [confirmingReset, setConfirmingReset] = useState(false);
3658
+ const [nothingToReset, setNothingToReset] = useState(false);
3659
+ const bodyRef = useRef(null);
3660
+ const [cvaVariants, setCvaVariants] = useState({});
3661
+ const [cvaSlot, setCvaSlot] = useState(remembered.cvaSlot ?? "button.cva");
3662
+ const [section, setSection] = useState(remembered.section ?? "Colors");
3663
+ const [previewMode, setPreviewMode] = useState(remembered.previewMode ?? "gallery");
3664
+ const [search, setSearch] = useState("");
3665
+ const [expandedGroups, setExpandedGroups] = useState(remembered.expandedGroups ?? {});
3666
+ const [sectionTabs, setSectionTabs] = useState(remembered.sectionTabs ?? {});
3667
+ const [resetRevision, setResetRevision] = useState(0);
3668
+ const [invalidFields, setInvalidFields] = useState({});
3669
+ const [message, setMessage] = useState("");
3670
+ const [themeWriter, setThemeWriter] = useState(null);
3671
+ const [savingTheme, setSavingTheme] = useState(false);
3672
+ useEffect(() => {
3673
+ setThemeWriter(getThemeWriter());
3674
+ }, []);
3675
+ const [exportTab, setExportTab] = useState(remembered.exportTab ?? "css");
3676
+ const editorRef = useRef(null);
3677
+ const previewRef = useRef(null);
3678
+ useEffect(() => {
3679
+ Object.assign(memory.current, {
3680
+ section,
3681
+ sectionTabs,
3682
+ expandedGroups,
3683
+ mode,
3684
+ cvaSlot,
3685
+ previewMode,
3686
+ exportTab,
3687
+ editorWidth,
3688
+ sizeUnit
3689
+ });
3690
+ }, [
3691
+ memory,
3692
+ section,
3693
+ sectionTabs,
3694
+ expandedGroups,
3695
+ mode,
3696
+ cvaSlot,
3697
+ previewMode,
3698
+ exportTab,
3699
+ editorWidth,
3700
+ sizeUnit
3701
+ ]);
3702
+ useLayoutEffect(() => {
3703
+ const frame = requestAnimationFrame(() => {
3704
+ editorRef.current?.scrollTo({ top: memory.current.editorScroll ?? 0 });
3705
+ previewRef.current?.scrollTo({ top: memory.current.previewScroll ?? 0 });
3706
+ });
3707
+ return () => cancelAnimationFrame(frame);
3708
+ }, [memory]);
3709
+ const exportRef = useRef(null);
3710
+ const changedCount = Object.keys(draft.overrides ?? {}).length + Object.values(draft.theme).reduce((count, tokens) => count + Object.keys(tokens).length, 0) + Object.values(draft.config).reduce((count_0, value) => count_0 + (typeof value === "object" && value !== null ? Object.keys(value).length : 1), 0);
3711
+ const config = inherited;
3712
+ const exportText = exportTab === "css" ? exportCss(draft.theme, defaults) : exportTab === "overrides" ? exportCvaEdits(draft.overrides) : `import { UIConfig } from "@povio/ui/ui-config";\n\nconst config = ${JSON.stringify(draft.config, null, 2)} satisfies Partial<UIConfig.Options>;\n\n// Wrap your application:\n// <UIConfig.Provider config={config}>{children}</UIConfig.Provider>\n`;
3713
+ const changeSection = (next) => {
3714
+ if (isLayoutKind(next)) setSectionTabs((current) => ({
3715
+ ...current,
3716
+ Layout: next
3717
+ }));
3718
+ if (isAdvancedSection(next)) setSectionTabs((current_0) => ({
3719
+ ...current_0,
3720
+ Advanced: next
3721
+ }));
3722
+ setSection(next);
3723
+ setSearch("");
3724
+ setMessage("");
3725
+ setHighlightedToken(null);
3726
+ };
3727
+ const [highlightedToken, setHighlightedToken] = useState(null);
3728
+ const isInspectable = useCallback((name) => (name in defaults.theme || name in defaults.light || name in defaults.dark) && groups.includes(groupFor(name)) && !name.startsWith("--color-"), [defaults]);
3729
+ const describeToken = useCallback((name_0) => {
3730
+ const section_0 = sectionFor(name_0);
3731
+ const bucket = mode === "dark" && name_0 in defaults.dark ? "dark" : name_0 in defaults.light ? "light" : "theme";
3732
+ const value_0 = draft.theme[bucket][name_0] ?? defaults[bucket][name_0];
3733
+ return `${groupKeyFor(section_0, name_0, defaults)} · ${componentToken(name_0).label} · ${value_0}`;
3734
+ }, [
3735
+ defaults,
3736
+ draft,
3737
+ mode
3738
+ ]);
3739
+ /** Opens the editor on a token picked in the inspector: its section, its group, scrolled into view and highlighted. */
3740
+ const focusToken = useCallback((picked) => {
3741
+ const name_1 = listedLayoutToken(picked, defaults);
3742
+ const next_0 = sectionFor(name_1);
3743
+ if (isLayoutKind(next_0)) setSectionTabs((current_1) => ({
3744
+ ...current_1,
3745
+ Layout: next_0
3746
+ }));
3747
+ setSection(next_0);
3748
+ setSearch("");
3749
+ setMessage("");
3750
+ const key = groupKeyFor(next_0, name_1, defaults);
3751
+ setExpandedGroups((current_2) => ({
3752
+ ...current_2,
3753
+ [`${next_0}:${key}`]: true
3754
+ }));
3755
+ if (next_0 === "Typography") setSectionTabs((current_3) => ({
3756
+ ...current_3,
3757
+ Typography: typographyTabFor(key)
3758
+ }));
3759
+ if (next_0 === "Colors") setSectionTabs((current_4) => ({
3760
+ ...current_4,
3761
+ Colors: baseColorNames(defaults).has(name_1) ? baseSystemTab : semanticPaletteTab
3762
+ }));
3763
+ setHighlightedToken(name_1);
3764
+ }, [defaults]);
3765
+ useEffect(() => {
3766
+ if (!highlightedToken) return;
3767
+ const frame_0 = requestAnimationFrame(() => {
3768
+ (document.getElementById(`token-${highlightedToken}`)?.closest(".studio-token"))?.scrollIntoView({
3769
+ block: "center",
3770
+ behavior: "smooth"
3771
+ });
3772
+ });
3773
+ return () => cancelAnimationFrame(frame_0);
3774
+ }, [highlightedToken, section]);
3775
+ const validity = (name_2, invalid, value_1 = "") => setInvalidFields((current_5) => {
3776
+ const next_1 = { ...current_5 };
3777
+ if (invalid) next_1[name_2] = value_1;
3778
+ else delete next_1[name_2];
3779
+ return next_1;
3780
+ });
3781
+ const reset = () => {
3782
+ setDraft(emptyConfiguration());
3783
+ setInvalidFields({});
3784
+ setResetRevision((value_2) => value_2 + 1);
3785
+ setMessage("All settings reset to the application defaults.");
3786
+ };
3787
+ const setToken = (name_3, value_3) => {
3788
+ const bucket_0 = mode === "dark" && name_3 in defaults.dark ? "dark" : name_3 in defaults.light ? "light" : "theme";
3789
+ const linked = bucket_0 === "theme" && !value_3?.startsWith("var(") ? linkedLayoutTokens(name_3, defaults) : [];
3790
+ setDraft((current_6) => {
3791
+ const tokens_0 = { ...current_6.theme[bucket_0] };
3792
+ for (const token of [name_3, ...linked]) if (value_3 === void 0 || value_3 === defaults[bucket_0][token]) delete tokens_0[token];
3793
+ else tokens_0[token] = value_3;
3794
+ return {
3795
+ ...current_6,
3796
+ theme: {
3797
+ ...current_6.theme,
3798
+ [bucket_0]: tokens_0
3799
+ }
3800
+ };
3801
+ });
3802
+ };
3803
+ const setLayoutLevel = (kind, level) => setDraft((current_7) => {
3804
+ const tokens_1 = { ...current_7.theme.theme };
3805
+ for (const [name_4, value_4] of Object.entries(layoutScales[kind].scale(defaults, level))) if (value_4 === defaults.theme[name_4]) delete tokens_1[name_4];
3806
+ else tokens_1[name_4] = value_4;
3807
+ return {
3808
+ ...current_7,
3809
+ theme: {
3810
+ ...current_7.theme,
3811
+ theme: tokens_1
3812
+ }
3813
+ };
3814
+ });
3815
+ const applyPreset = (preset) => {
3816
+ setDraft((current_8) => ({
3817
+ ...current_8,
3818
+ theme: presetEdits(preset, defaults)
3819
+ }));
3820
+ setInvalidFields({});
3821
+ setResetRevision((value_5) => value_5 + 1);
3822
+ setMessage(`${preset.label} preset applied. Apply settings to keep it.`);
3823
+ };
3824
+ const setComponent = (key_0, field, value_6) => {
3825
+ setDraft((current_9) => ({
3826
+ ...current_9,
3827
+ config: {
3828
+ ...current_9.config,
3829
+ [key_0]: {
3830
+ ...current_9.config[key_0],
3831
+ [field]: value_6
3832
+ }
3833
+ }
3834
+ }));
3835
+ };
3836
+ const radiusAliasOptions = Object.keys(defaults.theme).filter((name_5) => name_5.startsWith("--radius-global-rounding-")).map((name_6) => ({
3837
+ name: name_6,
3838
+ label: `Global ${name_6.replace("--radius-global-rounding-", "").toUpperCase()}`,
3839
+ value: draft.theme.theme[name_6] ?? defaults.theme[name_6]
3840
+ }));
3841
+ const controlHeightAliasOptions = (name_7) => {
3842
+ const counterpart = controlHeightCounterpart(name_7);
3843
+ if (!counterpart || defaults.theme[name_7] !== `var(${counterpart})`) return void 0;
3844
+ return [{
3845
+ name: counterpart,
3846
+ label: `Button ${counterpart.replace(/^.*-height-/, "")}`,
3847
+ value: draft.theme.theme[counterpart] ?? defaults.theme[counterpart]
3848
+ }];
3849
+ };
3850
+ const palette = baseColorNames(defaults);
3851
+ const paletteOptions = [...palette].map((name_8) => ({
3852
+ name: name_8,
3853
+ value: draft.theme.light[name_8] ?? defaults.light[name_8]
3854
+ }));
3855
+ const sectionEntries = Object.entries({
3856
+ ...defaults.light,
3857
+ ...mode === "dark" ? defaults.dark : {},
3858
+ ...defaults.theme
3859
+ }).filter(([name_9]) => (section === "Font size" ? isFontSizeToken(name_9) : section === "Spacing" || section === "Sizing" ? layoutKindFor(name_9) === section && listedLayoutToken(name_9, defaults) === name_9 : groupFor(name_9) === section) && !name_9.startsWith("--color-"));
3860
+ const groupedEntries = /* @__PURE__ */ new Map();
3861
+ for (const entry of sectionEntries) {
3862
+ const [name_10] = entry;
3863
+ const textStyle = section === "Typography" ? name_10.match(/^--text-(.+?)(?:--.+)?$/)?.[1] : void 0;
3864
+ const key_1 = groupKeyFor(section, name_10, defaults);
3865
+ if (!groupedEntries.has(key_1)) groupedEntries.set(key_1, {
3866
+ title: textStyle ? textStyle.replaceAll("-", " ") : key_1 === "tokens" ? "" : key_1,
3867
+ compact: !!textStyle,
3868
+ entries: []
3869
+ });
3870
+ groupedEntries.get(key_1).entries.push(entry);
3871
+ }
3872
+ const paletteStep = (name_11) => Number(name_11.match(/-(\d+)-base$/)?.[1]);
3873
+ const isPaletteGroup = (entries) => entries.every(([name_12]) => palette.has(name_12));
3874
+ for (const group of groupedEntries.values()) if (isPaletteGroup(group.entries)) group.entries.sort(([left], [right]) => paletteStep(right) - paletteStep(left));
3875
+ const paletteValue = (name_13) => draft.theme.light[name_13] ?? defaults.light[name_13];
3876
+ const renderPaletteShades = (title, entries_0) => {
3877
+ const base = paletteValue((entries_0.find(([name_14]) => paletteStep(name_14) === 500) ?? entries_0[Math.floor(entries_0.length / 2)])[0]);
3878
+ return /* @__PURE__ */ jsx(ShadesGenerator, {
3879
+ title,
3880
+ steps: entries_0.map(([name_15]) => ({
3881
+ name: name_15,
3882
+ step: paletteStep(name_15)
3883
+ })),
3884
+ initial: base,
3885
+ onApply: (values) => {
3886
+ for (const [name_16, value_7] of Object.entries(values)) setToken(name_16, value_7);
3887
+ }
3888
+ }, base);
3889
+ };
3890
+ const tokenGroups = [...groupedEntries.entries()].filter(([key_2, group_0]) => `${key_2} ${group_0.title} ${group_0.entries.map(([name_17]) => `${name_17} ${labelFor(name_17)}`).join(" ")}`.toLowerCase().includes(search.toLowerCase().trim()));
3891
+ const visibleGroups = section === "Typography" ? tokenGroups : tokenGroups.map(([key_3, group_1]) => [key_3, {
3892
+ ...group_1,
3893
+ entries: group_1.entries.filter(([name_18]) => `${group_1.title} ${name_18} ${labelFor(name_18)}`.toLowerCase().includes(search.toLowerCase().trim()))
3894
+ }]).filter(([, group_2]) => group_2.entries.length);
3895
+ const groupRank = (key_4) => key_4 === "Global" ? -1 : key_4 === "Base scale" ? 1 : 0;
3896
+ const sectionKeys = [...groupedEntries.keys()].sort((a, b) => groupRank(a) - groupRank(b));
3897
+ const searching = !!search.trim();
3898
+ const tabFor = (key_5) => section === "Typography" ? typographyTabFor(key_5) : section === "Colors" ? isPaletteGroup(groupedEntries.get(key_5)?.entries ?? []) ? baseSystemTab : semanticPaletteTab : void 0;
3899
+ const sectionTabList = [...new Set(sectionKeys.map(tabFor))].filter((tab) => !!tab);
3900
+ const activeSectionTab = sectionTabList.includes(sectionTabs[section]) ? sectionTabs[section] : sectionTabList[0];
3901
+ const tabbed = sectionTabList.length > 1 && !searching;
3902
+ const inActiveTab = (key_6) => !tabbed || tabFor(key_6) === activeSectionTab;
3903
+ const flatTab = tabbed && section === "Typography" && activeSectionTab !== textStylesTab;
3904
+ const orderedGroups = [...visibleGroups].filter(([key_7]) => inActiveTab(key_7)).sort(([a_0], [b_0]) => groupRank(a_0) - groupRank(b_0));
3905
+ const collapsibleKeys = sectionKeys.filter(inActiveTab);
3906
+ const primaryGroup = collapsibleKeys[0];
3907
+ const isExpanded = (key_8) => searching || (expandedGroups[`${section}:${key_8}`] ?? key_8 === primaryGroup);
3908
+ const toggleGroup = (key_9) => setExpandedGroups((current_10) => ({
3909
+ ...current_10,
3910
+ [`${section}:${key_9}`]: !isExpanded(key_9)
3911
+ }));
3912
+ const allExpanded = collapsibleKeys.every(isExpanded);
3913
+ const setAllGroups = (expanded) => setExpandedGroups((current_11) => ({
3914
+ ...current_11,
3915
+ ...Object.fromEntries(collapsibleKeys.map((key_10) => [`${section}:${key_10}`, expanded]))
3916
+ }));
3917
+ const groupChanged = (entries_1) => entries_1.some(([name_19]) => {
3918
+ const bucket_1 = mode === "dark" && name_19 in defaults.dark ? "dark" : name_19 in defaults.light ? "light" : "theme";
3919
+ return name_19 in draft.theme[bucket_1];
3920
+ });
3921
+ /** The current font size of a text style's line height or letter spacing token. */
3922
+ const fontSizeFor = (name_20) => {
3923
+ const fontSizeName = name_20.match(/^(--text-.+?)--(?:line-height|letter-spacing)$/)?.[1];
3924
+ if (!fontSizeName) return void 0;
3925
+ const bucket_2 = mode === "dark" && fontSizeName in defaults.dark ? "dark" : fontSizeName in defaults.light ? "light" : "theme";
3926
+ return draft.theme[bucket_2][fontSizeName] ?? defaults[bucket_2][fontSizeName];
3927
+ };
3928
+ const renderToken = ([name_21, original], compact = false) => {
3929
+ const bucket_3 = mode === "dark" && name_21 in defaults.dark ? "dark" : name_21 in defaults.light ? "light" : "theme";
3930
+ const compactLabel = compact ? name_21.endsWith("--line-height") ? "Line height" : name_21.endsWith("--letter-spacing") ? "Letter spacing" : "Font size" : section === "Colors" ? palette.has(name_21) ? labelFor(name_21).split(" ").slice(1).join(" ") : labelFor(name_21).replace(/^(surface|border|interactive|support|states|shadow) /, "") : section === "Spacing" || section === "Radius" || section === "Sizing" ? componentToken(name_21).label : section === "Font size" ? name_21.replace(/^--text-/, "").replaceAll("-", " ") : section === "Effects" ? effectToken(name_21).label : void 0;
3931
+ return /* @__PURE__ */ jsx(TokenField, {
3932
+ name: name_21,
3933
+ original,
3934
+ compactLabel,
3935
+ sizeUnit,
3936
+ fontSize: fontSizeFor(name_21),
3937
+ highlighted: highlightedToken === name_21,
3938
+ paletteOptions: section === "Colors" && /^var\(--[\w-]+\)$/.test(original) ? paletteOptions : void 0,
3939
+ aliasOptions: section === "Radius" && !name_21.startsWith("--radius-global-") && componentToken(name_21).title !== "Base scale" ? radiusAliasOptions : controlHeightAliasOptions(name_21),
3940
+ value: draft.theme[bucket_3][name_21] ?? original,
3941
+ changed: name_21 in draft.theme[bucket_3],
3942
+ onChange: (value_8) => {
3943
+ setToken(name_21, value_8);
3944
+ const lineHeight = `${name_21}--line-height`;
3945
+ if (/^--text-[\w-]+$/.test(name_21) && !name_21.includes("--", 2) && (lineHeight in defaults.theme || lineHeight in defaults.light)) setToken(lineHeight, fontSizeLineHeight);
3946
+ },
3947
+ onReset: () => setToken(name_21),
3948
+ invalidValue: invalidFields[`${bucket_3}:${name_21}`],
3949
+ onValidity: (field_0, invalid_0, value_9) => validity(`${bucket_3}:${field_0}`, invalid_0, value_9)
3950
+ }, `${revision}-${resetRevision}-${mode}-${name_21}`);
3951
+ };
3952
+ const layoutSection = isLayoutKind(section) ? section : void 0;
3953
+ const advancedSection = isAdvancedSection(section) ? section : void 0;
3954
+ const lastLayoutSection = isLayoutKind(sectionTabs.Layout ?? "") ? sectionTabs.Layout : layoutKinds[0];
3955
+ /**
3956
+ * Font roles (heading, body) lead as picker cards; the families they choose from follow below a divider. A family
3957
+ * token points at its own `-base` font (`--font-inter` → `--font-inter-base`); any other font token is a role.
3958
+ */
3959
+ const renderFontFamilies = (entries_2) => {
3960
+ const isFamily = ([name_22, value_10]) => value_10.includes(`var(${name_22}-base)`);
3961
+ const families = entries_2.filter(isFamily);
3962
+ const roles = entries_2.filter((entry_0) => !isFamily(entry_0));
3963
+ const themeFonts = families.map(([name_23]) => ({
3964
+ name: name_23,
3965
+ label: familyName(name_23.replace(/^--font-/, "")),
3966
+ value: draft.theme.theme[name_23] ?? defaults.theme[name_23],
3967
+ group: "Theme fonts"
3968
+ }));
3969
+ const options = [
3970
+ ...themeFonts,
3971
+ ...loadedFonts.filter((font) => !themeFonts.some(({ value: value_11 }) => value_11 === font.value)),
3972
+ ...systemFonts
3973
+ ];
3974
+ const roleLabels = {
3975
+ "--font-titles": "Heading",
3976
+ "--font-body": "Body"
3977
+ };
3978
+ return /* @__PURE__ */ jsxs("div", {
3979
+ className: "studio-font-families",
3980
+ children: [
3981
+ /* @__PURE__ */ jsx("div", {
3982
+ className: "studio-font-roles",
3983
+ children: roles.map(([name_24, original_0]) => /* @__PURE__ */ jsx(FontRoleCard, {
3984
+ label: roleLabels[name_24] ?? labelFor(name_24).replace(/^font /, ""),
3985
+ value: draft.theme.theme[name_24] ?? original_0,
3986
+ options,
3987
+ changed: name_24 in draft.theme.theme,
3988
+ onChange: (value_12) => setToken(name_24, value_12),
3989
+ onReset: () => setToken(name_24)
3990
+ }, `${revision}-${resetRevision}-${name_24}`))
3991
+ }),
3992
+ /* @__PURE__ */ jsx(FontUpload, { onUpload: refreshLoadedFonts }),
3993
+ !!families.length && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("hr", { className: "studio-font-divider" }), families.map((entry_1) => renderToken(entry_1))] })
3994
+ ]
3995
+ }, "font-families");
3996
+ };
3997
+ const showTabs = sectionTabList.length > 1 && isTokenSection(section);
3998
+ const toggleAllButton = isTokenSection(section) && !flatTab && collapsibleKeys.length > 1 && /* @__PURE__ */ jsxs("button", {
3999
+ type: "button",
4000
+ className: "studio-toggle-all",
4001
+ disabled: searching,
4002
+ onClick: () => setAllGroups(!allExpanded),
4003
+ children: [/* @__PURE__ */ jsx(ChevronsUpDown, {
4004
+ size: 13,
4005
+ "aria-hidden": "true"
4006
+ }), allExpanded ? "Collapse all" : "Expand all"]
4007
+ });
4008
+ const selectControl = (label, key_11, field_1, options_0) => /* @__PURE__ */ jsxs("label", {
4009
+ className: "studio-setting",
4010
+ children: [/* @__PURE__ */ jsx("span", { children: label }), /* @__PURE__ */ jsx("select", {
4011
+ "aria-label": label,
4012
+ value: String(config[key_11][field_1]),
4013
+ onChange: (event) => setComponent(key_11, field_1, event.target.value),
4014
+ children: options_0.map((option) => /* @__PURE__ */ jsx("option", { children: option }, option))
4015
+ })]
4016
+ }, `${key_11}-${field_1}`);
4017
+ return /* @__PURE__ */ jsx($8b8d26808cb8cb53$export$8948f78d83984c69, {
4018
+ className: "studio-overlay",
4019
+ isOpen,
4020
+ onOpenChange: (next_2) => {
4021
+ if (!next_2) cancel();
4022
+ },
4023
+ isDismissable: false,
4024
+ children: /* @__PURE__ */ jsx($8b8d26808cb8cb53$export$2b77a92f1a5ad772, {
4025
+ className: "studio-modal",
4026
+ children: /* @__PURE__ */ jsxs($f2ff30fde7b014be$export$3ddf2d174ce01153, {
4027
+ className: "studio-dialog",
4028
+ style: { "--studio-editor-track": editorWidth ? `minmax(260px, ${editorWidth}px)` : void 0 },
4029
+ children: [
4030
+ /* @__PURE__ */ jsxs("header", {
4031
+ className: "studio-topbar",
4032
+ children: [
4033
+ /* @__PURE__ */ jsx("div", {
4034
+ className: "studio-title",
4035
+ children: /* @__PURE__ */ jsx($2ec61d1d4f780267$export$a8a3e93435678ff9, {
4036
+ slot: "title",
4037
+ children: "Povio UI Configuration"
4038
+ })
4039
+ }),
4040
+ /* @__PURE__ */ jsxs("nav", {
4041
+ className: "studio-nav",
4042
+ "aria-label": "Configuration sections",
4043
+ children: [
4044
+ navSections.map((group_3) => /* @__PURE__ */ jsx("button", {
4045
+ "aria-current": (group_3 === "Layout" ? isLayoutKind(section) : section === group_3) ? "page" : void 0,
4046
+ onClick: () => changeSection(group_3 === "Layout" ? lastLayoutSection : group_3),
4047
+ children: group_3
4048
+ }, group_3)),
4049
+ /* @__PURE__ */ jsx("span", {
4050
+ className: "studio-nav-divider",
4051
+ "aria-hidden": "true"
4052
+ }),
4053
+ /* @__PURE__ */ jsx("button", {
4054
+ "aria-current": advancedSection ? "page" : void 0,
4055
+ onClick: () => changeSection(isAdvancedSection(sectionTabs.Advanced ?? "") ? sectionTabs.Advanced : advancedSections[0][0]),
4056
+ children: "Advanced"
4057
+ })
4058
+ ]
4059
+ }),
4060
+ /* @__PURE__ */ jsx("div", {
4061
+ className: "studio-topbar-controls",
4062
+ children: /* @__PURE__ */ jsxs("label", {
4063
+ className: "studio-search",
4064
+ children: [/* @__PURE__ */ jsx(Search, { size: 14 }), /* @__PURE__ */ jsx("input", {
4065
+ "aria-label": "Search tokens",
4066
+ placeholder: "Search tokens",
4067
+ value: search,
4068
+ disabled: !isTokenSection(section),
4069
+ onChange: (event_0) => setSearch(event_0.target.value)
4070
+ })]
4071
+ })
4072
+ })
4073
+ ]
4074
+ }),
4075
+ /* @__PURE__ */ jsxs("div", {
4076
+ ref: bodyRef,
4077
+ className: "studio-body",
4078
+ children: [
4079
+ /* @__PURE__ */ jsxs("main", {
4080
+ ref: editorRef,
4081
+ className: "studio-editor",
4082
+ onScroll: (event_1) => memory.current.editorScroll = event_1.currentTarget.scrollTop,
4083
+ children: [
4084
+ layoutSection ? /* @__PURE__ */ jsxs("div", {
4085
+ className: "studio-subtabs-bar",
4086
+ children: [/* @__PURE__ */ jsx("div", {
4087
+ className: "studio-subtabs",
4088
+ role: "tablist",
4089
+ "aria-label": "Layout tokens",
4090
+ children: layoutKinds.map((kind_0) => /* @__PURE__ */ jsxs("button", {
4091
+ type: "button",
4092
+ role: "tab",
4093
+ "aria-selected": kind_0 === section,
4094
+ onClick: () => changeSection(kind_0),
4095
+ children: [kind_0, Object.keys(draft.theme.theme).some((name_25) => layoutKindFor(name_25) === kind_0) && /* @__PURE__ */ jsx("span", {
4096
+ className: "studio-group-changed",
4097
+ "aria-label": "has changes"
4098
+ })]
4099
+ }, kind_0))
4100
+ }), toggleAllButton]
4101
+ }) : showTabs ? /* @__PURE__ */ jsxs("div", {
4102
+ className: "studio-subtabs-bar",
4103
+ children: [/* @__PURE__ */ jsx("div", {
4104
+ className: "studio-subtabs",
4105
+ role: "tablist",
4106
+ "aria-label": `${section} tokens`,
4107
+ children: sectionTabList.map((tab_0) => /* @__PURE__ */ jsxs("button", {
4108
+ type: "button",
4109
+ role: "tab",
4110
+ "aria-selected": !searching && tab_0 === activeSectionTab,
4111
+ disabled: searching,
4112
+ onClick: () => setSectionTabs((current_12) => ({
4113
+ ...current_12,
4114
+ [section]: tab_0
4115
+ })),
4116
+ children: [tab_0, groupChanged([...groupedEntries].filter(([key_12]) => tabFor(key_12) === tab_0).flatMap(([, group_4]) => group_4.entries)) && /* @__PURE__ */ jsx("span", {
4117
+ className: "studio-group-changed",
4118
+ "aria-label": "has changes"
4119
+ })]
4120
+ }, tab_0))
4121
+ }), toggleAllButton]
4122
+ }) : advancedSection ? /* @__PURE__ */ jsx("div", {
4123
+ className: "studio-subtabs-bar",
4124
+ children: /* @__PURE__ */ jsx("div", {
4125
+ className: "studio-subtabs",
4126
+ role: "tablist",
4127
+ "aria-label": "Advanced settings",
4128
+ children: advancedSections.map(([key_13, label_0]) => /* @__PURE__ */ jsxs("button", {
4129
+ type: "button",
4130
+ role: "tab",
4131
+ "aria-selected": key_13 === section,
4132
+ onClick: () => changeSection(key_13),
4133
+ children: [label_0, (key_13 === "Components" ? Object.keys(draft.config).length > 0 : key_13 === "Variants & overrides" && Object.keys(draft.overrides ?? {}).length > 0) && /* @__PURE__ */ jsx("span", {
4134
+ className: "studio-group-changed",
4135
+ "aria-label": "has changes"
4136
+ })]
4137
+ }, key_13))
4138
+ })
4139
+ }) : /* @__PURE__ */ jsxs("div", {
4140
+ className: "studio-editor-heading",
4141
+ children: [/* @__PURE__ */ jsx("h2", { children: section }), toggleAllButton]
4142
+ }),
4143
+ isTokenSection(section) && /* @__PURE__ */ jsxs(Fragment$1, { children: [layoutSection && !searching && /* @__PURE__ */ jsx(LayoutScaleControl, {
4144
+ kind: layoutSection,
4145
+ level: layoutLevelFor(defaults, draft.theme.theme, layoutSection),
4146
+ onChange: (level_0) => setLayoutLevel(layoutSection, level_0)
4147
+ }, layoutSection), /* @__PURE__ */ jsxs("div", {
4148
+ className: `studio-token-list ${section !== "Typography" ? "studio-token-list-inline" : "studio-token-list-rows"}`,
4149
+ children: [orderedGroups.map(([key_14, group_5]) => group_5.title && !flatTab ? /* @__PURE__ */ jsxs("fieldset", {
4150
+ className: `studio-token-group ${group_5.compact ? "studio-type-style" : ""} ${!isExpanded(key_14) ? "is-collapsed" : ""}`,
4151
+ children: [/* @__PURE__ */ jsxs("legend", { children: [/* @__PURE__ */ jsxs("button", {
4152
+ type: "button",
4153
+ className: "studio-group-toggle",
4154
+ "aria-expanded": isExpanded(key_14),
4155
+ "aria-controls": `group-${section}-${key_14.replaceAll(" ", "-")}`,
4156
+ onClick: () => toggleGroup(key_14),
4157
+ children: [
4158
+ /* @__PURE__ */ jsx(ChevronRight, {
4159
+ size: 14,
4160
+ "aria-hidden": "true"
4161
+ }),
4162
+ group_5.title,
4163
+ groupChanged(group_5.entries) && /* @__PURE__ */ jsx("span", {
4164
+ className: "studio-group-changed",
4165
+ "aria-label": "has changes"
4166
+ })
4167
+ ]
4168
+ }), section === "Colors" && isPaletteGroup(group_5.entries) && /* @__PURE__ */ jsx("span", {
4169
+ className: "studio-palette-actions",
4170
+ children: /* @__PURE__ */ jsx("button", {
4171
+ type: "button",
4172
+ className: "studio-palette-reset",
4173
+ "aria-label": `Reset ${group_5.title} palette`,
4174
+ title: "Reset every shade in this palette to its default",
4175
+ disabled: !groupChanged(group_5.entries),
4176
+ onClick: () => {
4177
+ for (const [name_26] of group_5.entries) setToken(name_26);
4178
+ },
4179
+ children: /* @__PURE__ */ jsx(RotateCcw, {
4180
+ size: 13,
4181
+ "aria-hidden": "true"
4182
+ })
4183
+ })
4184
+ })] }), /* @__PURE__ */ jsxs("div", {
4185
+ id: `group-${section}-${key_14.replaceAll(" ", "-")}`,
4186
+ hidden: !isExpanded(key_14),
4187
+ className: group_5.compact ? "studio-type-fields" : void 0,
4188
+ children: [section === "Colors" && isPaletteGroup(group_5.entries) && renderPaletteShades(group_5.title, group_5.entries), group_5.entries.map((entry_2) => renderToken(entry_2, group_5.compact))]
4189
+ })]
4190
+ }, key_14) : section === "Typography" && key_14 === "Font families" ? renderFontFamilies(group_5.entries) : group_5.entries.map((entry_3) => renderToken(entry_3))), !orderedGroups.length && /* @__PURE__ */ jsx("p", { children: "No matching tokens. Try a component name such as “button”." })]
4191
+ })] }),
4192
+ section === "Variants & overrides" && /* @__PURE__ */ jsx(CvaEditor, {
4193
+ slot: cvaSlot,
4194
+ setSlot: (slot) => {
4195
+ setCvaSlot(slot);
4196
+ setCvaVariants({});
4197
+ },
4198
+ onPreview: setCvaVariants
4199
+ }),
4200
+ section === "Presets" && /* @__PURE__ */ jsxs("div", {
4201
+ className: "studio-presets",
4202
+ children: [/* @__PURE__ */ jsx("p", {
4203
+ className: "studio-presets-intro",
4204
+ children: "A preset replaces your theme edits with its own. Component defaults and overrides stay as they are; Apply or Save theme keeps it, Cancel discards it."
4205
+ }), [appThemePreset, ...themePresets].map((preset_0) => {
4206
+ const active = isPresetActive(preset_0, defaults, draft.theme);
4207
+ const colors = presetEdits(preset_0, defaults).light;
4208
+ const swatch = (name_27) => `rgb(${colors[name_27] ?? defaults.light[name_27]})`;
4209
+ return /* @__PURE__ */ jsxs("div", {
4210
+ className: `studio-preset ${active ? "is-active" : ""}`,
4211
+ children: [
4212
+ /* @__PURE__ */ jsx("span", {
4213
+ className: "studio-preset-swatches",
4214
+ "aria-hidden": "true",
4215
+ children: [
4216
+ 50,
4217
+ 200,
4218
+ 500,
4219
+ 900,
4220
+ 950
4221
+ ].map((step) => /* @__PURE__ */ jsx("i", { style: { background: swatch(`--neutral-${step}-base`) } }, step))
4222
+ }),
4223
+ /* @__PURE__ */ jsxs("span", {
4224
+ className: "studio-preset-text",
4225
+ children: [/* @__PURE__ */ jsx("strong", { children: preset_0.label }), /* @__PURE__ */ jsx("span", { children: preset_0.description })]
4226
+ }),
4227
+ /* @__PURE__ */ jsx("button", {
4228
+ type: "button",
4229
+ className: active ? void 0 : "studio-primary",
4230
+ disabled: active,
4231
+ onClick: () => applyPreset(preset_0),
4232
+ children: active ? "Active" : "Apply preset"
4233
+ })
4234
+ ]
4235
+ }, preset_0.id);
4236
+ })]
4237
+ }),
4238
+ section === "Components" && /* @__PURE__ */ jsxs("div", {
4239
+ className: "studio-settings",
4240
+ children: [
4241
+ /* @__PURE__ */ jsx("h3", { children: "Editor" }),
4242
+ /* @__PURE__ */ jsxs("label", {
4243
+ className: "studio-setting",
4244
+ children: [/* @__PURE__ */ jsx("span", { children: "Size units" }), /* @__PURE__ */ jsxs("select", {
4245
+ "aria-label": "Size units",
4246
+ value: sizeUnit,
4247
+ onChange: (event_2) => setSizeUnit(event_2.target.value),
4248
+ children: [/* @__PURE__ */ jsx("option", {
4249
+ value: "px",
4250
+ children: "px"
4251
+ }), /* @__PURE__ */ jsx("option", {
4252
+ value: "rem",
4253
+ children: "rem"
4254
+ })]
4255
+ })]
4256
+ }),
4257
+ /* @__PURE__ */ jsx("h3", { children: "Buttons" }),
4258
+ selectControl("Appearance", "button", "variant", [
4259
+ "contained",
4260
+ "outlined",
4261
+ "subtle",
4262
+ "ghost",
4263
+ "text"
4264
+ ]),
4265
+ selectControl("Button size", "button", "size", [
4266
+ "default",
4267
+ "sm",
4268
+ "s"
4269
+ ]),
4270
+ /* @__PURE__ */ jsx("h3", { children: "Inputs" }),
4271
+ selectControl("Input appearance", "input", "variant", ["outlined", "filled"]),
4272
+ selectControl("Label layout", "input", "as", [
4273
+ "default",
4274
+ "floating",
4275
+ "inline",
4276
+ "filter"
4277
+ ]),
4278
+ selectControl("Input size", "input", "size", ["default", "small"]),
4279
+ [
4280
+ "isClearable",
4281
+ "hideLabel",
4282
+ "alwaysShowClear"
4283
+ ].map((field_2) => /* @__PURE__ */ jsxs("label", {
4284
+ className: "studio-setting",
4285
+ children: [/* @__PURE__ */ jsx("span", { children: {
4286
+ isClearable: "Allow clearing",
4287
+ hideLabel: "Hide labels",
4288
+ alwaysShowClear: "Always show clear button"
4289
+ }[field_2] }), /* @__PURE__ */ jsx("input", {
4290
+ type: "checkbox",
4291
+ checked: config.input[field_2],
4292
+ onChange: (event_3) => setComponent("input", field_2, event_3.target.checked)
4293
+ })]
4294
+ }, field_2)),
4295
+ /* @__PURE__ */ jsx("h3", { children: "Rendering" }),
4296
+ /* @__PURE__ */ jsxs("label", {
4297
+ className: "studio-setting",
4298
+ children: [/* @__PURE__ */ jsxs("span", { children: ["Use static inputs until interaction", /* @__PURE__ */ jsx("small", { children: "Reduce work when rendering large forms." })] }), /* @__PURE__ */ jsx("input", {
4299
+ type: "checkbox",
4300
+ checked: config.renderStaticInput,
4301
+ onChange: (event_4) => setDraft((current_13) => ({
4302
+ ...current_13,
4303
+ config: {
4304
+ ...current_13.config,
4305
+ renderStaticInput: event_4.target.checked
4306
+ }
4307
+ }))
4308
+ })]
4309
+ }),
4310
+ /* @__PURE__ */ jsx("p", {
4311
+ className: "studio-help",
4312
+ children: "Component props override these defaults. The preview uses inherited defaults unless an example needs a specific state."
4313
+ })
4314
+ ]
4315
+ }),
4316
+ section === "Export" && /* @__PURE__ */ jsxs("div", {
4317
+ className: "studio-export",
4318
+ children: [
4319
+ /* @__PURE__ */ jsxs("div", {
4320
+ className: "studio-mode",
4321
+ children: [
4322
+ /* @__PURE__ */ jsx("button", {
4323
+ "aria-pressed": exportTab === "css",
4324
+ onClick: () => setExportTab("css"),
4325
+ children: "Tailwind CSS"
4326
+ }),
4327
+ /* @__PURE__ */ jsx("button", {
4328
+ "aria-pressed": exportTab === "config",
4329
+ onClick: () => setExportTab("config"),
4330
+ children: "UIConfig"
4331
+ }),
4332
+ /* @__PURE__ */ jsx("button", {
4333
+ "aria-pressed": exportTab === "overrides",
4334
+ onClick: () => setExportTab("overrides"),
4335
+ children: "UIOverrides"
4336
+ })
4337
+ ]
4338
+ }),
4339
+ /* @__PURE__ */ jsx("p", { children: exportTab === "css" ? "Import after your existing theme. Only changed tokens are included; light and dark colors remain separate." : exportTab === "overrides" ? "Merge these edited slots with your existing app overrides. New Tailwind classes require a rebuild." : "Wrap your application with this provider. Only changed component settings are included." }),
4340
+ /* @__PURE__ */ jsx("textarea", {
4341
+ ref: exportRef,
4342
+ "aria-label": "Exported configuration",
4343
+ readOnly: true,
4344
+ value: exportText,
4345
+ spellCheck: false
4346
+ }),
4347
+ /* @__PURE__ */ jsxs("div", {
4348
+ className: "studio-export-actions",
4349
+ children: [
4350
+ exportTab === "css" && themeWriter && /* @__PURE__ */ jsx("button", {
4351
+ disabled: savingTheme || !!Object.keys(invalidFields).length,
4352
+ title: `Save to ${themeWriter.file}`,
4353
+ onClick: async () => {
4354
+ setSavingTheme(true);
4355
+ setMessage("");
4356
+ try {
4357
+ await saveThemeCss(themeWriter, exportText);
4358
+ setMessage(`Saved theme to ${themeWriter.file}.`);
4359
+ } catch (error) {
4360
+ setMessage(error instanceof Error ? error.message : "Could not save theme.");
4361
+ } finally {
4362
+ setSavingTheme(false);
4363
+ }
4364
+ },
4365
+ children: savingTheme ? "Saving theme…" : "Save theme"
4366
+ }),
4367
+ /* @__PURE__ */ jsx("button", {
4368
+ disabled: !!Object.keys(invalidFields).length,
4369
+ onClick: async () => {
4370
+ try {
4371
+ await navigator.clipboard.writeText(exportText);
4372
+ setMessage("Copied to clipboard.");
4373
+ } catch {
4374
+ exportRef.current?.select();
4375
+ setMessage("Clipboard unavailable. The export is selected for manual copying.");
4376
+ }
4377
+ },
4378
+ children: "Copy code"
4379
+ }),
4380
+ /* @__PURE__ */ jsxs("button", {
4381
+ disabled: !!Object.keys(invalidFields).length,
4382
+ onClick: () => {
4383
+ const url = URL.createObjectURL(new Blob([exportText], { type: "text/plain" }));
4384
+ const link = document.createElement("a");
4385
+ link.href = url;
4386
+ link.download = exportTab === "css" ? "povio-theme.css" : exportTab === "overrides" ? "povio-ui-overrides.ts" : "povio-ui-config.ts";
4387
+ link.click();
4388
+ setTimeout(() => URL.revokeObjectURL(url), 1e3);
4389
+ setMessage("Export downloaded.");
4390
+ },
4391
+ children: [/* @__PURE__ */ jsx(ArrowDownToLine, { size: 14 }), " Download"]
4392
+ })
4393
+ ]
4394
+ })
4395
+ ]
4396
+ })
4397
+ ]
4398
+ }),
4399
+ /* @__PURE__ */ jsxs("aside", {
4400
+ ref: previewRef,
4401
+ className: "studio-preview",
4402
+ onScroll: (event_5) => memory.current.previewScroll = event_5.currentTarget.scrollTop,
4403
+ children: [
4404
+ /* @__PURE__ */ jsxs("div", {
4405
+ className: "studio-preview-heading",
4406
+ children: [/* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("i", {}), " LIVE PREVIEW"] }), /* @__PURE__ */ jsxs("div", {
4407
+ className: "studio-preview-actions",
4408
+ children: [/* @__PURE__ */ jsx(ColorModeSwitch, {
4409
+ value: mode,
4410
+ onChange: setMode
4411
+ }), isTokenSection(section) && /* @__PURE__ */ jsxs("div", {
4412
+ className: "studio-mode studio-preview-modes",
4413
+ role: "group",
4414
+ "aria-label": "Preview mode",
4415
+ children: [/* @__PURE__ */ jsx("button", {
4416
+ type: "button",
4417
+ "aria-pressed": previewMode === "gallery",
4418
+ onClick: () => setPreviewMode("gallery"),
4419
+ children: "Gallery"
4420
+ }), /* @__PURE__ */ jsx("button", {
4421
+ type: "button",
4422
+ "aria-pressed": previewMode === "focused",
4423
+ onClick: () => setPreviewMode("focused"),
4424
+ children: "Token preview"
4425
+ })]
4426
+ })]
4427
+ })]
4428
+ }),
4429
+ section === "Variants & overrides" || isTokenSection(section) && previewMode === "focused" ? /* @__PURE__ */ jsx(ContextualPreview, {
4430
+ variants: cvaVariants,
4431
+ setVariants: setCvaVariants,
4432
+ section,
4433
+ slot: cvaSlot,
4434
+ mode,
4435
+ entries: visibleGroups.flatMap(([, group_6]) => group_6.entries)
4436
+ }) : /* @__PURE__ */ jsx(ComponentPreview, {
4437
+ value: draft,
4438
+ mode,
4439
+ inspector: {
4440
+ isKnown: isInspectable,
4441
+ describe: describeToken,
4442
+ onSelect: focusToken,
4443
+ revision: draft
4444
+ }
4445
+ }),
4446
+ /* @__PURE__ */ jsx("p", {
4447
+ className: "studio-preview-note",
4448
+ children: section === "Variants & overrides" || previewMode === "focused" ? "Preview follows the current section. Variant controls affect only the preview." : "Click a component to inspect its padding, gaps and radius."
4449
+ })
4450
+ ]
4451
+ }),
4452
+ /* @__PURE__ */ jsx(PanelResizeHandle, {
4453
+ label: "Resize editor and preview",
4454
+ column: 2,
4455
+ width: editorWidth,
4456
+ min: 260,
4457
+ max: () => (bodyRef.current?.parentElement?.clientWidth ?? 0) - 320,
4458
+ onResize: setEditorWidth,
4459
+ onReset: () => setEditorWidth(void 0)
4460
+ })
4461
+ ]
4462
+ }),
4463
+ /* @__PURE__ */ jsxs("footer", {
4464
+ className: "studio-footer",
4465
+ children: [
4466
+ /* @__PURE__ */ jsxs("button", {
4467
+ onClick: () => {
4468
+ const hasChanges = !!changedCount || !!Object.keys(invalidFields).length;
4469
+ setNothingToReset(!hasChanges);
4470
+ setConfirmingReset(hasChanges);
4471
+ },
4472
+ children: [/* @__PURE__ */ jsx(RotateCcw, { size: 14 }), " Reset all"]
4473
+ }),
4474
+ /* @__PURE__ */ jsx("span", {
4475
+ role: "status",
4476
+ children: Object.keys(invalidFields).length ? "Fix invalid values or reset before applying or exporting." : nothingToReset && !changedCount ? "No active changes to reset." : message || `${changedCount} overrides · Changes stay in this session`
4477
+ }),
4478
+ /* @__PURE__ */ jsx("button", {
4479
+ onClick: () => cancel(),
4480
+ children: "Cancel"
4481
+ }),
4482
+ /* @__PURE__ */ jsxs("button", {
4483
+ className: "studio-primary",
4484
+ disabled: !!Object.keys(invalidFields).length,
4485
+ onClick: () => {
4486
+ apply();
4487
+ },
4488
+ children: [/* @__PURE__ */ jsx(Check, { size: 15 }), " Apply settings"]
4489
+ })
4490
+ ]
4491
+ }),
4492
+ /* @__PURE__ */ jsx($8b8d26808cb8cb53$export$8948f78d83984c69, {
4493
+ className: "studio-overlay studio-confirm-overlay",
4494
+ isOpen: confirmingReset,
4495
+ onOpenChange: setConfirmingReset,
4496
+ isDismissable: true,
4497
+ children: /* @__PURE__ */ jsx($8b8d26808cb8cb53$export$2b77a92f1a5ad772, {
4498
+ className: "studio-confirm",
4499
+ children: /* @__PURE__ */ jsxs($f2ff30fde7b014be$export$3ddf2d174ce01153, {
4500
+ role: "alertdialog",
4501
+ className: "studio-confirm-dialog",
4502
+ children: [
4503
+ /* @__PURE__ */ jsx($2ec61d1d4f780267$export$a8a3e93435678ff9, {
4504
+ slot: "title",
4505
+ children: "Reset all settings?"
4506
+ }),
4507
+ /* @__PURE__ */ jsxs("p", { children: [
4508
+ "Are you sure you want to reset all settings to the application defaults? All ",
4509
+ changedCount,
4510
+ " overrides will be discarded."
4511
+ ] }),
4512
+ /* @__PURE__ */ jsxs("div", {
4513
+ className: "studio-confirm-actions",
4514
+ children: [/* @__PURE__ */ jsx("button", {
4515
+ autoFocus: true,
4516
+ onClick: () => setConfirmingReset(false),
4517
+ children: "Keep changes"
4518
+ }), /* @__PURE__ */ jsxs("button", {
4519
+ className: "studio-danger",
4520
+ onClick: () => {
4521
+ reset();
4522
+ setConfirmingReset(false);
4523
+ },
4524
+ children: [/* @__PURE__ */ jsx(RotateCcw, { size: 14 }), " Yes, reset all"]
4525
+ })]
4526
+ })
4527
+ ]
4528
+ })
4529
+ })
4530
+ })
4531
+ ]
4532
+ })
4533
+ })
4534
+ });
4535
+ }
4536
+ function UIConfigurationModal() {
4537
+ const $ = c(4);
4538
+ const { isOpen, revision } = useUIConfiguration();
4539
+ let t0;
4540
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
4541
+ t0 = {};
4542
+ $[0] = t0;
4543
+ } else t0 = $[0];
4544
+ const memory = useRef(t0);
4545
+ let t1;
4546
+ if ($[1] !== isOpen || $[2] !== revision) {
4547
+ t1 = isOpen ? /* @__PURE__ */ jsx(ConfigurationModalContent, { memory }, revision) : null;
4548
+ $[1] = isOpen;
4549
+ $[2] = revision;
4550
+ $[3] = t1;
4551
+ } else t1 = $[3];
4552
+ return t1;
4553
+ }
4554
+ //#endregion
4555
+ export { ColorModeSwitch, UIConfigurationModal, UIConfigurationProvider, exportCss, parseThemeCss, useUIConfiguration };