@chassis-ui/react 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (356) hide show
  1. package/README.md +4 -3
  2. package/dist/accordion.js +1 -1
  3. package/dist/alert.js +1 -1
  4. package/dist/autocomplete.d.ts +1 -1
  5. package/dist/autocomplete.js +1 -1
  6. package/dist/avatar.js +1 -1
  7. package/dist/badge.js +1 -1
  8. package/dist/breadcrumb.js +1 -1
  9. package/dist/button-group.js +1 -1
  10. package/dist/button.js +1 -1
  11. package/dist/calendar.js +1 -1
  12. package/dist/card.js +1 -1
  13. package/dist/carousel.js +1 -1
  14. package/dist/checkbox.d.ts +1 -1
  15. package/dist/checkbox.js +1 -1
  16. package/dist/chip-input.js +1 -1
  17. package/dist/chip.js +1 -1
  18. package/dist/chunks/Button-Cjenm3ku.js +2 -0
  19. package/dist/chunks/Button-Cjenm3ku.js.map +1 -0
  20. package/dist/chunks/{Chip-C7QlFCvx.js → Chip-CXuYhjc3.js} +2 -2
  21. package/dist/chunks/{Chip-C7QlFCvx.js.map → Chip-CXuYhjc3.js.map} +1 -1
  22. package/dist/chunks/CloseButton-CAQ--0sB.js +2 -0
  23. package/dist/chunks/CloseButton-CAQ--0sB.js.map +1 -0
  24. package/dist/chunks/{DateField-4cdcwt0v.js → DateField-G1TP9ayt.js} +2 -2
  25. package/dist/chunks/{DateField-4cdcwt0v.js.map → DateField-G1TP9ayt.js.map} +1 -1
  26. package/dist/chunks/{FormHelp-B1eSoack.js → FormHelp-2U3P8C6b.js} +2 -2
  27. package/dist/chunks/{FormHelp-B1eSoack.js.map → FormHelp-2U3P8C6b.js.map} +1 -1
  28. package/dist/chunks/Link-B3SX50Od.js +2 -0
  29. package/dist/chunks/Link-B3SX50Od.js.map +1 -0
  30. package/dist/chunks/Menu-DBN4Mxak.js +2 -0
  31. package/dist/chunks/Menu-DBN4Mxak.js.map +1 -0
  32. package/dist/chunks/MenuToggle-DHzKm1Ed.js +2 -0
  33. package/dist/chunks/MenuToggle-DHzKm1Ed.js.map +1 -0
  34. package/dist/chunks/{RangeCalendar-mM3OeTlU.js → RangeCalendar-DRcg1Hp3.js} +2 -2
  35. package/dist/chunks/{RangeCalendar-mM3OeTlU.js.map → RangeCalendar-DRcg1Hp3.js.map} +1 -1
  36. package/dist/chunks/{VisuallyHidden-CGv-mBuQ.js → VisuallyHidden-24WfUCsJ.js} +2 -2
  37. package/dist/chunks/{VisuallyHidden-CGv-mBuQ.js.map → VisuallyHidden-24WfUCsJ.js.map} +1 -1
  38. package/dist/chunks/{accordion-BZlX2uk8.js → accordion-DiYPbV_r.js} +2 -2
  39. package/dist/chunks/{accordion-BZlX2uk8.js.map → accordion-DiYPbV_r.js.map} +1 -1
  40. package/dist/chunks/alert-oSKrhxkI.js +2 -0
  41. package/dist/chunks/{alert-DSLg5MBb.js.map → alert-oSKrhxkI.js.map} +1 -1
  42. package/dist/chunks/autocomplete-wjDWeWDh.js +2 -0
  43. package/dist/chunks/autocomplete-wjDWeWDh.js.map +1 -0
  44. package/dist/chunks/{avatar-BQBbcnk6.js → avatar-CvcvC9KA.js} +2 -2
  45. package/dist/chunks/{avatar-BQBbcnk6.js.map → avatar-CvcvC9KA.js.map} +1 -1
  46. package/dist/chunks/{badge-Ths1Qn1a.js → badge-D7XgWBXc.js} +2 -2
  47. package/dist/chunks/{badge-Ths1Qn1a.js.map → badge-D7XgWBXc.js.map} +1 -1
  48. package/dist/chunks/{breadcrumb-BTiQikk-.js → breadcrumb-DxCHVppV.js} +2 -2
  49. package/dist/chunks/{breadcrumb-BTiQikk-.js.map → breadcrumb-DxCHVppV.js.map} +1 -1
  50. package/dist/chunks/{button-group-CefkGeYL.js → button-group-CXMj0D4r.js} +2 -2
  51. package/dist/chunks/{button-group-CefkGeYL.js.map → button-group-CXMj0D4r.js.map} +1 -1
  52. package/dist/chunks/{card-CEQgHIaL.js → card-C6lPZs5J.js} +2 -2
  53. package/dist/chunks/{card-CEQgHIaL.js.map → card-C6lPZs5J.js.map} +1 -1
  54. package/dist/chunks/carousel-Ka9OA-HJ.js +2 -0
  55. package/dist/chunks/carousel-Ka9OA-HJ.js.map +1 -0
  56. package/dist/chunks/checkbox-5jv0YWoi.js +2 -0
  57. package/dist/chunks/checkbox-5jv0YWoi.js.map +1 -0
  58. package/dist/chunks/chip-input-D8EaNujM.js +2 -0
  59. package/dist/chunks/chip-input-D8EaNujM.js.map +1 -0
  60. package/dist/chunks/{collapse-CBi3RWTf.js → collapse-Bc7fnmyU.js} +2 -2
  61. package/dist/chunks/{collapse-CBi3RWTf.js.map → collapse-Bc7fnmyU.js.map} +1 -1
  62. package/dist/chunks/color-input-DBOd4Jba.js +2 -0
  63. package/dist/chunks/color-input-DBOd4Jba.js.map +1 -0
  64. package/dist/chunks/combobox-DByuUtwh.js +2 -0
  65. package/dist/chunks/{combobox-BQh3uJWB.js.map → combobox-DByuUtwh.js.map} +1 -1
  66. package/dist/chunks/context-HDVxTNPi.js.map +1 -1
  67. package/dist/chunks/context-menu-CGOGliw6.js +2 -0
  68. package/dist/chunks/context-menu-CGOGliw6.js.map +1 -0
  69. package/dist/chunks/datagrid-Dv_9uFef.js +2 -0
  70. package/dist/chunks/datagrid-Dv_9uFef.js.map +1 -0
  71. package/dist/chunks/datepicker-DuYmXiSe.js +2 -0
  72. package/dist/chunks/datepicker-DuYmXiSe.js.map +1 -0
  73. package/dist/chunks/dialogTitle-DMBvXZLT.js +2 -0
  74. package/dist/chunks/dialogTitle-DMBvXZLT.js.map +1 -0
  75. package/dist/chunks/{divider-C1-NoKMV.js → divider-DbWmMSrn.js} +2 -2
  76. package/dist/chunks/{divider-C1-NoKMV.js.map → divider-DbWmMSrn.js.map} +1 -1
  77. package/dist/chunks/drawer-DPxF30qn.js +2 -0
  78. package/dist/chunks/drawer-DPxF30qn.js.map +1 -0
  79. package/dist/chunks/file-input-B5YaBXjI.js +2 -0
  80. package/dist/chunks/file-input-B5YaBXjI.js.map +1 -0
  81. package/dist/chunks/{flex-C2jV5LyV.js → flex-C6CbAkVJ.js} +2 -2
  82. package/dist/chunks/{flex-C2jV5LyV.js.map → flex-C6CbAkVJ.js.map} +1 -1
  83. package/dist/chunks/floating-input-B9YAJ9d4.js +2 -0
  84. package/dist/chunks/floating-input-B9YAJ9d4.js.map +1 -0
  85. package/dist/chunks/{form-field-Bcx96ezd.js → form-field-D74QY_wP.js} +2 -2
  86. package/dist/chunks/{form-field-Bcx96ezd.js.map → form-field-D74QY_wP.js.map} +1 -1
  87. package/dist/chunks/grid-BCVkow3u.js +2 -0
  88. package/dist/chunks/grid-BCVkow3u.js.map +1 -0
  89. package/dist/chunks/{index-5qsV1-cc.d.ts → index--DV9l24Q.d.ts} +18 -14
  90. package/dist/chunks/{index-BAvt_oPe.d.ts → index-B2d_pjjy.d.ts} +6 -5
  91. package/dist/chunks/{index-CbcFEGCh.d.ts → index-BIWaMOr6.d.ts} +9 -2
  92. package/dist/chunks/{index-3JVLrDHv.d.ts → index-BMAdUGiM.d.ts} +7 -1
  93. package/dist/chunks/{index-Cpifcw5a.d.ts → index-BzYAMLX1.d.ts} +44 -4
  94. package/dist/chunks/{index-BbZzaApz.d.ts → index-C9RqZNjk.d.ts} +7 -1
  95. package/dist/chunks/{index-D0Dhs7YI.d.ts → index-CHtvpvUh.d.ts} +6 -1
  96. package/dist/chunks/{index-Bl-_sC4y.d.ts → index-CSmHNy8M.d.ts} +8 -2
  97. package/dist/chunks/{index-Davd7Cue.d.ts → index-CXzKYWtS.d.ts} +3 -2
  98. package/dist/chunks/{index-OnB4_h6x.d.ts → index-DV_JBDoF.d.ts} +2 -2
  99. package/dist/chunks/{index-Es9I0fIS.d.ts → index-DjmN2hBX.d.ts} +2 -2
  100. package/dist/chunks/{index-UjmJQRaG.d.ts → index-DyB9XXLJ.d.ts} +3 -3
  101. package/dist/chunks/{index-CSRGr7pU.d.ts → index-JCnEw-55.d.ts} +2 -6
  102. package/dist/chunks/{index-Ctf5hLue.d.ts → index-Me921MYl.d.ts} +15 -13
  103. package/dist/chunks/{index-C-IrFdKe.d.ts → index-OgWCTy2Y.d.ts} +2 -2
  104. package/dist/chunks/{index-BZpHSGlk.d.ts → index-bZRQGwY7.d.ts} +7 -2
  105. package/dist/chunks/{index-Cm3rPbI1.d.ts → index-qJGkO-ni.d.ts} +3 -3
  106. package/dist/chunks/{input-adorn-DV9tuWXh.js → input-adorn-D0E3Afdf.js} +2 -2
  107. package/dist/chunks/{input-adorn-DV9tuWXh.js.map → input-adorn-D0E3Afdf.js.map} +1 -1
  108. package/dist/chunks/{input-group-YB_zoKud.js → input-group-paIBtI1R.js} +2 -2
  109. package/dist/chunks/{input-group-YB_zoKud.js.map → input-group-paIBtI1R.js.map} +1 -1
  110. package/dist/chunks/{list-BPBZR66Y.js → list-Ch6vxaUs.js} +2 -2
  111. package/dist/chunks/{list-BPBZR66Y.js.map → list-Ch6vxaUs.js.map} +1 -1
  112. package/dist/chunks/menu-DTe27h5q.js +2 -0
  113. package/dist/chunks/{menu-DEu-Nbv8.js.map → menu-DTe27h5q.js.map} +1 -1
  114. package/dist/chunks/modal-BDQe7xyy.js +2 -0
  115. package/dist/chunks/modal-BDQe7xyy.js.map +1 -0
  116. package/dist/chunks/nativeFormReset-DgsRU9SA.js +2 -0
  117. package/dist/chunks/nativeFormReset-DgsRU9SA.js.map +1 -0
  118. package/dist/chunks/nav-DDI8Dv28.js +2 -0
  119. package/dist/chunks/nav-DDI8Dv28.js.map +1 -0
  120. package/dist/chunks/{nav-overflow-DpX_lRYf.js → nav-overflow-BxAhoMh3.js} +2 -2
  121. package/dist/chunks/{nav-overflow-DpX_lRYf.js.map → nav-overflow-BxAhoMh3.js.map} +1 -1
  122. package/dist/chunks/{navOverflow-C_QJmkPM.js → navOverflow-eSROB_mV.js} +2 -2
  123. package/dist/chunks/{navOverflow-C_QJmkPM.js.map → navOverflow-eSROB_mV.js.map} +1 -1
  124. package/dist/chunks/{navVariant-D4wiKS8I.js → navVariant-Bm5k8CY3.js} +2 -2
  125. package/dist/chunks/{navVariant-D4wiKS8I.js.map → navVariant-Bm5k8CY3.js.map} +1 -1
  126. package/dist/chunks/{navbar-C7dO0YRs.js → navbar-BYMKe2yW.js} +2 -2
  127. package/dist/chunks/{navbar-C7dO0YRs.js.map → navbar-BYMKe2yW.js.map} +1 -1
  128. package/dist/chunks/{notification-oIrUtDhl.js → notification-C1Sd4X7M.js} +2 -2
  129. package/dist/chunks/{notification-oIrUtDhl.js.map → notification-C1Sd4X7M.js.map} +1 -1
  130. package/dist/chunks/{number-field-ChPTSBwI.js → number-field-BIApgIlR.js} +2 -2
  131. package/dist/chunks/{number-field-ChPTSBwI.js.map → number-field-BIApgIlR.js.map} +1 -1
  132. package/dist/chunks/otp-input-CCkfFZID.js +2 -0
  133. package/dist/chunks/otp-input-CCkfFZID.js.map +1 -0
  134. package/dist/chunks/overlayPlacement-D2vfhhg3.js +2 -0
  135. package/dist/chunks/overlayPlacement-D2vfhhg3.js.map +1 -0
  136. package/dist/chunks/{pagination-Dvz8lccd.js → pagination-WINUPT_P.js} +2 -2
  137. package/dist/chunks/pagination-WINUPT_P.js.map +1 -0
  138. package/dist/chunks/placeholder-9rTlnMso.js +2 -0
  139. package/dist/chunks/{placeholder-SPoVRkKE.js.map → placeholder-9rTlnMso.js.map} +1 -1
  140. package/dist/chunks/polymorphic-mAKwlLiW.js +2 -0
  141. package/dist/chunks/{polymorphic-CZIFszAy.js.map → polymorphic-mAKwlLiW.js.map} +1 -1
  142. package/dist/chunks/popover-CrAJTevL.js +2 -0
  143. package/dist/chunks/popover-CrAJTevL.js.map +1 -0
  144. package/dist/chunks/{progress-CiSJDNwx.js → progress-CAqSu3jc.js} +2 -2
  145. package/dist/chunks/{progress-CiSJDNwx.js.map → progress-CAqSu3jc.js.map} +1 -1
  146. package/dist/chunks/{radio-C42F_5OD.js → radio-XlINMnQm.js} +2 -2
  147. package/dist/chunks/{radio-C42F_5OD.js.map → radio-XlINMnQm.js.map} +1 -1
  148. package/dist/chunks/range-input-tyImJHKI.js +2 -0
  149. package/dist/chunks/range-input-tyImJHKI.js.map +1 -0
  150. package/dist/chunks/{renderFormField-_6WswnEX.js → renderFormField-CaZ8-xrn.js} +2 -2
  151. package/dist/chunks/{renderFormField-_6WswnEX.js.map → renderFormField-CaZ8-xrn.js.map} +1 -1
  152. package/dist/chunks/{search-field-OFsb3t4L.js → search-field-CIYtMraB.js} +2 -2
  153. package/dist/chunks/{search-field-OFsb3t4L.js.map → search-field-CIYtMraB.js.map} +1 -1
  154. package/dist/chunks/select-CkucgA6H.js +2 -0
  155. package/dist/chunks/select-CkucgA6H.js.map +1 -0
  156. package/dist/chunks/{skeleton-B2blJGWj.js → skeleton-CXFwCjB9.js} +2 -2
  157. package/dist/chunks/{skeleton-B2blJGWj.js.map → skeleton-CXFwCjB9.js.map} +1 -1
  158. package/dist/chunks/slot-DagH0Gxq.js +2 -0
  159. package/dist/chunks/slot-DagH0Gxq.js.map +1 -0
  160. package/dist/chunks/{spinner-D8lQCW4u.js → spinner-BLQiCoQd.js} +2 -2
  161. package/dist/chunks/{spinner-D8lQCW4u.js.map → spinner-BLQiCoQd.js.map} +1 -1
  162. package/dist/chunks/{stack-DtzW54UK.js → stack-OItr30SC.js} +2 -2
  163. package/dist/chunks/{stack-DtzW54UK.js.map → stack-OItr30SC.js.map} +1 -1
  164. package/dist/chunks/{stepper-tSA84huJ.js → stepper-BLjW7UnC.js} +2 -2
  165. package/dist/chunks/{stepper-tSA84huJ.js.map → stepper-BLjW7UnC.js.map} +1 -1
  166. package/dist/chunks/switch-nt7aXQDX.js +2 -0
  167. package/dist/chunks/switch-nt7aXQDX.js.map +1 -0
  168. package/dist/chunks/table-KtPHx4FG.js +2 -0
  169. package/dist/chunks/table-KtPHx4FG.js.map +1 -0
  170. package/dist/chunks/{tabs-DMFSLjnV.js → tabs-Dh5kH5Ik.js} +2 -2
  171. package/dist/chunks/{tabs-DMFSLjnV.js.map → tabs-Dh5kH5Ik.js.map} +1 -1
  172. package/dist/chunks/{text-input-CR73x-8D.js → text-input-D3jBYiLn.js} +2 -2
  173. package/dist/chunks/{text-input-CR73x-8D.js.map → text-input-D3jBYiLn.js.map} +1 -1
  174. package/dist/chunks/{textarea-C-1cMyH4.js → textarea-2BJCzT97.js} +2 -2
  175. package/dist/chunks/{textarea-C-1cMyH4.js.map → textarea-2BJCzT97.js.map} +1 -1
  176. package/dist/chunks/{time-field-CbCfOQZz.js → time-field-ClPbatW3.js} +2 -2
  177. package/dist/chunks/{time-field-CbCfOQZz.js.map → time-field-ClPbatW3.js.map} +1 -1
  178. package/dist/chunks/toast-D5-58Ch1.js +2 -0
  179. package/dist/chunks/toast-D5-58Ch1.js.map +1 -0
  180. package/dist/chunks/tooltip-TGFFlOJL.js +2 -0
  181. package/dist/chunks/tooltip-TGFFlOJL.js.map +1 -0
  182. package/dist/chunks/tree-BO0WSxQa.js +2 -0
  183. package/dist/chunks/tree-BO0WSxQa.js.map +1 -0
  184. package/dist/chunks/useButtonSemantics-DN3OIXtG.js +2 -0
  185. package/dist/chunks/useButtonSemantics-DN3OIXtG.js.map +1 -0
  186. package/dist/chunks/{useDialogElement-BfygWBPZ.js → useDialogElement-yEgUSejP.js} +2 -2
  187. package/dist/chunks/useDialogElement-yEgUSejP.js.map +1 -0
  188. package/dist/chunks/{useFormField-DH2tlc3e.js → useFormField-q21MOgh8.js} +2 -2
  189. package/dist/chunks/{useFormField-DH2tlc3e.js.map → useFormField-q21MOgh8.js.map} +1 -1
  190. package/dist/chunks/useFormReset-BK5Yb24_.js +2 -0
  191. package/dist/chunks/useFormReset-BK5Yb24_.js.map +1 -0
  192. package/dist/chunks/useHeldBack-o-CsPcSe.js +2 -0
  193. package/dist/chunks/useHeldBack-o-CsPcSe.js.map +1 -0
  194. package/dist/chunks/{useOpenStateProps-BhjSQ3f6.js → useOpenStateProps-CdSO1nmI.js} +2 -2
  195. package/dist/chunks/{useOpenStateProps-BhjSQ3f6.js.map → useOpenStateProps-CdSO1nmI.js.map} +1 -1
  196. package/dist/chunks/useOverlayMaxHeight-5UnurH0W.js +2 -0
  197. package/dist/chunks/useOverlayMaxHeight-5UnurH0W.js.map +1 -0
  198. package/dist/chunks/{useRequiredValueInput-gYN8I-LY.js → useRequiredValueInput-CL7AIgqz.js} +2 -2
  199. package/dist/chunks/{useRequiredValueInput-gYN8I-LY.js.map → useRequiredValueInput-CL7AIgqz.js.map} +1 -1
  200. package/dist/chunks/useSelectionForMode-B_oTWvEy.js +2 -0
  201. package/dist/chunks/useSelectionForMode-B_oTWvEy.js.map +1 -0
  202. package/dist/chunks/useToastRegionQueue-QHa4v7k6.js +2 -0
  203. package/dist/chunks/useToastRegionQueue-QHa4v7k6.js.map +1 -0
  204. package/dist/chunks/useTransitionState-WEw9C0yn.js +2 -0
  205. package/dist/chunks/useTransitionState-WEw9C0yn.js.map +1 -0
  206. package/dist/chunks/{visibleState-CWyQak65.js → visibleState-DVyxSMUT.js} +2 -2
  207. package/dist/chunks/{visibleState-CWyQak65.js.map → visibleState-DVyxSMUT.js.map} +1 -1
  208. package/dist/close-button.js +1 -1
  209. package/dist/collapse.js +1 -1
  210. package/dist/color-input.d.ts +1 -1
  211. package/dist/color-input.js +1 -1
  212. package/dist/combobox.js +1 -1
  213. package/dist/context-menu.js +1 -1
  214. package/dist/datagrid.d.ts +1 -1
  215. package/dist/datagrid.js +1 -1
  216. package/dist/datepicker.js +1 -1
  217. package/dist/divider.js +1 -1
  218. package/dist/drawer.d.ts +1 -1
  219. package/dist/drawer.js +1 -1
  220. package/dist/file-input.d.ts +1 -1
  221. package/dist/file-input.js +1 -1
  222. package/dist/flex.js +1 -1
  223. package/dist/floating-input.d.ts +1 -1
  224. package/dist/floating-input.js +1 -1
  225. package/dist/form-field.js +1 -1
  226. package/dist/form.js +1 -1
  227. package/dist/grid.js +1 -1
  228. package/dist/index.d.ts +19 -19
  229. package/dist/index.js +1 -1
  230. package/dist/input-adorn.js +1 -1
  231. package/dist/input-group.js +1 -1
  232. package/dist/link.js +1 -1
  233. package/dist/list.js +1 -1
  234. package/dist/menu.js +1 -1
  235. package/dist/modal.d.ts +1 -1
  236. package/dist/modal.js +1 -1
  237. package/dist/nav-overflow.js +1 -1
  238. package/dist/nav.d.ts +1 -1
  239. package/dist/nav.js +1 -1
  240. package/dist/navbar.js +1 -1
  241. package/dist/notification.js +1 -1
  242. package/dist/number-field.js +1 -1
  243. package/dist/otp-input.d.ts +1 -1
  244. package/dist/otp-input.js +1 -1
  245. package/dist/pagination.d.ts +1 -1
  246. package/dist/pagination.js +1 -1
  247. package/dist/placeholder.js +1 -1
  248. package/dist/popover.js +1 -1
  249. package/dist/progress.js +1 -1
  250. package/dist/radio.d.ts +1 -1
  251. package/dist/radio.js +1 -1
  252. package/dist/range-input.d.ts +1 -1
  253. package/dist/range-input.js +1 -1
  254. package/dist/search-field.js +1 -1
  255. package/dist/select.d.ts +1 -1
  256. package/dist/select.js +1 -1
  257. package/dist/skeleton.js +1 -1
  258. package/dist/spinner.js +1 -1
  259. package/dist/stack.js +1 -1
  260. package/dist/stepper.js +1 -1
  261. package/dist/style.css +1 -1
  262. package/dist/switch.d.ts +1 -1
  263. package/dist/switch.js +1 -1
  264. package/dist/table.d.ts +1 -1
  265. package/dist/table.js +1 -1
  266. package/dist/tabs.js +1 -1
  267. package/dist/text-input.js +1 -1
  268. package/dist/textarea.js +1 -1
  269. package/dist/time-field.js +1 -1
  270. package/dist/toast.d.ts +1 -1
  271. package/dist/toast.js +1 -1
  272. package/dist/tooltip.js +1 -1
  273. package/dist/tree.js +1 -1
  274. package/dist/visually-hidden.js +1 -1
  275. package/package.json +11 -11
  276. package/dist/chunks/Button-ZU-x1uN_.js +0 -2
  277. package/dist/chunks/Button-ZU-x1uN_.js.map +0 -1
  278. package/dist/chunks/CloseButton-BPUI5iGX.js +0 -2
  279. package/dist/chunks/CloseButton-BPUI5iGX.js.map +0 -1
  280. package/dist/chunks/Link-DE8NSAXJ.js +0 -2
  281. package/dist/chunks/Link-DE8NSAXJ.js.map +0 -1
  282. package/dist/chunks/Menu-264aGoBR.js +0 -2
  283. package/dist/chunks/Menu-264aGoBR.js.map +0 -1
  284. package/dist/chunks/MenuToggle-DcPEh55c.js +0 -2
  285. package/dist/chunks/MenuToggle-DcPEh55c.js.map +0 -1
  286. package/dist/chunks/alert-DSLg5MBb.js +0 -2
  287. package/dist/chunks/autocomplete-99usnvgh.js +0 -2
  288. package/dist/chunks/autocomplete-99usnvgh.js.map +0 -1
  289. package/dist/chunks/carousel-DC-UGc6W.js +0 -2
  290. package/dist/chunks/carousel-DC-UGc6W.js.map +0 -1
  291. package/dist/chunks/checkbox-ko6CdtoT.js +0 -2
  292. package/dist/chunks/checkbox-ko6CdtoT.js.map +0 -1
  293. package/dist/chunks/chip-input-CugY8EOc.js +0 -2
  294. package/dist/chunks/chip-input-CugY8EOc.js.map +0 -1
  295. package/dist/chunks/color-input-C4zMWlvm.js +0 -2
  296. package/dist/chunks/color-input-C4zMWlvm.js.map +0 -1
  297. package/dist/chunks/combobox-BQh3uJWB.js +0 -2
  298. package/dist/chunks/context-menu-8KIuH4cJ.js +0 -2
  299. package/dist/chunks/context-menu-8KIuH4cJ.js.map +0 -1
  300. package/dist/chunks/datagrid-n9vFeXN1.js +0 -2
  301. package/dist/chunks/datagrid-n9vFeXN1.js.map +0 -1
  302. package/dist/chunks/datepicker-DqztYJD6.js +0 -2
  303. package/dist/chunks/datepicker-DqztYJD6.js.map +0 -1
  304. package/dist/chunks/drawer-CRv9jmbp.js +0 -2
  305. package/dist/chunks/drawer-CRv9jmbp.js.map +0 -1
  306. package/dist/chunks/file-input-D_Gl1h-T.js +0 -2
  307. package/dist/chunks/file-input-D_Gl1h-T.js.map +0 -1
  308. package/dist/chunks/floating-input-D4gWFfOU.js +0 -2
  309. package/dist/chunks/floating-input-D4gWFfOU.js.map +0 -1
  310. package/dist/chunks/grid-CkdPftit.js +0 -2
  311. package/dist/chunks/grid-CkdPftit.js.map +0 -1
  312. package/dist/chunks/menu-DEu-Nbv8.js +0 -2
  313. package/dist/chunks/modal-CHvsDTyl.js +0 -2
  314. package/dist/chunks/modal-CHvsDTyl.js.map +0 -1
  315. package/dist/chunks/nav-B4U_Hqs7.js +0 -2
  316. package/dist/chunks/nav-B4U_Hqs7.js.map +0 -1
  317. package/dist/chunks/otp-input-DUtCMg8P.js +0 -2
  318. package/dist/chunks/otp-input-DUtCMg8P.js.map +0 -1
  319. package/dist/chunks/overlayPlacement-Q6bcbXA5.js +0 -2
  320. package/dist/chunks/overlayPlacement-Q6bcbXA5.js.map +0 -1
  321. package/dist/chunks/pagination-Dvz8lccd.js.map +0 -1
  322. package/dist/chunks/placeholder-SPoVRkKE.js +0 -2
  323. package/dist/chunks/polymorphic-CZIFszAy.js +0 -2
  324. package/dist/chunks/popover-C_32yD9W.js +0 -2
  325. package/dist/chunks/popover-C_32yD9W.js.map +0 -1
  326. package/dist/chunks/range-input-DeZq_9S7.js +0 -2
  327. package/dist/chunks/range-input-DeZq_9S7.js.map +0 -1
  328. package/dist/chunks/select-DwyL6aqY.js +0 -2
  329. package/dist/chunks/select-DwyL6aqY.js.map +0 -1
  330. package/dist/chunks/slot-BQVx1Eew.js +0 -2
  331. package/dist/chunks/slot-BQVx1Eew.js.map +0 -1
  332. package/dist/chunks/switch-cp3IZg3L.js +0 -2
  333. package/dist/chunks/switch-cp3IZg3L.js.map +0 -1
  334. package/dist/chunks/table-CBTg5Yuq.js +0 -2
  335. package/dist/chunks/table-CBTg5Yuq.js.map +0 -1
  336. package/dist/chunks/toast-Dd0J2e1z.js +0 -2
  337. package/dist/chunks/toast-Dd0J2e1z.js.map +0 -1
  338. package/dist/chunks/tooltip-CmKeQwYw.js +0 -2
  339. package/dist/chunks/tooltip-CmKeQwYw.js.map +0 -1
  340. package/dist/chunks/tree-DNj_EfUl.js +0 -2
  341. package/dist/chunks/tree-DNj_EfUl.js.map +0 -1
  342. package/dist/chunks/useButtonSemantics-B1SbGaDO.js +0 -2
  343. package/dist/chunks/useButtonSemantics-B1SbGaDO.js.map +0 -1
  344. package/dist/chunks/useDialogElement-BfygWBPZ.js.map +0 -1
  345. package/dist/chunks/useDialogTitle-DiB4YDGI.js +0 -2
  346. package/dist/chunks/useDialogTitle-DiB4YDGI.js.map +0 -1
  347. package/dist/chunks/useFloatingOverlay-BuiI_CCn.js +0 -2
  348. package/dist/chunks/useFloatingOverlay-BuiI_CCn.js.map +0 -1
  349. package/dist/chunks/useHeldBack-eeTfpa_t.js +0 -2
  350. package/dist/chunks/useHeldBack-eeTfpa_t.js.map +0 -1
  351. package/dist/chunks/useOverlayMaxHeight-8mQL2Q6d.js +0 -2
  352. package/dist/chunks/useOverlayMaxHeight-8mQL2Q6d.js.map +0 -1
  353. package/dist/chunks/useToastRegionQueue-CuAMxAIA.js +0 -2
  354. package/dist/chunks/useToastRegionQueue-CuAMxAIA.js.map +0 -1
  355. package/dist/chunks/useTransitionState-sQUQey74.js +0 -2
  356. package/dist/chunks/useTransitionState-sQUQey74.js.map +0 -1
