@42-central/ui-react 0.20.0 → 0.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/dist/{chunk-PAFS7TED.js → chunk-2HIX6DKN.js} +3 -3
  2. package/dist/{chunk-PAFS7TED.js.map → chunk-2HIX6DKN.js.map} +1 -1
  3. package/dist/{chunk-Z5WYYDG2.js → chunk-2MXWEIMD.js} +7 -4
  4. package/dist/chunk-2MXWEIMD.js.map +1 -0
  5. package/dist/{chunk-JYK6JVR3.js → chunk-3BXKTWWD.js} +8 -8
  6. package/dist/{chunk-JYK6JVR3.js.map → chunk-3BXKTWWD.js.map} +1 -1
  7. package/dist/{chunk-7R4CDHBK.js → chunk-45QRQKRC.js} +4 -4
  8. package/dist/{chunk-7R4CDHBK.js.map → chunk-45QRQKRC.js.map} +1 -1
  9. package/dist/{chunk-MKJKCBRE.js → chunk-47LEAR6G.js} +6 -6
  10. package/dist/{chunk-MKJKCBRE.js.map → chunk-47LEAR6G.js.map} +1 -1
  11. package/dist/chunk-4ASNIDV7.js +17 -0
  12. package/dist/chunk-4ASNIDV7.js.map +1 -0
  13. package/dist/{chunk-ZN3WYGIQ.js → chunk-5HUEBSIS.js} +3 -3
  14. package/dist/{chunk-ZN3WYGIQ.js.map → chunk-5HUEBSIS.js.map} +1 -1
  15. package/dist/{chunk-2TM7UVM2.js → chunk-6M6YZ3PQ.js} +4 -4
  16. package/dist/{chunk-2TM7UVM2.js.map → chunk-6M6YZ3PQ.js.map} +1 -1
  17. package/dist/{chunk-4BGU2UQB.js → chunk-6VYGK3Q3.js} +6 -6
  18. package/dist/{chunk-4BGU2UQB.js.map → chunk-6VYGK3Q3.js.map} +1 -1
  19. package/dist/{chunk-ZFUTGBJC.js → chunk-6YNLRQ25.js} +3 -3
  20. package/dist/{chunk-ZFUTGBJC.js.map → chunk-6YNLRQ25.js.map} +1 -1
  21. package/dist/{chunk-6OV6EJQ2.js → chunk-7AQ4MN4M.js} +6 -6
  22. package/dist/{chunk-6OV6EJQ2.js.map → chunk-7AQ4MN4M.js.map} +1 -1
  23. package/dist/{chunk-5337N3FE.js → chunk-7BOSX65U.js} +3 -3
  24. package/dist/{chunk-5337N3FE.js.map → chunk-7BOSX65U.js.map} +1 -1
  25. package/dist/{chunk-THLMW5IU.js → chunk-7CNDZZZ6.js} +4 -4
  26. package/dist/{chunk-THLMW5IU.js.map → chunk-7CNDZZZ6.js.map} +1 -1
  27. package/dist/{chunk-LJ3GHC4V.js → chunk-BE2LWUHY.js} +5 -5
  28. package/dist/{chunk-LJ3GHC4V.js.map → chunk-BE2LWUHY.js.map} +1 -1
  29. package/dist/{chunk-LSIX2PVU.js → chunk-BNWQ7IAZ.js} +7 -7
  30. package/dist/{chunk-LSIX2PVU.js.map → chunk-BNWQ7IAZ.js.map} +1 -1
  31. package/dist/{chunk-2KN3MI7I.js → chunk-C4NFRSOR.js} +4 -4
  32. package/dist/{chunk-2KN3MI7I.js.map → chunk-C4NFRSOR.js.map} +1 -1
  33. package/dist/{chunk-3REFDGOM.js → chunk-C6NVU4F7.js} +3 -3
  34. package/dist/{chunk-3REFDGOM.js.map → chunk-C6NVU4F7.js.map} +1 -1
  35. package/dist/{chunk-HVOEVB4E.js → chunk-D2QIPQ74.js} +3 -3
  36. package/dist/{chunk-HVOEVB4E.js.map → chunk-D2QIPQ74.js.map} +1 -1
  37. package/dist/{chunk-4EU6FGGB.js → chunk-DA4QII2N.js} +4 -4
  38. package/dist/{chunk-4EU6FGGB.js.map → chunk-DA4QII2N.js.map} +1 -1
  39. package/dist/{chunk-LZWA7V62.js → chunk-DJLNGWMM.js} +5 -5
  40. package/dist/{chunk-LZWA7V62.js.map → chunk-DJLNGWMM.js.map} +1 -1
  41. package/dist/{chunk-HEQ2H6VO.js → chunk-DT6LKNZF.js} +4 -4
  42. package/dist/{chunk-HEQ2H6VO.js.map → chunk-DT6LKNZF.js.map} +1 -1
  43. package/dist/{chunk-BUFALAEK.js → chunk-E5H3YWZV.js} +4 -4
  44. package/dist/{chunk-BUFALAEK.js.map → chunk-E5H3YWZV.js.map} +1 -1
  45. package/dist/{chunk-WR444JRU.js → chunk-E63VD25L.js} +7 -7
  46. package/dist/{chunk-WR444JRU.js.map → chunk-E63VD25L.js.map} +1 -1
  47. package/dist/{chunk-H7INUXZD.js → chunk-F342ZT7O.js} +4 -4
  48. package/dist/{chunk-H7INUXZD.js.map → chunk-F342ZT7O.js.map} +1 -1
  49. package/dist/{chunk-VALQ2XVA.js → chunk-H3PYSAWN.js} +3 -3
  50. package/dist/{chunk-VALQ2XVA.js.map → chunk-H3PYSAWN.js.map} +1 -1
  51. package/dist/{chunk-Q5ZO2O25.js → chunk-HRNWWL3Y.js} +6 -6
  52. package/dist/{chunk-Q5ZO2O25.js.map → chunk-HRNWWL3Y.js.map} +1 -1
  53. package/dist/{chunk-DHTSVJ4G.js → chunk-IOYZC7SA.js} +9 -9
  54. package/dist/{chunk-DHTSVJ4G.js.map → chunk-IOYZC7SA.js.map} +1 -1
  55. package/dist/{chunk-HBFN5W7Q.js → chunk-JVG5ISPT.js} +4 -4
  56. package/dist/{chunk-HBFN5W7Q.js.map → chunk-JVG5ISPT.js.map} +1 -1
  57. package/dist/{chunk-6KER77RS.js → chunk-KMZENCEP.js} +7 -7
  58. package/dist/{chunk-6KER77RS.js.map → chunk-KMZENCEP.js.map} +1 -1
  59. package/dist/{chunk-VVM7JMZS.js → chunk-LBAE6FP6.js} +8 -8
  60. package/dist/{chunk-VVM7JMZS.js.map → chunk-LBAE6FP6.js.map} +1 -1
  61. package/dist/{chunk-U2PNMMDB.js → chunk-LKFHUDEW.js} +7 -7
  62. package/dist/{chunk-U2PNMMDB.js.map → chunk-LKFHUDEW.js.map} +1 -1
  63. package/dist/{chunk-P276SCCV.js → chunk-MKKQE3TM.js} +6 -6
  64. package/dist/{chunk-P276SCCV.js.map → chunk-MKKQE3TM.js.map} +1 -1
  65. package/dist/{chunk-2SVX3MQQ.js → chunk-MW42XVPD.js} +3 -3
  66. package/dist/{chunk-2SVX3MQQ.js.map → chunk-MW42XVPD.js.map} +1 -1
  67. package/dist/{chunk-S4TRYMCU.js → chunk-MXAACRWE.js} +6 -6
  68. package/dist/{chunk-S4TRYMCU.js.map → chunk-MXAACRWE.js.map} +1 -1
  69. package/dist/{chunk-WFHY6NRQ.js → chunk-NJPHZBLI.js} +11 -11
  70. package/dist/{chunk-WFHY6NRQ.js.map → chunk-NJPHZBLI.js.map} +1 -1
  71. package/dist/{chunk-DUPE2CRU.js → chunk-NKOTA5TM.js} +3 -3
  72. package/dist/{chunk-DUPE2CRU.js.map → chunk-NKOTA5TM.js.map} +1 -1
  73. package/dist/{chunk-RGLNH7A5.js → chunk-NLOBBJAA.js} +3 -3
  74. package/dist/{chunk-RGLNH7A5.js.map → chunk-NLOBBJAA.js.map} +1 -1
  75. package/dist/{chunk-FXDLS23K.js → chunk-NS6RGPWR.js} +3 -3
  76. package/dist/{chunk-FXDLS23K.js.map → chunk-NS6RGPWR.js.map} +1 -1
  77. package/dist/{chunk-ZWOZL4XX.js → chunk-O5W3QWJ6.js} +5 -5
  78. package/dist/{chunk-ZWOZL4XX.js.map → chunk-O5W3QWJ6.js.map} +1 -1
  79. package/dist/{chunk-PD4FX34E.js → chunk-O7LS6OZR.js} +4 -4
  80. package/dist/{chunk-PD4FX34E.js.map → chunk-O7LS6OZR.js.map} +1 -1
  81. package/dist/{chunk-JL4QMM46.js → chunk-POKLPMSB.js} +5 -5
  82. package/dist/{chunk-JL4QMM46.js.map → chunk-POKLPMSB.js.map} +1 -1
  83. package/dist/{chunk-K6BHDFX3.js → chunk-QKSLDQM2.js} +3 -3
  84. package/dist/{chunk-K6BHDFX3.js.map → chunk-QKSLDQM2.js.map} +1 -1
  85. package/dist/{chunk-CDHIF2NV.js → chunk-QNKD2SQM.js} +8 -8
  86. package/dist/{chunk-CDHIF2NV.js.map → chunk-QNKD2SQM.js.map} +1 -1
  87. package/dist/{chunk-KOT4PWGE.js → chunk-RCF7HTG5.js} +5 -5
  88. package/dist/{chunk-KOT4PWGE.js.map → chunk-RCF7HTG5.js.map} +1 -1
  89. package/dist/{chunk-SE3CGQRO.js → chunk-RLOWPCGG.js} +3 -3
  90. package/dist/{chunk-SE3CGQRO.js.map → chunk-RLOWPCGG.js.map} +1 -1
  91. package/dist/{chunk-R57QP43T.js → chunk-SVKN5ZHX.js} +4 -4
  92. package/dist/{chunk-R57QP43T.js.map → chunk-SVKN5ZHX.js.map} +1 -1
  93. package/dist/{chunk-NJ4RO3CT.js → chunk-SWVUXEBT.js} +5 -5
  94. package/dist/{chunk-NJ4RO3CT.js.map → chunk-SWVUXEBT.js.map} +1 -1
  95. package/dist/{chunk-FZNPJAGJ.js → chunk-SXNAUSEB.js} +5 -5
  96. package/dist/{chunk-FZNPJAGJ.js.map → chunk-SXNAUSEB.js.map} +1 -1
  97. package/dist/{chunk-7AWOMWCQ.js → chunk-TWLJQE75.js} +7 -7
  98. package/dist/{chunk-7AWOMWCQ.js.map → chunk-TWLJQE75.js.map} +1 -1
  99. package/dist/{chunk-GGT4GJD6.js → chunk-TWNIAF7K.js} +3 -3
  100. package/dist/{chunk-GGT4GJD6.js.map → chunk-TWNIAF7K.js.map} +1 -1
  101. package/dist/{chunk-4TCTMRR5.js → chunk-UAYENYS2.js} +5 -5
  102. package/dist/{chunk-4TCTMRR5.js.map → chunk-UAYENYS2.js.map} +1 -1
  103. package/dist/{chunk-HDRC6ITF.js → chunk-UT3TOV2Q.js} +3 -3
  104. package/dist/{chunk-HDRC6ITF.js.map → chunk-UT3TOV2Q.js.map} +1 -1
  105. package/dist/{chunk-R52P43LZ.js → chunk-UXPINIDN.js} +3 -3
  106. package/dist/{chunk-R52P43LZ.js.map → chunk-UXPINIDN.js.map} +1 -1
  107. package/dist/{chunk-45DFYIK5.js → chunk-VD6PB3VA.js} +3 -3
  108. package/dist/{chunk-45DFYIK5.js.map → chunk-VD6PB3VA.js.map} +1 -1
  109. package/dist/{chunk-2OQP7UY4.js → chunk-VTDBWU6H.js} +4 -4
  110. package/dist/{chunk-2OQP7UY4.js.map → chunk-VTDBWU6H.js.map} +1 -1
  111. package/dist/{chunk-IMP5VHEN.js → chunk-XKDL4QS6.js} +3 -3
  112. package/dist/{chunk-IMP5VHEN.js.map → chunk-XKDL4QS6.js.map} +1 -1
  113. package/dist/{chunk-H26K66EU.js → chunk-Y57NW6G7.js} +3 -3
  114. package/dist/{chunk-H26K66EU.js.map → chunk-Y57NW6G7.js.map} +1 -1
  115. package/dist/components/accordion/index.js +5 -5
  116. package/dist/components/action-icon/index.js +4 -4
  117. package/dist/components/alert/index.js +6 -6
  118. package/dist/components/ambient-background/index.js +1 -1
  119. package/dist/components/app-shell/index.js +6 -6
  120. package/dist/components/aspect-ratio/index.js +1 -1
  121. package/dist/components/autocomplete/index.js +6 -6
  122. package/dist/components/avatar/index.js +1 -1
  123. package/dist/components/badge/index.js +3 -3
  124. package/dist/components/breadcrumb/index.js +1 -1
  125. package/dist/components/button/index.js +4 -4
  126. package/dist/components/button-group/index.js +2 -2
  127. package/dist/components/button-multi-select/index.js +7 -7
  128. package/dist/components/button-select/index.js +7 -7
  129. package/dist/components/calendar/index.js +6 -6
  130. package/dist/components/camera/index.js +14 -14
  131. package/dist/components/card/card.d.ts.map +1 -1
  132. package/dist/components/card/index.js +2 -2
  133. package/dist/components/carousel/index.js +3 -3
  134. package/dist/components/chart/index.js +1 -1
  135. package/dist/components/checkbox/index.js +6 -6
  136. package/dist/components/choice-card-group/index.js +5 -5
  137. package/dist/components/circular-progress/index.js +1 -1
  138. package/dist/components/clipboard/index.js +6 -6
  139. package/dist/components/code/index.js +2 -2
  140. package/dist/components/code-block/chrome.js +6 -6
  141. package/dist/components/code-block/index.js +7 -7
  142. package/dist/components/code-block/static.js +4 -1
  143. package/dist/components/code-block/static.js.map +1 -1
  144. package/dist/components/collapse/index.js +2 -2
  145. package/dist/components/combobox/index.js +6 -6
  146. package/dist/components/combobox-list/index.js +8 -8
  147. package/dist/components/compare/index.js +2 -2
  148. package/dist/components/container/index.js +1 -1
  149. package/dist/components/data-table/index.js +32 -32
  150. package/dist/components/date-picker/index.js +15 -15
  151. package/dist/components/divider/index.js +2 -2
  152. package/dist/components/download-button/index.js +5 -5
  153. package/dist/components/drawer/index.js +6 -6
  154. package/dist/components/field/index.js +2 -2
  155. package/dist/components/figure/index.js +2 -2
  156. package/dist/components/file-item/index.js +8 -8
  157. package/dist/components/file-preview/index.js +6 -6
  158. package/dist/components/file-queue-summary/index.js +2 -2
  159. package/dist/components/file-trigger/index.js +5 -5
  160. package/dist/components/file-upload/index.js +10 -10
  161. package/dist/components/flex/index.js +2 -2
  162. package/dist/components/gallery/index.js +4 -4
  163. package/dist/components/grid/index.js +1 -1
  164. package/dist/components/hover-card/index.js +2 -2
  165. package/dist/components/image/index.js +2 -2
  166. package/dist/components/image-cropper/index.js +7 -7
  167. package/dist/components/indicator/index.js +1 -1
  168. package/dist/components/input/index.js +3 -3
  169. package/dist/components/kbd/index.js +3 -3
  170. package/dist/components/lightbox/index.js +9 -9
  171. package/dist/components/mark/index.js +2 -2
  172. package/dist/components/menu/index.js +4 -4
  173. package/dist/components/modal/index.js +6 -6
  174. package/dist/components/multi-combobox-list/index.js +10 -10
  175. package/dist/components/multi-select/index.js +9 -9
  176. package/dist/components/nav-link/index.js +5 -5
  177. package/dist/components/nav-link/tanstack.js +5 -5
  178. package/dist/components/notification/index.js +7 -7
  179. package/dist/components/number-input/index.js +6 -6
  180. package/dist/components/overlays/index.js +8 -8
  181. package/dist/components/password-input/index.js +4 -4
  182. package/dist/components/photo-capture/index.js +17 -17
  183. package/dist/components/pill/index.js +3 -3
  184. package/dist/components/pills-input/index.js +6 -6
  185. package/dist/components/pin-input/index.js +3 -3
  186. package/dist/components/popover/index.js +2 -2
  187. package/dist/components/progress/index.js +2 -2
  188. package/dist/components/radio-group/index.js +4 -4
  189. package/dist/components/rating/index.js +3 -3
  190. package/dist/components/schedule/index.js +9 -9
  191. package/dist/components/segment-group/index.js +3 -3
  192. package/dist/components/select/index.js +7 -7
  193. package/dist/components/skeleton/index.js +2 -2
  194. package/dist/components/slider/index.js +4 -4
  195. package/dist/components/spinner/index.js +2 -2
  196. package/dist/components/spotlight/index.js +15 -15
  197. package/dist/components/switch/index.js +3 -3
  198. package/dist/components/table/index.js +3 -3
  199. package/dist/components/tabs/index.js +3 -3
  200. package/dist/components/tags-input/index.js +8 -8
  201. package/dist/components/text/index.js +2 -2
  202. package/dist/components/text-input/index.js +3 -3
  203. package/dist/components/textarea/index.js +3 -3
  204. package/dist/components/theme-icon/index.js +3 -3
  205. package/dist/components/time-input/index.js +8 -8
  206. package/dist/components/timeline/index.js +1 -1
  207. package/dist/components/title/index.js +2 -2
  208. package/dist/components/tooltip/index.js +3 -3
  209. package/dist/components/tree-multi-select/index.js +10 -10
  210. package/dist/components/tree-select/index.js +7 -7
  211. package/dist/index.js +2 -2
  212. package/dist/lib/cn.d.ts.map +1 -1
  213. package/dist/lib/cn.js +1 -1
  214. package/package.json +1 -1
  215. package/src/components/card/card.test.tsx +10 -0
  216. package/src/components/card/card.tsx +4 -1
  217. package/src/lib/cn.test.ts +9 -0
  218. package/src/lib/cn.ts +9 -1
  219. package/dist/chunk-QP4I37PA.js +0 -14
  220. package/dist/chunk-QP4I37PA.js.map +0 -1
  221. package/dist/chunk-Z5WYYDG2.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/button/button.tsx"],"names":[],"mappings":";;;;;;;;;AAsEA,IAAM,cAAA,GAAiB,GAAA;AAAA,EACrB;AAAA,IACE,yCAAA;AAAA,IACA,+BAAA;AAAA,IACA,qCAAA;AAAA,IACA,cAAA;AAAA,IACA,0CAAA;AAAA,IACA,0BAAA;AAAA,IACA,WAAA,EAAY;AAAA,IACZ,oFAAA;AAAA,IACA,4DAAA;AAAA,IACA,uCAAA;AAAA,IACA,8BAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;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,CAAC,UAAA,EAAA,EAAW,SAAA,EAAW,eAAA,CAAgB,EAAE,IAAA,EAAM,CAAA,EAC5C,QAAA,EAAA,KAAA,KAAU,wBAAQ,GAAA,CAAC,WAAA,EAAA,EAAY,OAAA,EAAmB,QAAA,EAAA,OAAA,EAAQ,IAAiB,OAAA,EAC9E;AAAA,GAAA,EAEJ,CAAA;AAGF,EAAA,uBACE,GAAA;AAAA,IAAC,GAAA,CAAI,MAAA;AAAA,IAAJ;AAAA,MACC,OAAA;AAAA,MACA,IAAA,EAAM,OAAA,GAAU,IAAA,GAAQ,IAAA,IAAQ,QAAA;AAAA,MAChC,QAAA,EAAU,gBAAA;AAAA,MACV,YAAA,EAAY,KAAA;AAAA,MACZ,gBAAc,OAAA,IAAW,QAAA;AAAA,MACzB,aAAW,IAAA,IAAQ,IAAA;AAAA,MACnB,SAAA,EAAW,EAAA,CAAG,cAAA,CAAe,EAAE,OAAA,EAAS,IAAA,EAAM,CAAA,EAAG,KAAA,KAAU,OAAA,IAAW,UAAA,EAAY,SAAS,CAAA;AAAA,MAC3F,OAAA,EAAS,eAAA;AAAA,MACR,GAAG,KAAA,CAAM;AAAA,QACR,WAAA,EAAa,OAAA;AAAA,QACb,eAAA,EAAiB,gBAAA;AAAA,QACjB,cAAA,EAAgB,OAAA;AAAA,QAChB,aAAA,EAAe;AAAA,OAChB,CAAA;AAAA,MACA,GAAG,IAAA;AAAA,MAEH,QAAA,EAAA,OAAA,GACG,kBAAA;AAAA,QACE,QAAA;AAAA,QACA,OAAA;AAAA,QACA,OAAA,GAAU,EAAE,OAAA,EAAS,mBAAA,EAAoB,GAAI;AAAA,OAC/C,GACA,QAAQ,QAAQ;AAAA;AAAA,GACtB;AAEJ","file":"chunk-NJ4RO3CT.js","sourcesContent":["\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport type { MouseEvent, ReactNode } from \"react\"\nimport { withAsChildContent } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { Spinner } from \"../spinner/spinner\"\n\n/**\n * Button — interactive but stateless primitive.\n *\n * The new (variant × color) model splits visual treatment from accent palette:\n * - `variant` picks the shape (filled / light / outline / subtle)\n * - `color` picks the palette (brand / gray / neutral / red / orange / …)\n *\n * Color is delivered through CSS variables: the component writes a\n * `data-color=\"…\"` attribute and the global rules in `colors.css` resolve\n * `--c-solid`, `--c-soft`, `--c-text` etc. for both light and dark mode. So\n * the cva matrix only enumerates variants, not (variant × color) pairs.\n * When `color` is omitted, no `data-color` attribute is rendered and the\n * slot vars cascade from `:root` — which mirrors `neutral` — so the\n * zero-config `<Button>` renders `filled` · `neutral`. Consumers retheme the\n * default for the whole app by overriding the slot vars at `:root`, no JS\n * required.\n *\n * `asChild` (inherited from `HTMLArkProps`) renders the single child element\n * with Button's styling merged in. Ark's factory clones exactly one element,\n * so only one element can survive the swap — `startSlot`/`endSlot` and the\n * `loading` spinner are folded into *that* element's own children\n * (`withAsChildContent`, `lib/as-child.ts`) rather than rendered as siblings,\n * so they keep showing up even when the child is a link. Common case:\n * `<Button asChild startSlot={<Icon />}><a ...>Go</a></Button>`.\n *\n * `loading` never changes the button's size or moves its label. Nothing\n * leaves the layout; the spinner morphs into a place that is already there:\n * - with a `startSlot`, the spinner is stacked on the icon in the same grid\n * cell and the two crossfade (`LoadingSlot`); the label and any `endSlot`\n * stay put;\n * - with only an `endSlot`, the same morph happens in the end slot;\n * - with no slot, the label stays laid out (so it still sizes the button)\n * while it fades and lifts away, and the spinner fades up into an\n * overlay centred over it (`LoadingLabel`).\n * The cell and the label keep their idle size, so the button is sized by its\n * idle content — CSS only, nothing measured. The spinner is mounted whenever\n * the `loading` prop is *passed* (true or false), so the fade has a state to\n * start from, and its rotation is paused while idle so a page of idle buttons\n * runs no animations; a button that never passes `loading` renders no\n * spinner at all. Under `motion-reduce` the swap is instant; the spinner\n * itself still turns.\n *\n * A loading button keeps full contrast — dimming it would read as\n * `disabled`. `disabled` alone still dims (`not-data-loading:` scopes the\n * `:disabled` dim off, since `resolvedDisabled` sets native `disabled` for\n * `loading` too).\n *\n * `loading` doesn't use `pointer-events-none` to block interaction — that\n * also blocks `:hover`, which would make `cursor-progress` unreachable by a\n * real mouse. Instead native `disabled` handles a real `<button>` (the\n * `disabled:pointer-events-none` rule is scoped off while loading via\n * `not-data-loading:` for the same reason as the dim), and an explicit\n * `onClick` guard (`preventWhileLoading`) handles an arbitrary `asChild`\n * element, which `disabled` doesn't affect. `cursor-progress` and the hover\n * suppression are keyed off `data-loading` rather than `:disabled`, which\n * never matches a non-form element like an `<a>`.\n */\nconst buttonVariants = cva(\n [\n \"inline-flex items-center justify-center\",\n \"whitespace-nowrap select-none\",\n \"font-medium uppercase tracking-wide\",\n \"no-underline\",\n \"rounded-button border border-transparent\",\n \"transition-colors-radius\",\n focusStyles(),\n \"disabled:not-data-loading:pointer-events-none disabled:not-data-loading:opacity-50\",\n \"data-disabled:pointer-events-none data-disabled:opacity-50\",\n \"not-data-loading:hover:cursor-pointer\",\n \"data-loading:cursor-progress\",\n \"[&_svg]:shrink-0 [&_svg]:pointer-events-none\",\n ],\n {\n variants: {\n variant: {\n filled: [\n \"bg-(--c-solid) text-(--c-on-solid)\",\n \"not-data-loading:hover:bg-(--c-solid-hover)\",\n ],\n light: [\n \"bg-(--c-soft) text-(--c-text) border-(--c-soft-hover)\",\n \"not-data-loading:hover:bg-(--c-soft-hover) not-data-loading:hover:border-(--c-solid)\",\n ],\n outline: [\n \"bg-transparent text-(--c-text) border-(--c-solid)\",\n \"not-data-loading:hover:bg-(--c-soft)\",\n ],\n subtle: [\"bg-transparent text-(--c-text)\", \"not-data-loading:hover:bg-(--c-soft)\"],\n },\n size: {\n xs: \"h-7 px-2 text-xs [&_svg]:size-3 gap-1\",\n sm: \"h-8 px-3 text-sm [&_svg]:size-3.5 gap-1.5\",\n md: \"h-9 px-4 text-md [&_svg]:size-4 gap-2\",\n lg: \"h-10 px-4 text-lg [&_svg]:size-5 gap-3\",\n xl: \"h-12 px-5 text-xl [&_svg]:size-6 gap-3\",\n },\n },\n defaultVariants: {\n variant: \"filled\",\n size: \"md\",\n },\n },\n)\n\nconst startSlotVariants = cva(\"inline-flex shrink-0 items-center\", {\n variants: {\n size: {\n xs: \"-ms-0.5\",\n sm: \"-ms-1\",\n md: \"-ms-2\",\n lg: \"-ms-2.5\",\n xl: \"-ms-3\",\n },\n },\n})\nconst endSlotVariants = cva(\"inline-flex shrink-0 items-center\", {\n variants: {\n size: {\n xs: \"-me-0.5\",\n sm: \"-me-1\",\n md: \"-me-2\",\n lg: \"-me-2.5\",\n xl: \"-me-3\",\n },\n },\n})\n\nexport type ButtonVariant = NonNullable<VariantProps<typeof buttonVariants>[\"variant\"]>\nexport type ButtonSize = NonNullable<VariantProps<typeof buttonVariants>[\"size\"]>\n\nexport type ButtonProps = Omit<HTMLArkProps<\"button\">, \"color\"> &\n VariantProps<typeof buttonVariants> &\n WithTestId & {\n /** Accent palette. Re-exported as `Color` from `@42/ui-react`. */\n color?: Color\n /**\n * Show a spinner and mark the button as busy + non-interactive, without\n * changing its size: the spinner crossfades in place of `startSlot` (or\n * `endSlot` when there is no `startSlot`), or over the label when there\n * is no slot. Use for async submit handlers.\n */\n loading?: boolean\n /**\n * Optional element rendered at the inline-start of the children (e.g. an\n * icon) — left in LTR, right in RTL. Hidden from assistive tech via\n * `aria-hidden`.\n */\n startSlot?: ReactNode\n /**\n * Optional element rendered at the inline-end of the children — right in\n * LTR, left in RTL. `aria-hidden`.\n */\n endSlot?: ReactNode\n }\n\nconst HiddenSlot = ({ children, className }: { children: ReactNode; className?: string }) => (\n <span\n aria-hidden=\"true\"\n className={cn(\"inline-flex shrink-0 items-center justify-center\", className)}\n >\n {children}\n </span>\n)\n\n/** Both layers of a loading morph share one grid cell, so the cell is as big\n * as the larger of the two and swapping them can't move anything. */\nconst morphLayer = \"col-start-1 row-start-1 transition-morph motion-reduce:transition-none\"\n\n/** The spinner's own rotation runs only while it is showing; paused (not\n * removed) so it fades out from where it was rather than snapping back. */\nconst LoadingSpinner = ({ loading }: { loading: boolean }) => (\n <Spinner label={null} className={loading ? undefined : \"[animation-play-state:paused]\"} />\n)\n\n/**\n * A slot's icon and the spinner stacked in place: the icon shrinks and fades\n * out as the spinner grows and fades in, inside a cell that keeps its size.\n */\nconst LoadingSlot = ({ loading, children }: { loading: boolean; children: ReactNode }) => (\n <span className=\"inline-grid place-items-center\">\n <span className={cn(morphLayer, \"inline-flex\", loading && \"scale-50 opacity-0\")}>\n {children}\n </span>\n <span className={cn(morphLayer, \"inline-flex\", !loading && \"scale-50 opacity-0\")}>\n <LoadingSpinner loading={loading} />\n </span>\n </span>\n)\n\n/**\n * No slot to morph in: the label stays laid out (it still sizes the button)\n * while it fades and lifts away, and the spinner rises into an overlay over\n * the whole button — the root is `relative` for it. The label wrapper\n * inherits the root's `gap`, so children with several nodes keep their\n * spacing.\n */\nconst LoadingLabel = ({ loading, children }: { loading: boolean; children: ReactNode }) => (\n <>\n <span\n className={cn(\n morphLayer,\n \"inline-flex items-center justify-center gap-[inherit]\",\n loading && \"-translate-y-1 opacity-0\",\n )}\n >\n {children}\n </span>\n <span\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none absolute inset-0 grid place-items-center\",\n \"transition-morph motion-reduce:transition-none\",\n !loading && \"translate-y-1 opacity-0\",\n )}\n >\n <LoadingSpinner loading={loading} />\n </span>\n </>\n)\n\n/**\n * Swallows the click while `loading`. Native `disabled` already blocks\n * interaction on a real `<button>` with or without this, but it's a no-op\n * on an arbitrary `asChild` element (e.g. an `<a>`) — that's the one case\n * this actually needs to do something. A stable module-level reference so\n * it never causes the clone below to look \"changed\" across renders.\n */\nconst preventWhileLoading = (event: MouseEvent) => {\n event.preventDefault()\n event.stopPropagation()\n}\n\nexport const Button = ({\n className,\n variant,\n size,\n color,\n loading: loadingProp,\n startSlot,\n endSlot,\n children,\n disabled,\n type,\n asChild,\n testId,\n onClick,\n ...rest\n}: ButtonProps) => {\n const loading = loadingProp ?? false\n // Passing `loading` at all (even `false`) opts into the spinner layers, so\n // the first switch to `true` already has a from-state to fade from.\n const loadable = loadingProp !== undefined\n // Where the spinner morphs: the start slot, else the end slot, else over\n // the label.\n const morph = !loadable ? null : startSlot ? \"start\" : endSlot ? \"end\" : \"label\"\n const resolvedDisabled = disabled || loading\n const resolvedOnClick = loading ? preventWhileLoading : onClick\n const content = (own: ReactNode) => (\n <>\n {startSlot && (\n <HiddenSlot className={startSlotVariants({ size })}>\n {morph === \"start\" ? <LoadingSlot loading={loading}>{startSlot}</LoadingSlot> : startSlot}\n </HiddenSlot>\n )}\n {morph === \"label\" ? <LoadingLabel loading={loading}>{own}</LoadingLabel> : own}\n {endSlot && (\n <HiddenSlot className={endSlotVariants({ size })}>\n {morph === \"end\" ? <LoadingSlot loading={loading}>{endSlot}</LoadingSlot> : endSlot}\n </HiddenSlot>\n )}\n </>\n )\n\n return (\n <ark.button\n asChild={asChild}\n type={asChild ? type : (type ?? \"button\")}\n disabled={resolvedDisabled}\n data-color={color}\n data-variant={variant ?? \"filled\"}\n data-size={size ?? \"md\"}\n className={cn(buttonVariants({ variant, size }), morph === \"label\" && \"relative\", className)}\n onClick={resolvedOnClick}\n {...props({\n \"aria-busy\": loading,\n \"aria-disabled\": resolvedDisabled,\n \"data-loading\": loading,\n \"data-testid\": testId,\n })}\n {...rest}\n >\n {asChild\n ? withAsChildContent(\n children,\n content,\n loading ? { onClick: preventWhileLoading } : undefined,\n )\n : content(children)}\n </ark.button>\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/components/button/button.tsx"],"names":[],"mappings":";;;;;;;;;AAsEA,IAAM,cAAA,GAAiB,GAAA;AAAA,EACrB;AAAA,IACE,yCAAA;AAAA,IACA,+BAAA;AAAA,IACA,qCAAA;AAAA,IAC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Q;AAAA;AAAA,GACtB;AAEJ","file":"chunk-SWVUXEBT.js","sourcesContent":["\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport type { MouseEvent, ReactNode } from \"react\"\nimport { withAsChildContent } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { Spinner } from \"../spinner/spinner\"\n\n/**\n * Button — interactive but stateless primitive.\n *\n * The new (variant × color) model splits visual treatment from accent palette:\n * - `variant` picks the shape (filled / light / outline / subtle)\n * - `color` picks the palette (brand / gray / neutral / red / orange / …)\n *\n * Color is delivered through CSS variables: the component writes a\n * `data-color=\"…\"` attribute and the global rules in `colors.css` resolve\n * `--c-solid`, `--c-soft`, `--c-text` etc. for both light and dark mode. So\n * the cva matrix only enumerates variants, not (variant × color) pairs.\n * When `color` is omitted, no `data-color` attribute is rendered and the\n * slot vars cascade from `:root` — which mirrors `neutral` — so the\n * zero-config `<Button>` renders `filled` · `neutral`. Consumers retheme the\n * default for the whole app by overriding the slot vars at `:root`, no JS\n * required.\n *\n * `asChild` (inherited from `HTMLArkProps`) renders the single child element\n * with Button's styling merged in. Ark's factory clones exactly one element,\n * so only one element can survive the swap — `startSlot`/`endSlot` and the\n * `loading` spinner are folded into *that* element's own children\n * (`withAsChildContent`, `lib/as-child.ts`) rather than rendered as siblings,\n * so they keep showing up even when the child is a link. Common case:\n * `<Button asChild startSlot={<Icon />}><a ...>Go</a></Button>`.\n *\n * `loading` never changes the button's size or moves its label. Nothing\n * leaves the layout; the spinner morphs into a place that is already there:\n * - with a `startSlot`, the spinner is stacked on the icon in the same grid\n * cell and the two crossfade (`LoadingSlot`); the label and any `endSlot`\n * stay put;\n * - with only an `endSlot`, the same morph happens in the end slot;\n * - with no slot, the label stays laid out (so it still sizes the button)\n * while it fades and lifts away, and the spinner fades up into an\n * overlay centred over it (`LoadingLabel`).\n * The cell and the label keep their idle size, so the button is sized by its\n * idle content — CSS only, nothing measured. The spinner is mounted whenever\n * the `loading` prop is *passed* (true or false), so the fade has a state to\n * start from, and its rotation is paused while idle so a page of idle buttons\n * runs no animations; a button that never passes `loading` renders no\n * spinner at all. Under `motion-reduce` the swap is instant; the spinner\n * itself still turns.\n *\n * A loading button keeps full contrast — dimming it would read as\n * `disabled`. `disabled` alone still dims (`not-data-loading:` scopes the\n * `:disabled` dim off, since `resolvedDisabled` sets native `disabled` for\n * `loading` too).\n *\n * `loading` doesn't use `pointer-events-none` to block interaction — that\n * also blocks `:hover`, which would make `cursor-progress` unreachable by a\n * real mouse. Instead native `disabled` handles a real `<button>` (the\n * `disabled:pointer-events-none` rule is scoped off while loading via\n * `not-data-loading:` for the same reason as the dim), and an explicit\n * `onClick` guard (`preventWhileLoading`) handles an arbitrary `asChild`\n * element, which `disabled` doesn't affect. `cursor-progress` and the hover\n * suppression are keyed off `data-loading` rather than `:disabled`, which\n * never matches a non-form element like an `<a>`.\n */\nconst buttonVariants = cva(\n [\n \"inline-flex items-center justify-center\",\n \"whitespace-nowrap select-none\",\n \"font-medium uppercase tracking-wide\",\n \"no-underline\",\n \"rounded-button border border-transparent\",\n \"transition-colors-radius\",\n focusStyles(),\n \"disabled:not-data-loading:pointer-events-none disabled:not-data-loading:opacity-50\",\n \"data-disabled:pointer-events-none data-disabled:opacity-50\",\n \"not-data-loading:hover:cursor-pointer\",\n \"data-loading:cursor-progress\",\n \"[&_svg]:shrink-0 [&_svg]:pointer-events-none\",\n ],\n {\n variants: {\n variant: {\n filled: [\n \"bg-(--c-solid) text-(--c-on-solid)\",\n \"not-data-loading:hover:bg-(--c-solid-hover)\",\n ],\n light: [\n \"bg-(--c-soft) text-(--c-text) border-(--c-soft-hover)\",\n \"not-data-loading:hover:bg-(--c-soft-hover) not-data-loading:hover:border-(--c-solid)\",\n ],\n outline: [\n \"bg-transparent text-(--c-text) border-(--c-solid)\",\n \"not-data-loading:hover:bg-(--c-soft)\",\n ],\n subtle: [\"bg-transparent text-(--c-text)\", \"not-data-loading:hover:bg-(--c-soft)\"],\n },\n size: {\n xs: \"h-7 px-2 text-xs [&_svg]:size-3 gap-1\",\n sm: \"h-8 px-3 text-sm [&_svg]:size-3.5 gap-1.5\",\n md: \"h-9 px-4 text-md [&_svg]:size-4 gap-2\",\n lg: \"h-10 px-4 text-lg [&_svg]:size-5 gap-3\",\n xl: \"h-12 px-5 text-xl [&_svg]:size-6 gap-3\",\n },\n },\n defaultVariants: {\n variant: \"filled\",\n size: \"md\",\n },\n },\n)\n\nconst startSlotVariants = cva(\"inline-flex shrink-0 items-center\", {\n variants: {\n size: {\n xs: \"-ms-0.5\",\n sm: \"-ms-1\",\n md: \"-ms-2\",\n lg: \"-ms-2.5\",\n xl: \"-ms-3\",\n },\n },\n})\nconst endSlotVariants = cva(\"inline-flex shrink-0 items-center\", {\n variants: {\n size: {\n xs: \"-me-0.5\",\n sm: \"-me-1\",\n md: \"-me-2\",\n lg: \"-me-2.5\",\n xl: \"-me-3\",\n },\n },\n})\n\nexport type ButtonVariant = NonNullable<VariantProps<typeof buttonVariants>[\"variant\"]>\nexport type ButtonSize = NonNullable<VariantProps<typeof buttonVariants>[\"size\"]>\n\nexport type ButtonProps = Omit<HTMLArkProps<\"button\">, \"color\"> &\n VariantProps<typeof buttonVariants> &\n WithTestId & {\n /** Accent palette. Re-exported as `Color` from `@42/ui-react`. */\n color?: Color\n /**\n * Show a spinner and mark the button as busy + non-interactive, without\n * changing its size: the spinner crossfades in place of `startSlot` (or\n * `endSlot` when there is no `startSlot`), or over the label when there\n * is no slot. Use for async submit handlers.\n */\n loading?: boolean\n /**\n * Optional element rendered at the inline-start of the children (e.g. an\n * icon) — left in LTR, right in RTL. Hidden from assistive tech via\n * `aria-hidden`.\n */\n startSlot?: ReactNode\n /**\n * Optional element rendered at the inline-end of the children — right in\n * LTR, left in RTL. `aria-hidden`.\n */\n endSlot?: ReactNode\n }\n\nconst HiddenSlot = ({ children, className }: { children: ReactNode; className?: string }) => (\n <span\n aria-hidden=\"true\"\n className={cn(\"inline-flex shrink-0 items-center justify-center\", className)}\n >\n {children}\n </span>\n)\n\n/** Both layers of a loading morph share one grid cell, so the cell is as big\n * as the larger of the two and swapping them can't move anything. */\nconst morphLayer = \"col-start-1 row-start-1 transition-morph motion-reduce:transition-none\"\n\n/** The spinner's own rotation runs only while it is showing; paused (not\n * removed) so it fades out from where it was rather than snapping back. */\nconst LoadingSpinner = ({ loading }: { loading: boolean }) => (\n <Spinner label={null} className={loading ? undefined : \"[animation-play-state:paused]\"} />\n)\n\n/**\n * A slot's icon and the spinner stacked in place: the icon shrinks and fades\n * out as the spinner grows and fades in, inside a cell that keeps its size.\n */\nconst LoadingSlot = ({ loading, children }: { loading: boolean; children: ReactNode }) => (\n <span className=\"inline-grid place-items-center\">\n <span className={cn(morphLayer, \"inline-flex\", loading && \"scale-50 opacity-0\")}>\n {children}\n </span>\n <span className={cn(morphLayer, \"inline-flex\", !loading && \"scale-50 opacity-0\")}>\n <LoadingSpinner loading={loading} />\n </span>\n </span>\n)\n\n/**\n * No slot to morph in: the label stays laid out (it still sizes the button)\n * while it fades and lifts away, and the spinner rises into an overlay over\n * the whole button — the root is `relative` for it. The label wrapper\n * inherits the root's `gap`, so children with several nodes keep their\n * spacing.\n */\nconst LoadingLabel = ({ loading, children }: { loading: boolean; children: ReactNode }) => (\n <>\n <span\n className={cn(\n morphLayer,\n \"inline-flex items-center justify-center gap-[inherit]\",\n loading && \"-translate-y-1 opacity-0\",\n )}\n >\n {children}\n </span>\n <span\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none absolute inset-0 grid place-items-center\",\n \"transition-morph motion-reduce:transition-none\",\n !loading && \"translate-y-1 opacity-0\",\n )}\n >\n <LoadingSpinner loading={loading} />\n </span>\n </>\n)\n\n/**\n * Swallows the click while `loading`. Native `disabled` already blocks\n * interaction on a real `<button>` with or without this, but it's a no-op\n * on an arbitrary `asChild` element (e.g. an `<a>`) — that's the one case\n * this actually needs to do something. A stable module-level reference so\n * it never causes the clone below to look \"changed\" across renders.\n */\nconst preventWhileLoading = (event: MouseEvent) => {\n event.preventDefault()\n event.stopPropagation()\n}\n\nexport const Button = ({\n className,\n variant,\n size,\n color,\n loading: loadingProp,\n startSlot,\n endSlot,\n children,\n disabled,\n type,\n asChild,\n testId,\n onClick,\n ...rest\n}: ButtonProps) => {\n const loading = loadingProp ?? false\n // Passing `loading` at all (even `false`) opts into the spinner layers, so\n // the first switch to `true` already has a from-state to fade from.\n const loadable = loadingProp !== undefined\n // Where the spinner morphs: the start slot, else the end slot, else over\n // the label.\n const morph = !loadable ? null : startSlot ? \"start\" : endSlot ? \"end\" : \"label\"\n const resolvedDisabled = disabled || loading\n const resolvedOnClick = loading ? preventWhileLoading : onClick\n const content = (own: ReactNode) => (\n <>\n {startSlot && (\n <HiddenSlot className={startSlotVariants({ size })}>\n {morph === \"start\" ? <LoadingSlot loading={loading}>{startSlot}</LoadingSlot> : startSlot}\n </HiddenSlot>\n )}\n {morph === \"label\" ? <LoadingLabel loading={loading}>{own}</LoadingLabel> : own}\n {endSlot && (\n <HiddenSlot className={endSlotVariants({ size })}>\n {morph === \"end\" ? <LoadingSlot loading={loading}>{endSlot}</LoadingSlot> : endSlot}\n </HiddenSlot>\n )}\n </>\n )\n\n return (\n <ark.button\n asChild={asChild}\n type={asChild ? type : (type ?? \"button\")}\n disabled={resolvedDisabled}\n data-color={color}\n data-variant={variant ?? \"filled\"}\n data-size={size ?? \"md\"}\n className={cn(buttonVariants({ variant, size }), morph === \"label\" && \"relative\", className)}\n onClick={resolvedOnClick}\n {...props({\n \"aria-busy\": loading,\n \"aria-disabled\": resolvedDisabled,\n \"data-loading\": loading,\n \"data-testid\": testId,\n })}\n {...rest}\n >\n {asChild\n ? withAsChildContent(\n children,\n content,\n loading ? { onClick: preventWhileLoading } : undefined,\n )\n : content(children)}\n </ark.button>\n )\n}\n"]}