package/README.md CHANGED
@@ -30,8 +30,9 @@ The components render `@chassis-ui/css`'s markup and class names, so install bot
30
30
  npm install @chassis-ui/react @chassis-ui/css
31
31
  ```
32
32
 
33
- `@chassis-ui/css` is a peer dependency, pinned to one 0.x minor (`>=0.10.0 <0.11.0` today): before
34
- 1.0 a minor release of it can rename the tokens the components rely on.
33
+ `@chassis-ui/css` is a peer dependency, pinned to one 0.x minor (the range under
34
+ "Peer dependencies" below): before 1.0 a minor release of it can rename the tokens the components
35
+ rely on.
35
36
 
36
37
  ## Stylesheets
37
38
 
@@ -93,7 +94,7 @@ examples.
93
94
  ## Peer dependencies
94
95
 
95
96
  - `react` and `react-dom`: `^19.0.0`
96
- - `@chassis-ui/css`: `>=0.11.0 <0.12.0`
97
+ - `@chassis-ui/css`: `>=0.12.0 <0.13.0`
97
98
 
98
99
  ## Browser support
99
100
 
package/dist/accordion.js CHANGED
@@ -1 +1 @@
1
- "use client";export{t as Accordion,i as AccordionBody,r as AccordionHeader,n as AccordionItem}from"./chunks/accordion-BZlX2uk8.js";
1
+ "use client";export{t as Accordion,i as AccordionBody,r as AccordionHeader,n as AccordionItem}from"./chunks/accordion-DiYPbV_r.js";
package/dist/alert.js CHANGED
@@ -1 +1 @@
1
- "use client";export{c as Alert,s as AlertBody,o as AlertCancel,a as AlertCode,i as AlertFooter,r as AlertIcon,n as AlertText,t as AlertTitle}from"./chunks/alert-DSLg5MBb.js";
1
+ "use client";export{c as Alert,s as AlertBody,o as AlertCancel,a as AlertCode,i as AlertFooter,r as AlertIcon,n as AlertText,t as AlertTitle}from"./chunks/alert-oSKrhxkI.js";
@@ -1,2 +1,2 @@
1
- import { a as Autocomplete, i as AutocompleteGroupProps, n as AutocompleteItemProps, o as AutocompleteProps, r as AutocompleteGroup, t as AutocompleteItem } from "./chunks/index-3JVLrDHv.js";
1
+ import { a as Autocomplete, i as AutocompleteGroupProps, n as AutocompleteItemProps, o as AutocompleteProps, r as AutocompleteGroup, t as AutocompleteItem } from "./chunks/index-BMAdUGiM.js";
2
2
  export { Autocomplete, AutocompleteGroup, type AutocompleteGroupProps, AutocompleteItem, type AutocompleteItemProps, type AutocompleteProps };
@@ -1 +1 @@
1
- "use client";export{t as Autocomplete,r as AutocompleteGroup,n as AutocompleteItem}from"./chunks/autocomplete-99usnvgh.js";
1
+ "use client";export{t as Autocomplete,r as AutocompleteGroup,n as AutocompleteItem}from"./chunks/autocomplete-wjDWeWDh.js";
package/dist/avatar.js CHANGED
@@ -1 +1 @@
1
- "use client";export{n as Avatar,r as AvatarImage,t as AvatarStack}from"./chunks/avatar-BQBbcnk6.js";
1
+ "use client";export{n as Avatar,r as AvatarImage,t as AvatarStack}from"./chunks/avatar-CvcvC9KA.js";
package/dist/badge.js CHANGED
@@ -1 +1 @@
1
- "use client";export{t as Badge}from"./chunks/badge-Ths1Qn1a.js";
1
+ "use client";export{t as Badge}from"./chunks/badge-D7XgWBXc.js";
@@ -1 +1 @@
1
- "use client";export{t as Breadcrumb,n as BreadcrumbItem}from"./chunks/breadcrumb-BTiQikk-.js";
1
+ "use client";export{t as Breadcrumb,n as BreadcrumbItem}from"./chunks/breadcrumb-DxCHVppV.js";
@@ -1 +1 @@
1
- "use client";export{n as ButtonGroup,t as ButtonToolbar}from"./chunks/button-group-CefkGeYL.js";
1
+ "use client";export{n as ButtonGroup,t as ButtonToolbar}from"./chunks/button-group-CXMj0D4r.js";
package/dist/button.js CHANGED
@@ -1 +1 @@
1
- "use client";import"./chunks/focus-ring-Bs80iIBN.js";export{t as Button}from"./chunks/Button-ZU-x1uN_.js";
1
+ "use client";import"./chunks/focus-ring-Bs80iIBN.js";export{t as Button}from"./chunks/Button-Cjenm3ku.js";
package/dist/calendar.js CHANGED
@@ -1 +1 @@
1
- "use client";import"./chunks/focus-ring-Bs80iIBN.js";export{n as Calendar,t as RangeCalendar}from"./chunks/RangeCalendar-mM3OeTlU.js";
1
+ "use client";import"./chunks/focus-ring-Bs80iIBN.js";export{n as Calendar,t as RangeCalendar}from"./chunks/RangeCalendar-DRcg1Hp3.js";
package/dist/card.js CHANGED
@@ -1 +1 @@
1
- "use client";export{a as Card,d as CardBody,u as CardFooter,i as CardGroup,r as CardHeader,l as CardImage,n as CardImageOverlay,t as CardLink,c as CardSubtitle,s as CardText,o as CardTitle}from"./chunks/card-CEQgHIaL.js";
1
+ "use client";export{a as Card,d as CardBody,u as CardFooter,i as CardGroup,r as CardHeader,l as CardImage,n as CardImageOverlay,t as CardLink,c as CardSubtitle,s as CardText,o as CardTitle}from"./chunks/card-C6lPZs5J.js";
package/dist/carousel.js CHANGED
@@ -1 +1 @@
1
- "use client";export{o as Carousel,a as CarouselControlNext,i as CarouselControlPrev,r as CarouselIndicators,s as CarouselInner,c as CarouselItem,n as CarouselOverlay,t as CarouselPlayPause}from"./chunks/carousel-DC-UGc6W.js";
1
+ "use client";export{o as Carousel,a as CarouselControlNext,i as CarouselControlPrev,r as CarouselIndicators,s as CarouselInner,c as CarouselItem,n as CarouselOverlay,t as CarouselPlayPause}from"./chunks/carousel-Ka9OA-HJ.js";
@@ -1,3 +1,3 @@
1
1
  import { t as ButtonObject } from "./chunks/renderFormCheck-nKgpa_a3.js";
2
- import { i as CheckboxProps, n as CheckboxGroupProps, r as Checkbox, t as CheckboxGroup } from "./chunks/index-D0Dhs7YI.js";
2
+ import { i as CheckboxProps, n as CheckboxGroupProps, r as Checkbox, t as CheckboxGroup } from "./chunks/index-CHtvpvUh.js";
3
3
  export { type ButtonObject, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps };
package/dist/checkbox.js CHANGED
@@ -1 +1 @@
1
- "use client";export{n as Checkbox,t as CheckboxGroup}from"./chunks/checkbox-ko6CdtoT.js";
1
+ "use client";export{n as Checkbox,t as CheckboxGroup}from"./chunks/checkbox-5jv0YWoi.js";
@@ -1 +1 @@
1
- "use client";export{t as ChipInput}from"./chunks/chip-input-CugY8EOc.js";
1
+ "use client";export{t as ChipInput}from"./chunks/chip-input-D8EaNujM.js";
package/dist/chip.js CHANGED
@@ -1 +1 @@
1
- "use client";import"./chunks/focus-ring-Bs80iIBN.js";export{t as Chip}from"./chunks/Chip-C7QlFCvx.js";
1
+ "use client";import"./chunks/focus-ring-Bs80iIBN.js";export{t as Chip}from"./chunks/Chip-CXuYhjc3.js";
@@ -0,0 +1,2 @@
1
+ import{b as e,f as t,m as n,v as r}from"./slot-DagH0Gxq.js";import{t as i}from"./polymorphic-mAKwlLiW.js";import{n as a,t as o}from"./useButtonSemantics-DN3OIXtG.js";import{t as s}from"./useDisabledAnchorGuard-CH6df46a.js";import c from"react";import l from"classnames";import{mergeProps as u}from"react-aria";function d({children:i,className:d,color:f=`primary`,component:p,disabled:m,href:h,onClick:g,pressed:_,shape:v,size:y,type:b,variant:x,...S},C){let w=b??`button`,T=n(p,h,`button`),E=r(T,h,S),D=E===`anchor`,O=t(E,h,`Button`),k=E===`component`,A=l(`button`,f,{outline:x===`outline`,smooth:x===`smooth`,link:x===`link`,active:_,disabled:E!==`button`&&m},y,v,d),j=s(D,m,g),{buttonProps:M,forkedRef:N}=a(C,{disabled:m,onClick:g,...o(S)}),P={className:A,onClick:j},F=_===void 0?{}:{"aria-pressed":_};if(E===`button`){let e=T;return/* @__PURE__ */ c.createElement(e,{...S,...P,...F,type:w,disabled:m,ref:C},i)}if(E===`input`){let e=T;return/* @__PURE__ */ c.createElement(e,{...S,...P,...F,type:w,disabled:m,ref:C})}if(D){let t=T;return/* @__PURE__ */ c.createElement(t,{...S,...P,...(e(T)??S.role)===`button`&&F,...O,...m&&{"aria-disabled":!0,tabIndex:-1},ref:C},i)}return/* @__PURE__ */ c.createElement(T,{...k?{disabled:m,onClick:g,...b!==void 0&&{type:b},...S}:u(S,M),className:A,...F,...O,ref:k?C:N},i)}const f=i(d,`Button`);export{f as t};
2
+ //# sourceMappingURL=Button-Cjenm3ku.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button-Cjenm3ku.js","names":["resolveSlottedRole","hrefProps","linkElement","resolveLinkKind","createPolymorphicComponent","useButtonSemantics","pickButtonSemantics","useDisabledAnchorGuard","React","classNames","ButtonRender","typeProp","rest","type","Component","component","href","kind","isAnchor","linkProps","isComponentReference","_className","color","variant","pressed","disabled","size","shape","className","handleClick","onClick","ref","sharedProps","pressedProps","NativeButton","children","NativeInput","Anchor","mergeProps","buttonProps","forkedRef","Button"],"sources":["../../src/components/button/Button.tsx"],"sourcesContent":["import React, {\n ElementType,\n ForwardRefRenderFunction,\n MouseEventHandler,\n ReactElement,\n Ref\n} from 'react'\nimport classNames from 'classnames'\nimport { mergeProps } from 'react-aria'\n\nimport { ContextColor, ContextStyle, Shapes } from '../../types'\nimport { pickButtonSemantics, useButtonSemantics, useDisabledAnchorGuard } from '../../hooks'\nimport {\n hrefProps,\n linkElement,\n resolveLinkKind,\n resolveSlottedRole\n} from '../../utils/elementKind'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef,\n PolymorphicRefWithFallback\n} from '../../utils/polymorphic'\n\ntype ButtonOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Sets the color of the component to one of Chassis context colors.\n */\n color?: ContextColor\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n /**\n * Toggle the disabled state for the component.\n */\n disabled?: boolean\n /**\n * The href attribute specifies the URL of the page the link goes to.\n */\n href?: string\n /**\n * Fires on click. Typed for every element `component` can actually render (`button`, `a`,\n * `input`, or a custom component), rather than narrowed to `HTMLButtonElement` alone.\n */\n onClick?: MouseEventHandler<HTMLButtonElement | HTMLAnchorElement | HTMLInputElement>\n /**\n * Marks the button as pressed for toggle-style usage (e.g. a formatting toolbar button).\n * Applies the `.active` class and sets `aria-pressed` so assistive technology announces\n * \"button, pressed\" rather than treating the button as a navigation link. A link (`href`, or\n * an `<a>` as `component` or the `asChild` element) has no pressed state to announce: it gets\n * the class alone, unless you give it `role=\"button\"`.\n */\n pressed?: boolean\n /**\n * Select the shape of the component.\n */\n shape?: Shapes\n /**\n * Size the component sm or lg.\n */\n size?: 'sm' | 'lg'\n /**\n * Specifies the type of button. Always specify the type attribute for the `<button>` element.\n * Different browsers may use different default types for the `<button>` element.\n */\n type?: 'button' | 'submit' | 'reset'\n /**\n * Set the button style variant. Same as `ContextStyle`, but `solid` (the unmodified default\n * look) doesn't apply as a class, and `link` — button-specific, not a context color — makes\n * the button look and behave like a hyperlink while keeping its `color`.\n */\n variant?: Exclude<ContextStyle, 'solid'> | 'link'\n}\n\nexport type ButtonProps<C extends ElementType = 'button'> = PolymorphicComponentProps<\n C,\n ButtonOwnProps<C>\n>\n\ntype ButtonComponent = (<C extends ElementType = 'button'>(\n props: ButtonProps<C> & {\n ref?: PolymorphicRefWithFallback<C, HTMLButtonElement | HTMLAnchorElement>\n }\n) => ReactElement | null) & { displayName?: string }\n\nfunction ButtonRender<C extends ElementType = 'button'>(\n {\n children,\n className,\n color = 'primary',\n component,\n disabled,\n href,\n onClick,\n pressed,\n shape,\n size,\n type: typeProp,\n variant,\n ...rest\n }: ButtonProps<C>,\n ref: PolymorphicRef<C>\n) {\n const type = typeProp ?? 'button'\n // `href` makes it an `<a>`, unless `component` or `asChild` chose the element (see\n // `linkElement`).\n const Component = linkElement(component, href, 'button')\n // The kind rather than the tag, counting a router link with `href` or `to` as an anchor: under `asChild`, `Component` is a `Slot` standing in for the\n // caller's element, and a slotted `<a>` needs what `component=\"a\"` gets.\n const kind = resolveLinkKind(Component, href, rest)\n const isAnchor = kind === 'anchor'\n const linkProps = hrefProps(kind, href, 'Button')\n\n // A component reference without a link target (a router link with `href` or `to` is an anchor,\n // see `resolveLinkKind`) has its own visual identity and is trusted to\n // handle its own keyboard/role semantics, same as `CloseButton`'s `isComponentReference` escape\n // hatch — synthesizing `role=\"button\"` and Enter/Space handling on top of it would stamp the\n // wrong ARIA role onto whatever it actually renders (e.g. an `<a>`) and can double-fire a click\n // (native anchor Enter→click, plus the synthesized keydown→click). Only a bare, non-native HTML\n // tag string (e.g. `'div'`) still needs `useButtonSemantics`'s synthesis.\n const isComponentReference = kind === 'component'\n\n const _className = classNames(\n 'button',\n color,\n {\n outline: variant === 'outline',\n smooth: variant === 'smooth',\n link: variant === 'link',\n active: pressed,\n disabled: kind !== 'button' && disabled\n },\n size,\n shape,\n className\n )\n\n // `<a>` has no real `disabled` attribute, so a disabled link button still fires click\n // (and still navigates) unless it's blocked here. Native `button`/`input` already stop\n // clicks on their own once the `disabled` attribute below is set.\n const handleClick = useDisabledAnchorGuard<\n HTMLButtonElement | HTMLAnchorElement | HTMLInputElement\n >(isAnchor, disabled, onClick)\n\n // Native `button`/`a`/`input` elements get keyboard activation, focus and disabled\n // handling for free from the browser. A custom `component` doesn't, so useButtonSemantics\n // fills in role, tabIndex and Enter/Space activation for it, matching native button behavior.\n // `ref` is cast for the same reason as the branches below — it's declared for whatever `C`\n // was passed, but this path (a non-native `component`) only ever populates it with a\n // button/anchor-shaped instance.\n const { buttonProps, forkedRef } = useButtonSemantics<HTMLButtonElement | HTMLAnchorElement>(\n ref as Ref<HTMLButtonElement | HTMLAnchorElement>,\n { disabled, onClick, ...pickButtonSemantics(rest) }\n )\n\n // Rendered as three separate branches (rather than one `<Component>` tag driven by a\n // `'button' | 'a' | 'input'`-typed variable) because a union-typed tag makes JSX\n // intersect all three elements' prop types — `onClick`/`ref` would then need to satisfy\n // `button`, `a` *and* `input` simultaneously, which `handleClick`/`ref`'s real, narrower\n // types can't. Each branch renders `Component` typed as its tag: that is the tag itself, or\n // the `Slot` holding the caller's element of that kind. `ref` is cast per branch since it's\n // declared for the generic `C`, not the specific element each branch actually renders (true by\n // construction — each branch's ref only ever populates with a matching instance). The props\n // common to all three (className/onClick) are factored out here so a future addition only\n // needs to change one place, not three.\n const sharedProps = {\n className: _className,\n onClick: handleClick\n }\n // `aria-pressed` is a state of the button role, which a `<button>`, a button `<input>` and an\n // element given button semantics below have. A link doesn't take it (axe's `aria-allowed-attr`),\n // so an anchor gets it only when the caller made it a button. Without `pressed`, a caller's own\n // `aria-pressed` (a toggle managed elsewhere, or `\"mixed\"`) stays: spread after `rest`, an\n // `undefined` here wrote over it.\n const pressedProps = pressed === undefined ? {} : { 'aria-pressed': pressed }\n\n if (kind === 'button') {\n const NativeButton = Component as 'button'\n return (\n <NativeButton\n {...(rest as Record<string, unknown>)}\n {...sharedProps}\n {...pressedProps}\n type={type}\n disabled={disabled}\n ref={ref as Ref<HTMLButtonElement>}\n >\n {children}\n </NativeButton>\n )\n }\n\n if (kind === 'input') {\n const NativeInput = Component as 'input'\n return (\n // `rest` is cast because it's typed generically, whose event handlers don't structurally\n // match `<input>`'s own `onChange` (value-change semantics) — `component=\"input\"` is a\n // fixed set of documented attributes (`type`, `value`, `disabled`, ...), not a\n // general-purpose input, so this is a safe, deliberate escape.\n <NativeInput\n {...(rest as Record<string, unknown>)}\n {...sharedProps}\n {...pressedProps}\n type={type}\n disabled={disabled}\n ref={ref as Ref<HTMLInputElement>}\n />\n )\n }\n\n if (isAnchor) {\n const Anchor = Component as 'a'\n return (\n // `rest` is cast for the same reason as the `input` branch above — it's typed generically,\n // whose DOM event handlers are parameterized for whatever `C` was passed, which don't\n // structurally match `<a>`'s own `HTMLAnchorElement` ones (e.g. `onCopy`), even though both\n // accept a real DOM event at runtime.\n <Anchor\n {...(rest as Record<string, unknown>)}\n {...sharedProps}\n {...((resolveSlottedRole(Component) ?? (rest as { role?: string }).role) === 'button' &&\n pressedProps)}\n {...linkProps}\n {...(disabled && { 'aria-disabled': true, tabIndex: -1 })}\n ref={ref as Ref<HTMLAnchorElement>}\n >\n {children}\n </Anchor>\n )\n }\n\n return (\n <Component\n {...(isComponentReference\n ? // A `type` given reaches the component too: it was taken here and dropped. The\n // default `'button'` doesn't, as nothing says the component renders a button.\n ({\n disabled,\n onClick,\n ...(typeProp !== undefined && { type: typeProp }),\n ...rest\n } as Record<string, unknown>)\n : (mergeProps(rest, buttonProps) as Record<string, unknown>))}\n className={_className}\n {...pressedProps}\n {...linkProps}\n ref={isComponentReference ? ref : forkedRef}\n >\n {children}\n </Component>\n )\n}\n\nexport const Button = createPolymorphicComponent<ButtonComponent>(\n ButtonRender as ForwardRefRenderFunction<Element, ButtonProps<ElementType>>,\n 'Button'\n)\n"],"mappings":"A,sTA2FA,SAASU,EACP,CACE,WACA,YACA,QAAQ,UACR,YACA,WACA,OACA,UACA,UACA,QACA,OACA,KAAMC,EACN,UACA,GAAGC,GAEL,EACA,CACA,IAAMC,EAAOF,GAAY,SAGnBG,EAAYZ,EAAYa,EAAWC,EAAM,QAAQ,EAGjDC,EAAOd,EAAgBW,EAAWE,EAAMJ,CAAI,EAC5CM,EAAWD,IAAS,SACpBE,EAAYlB,EAAUgB,EAAMD,EAAM,QAAQ,EAS1CI,EAAuBH,IAAS,YAEhCI,EAAaZ,EACjB,SACAa,EACA,CACE,QAASC,IAAY,UACrB,OAAQA,IAAY,SACpB,KAAMA,IAAY,OAClB,OAAQC,EACR,SAAUP,IAAS,UAAYQ,CACjC,EACAC,EACAC,EACAC,CACF,EAKMC,EAActB,EAElBW,EAAUO,EAAUK,CAAO,EAQvB,CAAE,cAAa,aAAczB,EACjC0B,EACA,CAAE,WAAU,UAAS,GAAGzB,EAAoBM,CAAI,CAAE,CACpD,EAYMoB,EAAc,CAClB,UAAWX,EACX,QAASQ,CACX,EAMMI,EAAeT,IAAY,IAAA,GAAY,CAAC,EAAI,CAAE,eAAgBA,CAAQ,EAE5E,GAAIP,IAAS,SAAU,CACrB,IAAMiB,EAAepB,EACrB,MACE,kBAAA,cAACoB,EAAD,CACE,GAAKtB,EACL,GAAIoB,EACJ,GAAIC,EACE,OACI,WACL,KAGO,EADXE,CACW,CAElB,CAEA,GAAIlB,IAAS,QAAS,CACpB,IAAMmB,EAActB,EACpB,MAKE,kBAAA,cAACsB,EAAD,CACE,GAAKxB,EACL,GAAIoB,EACJ,GAAIC,EACE,OACI,WACL,KACN,CAAA,CAEL,CAEA,GAAIf,EAAU,CACZ,IAAMmB,EAASvB,EACf,MAKE,kBAAA,cAACuB,EAAD,CACE,GAAKzB,EACL,GAAIoB,EACJ,IAAMhC,EAAmBc,CAAS,GAAMF,EAA2B,QAAU,UAC3EqB,EACF,GAAId,EACJ,GAAKM,GAAY,CAAE,gBAAiB,GAAM,SAAU,EAAG,EAClD,KAGC,EADLU,CACK,CAEZ,CAEA,MACE,kBAAA,cAACrB,EAAD,CACE,GAAKM,EAGA,CACC,WACA,UACA,GAAIT,IAAa,IAAA,IAAa,CAAE,KAAMA,CAAS,EAC/C,GAAGC,CACL,EACC0B,EAAW1B,EAAM2B,CAAW,EACjC,UAAWlB,EACX,GAAIY,EACJ,GAAId,EACJ,IAAKC,EAAuBW,EAAMS,CAGzB,EADRL,CACQ,CAEf,CAEA,MAAaM,EAASrC,EACpBM,EACA,QACF,E"}
@@ -1,2 +1,2 @@
1
- import{f as e,m as t,v as n}from"./slot-BQVx1Eew.js";import{t as r}from"./polymorphic-CZIFszAy.js";import{t as i}from"./useButtonSemantics-B1SbGaDO.js";import{t as a}from"./useDisabledAnchorGuard-CH6df46a.js";import o from"react";import s from"classnames";import{mergeProps as c}from"react-aria";function l({children:r,className:l,color:u,component:d,disabled:f,href:p,onClick:m,pressed:h,size:g,type:_=`button`,variant:v,...y},b){let x=t(d,p,`span`),S=n(x,p,y),C=e(S,p,`Chip`),w=S===`button`,T=S===`anchor`,E=s(`chip`,u,g,{outline:v===`outline`,smooth:v===`smooth`,active:h,disabled:!w&&f},l),D=a(!w,f,m),O=y.role!==void 0,k=!w&&!T&&!!m&&!O,{buttonProps:A,forkedRef:j}=i(b,{disabled:f,onClick:m});if(w){let e=x;return/* @__PURE__ */ o.createElement(e,{...y,"aria-pressed":h,className:E,disabled:f,onClick:D,ref:b,type:_},r)}if(T){let e=x;return/* @__PURE__ */ o.createElement(e,{...y,"aria-pressed":y.role===`button`?h:void 0,className:E,...C,onClick:D,...f&&{"aria-disabled":!0,tabIndex:-1},ref:b},r)}let M=k||y.role===`button`;return/* @__PURE__ */ o.createElement(x,{...c(y,k?A:{}),"aria-pressed":M?h:void 0,className:E,...!k&&{onClick:D},...f&&{"aria-disabled":!0},...C,ref:k?j:b},r)}const u=r(l,`Chip`);export{u as t};
2
- //# sourceMappingURL=Chip-C7QlFCvx.js.map
1
+ import{f as e,m as t,v as n}from"./slot-DagH0Gxq.js";import{t as r}from"./polymorphic-mAKwlLiW.js";import{n as i}from"./useButtonSemantics-DN3OIXtG.js";import{t as a}from"./useDisabledAnchorGuard-CH6df46a.js";import o from"react";import s from"classnames";import{mergeProps as c}from"react-aria";function l({children:r,className:l,color:u,component:d,disabled:f,href:p,onClick:m,pressed:h,size:g,type:_=`button`,variant:v,...y},b){let x=t(d,p,`span`),S=n(x,p,y),C=e(S,p,`Chip`),w=S===`button`,T=S===`anchor`,E=s(`chip`,u,g,{outline:v===`outline`,smooth:v===`smooth`,active:h,disabled:!w&&f},l),D=a(!w,f,m),O=y.role!==void 0,k=!w&&!T&&!!m&&!O,{buttonProps:A,forkedRef:j}=i(b,{disabled:f,onClick:m});if(w){let e=x;return/* @__PURE__ */ o.createElement(e,{...y,"aria-pressed":h,className:E,disabled:f,onClick:D,ref:b,type:_},r)}if(T){let e=x;return/* @__PURE__ */ o.createElement(e,{...y,"aria-pressed":y.role===`button`?h:void 0,className:E,...C,onClick:D,...f&&{"aria-disabled":!0,tabIndex:-1},ref:b},r)}let M=k||y.role===`button`;return/* @__PURE__ */ o.createElement(x,{...c(y,k?A:{}),"aria-pressed":M?h:void 0,className:E,...!k&&{onClick:D},...f&&{"aria-disabled":!0},...C,ref:k?j:b},r)}const u=r(l,`Chip`);export{u as t};
2
+ //# sourceMappingURL=Chip-CXuYhjc3.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Chip-C7QlFCvx.js","names":["hrefProps","linkElement","resolveLinkKind","createPolymorphicComponent","useButtonSemantics","useDisabledAnchorGuard","React","classNames","ChipRender","rest","Component","component","href","kind","linkProps","isButton","isAnchor","_className","color","size","variant","pressed","disabled","className","handleClick","onClick","hasExplicitRole","needsButtonSemantics","ref","NativeButton","children","Anchor","hasButtonRole","mergeProps","buttonProps","forkedRef","Chip"],"sources":["../../src/components/chip/Chip.tsx"],"sourcesContent":["import React, {\n ElementType,\n ForwardRefRenderFunction,\n MouseEventHandler,\n ReactElement,\n Ref\n} from 'react'\nimport classNames from 'classnames'\nimport { mergeProps } from 'react-aria'\n\nimport { ContextColor, ContextStyle } from '../../types'\nimport { useButtonSemantics, useDisabledAnchorGuard } from '../../hooks'\nimport { hrefProps, linkElement, resolveLinkKind } from '../../utils/elementKind'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef,\n PolymorphicRefWithFallback\n} from '../../utils/polymorphic'\n\ntype ChipOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Sets the color of the component to one of Chassis context colors.\n */\n color?: ContextColor\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n * Defaults to `span`, or `a` when `href` is set.\n */\n component?: C\n /**\n * Toggle the disabled state for the component. Applied as the native `disabled` attribute when\n * `component` is `button`, or the `.disabled` class for every other element (a bare `<span>`/\n * `<a>` has no real `disabled` attribute).\n */\n disabled?: boolean\n /**\n * Renders the chip as a link to this URL. Defaults `component` to `a`.\n */\n href?: string\n /**\n * Fires on click. Typed for every element `component` can actually render, rather than\n * narrowed to whichever element `C` happens to be.\n */\n onClick?: MouseEventHandler<HTMLElement>\n /**\n * Marks the chip as pressed for toggle-style usage (e.g. a filter chip). Applies the `.active`\n * class and sets `aria-pressed` so assistive technology announces the toggle state. A chip\n * with no `onClick` or `component=\"button\"` is not a button and gets the class alone: a static\n * chip, and a link (`href`, or an `<a>` as `component` or the `asChild` element), which has no\n * pressed state to announce unless you give it `role=\"button\"`.\n */\n pressed?: boolean\n /**\n * Size the component sm or lg.\n */\n size?: 'sm' | 'lg'\n /**\n * Specifies the type of button. Only applies when `component` is `button`. Different browsers\n * may use different default types for the `<button>` element, so always specify it explicitly.\n */\n type?: 'button' | 'submit' | 'reset'\n /**\n * Set the chip style variant. `solid`/`basic` render the default look with no extra class.\n */\n variant?: ContextStyle\n}\n\nexport type ChipProps<C extends ElementType = 'span'> = PolymorphicComponentProps<\n C,\n ChipOwnProps<C>\n>\n\ntype ChipComponent = (<C extends ElementType = 'span'>(\n props: ChipProps<C> & { ref?: PolymorphicRefWithFallback<C, HTMLSpanElement | HTMLAnchorElement> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction ChipRender<C extends ElementType = 'span'>(\n {\n children,\n className,\n color,\n component,\n disabled,\n href,\n onClick,\n pressed,\n size,\n type = 'button',\n variant,\n ...rest\n }: ChipProps<C>,\n ref: PolymorphicRef<C>\n) {\n // `href` makes it an `<a>`, unless `component` or `asChild` chose the element (see\n // `linkElement`).\n const Component = linkElement(component, href, 'span')\n // The kind rather than the tag, counting a router link with `href` or `to` as an anchor: under `asChild`, `Component` is a `Slot` standing in for the\n // caller's element, and a slotted `<a>` needs what `component=\"a\"` gets.\n const kind = resolveLinkKind(Component, href, rest)\n const linkProps = hrefProps(kind, href, 'Chip')\n const isButton = kind === 'button'\n const isAnchor = kind === 'anchor'\n\n const _className = classNames(\n 'chip',\n color,\n size,\n {\n outline: variant === 'outline',\n smooth: variant === 'smooth',\n active: pressed,\n disabled: !isButton && disabled\n },\n className\n )\n\n // `<a>`/`<span>`/`<div>` have no real `disabled` attribute, so a disabled non-button chip\n // still fires click (and an anchor still navigates) unless it's blocked here, same guard\n // `Button`/`CloseButton` apply.\n const handleClick = useDisabledAnchorGuard<HTMLElement>(!isButton, disabled, onClick)\n\n // A default (non-`button`/`a`) chip — the documented `pressed`/filter-chip use case — gets a\n // raw `onClick` with no keyboard semantics otherwise, the same gap `Link` fills via\n // `useButtonSemantics`. Skipped when the caller already supplied their own `role` via `rest`\n // (e.g. `ChipList`'s `role=\"row\"` grid semantics) — that caller is trusted to handle its own\n // keyboard interaction, same as `CloseButton`'s `isComponentReference` escape hatch.\n const hasExplicitRole = (rest as Record<string, unknown>).role !== undefined\n const needsButtonSemantics = !isButton && !isAnchor && !!onClick && !hasExplicitRole\n const { buttonProps, forkedRef } = useButtonSemantics<HTMLElement>(ref as Ref<HTMLElement>, {\n disabled,\n onClick\n })\n\n if (isButton) {\n const NativeButton = Component as 'button'\n return (\n <NativeButton\n {...(rest as Record<string, unknown>)}\n aria-pressed={pressed}\n className={_className}\n disabled={disabled}\n onClick={handleClick as MouseEventHandler<HTMLButtonElement>}\n ref={ref as Ref<HTMLButtonElement>}\n type={type}\n >\n {children}\n </NativeButton>\n )\n }\n\n if (isAnchor) {\n const Anchor = Component as 'a'\n return (\n // `aria-pressed` is a state of the button role, which a link doesn't have (axe's\n // `aria-allowed-attr`): an anchor gets it only when the caller made it a button, as\n // `Button` does. `.active` still shows it.\n <Anchor\n {...(rest as Record<string, unknown>)}\n aria-pressed={(rest as { role?: string }).role === 'button' ? pressed : undefined}\n className={_className}\n {...linkProps}\n onClick={handleClick as MouseEventHandler<HTMLAnchorElement>}\n {...(disabled && { 'aria-disabled': true, tabIndex: -1 })}\n ref={ref as Ref<HTMLAnchorElement>}\n >\n {children}\n </Anchor>\n )\n }\n\n // `aria-pressed` belongs to the button role alone: on a static chip, a span with no role, it is\n // an attribute the element can't take (axe's `aria-allowed-attr`). `.active` still shows it.\n const hasButtonRole = needsButtonSemantics || (rest as Record<string, unknown>).role === 'button'\n\n return (\n <Component\n {...(mergeProps(rest, needsButtonSemantics ? buttonProps : {}) as Record<string, unknown>)}\n aria-pressed={hasButtonRole ? pressed : undefined}\n className={_className}\n {...(!needsButtonSemantics && { onClick: handleClick })}\n {...(disabled && { 'aria-disabled': true })}\n {...linkProps}\n ref={needsButtonSemantics ? forkedRef : ref}\n >\n {children}\n </Component>\n )\n}\n\nexport const Chip = createPolymorphicComponent<ChipComponent>(\n ChipRender as ForwardRefRenderFunction<Element, ChipProps<ElementType>>,\n 'Chip'\n)\n"],"mappings":"A,wSAiFA,SAASQ,EACP,CACE,WACA,YACA,QACA,YACA,WACA,OACA,UACA,UACA,OACA,OAAO,SACP,UACA,GAAGC,GAEL,EACA,CAGA,IAAMC,EAAYT,EAAYU,EAAWC,EAAM,MAAM,EAG/CC,EAAOX,EAAgBQ,EAAWE,EAAMH,CAAI,EAC5CK,EAAYd,EAAUa,EAAMD,EAAM,MAAM,EACxCG,EAAWF,IAAS,SACpBG,EAAWH,IAAS,SAEpBI,EAAaV,EACjB,OACAW,EACAC,EACA,CACE,QAASC,IAAY,UACrB,OAAQA,IAAY,SACpB,OAAQC,EACR,SAAU,CAACN,GAAYO,CACzB,EACAC,CACF,EAKMC,EAAcnB,EAAoC,CAACU,EAAUO,EAAUG,CAAO,EAO9EC,EAAmBjB,EAAiC,OAAS,IAAA,GAC7DkB,EAAuB,CAACZ,GAAY,CAACC,GAAY,CAAC,CAACS,GAAW,CAACC,EAC/D,CAAE,cAAa,aAActB,EAAgCwB,EAAyB,CAC1F,WACA,SACF,CAAC,EAED,GAAIb,EAAU,CACZ,IAAMc,EAAenB,EACrB,MACE,kBAAA,cAACmB,EAAD,CACE,GAAKpB,EACL,eAAcY,EACd,UAAWJ,EACD,WACV,QAASO,EACJ,MACC,MAGM,EADXM,CACW,CAElB,CAEA,GAAId,EAAU,CACZ,IAAMe,EAASrB,EACf,MAIE,kBAAA,cAACqB,EAAD,CACE,GAAKtB,EACL,eAAeA,EAA2B,OAAS,SAAWY,EAAU,IAAA,GACxE,UAAWJ,EACX,GAAIH,EACJ,QAASU,EACT,GAAKF,GAAY,CAAE,gBAAiB,GAAM,SAAU,EAAG,EAClD,KAGC,EADLQ,CACK,CAEZ,CAIA,IAAME,EAAgBL,GAAyBlB,EAAiC,OAAS,SAEzF,MACE,kBAAA,cAACC,EAAD,CACE,GAAKuB,EAAWxB,EAAMkB,EAAuBO,EAAc,CAAC,CAAC,EAC7D,eAAcF,EAAgBX,EAAU,IAAA,GACxC,UAAWJ,EACX,GAAK,CAACU,GAAwB,CAAE,QAASH,CAAY,EACrD,GAAKF,GAAY,CAAE,gBAAiB,EAAK,EACzC,GAAIR,EACJ,IAAKa,EAAuBQ,EAAYP,CAG/B,EADRE,CACQ,CAEf,CAEA,MAAaM,EAAOjC,EAClBK,EACA,MACF,E"}
1
+ {"version":3,"file":"Chip-CXuYhjc3.js","names":["hrefProps","linkElement","resolveLinkKind","createPolymorphicComponent","useButtonSemantics","useDisabledAnchorGuard","React","classNames","ChipRender","rest","Component","component","href","kind","linkProps","isButton","isAnchor","_className","color","size","variant","pressed","disabled","className","handleClick","onClick","hasExplicitRole","needsButtonSemantics","ref","NativeButton","children","Anchor","hasButtonRole","mergeProps","buttonProps","forkedRef","Chip"],"sources":["../../src/components/chip/Chip.tsx"],"sourcesContent":["import React, {\n ElementType,\n ForwardRefRenderFunction,\n MouseEventHandler,\n ReactElement,\n Ref\n} from 'react'\nimport classNames from 'classnames'\nimport { mergeProps } from 'react-aria'\n\nimport { ContextColor, ContextStyle } from '../../types'\nimport { useButtonSemantics, useDisabledAnchorGuard } from '../../hooks'\nimport { hrefProps, linkElement, resolveLinkKind } from '../../utils/elementKind'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef,\n PolymorphicRefWithFallback\n} from '../../utils/polymorphic'\n\ntype ChipOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Sets the color of the component to one of Chassis context colors.\n */\n color?: ContextColor\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n * Defaults to `span`, or `a` when `href` is set.\n */\n component?: C\n /**\n * Toggle the disabled state for the component. Applied as the native `disabled` attribute when\n * `component` is `button`, or the `.disabled` class for every other element (a bare `<span>`/\n * `<a>` has no real `disabled` attribute).\n */\n disabled?: boolean\n /**\n * Renders the chip as a link to this URL. Defaults `component` to `a`.\n */\n href?: string\n /**\n * Fires on click. Typed for every element `component` can actually render, rather than\n * narrowed to whichever element `C` happens to be.\n */\n onClick?: MouseEventHandler<HTMLElement>\n /**\n * Marks the chip as pressed for toggle-style usage (e.g. a filter chip). Applies the `.active`\n * class and sets `aria-pressed` so assistive technology announces the toggle state. A chip\n * with no `onClick` or `component=\"button\"` is not a button and gets the class alone: a static\n * chip, and a link (`href`, or an `<a>` as `component` or the `asChild` element), which has no\n * pressed state to announce unless you give it `role=\"button\"`.\n */\n pressed?: boolean\n /**\n * Size the component sm or lg.\n */\n size?: 'sm' | 'lg'\n /**\n * Specifies the type of button. Only applies when `component` is `button`. Different browsers\n * may use different default types for the `<button>` element, so always specify it explicitly.\n */\n type?: 'button' | 'submit' | 'reset'\n /**\n * Set the chip style variant. `solid`/`basic` render the default look with no extra class.\n */\n variant?: ContextStyle\n}\n\nexport type ChipProps<C extends ElementType = 'span'> = PolymorphicComponentProps<\n C,\n ChipOwnProps<C>\n>\n\ntype ChipComponent = (<C extends ElementType = 'span'>(\n props: ChipProps<C> & { ref?: PolymorphicRefWithFallback<C, HTMLSpanElement | HTMLAnchorElement> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction ChipRender<C extends ElementType = 'span'>(\n {\n children,\n className,\n color,\n component,\n disabled,\n href,\n onClick,\n pressed,\n size,\n type = 'button',\n variant,\n ...rest\n }: ChipProps<C>,\n ref: PolymorphicRef<C>\n) {\n // `href` makes it an `<a>`, unless `component` or `asChild` chose the element (see\n // `linkElement`).\n const Component = linkElement(component, href, 'span')\n // The kind rather than the tag, counting a router link with `href` or `to` as an anchor: under `asChild`, `Component` is a `Slot` standing in for the\n // caller's element, and a slotted `<a>` needs what `component=\"a\"` gets.\n const kind = resolveLinkKind(Component, href, rest)\n const linkProps = hrefProps(kind, href, 'Chip')\n const isButton = kind === 'button'\n const isAnchor = kind === 'anchor'\n\n const _className = classNames(\n 'chip',\n color,\n size,\n {\n outline: variant === 'outline',\n smooth: variant === 'smooth',\n active: pressed,\n disabled: !isButton && disabled\n },\n className\n )\n\n // `<a>`/`<span>`/`<div>` have no real `disabled` attribute, so a disabled non-button chip\n // still fires click (and an anchor still navigates) unless it's blocked here, same guard\n // `Button`/`CloseButton` apply.\n const handleClick = useDisabledAnchorGuard<HTMLElement>(!isButton, disabled, onClick)\n\n // A default (non-`button`/`a`) chip — the documented `pressed`/filter-chip use case — gets a\n // raw `onClick` with no keyboard semantics otherwise, the same gap `Link` fills via\n // `useButtonSemantics`. Skipped when the caller already supplied their own `role` via `rest`\n // (e.g. `ChipList`'s `role=\"row\"` grid semantics) — that caller is trusted to handle its own\n // keyboard interaction, same as `CloseButton`'s `isComponentReference` escape hatch.\n const hasExplicitRole = (rest as Record<string, unknown>).role !== undefined\n const needsButtonSemantics = !isButton && !isAnchor && !!onClick && !hasExplicitRole\n const { buttonProps, forkedRef } = useButtonSemantics<HTMLElement>(ref as Ref<HTMLElement>, {\n disabled,\n onClick\n })\n\n if (isButton) {\n const NativeButton = Component as 'button'\n return (\n <NativeButton\n {...(rest as Record<string, unknown>)}\n aria-pressed={pressed}\n className={_className}\n disabled={disabled}\n onClick={handleClick as MouseEventHandler<HTMLButtonElement>}\n ref={ref as Ref<HTMLButtonElement>}\n type={type}\n >\n {children}\n </NativeButton>\n )\n }\n\n if (isAnchor) {\n const Anchor = Component as 'a'\n return (\n // `aria-pressed` is a state of the button role, which a link doesn't have (axe's\n // `aria-allowed-attr`): an anchor gets it only when the caller made it a button, as\n // `Button` does. `.active` still shows it.\n <Anchor\n {...(rest as Record<string, unknown>)}\n aria-pressed={(rest as { role?: string }).role === 'button' ? pressed : undefined}\n className={_className}\n {...linkProps}\n onClick={handleClick as MouseEventHandler<HTMLAnchorElement>}\n {...(disabled && { 'aria-disabled': true, tabIndex: -1 })}\n ref={ref as Ref<HTMLAnchorElement>}\n >\n {children}\n </Anchor>\n )\n }\n\n // `aria-pressed` belongs to the button role alone: on a static chip, a span with no role, it is\n // an attribute the element can't take (axe's `aria-allowed-attr`). `.active` still shows it.\n const hasButtonRole = needsButtonSemantics || (rest as Record<string, unknown>).role === 'button'\n\n return (\n <Component\n {...(mergeProps(rest, needsButtonSemantics ? buttonProps : {}) as Record<string, unknown>)}\n aria-pressed={hasButtonRole ? pressed : undefined}\n className={_className}\n {...(!needsButtonSemantics && { onClick: handleClick })}\n {...(disabled && { 'aria-disabled': true })}\n {...linkProps}\n ref={needsButtonSemantics ? forkedRef : ref}\n >\n {children}\n </Component>\n )\n}\n\nexport const Chip = createPolymorphicComponent<ChipComponent>(\n ChipRender as ForwardRefRenderFunction<Element, ChipProps<ElementType>>,\n 'Chip'\n)\n"],"mappings":"A,wSAiFA,SAASQ,EACP,CACE,WACA,YACA,QACA,YACA,WACA,OACA,UACA,UACA,OACA,OAAO,SACP,UACA,GAAGC,GAEL,EACA,CAGA,IAAMC,EAAYT,EAAYU,EAAWC,EAAM,MAAM,EAG/CC,EAAOX,EAAgBQ,EAAWE,EAAMH,CAAI,EAC5CK,EAAYd,EAAUa,EAAMD,EAAM,MAAM,EACxCG,EAAWF,IAAS,SACpBG,EAAWH,IAAS,SAEpBI,EAAaV,EACjB,OACAW,EACAC,EACA,CACE,QAASC,IAAY,UACrB,OAAQA,IAAY,SACpB,OAAQC,EACR,SAAU,CAACN,GAAYO,CACzB,EACAC,CACF,EAKMC,EAAcnB,EAAoC,CAACU,EAAUO,EAAUG,CAAO,EAO9EC,EAAmBjB,EAAiC,OAAS,IAAA,GAC7DkB,EAAuB,CAACZ,GAAY,CAACC,GAAY,CAAC,CAACS,GAAW,CAACC,EAC/D,CAAE,cAAa,aAActB,EAAgCwB,EAAyB,CAC1F,WACA,SACF,CAAC,EAED,GAAIb,EAAU,CACZ,IAAMc,EAAenB,EACrB,MACE,kBAAA,cAACmB,EAAD,CACE,GAAKpB,EACL,eAAcY,EACd,UAAWJ,EACD,WACV,QAASO,EACJ,MACC,MAGM,EADXM,CACW,CAElB,CAEA,GAAId,EAAU,CACZ,IAAMe,EAASrB,EACf,MAIE,kBAAA,cAACqB,EAAD,CACE,GAAKtB,EACL,eAAeA,EAA2B,OAAS,SAAWY,EAAU,IAAA,GACxE,UAAWJ,EACX,GAAIH,EACJ,QAASU,EACT,GAAKF,GAAY,CAAE,gBAAiB,GAAM,SAAU,EAAG,EAClD,KAGC,EADLQ,CACK,CAEZ,CAIA,IAAME,EAAgBL,GAAyBlB,EAAiC,OAAS,SAEzF,MACE,kBAAA,cAACC,EAAD,CACE,GAAKuB,EAAWxB,EAAMkB,EAAuBO,EAAc,CAAC,CAAC,EAC7D,eAAcF,EAAgBX,EAAU,IAAA,GACxC,UAAWJ,EACX,GAAK,CAACU,GAAwB,CAAE,QAASH,CAAY,EACrD,GAAKF,GAAY,CAAE,gBAAiB,EAAK,EACzC,GAAIR,EACJ,IAAKa,EAAuBQ,EAAYP,CAG/B,EADRE,CACQ,CAEf,CAEA,MAAaM,EAAOjC,EAClBK,EACA,MACF,E"}
@@ -0,0 +1,2 @@
1
+ import{f as e,m as t,v as n}from"./slot-DagH0Gxq.js";import{n as r,t as i}from"./lazyElement-tfMG21pZ.js";import{t as a}from"./polymorphic-mAKwlLiW.js";import{n as o,t as s}from"./useButtonSemantics-DN3OIXtG.js";import{t as c}from"./useDisabledAnchorGuard-CH6df46a.js";import{t as l}from"./Icon-Dk5_q79o.js";import u,{Children as d,Fragment as f,isValidElement as p}from"react";import m from"classnames";import{mergeProps as h}from"react-aria";const g=e=>d.toArray(e).some(e=>{let t=r(e);if(typeof t==`string`||typeof t==`number`)return String(t).trim()!==``;if(!p(t))return!1;let n=t.props;return n[`aria-hidden`]===!0||n[`aria-hidden`]===`true`?!1:n[`aria-label`]||n[`aria-labelledby`]||n.title?!0:n.children==null?typeof t.type!=`string`&&t.type!==f&&!i(t,l):g(n.children)});function _({children:r,className:i,color:a,component:l,disabled:d,href:f,label:p,onClick:_,size:v,type:y,variant:b,...x},S){let C=y??`button`,w=t(l,f,`button`),T=n(w,f,x),E=e(T,f,`CloseButton`),D=T===`component`,O=D?i:m(`close-button`,{context:a||b,disabled:T!==`button`&&d},a,b,v,i),k=p??(g(r)?void 0:`Close`),A=c(T===`anchor`,d,_),{buttonProps:j,forkedRef:M}=o(S,{disabled:d,onClick:_,...s(x)});if(T===`button`){let e=w;return/* @__PURE__ */ u.createElement(e,{className:O,"aria-label":k,...x,type:C,disabled:d,onClick:A,ref:S},r)}if(T===`anchor`){let e=w;return/* @__PURE__ */ u.createElement(e,{className:O,"aria-label":k,...x,...E,onClick:A,...d&&{"aria-disabled":!0,tabIndex:-1},ref:S},r)}let N=w;return/* @__PURE__ */ u.createElement(N,{className:O,"aria-label":k,...D?{color:a,size:v,variant:b,disabled:d,onClick:_,...y!==void 0&&{type:y},...x}:h(x,j),...E,ref:D?S:M},r)}const v=a(_,`CloseButton`);export{v as t};
2
+ //# sourceMappingURL=CloseButton-CAQ--0sB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloseButton-CAQ--0sB.js","names":["hrefProps","linkElement","resolveLinkKind","resolveLazy","isElementOfType","createPolymorphicComponent","useButtonSemantics","pickButtonSemantics","useDisabledAnchorGuard","Icon","React","classNames","namesItself","Children","children","node","child","isValidElement","props","Fragment","CloseButtonRender","typeProp","rest","type","component_","component","href","kind","linkProps","isComponentReference","_className","className","color","variant","disabled","size","_label","label","handleClick","onClick","ref","NativeButton","Anchor","Component","mergeProps","buttonProps","forkedRef","CloseButton"],"sources":["../../src/components/close-button/CloseButton.tsx"],"sourcesContent":["import React, {\n Children,\n ElementType,\n ForwardRefRenderFunction,\n Fragment,\n isValidElement,\n MouseEventHandler,\n ReactElement,\n ReactNode,\n Ref\n} from 'react'\nimport classNames from 'classnames'\nimport { mergeProps } from 'react-aria'\n\nimport { ContextColor, ContextStyle } from '../../types'\nimport { pickButtonSemantics, useButtonSemantics, useDisabledAnchorGuard } from '../../hooks'\nimport { hrefProps, linkElement, resolveLinkKind } from '../../utils/elementKind'\nimport { isElementOfType, resolveLazy } from '../../utils/lazyElement'\nimport { Icon } from '../icon/Icon'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef,\n PolymorphicRefWithFallback\n} from '../../utils/polymorphic'\n\n// Whether `children` give the button a name of their own: text, or an element that names itself\n// (`aria-label`, `aria-labelledby`, `Icon`'s `title`) or holds text. An icon swapped in for the\n// default one is `aria-hidden`, and names nothing. A component other than `Icon` given no children\n// renders what can't be read here (a `<FormattedMessage>`), and is taken to name the button, as\n// any child was before: the fallback would give it an English \"Close\" over its visible text. An\n// icon component of another library takes `aria-hidden`, or the button a `label`.\nconst namesItself = (children: ReactNode): boolean =>\n Children.toArray(children).some((child) => {\n const node = resolveLazy(child)\n if (typeof node === 'string' || typeof node === 'number') return String(node).trim() !== ''\n if (!isValidElement(node)) return false\n const props = node.props as Record<string, unknown>\n if (props['aria-hidden'] === true || props['aria-hidden'] === 'true') return false\n if (props['aria-label'] || props['aria-labelledby'] || props.title) return true\n if (props.children == null) {\n return typeof node.type !== 'string' && node.type !== Fragment && !isElementOfType(node, Icon)\n }\n return namesItself(props.children as ReactNode)\n })\n\ntype CloseButtonOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Sets the color of the component to one of Chassis context colors. Applies the\n * `context` class alongside it, so the icon picks up that color without needing\n * an ancestor `.context` wrapper.\n */\n color?: ContextColor\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n * A custom HTML tag (e.g. `'span'`) gets button semantics — role, focus, Enter/Space\n * activation — filled in automatically. A component is trusted to handle its own semantics,\n * so pass one that's already interactive (e.g. `Button`).\n */\n component?: C\n /**\n * Toggle the disabled state for the component.\n */\n disabled?: boolean\n /**\n * The href attribute specifies the URL of the page the link goes to. Renders an `<a>` in place\n * of the `<button>`, unless `component` or `asChild` chose the element.\n */\n href?: string\n /**\n * The accessible label announced by assistive technology. Override this to\n * localize the button for non-English contexts.\n */\n label?: string\n /**\n * Fires on click. Typed for every element `component` can actually render (`button` or `a`\n * natively, plus whatever a custom `component` renders), rather than narrowed to\n * `HTMLButtonElement` alone.\n */\n onClick?: MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>\n /**\n * Size the component sm or lg.\n */\n size?: 'sm' | 'lg'\n /**\n * Specifies the type of button. Always specify the type attribute for the `<button>` element.\n * Different browsers may use different default types for the `<button>` element.\n */\n type?: 'button' | 'submit' | 'reset'\n /**\n * Set the close button's context style variant. Applies the `context` class\n * alongside it, same as `color`.\n */\n variant?: ContextStyle\n}\n\nexport type CloseButtonProps<C extends ElementType = 'button'> = PolymorphicComponentProps<\n C,\n CloseButtonOwnProps<C>\n>\n\ntype CloseButtonComponent = (<C extends ElementType = 'button'>(\n props: CloseButtonProps<C> & {\n ref?: PolymorphicRefWithFallback<C, HTMLButtonElement | HTMLAnchorElement>\n }\n) => ReactElement | null) & { displayName?: string }\n\nfunction CloseButtonRender<C extends ElementType = 'button'>(\n {\n children,\n className,\n color,\n component,\n disabled,\n href,\n label,\n onClick,\n size,\n type: typeProp,\n variant,\n ...rest\n }: CloseButtonProps<C>,\n ref: PolymorphicRef<C>\n) {\n const type = typeProp ?? 'button'\n // `href` makes it an `<a>`, unless `component` or `asChild` chose the element (see\n // `linkElement`). It used to be dropped unless `component=\"a\"` was passed as well.\n const component_ = linkElement(component, href, 'button')\n // The kind rather than the tag, counting a router link with `href` or `to` as an anchor: under `asChild`, `component_` is a `Slot` standing in for the\n // caller's element, and a slotted `<a>` needs what `component=\"a\"` gets.\n const kind = resolveLinkKind(component_, href, rest)\n const linkProps = hrefProps(kind, href, 'CloseButton')\n\n // A component reference (e.g. `Button`) has its own visual identity and its own\n // `color`/`size`/`variant` semantics — CloseButton's icon styling (the `close-button`\n // class and its context/color/variant/size classes) would just conflict with it, and\n // would also swallow those props before the component ever saw them. So a component\n // reference gets none of CloseButton's own styling; `color`/`size`/`variant` pass\n // through untouched, same as `className`, letting the component interpret them itself.\n const isComponentReference = kind === 'component'\n\n // Only a bare, non-`button` HTML tag needs the `.disabled` class applied by hand — a real\n // `<button>` gets native `:disabled` styling for free (chassis-css matches both selectors,\n // `&:disabled, &.disabled`), and a component reference isn't styled by CloseButton at all\n // (see `isComponentReference` above).\n const _className = isComponentReference\n ? className\n : classNames(\n 'close-button',\n { context: color || variant, disabled: kind !== 'button' && disabled },\n color,\n variant,\n size,\n className\n )\n\n // The default icon-only close button has no visible text, so it needs the 'Close' fallback\n // as its accessible name, and so does one whose icon is swapped through `children`. Once\n // `children` name the button themselves (e.g. custom text passed through `component`), let\n // them be the accessible name instead — forcing the fallback label here would silently\n // override it (a Label-in-Name accessibility failure). An explicit `label` always wins either\n // way, same as an explicit `aria-label` always did.\n const _label = label ?? (namesItself(children) ? undefined : 'Close')\n\n // `<a>` has no real `disabled` attribute, so a disabled link close-button still fires\n // click (and still navigates) unless it's blocked here, same guard `Button` applies.\n const handleClick = useDisabledAnchorGuard<HTMLButtonElement | HTMLAnchorElement>(\n kind === 'anchor',\n disabled,\n onClick\n )\n\n const { buttonProps, forkedRef } = useButtonSemantics<HTMLButtonElement | HTMLAnchorElement>(\n ref as Ref<HTMLButtonElement | HTMLAnchorElement>,\n { disabled, onClick, ...pickButtonSemantics(rest) }\n )\n\n // Rendered as explicit branches, same as `Button`, rather than one `<Component>` tag\n // driven by a `'button' | 'a' | ElementType`-typed variable — a union-typed tag would\n // make JSX intersect all of `button`/`a`/custom prop types at once. Each branch renders\n // `component_` typed as its tag: the tag itself, or the `Slot` holding an element of that kind.\n // `aria-label={_label}` comes before `...rest` in every branch below so that an explicit\n // `aria-label` (not destructured above, so it lands in `rest`) overrides the computed\n // fallback via JSX's last-attribute-wins rule, rather than the other way around.\n if (kind === 'button') {\n const NativeButton = component_ as 'button'\n return (\n <NativeButton\n className={_className}\n aria-label={_label}\n {...(rest as Record<string, unknown>)}\n type={type}\n disabled={disabled}\n onClick={handleClick}\n ref={ref as Ref<HTMLButtonElement>}\n >\n {children}\n </NativeButton>\n )\n }\n\n if (kind === 'anchor') {\n const Anchor = component_ as 'a'\n return (\n <Anchor\n className={_className}\n aria-label={_label}\n {...(rest as Record<string, unknown>)}\n {...linkProps}\n onClick={handleClick}\n {...(disabled && { 'aria-disabled': true, tabIndex: -1 })}\n ref={ref as Ref<HTMLAnchorElement>}\n >\n {children}\n </Anchor>\n )\n }\n\n const Component = component_ as ElementType\n\n // Only a bare, non-`button`/`a` HTML tag (e.g. `'span'`) reaches here needing synthesized\n // button semantics — a component reference is trusted to already be interactive, so it\n // skips `buttonProps` (double keyboard activation) and instead gets `color`/`size`/`variant`\n // passed through untouched, per the comment on `isComponentReference` above.\n return (\n <Component\n className={_className}\n aria-label={_label}\n {...(isComponentReference\n ? // A `type` given reaches the component too, as `Button` passes it: it was taken here\n // and dropped. The default `'button'` doesn't, as nothing says the component renders\n // a button.\n ({\n color,\n size,\n variant,\n disabled,\n onClick,\n ...(typeProp !== undefined && { type: typeProp }),\n ...rest\n } as Record<string, unknown>)\n : (mergeProps(rest, buttonProps) as Record<string, unknown>))}\n {...linkProps}\n ref={isComponentReference ? ref : forkedRef}\n >\n {children}\n </Component>\n )\n}\n\nexport const CloseButton = createPolymorphicComponent<CloseButtonComponent>(\n CloseButtonRender as ForwardRefRenderFunction<Element, CloseButtonProps<ElementType>>,\n 'CloseButton'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YM,EACZ,GAAKd,EACC,OACI,WACV,QAASgB,EACJ,KAGO,EADXxB,CACW,CAElB,CAEA,GAAIa,IAAS,SAAU,CACrB,IAAMe,EAASlB,EACf,MACE,kBAAA,cAACkB,EAAD,CACE,UAAWZ,EACX,aAAYM,EACZ,GAAKd,EACL,GAAIM,EACJ,QAASU,EACT,GAAKJ,GAAY,CAAE,gBAAiB,GAAM,SAAU,EAAG,EAClD,KAGC,EADLpB,CACK,CAEZ,CAEA,IAAM6B,EAAYnB,EAMlB,MACE,kBAAA,cAACmB,EAAD,CACE,UAAWb,EACX,aAAYM,EACZ,GAAKP,EAIA,CACC,QACA,OACA,UACA,WACA,UACA,GAAIR,IAAa,IAAA,IAAa,CAAE,KAAMA,CAAS,EAC/C,GAAGC,CACL,EACCsB,EAAWtB,EAAMuB,CAAW,EACjC,GAAIjB,EACJ,IAAKC,EAAuBW,EAAMM,CAGzB,EADRhC,CACQ,CAEf,CAEA,MAAaiC,EAAc1C,EACzBe,EACA,aACF,E"}
@@ -1,2 +1,2 @@
1
- import{c as e,u as t}from"./slot-BQVx1Eew.js";import n,{useRef as r}from"react";import i from"classnames";import{useDateField as a,useDateSegment as o,useLocale as s}from"react-aria";import{useDateFieldState as c}from"react-stately";import{createCalendar as l}from"@internationalized/date";const u=/^[\s\u2066-\u2069]+$/,d=/* @__PURE__ */ new Set([`era`,`year`,`month`,`day`]),f=(e,t)=>{let n=e.slice(0,t).reverse().find(e=>e.type!==`literal`),r=e.slice(t+1).find(e=>e.type!==`literal`);return!!(n&&r)&&d.has(n.type)!==d.has(r.type)},p=({fieldLabelledBy:a,segment:s,slots:c,state:l})=>{let d=r(null),{segmentProps:p}=o(s,l,d),m=s.type===`literal`&&(u.test(s.text)||f(l.segments,l.segments.indexOf(s)));return/* @__PURE__ */ n.createElement(`span`,{...t(p,...c),"aria-labelledby":p[`aria-labelledby`]&&e(p.id,a),className:m?void 0:i(`datepicker-segment`,{placeholder:s.isPlaceholder}),contentEditable:p.contentEditable||void 0,ref:d},s.text)},m=e=>e?.querySelector(`[role="spinbutton"]`)?.focus(),h=({fieldProps:e,fieldRef:i})=>{let{locale:o}=s(),u=c({...e,createCalendar:l,locale:o}),d=r(null),f=i??d,{descriptionProps:m,errorMessageProps:h,fieldProps:g}=a(e,u,f);return/* @__PURE__ */ n.createElement(`div`,{...t(g,m,h),className:`datepicker-field`,ref:f},u.segments.map((t,r)=>/* @__PURE__ */ n.createElement(p,{fieldLabelledBy:e[`aria-labelledby`],key:r,segment:t,slots:[m,h],state:u})))};export{m as n,p as r,h as t};
2
- //# sourceMappingURL=DateField-4cdcwt0v.js.map
1
+ import{c as e,u as t}from"./slot-DagH0Gxq.js";import n,{useRef as r}from"react";import i from"classnames";import{useDateField as a,useDateSegment as o,useLocale as s}from"react-aria";import{useDateFieldState as c}from"react-stately";import{createCalendar as l}from"@internationalized/date";const u=/^[\s\u2066-\u2069]+$/,d=/* @__PURE__ */ new Set([`era`,`year`,`month`,`day`]),f=(e,t)=>{let n=e.slice(0,t).reverse().find(e=>e.type!==`literal`),r=e.slice(t+1).find(e=>e.type!==`literal`);return!!(n&&r)&&d.has(n.type)!==d.has(r.type)},p=({fieldLabelledBy:a,segment:s,slots:c,state:l})=>{let d=r(null),{segmentProps:p}=o(s,l,d),m=s.type===`literal`&&(u.test(s.text)||f(l.segments,l.segments.indexOf(s)));return/* @__PURE__ */ n.createElement(`span`,{...t(p,...c),"aria-labelledby":p[`aria-labelledby`]&&e(p.id,a),className:m?void 0:i(`datepicker-segment`,{placeholder:s.isPlaceholder}),contentEditable:p.contentEditable||void 0,ref:d},s.text)},m=e=>e?.querySelector(`[role="spinbutton"]`)?.focus(),h=({fieldProps:e,fieldRef:i})=>{let{locale:o}=s(),u=c({...e,createCalendar:l,locale:o}),d=r(null),f=i??d,{descriptionProps:m,errorMessageProps:h,fieldProps:g}=a(e,u,f);return/* @__PURE__ */ n.createElement(`div`,{...t(g,m,h),className:`datepicker-field`,ref:f},u.segments.map((t,r)=>/* @__PURE__ */ n.createElement(p,{fieldLabelledBy:e[`aria-labelledby`],key:r,segment:t,slots:[m,h],state:u})))};export{m as n,p as r,h as t};
2
+ //# sourceMappingURL=DateField-G1TP9ayt.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateField-4cdcwt0v.js","names":["joinIds","withoutSlotIds","React","classNames","BLANK_LITERAL","DATE_PARTS","separatesDateAndTime","before","segments","index","segment","after","DateSegment","ref","useRef","useDateSegment","state","plain","segmentProps","slots","fieldLabelledBy","focusFirstSegment","root","DateField","useLocale","useDateFieldState","fieldProps","ownRef","fieldRef","domFieldProps","useDateField","descriptionProps","errorMessageProps"],"sources":["../../src/components/datepicker/DateSegment.tsx","../../src/components/datepicker/DateField.tsx"],"sourcesContent":["import React, { useRef } from 'react'\nimport classNames from 'classnames'\nimport { useDateSegment } from 'react-aria'\nimport { DateFieldState, DateSegment as DateSegmentType } from 'react-stately'\n\nimport './DateSegment.scss'\nimport { joinIds, withoutSlotIds } from '../../utils/idRefs'\n\n// One editable part of a date or time field (a month, an hour, a day period), for `DateField`\n// and `TimeField` alike. A `TimeFieldState` is a `DateFieldState`.\n// A literal of spaces or bidi isolation marks (U+2066-U+2069) only.\nconst BLANK_LITERAL = /^[\\s\\u2066-\\u2069]+$/\nconst DATE_PARTS = new Set(['era', 'year', 'month', 'day'])\n\n// Whether a literal stands between a field's date and its time (en-US \", \"), found by the\n// editable parts on either side of it.\nconst separatesDateAndTime = (segments: DateSegmentType[], index: number) => {\n const before = segments\n .slice(0, index)\n .reverse()\n .find((segment) => segment.type !== 'literal')\n const after = segments.slice(index + 1).find((segment) => segment.type !== 'literal')\n return Boolean(before && after) && DATE_PARTS.has(before!.type) !== DATE_PARTS.has(after!.type)\n}\n\nexport interface DateSegmentProps {\n fieldLabelledBy?: string\n segment: DateSegmentType\n slots: { id?: string }[]\n state: DateFieldState\n}\n\nexport const DateSegment = ({ fieldLabelledBy, segment, slots, state }: DateSegmentProps) => {\n const ref = useRef<HTMLDivElement>(null)\n const { segmentProps } = useDateSegment(segment, state, ref)\n const plain =\n segment.type === 'literal' &&\n (BLANK_LITERAL.test(segment.text) ||\n separatesDateAndTime(state.segments, state.segments.indexOf(segment)))\n\n return (\n <span\n {...withoutSlotIds(segmentProps, ...slots)}\n // react-aria labels a segment by an id of its own, which it merges into the segment's `id`\n // only after hydration, and by the field's label. The server's HTML referred to the first,\n // an id no element had.\n aria-labelledby={segmentProps['aria-labelledby'] && joinIds(segmentProps.id, fieldLabelledBy)}\n // A time's literal segments include bidi isolation marks around it, which show nothing, the\n // space before AM/PM, and the \", \" between a date and its time. As `.datepicker-segment`s,\n // their padding set the time off from the edge and widened the space, or put one before the\n // comma: they render as plain text. A date's own literals (\"/\", ko-KR's \". \") keep it.\n className={\n plain ? undefined : classNames('datepicker-segment', { placeholder: segment.isPlaceholder })\n }\n // A segment that can't be edited leaves `contenteditable` out rather than writing `false`:\n // react-aria marks it `aria-readonly`, which HTML allows only on an element that isn't\n // `contenteditable` at all.\n contentEditable={segmentProps.contentEditable || undefined}\n ref={ref}\n >\n {segment.text}\n </span>\n )\n}\n","import React, { RefObject, useRef } from 'react'\nimport { AriaDateFieldProps, DateValue, useDateField, useLocale } from 'react-aria'\nimport { useDateFieldState } from 'react-stately'\nimport { createCalendar } from '@internationalized/date'\n\nimport { withoutSlotIds } from '../../utils/idRefs'\nimport { DateSegment } from './DateSegment'\n\ninterface DateFieldProps {\n fieldProps: AriaDateFieldProps<DateValue>\n /**\n * A ref to the field's element, for a picker that focuses one field of two.\n */\n fieldRef?: RefObject<HTMLDivElement | null>\n}\n\n// Where a required picker puts focus once it has held its form back: the first segment under\n// `root`, a picker's group or one of its fields.\nexport const focusFirstSegment = (root: HTMLElement | null) =>\n root?.querySelector<HTMLElement>('[role=\"spinbutton\"]')?.focus()\n\n// Builds its own segment state from the `fieldProps` `DatePicker` hands down — mirrors react\n// aria's own documented composition (the top-level `useDatePickerState`/`useDatePicker` pair\n// manages the *selected value*; the field's individually-editable segments are a separate piece\n// of state derived from `locale`/`createCalendar`, owned here).\nexport const DateField = ({ fieldProps, fieldRef }: DateFieldProps) => {\n const { locale } = useLocale()\n const state = useDateFieldState({\n ...fieldProps,\n createCalendar,\n locale\n })\n\n const ownRef = useRef<HTMLDivElement>(null)\n const ref = fieldRef ?? ownRef\n const {\n descriptionProps,\n errorMessageProps,\n fieldProps: domFieldProps\n } = useDateField(fieldProps, state, ref)\n\n return (\n <div\n {...withoutSlotIds(domFieldProps, descriptionProps, errorMessageProps)}\n className=\"datepicker-field\"\n ref={ref}\n >\n {state.segments.map((segment, index) => (\n <DateSegment\n fieldLabelledBy={fieldProps['aria-labelledby']}\n // eslint-disable-next-line react/no-array-index-key\n key={index}\n segment={segment}\n slots={[descriptionProps, errorMessageProps]}\n state={state}\n />\n ))}\n </div>\n )\n}\n"],"mappings":"A,kSAWA,MAAMI,EAAgB,uBAChBC,kBAAa,IAAI,IAAI,CAAC,MAAO,OAAQ,QAAS,KAAK,CAAC,EAIpDC,GAAwB,EAA6B,IAAkB,CAC3E,IAAMC,EAASC,EACZ,MAAM,EAAGC,CAAK,CAAC,CACf,QAAQ,CAAC,CACT,KAAM,GAAYC,EAAQ,OAAS,SAAS,EACzCC,EAAQH,EAAS,MAAMC,EAAQ,CAAC,CAAC,CAAC,KAAM,GAAYC,EAAQ,OAAS,SAAS,EACpF,MAAO,GAAQH,GAAUI,IAAUN,EAAW,IAAIE,EAAQ,IAAI,IAAMF,EAAW,IAAIM,EAAO,IAAI,CAChG,EASaC,GAAe,CAAE,kBAAiB,UAAS,QAAO,WAA8B,CAC3F,IAAMC,EAAMC,EAAuB,IAAI,EACjC,CAAE,gBAAiBC,EAAeL,EAASM,EAAOH,CAAG,EACrDI,EACJP,EAAQ,OAAS,YAChBN,EAAc,KAAKM,EAAQ,IAAI,GAC9BJ,EAAqBU,EAAM,SAAUA,EAAM,SAAS,QAAQN,CAAO,CAAC,GAExE,MACE,kBAAA,cAAC,OAAD,CACE,GAAIT,EAAeiB,EAAc,GAAGC,CAAK,EAIzC,kBAAiBD,EAAa,oBAAsBlB,EAAQkB,EAAa,GAAIE,CAAe,EAK5F,UACEH,EAAQ,IAAA,GAAYd,EAAW,qBAAsB,CAAE,YAAaO,EAAQ,aAAc,CAAC,EAK7F,gBAAiBQ,EAAa,iBAAmB,IAAA,GAC5C,KAGD,EADHR,EAAQ,IACL,CAEV,EC7CaW,EAAqB,GAChCC,GAAM,cAA2B,qBAAqB,CAAC,EAAE,MAAM,EAMpDC,GAAa,CAAE,aAAY,cAA+B,CACrE,GAAM,CAAE,UAAWC,EAAU,EACvBR,EAAQS,EAAkB,CAC9B,GAAGC,EACH,iBACA,QACF,CAAC,EAEKC,EAASb,EAAuB,IAAI,EACpCD,EAAMe,GAAYD,EAClB,CACJ,mBACA,oBACA,WAAYE,GACVC,EAAaJ,EAAYV,EAAOH,CAAG,EAEvC,MACE,kBAAA,cAAC,MAAD,CACE,GAAIZ,EAAe4B,EAAeE,EAAkBC,CAAiB,EACrE,UAAU,mBACL,KAYF,EAVFhB,EAAM,SAAS,KAAK,EAAS,IAC5B,kBAAA,cAACJ,EAAD,CACE,gBAAiBc,EAAW,mBAE5B,IAAKjB,EACI,UACT,MAAO,CAACsB,EAAkBC,CAAiB,EACpC,OACR,CAAA,CACF,CACE,CAET,E"}
1
+ {"version":3,"file":"DateField-G1TP9ayt.js","names":["joinIds","withoutSlotIds","React","classNames","BLANK_LITERAL","DATE_PARTS","separatesDateAndTime","before","segments","index","segment","after","DateSegment","ref","useRef","useDateSegment","state","plain","segmentProps","slots","fieldLabelledBy","focusFirstSegment","root","DateField","useLocale","useDateFieldState","fieldProps","ownRef","fieldRef","domFieldProps","useDateField","descriptionProps","errorMessageProps"],"sources":["../../src/components/datepicker/DateSegment.tsx","../../src/components/datepicker/DateField.tsx"],"sourcesContent":["import React, { useRef } from 'react'\nimport classNames from 'classnames'\nimport { useDateSegment } from 'react-aria'\nimport { DateFieldState, DateSegment as DateSegmentType } from 'react-stately'\n\nimport './DateSegment.scss'\nimport { joinIds, withoutSlotIds } from '../../utils/idRefs'\n\n// One editable part of a date or time field (a month, an hour, a day period), for `DateField`\n// and `TimeField` alike. A `TimeFieldState` is a `DateFieldState`.\n// A literal of spaces or bidi isolation marks (U+2066-U+2069) only.\nconst BLANK_LITERAL = /^[\\s\\u2066-\\u2069]+$/\nconst DATE_PARTS = new Set(['era', 'year', 'month', 'day'])\n\n// Whether a literal stands between a field's date and its time (en-US \", \"), found by the\n// editable parts on either side of it.\nconst separatesDateAndTime = (segments: DateSegmentType[], index: number) => {\n const before = segments\n .slice(0, index)\n .reverse()\n .find((segment) => segment.type !== 'literal')\n const after = segments.slice(index + 1).find((segment) => segment.type !== 'literal')\n return Boolean(before && after) && DATE_PARTS.has(before!.type) !== DATE_PARTS.has(after!.type)\n}\n\nexport interface DateSegmentProps {\n fieldLabelledBy?: string\n segment: DateSegmentType\n slots: { id?: string }[]\n state: DateFieldState\n}\n\nexport const DateSegment = ({ fieldLabelledBy, segment, slots, state }: DateSegmentProps) => {\n const ref = useRef<HTMLDivElement>(null)\n const { segmentProps } = useDateSegment(segment, state, ref)\n const plain =\n segment.type === 'literal' &&\n (BLANK_LITERAL.test(segment.text) ||\n separatesDateAndTime(state.segments, state.segments.indexOf(segment)))\n\n return (\n <span\n {...withoutSlotIds(segmentProps, ...slots)}\n // react-aria labels a segment by an id of its own, which it merges into the segment's `id`\n // only after hydration, and by the field's label. The server's HTML referred to the first,\n // an id no element had.\n aria-labelledby={segmentProps['aria-labelledby'] && joinIds(segmentProps.id, fieldLabelledBy)}\n // A time's literal segments include bidi isolation marks around it, which show nothing, the\n // space before AM/PM, and the \", \" between a date and its time. As `.datepicker-segment`s,\n // their padding set the time off from the edge and widened the space, or put one before the\n // comma: they render as plain text. A date's own literals (\"/\", ko-KR's \". \") keep it.\n className={\n plain ? undefined : classNames('datepicker-segment', { placeholder: segment.isPlaceholder })\n }\n // A segment that can't be edited leaves `contenteditable` out rather than writing `false`:\n // react-aria marks it `aria-readonly`, which HTML allows only on an element that isn't\n // `contenteditable` at all.\n contentEditable={segmentProps.contentEditable || undefined}\n ref={ref}\n >\n {segment.text}\n </span>\n )\n}\n","import React, { RefObject, useRef } from 'react'\nimport { AriaDateFieldProps, DateValue, useDateField, useLocale } from 'react-aria'\nimport { useDateFieldState } from 'react-stately'\nimport { createCalendar } from '@internationalized/date'\n\nimport { withoutSlotIds } from '../../utils/idRefs'\nimport { DateSegment } from './DateSegment'\n\ninterface DateFieldProps {\n fieldProps: AriaDateFieldProps<DateValue>\n /**\n * A ref to the field's element, for a picker that focuses one field of two.\n */\n fieldRef?: RefObject<HTMLDivElement | null>\n}\n\n// Where a required picker puts focus once it has held its form back: the first segment under\n// `root`, a picker's group or one of its fields.\nexport const focusFirstSegment = (root: HTMLElement | null) =>\n root?.querySelector<HTMLElement>('[role=\"spinbutton\"]')?.focus()\n\n// Builds its own segment state from the `fieldProps` `DatePicker` hands down — mirrors react\n// aria's own documented composition (the top-level `useDatePickerState`/`useDatePicker` pair\n// manages the *selected value*; the field's individually-editable segments are a separate piece\n// of state derived from `locale`/`createCalendar`, owned here).\nexport const DateField = ({ fieldProps, fieldRef }: DateFieldProps) => {\n const { locale } = useLocale()\n const state = useDateFieldState({\n ...fieldProps,\n createCalendar,\n locale\n })\n\n const ownRef = useRef<HTMLDivElement>(null)\n const ref = fieldRef ?? ownRef\n const {\n descriptionProps,\n errorMessageProps,\n fieldProps: domFieldProps\n } = useDateField(fieldProps, state, ref)\n\n return (\n <div\n {...withoutSlotIds(domFieldProps, descriptionProps, errorMessageProps)}\n className=\"datepicker-field\"\n ref={ref}\n >\n {state.segments.map((segment, index) => (\n <DateSegment\n fieldLabelledBy={fieldProps['aria-labelledby']}\n // eslint-disable-next-line react/no-array-index-key\n key={index}\n segment={segment}\n slots={[descriptionProps, errorMessageProps]}\n state={state}\n />\n ))}\n </div>\n )\n}\n"],"mappings":"A,kSAWA,MAAMI,EAAgB,uBAChBC,kBAAa,IAAI,IAAI,CAAC,M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,EAAe4B,EAAeE,EAAkBC,CAAiB,EACrE,UAAU,mBACL,KAYF,EAVFhB,EAAM,SAAS,KAAK,EAAS,IAC5B,kBAAA,cAACJ,EAAD,CACE,gBAAiBc,EAAW,mBAE5B,IAAKjB,EACI,UACT,MAAO,CAACsB,EAAkBC,CAAiB,EACpC,OACR,CAAA,CACF,CACE,CAET,E"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./polymorphic-CZIFszAy.js";import t from"react";import n from"classnames";function r({children:e,className:r,component:i,invalid:a,tooltip:o,valid:s,...c},l){let u=i??`div`,d=n({[`invalid-${o?`tooltip`:`feedback`}`]:a,[`valid-${o?`tooltip`:`feedback`}`]:s},r);return/* @__PURE__ */ t.createElement(u,{className:d,...c,ref:l},e)}const i=e(r,`FormFeedback`);function a({children:e,className:r,component:i,...a},o){let s=i??`div`,c=n(`form-help`,r);return/* @__PURE__ */ t.createElement(s,{className:c,...a,ref:o},e)}const o=e(a,`FormHelp`);export{i as n,o as t};
2
- //# sourceMappingURL=FormHelp-B1eSoack.js.map
1
+ import{t as e}from"./polymorphic-mAKwlLiW.js";import t from"react";import n from"classnames";function r({children:e,className:r,component:i,invalid:a,tooltip:o,valid:s,...c},l){let u=i??`div`,d=n({[`invalid-${o?`tooltip`:`feedback`}`]:a,[`valid-${o?`tooltip`:`feedback`}`]:s},r);return/* @__PURE__ */ t.createElement(u,{className:d,...c,ref:l},e)}const i=e(r,`FormFeedback`);function a({children:e,className:r,component:i,...a},o){let s=i??`div`,c=n(`form-help`,r);return/* @__PURE__ */ t.createElement(s,{className:c,...a,ref:o},e)}const o=e(a,`FormHelp`);export{i as n,o as t};
2
+ //# sourceMappingURL=FormHelp-2U3P8C6b.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormHelp-B1eSoack.js","names":["createPolymorphicComponent","React","classNames","FormFeedbackRender","rest","Component","component","_className","tooltip","invalid","valid","className","children","FormFeedback","FormHelpRender","FormHelp"],"sources":["../../src/components/form/FormFeedback.tsx","../../src/components/form/FormHelp.tsx"],"sourcesContent":["import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype FormFeedbackOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n /**\n * Set component validation state to invalid.\n */\n invalid?: boolean\n /**\n * If your form layout allows it, you can display validation feedback in a styled tooltip.\n */\n tooltip?: boolean\n /**\n * Set component validation state to valid.\n */\n valid?: boolean\n}\n\nexport type FormFeedbackProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n FormFeedbackOwnProps<C>\n>\n\ntype FormFeedbackComponent = (<C extends ElementType = 'div'>(\n props: FormFeedbackProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction FormFeedbackRender<C extends ElementType = 'div'>(\n { children, className, component, invalid, tooltip, valid, ...rest }: FormFeedbackProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames(\n {\n [`invalid-${tooltip ? 'tooltip' : 'feedback'}`]: invalid,\n [`valid-${tooltip ? 'tooltip' : 'feedback'}`]: valid\n },\n className\n )\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const FormFeedback = createPolymorphicComponent<FormFeedbackComponent>(\n FormFeedbackRender as ForwardRefRenderFunction<Element, FormFeedbackProps<ElementType>>,\n 'FormFeedback'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype FormHelpOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n}\n\nexport type FormHelpProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n FormHelpOwnProps<C>\n>\n\ntype FormHelpComponent = (<C extends ElementType = 'div'>(\n props: FormHelpProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction FormHelpRender<C extends ElementType = 'div'>(\n { children, className, component, ...rest }: FormHelpProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames('form-help', className)\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const FormHelp = createPolymorphicComponent<FormHelpComponent>(\n FormHelpRender as ForwardRefRenderFunction<Element, FormHelpProps<ElementType>>,\n 'FormHelp'\n)\n"],"mappings":"A,6FAyCA,SAASG,EACP,CAAE,WAAU,YAAW,YAAW,UAAS,UAAS,QAAO,GAAGC,GAC9D,EACA,CACA,IAAMC,EAAYC,GAAa,MACzBC,EAAaL,EACjB,EACG,WAAWM,EAAU,UAAY,cAAeC,GAChD,SAASD,EAAU,UAAY,cAAeE,CACjD,EACAC,CACF,EACA,MACE,kBAAA,cAACN,EAAD,CAAW,UAAWE,EAAY,GAAIH,EAAW,KAEtC,EADRQ,CACQ,CAEf,CAEA,MAAaC,EAAeb,EAC1BG,EACA,cACF,EClCA,SAASW,EACP,CAAE,WAAU,YAAW,YAAW,GAAGV,GACrC,EACA,CACA,IAAMC,EAAYC,GAAa,MACzBC,EAAaL,EAAW,YAAaS,CAAS,EACpD,MACE,kBAAA,cAACN,EAAD,CAAW,UAAWE,EAAY,GAAIH,EAAW,KAEtC,EADRQ,CACQ,CAEf,CAEA,MAAaG,EAAWf,EACtBc,EACA,UACF,E"}
1
+ {"version":3,"file":"FormHelp-2U3P8C6b.js","names":["createPolymorphicComponent","React","classNames","FormFeedbackRender","rest","Component","component","_className","tooltip","invalid","valid","className","children","FormFeedback","FormHelpRender","FormHelp"],"sources":["../../src/components/form/FormFeedback.tsx","../../src/components/form/FormHelp.tsx"],"sourcesContent":["import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype FormFeedbackOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n /**\n * Set component validation state to invalid.\n */\n invalid?: boolean\n /**\n * If your form layout allows it, you can display validation feedback in a styled tooltip.\n */\n tooltip?: boolean\n /**\n * Set component validation state to valid.\n */\n valid?: boolean\n}\n\nexport type FormFeedbackProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n FormFeedbackOwnProps<C>\n>\n\ntype FormFeedbackComponent = (<C extends ElementType = 'div'>(\n props: FormFeedbackProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction FormFeedbackRender<C extends ElementType = 'div'>(\n { children, className, component, invalid, tooltip, valid, ...rest }: FormFeedbackProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames(\n {\n [`invalid-${tooltip ? 'tooltip' : 'feedback'}`]: invalid,\n [`valid-${tooltip ? 'tooltip' : 'feedback'}`]: valid\n },\n className\n )\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const FormFeedback = createPolymorphicComponent<FormFeedbackComponent>(\n FormFeedbackRender as ForwardRefRenderFunction<Element, FormFeedbackProps<ElementType>>,\n 'FormFeedback'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype FormHelpOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n}\n\nexport type FormHelpProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n FormHelpOwnProps<C>\n>\n\ntype FormHelpComponent = (<C extends ElementType = 'div'>(\n props: FormHelpProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction FormHelpRender<C extends ElementType = 'div'>(\n { children, className, component, ...rest }: FormHelpProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames('form-help', className)\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const FormHelp = createPolymorphicComponent<FormHelpComponent>(\n FormHelpRender as ForwardRefRenderFunction<Element, FormHelpProps<ElementType>>,\n 'FormHelp'\n)\n"],"mappings":"A,6FAyCA,SAASG,EACP,CAAE,WAAU,YAAW,YAAW,UAAS,UAAS,QAAO,GAAGC,GAC9D,EACA,CACA,IAAMC,EAAYC,GAAa,MACzBC,EAAaL,EACjB,EACG,WAAWM,EAAU,UAAY,cAAeC,GAChD,SAASD,EAAU,UAAY,cAAeE,CACjD,EACAC,CACF,EACA,MACE,kBAAA,cAACN,EAAD,CAAW,UAAWE,EAAY,GAAIH,EAAW,KAEtC,EADRQ,CACQ,CAEf,CAEA,MAAaC,EAAeb,EAC1BG,EACA,cACF,EClCA,SAASW,EACP,CAAE,WAAU,YAAW,YAAW,GAAGV,GACrC,EACA,CACA,IAAMC,EAAYC,GAAa,MACzBC,EAAaL,EAAW,YAAaS,CAAS,EACpD,MACE,kBAAA,cAACN,EAAD,CAAW,UAAWE,EAAY,GAAIH,EAAW,KAEtC,EADRQ,CACQ,CAEf,CAEA,MAAaG,EAAWf,EACtBc,EACA,UACF,E"}
@@ -0,0 +1,2 @@
1
+ import{f as e,m as t,p as n,v as r}from"./slot-DagH0Gxq.js";import{t as i}from"./useForkedRef-WoqMqsWE.js";import{t as a}from"./polymorphic-mAKwlLiW.js";import{n as o,t as s}from"./useButtonSemantics-DN3OIXtG.js";import{t as c}from"./useDisabledAnchorGuard-CH6df46a.js";import{r as l}from"./colorClassNames-YzGWu6qm.js";import{n as u}from"./scrollspy-D_lPjb92.js";import d from"react";import f from"classnames";import{mergeProps as p}from"react-aria";function m({children:a,active:m,className:h,color:g,component:_,disabled:v,href:y,iconLink:b,onClick:x,reset:S,stretched:C,type:w=`button`,...T},E){let D=t(_,y,`a`),O=r(D,y,T),k=n(O),A=O===`component`,j=u(v),M=j.onClick,N=c(O===`anchor`,v,M?e=>{x?.(e),M(e)}:x),P=!k&&!A&&!!x,{buttonProps:F,forkedRef:I}=o(E,{disabled:v,onClick:x,...s(T)}),L=P?I:E,R=i(L,j.ref),z=m||!!j.mark,B=T[`aria-current`]??(m?`page`:j.mark===`current`?`true`:void 0),V=f(g&&l[g],{"icon-link":b,"fg-reset":S,"stretched-link":C},{active:z,disabled:v},h);return/* @__PURE__ */ d.createElement(D,{...p(T,P?F:{}),className:V,...e(O,y,`Link`),...B&&{"aria-current":B},...O===`anchor`&&v&&{"aria-disabled":!0,tabIndex:-1},...!P&&{onClick:N},...O===`button`&&{disabled:v,type:w},ref:j.ref?R:L},a)}const h=a(m,`Link`);export{h as t};
2
+ //# sourceMappingURL=Link-B3SX50Od.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Link-B3SX50Od.js","names":["hrefProps","linkElement","isInteractiveKind","resolveLinkKind","useForkedRef","createPolymorphicComponent","useButtonSemantics","pickButtonSemantics","useDisabledAnchorGuard","LINK_COLOR_CLASS_NAMES","useScrollspyLink","React","classNames","LinkRender","rest","Component","component","href","kind","isInteractive","isComponentReference","spy","disabled","spyClick","handleClick","onClick","event","needsButtonSemantics","ref","ownRef","forkedRef","spyRef","isActive","active","ariaCurrent","_className","color","iconLink","reset","stretched","className","mergeProps","buttonProps","children","Link"],"sources":["../../src/components/link/Link.tsx"],"sourcesContent":["import React, {\n AriaAttributes,\n ElementType,\n ForwardRefRenderFunction,\n MouseEventHandler,\n ReactElement,\n Ref\n} from 'react'\nimport classNames from 'classnames'\nimport { mergeProps } from 'react-aria'\n\nimport { ContextColor } from '../../types'\nimport { LINK_COLOR_CLASS_NAMES } from '../../utils/colorClassNames'\nimport {\n pickButtonSemantics,\n useButtonSemantics,\n useDisabledAnchorGuard,\n useForkedRef\n} from '../../hooks'\nimport { hrefProps, isInteractiveKind, linkElement, resolveLinkKind } from '../../utils/elementKind'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { useScrollspyLink } from '../../utils/scrollspy'\n\ntype LinkOwnProps<C extends ElementType> = {\n /**\n * Toggle the active state for the component.\n */\n active?: boolean\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Sets the link color to one of Chassis context colors, including its interactive\n * (`:hover`/`:focus`/`:active`/`:visited`) states.\n */\n color?: ContextColor\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n /**\n * Toggle the disabled state for the component.\n */\n disabled?: boolean\n /**\n * The href attribute specifies the URL of the page the link goes to. Reaches an `<a>` or a\n * component reference (a router link); dropped, with a warning in development, when\n * `component` is another element. Declared explicitly here — rather than left to flow through\n * generically from whatever `C` is — so consumers that wrap `Link` (`MenuItem`, `ListItem`,\n * `NavLink`) can read it with a concrete type regardless of `component`.\n */\n href?: string\n /**\n * Fires on click.\n */\n onClick?: MouseEventHandler<HTMLElement>\n /**\n * Aligns a leading or trailing icon with the link text using flexbox, with a gap between\n * them and an offset underline. Icons need to be passed as `children` alongside the text.\n * Named `iconLink` rather than `icon` to avoid colliding with components (e.g. `MenuItem`)\n * that already have their own, differently-typed `icon` prop for the icon content itself.\n */\n iconLink?: boolean\n /**\n * Removes the foreground color override, so the link inherits its color from the nearest\n * ancestor instead of the default link color.\n */\n reset?: boolean\n /**\n * Expands the link's click target to fill its positioned ancestor (the nearest ancestor with\n * a `position` other than `static`).\n */\n stretched?: boolean\n /**\n * Specifies the type of button. Only applies when `component=\"button\"`. Different browsers may\n * use different default types for the `<button>` element, so always specify it explicitly.\n */\n type?: 'button' | 'submit' | 'reset'\n}\n\nexport type LinkProps<C extends ElementType = 'a'> = PolymorphicComponentProps<C, LinkOwnProps<C>>\n\ntype LinkComponent = (<C extends ElementType = 'a'>(\n props: LinkProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction LinkRender<C extends ElementType = 'a'>(\n {\n children,\n active,\n className,\n color,\n component,\n disabled,\n href,\n iconLink,\n onClick,\n reset,\n stretched,\n type = 'button',\n ...rest\n }: LinkProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = linkElement(component, href, 'a')\n // The kind rather than the tag, counting a router link with `href` or `to` as an anchor: under `asChild`, `Component` is a `Slot` standing in for the\n // caller's element, and a slotted `<a>` needs what `component=\"a\"` gets.\n const kind = resolveLinkKind(Component, href, rest)\n\n const isInteractive = isInteractiveKind(kind)\n // A component reference without a link target (a router link with `href` or `to` is an anchor,\n // see `resolveLinkKind`) has its own visual identity and is trusted to\n // handle its own keyboard/role semantics, same as `CloseButton`'s `isComponentReference` escape\n // hatch — synthesizing `role=\"button\"` and Enter/Space handling on top of it would stamp the\n // wrong ARIA role onto whatever it actually renders (e.g. an `<a>`) and can double-fire a click\n // (native anchor Enter→click, plus the synthesized keydown→click).\n const isComponentReference = kind === 'component'\n // Inside a `Scrollspy`, the link registers its element, is marked when its section is the one\n // being read, and scrolls to it smoothly when the `Scrollspy` is set to (`src/utils/scrollspy.ts`).\n const spy = useScrollspyLink(disabled)\n const spyClick = spy.onClick\n const clickHandler: MouseEventHandler<HTMLElement> | undefined = spyClick\n ? (event) => {\n onClick?.(event)\n spyClick(event)\n }\n : onClick\n // `<a>` has no real `disabled` attribute, so a disabled anchor link still fires click (and\n // still navigates) unless it's blocked here, same guard `Button`/`CloseButton` apply. A real\n // `<button>` already stops clicks on its own once the `disabled` attribute below is set.\n const handleClick = useDisabledAnchorGuard<HTMLElement>(kind === 'anchor', disabled, clickHandler)\n\n // A `component` that isn't a native interactive element gets a raw onClick with no\n // keyboard semantics otherwise — mouse-only, unlike `Button`/`CloseButton`, which\n // synthesize this via `useButtonSemantics` for exactly this \"arbitrary component\" case. A\n // component reference is excluded (see `isComponentReference` above).\n const needsButtonSemantics = !isInteractive && !isComponentReference && !!onClick\n const { buttonProps, forkedRef } = useButtonSemantics<HTMLElement>(ref as Ref<HTMLElement>, {\n disabled,\n onClick,\n ...pickButtonSemantics(rest)\n })\n const ownRef = needsButtonSemantics ? forkedRef : ref\n const spyRef = useForkedRef(ownRef as Ref<HTMLElement>, spy.ref)\n // A link to the section being read is `active` and `aria-current=\"true\"`: the current place in\n // the page, not the current page. A link it belongs under, such as its menu's toggle, only\n // looks active. An `active` given as a prop wins, and an `aria-current` given as one wins over\n // both: a step of a process is `\"step\"`, not the current page.\n const isActive = active || !!spy.mark\n const ownAriaCurrent = (rest as AriaAttributes)['aria-current']\n const ariaCurrent =\n ownAriaCurrent ?? (active ? 'page' : spy.mark === 'current' ? 'true' : undefined)\n\n const _className = classNames(\n color && LINK_COLOR_CLASS_NAMES[color],\n { 'icon-link': iconLink, 'fg-reset': reset, 'stretched-link': stretched },\n { active: isActive, disabled },\n className\n )\n\n return (\n <Component\n {...(mergeProps(rest, needsButtonSemantics ? buttonProps : {}) as Record<string, unknown>)}\n className={_className}\n {...hrefProps(kind, href, 'Link')}\n {...(ariaCurrent && { 'aria-current': ariaCurrent })}\n {...(kind === 'anchor' && disabled && { 'aria-disabled': true, tabIndex: -1 })}\n {...(!needsButtonSemantics && { onClick: handleClick })}\n {...(kind === 'button' && { disabled, type })}\n ref={spy.ref ? spyRef : ownRef}\n >\n {children}\n </Component>\n )\n}\n\nexport const Link = createPolymorphicComponent<LinkComponent>(\n LinkRender as ForwardRefRenderFunction<Element, LinkProps<ElementType>>,\n 'Link'\n)\n"],"mappings":"A,mcA2FA,SAASa,EACP,CACE,WACA,SACA,YACA,QACA,YACA,WACA,OACA,WACA,UACA,QACA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AAaC,EAAOvC,EAClBQ,EACA,MACF,E"}
@@ -0,0 +1,2 @@
1
+ import{t as e}from"./useForkedRef-WoqMqsWE.js";import{t}from"./polymorphic-mAKwlLiW.js";import{t as n}from"./useIsomorphicLayoutEffect-BbqRwuqn.js";import{t as r}from"./dialogTransition-C8fYTsSa.js";import{n as i}from"./overlayStack-BXtTGCRm.js";import{i as a,r as o,s}from"./overlayPlacement-D2vfhhg3.js";import{t as c}from"./useOpenStateProps-CdSO1nmI.js";import{t as l}from"./useOverlayMaxHeight-5UnurH0W.js";import{t as u}from"./focusRedirect-CrBl4p_n.js";import{n as d}from"./insideEvents-CWcNrMu7.js";import{t as ee}from"./navOverflow-eSROB_mV.js";import f,{Fragment as p,createContext as m,useEffect as h,useMemo as te,useRef as g}from"react";import ne from"classnames";import{useMenuTrigger as re,useOverlayPosition as ie}from"react-aria";import{useMenuTriggerState as ae}from"react-stately";function _(e,t){let n=/* @__PURE__ */ new Map,r=e=>{n.set(e,window.setTimeout(()=>{n.delete(e),t(e,!0)}))},i=e=>{window.clearTimeout(n.get(e)),n.delete(e),t(e,!1)};return window.addEventListener(e,r,!0),window.addEventListener(e,i),()=>{window.removeEventListener(e,r,!0),window.removeEventListener(e,i);for(let e of n.values())window.clearTimeout(e);n.clear()}}const v=()=>void 0,y=m({autoClose:!0,close:v,focusStrategy:null,hide:v,menuId:``,menuStyle:{},menuTriggerProps:{},overlayRef:{current:null},placementAttr:`bottom-start`,reference:`toggle`,registerOverlay:v,show:v,targetRef:{current:null},toggle:v,toggleNodeRef:{current:null},triggerId:``,visible:!1}),b=/* @__PURE__ */ new WeakSet,x=/* @__PURE__ */ new Set,S=(e,t)=>{if(!(e instanceof Element))return!1;let n=e instanceof HTMLFormElement?e:e.closest(`input, select, option, textarea, label, [contenteditable]:not([contenteditable="false"])`);return!!n&&t.some(e=>!!e?.contains(n))};function C({children:t,autoClose:m=!0,className:v,component:C,container:w,defaultVisible:oe,offset:T=[0,2],onHide:se,onHidden:E,onShow:ce,onShown:D,onVisibleChange:O,placement:k=`bottom-start`,reference:A=`toggle`,visible:j,...le},ue){let M=C??p,N=g(null),de=e(ue,N),P=g(null),F=g(null),I=g(null),L=g(/* @__PURE__ */ new Map),fe=(e,t)=>{t?L.current.set(e,t):L.current.delete(e)},R=ae(c({defaultVisible:oe,onVisibleChange:O,visible:j},`Menu`)),{menuTriggerProps:z,menuProps:B}=re({},R,P);n(()=>{A===`parent`&&(F.current=N.current)},[A]);let V=g(R.isOpen);h(()=>{let e=I.current;if(V.current!==R.isOpen){if(V.current=R.isOpen,R.isOpen){if(ce?.(),!e){D?.();return}return r(e,()=>D?.(),!0)}if(se?.(),!e)E?.();else return r(e,()=>E?.(),!0)}},[R.isOpen]);let{overlayProps:pe,placement:me,updatePosition:he}=ie({targetRef:F,overlayRef:I,placement:a(k),offset:T[1],crossOffset:T[0],containerPadding:8,isOpen:R.isOpen,onClose:null});l(I,R.isOpen);let{menuStyle:H,placementAttr:U}=o(pe.style,k,me),W=g(!0);W.current=j===void 0||!!O;let G=g(!1);G.current=j!==void 0;let K=g(!1),q=g(!1),J=e=>R.open(e),Y=()=>{K.current=!1,R.close()},ge=e=>R.toggle(e),X=e=>{R.close(),G.current?(K.current=W.current,q.current=e):u(P.current,e)},Z=()=>X(!1);h(()=>{!R.isOpen&&K.current&&u(P.current,q.current),K.current=!1},[R.isOpen]);let Q=s({close:Y,isOpen:R.isOpen,triggerRef:P});n(()=>{R.isOpen&&he()},[Q]),h(()=>{if(!R.isOpen||m===!1)return;let e=/* @__PURE__ */ new WeakSet,t=(t,n=!1)=>{if(t instanceof KeyboardEvent&&t.key!==`Tab`||e.has(t))return;e.add(t);let r=t.target,i=P.current,a=I.current;if(i?.contains(r))return;let o=[a,...L.current.values()],s=o.some(e=>!!e?.contains(r));if(!s&&d(t,I)||s&&b.has(t)||m===`inside`&&!s||m===`outside`&&s||s&&(n||t instanceof KeyboardEvent&&t.key===`Tab`||S(r,o)))return;let c=document.activeElement,l=!c||c===document.body||!!a?.contains(c)||Array.from(L.current.values()).some(e=>e.contains(c));s&&l?X(t instanceof MouseEvent&&t.detail>0):Y()},n=[],r=window.setTimeout(()=>{n.push(_(`click`,t),_(`keyup`,t)),x.add(t)});return()=>{window.clearTimeout(r);for(let e of n)e();x.delete(t)}},[R.isOpen,m]),h(()=>{if(R.isOpen)return i({nodes:()=>[I.current,P.current],onEscape:Z})},[R.isOpen]);let _e=te(()=>({autoClose:m,close:Z,container:w===!0?Q??!0:w,focusStrategy:R.focusStrategy,hide:Y,menuId:B.id??``,menuStyle:H,menuTriggerProps:z,overlayRef:I,placementAttr:U,portalContainer:Q,reference:A,registerOverlay:fe,show:J,targetRef:F,toggle:ge,toggleNodeRef:P,triggerId:z.id??``,visible:R.isOpen}),[m,w,R.focusStrategy,B.id,H,z,U,Q,A,R.isOpen]),$=/* @__PURE__ */ f.createElement(ee,null,t);return/* @__PURE__ */ f.createElement(y.Provider,{value:_e},M===p?$:/* @__PURE__ */ f.createElement(M,{className:ne(v,{show:R.isOpen}),...le,ref:de},$))}const w=t(C,`Menu`);export{x as a,b as i,y as n,_ as o,S as r,w as t};
2
+ //# sourceMappingURL=Menu-DBN4Mxak.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Menu-DBN4Mxak.js","names":["useForkedRef","useIsomorphicLayoutEffect","executeAfterTransition","pushOverlay","toAriaPlacement","resolveMenuOverlayPositioning","useOpenStateProps","useOverlayMaxHeight","focusRedirect","isEventInside","NavOverflowBoundary","React","classNames","listenOnWindow","pending","handleCapture","event","handler","handleBubble","type","timer","noop","MenuContext","createContext","menuToggleClicks","openMenuDismissals","isFormControlClick","target","control","lists","list","MenuRender","offsetProp","rest","Component","component","Fragment","wrapperRef","useRef","forkedRef","ref","toggleNodeRef","targetRef","overlayRef","submenuOverlaysRef","registerOverlay","node","id","state","useMenuTriggerState","useMenuTrigger","reference","reportedOpenRef","useEffect","overlay","onShow","onShown","onHide","onHidden","resolvedPlacement","useOverlayPosition","placement","overlayProps","followsRequestsRef","visible","onVisibleChange","isControlledRef","focusReturnOwedRef","focusReturnViaPointerRef","show","focusStrategy","hide","toggleVisible","closeAndReturnFocus","viaPointer","close","portalContainer","useFloatingOverlay","updatePosition","autoClose","handled","handleDismiss","toggleNode","menuNode","isMenuTarget","stopped","active","holdsFocus","cleanups","cleanup","contextValue","useMemo","container","menuProps","menuTriggerProps","menuStyle","placementAttr","content","children","className","Menu","createPolymorphicComponent"],"sources":["../../src/utils/windowEvents.ts","../../src/components/menu/Menu.tsx"],"sourcesContent":["// Listens for `type` on `window` for an overlay's outside-press handling, including the events\n// that something stopped on the way. react-aria's `usePress` stops the `pointerdown` and `click` of\n// the element it is on (a `Tab`, a `Checkbox`, a `Select` trigger, a `DataGrid` row), so a menu\n// that listened in the bubble phase alone never heard a press on one of them, and stayed open\n// beside the control the user had just operated.\n//\n// Not the capture phase alone: `isEventInside` reads the mark React's root puts on an event in its\n// own capture phase, which comes after `window`'s. An event is seen in the capture phase and\n// handled when it bubbles up to `window`, as before; one that never arrives is handled a task\n// later, once its dispatch is over. Each event reaches `handler` once, with `stopped` for one that\n// never bubbled up: something on its path took it, and a listener that reads the event as a click\n// on one of its own items (a menu's dismissal) leaves such a one to the control it was on.\nexport function listenOnWindow<K extends keyof WindowEventMap>(\n type: K,\n handler: (event: WindowEventMap[K], stopped: boolean) => void\n): () => void {\n const pending = new Map<Event, number>()\n\n const handleCapture = (event: WindowEventMap[K]) => {\n pending.set(\n event,\n window.setTimeout(() => {\n pending.delete(event)\n handler(event, true)\n })\n )\n }\n\n const handleBubble = (event: WindowEventMap[K]) => {\n window.clearTimeout(pending.get(event))\n pending.delete(event)\n handler(event, false)\n }\n\n window.addEventListener(type, handleCapture, true)\n window.addEventListener(type, handleBubble)\n return () => {\n window.removeEventListener(type, handleCapture, true)\n window.removeEventListener(type, handleBubble)\n for (const timer of pending.values()) window.clearTimeout(timer)\n pending.clear()\n }\n}\n","import React, {\n createContext,\n ElementType,\n ForwardRefRenderFunction,\n Fragment,\n ReactElement,\n useEffect,\n useMemo,\n useRef\n} from 'react'\nimport classNames from 'classnames'\nimport { AriaButtonProps, useMenuTrigger, useOverlayPosition } from 'react-aria'\nimport { useMenuTriggerState } from 'react-stately'\n\nimport {\n useFloatingOverlay,\n useForkedRef,\n useIsomorphicLayoutEffect,\n useOpenStateProps,\n useOverlayMaxHeight\n} from '../../hooks'\nimport { executeAfterTransition } from '../../utils/dialogTransition'\nimport { focusRedirect } from '../../utils/focusRedirect'\nimport { isEventInside } from '../../utils/insideEvents'\nimport {\n Placement,\n resolveMenuOverlayPositioning,\n toAriaPlacement\n} from '../../utils/overlayPlacement'\nimport { NavOverflowBoundary } from '../../utils/navOverflow'\nimport { pushOverlay } from '../../utils/overlayStack'\nimport { listenOnWindow } from '../../utils/windowEvents'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\nexport type { Placement }\nexport type MenuFocusStrategy = 'first' | 'last'\n\nexport type MenuAutoClose = boolean | 'inside' | 'outside'\n\ntype MenuOwnProps<C extends ElementType> = {\n /**\n * Controls which clicks close the menu. `true` closes on any click inside or outside.\n * `false` leaves closing to the toggle, the Escape key and `visible`. `'inside'` closes only\n * on click inside the menu. `'outside'` closes only on click outside the menu.\n */\n autoClose?: MenuAutoClose\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n * Defaults to `Fragment` — `MenuToggle`/`MenuList` render with no wrapping element, so\n * they land as direct children of whatever contains the `Menu`. This matters inside\n * `ButtonGroup`/`InputGroup`, whose CSS expects the toggle button and menu panel as direct\n * children rather than nested inside an intermediate node.\n *\n * Pass an actual element (e.g. `\"div\"`, or `\"li\"` for a navbar item) to opt back into a\n * wrapper — needed if you want to apply `className`/`style`/other rest props to a container\n * around the whole menu, for semantic wrapping like a nav `<li>`, or for `reference=\"parent\"`,\n * which positions off this wrapper and has nothing to measure against without one.\n */\n component?: C\n /**\n * Teleports the menu panel to a container element on open. Accepts an element reference, or\n * `true` to append to `document.body`, or to the open dialog the menu is in, so the panel\n * stays in that dialog's top layer.\n */\n container?: boolean | Element\n /**\n * Whether the menu is open when it first renders. Use it instead of `visible` when nothing\n * outside needs to control the menu.\n */\n defaultVisible?: boolean\n /**\n * Distance between the menu and its reference element, as `[skidding, distance]` in pixels.\n */\n offset?: [number, number]\n /**\n * Callback fired when the menu starts to hide.\n */\n onHide?: () => void\n /**\n * Callback fired after the menu finishes hiding.\n */\n onHidden?: () => void\n /**\n * Callback fired when the menu starts to show.\n */\n onShow?: () => void\n /**\n * Callback fired after the menu finishes showing.\n */\n onShown?: () => void\n /**\n * Callback fired when the menu asks to show or hide: the toggle, a click that `autoClose`\n * counts, or the Escape or Tab key. Receives the state it asks for. With `visible` set, the\n * menu changes only when `visible` does.\n */\n onVisibleChange?: (visible: boolean) => void\n /**\n * Initial placement. Chassis will flip it to keep the menu in view.\n *\n * @type 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end'\n */\n placement?: Placement\n /**\n * Reference element used for positioning. `'toggle'` uses the trigger. `'parent'` uses this\n * component's own rendered element, useful for split buttons and button groups.\n */\n reference?: 'toggle' | 'parent'\n /**\n * Whether the menu is open. Setting it makes the menu controlled: it opens and closes only\n * when this changes, so pair it with `onVisibleChange`. Leave it unset, or use\n * `defaultVisible`, for a menu that opens and closes itself.\n */\n visible?: boolean\n}\n\nexport type MenuProps<C extends ElementType = typeof Fragment> = PolymorphicComponentProps<\n C,\n MenuOwnProps<C>\n>\n\ntype MenuComponent = (<C extends ElementType = typeof Fragment>(\n props: MenuProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nexport interface MenuContextProps {\n autoClose: MenuAutoClose\n close: () => void\n container?: boolean | Element\n focusStrategy: MenuFocusStrategy | null\n hide: () => void\n menuId: string\n menuStyle: React.CSSProperties\n menuTriggerProps: AriaButtonProps\n overlayRef: React.MutableRefObject<HTMLElement | null>\n placementAttr: string\n /**\n * The open dialog the menu is in, or `document.body`; `null` until the menu first opens. A\n * `MenuSubmenu` portals its panel there, so inside a modal dialog it is in the top layer with\n * the menu rather than under it, where the page is inert.\n */\n portalContainer?: Element | null\n reference: 'toggle' | 'parent'\n /**\n * Registers (or, passing `null`, unregisters) a nested `MenuSubmenu`'s own portaled panel\n * element, so this `Menu`'s outside/inside click-dismiss logic recognizes clicks landing in it\n * as \"inside\" the menu — see `MenuSubmenu`'s own use for why this is necessary: its panel\n * portals straight to `document.body`, structurally detached from this menu's own DOM subtree.\n */\n registerOverlay: (id: string, node: HTMLElement | null) => void\n show: (focusStrategy?: MenuFocusStrategy | null) => void\n targetRef: React.MutableRefObject<HTMLElement | null>\n toggle: (focusStrategy?: MenuFocusStrategy | null) => void\n toggleNodeRef: React.MutableRefObject<HTMLElement | null>\n triggerId: string\n visible: boolean\n}\n\n// A fully-shaped no-op default so a `MenuToggle`/`MenuList`/`MenuSubmenu` rendered without a\n// `Menu` ancestor (or in an environment where context can't cross a component boundary, e.g.\n// some static-site prerenderers) degrades to an inert, always-closed menu instead of throwing.\nconst noop = () => undefined\n\nconst defaultMenuContext: MenuContextProps = {\n autoClose: true,\n close: noop,\n focusStrategy: null,\n hide: noop,\n menuId: '',\n menuStyle: {},\n menuTriggerProps: {},\n overlayRef: { current: null },\n placementAttr: 'bottom-start',\n reference: 'toggle',\n registerOverlay: noop,\n show: noop,\n targetRef: { current: null },\n toggle: noop,\n toggleNodeRef: { current: null },\n triggerId: '',\n visible: false\n}\n\nexport const MenuContext = createContext(defaultMenuContext)\n\n// The clicks on a `MenuToggle`, a `MenuSubmenu` trigger or a `MenuSubmenuBack`. One in a menu's\n// list opens or closes a menu of its own: it is no click on an item of that list.\nexport const menuToggleClicks = new WeakSet<Event>()\n\n// The outside-click handlers of the open menus. react-aria's press handling stops the click on a\n// `MenuToggle` before it reaches `window`, where those handlers listen, so another menu stayed open\n// beside the one the click opened: the toggle hands its click to each of them itself.\nexport const openMenuDismissals = new Set<(event: Event) => void>()\n\n// Whether a click uses a form control in a menu's list in place, which keeps the menu open: one on\n// the control, on a `<label>` (whose click the browser passes on to its control), or on a form\n// itself, as menu.js's `clearMenus` has it. A button in that form is an item: its submit closes the\n// menu. Only what is inside `lists` counts: a menu inside a page's form still closes on an item.\nexport const isFormControlClick = (\n target: EventTarget | null,\n lists: Array<Element | null | undefined>\n): boolean => {\n if (!(target instanceof Element)) return false\n const control =\n target instanceof HTMLFormElement\n ? target\n : target.closest(\n 'input, select, option, textarea, label, [contenteditable]:not([contenteditable=\"false\"])'\n )\n return !!control && lists.some((list) => !!list?.contains(control))\n}\n\nfunction MenuRender<C extends ElementType = typeof Fragment>(\n {\n children,\n autoClose = true,\n className,\n component,\n container,\n defaultVisible,\n offset: offsetProp = [0, 2],\n onHide,\n onHidden,\n onShow,\n onShown,\n onVisibleChange,\n placement = 'bottom-start',\n reference = 'toggle',\n visible,\n ...rest\n }: MenuProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? (Fragment as ElementType)\n const wrapperRef = useRef<HTMLElement>(null)\n const forkedRef = useForkedRef(ref, wrapperRef)\n const toggleNodeRef = useRef<HTMLElement | null>(null)\n const targetRef = useRef<HTMLElement | null>(null)\n const overlayRef = useRef<HTMLElement | null>(null)\n // Portaled `MenuSubmenu` panels register themselves here (see `registerOverlay` below and\n // `MenuSubmenu`'s own ref callback) so `handleDismiss` can recognize clicks inside them as\n // \"inside\" this menu despite living outside `overlayRef.current`'s own DOM subtree.\n const submenuOverlaysRef = useRef<Map<string, HTMLElement>>(new Map())\n const registerOverlay = (id: string, node: HTMLElement | null) => {\n if (node) submenuOverlaysRef.current.set(id, node)\n else submenuOverlaysRef.current.delete(id)\n }\n\n // Controlled by `visible` when it is set: `show`/`hide`/`toggle` (from `MenuToggle`, autoClose\n // dismissal, an item) then only report to `onVisibleChange`.\n const state = useMenuTriggerState(\n useOpenStateProps({ defaultVisible, onVisibleChange, visible }, 'Menu')\n )\n const { menuTriggerProps, menuProps } = useMenuTrigger<unknown>({}, state, toggleNodeRef)\n\n useIsomorphicLayoutEffect(() => {\n if (reference === 'parent') {\n targetRef.current = wrapperRef.current\n }\n }, [reference])\n\n // `onShown`/`onHidden` wait for chassis-css's own opacity/transform transition on `.menu`\n // (see `_menu.scss`) to actually finish, matching `Modal`'s identically-worded \"requests to\n // be shown\" vs \"finishes showing\" contract (`Modal.tsx`'s own `executeAfterTransition` use).\n // `overlayRef.current` is `MenuList`'s root element — already in the DOM and already\n // reflecting the new `.show` class by the time this effect runs, since React commits the\n // render before passive effects execute. Falls back to firing synchronously when no\n // `MenuList` is mounted to measure (nothing to transition, so nothing to wait for).\n //\n // All four report *transitions*, so none fires for the initial commit — mounting closed is not\n // a hide. Without this guard, mounting fired `onHide` (and scheduled `onHidden`) for every menu\n // on the page before `onShow` had ever fired once, which `Menu.spec.tsx` used to have to\n // `mockClear()` past. The guard compares against the state last reported, as\n // `useFloatingOverlay` does: a `mounted` flag let StrictMode's second run of the effect on\n // mount through.\n const reportedOpenRef = useRef(state.isOpen)\n\n useEffect(() => {\n const overlay = overlayRef.current\n if (reportedOpenRef.current === state.isOpen) return undefined\n reportedOpenRef.current = state.isOpen\n\n if (state.isOpen) {\n onShow?.()\n if (!overlay) {\n onShown?.()\n return undefined\n }\n return executeAfterTransition(overlay, () => onShown?.(), true)\n }\n\n onHide?.()\n if (!overlay) {\n onHidden?.()\n return undefined\n }\n return executeAfterTransition(overlay, () => onHidden?.(), true)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [state.isOpen])\n\n const {\n overlayProps,\n placement: resolvedPlacement,\n updatePosition\n } = useOverlayPosition({\n targetRef,\n overlayRef,\n placement: toAriaPlacement(placement),\n offset: offsetProp[1],\n crossOffset: offsetProp[0],\n containerPadding: 8,\n isOpen: state.isOpen,\n // `useOverlayPosition` closes on any window scroll via a backward-compat `WeakMap` that\n // `useMenuTrigger` populates for `targetRef.current` (see `MenuToggle`'s `setRefs`).\n // Passing `null` opts out so the menu repositions with its trigger instead of vanishing —\n // matching `Autocomplete`/`Combobox`, neither of which is wired into that map.\n onClose: null\n })\n useOverlayMaxHeight(overlayRef, state.isOpen)\n\n const { menuStyle, placementAttr } = resolveMenuOverlayPositioning(\n overlayProps.style,\n placement,\n resolvedPlacement\n )\n\n // Escape closes the menu and returns focus to the toggle. Controlled, the close is a request:\n // focus returns when `visible` follows it, in the effect below, and stays where it is when\n // nothing can follow it or the caller declines. Read through a ref because the context value\n // these functions travel in is memoized.\n const followsRequestsRef = useRef(true)\n followsRequestsRef.current = visible === undefined || !!onVisibleChange\n const isControlledRef = useRef(false)\n isControlledRef.current = visible !== undefined\n const focusReturnOwedRef = useRef(false)\n const focusReturnViaPointerRef = useRef(false)\n\n const show = (focusStrategy?: MenuFocusStrategy | null) => state.open(focusStrategy)\n const hide = () => {\n focusReturnOwedRef.current = false\n state.close()\n }\n const toggleVisible = (focusStrategy?: MenuFocusStrategy | null) => state.toggle(focusStrategy)\n // Focus returns by script, which matches `:focus-visible` whatever the interaction was: after an\n // item chosen with the pointer, the toggle is focused without its ring (`focusRedirect`), and a\n // key press brings the ring back.\n const closeAndReturnFocus = (viaPointer: boolean) => {\n state.close()\n if (!isControlledRef.current) focusRedirect(toggleNodeRef.current, viaPointer)\n else {\n focusReturnOwedRef.current = followsRequestsRef.current\n focusReturnViaPointerRef.current = viaPointer\n }\n }\n const close = () => closeAndReturnFocus(false)\n\n useEffect(() => {\n if (!state.isOpen && focusReturnOwedRef.current) {\n focusRedirect(toggleNodeRef.current, focusReturnViaPointerRef.current)\n }\n focusReturnOwedRef.current = false\n }, [state.isOpen])\n\n // The open dialog the toggle is in, if any, as `Popover` and `ContextMenu` resolve it: a list\n // teleported by `container` goes into that dialog rather than `document.body`, which lies\n // under a modal dialog's top layer, and the menu closes when the dialog does, teleported or\n // not, so a reopened dialog doesn't show a menu left open. `onShow`/`onHide` stay with the\n // effect above.\n const portalContainer = useFloatingOverlay({\n close: hide,\n isOpen: state.isOpen,\n triggerRef: toggleNodeRef\n })\n\n // The list is mounted again when it moves into the dialog, as a new element in another\n // containing block: placed again here, after its ref is set and before the paint.\n useIsomorphicLayoutEffect(() => {\n if (state.isOpen) updatePosition()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [portalContainer])\n\n // Deferred so the click that opened the menu doesn't immediately close it, and scoped\n // to match menu.js's `clearMenus`: skip the toggle itself, honor `inside`/`outside`\n // modes, and let Tab or clicks on form controls inside the menu pass through untouched.\n useEffect(() => {\n if (!state.isOpen || autoClose === false) return undefined\n\n // A toggle's click can come both ways: from the toggle, and on `window` when nothing stopped it.\n const handled = new WeakSet<Event>()\n const handleDismiss = (event: Event, stopped = false) => {\n if (event instanceof KeyboardEvent && event.key !== 'Tab') return\n if (handled.has(event)) return\n handled.add(event)\n\n const target = event.target as Node\n const toggleNode = toggleNodeRef.current\n const menuNode = overlayRef.current\n\n if (toggleNode?.contains(target)) return\n\n const lists = [menuNode, ...submenuOverlaysRef.current.values()]\n const isMenuTarget = lists.some((node) => !!node?.contains(target))\n\n // An overlay opened from the menu (a popover on an item, a picker's list) is portaled out\n // of the list, and React still renders it under it (`insideEvents`). A click there is\n // neither a click on an item nor one outside the menu: it is that overlay's.\n if (!isMenuTarget && isEventInside(event, overlayRef)) return\n if (isMenuTarget && menuToggleClicks.has(event)) return\n\n if (autoClose === 'inside' && !isMenuTarget) return\n if (autoClose === 'outside' && isMenuTarget) return\n\n // A click in the list that never bubbled up to `window` (`stopped`, `listenOnWindow`) was\n // taken by a react-aria control in the list (a `NumberField`'s stepper, a `SearchField`'s\n // clear button, a picker's toggle): used in place, as a native form control is. An item's\n // click bubbles.\n if (\n isMenuTarget &&\n (stopped ||\n (event instanceof KeyboardEvent && event.key === 'Tab') ||\n isFormControlClick(target, lists))\n ) {\n return\n }\n\n // An item chosen returns focus to the toggle, as Escape does: the closed list is\n // `display: none`, and focus on an item in it fell to `<body>`. Only while the menu holds\n // focus, or nothing does: an item that opened a dialog has moved it there. A click outside\n // or Tab has put focus where it is going already.\n const active = document.activeElement\n const holdsFocus =\n !active ||\n active === document.body ||\n !!menuNode?.contains(active) ||\n Array.from(submenuOverlaysRef.current.values()).some((node) => node.contains(active))\n // A click from the keyboard (Enter or Space on an item) has no `detail`.\n if (isMenuTarget && holdsFocus) {\n closeAndReturnFocus(event instanceof MouseEvent && event.detail > 0)\n } else hide()\n }\n\n // On `window`, including a click that a react-aria pressable outside stopped\n // (`listenOnWindow`).\n const cleanups: Array<() => void> = []\n const id = window.setTimeout(() => {\n cleanups.push(listenOnWindow('click', handleDismiss), listenOnWindow('keyup', handleDismiss))\n openMenuDismissals.add(handleDismiss)\n })\n\n return () => {\n window.clearTimeout(id)\n for (const cleanup of cleanups) cleanup()\n openMenuDismissals.delete(handleDismiss)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [state.isOpen, autoClose])\n\n // Escape should always close the menu, independent of `autoClose`'s inside/outside/false\n // modes. `MenuList`'s own `onKeyDown` handling only fires when focus is already inside the\n // panel (e.g. opened via ArrowDown) — a mouse-press open via `useMenuTrigger` leaves focus on\n // the trigger button, where that handler is unreachable. The stack of open overlays listens on\n // `window`, which catches Escape regardless of where focus currently is, and gives it to this\n // menu only while nothing opened since is still open, and never to the popover or the dialog\n // around the menu as well.\n useEffect(() => {\n if (!state.isOpen) return undefined\n\n return pushOverlay({\n nodes: () => [overlayRef.current, toggleNodeRef.current],\n onEscape: close\n })\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [state.isOpen])\n\n const contextValue: MenuContextProps = useMemo(\n () => ({\n autoClose,\n close,\n container: container === true ? (portalContainer ?? true) : container,\n focusStrategy: state.focusStrategy as MenuFocusStrategy | null,\n hide,\n menuId: menuProps.id ?? '',\n menuStyle,\n menuTriggerProps,\n overlayRef,\n placementAttr,\n portalContainer,\n reference,\n registerOverlay,\n show,\n targetRef,\n toggle: toggleVisible,\n toggleNodeRef,\n triggerId: menuTriggerProps.id ?? '',\n visible: state.isOpen\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n autoClose,\n container,\n state.focusStrategy,\n menuProps.id,\n menuStyle,\n menuTriggerProps,\n placementAttr,\n portalContainer,\n reference,\n state.isOpen\n ]\n )\n\n // Inside a `NavOverflow`, a menu in a nav item is that item's content, not its link: a toggle\n // rendered as a `NavLink` has nothing to show in the overflow menu.\n const content = <NavOverflowBoundary>{children}</NavOverflowBoundary>\n\n return (\n <MenuContext.Provider value={contextValue}>\n {Component === Fragment ? (\n content\n ) : (\n // `show` mirrors vanilla menu.js's `this._parent.classList.add('show')` — needed for\n // e.g. `.nav-item.show .nav-link` to put a `NavLink`-rooted `MenuToggle` into its\n // pressed look while open, since a bare `.nav-link.show` has no styling of its own.\n <Component\n className={classNames(className, { show: state.isOpen })}\n {...rest}\n ref={forkedRef}\n >\n {content}\n </Component>\n )}\n </MenuContext.Provider>\n )\n}\n\nexport const Menu = createPolymorphicComponent<MenuComponent>(\n MenuRender as ForwardRefRenderFunction<Element, MenuProps<ElementType>>,\n 'Menu'\n)\n"],"mappings":"A,gyBAYA,SAAgBa,EACd,EACA,EACY,CACZ,IAAMC,kBAAU,IAAI,IAEdC,EAAiB,GAA6B,CAClDD,EAAQ,IACNE,EACA,OAAO,eAAiB,CACtBF,EAAQ,OAAOE,CAAK,EACpBC,EAAQD,EAAO,EAAI,CACrB,CAAC,CACH,CACF,EAEME,EAAgB,GAA6B,CACjD,OAAO,aAAaJ,EAAQ,IAAIE,CAAK,CAAC,EACtCF,EAAQ,OAAOE,CAAK,EACpBC,EAAQD,EAAO,EAAK,CACtB,EAIA,OAFA,OAAO,iBAAiBG,EAAMJ,EAAe,EAAI,EACjD,OAAO,iBAAiBI,EAAMD,CAAY,MAC7B,CACX,OAAO,oBAAoBC,EAAMJ,EAAe,EAAI,EACpD,OAAO,oBAAoBI,EAAMD,CAAY,EAC7C,IAAK,IAAME,KAASN,EAAQ,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AAcE,EACb6D,EAKA,kBAAA,cAAC/D,EAAD,CACE,UAAWtB,GAAWuF,EAAW,CAAE,KAAMnD,EAAM,MAAO,CAAC,EACvD,GAAIf,GACJ,IAAKM,EAGI,EADR0D,CACQ,CAEO,CAE1B,CAEA,MAAaG,EAAOC,EAClBtE,EACA,MACF,E"}
@@ -0,0 +1,2 @@
1
+ import{d as e,f as t,m as n,v as r}from"./slot-DagH0Gxq.js";import{t as i}from"./useForkedRef-WoqMqsWE.js";import{t as a}from"./polymorphic-mAKwlLiW.js";import{t as o}from"./useHydrated-Dud4JEwp.js";import{t as s}from"./renderMenuItemContent-DNdj-Ukz.js";import{t as c}from"./Portal-BTDylxAi.js";import{t as l}from"./Link-B3SX50Od.js";import{t as u}from"./Button-Cjenm3ku.js";import{t as d}from"./insideEvents-CWcNrMu7.js";import{a as f,i as p,n as m}from"./Menu-DBN4Mxak.js";import h,{createContext as g,forwardRef as _,useContext as v,useEffect as y,useRef as b}from"react";import x from"classnames";import{mergeProps as S,useButton as C}from"react-aria";const w=_(({className:e,...t},n)=>{let r=x(`menu-divider`,e);return/* @__PURE__ */ h.createElement(`hr`,{className:r,...t,ref:n})});w.displayName=`MenuDivider`;function T({children:e,className:t,component:n,role:r=`presentation`,...i},a){let o=n??`h4`,s=x(`menu-header`,t);return/* @__PURE__ */ h.createElement(o,{className:s,role:r,...i,ref:a},e)}const E=a(T,`MenuHeader`);function D({children:e,className:t,component:r,description:i,href:a,icon:o,onClick:c,selected:u,...d},f){let p=x(`menu-item`,{selected:u},t);return/* @__PURE__ */ h.createElement(l,{role:`menuitem`,component:n(r,a,`button`),href:a,onClick:e=>{a===`#`&&e.preventDefault(),c?.(e)},...d,className:p,ref:f},s({icon:o,label:e,description:i}))}const O=a(D,`MenuItem`),k=`:is(.menu-item, .submenu-back):not(.disabled):not(:disabled)`,A=e=>!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length),j=e=>{if(!e)return[];let t=[];for(let n of Array.from(e.children))if(n.matches(k))t.push(n);else if(n.classList.contains(`submenu`)){let e=Array.from(n.children).find(e=>e.matches(k));e&&t.push(e)}return t.filter(A)},M=(e,t)=>{e.length&&(t===`first`?e[0]:e[e.length-1]).focus()},N=/* @__PURE__ */ new Set([`button`,`checkbox`,`image`,`reset`,`submit`]),P=e=>e.isContentEditable||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLInputElement&&!N.has(e.type),F=(e,{onArrowLeft:t,onArrowRight:n,onEscape:r})=>{let i=e.currentTarget,a=e.target;if(!(e.key!==`Escape`&&P(a)))switch(e.key){case`ArrowDown`:case`ArrowUp`:{e.preventDefault(),e.stopPropagation();let t=j(i);if(!t.length)return;let n=t.indexOf(a);t[n===-1?e.key===`ArrowDown`?0:t.length-1:(n+(e.key===`ArrowDown`?1:-1)+t.length)%t.length].focus();return}case`Home`:case`End`:e.preventDefault(),e.stopPropagation(),M(j(i),e.key===`Home`?`first`:`last`);return;case`Escape`:if(!r)return;e.preventDefault(),e.stopPropagation(),r();return;case`ArrowLeft`:if(!t)return;e.preventDefault(),e.stopPropagation(),t();return;case`ArrowRight`:if(!n)return;e.preventDefault(),e.stopPropagation(),n();return}},I=g(null),L=()=>{let e=b(null);if(!e.current){let t=/* @__PURE__ */ new Map;e.current={register:(e,n)=>(t.set(e,n),()=>{t.delete(e)}),notifyOpen:e=>{t.forEach((t,n)=>{n!==e&&t()})}}}return e.current},R=g(null),z=g(!0),B=e=>e.type===`header`?/* @__PURE__ */ h.createElement(E,{key:e.id},e.label):e.type===`divider`?/* @__PURE__ */ h.createElement(w,{key:e.id}):/* @__PURE__ */ h.createElement(O,{key:e.id,href:e.href,disabled:e.disabled,selected:e.selected,onClick:e.onClick},s({icon:e.icon,label:e.label,description:e.description,selected:e.selected}));function V({children:e,className:t,component:n,items:r,onKeyDown:a,...s},l){let u=n??`div`,{close:f,container:p,focusStrategy:g,menuId:_,menuStyle:b,overlayRef:C,placementAttr:w,triggerId:T,visible:E}=v(m),D=i(l,C),O=L(),k=o(),A=E&&k;y(()=>{E&&g&&M(j(C.current),g===`last`?`last`:`first`)},[E,g]);let N=e=>{F(e,{onEscape:f}),a?.(e)},P=s[`aria-label`]?void 0:T||void 0,R=/* @__PURE__ */ h.createElement(u,{role:`menu`,id:_,"aria-labelledby":P,className:x(`menu`,{show:A},t),style:b,"data-cx-placement":w,...S(s,d(C)),onKeyDown:N,ref:D},/* @__PURE__ */ h.createElement(I.Provider,{value:O},r?r.map(B):e));return p?/* @__PURE__ */ h.createElement(c,{container:p===!0?void 0:p},R):R}const H=a(V,`MenuList`);function U({children:n,caret:a=!0,className:o,component:s,disabled:c,href:l,onClick:d,onKeyDown:g,tabIndex:_,...y},w){let{hide:T,menuTriggerProps:E,reference:D,targetRef:O,toggleNodeRef:k,visible:A}=v(m),j=s??u,M=b(null),N=j===u?e(l)?`anchor`:`button`:r(j,l,y),P=N===`button`,F=j===u?{href:l}:t(N,l,`MenuToggle`),{buttonProps:I}=C({...E,elementType:P?`button`:`a`,isDisabled:c},M),L=b(!1),R=i(w,e=>{M.current=e,k.current=e,D!==`parent`&&(O.current=e)}),z=e=>{L.current=e.pointerType!==`touch`&&A},B=e=>{if(e.preventDefault(),p.add(e.nativeEvent),!c){for(let t of[...f])t(e.nativeEvent);L.current&&(L.current=!1,T()),d?.(e)}};return/* @__PURE__ */ h.createElement(j,{...P?{type:`button`}:{},className:x({caret:a,show:A},o),disabled:c,...S({onPointerDown:z},y,I,{onClick:B,onKeyDown:g,..._!==void 0&&{tabIndex:_}}),...F,ref:R},n)}const W=a(U,`MenuToggle`);export{z as a,j as c,E as d,w as f,I as i,F as l,H as n,L as o,R as r,M as s,W as t,O as u};
2
+ //# sourceMappingURL=MenuToggle-DHzKm1Ed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MenuToggle-DHzKm1Ed.js","names":["hasHref","hrefProps","linkElement","resolveLinkKind","useForkedRef","createPolymorphicComponent","useHydrated","renderMenuItemContent","Portal","Link","Button","insideEventProps","openMenuDismissals","menuToggleClicks","MenuContext","React","classNames","MenuDivider","forwardRef","rest","_className","className","MenuHeaderRender","Component","component","children","MenuHeader","MenuItemRender","href","event","onClick","MenuItem","VISIBLE_ITEMS_SELECTOR","isVisible","element","getMenuItems","menu","items","child","trigger","grandchild","focusMenuItem","target","KEYLESS_INPUT_TYPES","usesKeysInPlace","handleMenuKeyDown","currentIndex","onEscape","onArrowLeft","onArrowRight","SubmenuGroupContext","createContext","useSubmenuGroupProvider","ref","useRef","closers","id","close","key","SubmenuActionsContext","SubmenuVisibleContext","renderMenuItemDef","def","MenuListRender","useContext","forkedRef","overlayRef","submenuGroup","hydrated","shown","visible","useEffect","focusStrategy","handleKeyDown","onKeyDown","labelledBy","triggerId","content","menuId","menuStyle","placementAttr","mergeProps","container","MenuList","MenuToggleRender","buttonRef","kind","rendersButton","linkProps","useButton","menuTriggerProps","disabled","wasOpenRef","node","reference","handlePointerDown","handleClick","dismiss","hide","buttonProps","tabIndex","MenuToggle"],"sources":["../../src/components/menu/MenuDivider.tsx","../../src/components/menu/MenuHeader.tsx","../../src/components/menu/MenuItem.tsx","../../src/components/menu/menuNavigation.ts","../../src/components/menu/submenuGroup.ts","../../src/components/menu/MenuList.tsx","../../src/components/menu/MenuToggle.tsx"],"sourcesContent":["import React, { forwardRef, HTMLAttributes } from 'react'\nimport classNames from 'classnames'\n\nexport interface MenuDividerProps extends HTMLAttributes<HTMLHRElement> {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n}\n\nexport const MenuDivider = forwardRef<HTMLHRElement, MenuDividerProps>(\n ({ className, ...rest }, ref) => {\n const _className = classNames('menu-divider', className)\n\n return <hr className={_className} {...rest} ref={ref} />\n }\n)\n\nMenuDivider.displayName = 'MenuDivider'\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype MenuHeaderOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n /**\n * ARIA role applied to the root node. Defaults to `'presentation'` — see the render function\n * for why.\n */\n role?: React.AriaRole\n}\n\nexport type MenuHeaderProps<C extends ElementType = 'h4'> = PolymorphicComponentProps<\n C,\n MenuHeaderOwnProps<C>\n>\n\ntype MenuHeaderComponent = (<C extends ElementType = 'h4'>(\n props: MenuHeaderProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction MenuHeaderRender<C extends ElementType = 'h4'>(\n { children, className, component, role = 'presentation', ...rest }: MenuHeaderProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'h4'\n const _className = classNames('menu-header', className)\n\n // Always rendered as a direct child of `role=\"menu\"` (see MenuList) — ARIA's menu role only\n // permits menuitem/group/separator children, so a bare heading fails aria-required-children.\n // `role=\"presentation\"` opts the element itself out without hiding its text content.\n return (\n <Component className={_className} role={role} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const MenuHeader = createPolymorphicComponent<MenuHeaderComponent>(\n MenuHeaderRender as ForwardRefRenderFunction<Element, MenuHeaderProps<ElementType>>,\n 'MenuHeader'\n)\n","import React, {\n ElementType,\n ForwardRefRenderFunction,\n MouseEvent,\n ReactElement,\n ReactNode\n} from 'react'\nimport classNames from 'classnames'\n\nimport { linkElement } from '../../utils/elementKind'\nimport {\n createPolymorphicComponent,\n PolymorphicRef,\n PolymorphicRefWithFallback\n} from '../../utils/polymorphic'\nimport { renderMenuItemContent } from './renderMenuItemContent'\nimport { LinkProps, Link } from '../link/Link'\n\ntype MenuItemOwnProps = {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Secondary line of text rendered below `children` (`.menu-item-description`).\n */\n description?: ReactNode\n /**\n * Icon rendered at the item's leading edge (`.menu-item-icon`).\n */\n icon?: ReactNode\n /**\n * Marks the item as the current selection in a choice list. Renders in a heavier font weight.\n * Combine with a manually-composed `.menu-item-check` icon (in `children`, or via `icon` on a\n * plain, non-selection item) to also show a checkmark — this prop alone doesn't add one, so\n * existing font-weight-only usage keeps rendering unchanged.\n */\n selected?: boolean\n}\n\nexport type MenuItemProps<C extends ElementType = 'a'> = LinkProps<C> & MenuItemOwnProps\n\ntype MenuItemComponent = (<C extends ElementType = 'a'>(\n props: MenuItemProps<C> & {\n ref?: PolymorphicRefWithFallback<C, HTMLAnchorElement | HTMLButtonElement>\n }\n) => ReactElement | null) & { displayName?: string }\n\nfunction MenuItemRender<C extends ElementType = 'a'>(\n {\n children,\n className,\n component,\n description,\n href,\n icon,\n onClick,\n selected,\n ...rest\n }: MenuItemProps<C>,\n ref: PolymorphicRef<C>\n) {\n const _className = classNames('menu-item', { selected }, className)\n\n // `href=\"#\"` is a common placeholder for menu items that act via `onClick` rather than\n // real navigation. Left alone, a plain anchor click still navigates to the empty fragment,\n // which scrolls the page to the top — so we suppress that default for the placeholder case\n // only, leaving real same-page anchors (`href=\"#some-id\"`) free to navigate as expected.\n const handleClick = (event: MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => {\n if (href === '#') event.preventDefault()\n onClick?.(event)\n }\n\n // An item with `href` is an `<a>`, one without is a `<button type=\"button\">`, unless `component`\n // or `asChild` chose the element (see `linkElement`). chassis-css styles both as `.menu-item`.\n // An item without `href` used to be an `<a>` with no `href`, which isn't focusable, so keyboard\n // users couldn't reach it outside the menu's own arrow-key handling.\n return (\n <Link\n role=\"menuitem\"\n component={linkElement(component as ElementType | undefined, href, 'button')}\n href={href}\n onClick={handleClick}\n {...(rest as Record<string, unknown>)}\n className={_className}\n ref={ref as PolymorphicRef<ElementType>}\n >\n {renderMenuItemContent({ icon, label: children, description })}\n </Link>\n )\n}\n\nexport const MenuItem = createPolymorphicComponent<MenuItemComponent>(\n MenuItemRender as ForwardRefRenderFunction<Element, MenuItemProps<ElementType>>,\n 'MenuItem'\n)\n","import React from 'react'\n\n// Mirrors Chassis CSS's menu.js SELECTOR_VISIBLE_ITEMS / SELECTOR_KB_NAV_ITEMS: direct-child\n// menu items and submenu-back buttons, plus submenu trigger items nested one level inside a\n// `.submenu` wrapper (which aren't direct children of the `.menu`).\n//\n// Walks `children` directly rather than a `:scope`-based `querySelectorAll` — jsdom's selector\n// engine (nwsapi) mis-parses `:scope` queries against an element whose `id` contains a colon,\n// which is exactly the shape of React 18's default `useId()` output now that `MenuList`/\n// `MenuSubmenu` set a real `id` for `aria-controls`/`aria-labelledby` linking. Real browsers don't\n// have this bug, but walking children is just as correct and sidesteps it either way.\nconst VISIBLE_ITEMS_SELECTOR = ':is(.menu-item, .submenu-back):not(.disabled):not(:disabled)'\n\nconst isVisible = (element: HTMLElement) =>\n Boolean(element.offsetWidth || element.offsetHeight || element.getClientRects().length)\n\nexport const getMenuItems = (menu: HTMLElement | null): HTMLElement[] => {\n if (!menu) return []\n const items: HTMLElement[] = []\n for (const child of Array.from(menu.children)) {\n if (child.matches(VISIBLE_ITEMS_SELECTOR)) {\n items.push(child as HTMLElement)\n } else if (child.classList.contains('submenu')) {\n const trigger = Array.from(child.children).find((grandchild) =>\n grandchild.matches(VISIBLE_ITEMS_SELECTOR)\n )\n if (trigger) items.push(trigger as HTMLElement)\n }\n }\n return items.filter(isVisible)\n}\n\nexport const focusMenuItem = (items: HTMLElement[], target: 'first' | 'last') => {\n if (!items.length) return\n ;(target === 'first' ? items[0]! : items[items.length - 1]!).focus()\n}\n\n// Input types whose arrow, Home and End keys do nothing of their own: in a menu, those keys move\n// between its items. Every other input uses them in place (the caret of a text field, a radio\n// group, a range), as do a `<select>`, a `<textarea>` and an editable element.\nconst KEYLESS_INPUT_TYPES = new Set(['button', 'checkbox', 'image', 'reset', 'submit'])\n\nconst usesKeysInPlace = (target: HTMLElement) =>\n target.isContentEditable ||\n target instanceof HTMLTextAreaElement ||\n target instanceof HTMLSelectElement ||\n (target instanceof HTMLInputElement && !KEYLESS_INPUT_TYPES.has(target.type))\n\nexport interface MenuKeyDownOptions {\n onArrowLeft?: () => void\n onArrowRight?: () => void\n onEscape?: () => void\n}\n\n// Scoped to `event.currentTarget` (the `.menu` element the handler is bound to), so the same\n// function drives keyboard navigation for both the top-level menu and any nested submenu list.\n// `onArrowLeft`/`onArrowRight` are both optional and independent (rather than a single\n// direction-agnostic \"close\" callback) so a caller under an RTL locale can wire the one that\n// actually points back toward the trigger — see `MenuSubmenu`, the only current consumer of\n// either.\nexport const handleMenuKeyDown = (\n event: React.KeyboardEvent<HTMLElement>,\n { onArrowLeft, onArrowRight, onEscape }: MenuKeyDownOptions\n): void => {\n const menu = event.currentTarget\n const target = event.target as HTMLElement\n\n // A form control in the list is used in place (menu.mdx): its own keys are left to it. Escape\n // still closes the menu.\n if (event.key !== 'Escape' && usesKeysInPlace(target)) return\n\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowUp': {\n event.preventDefault()\n event.stopPropagation()\n const items = getMenuItems(menu)\n if (!items.length) return\n const currentIndex = items.indexOf(target)\n const nextIndex =\n currentIndex === -1\n ? event.key === 'ArrowDown'\n ? 0\n : items.length - 1\n : (currentIndex + (event.key === 'ArrowDown' ? 1 : -1) + items.length) % items.length\n // `nextIndex` is always a valid index into `items` here (0, items.length - 1, or a modulo\n // result — the `if (!items.length) return` above already ruled out the empty-array case).\n items[nextIndex]!.focus()\n return\n }\n case 'Home':\n case 'End': {\n event.preventDefault()\n event.stopPropagation()\n focusMenuItem(getMenuItems(menu), event.key === 'Home' ? 'first' : 'last')\n return\n }\n case 'Escape': {\n if (!onEscape) return\n event.preventDefault()\n event.stopPropagation()\n onEscape()\n return\n }\n case 'ArrowLeft': {\n if (!onArrowLeft) return\n event.preventDefault()\n event.stopPropagation()\n onArrowLeft()\n return\n }\n case 'ArrowRight': {\n if (!onArrowRight) return\n event.preventDefault()\n event.stopPropagation()\n onArrowRight()\n return\n }\n default:\n }\n}\n","import { createContext, useRef } from 'react'\n\n// Lets sibling `.submenu` flyouts at the same menu level close one another when a new one\n// opens, mirroring menu.js's `_closeSiblingSubmenus`. One provider instance is created per\n// menu level (the top-level `.menu` and each `.submenu`'s own nested list) and lives for the\n// lifetime of that level, so registration doesn't churn on every render.\nexport interface SubmenuGroupContextValue {\n register: (id: string, close: () => void) => () => void\n notifyOpen: (id: string) => void\n}\n\nexport const SubmenuGroupContext = createContext<SubmenuGroupContextValue | null>(null)\n\nexport const useSubmenuGroupProvider = (): SubmenuGroupContextValue => {\n const ref = useRef<SubmenuGroupContextValue | null>(null)\n\n if (!ref.current) {\n const closers = new Map<string, () => void>()\n ref.current = {\n register: (id, close) => {\n closers.set(id, close)\n return () => {\n closers.delete(id)\n }\n },\n notifyOpen: (id) => {\n closers.forEach((close, key) => {\n if (key !== id) close()\n })\n }\n }\n }\n\n return ref.current\n}\n\n// Exposes the current `.submenu`'s own close-and-refocus action to a nested `MenuSubmenuBack`\n// button, without threading it through the sibling-group registry above.\nexport interface SubmenuActionsContextValue {\n close: () => void\n}\n\nexport const SubmenuActionsContext = createContext<SubmenuActionsContextValue | null>(null)\n\n// Whether the `.submenu` a nested `MenuSubmenu` is in is open. A submenu's panel is portaled out\n// of its parent's, so nothing hides it when the parent closes: it follows this, as the first\n// level follows the `Menu` itself. `true` at the top level, where there is no parent submenu.\nexport const SubmenuVisibleContext = createContext(true)\n","import React, {\n ElementType,\n ForwardRefRenderFunction,\n ReactElement,\n ReactNode,\n useContext,\n useEffect\n} from 'react'\nimport classNames from 'classnames'\nimport { mergeProps } from 'react-aria'\n\nimport { useForkedRef } from '../../hooks'\nimport { insideEventProps } from '../../utils/insideEvents'\nimport { renderMenuItemContent } from './renderMenuItemContent'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { useHydrated } from '../../hooks/useHydrated'\nimport { Portal } from '../portal/Portal'\nimport { MenuContext } from './Menu'\nimport { MenuDivider } from './MenuDivider'\nimport { MenuHeader } from './MenuHeader'\nimport { MenuItem } from './MenuItem'\nimport { MenuItemsDef } from './MenuItemDef'\nimport { focusMenuItem, getMenuItems, handleMenuKeyDown } from './menuNavigation'\nimport { SubmenuGroupContext, useSubmenuGroupProvider } from './submenuGroup'\n\ntype MenuListOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n /**\n * Array of item/header/divider definitions for data-driven rendering. When provided, children\n * are ignored. Covers flat items, headers, and dividers only — for nested submenus, compose\n * with `children` and `MenuSubmenu` instead.\n */\n items?: MenuItemsDef\n}\n\nexport type MenuListProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n MenuListOwnProps<C>\n>\n\ntype MenuListComponent = (<C extends ElementType = 'div'>(\n props: MenuListProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nconst renderMenuItemDef = (def: MenuItemsDef[number]): ReactNode => {\n if (def.type === 'header') {\n return <MenuHeader key={def.id}>{def.label}</MenuHeader>\n }\n if (def.type === 'divider') {\n return <MenuDivider key={def.id} />\n }\n return (\n <MenuItem\n key={def.id}\n href={def.href}\n disabled={def.disabled}\n selected={def.selected}\n onClick={def.onClick}\n >\n {renderMenuItemContent({\n icon: def.icon,\n label: def.label,\n description: def.description,\n selected: def.selected\n })}\n </MenuItem>\n )\n}\n\nfunction MenuListRender<C extends ElementType = 'div'>(\n { children, className, component, items, onKeyDown, ...rest }: MenuListProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const {\n close,\n container,\n focusStrategy,\n menuId,\n menuStyle,\n overlayRef,\n placementAttr,\n triggerId,\n visible\n } = useContext(MenuContext)\n const forkedRef = useForkedRef(ref, overlayRef)\n const submenuGroup = useSubmenuGroupProvider()\n // The list is positioned in a layout effect, which the server never runs: a menu open on its\n // first render was painted at the top left of the page until the JavaScript had loaded. It is\n // shown once hydration has finished, where that effect has placed it.\n const hydrated = useHydrated()\n const shown = visible && hydrated\n\n // ArrowDown/ArrowUp on the trigger opens the menu with a focus strategy (see `Menu`'s\n // `useMenuTrigger` wiring) — this is where that intent actually lands, since we're not\n // adopting `useMenu`'s own collection-aware auto-focus.\n useEffect(() => {\n if (!visible || !focusStrategy) return\n focusMenuItem(getMenuItems(overlayRef.current), focusStrategy === 'last' ? 'last' : 'first')\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [visible, focusStrategy])\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n handleMenuKeyDown(event, { onEscape: close })\n onKeyDown?.(event as React.KeyboardEvent<HTMLDivElement>)\n }\n\n // Labelled by the trigger, unless the caller names the list itself: `aria-labelledby` would\n // outrank that `aria-label`. Left out when there is no trigger to point at (a `ContextMenu`'s\n // region with no id of its own has one; a list rendered with no `Menu` around it has none).\n const ariaLabel = (rest as { 'aria-label'?: string })['aria-label']\n const labelledBy = ariaLabel ? undefined : triggerId || undefined\n\n const content = (\n <Component\n role=\"menu\"\n id={menuId}\n aria-labelledby={labelledBy}\n className={classNames('menu', { show: shown }, className)}\n style={menuStyle}\n data-cx-placement={placementAttr}\n // Marks the events that reach the list through React's tree, for the `Menu` or the\n // `ContextMenu` to tell an overlay opened from an item from the page outside.\n {...(mergeProps(rest, insideEventProps(overlayRef)) as Record<string, unknown>)}\n onKeyDown={handleKeyDown}\n ref={forkedRef}\n >\n <SubmenuGroupContext.Provider value={submenuGroup}>\n {items ? items.map(renderMenuItemDef) : children}\n </SubmenuGroupContext.Provider>\n </Component>\n )\n\n if (container) {\n return <Portal container={container === true ? undefined : container}>{content}</Portal>\n }\n\n return content\n}\n\nexport const MenuList = createPolymorphicComponent<MenuListComponent>(\n MenuListRender as ForwardRefRenderFunction<Element, MenuListProps<ElementType>>,\n 'MenuList'\n)\n","import React, {\n ElementType,\n ForwardRefRenderFunction,\n ReactElement,\n useContext,\n useRef\n} from 'react'\nimport classNames from 'classnames'\nimport { mergeProps, useButton } from 'react-aria'\n\nimport { Button, ButtonProps } from '../button/Button'\nimport { MenuContext, menuToggleClicks, openMenuDismissals } from './Menu'\nimport { ContextColor, Shapes } from '../../types'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { useForkedRef } from '../../hooks'\nimport { hasHref, hrefProps, resolveLinkKind } from '../../utils/elementKind'\n\ntype MenuToggleOwnProps<C extends ElementType> = {\n /**\n * Toggle the active state for the component.\n */\n active?: boolean\n /**\n * Draws the caret after the toggle's content. Set it to `false` for a toggle that shows what it\n * is another way, such as an icon-only \"more\" button.\n *\n * @default true\n */\n caret?: boolean\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Sets the color of the component to one of Chassis context colors. Only applies to the\n * default `Button` root.\n */\n color?: ContextColor\n /**\n * Component used for the root node — the trigger element the menu opens from. Defaults to\n * `Button`; swap for e.g. `NavLink` to render a nav-item-style trigger (`.nav-link.caret`)\n * instead of a `.button.caret`. Its own props are type-checked at the call site once passed\n * here.\n */\n component?: C\n /**\n * Toggle the disabled state for the component.\n */\n disabled?: boolean\n /**\n * The href attribute specifies the URL of the page the link goes to.\n */\n href?: string\n /**\n * Select the shape of the component. Only applies to the default `Button` root.\n */\n shape?: Shapes\n /**\n * Size the component sm or lg. Only applies to the default `Button` root.\n */\n size?: 'sm' | 'lg'\n /**\n * Sets the style variant of the component, as `Button`'s own `variant` does. Only applies to\n * the default `Button` root.\n */\n variant?: ButtonProps['variant']\n}\n\nexport type MenuToggleProps<C extends ElementType = typeof Button> = PolymorphicComponentProps<\n C,\n MenuToggleOwnProps<C>\n>\n\ntype MenuToggleComponent = (<C extends ElementType = typeof Button>(\n props: MenuToggleProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction MenuToggleRender<C extends ElementType = typeof Button>(\n {\n children,\n caret = true,\n className,\n component,\n disabled,\n href,\n onClick,\n onKeyDown,\n tabIndex,\n ...rest\n }: MenuToggleProps<C>,\n ref: PolymorphicRef<C>\n) {\n const { hide, menuTriggerProps, reference, targetRef, toggleNodeRef, visible } =\n useContext(MenuContext)\n const Component = component ?? Button\n const buttonRef = useRef<HTMLButtonElement | null>(null)\n // What the root renders. The default `Button` renders a `<button>`, or an `<a>` given `href`.\n // Anything else is asked, like every polymorphic component asks: `NavLink` is a component\n // reference, and `component=\"button\"` a real `<button>`.\n const kind =\n Component === Button\n ? hasHref(href)\n ? 'anchor'\n : 'button'\n : resolveLinkKind(Component, href, rest)\n const rendersButton = kind === 'button'\n // `Button` applies the `href` rule itself; anything else gets `href` only if it can take one.\n const linkProps = Component === Button ? { href } : hrefProps(kind, href, 'MenuToggle')\n // `elementType` tells react-aria whether the rendered root already has native button\n // semantics or needs them emulated (`role=\"button\"`, keyboard activation). `isDisabled` keeps\n // its press and its keys from opening the menu: `disabled` alone reaches only the rendered\n // element, and an `<a>` (a `NavLink`, a `Button` with `href`) still delivers both.\n const { buttonProps } = useButton(\n {\n ...menuTriggerProps,\n elementType: rendersButton ? 'button' : 'a',\n isDisabled: disabled\n },\n buttonRef\n )\n const wasOpenRef = useRef(false)\n\n const setRefs = (node: HTMLButtonElement | null) => {\n buttonRef.current = node\n toggleNodeRef.current = node\n if (reference !== 'parent') {\n targetRef.current = node\n }\n }\n\n const forkedRef = useForkedRef(ref, setRefs)\n\n // react-aria's `useMenuTrigger` opens (rather than toggles) on mouse/pen press start, so\n // re-clicking an already-open trigger would otherwise re-open it right back instead of\n // closing it. Capture whether it was open before that happens — ours has to run ahead of\n // `buttonProps`' own `onPointerDown` in the `mergeProps` chain below — then close it back\n // down on click. Touch is exempt: react-aria's `onPress` already toggles it correctly there.\n const handlePointerDown = (event: React.PointerEvent<HTMLButtonElement>) => {\n wasOpenRef.current = event.pointerType !== 'touch' && visible\n }\n\n // Another open menu closes on the click (`openMenuDismissals`), unless this toggle is in its\n // list (`menuToggleClicks`).\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n event.preventDefault()\n menuToggleClicks.add(event.nativeEvent)\n // A disabled `<a>` still takes the click, which runs no `onClick`, as a `<button disabled>`\n // takes none. Another open menu closes on it on `window`, as on any click outside it.\n if (disabled) return\n for (const dismiss of [...openMenuDismissals]) dismiss(event.nativeEvent)\n if (wasOpenRef.current) {\n wasOpenRef.current = false\n hide()\n }\n onClick?.(event)\n }\n\n return (\n <Component\n // A `<button>` root needs an explicit `type` to avoid an implicit form submit; other roots\n // (e.g. `NavLink`) don't render a `<button>` at all.\n {...(rendersButton ? { type: 'button' } : {})}\n // The `.caret` utility (rather than styling off `[data-cx-toggle=\"menu\"]`, as the vanilla\n // CSS docs show) keeps this element from also matching Chassis CSS's own vanilla menu.js\n // selectors on a page that happens to load both — this component reimplements all of that\n // behavior itself, so there's nothing for the vanilla plugin to usefully do with it anyway.\n // `show` mirrors `MenuList`'s own `{ show: visible }` and vanilla menu.js's\n // `this._element.classList.add('show')` — it's what puts the trigger itself into a\n // pressed look while its menu is open (`.button.show`/`.nav-item.show .nav-link`).\n className={classNames({ caret, show: visible }, className)}\n disabled={disabled}\n {...(mergeProps({ onPointerDown: handlePointerDown }, rest, buttonProps, {\n onClick: handleClick,\n onKeyDown,\n // The caller's, when it gives one: react-aria's own `tabIndex` would replace it.\n ...(tabIndex !== undefined && { tabIndex })\n }) as Record<string, unknown>)}\n // After `buttonProps`: for an `<a>`, react-aria returns an `href` of its own, the one it was\n // given, which is none.\n {...linkProps}\n ref={forkedRef}\n >\n {children}\n </Component>\n )\n}\n\nexport const MenuToggle = createPolymorphicComponent<MenuToggleComponent>(\n MenuToggleRender as ForwardRefRenderFunction<Element, MenuToggleProps<ElementType>>,\n 'MenuToggle'\n)\n"],"mappings":"A,ipBAUA,MAAaiB,EAAcC,GACxB,CAAE,YAAW,GAAGC,GAAQ,IAAQ,CAC/B,IAAMC,EAAaJ,EAAW,eAAgBK,CAAS,EAEvD,MAAO,kBAAA,cAAC,KAAD,CAAI,UAAWD,EAAY,GAAID,EAAW,KAAM,CAAA,CACzD,CACF,EA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