@@ -1,7 +1,7 @@
1
- import { inputSlot, inputControlClasses, inputShell } from './chunk-7R4CDHBK.js';
2
- import { popoverClearTrigger } from './chunk-ZN3WYGIQ.js';
1
+ import { inputSlot, inputControlClasses, inputShell } from './chunk-45QRQKRC.js';
2
+ import { popoverClearTrigger } from './chunk-5HUEBSIS.js';
3
3
  import { props } from './chunk-WYCMIIRR.js';
4
- import { cn } from './chunk-QP4I37PA.js';
4
+ import { cn } from './chunk-4ASNIDV7.js';
5
5
  import { Combobox } from '@ark-ui/react/combobox';
6
6
  import { jsxs, jsx } from 'react/jsx-runtime';
7
7
 
@@ -58,5 +58,5 @@ var ComboboxSearchRow = ({
58
58
  );
59
59
 
60
60
  export { ComboboxSearchRow };
61
- //# sourceMappingURL=chunk-FZNPJAGJ.js.map
62
- //# sourceMappingURL=chunk-FZNPJAGJ.js.map
61
+ //# sourceMappingURL=chunk-SXNAUSEB.js.map
62
+ //# sourceMappingURL=chunk-SXNAUSEB.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/combobox-list/combobox-search-row.tsx"],"names":["ArkCombobox"],"mappings":";;;;;;;AAqCO,IAAM,oBAAoB,CAAC;AAAA,EAChC,IAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,WAAA;AAAA,EACA,QAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,GAAA;AAAA,EACA,MAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAAA,qBACE,IAAA;AAAA,EAAC,KAAA;AAAA,EAAA;AAAA,IACE,GAAG,KAAA,CAAM,EAAE,gBAAgB,OAAA,EAAS,oBAAA,EAAsB,UAAU,CAAA;AAAA,IACrE,SAAA,EAAW,EAAA;AAAA,MACT,UAAA,CAAW,EAAE,IAAA,EAAM,OAAA,EAAS,CAAA;AAAA,MAC5B,iGAAA;AAAA,MACA,UAAA,EAAY;AAAA,KACd;AAAA,IAEC,QAAA,EAAA;AAAA,MAAA,KAAA,CAAM,MAAA,IAAU,wBACf,GAAA,CAAC,MAAA,EAAA,EAAK,WAAW,SAAA,EAAW,aAAA,EAAW,IAAA,EACpC,QAAA,EAAA,KAAA,CAAM,MAAA,EACT,CAAA;AAAA,sBAOF,GAAA;AAAA,QAACA,QAAA,CAAY,KAAA;AAAA,QAAZ;AAAA,UACC,WAAA;AAAA,UACA,MAAA;AAAA,UACA,GAAA;AAAA,UACC,GAAG,KAAA,CAAM,EAAE,gBAAgB,OAAA,EAAS,aAAA,EAAe,QAAQ,CAAA;AAAA,UAC5D,SAAA,EAAW,EAAA,CAAG,mBAAA,EAAqB,UAAA,EAAY,KAAK;AAAA;AAAA,OACtD;AAAA,MACC,QAAA,oBACC,GAAA;AAAA,QAAC,QAAA;AAAA,QAAA;AAAA,UACC,IAAA,EAAK,QAAA;AAAA,UACL,YAAA,EAAY,UAAA;AAAA,UACZ,eAAa,CAAC,SAAA;AAAA,UACd,QAAA,EAAU,YAAY,CAAA,GAAI,EAAA;AAAA,UAC1B,aAAA,EAAe,CAAC,KAAA,KAAU,KAAA,CAAM,cAAA,EAAe;AAAA,UAC/C,OAAA,EAAS,OAAA;AAAA,UACT,SAAA,EAAW,EAAA,CAAG,mBAAA,EAAqB,CAAC,aAAa,WAAW,CAAA;AAAA,UAE3D,QAAA,EAAA,KAAA,CAAM;AAAA;AAAA;AACT;AAAA;AAEJ","file":"chunk-FZNPJAGJ.js","sourcesContent":["\"use client\"\n\nimport { Combobox as ArkCombobox } from \"@ark-ui/react/combobox\"\nimport type { FocusEvent, ReactNode, Ref } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { props } from \"../../lib/props\"\nimport {\n type InputSize,\n type InputVariant,\n inputControlClasses,\n inputShell,\n inputSlot,\n} from \"../input/input\"\nimport { popoverClearTrigger } from \"../popover/popover\"\n\nexport type ComboboxSearchRowProps = {\n size: InputSize\n variant: InputVariant\n invalid: boolean\n placeholder?: string\n /** Reserves the clear button's box, so its showing never shifts the input's width. */\n canClear: boolean\n /** Shows the reserved clear button and makes it reachable. */\n showClear: boolean\n clearLabel: string\n onClear: () => void\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n ref?: Ref<HTMLInputElement>\n testId?: string\n icons: { search: ReactNode; clear: ReactNode }\n classNames?: { search?: string; input?: string }\n}\n\n/**\n * The always-open lists' search row — `ComboboxList` and `MultiComboboxList` — inside their\n * `Combobox.Root`: the magnifier, the search `<input>`, and the clear button.\n */\nexport const ComboboxSearchRow = ({\n size,\n variant,\n invalid,\n placeholder,\n canClear,\n showClear,\n clearLabel,\n onClear,\n onBlur,\n ref,\n testId,\n icons,\n classNames,\n}: ComboboxSearchRowProps) => (\n <div\n {...props({ \"data-invalid\": invalid, \"data-with-end-slot\": canClear })}\n className={cn(\n inputShell({ size, variant }),\n \"rounded-none border-t-0 border-e-0 border-s-0 border-b border-brand-900/20 dark:border-white/15\",\n classNames?.search,\n )}\n >\n {icons.search != null && (\n <span className={inputSlot} aria-hidden>\n {icons.search}\n </span>\n )}\n {/* Ark's own Input (a forwardRef) so the caller's `ref` lands on the\n real focusable `<input>` for RHF focus-on-error; the kit's\n `Combobox.Input` wrapper only adds `inputControlClasses`, replicated\n here. `name` is intentionally NOT here — it would submit the typed\n search text, not the selection (the lists render hidden inputs). */}\n <ArkCombobox.Input\n placeholder={placeholder}\n onBlur={onBlur}\n ref={ref}\n {...props({ \"aria-invalid\": invalid, \"data-testid\": testId })}\n className={cn(inputControlClasses, classNames?.input)}\n />\n {canClear && (\n <button\n type=\"button\"\n aria-label={clearLabel}\n aria-hidden={!showClear}\n tabIndex={showClear ? 0 : -1}\n onPointerDown={(event) => event.preventDefault()}\n onClick={onClear}\n className={cn(popoverClearTrigger, !showClear && \"invisible\")}\n >\n {icons.clear}\n </button>\n )}\n </div>\n)\n"]}
1
+ {"version":3,"sources":["../src/components/combobox-list/combobox-search-row.tsx"],"names":["ArkCombobox"],"mappings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,CAAM,cAAA,EAAe;AAAA,UAC/C,OAAA,EAAS,OAAA;AAAA,UACT,SAAA,EAAW,EAAA,CAAG,mBAAA,EAAqB,CAAC,aAAa,WAAW,CAAA;AAAA,UAE3D,QAAA,EAAA,KAAA,CAAM;AAAA;AAAA;AACT;AAAA;AAEJ","file":"chunk-SXNAUSEB.js","sourcesContent":["\"use client\"\n\nimport { Combobox as ArkCombobox } from \"@ark-ui/react/combobox\"\nimport type { FocusEvent, ReactNode, Ref } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { props } from \"../../lib/props\"\nimport {\n type InputSize,\n type InputVariant,\n inputControlClasses,\n inputShell,\n inputSlot,\n} from \"../input/input\"\nimport { popoverClearTrigger } from \"../popover/popover\"\n\nexport type ComboboxSearchRowProps = {\n size: InputSize\n variant: InputVariant\n invalid: boolean\n placeholder?: string\n /** Reserves the clear button's box, so its showing never shifts the input's width. */\n canClear: boolean\n /** Shows the reserved clear button and makes it reachable. */\n showClear: boolean\n clearLabel: string\n onClear: () => void\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n ref?: Ref<HTMLInputElement>\n testId?: string\n icons: { search: ReactNode; clear: ReactNode }\n classNames?: { search?: string; input?: string }\n}\n\n/**\n * The always-open lists' search row — `ComboboxList` and `MultiComboboxList` — inside their\n * `Combobox.Root`: the magnifier, the search `<input>`, and the clear button.\n */\nexport const ComboboxSearchRow = ({\n size,\n variant,\n invalid,\n placeholder,\n canClear,\n showClear,\n clearLabel,\n onClear,\n onBlur,\n ref,\n testId,\n icons,\n classNames,\n}: ComboboxSearchRowProps) => (\n <div\n {...props({ \"data-invalid\": invalid, \"data-with-end-slot\": canClear })}\n className={cn(\n inputShell({ size, variant }),\n \"rounded-none border-t-0 border-e-0 border-s-0 border-b border-brand-900/20 dark:border-white/15\",\n classNames?.search,\n )}\n >\n {icons.search != null && (\n <span className={inputSlot} aria-hidden>\n {icons.search}\n </span>\n )}\n {/* Ark's own Input (a forwardRef) so the caller's `ref` lands on the\n real focusable `<input>` for RHF focus-on-error; the kit's\n `Combobox.Input` wrapper only adds `inputControlClasses`, replicated\n here. `name` is intentionally NOT here — it would submit the typed\n search text, not the selection (the lists render hidden inputs). */}\n <ArkCombobox.Input\n placeholder={placeholder}\n onBlur={onBlur}\n ref={ref}\n {...props({ \"aria-invalid\": invalid, \"data-testid\": testId })}\n className={cn(inputControlClasses, classNames?.input)}\n />\n {canClear && (\n <button\n type=\"button\"\n aria-label={clearLabel}\n aria-hidden={!showClear}\n tabIndex={showClear ? 0 : -1}\n onPointerDown={(event) => event.preventDefault()}\n onClick={onClear}\n className={cn(popoverClearTrigger, !showClear && \"invisible\")}\n >\n {icons.clear}\n </button>\n )}\n </div>\n)\n"]}
@@ -1,10 +1,10 @@
1
- import { inputSlot, inputControlClasses } from './chunk-7R4CDHBK.js';
2
- import { fieldA11yProps } from './chunk-45DFYIK5.js';
3
- import { Popover, popoverClearTrigger, popoverChevron, popoverEmpty } from './chunk-ZN3WYGIQ.js';
1
+ import { inputSlot, inputControlClasses } from './chunk-45QRQKRC.js';
2
+ import { fieldA11yProps } from './chunk-VD6PB3VA.js';
3
+ import { Popover, popoverClearTrigger, popoverChevron, popoverEmpty } from './chunk-5HUEBSIS.js';
4
4
  import { props } from './chunk-WYCMIIRR.js';
5
- import { focusStyles } from './chunk-3REFDGOM.js';
5
+ import { focusStyles } from './chunk-C6NVU4F7.js';
6
6
  import { TEXT_COLOR_CLASSES } from './chunk-GIPQUKCN.js';
7
- import { cn } from './chunk-QP4I37PA.js';
7
+ import { cn } from './chunk-4ASNIDV7.js';
8
8
  import { useFieldContext } from '@ark-ui/react/field';
9
9
  import { cva } from 'class-variance-authority';
10
10
  import { Fragment, useState, useRef, useEffect } from 'react';
@@ -341,5 +341,5 @@ var useTreeRovingFocus = ({
341
341
  };
342
342
 
343
343
  export { TreeBody, TreeLabel, TreeRails, TreeSearch, TreeTrigger, buildMaps, filterTree, flattenTree, isLeaf, renderTree, treeItemAria, treeRow, useTreeRovingFocus };
344
- //# sourceMappingURL=chunk-7AWOMWCQ.js.map
345
- //# sourceMappingURL=chunk-7AWOMWCQ.js.map
344
+ //# sourceMappingURL=chunk-TWLJQE75.js.map
345
+ //# sourceMappingURL=chunk-TWLJQE75.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/lib/tree-data.ts","../src/components/tree-select/tree-popover.tsx"],"names":["Fragment"],"mappings":";;;;;;;;;;;;;AAyGO,IAAM,MAAA,GAAS,CAAC,IAAA,KAAgC,CAAC,KAAK,QAAA,IAAY,IAAA,CAAK,SAAS,MAAA,KAAW;AAG3F,IAAM,SAAA,GAAY,CAAI,KAAA,KAA0C;AACrE,EAAA,MAAM,QAAA,uBAAe,GAAA,EAAoB;AACzC,EAAA,MAAM,OAAA,uBAAc,GAAA,EAA6B;AACjD,EAAA,MAAM,IAAA,GAAO,CAAC,EAAA,KAAuC;AACnD,IAAA,KAAA,MAAW,KAAK,EAAA,EAAI;AAClB,MAAA,QAAA,CAAS,GAAA,CAAI,CAAA,CAAE,KAAA,EAAO,CAAA,CAAE,KAAK,CAAA;AAC7B,MAAA,OAAA,CAAQ,GAAA,CAAI,CAAA,CAAE,KAAA,EAAO,CAAC,CAAA;AACtB,MAAA,IAAI,CAAA,CAAE,QAAA,EAAU,IAAA,CAAK,CAAA,CAAE,QAAQ,CAAA;AAAA,IACjC;AAAA,EACF,CAAA;AACA,EAAA,IAAA,CAAK,KAAK,CAAA;AACV,EAAA,OAAO,EAAE,UAAU,OAAA,EAAQ;AAC7B;AAGO,IAAM,cAAc,CACzB,KAAA,EACA,iBAAA,EACA,GAAA,GAA8C,EAAC,KACJ;AAC3C,EAAA,KAAA,MAAW,KAAK,KAAA,EAAO;AACrB,IAAA,MAAM,YAAA,GAAe,iBAAA,IAAqB,CAAC,CAAC,CAAA,CAAE,QAAA;AAC9C,IAAA,GAAA,CAAI,KAAK,EAAE,KAAA,EAAO,EAAE,KAAA,EAAO,QAAA,EAAU,cAAc,CAAA;AACnD,IAAA,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W,CAAC,KAAA,CAAM,MAAA,EAAQ;AAC/E,UAAA,KAAA,CAAM,cAAA,EAAe;AACrB,UAAA,WAAA,CAAY,MAAM,GAAG,CAAA;AAAA,QACvB;AAAA;AACJ,EACF,CAAA;AAEA,EAAA,MAAM,eAAA,GAAkB,CAAC,KAAA,KAA2C;AAClE,IAAA,IAAI,KAAA,CAAM,QAAQ,WAAA,EAAa;AAC7B,MAAA,KAAA,CAAM,cAAA,EAAe;AACrB,MAAA,QAAA,CAAS,MAAA,CAAO,CAAC,CAAC,CAAA;AAAA,IACpB;AAAA,EACF,CAAA;AAIA,EAAA,MAAM,QAAA,GAAW,CAAC,KAAA,MAAmB;AAAA,IACnC,GAAA,EAAK,CAAC,EAAA,KAA2B;AAC/B,MAAA,IAAI,EAAA,EAAI,OAAA,CAAQ,OAAA,CAAQ,GAAA,CAAI,OAAO,EAAE,CAAA;AAAA,WAChC,OAAA,CAAQ,OAAA,CAAQ,MAAA,CAAO,KAAK,CAAA;AAAA,IACnC,CAAA;AAAA,IACA,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,KAAA,KAAU,aAAa;AAAA,GACnD,CAAA;AAEA,EAAA,OAAO,EAAE,WAAA,EAAa,cAAA,EAAgB,SAAA,EAAW,QAAA,EAAU,eAAe,eAAA,EAAgB;AAC5F","file":"chunk-7AWOMWCQ.js","sourcesContent":["/**\n * Shared tree model + pure helpers for the hierarchical pickers (TreeSelect,\n * TreeMultiSelect). `data` is a tree of `{ value, label, disabled?, children? }`;\n * a node with `children` is a *branch*, one without is a *leaf*. These helpers\n * are selection-agnostic — the single / multi cascade logic lives in each\n * component (mirrors `lib/select-data.ts` for the flat pickers).\n *\n * A node may carry an arbitrary, optional `payload`. Selection ignores it\n * (value / label / disabled drive everything) but it flows through to a tree\n * picker's `renderItem` as `node.payload`.\n */\n\nimport type { ReactNode } from \"react\"\nimport type { LabelSearch } from \"./select-data\"\n\nexport type TreeNodeData<P = unknown> = {\n value: string\n label: string\n disabled?: boolean\n children?: TreeNodeData<P>[]\n /** Arbitrary extra data, surfaced to `renderItem`. */\n payload?: P\n /** `data-testid` on the rendered row. Defaults to `` `item-${value}` `` —\n * set it explicitly when `value` isn't a safe/stable test selector on its\n * own. Unlike the Ark-machine-backed pickers, this tree is hand-rolled, so\n * there's no free `data-part` / `data-value` here — `testId` is the row's\n * only stable selector. */\n testId?: string\n}\n\n/**\n * A tree picker's `data` shape. Not generic over the node payload here (a\n * component generic over both `Data` and `P` independently defeats payload\n * inference — see `TreePayload` below); `TreeNodeData`'s own `P` still drives\n * autocomplete, extracted structurally from `Data` when needed.\n */\nexport type TreeSelectData = ReadonlyArray<TreeNodeData>\n\n/**\n * Extract the literal value union from a tree of `TreeNodeData` — the tree\n * analogue of `lib/select-data.ts`'s `SelectValue`, walking every node's\n * `value` plus its `children` (recursively) so a `const`-typed `data` prop\n * narrows `value` / `onChange` to the tree's actual node values instead of\n * plain `string`.\n */\nexport type TreeValue<Nodes extends ReadonlyArray<TreeNodeData>> = TreeNodeValue<Nodes[number]>\n\ntype TreeNodeValue<N> = N extends TreeNodeData\n ?\n | N[\"value\"]\n | (N[\"children\"] extends ReadonlyArray<TreeNodeData> ? TreeValue<N[\"children\"]> : never)\n : never\n\n/**\n * Extract the `payload` type carried by a tree — read structurally off every\n * node's own `payload` property (robust against generic-instantiation\n * inference, same approach as `lib/select-data.ts`'s `SelectPayload`),\n * recursing into `children`. Payload-less nodes contribute `never`; a\n * homogeneous payload resolves precisely, a mixed one to the union.\n */\nexport type TreePayload<Nodes extends ReadonlyArray<TreeNodeData>> = TreeNodePayload<Nodes[number]>\n\ntype TreeNodePayload<N> = N extends TreeNodeData\n ?\n | (N extends { payload: infer P } ? P : never)\n | (N[\"children\"] extends ReadonlyArray<TreeNodeData> ? TreePayload<N[\"children\"]> : never)\n : never\n\n/**\n * Live node state passed alongside the node to a tree picker's `renderItem`.\n * `depth` is 0-based (the row renders `aria-level={depth + 1}`); `leaf`\n * distinguishes selectable leaves from organizational branches.\n */\nexport type TreeSelectItemState = {\n selected: boolean\n leaf: boolean\n disabled: boolean\n depth: number\n}\n\n/** Tri-state variant for `TreeMultiSelect` — branches cascade to `indeterminate`. */\nexport type TreeMultiSelectItemState = {\n checked: boolean\n indeterminate: boolean\n leaf: boolean\n disabled: boolean\n depth: number\n}\n\n/**\n * Render a node's content yourself. The component keeps owning the row\n * (treeitem role, indent rails, roving focus, click); the callback fills the\n * content after the rails and receives the node (including its typed `payload`).\n * In an RSC tree the function must live in a `\"use client\"` module so the\n * boundary serializes it as a client reference.\n */\nexport type RenderTreeSelectItem<P = unknown> = (\n node: TreeNodeData<P>,\n state: TreeSelectItemState,\n) => ReactNode\nexport type RenderTreeMultiSelectItem<P = unknown> = (\n node: TreeNodeData<P>,\n state: TreeMultiSelectItemState,\n) => ReactNode\n\nexport const isLeaf = (node: TreeNodeData): boolean => !node.children || node.children.length === 0\n\n/** value → label (trigger display) and value → node (toggling from keyboard / filtered rows). */\nexport const buildMaps = <P>(nodes: ReadonlyArray<TreeNodeData<P>>) => {\n const labelMap = new Map<string, string>()\n const nodeMap = new Map<string, TreeNodeData<P>>()\n const walk = (ns: ReadonlyArray<TreeNodeData<P>>) => {\n for (const n of ns) {\n labelMap.set(n.value, n.label)\n nodeMap.set(n.value, n)\n if (n.children) walk(n.children)\n }\n }\n walk(nodes)\n return { labelMap, nodeMap }\n}\n\n/** Pre-order list of node values + inherited-disabled flag — drives roving focus. */\nexport const flattenTree = (\n nodes: ReadonlyArray<TreeNodeData>,\n inheritedDisabled: boolean,\n acc: { value: string; disabled: boolean }[] = [],\n): { value: string; disabled: boolean }[] => {\n for (const n of nodes) {\n const nodeDisabled = inheritedDisabled || !!n.disabled\n acc.push({ value: n.value, disabled: nodeDisabled })\n if (n.children) flattenTree(n.children, nodeDisabled, acc)\n }\n return acc\n}\n\n/**\n * Keep nodes whose label (or a descendant's) matches `query`; preserves ancestors.\n * `matches` is the pickers' shared locale-aware search (`useLabelSearch().matches`), passed in\n * because this is a plain function: accents and case fold away, Turkish keeps its i's apart.\n */\nexport const filterTree = <P>(\n nodes: ReadonlyArray<TreeNodeData<P>>,\n query: string,\n matches: LabelSearch[\"matches\"],\n): TreeNodeData<P>[] => {\n if (!query.trim()) return nodes as TreeNodeData<P>[]\n const recurse = (ns: ReadonlyArray<TreeNodeData<P>>): TreeNodeData<P>[] => {\n const out: TreeNodeData<P>[] = []\n for (const n of ns) {\n const selfMatch = matches(n.label, query)\n if (isLeaf(n)) {\n if (selfMatch) out.push(n)\n } else if (selfMatch) {\n out.push(n) // branch matches → keep its full subtree\n } else if (n.children) {\n const kids = recurse(n.children)\n if (kids.length > 0) out.push({ ...n, children: kids })\n }\n }\n return out\n }\n return recurse(nodes)\n}\n","\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { cva } from \"class-variance-authority\"\nimport {\n type ComponentProps,\n Fragment,\n type KeyboardEvent,\n type ReactNode,\n type Ref,\n useEffect,\n useRef,\n useState,\n} from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { props } from \"../../lib/props\"\nimport type { ClearSectionMode } from \"../../lib/select-data\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport type { TreeNodeData } from \"../../lib/tree-data\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\nimport { fieldA11yProps } from \"../field/field\"\nimport { inputControlClasses, inputSlot } from \"../input/input\"\nimport { Popover, popoverChevron, popoverClearTrigger, popoverEmpty } from \"../popover/popover\"\n\n/**\n * The internals `TreeSelect` and `TreeMultiSelect` share: the row styles, the\n * indent rails, the combobox trigger, the search header, the tree body and the\n * roving focus (arrows, Home / End, type-ahead). Each picker keeps only what\n * differs: what a row shows, and what activating one does.\n */\n\n/** Indent guide / connector colour, shared by rails and the elbow. */\nconst treeLine = \"bg-brand-900/20 dark:bg-white/15\"\n\n/**\n * One tree row. `interactive` rows (every TreeMultiSelect row, TreeSelect's\n * leaves) take roving focus and hover/active surfaces: neutral and\n * transparent, a low-opacity black/white wash rather than an opaque gray,\n * matching the popover surface's own background-dependent tint (no Figma\n * reference for this state yet). The others are TreeSelect's branches:\n * organizational, present for structure and levels, never focused.\n */\nexport const treeRow = cva(\n [\"group/row relative flex w-full items-center rounded-sm ps-1.5 outline-none select-none\"],\n {\n variants: {\n size: {\n xs: \"min-h-7 pe-1.5 text-xs\",\n sm: \"min-h-8 pe-2 text-sm\",\n md: \"min-h-9 pe-2 text-md\",\n lg: \"min-h-10 pe-2.5 text-lg\",\n xl: \"min-h-11 pe-3 text-xl\",\n },\n interactive: {\n true: [\n \"cursor-pointer\",\n TEXT_COLOR_CLASSES.primary,\n \"hover:bg-black/5 dark:hover:bg-white/8\",\n \"data-active:bg-black/5 dark:data-active:bg-white/8\",\n \"data-disabled:pointer-events-none data-disabled:opacity-50\",\n // Palette, not brand: the focused row is also the active one, and brand-500\n // measured 2.73:1 against that light fill. `--c-text` (the popover's\n // `data-color`, neutral by default) clears it in both themes.\n focusStyles({ ring: \"palette\", offset: false, inset: true }),\n ],\n false: [\"cursor-default font-medium\", TEXT_COLOR_CLASSES.secondary],\n },\n },\n defaultVariants: { size: \"md\", interactive: true },\n },\n)\n\n/** Where a node sits in the rendered tree: what its rails and set position need. */\nexport type TreePosition = {\n /** 0-based; the row renders `aria-level={depth + 1}`. */\n depth: number\n /** Per ancestor below the top level: whether it has a sibling after it (its rail continues). */\n ancestorHasNextSibling: boolean[]\n /** Last among its siblings: the connector stops at the elbow. */\n isLast: boolean\n /** 1-based index among its siblings. */\n posinset: number\n /** Number of siblings, itself included. */\n setsize: number\n}\n\n/**\n * Walk `nodes` depth-first, rendering each through `row` with its position,\n * its subtree flattened right after it: the tree is one flat list of rows,\n * its hierarchy carried by `aria-level` and the rails.\n */\nexport const renderTree = <P,>(\n nodes: ReadonlyArray<TreeNodeData<P>>,\n row: (node: TreeNodeData<P>, position: TreePosition) => ReactNode,\n depth = 0,\n ancestorHasNextSibling: boolean[] = [],\n): ReactNode =>\n nodes.map((node, i) => {\n const position = {\n depth,\n ancestorHasNextSibling,\n isLast: i === nodes.length - 1,\n posinset: i + 1,\n setsize: nodes.length,\n }\n return (\n <Fragment key={node.value}>\n {row(node, position)}\n {node.children &&\n renderTree(\n node.children,\n row,\n depth + 1,\n depth === 0 ? [] : [...ancestorHasNextSibling, !position.isLast],\n )}\n </Fragment>\n )\n })\n\n/** A row's level and set position. The tree renders flat, so the browser can't derive them. */\nexport const treeItemAria = ({ depth, setsize, posinset }: TreePosition) => ({\n \"aria-level\": depth + 1,\n \"aria-setsize\": setsize,\n \"aria-posinset\": posinset,\n})\n\n/** The indent guides before a row's content. Top-level rows sit flush. */\nexport const TreeRails = ({ depth, ancestorHasNextSibling, isLast }: TreePosition) =>\n depth > 0 && (\n <>\n {/* ancestor rails: a vertical guide where that ancestor has a sibling below */}\n {ancestorHasNextSibling.map((hasNext, i) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: Indentation is stable inside component, we would want to rerender anyway.\n <span key={i} aria-hidden className=\"relative w-4 shrink-0 self-stretch\">\n {hasNext && <span className={cn(\"absolute inset-y-0 inset-s-1/2 w-px\", treeLine)} />}\n </span>\n ))}\n\n {/* connector: vertical (├ continues / └ stops) + horizontal elbow */}\n <span aria-hidden className=\"relative w-4 shrink-0 self-stretch\">\n <span\n className={cn(\"absolute inset-s-1/2 top-0 w-px\", treeLine, isLast ? \"h-1/2\" : \"bottom-0\")}\n />\n <span className={cn(\"absolute inset-s-1/2 top-1/2 h-px w-1/2\", treeLine)} />\n </span>\n </>\n )\n\n/** A row's default label, after the rails. */\nexport const TreeLabel = ({ className, children }: { className?: string; children: ReactNode }) => (\n <span className={cn(\"ms-1.5 min-w-0 flex-1 truncate text-start\", className)}>{children}</span>\n)\n\ntype TreeTriggerProps = Omit<ComponentProps<\"div\">, \"role\" | \"tabIndex\" | \"color\"> &\n WithTestId & {\n open: boolean\n disabled?: boolean\n readOnly?: boolean\n invalid: boolean\n color?: Color\n startSlot?: ReactNode\n endSlot?: ReactNode\n /** Clears the value. Omit it to hide the clear button. */\n onClear?: () => void\n clearLabel: string\n clearSectionMode: ClearSectionMode\n icons: { clear: ReactNode; chevron: ReactNode }\n /** Enter, Space or ↓ on the closed trigger. */\n onOpen: () => void\n }\n\n/**\n * The real, focusable `<div role=\"combobox\">`, with its start slot, value\n * (`children`), end slot, clear button and chevron. A component of its own so\n * it reads the `Field` context from *inside* the picker's `FieldShell`: the\n * picker renders that shell, so `useFieldContext()` at its top level would\n * run too early. `Popover.Trigger` stamps its own id on the element, so the\n * `<label for>` never reaches it: the name comes from `aria-labelledby`.\n */\nexport const TreeTrigger = ({\n open,\n disabled,\n readOnly,\n invalid,\n color,\n startSlot,\n endSlot,\n onClear,\n clearLabel,\n clearSectionMode,\n icons,\n onOpen,\n testId,\n children,\n ...rest\n}: TreeTriggerProps) => {\n const field = useFieldContext()\n return (\n <Popover.Trigger asChild>\n <div\n role=\"combobox\"\n aria-expanded={open}\n aria-haspopup=\"tree\"\n tabIndex={disabled ? -1 : 0}\n {...fieldA11yProps(field)}\n data-color={color}\n {...props({\n \"aria-invalid\": invalid,\n \"data-disabled\": disabled,\n \"data-readonly\": readOnly,\n \"data-invalid\": invalid,\n \"data-with-start-slot\": startSlot != null,\n // The trigger always ends in a chevron (and optional clear).\n \"data-with-end-slot\": true,\n // The shell IS the tabbable/focusable element here (no separate\n // inner control to route to), so `testId` lands directly on it.\n \"data-testid\": testId,\n })}\n onKeyDown={(event) => {\n if (disabled || readOnly) return\n if (event.key === \"Enter\" || event.key === \" \" || event.key === \"ArrowDown\") {\n event.preventDefault()\n onOpen()\n }\n }}\n {...rest}\n >\n {startSlot != null && (\n <span className={inputSlot} aria-hidden>\n {startSlot}\n </span>\n )}\n {children}\n {endSlot != null && <span className={inputSlot}>{endSlot}</span>}\n {onClear && (\n <button\n type=\"button\"\n aria-label={clearLabel}\n onPointerDown={(event) => {\n event.preventDefault()\n event.stopPropagation()\n }}\n onClick={(event) => {\n event.stopPropagation()\n onClear()\n }}\n className={popoverClearTrigger}\n >\n {icons.clear}\n </button>\n )}\n {(clearSectionMode === \"both\" || !onClear) && (\n <span aria-hidden data-chevron className={cn(popoverChevron, open && \"rotate-180\")}>\n {icons.chevron}\n </span>\n )}\n </div>\n </Popover.Trigger>\n )\n}\n\n/** The popover's search field, in its fixed header. */\nexport const TreeSearch = ({\n ref,\n value,\n onChange,\n onKeyDown,\n placeholder,\n label,\n className,\n}: {\n ref: Ref<HTMLInputElement>\n value: string\n onChange: (value: string) => void\n onKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void\n placeholder: string\n label: string\n className?: string\n}) => (\n <Popover.Header>\n <input\n ref={ref}\n type=\"text\"\n value={value}\n onChange={(event) => onChange(event.target.value)}\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n aria-label={label}\n className={cn(inputControlClasses, \"text-sm\", className)}\n />\n </Popover.Header>\n)\n\n/** The scrolling body: the `role=\"tree\"` list, or `empty` when the search matched nothing. */\nexport const TreeBody = ({\n id,\n isEmpty,\n empty,\n multiselectable,\n onKeyDown,\n children,\n}: {\n id: string\n isEmpty: boolean\n empty: ReactNode\n multiselectable?: boolean\n onKeyDown: (event: KeyboardEvent<HTMLDivElement>) => void\n children: ReactNode\n}) => (\n <Popover.Body>\n {isEmpty ? (\n <div className={popoverEmpty}>{empty}</div>\n ) : (\n <div\n id={id}\n role=\"tree\"\n {...props({ \"aria-multiselectable\": multiselectable && \"true\" })}\n aria-orientation=\"vertical\"\n onKeyDown={onKeyDown}\n className=\"flex flex-col\"\n >\n {children}\n </div>\n )}\n </Popover.Body>\n)\n\ntype UseTreeRovingFocusOptions = {\n /** The rows that take focus (enabled, and selectable), in visual order. */\n values: readonly string[]\n /** A row's label, matched by type-ahead. */\n labelOf: (value: string) => string\n open: boolean\n searchable: boolean\n /** Space / Enter on the focused row. */\n onActivate: (value: string) => void\n}\n\n/**\n * Roving focus over a flat-rendered tree. One row is active (`tabIndex=0`,\n * `data-active`); `↑` / `↓` step through `values`, `Home` / `End` jump to\n * either end, `Space` / `Enter` activate, and printable keys type-ahead to the\n * next row whose label starts with what was typed. On open, focus lands in\n * the search field when there is one, on the active row otherwise.\n */\nexport const useTreeRovingFocus = ({\n values,\n labelOf,\n open,\n searchable,\n onActivate,\n}: UseTreeRovingFocusOptions) => {\n const [activeValueState, setActiveValue] = useState<string | null>(null)\n // A row filtered out (or disabled) since it was active falls back to the first.\n const activeValue =\n activeValueState != null && values.includes(activeValueState)\n ? activeValueState\n : (values[0] ?? null)\n\n const searchRef = useRef<HTMLInputElement>(null)\n const rowRefs = useRef(new Map<string, HTMLElement>())\n const focusRow = (next: string | null | undefined) => {\n if (next == null) return\n setActiveValue(next)\n rowRefs.current.get(next)?.focus()\n }\n\n // Type-ahead: typed characters buffer briefly and jump to the next row whose\n // label starts with the buffer. Only fires while the tree itself has focus —\n // when `searchable`, keys land in the search field instead.\n const typeahead = useRef<{ query: string; timer: ReturnType<typeof setTimeout> | null }>({\n query: \"\",\n timer: null,\n })\n useEffect(\n () => () => {\n if (typeahead.current.timer) clearTimeout(typeahead.current.timer)\n },\n [],\n )\n const typeToFocus = (char: string) => {\n const state = typeahead.current\n if (state.timer) clearTimeout(state.timer)\n state.query += char\n state.timer = setTimeout(() => {\n state.query = \"\"\n }, 500)\n\n const n = values.length\n if (n === 0) return\n const q = state.query.toLowerCase()\n // A run of the same key (\"ss\") cycles through same-initial matches.\n const repeated = q.length > 1 && [...q].every((c) => c === q.charAt(0))\n const needle = repeated ? q.charAt(0) : q\n const start = activeValue ? values.indexOf(activeValue) : -1\n const base = start === -1 ? 0 : start\n // Advance past the current row for a fresh/repeated key; keep it for a\n // growing multi-char query so the current match can still satisfy it.\n const advance = start !== -1 && (q.length === 1 || repeated) ? 1 : 0\n const match = Array.from({ length: n }, (_, i) => values[(base + advance + i) % n]).find(\n (value) => value != null && labelOf(value).toLowerCase().startsWith(needle),\n )\n focusRow(match)\n }\n\n // On open, focus the search field (or the active row). Initial focus only.\n // biome-ignore lint/correctness/useExhaustiveDependencies: re-running on activeValue would steal focus while navigating the tree.\n useEffect(() => {\n if (!open) return\n const id = requestAnimationFrame(() => {\n // preventScroll: the content is portaled, so focusing it before the\n // positioner places it would otherwise warp the page to the top.\n if (searchable) searchRef.current?.focus({ preventScroll: true })\n else if (activeValue) rowRefs.current.get(activeValue)?.focus({ preventScroll: true })\n })\n return () => cancelAnimationFrame(id)\n }, [open, searchable])\n\n const moveActive = (dir: 1 | -1) => {\n if (values.length === 0) return\n const idx = activeValue ? values.indexOf(activeValue) : -1\n const next =\n idx === -1\n ? dir === 1\n ? 0\n : values.length - 1\n : Math.min(Math.max(idx + dir, 0), values.length - 1)\n focusRow(values[next])\n }\n\n const onTreeKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n switch (event.key) {\n case \"ArrowDown\":\n event.preventDefault()\n moveActive(1)\n break\n case \"ArrowUp\":\n event.preventDefault()\n moveActive(-1)\n break\n case \"Home\":\n event.preventDefault()\n focusRow(values[0])\n break\n case \"End\":\n event.preventDefault()\n focusRow(values[values.length - 1])\n break\n case \" \":\n case \"Enter\":\n event.preventDefault()\n if (activeValue != null) onActivate(activeValue)\n break\n default:\n // Single printable key (no modifier) drives type-ahead. Space never\n // reaches here — it's handled above as \"activate\".\n if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {\n event.preventDefault()\n typeToFocus(event.key)\n }\n }\n }\n\n const onSearchKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === \"ArrowDown\") {\n event.preventDefault()\n focusRow(values[0])\n }\n }\n\n /** Spread on each focusable row: its ref and `data-active`. The row sets its own roving\n * `tabIndex={value === activeValue ? 0 : -1}`, where the a11y lint can see it. */\n const rowProps = (value: string) => ({\n ref: (el: HTMLElement | null) => {\n if (el) rowRefs.current.set(value, el)\n else rowRefs.current.delete(value)\n },\n ...props({ \"data-active\": value === activeValue }),\n })\n\n return { activeValue, setActiveValue, searchRef, rowProps, onTreeKeyDown, onSearchKeyDown }\n}\n"]}
1
+ {"version":3,"sources":["../src/lib/tree-data.ts","../src/components/tree-select/tree-popover.tsx"],"names":["Fragment"],"mappings":";;;;;;;;;;;;;AAyGO,IAAM,MAAA,GAAS,CAAC,IAAA,KAAgC,CAAC,KAAK,QAAA,IAAY,IAAA,CAAK,SAAS,MAAA,KAAW;AAG3F,IAAM,SAAA,GAAY,CAAI,KAAA,KAA0C;AACrE,EAAA,MAAM,QAAA,uBAAe,GAAA,EAAoB;AACzC,EAAA,MAAM,OAAA,uBAAc,GAAA,EAA6B;AACjD,EAAA,MAAM,IAAA,GAAO,CAAC,EAAA,KAAuC;AACnD,IAAA,KAAA,MAAW,KAAK,EAAA,EAAI;AAClB,MAAA,QAAA,CAAS,GAAA,CAAI,CAAA,CAAE,KAAA,EAAO,CAAA,CAAE,KAAK,CAAA;AAC7B,MAAA,OAAA,CAAQ,GAAA,CAAI,CAAA,CAAE,KAAA,EAAO,CAAC,CAAA;AACtB,MAAA,IAAI,CAAA,CAAE,QAAA,EAAU,IAAA,CAAK,CAAA,CAAE,QAAQ,CAAA;AAAA,IACjC;AAAA,EACF,CAAA;AACA,EAAA,IAAA,CAAK,KAAK,CAAA;AACV,EAAA,OAAO,EAAE,UAAU,OAAA,EAAQ;AAC7B;AAGO,IAAM,cAAc,CACzB,KAAA,EACA,iBAAA,EACA,GAAA,GAA8C,EAAC,KACJ;AAC3C,EAAA,KAAA,MAAW,KAAK,KAAA,EAAO;AACrB,IAAA,MAAM,YAAA,GAAe,iBAAA,IAAqB,CAAC,CAAC,CAAA,CAAE,QAAA;AAC9C,IAAA,GAAA,CAAI,KAAK,EAAE,KAAA,EAAO,EAAE,KAAA,EAAO,QAAA,EAAU,cAAc,CAAA;AACnD,IAAA,IAAI,EAAE,QAAA,EAAU,WAAA,CAAY,CAAA,CAAE,QAAA,EAAU,cAAc,GAAG,CAAA;AAAA,EAC3D;AACA,EAAA,OAAO,GAAA;AACT;AAOO,IA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AA;AACJ,EACF,CAAA;AAEA,EAAA,MAAM,eAAA,GAAkB,CAAC,KAAA,KAA2C;AAClE,IAAA,IAAI,KAAA,CAAM,QAAQ,WAAA,EAAa;AAC7B,MAAA,KAAA,CAAM,cAAA,EAAe;AACrB,MAAA,QAAA,CAAS,MAAA,CAAO,CAAC,CAAC,CAAA;AAAA,IACpB;AAAA,EACF,CAAA;AAIA,EAAA,MAAM,QAAA,GAAW,CAAC,KAAA,MAAmB;AAAA,IACnC,GAAA,EAAK,CAAC,EAAA,KAA2B;AAC/B,MAAA,IAAI,EAAA,EAAI,OAAA,CAAQ,OAAA,CAAQ,GAAA,CAAI,OAAO,EAAE,CAAA;AAAA,WAChC,OAAA,CAAQ,OAAA,CAAQ,MAAA,CAAO,KAAK,CAAA;AAAA,IACnC,CAAA;AAAA,IACA,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,KAAA,KAAU,aAAa;AAAA,GACnD,CAAA;AAEA,EAAA,OAAO,EAAE,WAAA,EAAa,cAAA,EAAgB,SAAA,EAAW,QAAA,EAAU,eAAe,eAAA,EAAgB;AAC5F","file":"chunk-TWLJQE75.js","sourcesContent":["/**\n * Shared tree model + pure helpers for the hierarchical pickers (TreeSelect,\n * TreeMultiSelect). `data` is a tree of `{ value, label, disabled?, children? }`;\n * a node with `children` is a *branch*, one without is a *leaf*. These helpers\n * are selection-agnostic — the single / multi cascade logic lives in each\n * component (mirrors `lib/select-data.ts` for the flat pickers).\n *\n * A node may carry an arbitrary, optional `payload`. Selection ignores it\n * (value / label / disabled drive everything) but it flows through to a tree\n * picker's `renderItem` as `node.payload`.\n */\n\nimport type { ReactNode } from \"react\"\nimport type { LabelSearch } from \"./select-data\"\n\nexport type TreeNodeData<P = unknown> = {\n value: string\n label: string\n disabled?: boolean\n children?: TreeNodeData<P>[]\n /** Arbitrary extra data, surfaced to `renderItem`. */\n payload?: P\n /** `data-testid` on the rendered row. Defaults to `` `item-${value}` `` —\n * set it explicitly when `value` isn't a safe/stable test selector on its\n * own. Unlike the Ark-machine-backed pickers, this tree is hand-rolled, so\n * there's no free `data-part` / `data-value` here — `testId` is the row's\n * only stable selector. */\n testId?: string\n}\n\n/**\n * A tree picker's `data` shape. Not generic over the node payload here (a\n * component generic over both `Data` and `P` independently defeats payload\n * inference — see `TreePayload` below); `TreeNodeData`'s own `P` still drives\n * autocomplete, extracted structurally from `Data` when needed.\n */\nexport type TreeSelectData = ReadonlyArray<TreeNodeData>\n\n/**\n * Extract the literal value union from a tree of `TreeNodeData` — the tree\n * analogue of `lib/select-data.ts`'s `SelectValue`, walking every node's\n * `value` plus its `children` (recursively) so a `const`-typed `data` prop\n * narrows `value` / `onChange` to the tree's actual node values instead of\n * plain `string`.\n */\nexport type TreeValue<Nodes extends ReadonlyArray<TreeNodeData>> = TreeNodeValue<Nodes[number]>\n\ntype TreeNodeValue<N> = N extends TreeNodeData\n ?\n | N[\"value\"]\n | (N[\"children\"] extends ReadonlyArray<TreeNodeData> ? TreeValue<N[\"children\"]> : never)\n : never\n\n/**\n * Extract the `payload` type carried by a tree — read structurally off every\n * node's own `payload` property (robust against generic-instantiation\n * inference, same approach as `lib/select-data.ts`'s `SelectPayload`),\n * recursing into `children`. Payload-less nodes contribute `never`; a\n * homogeneous payload resolves precisely, a mixed one to the union.\n */\nexport type TreePayload<Nodes extends ReadonlyArray<TreeNodeData>> = TreeNodePayload<Nodes[number]>\n\ntype TreeNodePayload<N> = N extends TreeNodeData\n ?\n | (N extends { payload: infer P } ? P : never)\n | (N[\"children\"] extends ReadonlyArray<TreeNodeData> ? TreePayload<N[\"children\"]> : never)\n : never\n\n/**\n * Live node state passed alongside the node to a tree picker's `renderItem`.\n * `depth` is 0-based (the row renders `aria-level={depth + 1}`); `leaf`\n * distinguishes selectable leaves from organizational branches.\n */\nexport type TreeSelectItemState = {\n selected: boolean\n leaf: boolean\n disabled: boolean\n depth: number\n}\n\n/** Tri-state variant for `TreeMultiSelect` — branches cascade to `indeterminate`. */\nexport type TreeMultiSelectItemState = {\n checked: boolean\n indeterminate: boolean\n leaf: boolean\n disabled: boolean\n depth: number\n}\n\n/**\n * Render a node's content yourself. The component keeps owning the row\n * (treeitem role, indent rails, roving focus, click); the callback fills the\n * content after the rails and receives the node (including its typed `payload`).\n * In an RSC tree the function must live in a `\"use client\"` module so the\n * boundary serializes it as a client reference.\n */\nexport type RenderTreeSelectItem<P = unknown> = (\n node: TreeNodeData<P>,\n state: TreeSelectItemState,\n) => ReactNode\nexport type RenderTreeMultiSelectItem<P = unknown> = (\n node: TreeNodeData<P>,\n state: TreeMultiSelectItemState,\n) => ReactNode\n\nexport const isLeaf = (node: TreeNodeData): boolean => !node.children || node.children.length === 0\n\n/** value → label (trigger display) and value → node (toggling from keyboard / filtered rows). */\nexport const buildMaps = <P>(nodes: ReadonlyArray<TreeNodeData<P>>) => {\n const labelMap = new Map<string, string>()\n const nodeMap = new Map<string, TreeNodeData<P>>()\n const walk = (ns: ReadonlyArray<TreeNodeData<P>>) => {\n for (const n of ns) {\n labelMap.set(n.value, n.label)\n nodeMap.set(n.value, n)\n if (n.children) walk(n.children)\n }\n }\n walk(nodes)\n return { labelMap, nodeMap }\n}\n\n/** Pre-order list of node values + inherited-disabled flag — drives roving focus. */\nexport const flattenTree = (\n nodes: ReadonlyArray<TreeNodeData>,\n inheritedDisabled: boolean,\n acc: { value: string; disabled: boolean }[] = [],\n): { value: string; disabled: boolean }[] => {\n for (const n of nodes) {\n const nodeDisabled = inheritedDisabled || !!n.disabled\n acc.push({ value: n.value, disabled: nodeDisabled })\n if (n.children) flattenTree(n.children, nodeDisabled, acc)\n }\n return acc\n}\n\n/**\n * Keep nodes whose label (or a descendant's) matches `query`; preserves ancestors.\n * `matches` is the pickers' shared locale-aware search (`useLabelSearch().matches`), passed in\n * because this is a plain function: accents and case fold away, Turkish keeps its i's apart.\n */\nexport const filterTree = <P>(\n nodes: ReadonlyArray<TreeNodeData<P>>,\n query: string,\n matches: LabelSearch[\"matches\"],\n): TreeNodeData<P>[] => {\n if (!query.trim()) return nodes as TreeNodeData<P>[]\n const recurse = (ns: ReadonlyArray<TreeNodeData<P>>): TreeNodeData<P>[] => {\n const out: TreeNodeData<P>[] = []\n for (const n of ns) {\n const selfMatch = matches(n.label, query)\n if (isLeaf(n)) {\n if (selfMatch) out.push(n)\n } else if (selfMatch) {\n out.push(n) // branch matches → keep its full subtree\n } else if (n.children) {\n const kids = recurse(n.children)\n if (kids.length > 0) out.push({ ...n, children: kids })\n }\n }\n return out\n }\n return recurse(nodes)\n}\n","\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { cva } from \"class-variance-authority\"\nimport {\n type ComponentProps,\n Fragment,\n type KeyboardEvent,\n type ReactNode,\n type Ref,\n useEffect,\n useRef,\n useState,\n} from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { props } from \"../../lib/props\"\nimport type { ClearSectionMode } from \"../../lib/select-data\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport type { TreeNodeData } from \"../../lib/tree-data\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\nimport { fieldA11yProps } from \"../field/field\"\nimport { inputControlClasses, inputSlot } from \"../input/input\"\nimport { Popover, popoverChevron, popoverClearTrigger, popoverEmpty } from \"../popover/popover\"\n\n/**\n * The internals `TreeSelect` and `TreeMultiSelect` share: the row styles, the\n * indent rails, the combobox trigger, the search header, the tree body and the\n * roving focus (arrows, Home / End, type-ahead). Each picker keeps only what\n * differs: what a row shows, and what activating one does.\n */\n\n/** Indent guide / connector colour, shared by rails and the elbow. */\nconst treeLine = \"bg-brand-900/20 dark:bg-white/15\"\n\n/**\n * One tree row. `interactive` rows (every TreeMultiSelect row, TreeSelect's\n * leaves) take roving focus and hover/active surfaces: neutral and\n * transparent, a low-opacity black/white wash rather than an opaque gray,\n * matching the popover surface's own background-dependent tint (no Figma\n * reference for this state yet). The others are TreeSelect's branches:\n * organizational, present for structure and levels, never focused.\n */\nexport const treeRow = cva(\n [\"group/row relative flex w-full items-center rounded-sm ps-1.5 outline-none select-none\"],\n {\n variants: {\n size: {\n xs: \"min-h-7 pe-1.5 text-xs\",\n sm: \"min-h-8 pe-2 text-sm\",\n md: \"min-h-9 pe-2 text-md\",\n lg: \"min-h-10 pe-2.5 text-lg\",\n xl: \"min-h-11 pe-3 text-xl\",\n },\n interactive: {\n true: [\n \"cursor-pointer\",\n TEXT_COLOR_CLASSES.primary,\n \"hover:bg-black/5 dark:hover:bg-white/8\",\n \"data-active:bg-black/5 dark:data-active:bg-white/8\",\n \"data-disabled:pointer-events-none data-disabled:opacity-50\",\n // Palette, not brand: the focused row is also the active one, and brand-500\n // measured 2.73:1 against that light fill. `--c-text` (the popover's\n // `data-color`, neutral by default) clears it in both themes.\n focusStyles({ ring: \"palette\", offset: false, inset: true }),\n ],\n false: [\"cursor-default font-medium\", TEXT_COLOR_CLASSES.secondary],\n },\n },\n defaultVariants: { size: \"md\", interactive: true },\n },\n)\n\n/** Where a node sits in the rendered tree: what its rails and set position need. */\nexport type TreePosition = {\n /** 0-based; the row renders `aria-level={depth + 1}`. */\n depth: number\n /** Per ancestor below the top level: whether it has a sibling after it (its rail continues). */\n ancestorHasNextSibling: boolean[]\n /** Last among its siblings: the connector stops at the elbow. */\n isLast: boolean\n /** 1-based index among its siblings. */\n posinset: number\n /** Number of siblings, itself included. */\n setsize: number\n}\n\n/**\n * Walk `nodes` depth-first, rendering each through `row` with its position,\n * its subtree flattened right after it: the tree is one flat list of rows,\n * its hierarchy carried by `aria-level` and the rails.\n */\nexport const renderTree = <P,>(\n nodes: ReadonlyArray<TreeNodeData<P>>,\n row: (node: TreeNodeData<P>, position: TreePosition) => ReactNode,\n depth = 0,\n ancestorHasNextSibling: boolean[] = [],\n): ReactNode =>\n nodes.map((node, i) => {\n const position = {\n depth,\n ancestorHasNextSibling,\n isLast: i === nodes.length - 1,\n posinset: i + 1,\n setsize: nodes.length,\n }\n return (\n <Fragment key={node.value}>\n {row(node, position)}\n {node.children &&\n renderTree(\n node.children,\n row,\n depth + 1,\n depth === 0 ? [] : [...ancestorHasNextSibling, !position.isLast],\n )}\n </Fragment>\n )\n })\n\n/** A row's level and set position. The tree renders flat, so the browser can't derive them. */\nexport const treeItemAria = ({ depth, setsize, posinset }: TreePosition) => ({\n \"aria-level\": depth + 1,\n \"aria-setsize\": setsize,\n \"aria-posinset\": posinset,\n})\n\n/** The indent guides before a row's content. Top-level rows sit flush. */\nexport const TreeRails = ({ depth, ancestorHasNextSibling, isLast }: TreePosition) =>\n depth > 0 && (\n <>\n {/* ancestor rails: a vertical guide where that ancestor has a sibling below */}\n {ancestorHasNextSibling.map((hasNext, i) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: Indentation is stable inside component, we would want to rerender anyway.\n <span key={i} aria-hidden className=\"relative w-4 shrink-0 self-stretch\">\n {hasNext && <span className={cn(\"absolute inset-y-0 inset-s-1/2 w-px\", treeLine)} />}\n </span>\n ))}\n\n {/* connector: vertical (├ continues / └ stops) + horizontal elbow */}\n <span aria-hidden className=\"relative w-4 shrink-0 self-stretch\">\n <span\n className={cn(\"absolute inset-s-1/2 top-0 w-px\", treeLine, isLast ? \"h-1/2\" : \"bottom-0\")}\n />\n <span className={cn(\"absolute inset-s-1/2 top-1/2 h-px w-1/2\", treeLine)} />\n </span>\n </>\n )\n\n/** A row's default label, after the rails. */\nexport const TreeLabel = ({ className, children }: { className?: string; children: ReactNode }) => (\n <span className={cn(\"ms-1.5 min-w-0 flex-1 truncate text-start\", className)}>{children}</span>\n)\n\ntype TreeTriggerProps = Omit<ComponentProps<\"div\">, \"role\" | \"tabIndex\" | \"color\"> &\n WithTestId & {\n open: boolean\n disabled?: boolean\n readOnly?: boolean\n invalid: boolean\n color?: Color\n startSlot?: ReactNode\n endSlot?: ReactNode\n /** Clears the value. Omit it to hide the clear button. */\n onClear?: () => void\n clearLabel: string\n clearSectionMode: ClearSectionMode\n icons: { clear: ReactNode; chevron: ReactNode }\n /** Enter, Space or ↓ on the closed trigger. */\n onOpen: () => void\n }\n\n/**\n * The real, focusable `<div role=\"combobox\">`, with its start slot, value\n * (`children`), end slot, clear button and chevron. A component of its own so\n * it reads the `Field` context from *inside* the picker's `FieldShell`: the\n * picker renders that shell, so `useFieldContext()` at its top level would\n * run too early. `Popover.Trigger` stamps its own id on the element, so the\n * `<label for>` never reaches it: the name comes from `aria-labelledby`.\n */\nexport const TreeTrigger = ({\n open,\n disabled,\n readOnly,\n invalid,\n color,\n startSlot,\n endSlot,\n onClear,\n clearLabel,\n clearSectionMode,\n icons,\n onOpen,\n testId,\n children,\n ...rest\n}: TreeTriggerProps) => {\n const field = useFieldContext()\n return (\n <Popover.Trigger asChild>\n <div\n role=\"combobox\"\n aria-expanded={open}\n aria-haspopup=\"tree\"\n tabIndex={disabled ? -1 : 0}\n {...fieldA11yProps(field)}\n data-color={color}\n {...props({\n \"aria-invalid\": invalid,\n \"data-disabled\": disabled,\n \"data-readonly\": readOnly,\n \"data-invalid\": invalid,\n \"data-with-start-slot\": startSlot != null,\n // The trigger always ends in a chevron (and optional clear).\n \"data-with-end-slot\": true,\n // The shell IS the tabbable/focusable element here (no separate\n // inner control to route to), so `testId` lands directly on it.\n \"data-testid\": testId,\n })}\n onKeyDown={(event) => {\n if (disabled || readOnly) return\n if (event.key === \"Enter\" || event.key === \" \" || event.key === \"ArrowDown\") {\n event.preventDefault()\n onOpen()\n }\n }}\n {...rest}\n >\n {startSlot != null && (\n <span className={inputSlot} aria-hidden>\n {startSlot}\n </span>\n )}\n {children}\n {endSlot != null && <span className={inputSlot}>{endSlot}</span>}\n {onClear && (\n <button\n type=\"button\"\n aria-label={clearLabel}\n onPointerDown={(event) => {\n event.preventDefault()\n event.stopPropagation()\n }}\n onClick={(event) => {\n event.stopPropagation()\n onClear()\n }}\n className={popoverClearTrigger}\n >\n {icons.clear}\n </button>\n )}\n {(clearSectionMode === \"both\" || !onClear) && (\n <span aria-hidden data-chevron className={cn(popoverChevron, open && \"rotate-180\")}>\n {icons.chevron}\n </span>\n )}\n </div>\n </Popover.Trigger>\n )\n}\n\n/** The popover's search field, in its fixed header. */\nexport const TreeSearch = ({\n ref,\n value,\n onChange,\n onKeyDown,\n placeholder,\n label,\n className,\n}: {\n ref: Ref<HTMLInputElement>\n value: string\n onChange: (value: string) => void\n onKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void\n placeholder: string\n label: string\n className?: string\n}) => (\n <Popover.Header>\n <input\n ref={ref}\n type=\"text\"\n value={value}\n onChange={(event) => onChange(event.target.value)}\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n aria-label={label}\n className={cn(inputControlClasses, \"text-sm\", className)}\n />\n </Popover.Header>\n)\n\n/** The scrolling body: the `role=\"tree\"` list, or `empty` when the search matched nothing. */\nexport const TreeBody = ({\n id,\n isEmpty,\n empty,\n multiselectable,\n onKeyDown,\n children,\n}: {\n id: string\n isEmpty: boolean\n empty: ReactNode\n multiselectable?: boolean\n onKeyDown: (event: KeyboardEvent<HTMLDivElement>) => void\n children: ReactNode\n}) => (\n <Popover.Body>\n {isEmpty ? (\n <div className={popoverEmpty}>{empty}</div>\n ) : (\n <div\n id={id}\n role=\"tree\"\n {...props({ \"aria-multiselectable\": multiselectable && \"true\" })}\n aria-orientation=\"vertical\"\n onKeyDown={onKeyDown}\n className=\"flex flex-col\"\n >\n {children}\n </div>\n )}\n </Popover.Body>\n)\n\ntype UseTreeRovingFocusOptions = {\n /** The rows that take focus (enabled, and selectable), in visual order. */\n values: readonly string[]\n /** A row's label, matched by type-ahead. */\n labelOf: (value: string) => string\n open: boolean\n searchable: boolean\n /** Space / Enter on the focused row. */\n onActivate: (value: string) => void\n}\n\n/**\n * Roving focus over a flat-rendered tree. One row is active (`tabIndex=0`,\n * `data-active`); `↑` / `↓` step through `values`, `Home` / `End` jump to\n * either end, `Space` / `Enter` activate, and printable keys type-ahead to the\n * next row whose label starts with what was typed. On open, focus lands in\n * the search field when there is one, on the active row otherwise.\n */\nexport const useTreeRovingFocus = ({\n values,\n labelOf,\n open,\n searchable,\n onActivate,\n}: UseTreeRovingFocusOptions) => {\n const [activeValueState, setActiveValue] = useState<string | null>(null)\n // A row filtered out (or disabled) since it was active falls back to the first.\n const activeValue =\n activeValueState != null && values.includes(activeValueState)\n ? activeValueState\n : (values[0] ?? null)\n\n const searchRef = useRef<HTMLInputElement>(null)\n const rowRefs = useRef(new Map<string, HTMLElement>())\n const focusRow = (next: string | null | undefined) => {\n if (next == null) return\n setActiveValue(next)\n rowRefs.current.get(next)?.focus()\n }\n\n // Type-ahead: typed characters buffer briefly and jump to the next row whose\n // label starts with the buffer. Only fires while the tree itself has focus —\n // when `searchable`, keys land in the search field instead.\n const typeahead = useRef<{ query: string; timer: ReturnType<typeof setTimeout> | null }>({\n query: \"\",\n timer: null,\n })\n useEffect(\n () => () => {\n if (typeahead.current.timer) clearTimeout(typeahead.current.timer)\n },\n [],\n )\n const typeToFocus = (char: string) => {\n const state = typeahead.current\n if (state.timer) clearTimeout(state.timer)\n state.query += char\n state.timer = setTimeout(() => {\n state.query = \"\"\n }, 500)\n\n const n = values.length\n if (n === 0) return\n const q = state.query.toLowerCase()\n // A run of the same key (\"ss\") cycles through same-initial matches.\n const repeated = q.length > 1 && [...q].every((c) => c === q.charAt(0))\n const needle = repeated ? q.charAt(0) : q\n const start = activeValue ? values.indexOf(activeValue) : -1\n const base = start === -1 ? 0 : start\n // Advance past the current row for a fresh/repeated key; keep it for a\n // growing multi-char query so the current match can still satisfy it.\n const advance = start !== -1 && (q.length === 1 || repeated) ? 1 : 0\n const match = Array.from({ length: n }, (_, i) => values[(base + advance + i) % n]).find(\n (value) => value != null && labelOf(value).toLowerCase().startsWith(needle),\n )\n focusRow(match)\n }\n\n // On open, focus the search field (or the active row). Initial focus only.\n // biome-ignore lint/correctness/useExhaustiveDependencies: re-running on activeValue would steal focus while navigating the tree.\n useEffect(() => {\n if (!open) return\n const id = requestAnimationFrame(() => {\n // preventScroll: the content is portaled, so focusing it before the\n // positioner places it would otherwise warp the page to the top.\n if (searchable) searchRef.current?.focus({ preventScroll: true })\n else if (activeValue) rowRefs.current.get(activeValue)?.focus({ preventScroll: true })\n })\n return () => cancelAnimationFrame(id)\n }, [open, searchable])\n\n const moveActive = (dir: 1 | -1) => {\n if (values.length === 0) return\n const idx = activeValue ? values.indexOf(activeValue) : -1\n const next =\n idx === -1\n ? dir === 1\n ? 0\n : values.length - 1\n : Math.min(Math.max(idx + dir, 0), values.length - 1)\n focusRow(values[next])\n }\n\n const onTreeKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n switch (event.key) {\n case \"ArrowDown\":\n event.preventDefault()\n moveActive(1)\n break\n case \"ArrowUp\":\n event.preventDefault()\n moveActive(-1)\n break\n case \"Home\":\n event.preventDefault()\n focusRow(values[0])\n break\n case \"End\":\n event.preventDefault()\n focusRow(values[values.length - 1])\n break\n case \" \":\n case \"Enter\":\n event.preventDefault()\n if (activeValue != null) onActivate(activeValue)\n break\n default:\n // Single printable key (no modifier) drives type-ahead. Space never\n // reaches here — it's handled above as \"activate\".\n if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {\n event.preventDefault()\n typeToFocus(event.key)\n }\n }\n }\n\n const onSearchKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === \"ArrowDown\") {\n event.preventDefault()\n focusRow(values[0])\n }\n }\n\n /** Spread on each focusable row: its ref and `data-active`. The row sets its own roving\n * `tabIndex={value === activeValue ? 0 : -1}`, where the a11y lint can see it. */\n const rowProps = (value: string) => ({\n ref: (el: HTMLElement | null) => {\n if (el) rowRefs.current.set(value, el)\n else rowRefs.current.delete(value)\n },\n ...props({ \"data-active\": value === activeValue }),\n })\n\n return { activeValue, setActiveValue, searchRef, rowProps, onTreeKeyDown, onSearchKeyDown }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { props } from './chunk-WYCMIIRR.js';
2
- import { cn } from './chunk-QP4I37PA.js';
2
+ import { cn } from './chunk-4ASNIDV7.js';
3
3
  import { cva } from 'class-variance-authority';
4
4
  import { jsxs, jsx } from 'react/jsx-runtime';
5
5
 
@@ -102,5 +102,5 @@ var Skeleton = ({
102
102
  };
103
103
 
104
104
  export { Skeleton };
105
- //# sourceMappingURL=chunk-GGT4GJD6.js.map
106
- //# sourceMappingURL=chunk-GGT4GJD6.js.map
105
+ //# sourceMappingURL=chunk-TWNIAF7K.js.map
106
+ //# sourceMappingURL=chunk-TWNIAF7K.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/skeleton/skeleton.tsx"],"names":[],"mappings":";;;;;AAsBA,IAAM,gBAAA,GAAmB,GAAA;AAAA,EACvB,CAAC,sEAAsE,CAAA;AAAA,EACvE;AAAA,IACE,QAAA,EAAU;AAAA,MACR,KAAA,EAAO;AAAA,QACL,WAAA,EAAa,mBAAA;AAAA,QACb,QAAA,EAAU;AAAA,OACZ;AAAA,MACA,IAAA,EAAM;AAAA,QACJ,EAAA,EAAI,EAAA;AAAA,QACJ,EAAA,EAAI,EAAA;AAAA,QACJ,EAAA,EAAI,EAAA;AAAA,QACJ,EAAA,EAAI,EAAA;AAAA,QACJ,EAAA,EAAI;AAAA;AACN,KACF;AAAA,IACA,gBAAA,EAAkB;AAAA,MAChB,EAAE,KAAA,EAAO,aAAA,EAAe,IAAA,EAAM,IAAA,EAAM,OAAO,KAAA,EAAM;AAAA,MACjD,EAAE,KAAA,EAAO,aAAA,EAAe,IAAA,EAAM,IAAA,EAAM,OAAO,KAAA,EAAM;AAAA,MACjD,EAAE,KAAA,EAAO,aAAA,EAAe,IAAA,EAAM,IAAA,EAAM,OAAO,KAAA,EAAM;AAAA,MACjD,EAAE,KAAA,EAAO,aAAA,EAAe,IAAA,EAAM,IAAA,EAAM,OAAO,KAAA,EAAM;AAAA,MACjD,EAAE,KAAA,EAAO,aAAA,EAAe,IAAA,EAAM,IAAA,EAAM,OAAO,KAAA,EAAM;AAAA,MACjD,EAAE,KAAA,EAAO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AAW,EAAA,CAAG,OAAA,IAAW,WAAW,CAAA;AAAA,cAEnC;AAAA;AAAA,WACH;AAAA,UACC,OAAA,oBACC,GAAA;AAAA,YAAC,KAAA;AAAA,YAAA;AAAA,cACC,WAAA,EAAU,UAAA;AAAA,cACV,aAAA,EAAY,MAAA;AAAA,cACZ,SAAA,EAAW,EAAA;AAAA,gBACT,gBAAA,CAAiB,EAAE,KAAA,EAAO,IAAA,EAAM,CAAA;AAAA,gBAChC,4BAAA;AAAA,gBACA,CAAC,OAAA,IAAW,cAAA;AAAA,gBACZ,UAAA,EAAY;AAAA;AACd;AAAA;AACF;AAAA;AAAA,KAEJ;AAAA,EAEJ;AAEA,EAAA,IAAI,CAAC,SAAS,OAAO,IAAA;AAErB,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,UAAA;AAAA,MACV,aAAA,EAAY,MAAA;AAAA,MACX,GAAG,KAAA,CAAU,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,MACtC,GAAG,IAAA;AAAA,MACJ,KAAA,EAAO;AAAA,QACL,GAAI,KAAA,KAAU,MAAA,IAAa,EAAE,KAAA,EAAM;AAAA,QACnC,GAAI,MAAA,KAAW,MAAA,IAAa,EAAE,MAAA,EAAO;AAAA,QACrC,GAAG;AAAA,OACL;AAAA,MACA,SAAA,EAAW,EAAA,CAAG,gBAAA,CAAiB,EAAE,KAAA,EAAO,IAAA,EAAM,CAAA,EAAG,CAAC,OAAA,IAAW,cAAA,EAAgB,SAAS;AAAA;AAAA,GACxF;AAEJ","file":"chunk-GGT4GJD6.js","sourcesContent":["import { cva, type VariantProps } from \"class-variance-authority\"\nimport type { ComponentPropsWithoutRef, CSSProperties, ReactNode } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { props as dataProps } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\n\n/**\n * Reproduces DataTable's own `DATA_TABLE_SKELETON_CLASS` exactly at the\n * rectangular default (`animate-pulse rounded-xs bg-black/15 dark:bg-white/8`)\n * — DataTable renders through this component internally, so pixel parity here\n * is load-bearing, not incidental. Monochrome by design: no `color` prop —\n * this is a shape axis, not a fill-treatment axis (see code-style.md's\n * variant/color split), and a loading placeholder should stay neutral rather\n * than compete with the content it precedes.\n *\n * `size` reuses the kit's shared `xs..xl` scale (`lib/sizes.ts`) at the same\n * `h-2..h-6` steps DataTable's own density scale already used — a text-line\n * bar height for `rectangular`, or (via the matching `size-2..size-6` step on\n * both axes) a small dot diameter for `circular`. Not wide enough for a\n * typical avatar circle by design — pass `width`/`height` for that.\n */\nconst skeletonVariants = cva(\n [\"animate-pulse bg-black/15 dark:bg-white/8 motion-reduce:animate-none\"],\n {\n variants: {\n shape: {\n rectangular: \"w-full rounded-xs\",\n circular: \"shrink-0 rounded-full\",\n },\n size: {\n xs: \"\",\n sm: \"\",\n md: \"\",\n lg: \"\",\n xl: \"\",\n },\n },\n compoundVariants: [\n { shape: \"rectangular\", size: \"xs\", class: \"h-2\" },\n { shape: \"rectangular\", size: \"sm\", class: \"h-3\" },\n { shape: \"rectangular\", size: \"md\", class: \"h-4\" },\n { shape: \"rectangular\", size: \"lg\", class: \"h-5\" },\n { shape: \"rectangular\", size: \"xl\", class: \"h-6\" },\n { shape: \"circular\", size: \"xs\", class: \"size-2\" },\n { shape: \"circular\", size: \"sm\", class: \"size-3\" },\n { shape: \"circular\", size: \"md\", class: \"size-4\" },\n { shape: \"circular\", size: \"lg\", class: \"size-5\" },\n { shape: \"circular\", size: \"xl\", class: \"size-6\" },\n ],\n defaultVariants: { shape: \"rectangular\", size: \"md\" },\n },\n)\n\nexport type SkeletonShape = NonNullable<VariantProps<typeof skeletonVariants>[\"shape\"]>\nexport type SkeletonSize = Size\n\nexport type SkeletonClassNames = {\n /** The placeholder box itself in wrap mode — separate from the wrapper's\n * own `className` so a caller can restyle just the placeholder (radius,\n * background) without touching the wrapper's layout. */\n skeleton?: string\n}\n\n/**\n * Skeleton — a loading placeholder. Not routed through Ark's `ark.*` factory\n * (no `asChild`): wrap mode below repurposes `children` to mean \"real content\n * to reveal,\" which collides with `asChild`'s usual meaning (the one child to\n * merge root props onto) — the same bespoke-primitive rationale as `Collapse`.\n *\n * **Standalone mode** (no `children`) — a fixed placeholder shape:\n *\n * <Skeleton />\n * <Skeleton shape=\"circular\" width={40} height={40} />\n *\n * **Wrap mode** (`children` passed) — sizes a placeholder to the real\n * content's own box (no measurement, pure CSS: the content stays mounted but\n * `invisible` while loading, so it keeps contributing its box to the relative\n * wrapper the placeholder absolutely fills), then reveals the content once\n * `loading` is `false`:\n *\n * <Skeleton loading={isLoading}>\n * <Avatar src={user.avatarUrl} />\n * </Skeleton>\n *\n * For complex card-style layouts, compose multiple `Skeleton`s inside the\n * kit's existing `Card`/`Flex`/`Grid` — Skeleton itself has no layout logic.\n *\n * The wrapper shrink-wraps to the content's *intrinsic* size (`inline-block`)\n * — content that itself stretches to fill its container (`w-full`, `flex-1`,\n * an unconstrained block paragraph) won't get a full-width overlay from wrap\n * mode alone. Add `className=\"block w-full\"` in that case, or use standalone\n * mode with an explicit `width` instead.\n */\nexport type SkeletonProps = ComponentPropsWithoutRef<\"div\"> &\n VariantProps<typeof skeletonVariants> &\n WithTestId & {\n /** Fixed width. Standalone mode only (no `children`) — wrap mode sizes\n * itself off the real content instead. Needed for an avatar-scale\n * `circular` placeholder, since `size`'s scale tops out at 24px. */\n width?: CSSProperties[\"width\"]\n /** Fixed height. Standalone mode only — see `width`. */\n height?: CSSProperties[\"height\"]\n /** Plays the pulse animation. Default `true`. */\n animate?: boolean\n /** Standalone (no `children`): `false` renders nothing. Wrap mode\n * (`children` set): `false` reveals the real children instead of the\n * placeholder. Default `true`. */\n loading?: boolean\n /** Wrap mode: real content to size the placeholder against, revealed\n * once `loading` is `false`. Omit for a standalone fixed-shape\n * placeholder. */\n children?: ReactNode\n classNames?: SkeletonClassNames\n }\n\nexport const Skeleton = ({\n className,\n classNames,\n shape,\n size,\n width,\n height,\n animate = true,\n loading = true,\n style,\n children,\n testId,\n ...rest\n}: SkeletonProps) => {\n if (children != null) {\n return (\n <div\n {...dataProps({ \"data-loading\": loading, \"aria-busy\": loading, \"data-testid\": testId })}\n {...rest}\n style={style}\n className={cn(\"relative inline-block\", className)}\n >\n <div\n data-part=\"content\"\n {...dataProps({ \"aria-hidden\": loading })}\n className={cn(loading && \"invisible\")}\n >\n {children}\n </div>\n {loading && (\n <div\n data-part=\"skeleton\"\n aria-hidden=\"true\"\n className={cn(\n skeletonVariants({ shape, size }),\n \"absolute inset-0 size-full\",\n !animate && \"animate-none\",\n classNames?.skeleton,\n )}\n />\n )}\n </div>\n )\n }\n\n if (!loading) return null\n\n return (\n <div\n data-part=\"skeleton\"\n aria-hidden=\"true\"\n {...dataProps({ \"data-testid\": testId })}\n {...rest}\n style={{\n ...(width !== undefined && { width }),\n ...(height !== undefined && { height }),\n ...style,\n }}\n className={cn(skeletonVariants({ shape, size }), !animate && \"animate-none\", className)}\n />\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/components/skeleton/skeleton.tsx"],"names":[],"mappings":";;;;;AAsBA,IAAM,gBAAA,GAAmB,GAAA;AAAA,EACvB,CAAC,sEAAsE,CAAA;AAAA,EACvE;AAAA,IACE,QAAA,EAAU;AAAA,MACR,KAAA,EAAO;AAAA,QACL,WAAA,EAAa,mBAAA;AAAA,QACb,QAAA,EAAU;AAAA,OACZ;AAAA,MACA,IAAA,EAAM;AAAA,QACJ,EAAA,EAAI,EAAA;AAAA,QACJ,EAAA,EAAI,EAAA;AAAA,QACJ,EAAA,EAAI,EAAA;AAAA,QACJ,EAAA,EAAI,EAAA;AAAA,QACJ,EAAA,EAAI;AAAA;AACN,KACF;AAAA,IACA,gBAAA,EAAkB;AAAA,MAChB,EAAE,KAAA,EAAO,aAAA,EAAe,IAAA,EAAM,IAAA,EAAM,OAAO,KAAA,EAAM;AAAA,MACjD,EAAE,KAAA,EAAO,aAAA,E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M,CAAA,EAAG,CAAC,OAAA,IAAW,cAAA,EAAgB,SAAS;AAAA;AAAA,GACxF;AAEJ","file":"chunk-TWNIAF7K.js","sourcesContent":["import { cva, type VariantProps } from \"class-variance-authority\"\nimport type { ComponentPropsWithoutRef, CSSProperties, ReactNode } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { props as dataProps } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\n\n/**\n * Reproduces DataTable's own `DATA_TABLE_SKELETON_CLASS` exactly at the\n * rectangular default (`animate-pulse rounded-xs bg-black/15 dark:bg-white/8`)\n * — DataTable renders through this component internally, so pixel parity here\n * is load-bearing, not incidental. Monochrome by design: no `color` prop —\n * this is a shape axis, not a fill-treatment axis (see code-style.md's\n * variant/color split), and a loading placeholder should stay neutral rather\n * than compete with the content it precedes.\n *\n * `size` reuses the kit's shared `xs..xl` scale (`lib/sizes.ts`) at the same\n * `h-2..h-6` steps DataTable's own density scale already used — a text-line\n * bar height for `rectangular`, or (via the matching `size-2..size-6` step on\n * both axes) a small dot diameter for `circular`. Not wide enough for a\n * typical avatar circle by design — pass `width`/`height` for that.\n */\nconst skeletonVariants = cva(\n [\"animate-pulse bg-black/15 dark:bg-white/8 motion-reduce:animate-none\"],\n {\n variants: {\n shape: {\n rectangular: \"w-full rounded-xs\",\n circular: \"shrink-0 rounded-full\",\n },\n size: {\n xs: \"\",\n sm: \"\",\n md: \"\",\n lg: \"\",\n xl: \"\",\n },\n },\n compoundVariants: [\n { shape: \"rectangular\", size: \"xs\", class: \"h-2\" },\n { shape: \"rectangular\", size: \"sm\", class: \"h-3\" },\n { shape: \"rectangular\", size: \"md\", class: \"h-4\" },\n { shape: \"rectangular\", size: \"lg\", class: \"h-5\" },\n { shape: \"rectangular\", size: \"xl\", class: \"h-6\" },\n { shape: \"circular\", size: \"xs\", class: \"size-2\" },\n { shape: \"circular\", size: \"sm\", class: \"size-3\" },\n { shape: \"circular\", size: \"md\", class: \"size-4\" },\n { shape: \"circular\", size: \"lg\", class: \"size-5\" },\n { shape: \"circular\", size: \"xl\", class: \"size-6\" },\n ],\n defaultVariants: { shape: \"rectangular\", size: \"md\" },\n },\n)\n\nexport type SkeletonShape = NonNullable<VariantProps<typeof skeletonVariants>[\"shape\"]>\nexport type SkeletonSize = Size\n\nexport type SkeletonClassNames = {\n /** The placeholder box itself in wrap mode — separate from the wrapper's\n * own `className` so a caller can restyle just the placeholder (radius,\n * background) without touching the wrapper's layout. */\n skeleton?: string\n}\n\n/**\n * Skeleton — a loading placeholder. Not routed through Ark's `ark.*` factory\n * (no `asChild`): wrap mode below repurposes `children` to mean \"real content\n * to reveal,\" which collides with `asChild`'s usual meaning (the one child to\n * merge root props onto) — the same bespoke-primitive rationale as `Collapse`.\n *\n * **Standalone mode** (no `children`) — a fixed placeholder shape:\n *\n * <Skeleton />\n * <Skeleton shape=\"circular\" width={40} height={40} />\n *\n * **Wrap mode** (`children` passed) — sizes a placeholder to the real\n * content's own box (no measurement, pure CSS: the content stays mounted but\n * `invisible` while loading, so it keeps contributing its box to the relative\n * wrapper the placeholder absolutely fills), then reveals the content once\n * `loading` is `false`:\n *\n * <Skeleton loading={isLoading}>\n * <Avatar src={user.avatarUrl} />\n * </Skeleton>\n *\n * For complex card-style layouts, compose multiple `Skeleton`s inside the\n * kit's existing `Card`/`Flex`/`Grid` — Skeleton itself has no layout logic.\n *\n * The wrapper shrink-wraps to the content's *intrinsic* size (`inline-block`)\n * — content that itself stretches to fill its container (`w-full`, `flex-1`,\n * an unconstrained block paragraph) won't get a full-width overlay from wrap\n * mode alone. Add `className=\"block w-full\"` in that case, or use standalone\n * mode with an explicit `width` instead.\n */\nexport type SkeletonProps = ComponentPropsWithoutRef<\"div\"> &\n VariantProps<typeof skeletonVariants> &\n WithTestId & {\n /** Fixed width. Standalone mode only (no `children`) — wrap mode sizes\n * itself off the real content instead. Needed for an avatar-scale\n * `circular` placeholder, since `size`'s scale tops out at 24px. */\n width?: CSSProperties[\"width\"]\n /** Fixed height. Standalone mode only — see `width`. */\n height?: CSSProperties[\"height\"]\n /** Plays the pulse animation. Default `true`. */\n animate?: boolean\n /** Standalone (no `children`): `false` renders nothing. Wrap mode\n * (`children` set): `false` reveals the real children instead of the\n * placeholder. Default `true`. */\n loading?: boolean\n /** Wrap mode: real content to size the placeholder against, revealed\n * once `loading` is `false`. Omit for a standalone fixed-shape\n * placeholder. */\n children?: ReactNode\n classNames?: SkeletonClassNames\n }\n\nexport const Skeleton = ({\n className,\n classNames,\n shape,\n size,\n width,\n height,\n animate = true,\n loading = true,\n style,\n children,\n testId,\n ...rest\n}: SkeletonProps) => {\n if (children != null) {\n return (\n <div\n {...dataProps({ \"data-loading\": loading, \"aria-busy\": loading, \"data-testid\": testId })}\n {...rest}\n style={style}\n className={cn(\"relative inline-block\", className)}\n >\n <div\n data-part=\"content\"\n {...dataProps({ \"aria-hidden\": loading })}\n className={cn(loading && \"invisible\")}\n >\n {children}\n </div>\n {loading && (\n <div\n data-part=\"skeleton\"\n aria-hidden=\"true\"\n className={cn(\n skeletonVariants({ shape, size }),\n \"absolute inset-0 size-full\",\n !animate && \"animate-none\",\n classNames?.skeleton,\n )}\n />\n )}\n </div>\n )\n }\n\n if (!loading) return null\n\n return (\n <div\n data-part=\"skeleton\"\n aria-hidden=\"true\"\n {...dataProps({ \"data-testid\": testId })}\n {...rest}\n style={{\n ...(width !== undefined && { width }),\n ...(height !== undefined && { height }),\n ...style,\n }}\n className={cn(skeletonVariants({ shape, size }), !animate && \"animate-none\", className)}\n />\n )\n}\n"]}
@@ -1,8 +1,8 @@
1
- import { FieldShell, fieldA11yProps } from './chunk-45DFYIK5.js';
1
+ import { FieldShell, fieldA11yProps } from './chunk-VD6PB3VA.js';
2
2
  import { props } from './chunk-WYCMIIRR.js';
3
- import { focusStyles } from './chunk-3REFDGOM.js';
3
+ import { focusStyles } from './chunk-C6NVU4F7.js';
4
4
  import { TYPOGRAPHY_SHADE_CLASSES } from './chunk-GIPQUKCN.js';
5
- import { cn } from './chunk-QP4I37PA.js';
5
+ import { cn } from './chunk-4ASNIDV7.js';
6
6
  import { useFieldContext } from '@ark-ui/react/field';
7
7
  import { Slider as Slider$1 } from '@ark-ui/react/slider';
8
8
  import { cva } from 'class-variance-authority';
@@ -289,5 +289,5 @@ var Slider = ({
289
289
  };
290
290
 
291
291
  export { Slider };
292
- //# sourceMappingURL=chunk-4TCTMRR5.js.map
293
- //# sourceMappingURL=chunk-4TCTMRR5.js.map
292
+ //# sourceMappingURL=chunk-UAYENYS2.js.map
293
+ //# sourceMappingURL=chunk-UAYENYS2.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/slider/slider.tsx"],"names":["Ark"],"mappings":";;;;;;;;;;AA8CA,IAAM,YAAA,GAAe,CAAC,CAAA,KACpB,CAAA,KAAM,MAAA,GAAY,MAAA,GAAY,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA,GAAI,CAAA,GAAI,CAAC,CAAC,CAAA;AAEzD,IAAM,YAAA,GAAe,IAAI,EAAA,EAAI;AAAA,EAC3B,QAAA,EAAU;AAAA,IACR,IAAA,EAAM;AAAA,MACJ,EAAA,EAAI,QAAA;AAAA,MACJ,EAAA,EAAI,SAAA;AAAA,MACJ,EAAA,EAAI,SAAA;AAAA,MACJ,EAAA,EAAI,QAAA;AAAA,MACJ,EAAA,EAAI;AAAA;AACN,GACF;AAAA,EACA,eAAA,EAAiB,EAAE,IAAA,EAAM,IAAA;AAC3B,CAAC,CAAA;AAED,IAAM,WAAA,GAAc,GAAA;AAAA;AAAA;AAAA;AAAA,EAIlB;AAAA,IACE,4FAAA;AAAA,IACA,6EAAA;AAAA;AAAA;AAAA;AAAA,IAIA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMR,IAAA,EAAM;AAAA,QACJ,EAAA,EAAI,OAAA;AAAA,QACJ,EAAA,EAAI,KAAA;AAAA,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Y;AAAA,6BACd;AAAA,4BAEC,2BAAiB,GAAG;AAAA;AAAA;AACvB;AAAA,qBAAA;AAAA,oBA7BG;AAAA,mBAgCR,CAAA,EAEL;AAAA;AAAA;AAAA,aACF;AAAA,YAEC,SAAA,oBACC,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,iEAAA,EACb,QAAA,kBAAA,GAAA;AAAA,cAACA,QAAA,CAAI,WAAA;AAAA,cAAJ;AAAA,gBACC,SAAA,EAAW,EAAA;AAAA,kBACT,YAAA,CAAa,EAAE,IAAA,EAAM,CAAA;AAAA,kBACrB,wBAAA;AAAA,kBACA,UAAA,EAAY;AAAA,iBACd;AAAA,gBAEC,QAAA,EAAA,KAAA,CAAM,GAAA,CAAI,CAAC,CAAA,qBACV,GAAA;AAAA,kBAACA,QAAA,CAAI,MAAA;AAAA,kBAAJ;AAAA,oBAEC,OAAO,CAAA,CAAE,KAAA;AAAA,oBACT,SAAA,EAAW,GAAG,UAAA,CAAW,EAAE,MAAM,CAAA,EAAG,YAAY,IAAI,CAAA;AAAA,oBAEnD,QAAA,EAAA,CAAA,CAAE,UAAU,MAAA,oBACX,GAAA;AAAA,sBAAC,MAAA;AAAA,sBAAA;AAAA,wBACC,SAAA,EAAW,EAAA;AAAA,0BACT,mDAAA;AAAA,0BACA,SAAA;AAAA,0BACA,wBAAA,CAAyB,KAAA;AAAA,0BACzB,UAAA,EAAY;AAAA,yBACd;AAAA,wBAEC,QAAA,EAAA,CAAA,CAAE;AAAA;AAAA;AACL,mBAAA;AAAA,kBAdG,CAAA,CAAE;AAAA,iBAiBV;AAAA;AAAA,aACH,EACF;AAAA;AAAA;AAAA;AAEJ;AAAA,GACF;AAEJ","file":"chunk-4TCTMRR5.js","sourcesContent":["\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { Slider as Ark } from \"@ark-ui/react/slider\"\nimport { cva } from \"class-variance-authority\"\nimport type { ComponentProps, ComponentPropsWithoutRef, FocusEvent, ReactNode, Ref } from \"react\"\nimport type { ForbidAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { props } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TYPOGRAPHY_SHADE_CLASSES } from \"../../lib/typography-size\"\nimport { type FieldProps, FieldShell, fieldA11yProps } from \"../field/field\"\n\n/**\n * Slider — Range input on top of Ark UI's Slider state\n * machine. Ark owns keyboard nav, RTL flipping, drag math, and ARIA wiring;\n * this wrapper provides the styled parts and a flatter API.\n *\n * - Single or range. Pass a `number` for one thumb, or `[number, number]`\n * for a two-thumb range. The value shape drives everything: the callbacks\n * echo back the same shape, and a thumb (with its own label) is rendered\n * per value. The component is generic over the shape (`V`) so single-value\n * callers keep `number` types — no `number | number[]` leaking into their\n * handlers.\n * - `marks` paints filled dots on the track and an optional label below.\n * Dots between the thumbs (or up to the thumb, for a single value) read\n * as active.\n * - `label` / `description` / `error` / `required` come from the shared `Field`, like the rest\n * of the family: every thumb (`role=\"slider\"`) is named by `label` and described by\n * `description`, or by `error` once invalid.\n * - `thumbLabel` floats above each thumb; visible on hover/focus by default. Its function\n * form also becomes each thumb's `aria-valuetext`, so a screen reader hears \"40%\", not \"40\".\n * - Track/range/thumb parts can be overridden via `classNames`.\n *\n * Palette is delivered through the kit's `data-color` + slot-var system\n * (see `components.md` -> Color system). The root writes `data-color={color}`\n * and the range/thumb reference `--c-solid` — adding a new color in\n * `colors.css` works here for free, no slider edits needed.\n */\n\ntype SliderValue = number | number[]\n\n/** Wrap a scalar into Ark's array contract; pass arrays through untouched. */\nconst toValueArray = (v: SliderValue | undefined): number[] | undefined =>\n v === undefined ? undefined : Array.isArray(v) ? v : [v]\n\nconst marksWrapper = cva(\"\", {\n variants: {\n size: {\n xs: \"px-0.5\",\n sm: \"px-0.75\",\n md: \"px-1.25\",\n lg: \"px-1.5\",\n xl: \"px-1.5\",\n },\n },\n defaultVariants: { size: \"md\" },\n})\n\nconst sliderTrack = cva(\n // `overflow-x-clip overflow-y-visible` keeps the Range's rounded ends\n // clipped (so the filled bar follows the track's pill shape) while\n // letting mark labels spill below the track without being cut off.\n [\n \"relative w-full overflow-x-clip overflow-y-visible rounded-full bg-black/3 dark:bg-white/4\",\n \"cursor-pointer disabled:cursor-not-allowed data-disabled:cursor-not-allowed\",\n // Red invalid state — Ark stamps `data-invalid` on the root, so the track\n // (a descendant) reads it via `group-data-[invalid]`. Figma has no Slider error\n // variant, so it follows Field's: a `border-error-solid` outline, no red fill.\n \"group-data-[invalid]/slider:ring-1 group-data-[invalid]/slider:ring-red-500\",\n ],\n {\n variants: {\n // Padding matches half the dot width per size: the marker wrapper\n // lives inside the track as `relative`, so it occupies the track's\n // content box (padding-inset). Dot centers land at the inset edges,\n // and `-translate-x-1/2` puts the dot's outer edge flush with the\n // track's visible end. No first/last special-casing needed.\n size: {\n xs: \"h-0.5\",\n sm: \"h-1\",\n md: \"h-1.5\",\n lg: \"h-2\",\n xl: \"h-3\",\n },\n },\n defaultVariants: { size: \"md\" },\n },\n)\n\nconst sliderRange = cva(\n \"h-full bg-(--c-solid) data-disabled:bg-(--c-solid-disabled) rounded-full\",\n {\n variants: {\n size: {\n xs: \"\",\n sm: \"\",\n md: \"\",\n lg: \"\",\n xl: \"\",\n },\n },\n },\n)\n\nconst sliderThumb = cva(\n [\n \"block rounded-full border-2 bg-brand-50 dark:bg-brand-950 shadow-sm z-1\",\n \"border-(--c-solid)\",\n \"transition-transform\",\n \"cursor-pointer disabled:cursor-not-allowed data-disabled:cursor-not-allowed data-disabled:border-(--c-solid-disabled)\",\n focusStyles({ ring: \"palette\" }),\n \"data-dragging:scale-110\",\n ],\n {\n variants: {\n size: {\n xs: \"size-2.5 border-2\",\n sm: \"size-3 border-2\",\n md: \"size-4 border-3\",\n lg: \"size-5 border-4\",\n xl: \"size-6 border-4\",\n },\n },\n defaultVariants: { size: \"md\" },\n },\n)\n\nconst sliderMark = cva(\n [\n \"absolute top-1/2 -translate-y-1/2\",\n \"before:rounded-full\",\n \"before:absolute before:top-full before:-translate-y-1/2 before:-translate-x-1/2\",\n \"before:bg-brand-900/10 dark:before:bg-white/16 state-under-or-at:before:bg-(--c-solid-hover)\",\n ],\n {\n variants: {\n size: {\n xs: \"before:size-px\",\n sm: \"before:size-0.5\",\n md: \"before:size-1\",\n lg: \"before:size-1.5\",\n xl: \"before:size-2\",\n },\n },\n defaultVariants: { size: \"md\" },\n },\n)\n\n// Matches `sliderThumb`'s `size-*` variants above (border-box, so border\n// width doesn't add to the rendered box). Passed to Ark as a static\n// `thumbSize` so it skips its own runtime thumb measurement — that\n// measurement is lost (permanently, `thumbSize` collapses to 0) the first\n// time the value changes, which throws off the `thumbAlignment: \"contain\"`\n// edge-inset math used to position both the thumb and every mark.\nconst THUMB_DIAMETER_PX: Record<Size, number> = {\n xs: 10,\n sm: 12,\n md: 16,\n lg: 20,\n xl: 24,\n}\n\nexport type SliderSize = Size | null | undefined\n\ntype SliderMark = {\n value: number\n label?: ReactNode\n}\n\ntype SliderClassNames = {\n field?: string\n root?: string\n control?: string\n track?: string\n range?: string\n thumb?: string\n thumbLabel?: string\n mark?: string\n markGroup?: string\n markDot?: string\n markLabel?: string\n}\n\ntype ArkRootProps = ComponentPropsWithoutRef<typeof Ark.Root>\n\ntype ShowThumbLabel = boolean | \"hover\" | \"always\" | \"never\"\n\n/**\n * `V` is the value shape: `number` for a single thumb (the default), or\n * `number[]` (use `[number, number]`) for a two-thumb range. Inferred from\n * `value` / `defaultValue`, so callbacks echo back the same shape.\n */\nexport type SliderProps<V extends SliderValue = number> = Pick<\n FieldProps,\n \"label\" | \"description\" | \"error\" | \"required\"\n> &\n ForbidAsChild &\n Omit<\n ArkRootProps,\n | \"asChild\"\n | \"value\"\n | \"defaultValue\"\n | \"onValueChange\"\n | \"onValueChangeEnd\"\n | \"onChange\"\n | \"onBlur\"\n | \"ref\"\n | \"className\"\n > &\n WithTestId & {\n /** Controlled value. `number` for one thumb, `[number, number]` for a range. */\n value?: V\n /** Uncontrolled initial value. Its shape decides single vs. range. */\n defaultValue?: V\n /** Fires on every value change (drag, keyboard, click). */\n onChange?: (value: V) => void\n /** Fires once the interaction settles (mouseup / keyup). */\n onChangeEnd?: (value: V) => void\n /** Tick marks rendered on the track. */\n marks?: SliderMark[]\n /**\n * Floating bubble above each thumb. Pass a static node, a function that\n * receives a thumb's live value, or `null` to disable. A function returning\n * a string or number also sets each thumb's `aria-valuetext`. In an RSC tree\n * the function form must live in a `\"use client\"` module so the boundary\n * serializes it as a client reference.\n */\n thumbLabel?: ReactNode | ((value: number) => ReactNode) | null\n /**\n * When the `thumbLabel` bubble shows: `hover` (the default) on hover, focus\n * or drag; `true` / `always` all the time; `false` / `never` not at all.\n */\n showThumbLabel?: ShowThumbLabel\n /** @deprecated Renamed `showThumbLabel`, to match `thumbLabel`. */\n showLabel?: ShowThumbLabel\n size?: SliderSize\n color?: Color\n /** Red invalid state, independent of (and OR'd with) `error`. */\n invalid?: boolean\n /** Forwarded to the slider root; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLElement>) => void\n /** Lands on the first thumb (the `role=\"slider\"` element) for focus-on-error. */\n ref?: Ref<HTMLDivElement>\n className?: string\n classNames?: SliderClassNames\n }\n\n/** Ark's per-thumb `aria-label` / `aria-labelledby` arrays, as a range slider takes them. */\ntype ThumbNames = Pick<ArkRootProps, \"aria-label\" | \"aria-labelledby\">\n\n/**\n * One `role=\"slider\"` thumb, split out so it reads the `Field` context from *inside*\n * `FieldShell` — `Slider` itself renders that shell. Ark's Slider never reads a Field, so its\n * thumbs point `aria-labelledby` at their own never-rendered `Slider.Label`; this names each\n * thumb by the field's `label` instead and describes it by `description` / `error`. A caller's\n * own per-thumb `aria-label` / `aria-labelledby` (the way to tell a range's two thumbs apart)\n * still wins: Ark already puts it on the thumb, so the field's label is left out.\n */\nconst SliderThumb = ({\n index,\n names,\n ...thumbProps\n}: ComponentProps<typeof Ark.Thumb> & { names: ThumbNames }) => {\n const { \"aria-labelledby\": fieldLabel, ...described } = fieldA11yProps(useFieldContext())\n const ownName = names[\"aria-label\"]?.[index] ?? names[\"aria-labelledby\"]?.[index]\n return (\n <Ark.Thumb\n index={index}\n {...described}\n aria-labelledby={ownName == null ? fieldLabel : undefined}\n {...thumbProps}\n />\n )\n}\n\n/** A function bubble's text, as `aria-valuetext`; a node with no plain text falls back to the number. */\nconst toValueText =\n (format: (value: number) => ReactNode) =>\n ({ value }: { value: number }) => {\n const text = format(value)\n return typeof text === \"string\" || typeof text === \"number\" ? String(text) : String(value)\n }\n\nexport const Slider = <V extends SliderValue = number>({\n value,\n defaultValue,\n onChange,\n onChangeEnd,\n marks,\n label,\n thumbLabel,\n size,\n showLabel,\n showThumbLabel = showLabel ?? \"hover\",\n color,\n min = 0,\n max = 100,\n step,\n disabled,\n invalid,\n onBlur,\n ref,\n description,\n error,\n required,\n className,\n classNames,\n testId,\n asChild: _asChild,\n ...rest\n}: SliderProps<V>) => {\n const withThumbLabel =\n thumbLabel != null && showThumbLabel !== \"never\" && showThumbLabel !== false\n const renderThumbLabel = (val: number): ReactNode =>\n typeof thumbLabel === \"function\" ? thumbLabel(val) : thumbLabel\n const showMarks = marks !== null && marks !== undefined && marks.length > 0\n // Red state is driven independently of the `Field` error slot so a form\n // library can flip it from `fieldState.invalid` (see FormControlProps).\n const isInvalid = invalid || error != null\n\n // The emitted shape mirrors the controlled/default value: arrays stay\n // arrays (range), scalars stay scalars (single thumb).\n const isRange = Array.isArray(value ?? defaultValue)\n const emit = (next: number[]): V => (isRange ? next : (next[0] ?? 0)) as V\n\n const thumbDiameter = THUMB_DIAMETER_PX[size ?? \"md\"]\n\n return (\n <FieldShell\n label={label}\n description={description}\n error={error}\n required={required}\n disabled={disabled}\n size={size ?? \"md\"}\n className={classNames?.field}\n // One or two thumbs: nothing carries the label's `for` id; each thumb's `aria-labelledby` names it.\n composite\n >\n <Ark.Root\n value={toValueArray(value)}\n defaultValue={toValueArray(defaultValue)}\n onValueChange={onChange ? ({ value: v }) => onChange(emit(v)) : undefined}\n onValueChangeEnd={onChangeEnd ? ({ value: v }) => onChangeEnd(emit(v)) : undefined}\n min={min}\n max={max}\n step={step}\n disabled={disabled}\n onBlur={onBlur}\n thumbSize={{ width: thumbDiameter, height: thumbDiameter }}\n getAriaValueText={typeof thumbLabel === \"function\" ? toValueText(thumbLabel) : undefined}\n data-color={color}\n {...props({ \"data-invalid\": isInvalid, \"data-testid\": testId })}\n className={cn(\n \"group/slider relative flex w-full flex-col gap-2\",\n { \"mb-4\": showMarks },\n className,\n classNames?.root,\n )}\n {...rest}\n >\n <Ark.Control\n className={cn(\n \"relative flex w-full items-center py-2\",\n marksWrapper({ size }),\n classNames?.control,\n )}\n >\n <Ark.Track className={cn(sliderTrack({ size }), classNames?.track)}>\n <Ark.Range className={cn(sliderRange({ size }), classNames?.range)} />\n </Ark.Track>\n\n <Ark.Context>\n {(api) =>\n api.value.map((val, i) => (\n <SliderThumb\n // A thumb *is* its index: keyed by value, every step\n // remounted it and dropped keyboard focus after one key press.\n // biome-ignore lint/suspicious/noArrayIndexKey: the index is the thumb's identity\n key={i}\n index={i}\n names={{\n \"aria-label\": rest[\"aria-label\"],\n \"aria-labelledby\": rest[\"aria-labelledby\"],\n }}\n // The focusable element is the thumb (role=\"slider\"), so the\n // caller's `ref` lands on the first thumb for focus-on-error.\n ref={i === 0 ? ref : undefined}\n {...props({\n \"aria-invalid\": isInvalid,\n \"data-testid\": testId && `${testId}-thumb-${i}`,\n })}\n className={cn(sliderThumb({ size }), classNames?.thumb)}\n >\n <Ark.HiddenInput />\n {withThumbLabel && (\n <span\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none absolute -top-7 left-1/2 -translate-x-1/2 whitespace-nowrap rounded-md px-2 py-0.5 text-xs font-medium transition-opacity\",\n \"bg-brand-950 text-white dark:bg-white dark:text-brand-950\",\n showThumbLabel === \"hover\"\n ? \"opacity-0 group-hover/slider:opacity-100 group-focus-within/slider:opacity-100 group-data-dragging:opacity-100\"\n : \"opacity-100\",\n classNames?.thumbLabel,\n )}\n >\n {renderThumbLabel(val)}\n </span>\n )}\n </SliderThumb>\n ))\n }\n </Ark.Context>\n </Ark.Control>\n\n {showMarks && (\n <div className=\"absolute inset-0 h-full w-full select-none pointer-events-none \">\n <Ark.MarkerGroup\n className={cn(\n marksWrapper({ size }),\n \"w-full h-full relative\",\n classNames?.markGroup,\n )}\n >\n {marks.map((m) => (\n <Ark.Marker\n key={m.value}\n value={m.value}\n className={cn(sliderMark({ size }), classNames?.mark)}\n >\n {m.label !== undefined && (\n <span\n className={cn(\n \"absolute top-3/4 translate-y-3/4 -translate-x-1/2\",\n \"text-xs\",\n TYPOGRAPHY_SHADE_CLASSES.muted,\n classNames?.markLabel,\n )}\n >\n {m.label}\n </span>\n )}\n </Ark.Marker>\n ))}\n </Ark.MarkerGroup>\n </div>\n )}\n </Ark.Root>\n </FieldShell>\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/components/slider/slider.tsx"],"names":["Ark"],"mappings":";;;;;;;;;;AA8CA,IAAM,YAAA,GAAe,CAAC,CAAA,KACpB,CAAA,KAAM,MAAA,GAAY,MAAA,GAAY,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA,GAAI,CAAA,GAAI,CAAC,CAAC,CAAA;AAEzD,IAAM,YAAA,GAAe,IAAI,EAAA,EAAI;AAAA,EAC3B,QAAA,EAAU;AAAA,IACR,IAAA,EAAM;AAAA,MACJ,EAAA,EAAI,QAAA;AAAA,MACJ,EAAA,EAAI,SAAA;AAAA,MACJ,EAAA,EAAI,SAAA;AAAA,MACJ,EAAA,EAAI,QAAA;AAAA,MACJ,EAAA,EAAI;AAAA;AACN,GACF;AAAA,EACA,eAAA,EAAiB,EAAE,IAAA,EAAM,IAAA;AAC3B,CAAC,CAAA;AAED,IAAM,WAAA,GAAc,GAAA;AAAA;AAAA;AAAA;AAAA,E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AA,aACH,EACF;AAAA;AAAA;AAAA;AAEJ;AAAA,GACF;AAEJ","file":"chunk-UAYENYS2.js","sourcesContent":["\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { Slider as Ark } from \"@ark-ui/react/slider\"\nimport { cva } from \"class-variance-authority\"\nimport type { ComponentProps, ComponentPropsWithoutRef, FocusEvent, ReactNode, Ref } from \"react\"\nimport type { ForbidAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { props } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TYPOGRAPHY_SHADE_CLASSES } from \"../../lib/typography-size\"\nimport { type FieldProps, FieldShell, fieldA11yProps } from \"../field/field\"\n\n/**\n * Slider — Range input on top of Ark UI's Slider state\n * machine. Ark owns keyboard nav, RTL flipping, drag math, and ARIA wiring;\n * this wrapper provides the styled parts and a flatter API.\n *\n * - Single or range. Pass a `number` for one thumb, or `[number, number]`\n * for a two-thumb range. The value shape drives everything: the callbacks\n * echo back the same shape, and a thumb (with its own label) is rendered\n * per value. The component is generic over the shape (`V`) so single-value\n * callers keep `number` types — no `number | number[]` leaking into their\n * handlers.\n * - `marks` paints filled dots on the track and an optional label below.\n * Dots between the thumbs (or up to the thumb, for a single value) read\n * as active.\n * - `label` / `description` / `error` / `required` come from the shared `Field`, like the rest\n * of the family: every thumb (`role=\"slider\"`) is named by `label` and described by\n * `description`, or by `error` once invalid.\n * - `thumbLabel` floats above each thumb; visible on hover/focus by default. Its function\n * form also becomes each thumb's `aria-valuetext`, so a screen reader hears \"40%\", not \"40\".\n * - Track/range/thumb parts can be overridden via `classNames`.\n *\n * Palette is delivered through the kit's `data-color` + slot-var system\n * (see `components.md` -> Color system). The root writes `data-color={color}`\n * and the range/thumb reference `--c-solid` — adding a new color in\n * `colors.css` works here for free, no slider edits needed.\n */\n\ntype SliderValue = number | number[]\n\n/** Wrap a scalar into Ark's array contract; pass arrays through untouched. */\nconst toValueArray = (v: SliderValue | undefined): number[] | undefined =>\n v === undefined ? undefined : Array.isArray(v) ? v : [v]\n\nconst marksWrapper = cva(\"\", {\n variants: {\n size: {\n xs: \"px-0.5\",\n sm: \"px-0.75\",\n md: \"px-1.25\",\n lg: \"px-1.5\",\n xl: \"px-1.5\",\n },\n },\n defaultVariants: { size: \"md\" },\n})\n\nconst sliderTrack = cva(\n // `overflow-x-clip overflow-y-visible` keeps the Range's rounded ends\n // clipped (so the filled bar follows the track's pill shape) while\n // letting mark labels spill below the track without being cut off.\n [\n \"relative w-full overflow-x-clip overflow-y-visible rounded-full bg-black/3 dark:bg-white/4\",\n \"cursor-pointer disabled:cursor-not-allowed data-disabled:cursor-not-allowed\",\n // Red invalid state — Ark stamps `data-invalid` on the root, so the track\n // (a descendant) reads it via `group-data-[invalid]`. Figma has no Slider error\n // variant, so it follows Field's: a `border-error-solid` outline, no red fill.\n \"group-data-[invalid]/slider:ring-1 group-data-[invalid]/slider:ring-red-500\",\n ],\n {\n variants: {\n // Padding matches half the dot width per size: the marker wrapper\n // lives inside the track as `relative`, so it occupies the track's\n // content box (padding-inset). Dot centers land at the inset edges,\n // and `-translate-x-1/2` puts the dot's outer edge flush with the\n // track's visible end. No first/last special-casing needed.\n size: {\n xs: \"h-0.5\",\n sm: \"h-1\",\n md: \"h-1.5\",\n lg: \"h-2\",\n xl: \"h-3\",\n },\n },\n defaultVariants: { size: \"md\" },\n },\n)\n\nconst sliderRange = cva(\n \"h-full bg-(--c-solid) data-disabled:bg-(--c-solid-disabled) rounded-full\",\n {\n variants: {\n size: {\n xs: \"\",\n sm: \"\",\n md: \"\",\n lg: \"\",\n xl: \"\",\n },\n },\n },\n)\n\nconst sliderThumb = cva(\n [\n \"block rounded-full border-2 bg-brand-50 dark:bg-brand-950 shadow-sm z-1\",\n \"border-(--c-solid)\",\n \"transition-transform\",\n \"cursor-pointer disabled:cursor-not-allowed data-disabled:cursor-not-allowed data-disabled:border-(--c-solid-disabled)\",\n focusStyles({ ring: \"palette\" }),\n \"data-dragging:scale-110\",\n ],\n {\n variants: {\n size: {\n xs: \"size-2.5 border-2\",\n sm: \"size-3 border-2\",\n md: \"size-4 border-3\",\n lg: \"size-5 border-4\",\n xl: \"size-6 border-4\",\n },\n },\n defaultVariants: { size: \"md\" },\n },\n)\n\nconst sliderMark = cva(\n [\n \"absolute top-1/2 -translate-y-1/2\",\n \"before:rounded-full\",\n \"before:absolute before:top-full before:-translate-y-1/2 before:-translate-x-1/2\",\n \"before:bg-brand-900/10 dark:before:bg-white/16 state-under-or-at:before:bg-(--c-solid-hover)\",\n ],\n {\n variants: {\n size: {\n xs: \"before:size-px\",\n sm: \"before:size-0.5\",\n md: \"before:size-1\",\n lg: \"before:size-1.5\",\n xl: \"before:size-2\",\n },\n },\n defaultVariants: { size: \"md\" },\n },\n)\n\n// Matches `sliderThumb`'s `size-*` variants above (border-box, so border\n// width doesn't add to the rendered box). Passed to Ark as a static\n// `thumbSize` so it skips its own runtime thumb measurement — that\n// measurement is lost (permanently, `thumbSize` collapses to 0) the first\n// time the value changes, which throws off the `thumbAlignment: \"contain\"`\n// edge-inset math used to position both the thumb and every mark.\nconst THUMB_DIAMETER_PX: Record<Size, number> = {\n xs: 10,\n sm: 12,\n md: 16,\n lg: 20,\n xl: 24,\n}\n\nexport type SliderSize = Size | null | undefined\n\ntype SliderMark = {\n value: number\n label?: ReactNode\n}\n\ntype SliderClassNames = {\n field?: string\n root?: string\n control?: string\n track?: string\n range?: string\n thumb?: string\n thumbLabel?: string\n mark?: string\n markGroup?: string\n markDot?: string\n markLabel?: string\n}\n\ntype ArkRootProps = ComponentPropsWithoutRef<typeof Ark.Root>\n\ntype ShowThumbLabel = boolean | \"hover\" | \"always\" | \"never\"\n\n/**\n * `V` is the value shape: `number` for a single thumb (the default), or\n * `number[]` (use `[number, number]`) for a two-thumb range. Inferred from\n * `value` / `defaultValue`, so callbacks echo back the same shape.\n */\nexport type SliderProps<V extends SliderValue = number> = Pick<\n FieldProps,\n \"label\" | \"description\" | \"error\" | \"required\"\n> &\n ForbidAsChild &\n Omit<\n ArkRootProps,\n | \"asChild\"\n | \"value\"\n | \"defaultValue\"\n | \"onValueChange\"\n | \"onValueChangeEnd\"\n | \"onChange\"\n | \"onBlur\"\n | \"ref\"\n | \"className\"\n > &\n WithTestId & {\n /** Controlled value. `number` for one thumb, `[number, number]` for a range. */\n value?: V\n /** Uncontrolled initial value. Its shape decides single vs. range. */\n defaultValue?: V\n /** Fires on every value change (drag, keyboard, click). */\n onChange?: (value: V) => void\n /** Fires once the interaction settles (mouseup / keyup). */\n onChangeEnd?: (value: V) => void\n /** Tick marks rendered on the track. */\n marks?: SliderMark[]\n /**\n * Floating bubble above each thumb. Pass a static node, a function that\n * receives a thumb's live value, or `null` to disable. A function returning\n * a string or number also sets each thumb's `aria-valuetext`. In an RSC tree\n * the function form must live in a `\"use client\"` module so the boundary\n * serializes it as a client reference.\n */\n thumbLabel?: ReactNode | ((value: number) => ReactNode) | null\n /**\n * When the `thumbLabel` bubble shows: `hover` (the default) on hover, focus\n * or drag; `true` / `always` all the time; `false` / `never` not at all.\n */\n showThumbLabel?: ShowThumbLabel\n /** @deprecated Renamed `showThumbLabel`, to match `thumbLabel`. */\n showLabel?: ShowThumbLabel\n size?: SliderSize\n color?: Color\n /** Red invalid state, independent of (and OR'd with) `error`. */\n invalid?: boolean\n /** Forwarded to the slider root; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLElement>) => void\n /** Lands on the first thumb (the `role=\"slider\"` element) for focus-on-error. */\n ref?: Ref<HTMLDivElement>\n className?: string\n classNames?: SliderClassNames\n }\n\n/** Ark's per-thumb `aria-label` / `aria-labelledby` arrays, as a range slider takes them. */\ntype ThumbNames = Pick<ArkRootProps, \"aria-label\" | \"aria-labelledby\">\n\n/**\n * One `role=\"slider\"` thumb, split out so it reads the `Field` context from *inside*\n * `FieldShell` — `Slider` itself renders that shell. Ark's Slider never reads a Field, so its\n * thumbs point `aria-labelledby` at their own never-rendered `Slider.Label`; this names each\n * thumb by the field's `label` instead and describes it by `description` / `error`. A caller's\n * own per-thumb `aria-label` / `aria-labelledby` (the way to tell a range's two thumbs apart)\n * still wins: Ark already puts it on the thumb, so the field's label is left out.\n */\nconst SliderThumb = ({\n index,\n names,\n ...thumbProps\n}: ComponentProps<typeof Ark.Thumb> & { names: ThumbNames }) => {\n const { \"aria-labelledby\": fieldLabel, ...described } = fieldA11yProps(useFieldContext())\n const ownName = names[\"aria-label\"]?.[index] ?? names[\"aria-labelledby\"]?.[index]\n return (\n <Ark.Thumb\n index={index}\n {...described}\n aria-labelledby={ownName == null ? fieldLabel : undefined}\n {...thumbProps}\n />\n )\n}\n\n/** A function bubble's text, as `aria-valuetext`; a node with no plain text falls back to the number. */\nconst toValueText =\n (format: (value: number) => ReactNode) =>\n ({ value }: { value: number }) => {\n const text = format(value)\n return typeof text === \"string\" || typeof text === \"number\" ? String(text) : String(value)\n }\n\nexport const Slider = <V extends SliderValue = number>({\n value,\n defaultValue,\n onChange,\n onChangeEnd,\n marks,\n label,\n thumbLabel,\n size,\n showLabel,\n showThumbLabel = showLabel ?? \"hover\",\n color,\n min = 0,\n max = 100,\n step,\n disabled,\n invalid,\n onBlur,\n ref,\n description,\n error,\n required,\n className,\n classNames,\n testId,\n asChild: _asChild,\n ...rest\n}: SliderProps<V>) => {\n const withThumbLabel =\n thumbLabel != null && showThumbLabel !== \"never\" && showThumbLabel !== false\n const renderThumbLabel = (val: number): ReactNode =>\n typeof thumbLabel === \"function\" ? thumbLabel(val) : thumbLabel\n const showMarks = marks !== null && marks !== undefined && marks.length > 0\n // Red state is driven independently of the `Field` error slot so a form\n // library can flip it from `fieldState.invalid` (see FormControlProps).\n const isInvalid = invalid || error != null\n\n // The emitted shape mirrors the controlled/default value: arrays stay\n // arrays (range), scalars stay scalars (single thumb).\n const isRange = Array.isArray(value ?? defaultValue)\n const emit = (next: number[]): V => (isRange ? next : (next[0] ?? 0)) as V\n\n const thumbDiameter = THUMB_DIAMETER_PX[size ?? \"md\"]\n\n return (\n <FieldShell\n label={label}\n description={description}\n error={error}\n required={required}\n disabled={disabled}\n size={size ?? \"md\"}\n className={classNames?.field}\n // One or two thumbs: nothing carries the label's `for` id; each thumb's `aria-labelledby` names it.\n composite\n >\n <Ark.Root\n value={toValueArray(value)}\n defaultValue={toValueArray(defaultValue)}\n onValueChange={onChange ? ({ value: v }) => onChange(emit(v)) : undefined}\n onValueChangeEnd={onChangeEnd ? ({ value: v }) => onChangeEnd(emit(v)) : undefined}\n min={min}\n max={max}\n step={step}\n disabled={disabled}\n onBlur={onBlur}\n thumbSize={{ width: thumbDiameter, height: thumbDiameter }}\n getAriaValueText={typeof thumbLabel === \"function\" ? toValueText(thumbLabel) : undefined}\n data-color={color}\n {...props({ \"data-invalid\": isInvalid, \"data-testid\": testId })}\n className={cn(\n \"group/slider relative flex w-full flex-col gap-2\",\n { \"mb-4\": showMarks },\n className,\n classNames?.root,\n )}\n {...rest}\n >\n <Ark.Control\n className={cn(\n \"relative flex w-full items-center py-2\",\n marksWrapper({ size }),\n classNames?.control,\n )}\n >\n <Ark.Track className={cn(sliderTrack({ size }), classNames?.track)}>\n <Ark.Range className={cn(sliderRange({ size }), classNames?.range)} />\n </Ark.Track>\n\n <Ark.Context>\n {(api) =>\n api.value.map((val, i) => (\n <SliderThumb\n // A thumb *is* its index: keyed by value, every step\n // remounted it and dropped keyboard focus after one key press.\n // biome-ignore lint/suspicious/noArrayIndexKey: the index is the thumb's identity\n key={i}\n index={i}\n names={{\n \"aria-label\": rest[\"aria-label\"],\n \"aria-labelledby\": rest[\"aria-labelledby\"],\n }}\n // The focusable element is the thumb (role=\"slider\"), so the\n // caller's `ref` lands on the first thumb for focus-on-error.\n ref={i === 0 ? ref : undefined}\n {...props({\n \"aria-invalid\": isInvalid,\n \"data-testid\": testId && `${testId}-thumb-${i}`,\n })}\n className={cn(sliderThumb({ size }), classNames?.thumb)}\n >\n <Ark.HiddenInput />\n {withThumbLabel && (\n <span\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none absolute -top-7 left-1/2 -translate-x-1/2 whitespace-nowrap rounded-md px-2 py-0.5 text-xs font-medium transition-opacity\",\n \"bg-brand-950 text-white dark:bg-white dark:text-brand-950\",\n showThumbLabel === \"hover\"\n ? \"opacity-0 group-hover/slider:opacity-100 group-focus-within/slider:opacity-100 group-data-dragging:opacity-100\"\n : \"opacity-100\",\n classNames?.thumbLabel,\n )}\n >\n {renderThumbLabel(val)}\n </span>\n )}\n </SliderThumb>\n ))\n }\n </Ark.Context>\n </Ark.Control>\n\n {showMarks && (\n <div className=\"absolute inset-0 h-full w-full select-none pointer-events-none \">\n <Ark.MarkerGroup\n className={cn(\n marksWrapper({ size }),\n \"w-full h-full relative\",\n classNames?.markGroup,\n )}\n >\n {marks.map((m) => (\n <Ark.Marker\n key={m.value}\n value={m.value}\n className={cn(sliderMark({ size }), classNames?.mark)}\n >\n {m.label !== undefined && (\n <span\n className={cn(\n \"absolute top-3/4 translate-y-3/4 -translate-x-1/2\",\n \"text-xs\",\n TYPOGRAPHY_SHADE_CLASSES.muted,\n classNames?.markLabel,\n )}\n >\n {m.label}\n </span>\n )}\n </Ark.Marker>\n ))}\n </Ark.MarkerGroup>\n </div>\n )}\n </Ark.Root>\n </FieldShell>\n )\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { Button } from './chunk-NJ4RO3CT.js';
1
+ import { Button } from './chunk-SWVUXEBT.js';
2
2
  import { props } from './chunk-WYCMIIRR.js';
3
3
  import { ark } from '@ark-ui/react';
4
4
  import { useRef } from 'react';
@@ -89,5 +89,5 @@ var FileTrigger = ({
89
89
  };
90
90
 
91
91
  export { FileTrigger };
92
- //# sourceMappingURL=chunk-HDRC6ITF.js.map
93
- //# sourceMappingURL=chunk-HDRC6ITF.js.map
92
+ //# sourceMappingURL=chunk-UT3TOV2Q.js.map
93
+ //# sourceM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AAA;AAAA;AAAA;AAAA,sBAGC,GAAA;AAAA,QAAC,GAAA,CAAI,MAAA;AAAA,QAAJ;AAAA,UACC,OAAA,EAAO,IAAA;AAAA,UACP,QAAA;AAAA,UACC,GAAG,KAAA,CAAM,EAAE,eAAA,EAAiB,UAAU,CAAA;AAAA,UACtC,GAAG,OAAA;AAAA,UAEH;AAAA;AAAA;AACH,wBAEA,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,OAAA;AAAA,QACA,IAAA;AAAA,QACA,KAAA;AAAA,QACA,OAAA;AAAA,QACA,SAAA;AAAA,QACA,OAAA;AAAA,QACA,QAAA;AAAA,QACC,GAAG,OAAA;AAAA,QAEH;AAAA;AAAA,KACH;AAAA,oBAEF,GAAA;AAAA,MAAC,OAAA;AAAA,MAAA;AAAA,QACC,GAAA,EAAK,KAAA;AAAA,QACL,IAAA,EAAK,MAAA;AAAA,QACL,MAAA,EAAM,IAAA;AAAA,QACN,QAAA,EAAU,EAAA;AAAA,QACV,aAAA,EAAW,IAAA;AAAA,QACX,MAAA,EAAQ,MAAM,OAAA,CAAQ,MAAM,IAAI,MAAA,CAAO,IAAA,CAAK,GAAG,CAAA,GAAI,MAAA;AAAA,QACnD,OAAA;AAAA,QACA,QAAA;AAAA,QACA,IAAA;AAAA,QACA,QAAA;AAAA,QACA,QAAA,EAAU,MAAA;AAAA,QACV,YAAA,EAAW,cAAA;AAAA,QACX,WAAA,EAAU;AAAA;AAAA;AACZ,GAAA,EACF,CAAA;AAEJ","file":"chunk-HDRC6ITF.js","sourcesContent":["\"use client\"\n\nimport { ark } from \"@ark-ui/react\"\nimport { type ChangeEvent, type MouseEvent, useRef } from \"react\"\nimport { props } from \"../../lib/props\"\nimport { Button, type ButtonProps } from \"../button/button\"\n\n/**\n * FileTrigger — a button that opens the OS file picker (or, on a phone, the\n * native camera), backed by a hidden `<input type=\"file\">`. It has no\n * dropzone and no file list: it hands the picked `File[]` to `onSelect` and\n * leaves the rest to you. Reach for `FileUpload` when you want the full\n * field.\n *\n * - Renders a kit `Button` by default, and takes every Button prop. With\n * `asChild`, any element becomes the trigger: an `ActionIcon`, a link\n * styled as a button, a `Menu.Item`. Style the child then; Button's own\n * style props (`variant`, `size`, …) only apply to the default render.\n * - `capture` asks a phone for its camera instead of the library. Desktop\n * browsers ignore it and open the file picker.\n * - The input is cleared after each pick, so choosing the same file twice\n * fires `onSelect` twice. Pass `name` and the input keeps its files\n * instead, so a native `<form>` submits them.\n * - The trigger is the only element a keyboard or a screen reader reaches;\n * the input is `hidden`, out of the tab order and out of the a11y tree.\n *\n * ```tsx\n * <FileTrigger accept=\"image/*\" onSelect={([file]) => setAvatar(file)}>\n * Choose a photo\n * </FileTrigger>\n * ```\n */\n\nexport type FileTriggerProps = Omit<ButtonProps, \"onSelect\" | \"name\" | \"type\"> & {\n /** Accepted types: MIME types, globs or extensions (`\"image/*\"`, `[\".pdf\", \".docx\"]`). */\n accept?: string | string[]\n /** Opens a phone's camera, front (`\"user\"`) or back (`\"environment\"`), instead of the library. */\n capture?: \"user\" | \"environment\"\n /** Allows picking several files at once. */\n multiple?: boolean\n /** Fires with the picked files. */\n onSelect?: (files: File[]) => void\n /** Wires the hidden input into native form submission; the input then keeps its files. */\n name?: string\n}\n\nexport const FileTrigger = ({\n accept,\n capture,\n multiple,\n onSelect,\n name,\n disabled,\n asChild,\n children,\n testId,\n onClick,\n variant,\n size,\n color,\n loading,\n startSlot,\n endSlot,\n ...rest\n}: FileTriggerProps) => {\n const input = useRef<HTMLInputElement>(null)\n\n // `onClick` runs first, so a caller can `preventDefault()` to keep the\n // picker shut (a confirm step, a quota check).\n const open = (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event)\n if (!event.defaultPrevented && !disabled) input.current?.click()\n }\n\n const select = (event: ChangeEvent<HTMLInputElement>) => {\n onSelect?.(Array.from(event.currentTarget.files ?? []))\n // A file input only fires `change` when its value changes, so picking the\n // same file again would be silent. A named input is form state, so it\n // keeps what was picked.\n if (name == null) event.currentTarget.value = \"\"\n }\n\n const trigger = {\n \"data-scope\": \"file-trigger\",\n \"data-part\": \"trigger\",\n onClick: open,\n ...props({ \"data-testid\": testId, \"data-disabled\": disabled }),\n ...rest,\n }\n\n return (\n <>\n {asChild ? (\n // Only behaviour is merged onto the child: Button's styling would\n // fight an ActionIcon's or a link's own.\n <ark.button\n asChild\n disabled={disabled}\n {...props({ \"aria-disabled\": disabled })}\n {...trigger}\n >\n {children}\n </ark.button>\n ) : (\n <Button\n variant={variant}\n size={size}\n color={color}\n loading={loading}\n startSlot={startSlot}\n endSlot={endSlot}\n disabled={disabled}\n {...trigger}\n >\n {children}\n </Button>\n )}\n <input\n ref={input}\n type=\"file\"\n hidden\n tabIndex={-1}\n aria-hidden\n accept={Array.isArray(accept) ? accept.join(\",\") : accept}\n capture={capture}\n multiple={multiple}\n name={name}\n disabled={disabled}\n onChange={select}\n data-scope=\"file-trigger\"\n data-part=\"input\"\n />\n </>\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/components/file-trigger/file-trigger.tsx"],"names":[],"mappings":";;;;;;AA8CO,IAAM,cAAc,CAAC;AAAA,EAC1B,MAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,IAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA,SAAA;AAAA,EACA,OAAA;AAAA,EACA,GAAG;AACL,CAAA,KAAwB;AACtB,EAAA,MAAM,KAAA,GAAQ,OAAyB,IAAI,CAAA;AAI3C,EAAA,MAAM,IAAA,GAAO,CAAC,KAAA,KAAyC;AACrD,IAAA,OAAA,GAAU,KAAK,CAAA;AACf,IAAA,IAAI,CAAC,KAAA,CAAM,gBAAA,IAAoB,CAAC,QAAA,EAAU,KAAA,CAAM,SAAS,KAAA,E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,MAAM,OAAA,CAAQ,MAAM,IAAI,MAAA,CAAO,IAAA,CAAK,GAAG,CAAA,GAAI,MAAA;AAAA,QACnD,OAAA;AAAA,QACA,QAAA;AAAA,QACA,IAAA;AAAA,QACA,QAAA;AAAA,QACA,QAAA,EAAU,MAAA;AAAA,QACV,YAAA,EAAW,cAAA;AAAA,QACX,WAAA,EAAU;AAAA;AAAA;AACZ,GAAA,EACF,CAAA;AAEJ","file":"chunk-UT3TOV2Q.js","sourcesContent":["\"use client\"\n\nimport { ark } from \"@ark-ui/react\"\nimport { type ChangeEvent, type MouseEvent, useRef } from \"react\"\nimport { props } from \"../../lib/props\"\nimport { Button, type ButtonProps } from \"../button/button\"\n\n/**\n * FileTrigger — a button that opens the OS file picker (or, on a phone, the\n * native camera), backed by a hidden `<input type=\"file\">`. It has no\n * dropzone and no file list: it hands the picked `File[]` to `onSelect` and\n * leaves the rest to you. Reach for `FileUpload` when you want the full\n * field.\n *\n * - Renders a kit `Button` by default, and takes every Button prop. With\n * `asChild`, any element becomes the trigger: an `ActionIcon`, a link\n * styled as a button, a `Menu.Item`. Style the child then; Button's own\n * style props (`variant`, `size`, …) only apply to the default render.\n * - `capture` asks a phone for its camera instead of the library. Desktop\n * browsers ignore it and open the file picker.\n * - The input is cleared after each pick, so choosing the same file twice\n * fires `onSelect` twice. Pass `name` and the input keeps its files\n * instead, so a native `<form>` submits them.\n * - The trigger is the only element a keyboard or a screen reader reaches;\n * the input is `hidden`, out of the tab order and out of the a11y tree.\n *\n * ```tsx\n * <FileTrigger accept=\"image/*\" onSelect={([file]) => setAvatar(file)}>\n * Choose a photo\n * </FileTrigger>\n * ```\n */\n\nexport type FileTriggerProps = Omit<ButtonProps, \"onSelect\" | \"name\" | \"type\"> & {\n /** Accepted types: MIME types, globs or extensions (`\"image/*\"`, `[\".pdf\", \".docx\"]`). */\n accept?: string | string[]\n /** Opens a phone's camera, front (`\"user\"`) or back (`\"environment\"`), instead of the library. */\n capture?: \"user\" | \"environment\"\n /** Allows picking several files at once. */\n multiple?: boolean\n /** Fires with the picked files. */\n onSelect?: (files: File[]) => void\n /** Wires the hidden input into native form submission; the input then keeps its files. */\n name?: string\n}\n\nexport const FileTrigger = ({\n accept,\n capture,\n multiple,\n onSelect,\n name,\n disabled,\n asChild,\n children,\n testId,\n onClick,\n variant,\n size,\n color,\n loading,\n startSlot,\n endSlot,\n ...rest\n}: FileTriggerProps) => {\n const input = useRef<HTMLInputElement>(null)\n\n // `onClick` runs first, so a caller can `preventDefault()` to keep the\n // picker shut (a confirm step, a quota check).\n const open = (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event)\n if (!event.defaultPrevented && !disabled) input.current?.click()\n }\n\n const select = (event: ChangeEvent<HTMLInputElement>) => {\n onSelect?.(Array.from(event.currentTarget.files ?? []))\n // A file input only fires `change` when its value changes, so picking the\n // same file again would be silent. A named input is form state, so it\n // keeps what was picked.\n if (name == null) event.currentTarget.value = \"\"\n }\n\n const trigger = {\n \"data-scope\": \"file-trigger\",\n \"data-part\": \"trigger\",\n onClick: open,\n ...props({ \"data-testid\": testId, \"data-disabled\": disabled }),\n ...rest,\n }\n\n return (\n <>\n {asChild ? (\n // Only behaviour is merged onto the child: Button's styling would\n // fight an ActionIcon's or a link's own.\n <ark.button\n asChild\n disabled={disabled}\n {...props({ \"aria-disabled\": disabled })}\n {...trigger}\n >\n {children}\n </ark.button>\n ) : (\n <Button\n variant={variant}\n size={size}\n color={color}\n loading={loading}\n startSlot={startSlot}\n endSlot={endSlot}\n disabled={disabled}\n {...trigger}\n >\n {children}\n </Button>\n )}\n <input\n ref={input}\n type=\"file\"\n hidden\n tabIndex={-1}\n aria-hidden\n accept={Array.isArray(accept) ? accept.join(\",\") : accept}\n capture={capture}\n multiple={multiple}\n name={name}\n disabled={disabled}\n onChange={select}\n data-scope=\"file-trigger\"\n data-part=\"input\"\n />\n </>\n )\n}\n"]}