@chassis-ui/react 0.5.1 → 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.
- package/README.md +4 -3
- package/dist/accordion.js +1 -1
- package/dist/alert.js +1 -1
- package/dist/autocomplete.d.ts +1 -1
- package/dist/autocomplete.js +1 -1
- package/dist/avatar.js +1 -1
- package/dist/badge.js +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/button-group.js +1 -1
- package/dist/button.js +1 -1
- package/dist/calendar.js +1 -1
- package/dist/card.js +1 -1
- package/dist/carousel.js +1 -1
- package/dist/checkbox.d.ts +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/chip-input.js +1 -1
- package/dist/chip.js +1 -1
- package/dist/chunks/Button-Cjenm3ku.js +2 -0
- package/dist/chunks/Button-Cjenm3ku.js.map +1 -0
- package/dist/chunks/{Chip-C7QlFCvx.js → Chip-CXuYhjc3.js} +2 -2
- package/dist/chunks/{Chip-C7QlFCvx.js.map → Chip-CXuYhjc3.js.map} +1 -1
- package/dist/chunks/CloseButton-CAQ--0sB.js +2 -0
- package/dist/chunks/CloseButton-CAQ--0sB.js.map +1 -0
- package/dist/chunks/{DateField-4cdcwt0v.js → DateField-G1TP9ayt.js} +2 -2
- package/dist/chunks/{DateField-4cdcwt0v.js.map → DateField-G1TP9ayt.js.map} +1 -1
- package/dist/chunks/{FormHelp-B1eSoack.js → FormHelp-2U3P8C6b.js} +2 -2
- package/dist/chunks/{FormHelp-B1eSoack.js.map → FormHelp-2U3P8C6b.js.map} +1 -1
- package/dist/chunks/Link-B3SX50Od.js +2 -0
- package/dist/chunks/Link-B3SX50Od.js.map +1 -0
- package/dist/chunks/Menu-DBN4Mxak.js +2 -0
- package/dist/chunks/Menu-DBN4Mxak.js.map +1 -0
- package/dist/chunks/MenuToggle-DHzKm1Ed.js +2 -0
- package/dist/chunks/MenuToggle-DHzKm1Ed.js.map +1 -0
- package/dist/chunks/{RangeCalendar-mM3OeTlU.js → RangeCalendar-DRcg1Hp3.js} +2 -2
- package/dist/chunks/{RangeCalendar-mM3OeTlU.js.map → RangeCalendar-DRcg1Hp3.js.map} +1 -1
- package/dist/chunks/{VisuallyHidden-CGv-mBuQ.js → VisuallyHidden-24WfUCsJ.js} +2 -2
- package/dist/chunks/{VisuallyHidden-CGv-mBuQ.js.map → VisuallyHidden-24WfUCsJ.js.map} +1 -1
- package/dist/chunks/{accordion-BZlX2uk8.js → accordion-DiYPbV_r.js} +2 -2
- package/dist/chunks/{accordion-BZlX2uk8.js.map → accordion-DiYPbV_r.js.map} +1 -1
- package/dist/chunks/alert-oSKrhxkI.js +2 -0
- package/dist/chunks/{alert-DSLg5MBb.js.map → alert-oSKrhxkI.js.map} +1 -1
- package/dist/chunks/autocomplete-wjDWeWDh.js +2 -0
- package/dist/chunks/autocomplete-wjDWeWDh.js.map +1 -0
- package/dist/chunks/{avatar-BQBbcnk6.js → avatar-CvcvC9KA.js} +2 -2
- package/dist/chunks/{avatar-BQBbcnk6.js.map → avatar-CvcvC9KA.js.map} +1 -1
- package/dist/chunks/{badge-Ths1Qn1a.js → badge-D7XgWBXc.js} +2 -2
- package/dist/chunks/{badge-Ths1Qn1a.js.map → badge-D7XgWBXc.js.map} +1 -1
- package/dist/chunks/{breadcrumb-BTiQikk-.js → breadcrumb-DxCHVppV.js} +2 -2
- package/dist/chunks/{breadcrumb-BTiQikk-.js.map → breadcrumb-DxCHVppV.js.map} +1 -1
- package/dist/chunks/{button-group-CefkGeYL.js → button-group-CXMj0D4r.js} +2 -2
- package/dist/chunks/{button-group-CefkGeYL.js.map → button-group-CXMj0D4r.js.map} +1 -1
- package/dist/chunks/{card-CEQgHIaL.js → card-C6lPZs5J.js} +2 -2
- package/dist/chunks/{card-CEQgHIaL.js.map → card-C6lPZs5J.js.map} +1 -1
- package/dist/chunks/carousel-Ka9OA-HJ.js +2 -0
- package/dist/chunks/carousel-Ka9OA-HJ.js.map +1 -0
- package/dist/chunks/checkbox-5jv0YWoi.js +2 -0
- package/dist/chunks/checkbox-5jv0YWoi.js.map +1 -0
- package/dist/chunks/chip-input-D8EaNujM.js +2 -0
- package/dist/chunks/chip-input-D8EaNujM.js.map +1 -0
- package/dist/chunks/{collapse-CBi3RWTf.js → collapse-Bc7fnmyU.js} +2 -2
- package/dist/chunks/{collapse-CBi3RWTf.js.map → collapse-Bc7fnmyU.js.map} +1 -1
- package/dist/chunks/color-input-DBOd4Jba.js +2 -0
- package/dist/chunks/color-input-DBOd4Jba.js.map +1 -0
- package/dist/chunks/combobox-DByuUtwh.js +2 -0
- package/dist/chunks/{combobox-DNqR4d3V.js.map → combobox-DByuUtwh.js.map} +1 -1
- package/dist/chunks/context-HDVxTNPi.js.map +1 -1
- package/dist/chunks/context-menu-CGOGliw6.js +2 -0
- package/dist/chunks/context-menu-CGOGliw6.js.map +1 -0
- package/dist/chunks/datagrid-Dv_9uFef.js +2 -0
- package/dist/chunks/datagrid-Dv_9uFef.js.map +1 -0
- package/dist/chunks/datepicker-DuYmXiSe.js +2 -0
- package/dist/chunks/datepicker-DuYmXiSe.js.map +1 -0
- package/dist/chunks/dialogTitle-DMBvXZLT.js +2 -0
- package/dist/chunks/dialogTitle-DMBvXZLT.js.map +1 -0
- package/dist/chunks/{divider-C1-NoKMV.js → divider-DbWmMSrn.js} +2 -2
- package/dist/chunks/{divider-C1-NoKMV.js.map → divider-DbWmMSrn.js.map} +1 -1
- package/dist/chunks/drawer-DPxF30qn.js +2 -0
- package/dist/chunks/drawer-DPxF30qn.js.map +1 -0
- package/dist/chunks/file-input-B5YaBXjI.js +2 -0
- package/dist/chunks/file-input-B5YaBXjI.js.map +1 -0
- package/dist/chunks/{flex-C2jV5LyV.js → flex-C6CbAkVJ.js} +2 -2
- package/dist/chunks/{flex-C2jV5LyV.js.map → flex-C6CbAkVJ.js.map} +1 -1
- package/dist/chunks/floating-input-B9YAJ9d4.js +2 -0
- package/dist/chunks/floating-input-B9YAJ9d4.js.map +1 -0
- package/dist/chunks/{form-field-Bcx96ezd.js → form-field-D74QY_wP.js} +2 -2
- package/dist/chunks/{form-field-Bcx96ezd.js.map → form-field-D74QY_wP.js.map} +1 -1
- package/dist/chunks/grid-BCVkow3u.js +2 -0
- package/dist/chunks/grid-BCVkow3u.js.map +1 -0
- package/dist/chunks/{index-5qsV1-cc.d.ts → index--DV9l24Q.d.ts} +18 -14
- package/dist/chunks/{index-BAvt_oPe.d.ts → index-B2d_pjjy.d.ts} +6 -5
- package/dist/chunks/{index-CbcFEGCh.d.ts → index-BIWaMOr6.d.ts} +9 -2
- package/dist/chunks/{index-3JVLrDHv.d.ts → index-BMAdUGiM.d.ts} +7 -1
- package/dist/chunks/{index-Cpifcw5a.d.ts → index-BzYAMLX1.d.ts} +44 -4
- package/dist/chunks/{index-BbZzaApz.d.ts → index-C9RqZNjk.d.ts} +7 -1
- package/dist/chunks/{index-D0Dhs7YI.d.ts → index-CHtvpvUh.d.ts} +6 -1
- package/dist/chunks/{index-Bl-_sC4y.d.ts → index-CSmHNy8M.d.ts} +8 -2
- package/dist/chunks/{index-Davd7Cue.d.ts → index-CXzKYWtS.d.ts} +3 -2
- package/dist/chunks/{index-OnB4_h6x.d.ts → index-DV_JBDoF.d.ts} +2 -2
- package/dist/chunks/{index-Es9I0fIS.d.ts → index-DjmN2hBX.d.ts} +2 -2
- package/dist/chunks/{index-UjmJQRaG.d.ts → index-DyB9XXLJ.d.ts} +3 -3
- package/dist/chunks/{index-CSRGr7pU.d.ts → index-JCnEw-55.d.ts} +2 -6
- package/dist/chunks/{index-Ctf5hLue.d.ts → index-Me921MYl.d.ts} +15 -13
- package/dist/chunks/{index-C-IrFdKe.d.ts → index-OgWCTy2Y.d.ts} +2 -2
- package/dist/chunks/{index-BZpHSGlk.d.ts → index-bZRQGwY7.d.ts} +7 -2
- package/dist/chunks/{index-Cm3rPbI1.d.ts → index-qJGkO-ni.d.ts} +3 -3
- package/dist/chunks/{input-adorn-DV9tuWXh.js → input-adorn-D0E3Afdf.js} +2 -2
- package/dist/chunks/{input-adorn-DV9tuWXh.js.map → input-adorn-D0E3Afdf.js.map} +1 -1
- package/dist/chunks/{input-group-YB_zoKud.js → input-group-paIBtI1R.js} +2 -2
- package/dist/chunks/{input-group-YB_zoKud.js.map → input-group-paIBtI1R.js.map} +1 -1
- package/dist/chunks/{list-BPBZR66Y.js → list-Ch6vxaUs.js} +2 -2
- package/dist/chunks/{list-BPBZR66Y.js.map → list-Ch6vxaUs.js.map} +1 -1
- package/dist/chunks/menu-DTe27h5q.js +2 -0
- package/dist/chunks/{menu-Bqlhottl.js.map → menu-DTe27h5q.js.map} +1 -1
- package/dist/chunks/modal-BDQe7xyy.js +2 -0
- package/dist/chunks/modal-BDQe7xyy.js.map +1 -0
- package/dist/chunks/nativeFormReset-DgsRU9SA.js +2 -0
- package/dist/chunks/nativeFormReset-DgsRU9SA.js.map +1 -0
- package/dist/chunks/nav-DDI8Dv28.js +2 -0
- package/dist/chunks/nav-DDI8Dv28.js.map +1 -0
- package/dist/chunks/{nav-overflow-GWARvoQZ.js → nav-overflow-BxAhoMh3.js} +2 -2
- package/dist/chunks/{nav-overflow-GWARvoQZ.js.map → nav-overflow-BxAhoMh3.js.map} +1 -1
- package/dist/chunks/{navOverflow-C_QJmkPM.js → navOverflow-eSROB_mV.js} +2 -2
- package/dist/chunks/{navOverflow-C_QJmkPM.js.map → navOverflow-eSROB_mV.js.map} +1 -1
- package/dist/chunks/{navVariant-D4wiKS8I.js → navVariant-Bm5k8CY3.js} +2 -2
- package/dist/chunks/{navVariant-D4wiKS8I.js.map → navVariant-Bm5k8CY3.js.map} +1 -1
- package/dist/chunks/{navbar-C7dO0YRs.js → navbar-BYMKe2yW.js} +2 -2
- package/dist/chunks/{navbar-C7dO0YRs.js.map → navbar-BYMKe2yW.js.map} +1 -1
- package/dist/chunks/{notification-oIrUtDhl.js → notification-C1Sd4X7M.js} +2 -2
- package/dist/chunks/{notification-oIrUtDhl.js.map → notification-C1Sd4X7M.js.map} +1 -1
- package/dist/chunks/{number-field-ChPTSBwI.js → number-field-BIApgIlR.js} +2 -2
- package/dist/chunks/{number-field-ChPTSBwI.js.map → number-field-BIApgIlR.js.map} +1 -1
- package/dist/chunks/otp-input-CCkfFZID.js +2 -0
- package/dist/chunks/otp-input-CCkfFZID.js.map +1 -0
- package/dist/chunks/overlayPlacement-D2vfhhg3.js +2 -0
- package/dist/chunks/overlayPlacement-D2vfhhg3.js.map +1 -0
- package/dist/chunks/{pagination-Dvz8lccd.js → pagination-WINUPT_P.js} +2 -2
- package/dist/chunks/pagination-WINUPT_P.js.map +1 -0
- package/dist/chunks/placeholder-9rTlnMso.js +2 -0
- package/dist/chunks/{placeholder-SPoVRkKE.js.map → placeholder-9rTlnMso.js.map} +1 -1
- package/dist/chunks/polymorphic-mAKwlLiW.js +2 -0
- package/dist/chunks/{polymorphic-CZIFszAy.js.map → polymorphic-mAKwlLiW.js.map} +1 -1
- package/dist/chunks/popover-CrAJTevL.js +2 -0
- package/dist/chunks/popover-CrAJTevL.js.map +1 -0
- package/dist/chunks/{progress-CiSJDNwx.js → progress-CAqSu3jc.js} +2 -2
- package/dist/chunks/{progress-CiSJDNwx.js.map → progress-CAqSu3jc.js.map} +1 -1
- package/dist/chunks/{radio-C42F_5OD.js → radio-XlINMnQm.js} +2 -2
- package/dist/chunks/{radio-C42F_5OD.js.map → radio-XlINMnQm.js.map} +1 -1
- package/dist/chunks/range-input-tyImJHKI.js +2 -0
- package/dist/chunks/range-input-tyImJHKI.js.map +1 -0
- package/dist/chunks/{renderFormField-_6WswnEX.js → renderFormField-CaZ8-xrn.js} +2 -2
- package/dist/chunks/{renderFormField-_6WswnEX.js.map → renderFormField-CaZ8-xrn.js.map} +1 -1
- package/dist/chunks/{search-field-OFsb3t4L.js → search-field-CIYtMraB.js} +2 -2
- package/dist/chunks/{search-field-OFsb3t4L.js.map → search-field-CIYtMraB.js.map} +1 -1
- package/dist/chunks/select-CkucgA6H.js +2 -0
- package/dist/chunks/select-CkucgA6H.js.map +1 -0
- package/dist/chunks/{skeleton-B2blJGWj.js → skeleton-CXFwCjB9.js} +2 -2
- package/dist/chunks/{skeleton-B2blJGWj.js.map → skeleton-CXFwCjB9.js.map} +1 -1
- package/dist/chunks/slot-DagH0Gxq.js +2 -0
- package/dist/chunks/slot-DagH0Gxq.js.map +1 -0
- package/dist/chunks/{spinner-D8lQCW4u.js → spinner-BLQiCoQd.js} +2 -2
- package/dist/chunks/{spinner-D8lQCW4u.js.map → spinner-BLQiCoQd.js.map} +1 -1
- package/dist/chunks/{stack-DtzW54UK.js → stack-OItr30SC.js} +2 -2
- package/dist/chunks/{stack-DtzW54UK.js.map → stack-OItr30SC.js.map} +1 -1
- package/dist/chunks/{stepper-tSA84huJ.js → stepper-BLjW7UnC.js} +2 -2
- package/dist/chunks/{stepper-tSA84huJ.js.map → stepper-BLjW7UnC.js.map} +1 -1
- package/dist/chunks/switch-nt7aXQDX.js +2 -0
- package/dist/chunks/switch-nt7aXQDX.js.map +1 -0
- package/dist/chunks/table-KtPHx4FG.js +2 -0
- package/dist/chunks/table-KtPHx4FG.js.map +1 -0
- package/dist/chunks/{tabs-DMFSLjnV.js → tabs-Dh5kH5Ik.js} +2 -2
- package/dist/chunks/{tabs-DMFSLjnV.js.map → tabs-Dh5kH5Ik.js.map} +1 -1
- package/dist/chunks/{text-input-CR73x-8D.js → text-input-D3jBYiLn.js} +2 -2
- package/dist/chunks/{text-input-CR73x-8D.js.map → text-input-D3jBYiLn.js.map} +1 -1
- package/dist/chunks/{textarea-C-1cMyH4.js → textarea-2BJCzT97.js} +2 -2
- package/dist/chunks/{textarea-C-1cMyH4.js.map → textarea-2BJCzT97.js.map} +1 -1
- package/dist/chunks/{time-field-CbCfOQZz.js → time-field-ClPbatW3.js} +2 -2
- package/dist/chunks/{time-field-CbCfOQZz.js.map → time-field-ClPbatW3.js.map} +1 -1
- package/dist/chunks/toast-D5-58Ch1.js +2 -0
- package/dist/chunks/toast-D5-58Ch1.js.map +1 -0
- package/dist/chunks/tooltip-TGFFlOJL.js +2 -0
- package/dist/chunks/tooltip-TGFFlOJL.js.map +1 -0
- package/dist/chunks/tree-BO0WSxQa.js +2 -0
- package/dist/chunks/tree-BO0WSxQa.js.map +1 -0
- package/dist/chunks/useButtonSemantics-DN3OIXtG.js +2 -0
- package/dist/chunks/useButtonSemantics-DN3OIXtG.js.map +1 -0
- package/dist/chunks/{useDialogElement-BfygWBPZ.js → useDialogElement-yEgUSejP.js} +2 -2
- package/dist/chunks/useDialogElement-yEgUSejP.js.map +1 -0
- package/dist/chunks/{useFormField-DH2tlc3e.js → useFormField-q21MOgh8.js} +2 -2
- package/dist/chunks/{useFormField-DH2tlc3e.js.map → useFormField-q21MOgh8.js.map} +1 -1
- package/dist/chunks/useFormReset-BK5Yb24_.js +2 -0
- package/dist/chunks/useFormReset-BK5Yb24_.js.map +1 -0
- package/dist/chunks/useHeldBack-o-CsPcSe.js +2 -0
- package/dist/chunks/useHeldBack-o-CsPcSe.js.map +1 -0
- package/dist/chunks/{useOpenStateProps-BhjSQ3f6.js → useOpenStateProps-CdSO1nmI.js} +2 -2
- package/dist/chunks/{useOpenStateProps-BhjSQ3f6.js.map → useOpenStateProps-CdSO1nmI.js.map} +1 -1
- package/dist/chunks/useOverlayMaxHeight-5UnurH0W.js +2 -0
- package/dist/chunks/useOverlayMaxHeight-5UnurH0W.js.map +1 -0
- package/dist/chunks/{useRequiredValueInput-gYN8I-LY.js → useRequiredValueInput-CL7AIgqz.js} +2 -2
- package/dist/chunks/{useRequiredValueInput-gYN8I-LY.js.map → useRequiredValueInput-CL7AIgqz.js.map} +1 -1
- package/dist/chunks/useSelectionForMode-B_oTWvEy.js +2 -0
- package/dist/chunks/useSelectionForMode-B_oTWvEy.js.map +1 -0
- package/dist/chunks/useToastRegionQueue-QHa4v7k6.js +2 -0
- package/dist/chunks/useToastRegionQueue-QHa4v7k6.js.map +1 -0
- package/dist/chunks/useTransitionState-WEw9C0yn.js +2 -0
- package/dist/chunks/useTransitionState-WEw9C0yn.js.map +1 -0
- package/dist/chunks/{visibleState-CWyQak65.js → visibleState-DVyxSMUT.js} +2 -2
- package/dist/chunks/{visibleState-CWyQak65.js.map → visibleState-DVyxSMUT.js.map} +1 -1
- package/dist/close-button.js +1 -1
- package/dist/collapse.js +1 -1
- package/dist/color-input.d.ts +1 -1
- package/dist/color-input.js +1 -1
- package/dist/combobox.js +1 -1
- package/dist/context-menu.js +1 -1
- package/dist/datagrid.d.ts +1 -1
- package/dist/datagrid.js +1 -1
- package/dist/datepicker.js +1 -1
- package/dist/divider.js +1 -1
- package/dist/drawer.d.ts +1 -1
- package/dist/drawer.js +1 -1
- package/dist/file-input.d.ts +1 -1
- package/dist/file-input.js +1 -1
- package/dist/flex.js +1 -1
- package/dist/floating-input.d.ts +1 -1
- package/dist/floating-input.js +1 -1
- package/dist/form-field.js +1 -1
- package/dist/form.js +1 -1
- package/dist/grid.js +1 -1
- package/dist/index.d.ts +19 -19
- package/dist/index.js +1 -1
- package/dist/input-adorn.js +1 -1
- package/dist/input-group.js +1 -1
- package/dist/link.js +1 -1
- package/dist/list.js +1 -1
- package/dist/menu.js +1 -1
- package/dist/modal.d.ts +1 -1
- package/dist/modal.js +1 -1
- package/dist/nav-overflow.js +1 -1
- package/dist/nav.d.ts +1 -1
- package/dist/nav.js +1 -1
- package/dist/navbar.js +1 -1
- package/dist/notification.js +1 -1
- package/dist/number-field.js +1 -1
- package/dist/otp-input.d.ts +1 -1
- package/dist/otp-input.js +1 -1
- package/dist/pagination.d.ts +1 -1
- package/dist/pagination.js +1 -1
- package/dist/placeholder.js +1 -1
- package/dist/popover.js +1 -1
- package/dist/progress.js +1 -1
- package/dist/radio.d.ts +1 -1
- package/dist/radio.js +1 -1
- package/dist/range-input.d.ts +1 -1
- package/dist/range-input.js +1 -1
- package/dist/search-field.js +1 -1
- package/dist/select.d.ts +1 -1
- package/dist/select.js +1 -1
- package/dist/skeleton.js +1 -1
- package/dist/spinner.js +1 -1
- package/dist/stack.js +1 -1
- package/dist/stepper.js +1 -1
- package/dist/style.css +1 -1
- package/dist/switch.d.ts +1 -1
- package/dist/switch.js +1 -1
- package/dist/table.d.ts +1 -1
- package/dist/table.js +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text-input.js +1 -1
- package/dist/textarea.js +1 -1
- package/dist/time-field.js +1 -1
- package/dist/toast.d.ts +1 -1
- package/dist/toast.js +1 -1
- package/dist/tooltip.js +1 -1
- package/dist/tree.js +1 -1
- package/dist/visually-hidden.js +1 -1
- package/package.json +11 -11
- package/dist/chunks/Button-ZU-x1uN_.js +0 -2
- package/dist/chunks/Button-ZU-x1uN_.js.map +0 -1
- package/dist/chunks/CloseButton-BPUI5iGX.js +0 -2
- package/dist/chunks/CloseButton-BPUI5iGX.js.map +0 -1
- package/dist/chunks/Link-DE8NSAXJ.js +0 -2
- package/dist/chunks/Link-DE8NSAXJ.js.map +0 -1
- package/dist/chunks/Menu-BiE9CzNk.js +0 -2
- package/dist/chunks/Menu-BiE9CzNk.js.map +0 -1
- package/dist/chunks/MenuToggle-W-ZSHFwF.js +0 -2
- package/dist/chunks/MenuToggle-W-ZSHFwF.js.map +0 -1
- package/dist/chunks/alert-DSLg5MBb.js +0 -2
- package/dist/chunks/autocomplete-Btcsjrh3.js +0 -2
- package/dist/chunks/autocomplete-Btcsjrh3.js.map +0 -1
- package/dist/chunks/carousel-DC-UGc6W.js +0 -2
- package/dist/chunks/carousel-DC-UGc6W.js.map +0 -1
- package/dist/chunks/checkbox-ko6CdtoT.js +0 -2
- package/dist/chunks/checkbox-ko6CdtoT.js.map +0 -1
- package/dist/chunks/chip-input-CugY8EOc.js +0 -2
- package/dist/chunks/chip-input-CugY8EOc.js.map +0 -1
- package/dist/chunks/color-input-C4zMWlvm.js +0 -2
- package/dist/chunks/color-input-C4zMWlvm.js.map +0 -1
- package/dist/chunks/combobox-DNqR4d3V.js +0 -2
- package/dist/chunks/context-menu-D3DNFN-P.js +0 -2
- package/dist/chunks/context-menu-D3DNFN-P.js.map +0 -1
- package/dist/chunks/datagrid-n9vFeXN1.js +0 -2
- package/dist/chunks/datagrid-n9vFeXN1.js.map +0 -1
- package/dist/chunks/datepicker-DqztYJD6.js +0 -2
- package/dist/chunks/datepicker-DqztYJD6.js.map +0 -1
- package/dist/chunks/drawer-CRv9jmbp.js +0 -2
- package/dist/chunks/drawer-CRv9jmbp.js.map +0 -1
- package/dist/chunks/file-input-D_Gl1h-T.js +0 -2
- package/dist/chunks/file-input-D_Gl1h-T.js.map +0 -1
- package/dist/chunks/floating-input-D4gWFfOU.js +0 -2
- package/dist/chunks/floating-input-D4gWFfOU.js.map +0 -1
- package/dist/chunks/grid-CkdPftit.js +0 -2
- package/dist/chunks/grid-CkdPftit.js.map +0 -1
- package/dist/chunks/menu-Bqlhottl.js +0 -2
- package/dist/chunks/modal-CHvsDTyl.js +0 -2
- package/dist/chunks/modal-CHvsDTyl.js.map +0 -1
- package/dist/chunks/nav-B4U_Hqs7.js +0 -2
- package/dist/chunks/nav-B4U_Hqs7.js.map +0 -1
- package/dist/chunks/otp-input-DUtCMg8P.js +0 -2
- package/dist/chunks/otp-input-DUtCMg8P.js.map +0 -1
- package/dist/chunks/overlayPlacement-Q6bcbXA5.js +0 -2
- package/dist/chunks/overlayPlacement-Q6bcbXA5.js.map +0 -1
- package/dist/chunks/pagination-Dvz8lccd.js.map +0 -1
- package/dist/chunks/placeholder-SPoVRkKE.js +0 -2
- package/dist/chunks/polymorphic-CZIFszAy.js +0 -2
- package/dist/chunks/popover-C_32yD9W.js +0 -2
- package/dist/chunks/popover-C_32yD9W.js.map +0 -1
- package/dist/chunks/range-input-DeZq_9S7.js +0 -2
- package/dist/chunks/range-input-DeZq_9S7.js.map +0 -1
- package/dist/chunks/select-DwyL6aqY.js +0 -2
- package/dist/chunks/select-DwyL6aqY.js.map +0 -1
- package/dist/chunks/slot-BQVx1Eew.js +0 -2
- package/dist/chunks/slot-BQVx1Eew.js.map +0 -1
- package/dist/chunks/switch-cp3IZg3L.js +0 -2
- package/dist/chunks/switch-cp3IZg3L.js.map +0 -1
- package/dist/chunks/table-CBTg5Yuq.js +0 -2
- package/dist/chunks/table-CBTg5Yuq.js.map +0 -1
- package/dist/chunks/toast-Dd0J2e1z.js +0 -2
- package/dist/chunks/toast-Dd0J2e1z.js.map +0 -1
- package/dist/chunks/tooltip-CmKeQwYw.js +0 -2
- package/dist/chunks/tooltip-CmKeQwYw.js.map +0 -1
- package/dist/chunks/tree-DNj_EfUl.js +0 -2
- package/dist/chunks/tree-DNj_EfUl.js.map +0 -1
- package/dist/chunks/useButtonSemantics-B1SbGaDO.js +0 -2
- package/dist/chunks/useButtonSemantics-B1SbGaDO.js.map +0 -1
- package/dist/chunks/useDialogElement-BfygWBPZ.js.map +0 -1
- package/dist/chunks/useDialogTitle-DiB4YDGI.js +0 -2
- package/dist/chunks/useDialogTitle-DiB4YDGI.js.map +0 -1
- package/dist/chunks/useFloatingOverlay-BuiI_CCn.js +0 -2
- package/dist/chunks/useFloatingOverlay-BuiI_CCn.js.map +0 -1
- package/dist/chunks/useHeldBack-eeTfpa_t.js +0 -2
- package/dist/chunks/useHeldBack-eeTfpa_t.js.map +0 -1
- package/dist/chunks/useOverlayMaxHeight-DTgbr4UQ.js +0 -2
- package/dist/chunks/useOverlayMaxHeight-DTgbr4UQ.js.map +0 -1
- package/dist/chunks/useToastRegionQueue-CuAMxAIA.js +0 -2
- package/dist/chunks/useToastRegionQueue-CuAMxAIA.js.map +0 -1
- package/dist/chunks/useTransitionState-sQUQey74.js +0 -2
- package/dist/chunks/useTransitionState-sQUQey74.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./focus-ring-Bs80iIBN.js";import{
|
|
2
|
-
//# sourceMappingURL=accordion-
|
|
1
|
+
import"./focus-ring-Bs80iIBN.js";import{C as e}from"./slot-DagH0Gxq.js";import{t}from"./polymorphic-mAKwlLiW.js";import n,{createContext as r,forwardRef as i,useContext as a,useId as o,useRef as s,useState as c}from"react";import l from"classnames";function u({children:e,className:t,component:r,...i},a){let o=r??`div`;return/* @__PURE__ */ n.createElement(o,{className:l(`accordion-body`,t),...i,ref:a},e)}const d=t(u,`AccordionBody`),f=i(({children:e,className:t,...r},i)=>/* @__PURE__ */ n.createElement(`summary`,{className:l(t)||void 0,...r,ref:i},/* @__PURE__ */ n.createElement(`span`,{className:`accordion-title`},e)));f.displayName=`AccordionHeader`;const p=r({}),m=i(({children:t,alwaysOpen:r,className:i,name:o,open:s,itemKey:c,...u},d)=>{e(c!==void 0,`AccordionItem: the itemKey prop is deprecated and no longer used — the native <details> element manages its own state. It will be removed in a future major version.`);let f=a(p),m=r??f.alwaysOpen,h=o??f.name,g=m?{}:{name:h};return/* @__PURE__ */ n.createElement(`details`,{className:l(`accordion-item`,i),open:s,...g,...u,ref:d},t)});m.displayName=`AccordionItem`;const h=i(({children:e,alwaysOpen:t=!1,caretEnd:r,className:i,defaultExpandedKeys:a,expandedKeys:u,flush:h,items:g,name:_,onExpandedChange:v,size:y,...b},x)=>{let S=o(),C=_??S,w=l(`accordion`,{flush:h,"caret-end":r},y,i),T=u!==void 0,E=T||a!==void 0||v!==void 0,[D,O]=c(()=>a??g?.flatMap((e,t)=>e.open?[e.id??t]:[])??[]),k=T?u:D,A=s(/* @__PURE__ */ new Map),j=(e,t)=>n=>{if(t?.(n),!g)return;let r=g.map((e,t)=>e.id??t).filter(e=>A.current.get(e)?.open);T?n.currentTarget.open=u.includes(e):O(r),v?.(r)},M=g?g.map((e,t)=>{let r=e.id??t;return/* @__PURE__ */ n.createElement(m,{key:r,className:e.className,open:E?k.includes(r):e.open,name:e.name,alwaysOpen:e.alwaysOpen,onToggle:j(r,e.onToggle),ref:e=>{A.current.set(r,e)}},/* @__PURE__ */ n.createElement(f,null,e.header),/* @__PURE__ */ n.createElement(d,null,e.body))}):e;return/* @__PURE__ */ n.createElement(`div`,{className:w,...b,ref:x},/* @__PURE__ */ n.createElement(p.Provider,{value:{alwaysOpen:t,name:C}},M))});h.displayName=`Accordion`;export{d as i,m as n,f as r,h as t};
|
|
2
|
+
//# sourceMappingURL=accordion-DiYPbV_r.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion-BZlX2uk8.js","names":["devWarning","React","classNames","AccordionBodyRender","rest","Component","component","className","children","AccordionBody","createPolymorphicComponent","AccordionHeader","forwardRef","AccordionContext","createContext","AccordionItem","_itemKey","context","useContext","isAlwaysOpen","alwaysOpen","groupName","name","groupProps","Accordion","generatedName","useId","_className","caretEnd","size","isExpandedControlled","expandedKeys","isTrackingExpanded","defaultExpandedKeys","onExpandedChange","uncontrolledExpandedKeys","setUncontrolledExpandedKeys","useState","items","item","index","currentExpandedKeys","itemRefs","useRef","handleItemToggle","itemOnToggle","event","next","key","id","content","node"],"sources":["../../src/components/accordion/AccordionBody.tsx","../../src/components/accordion/AccordionHeader.tsx","../../src/components/accordion/context.ts","../../src/components/accordion/AccordionItem.tsx","../../src/components/accordion/Accordion.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 AccordionBodyOwnProps<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\nexport type AccordionBodyProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n AccordionBodyOwnProps<C>\n>\n\ntype AccordionBodyComponent = (<C extends ElementType = 'div'>(\n props: AccordionBodyProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction AccordionBodyRender<C extends ElementType = 'div'>(\n { children, className, component, ...rest }: AccordionBodyProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n\n return (\n <Component className={classNames('accordion-body', className)} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const AccordionBody = createPolymorphicComponent<AccordionBodyComponent>(\n AccordionBodyRender as ForwardRefRenderFunction<Element, AccordionBodyProps<ElementType>>,\n 'AccordionBody'\n)\n","import React, { forwardRef, HTMLAttributes } from 'react'\nimport classNames from 'classnames'\n\nexport interface AccordionHeaderProps extends HTMLAttributes<HTMLElement> {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n}\n\nexport const AccordionHeader = forwardRef<HTMLElement, AccordionHeaderProps>(\n ({ children, className, ...rest }, ref) => {\n return (\n <summary className={classNames(className) || undefined} {...rest} ref={ref}>\n <span className=\"accordion-title\">{children}</span>\n </summary>\n )\n }\n)\n\nAccordionHeader.displayName = 'AccordionHeader'\n","import { createContext } from 'react'\n\nexport interface AccordionContextProps {\n alwaysOpen?: boolean\n name?: string\n}\n\nexport const AccordionContext = createContext<AccordionContextProps>({})\n","import React, { forwardRef, DetailsHTMLAttributes, useContext } from 'react'\nimport classNames from 'classnames'\n\nimport { AccordionContext } from './context'\nimport { devWarning } from '../../utils/devWarning'\n\nexport interface AccordionItemProps extends DetailsHTMLAttributes<HTMLDetailsElement> {\n /**\n * Let this item stay open when another item opens, overriding the accordion's `alwaysOpen` setting.\n */\n alwaysOpen?: boolean\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * The group this item shares with other items so only one can be open at a time, overriding the\n * accordion's shared `name`.\n */\n name?: string\n /**\n * Start the item in the open state.\n */\n open?: boolean\n /**\n * @deprecated No longer used. The native details element manages its own state.\n */\n itemKey?: number | string\n}\n\nexport const AccordionItem = forwardRef<HTMLDetailsElement, AccordionItemProps>(\n ({ children, alwaysOpen, className, name, open, itemKey: _itemKey, ...rest }, ref) => {\n devWarning(\n _itemKey !== undefined,\n 'AccordionItem: the itemKey prop is deprecated and no longer used — the native ' +\n '<details> element manages its own state. It will be removed in a future major version.'\n )\n\n const context = useContext(AccordionContext)\n const isAlwaysOpen = alwaysOpen ?? context.alwaysOpen\n const groupName = name ?? context.name\n\n const groupProps = isAlwaysOpen ? {} : { name: groupName }\n\n return (\n <details\n className={classNames('accordion-item', className)}\n open={open}\n {...(groupProps as React.HTMLAttributes<HTMLDetailsElement>)}\n {...rest}\n ref={ref}\n >\n {children}\n </details>\n )\n }\n)\n\nAccordionItem.displayName = 'AccordionItem'\n","import React, { forwardRef, HTMLAttributes, ReactNode, useId, useRef, useState } from 'react'\nimport classNames from 'classnames'\n\nimport { AccordionBody } from './AccordionBody'\nimport { AccordionHeader } from './AccordionHeader'\nimport { AccordionItem } from './AccordionItem'\nimport { AccordionContext } from './context'\n\nexport interface AccordionItemDef {\n /**\n * Let this item stay open when another item opens, overriding the accordion's `alwaysOpen` setting.\n */\n alwaysOpen?: boolean\n /**\n * Body content, rendered inside a `AccordionBody`.\n */\n body: ReactNode\n /**\n * A string of all className you want applied to this item.\n */\n className?: string\n /**\n * Header content, rendered inside a `AccordionHeader`.\n */\n header: ReactNode\n /**\n * React key for this item. Falls back to its index when omitted.\n */\n id?: number | string\n /**\n * The group this item shares with other items so only one can be open at a time, overriding the\n * accordion's shared `name`.\n */\n name?: string\n /**\n * Callback fired when this item's open state changes. Chained after `Accordion`'s own handling\n * of `expandedKeys`/`onExpandedChange`, so it fires regardless of whether those are used.\n */\n onToggle?: (event: React.SyntheticEvent<HTMLDetailsElement>) => void\n /**\n * Start the item in the open state (uncontrolled). Ignored for items whose key is included in\n * `expandedKeys`/`defaultExpandedKeys` on the parent `Accordion`.\n */\n open?: boolean\n}\n\nexport interface AccordionProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Make accordion items stay open when another item is opened.\n */\n alwaysOpen?: boolean\n /**\n * Move the caret icon to the end of the header.\n */\n caretEnd?: boolean\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * The keys of the initially expanded items (uncontrolled). Only applies to items rendered via\n * the `items` prop — a composed `AccordionItem` already supports native controlled `open`/\n * `onToggle` directly.\n */\n defaultExpandedKeys?: Array<number | string>\n /**\n * The keys of the currently expanded items (controlled). Only applies to items rendered via the\n * `items` prop — a composed `AccordionItem` already supports native controlled `open`/`onToggle`\n * directly.\n */\n expandedKeys?: Array<number | string>\n /**\n * Removes the default background-context, some borders, and some rounded corners to render accordions edge-to-edge with their parent container.\n */\n flush?: boolean\n /**\n * Array of item definitions for data-driven rendering. When provided, children are ignored.\n */\n items?: AccordionItemDef[]\n /**\n * The shared group name used by items that don't set their own `name`. Defaults to an auto-generated id.\n */\n name?: string\n /**\n * Callback fired with the updated set of expanded item keys, reflecting the native `<details>`\n * elements' actual open state (including items the browser closed itself via a shared `name`\n * group). Only fires for items rendered via the `items` prop.\n */\n onExpandedChange?: (keys: Array<number | string>) => void\n /**\n * Size the component sm or lg.\n */\n size?: 'sm' | 'lg'\n}\n\nexport const Accordion = forwardRef<HTMLDivElement, AccordionProps>(\n (\n {\n children,\n alwaysOpen = false,\n caretEnd,\n className,\n defaultExpandedKeys,\n expandedKeys,\n flush,\n items,\n name,\n onExpandedChange,\n size,\n ...rest\n },\n ref\n ) => {\n const generatedName = useId()\n const groupName = name ?? generatedName\n const _className = classNames('accordion', { flush, 'caret-end': caretEnd }, size, className)\n\n const isExpandedControlled = expandedKeys !== undefined\n const isTrackingExpanded =\n isExpandedControlled || defaultExpandedKeys !== undefined || onExpandedChange !== undefined\n\n const [uncontrolledExpandedKeys, setUncontrolledExpandedKeys] = useState<\n Array<number | string>\n >(\n () =>\n defaultExpandedKeys ??\n // The key before the filter: an item with no `id` is keyed by its index in `items`, not\n // by its place among the open ones.\n items?.flatMap((item, index) => (item.open ? [item.id ?? index] : [])) ??\n []\n )\n const currentExpandedKeys = isExpandedControlled ? expandedKeys : uncontrolledExpandedKeys\n\n // Keyed by each item's id (or index) so a toggle handler can read every sibling's *actual*\n // DOM open state — the browser settles a whole shared-`name` group's open attributes\n // synchronously before dispatching any `toggle` events, so this is always the true next set,\n // regardless of which affected item's handler happens to run first.\n const itemRefs = useRef(new Map<number | string, HTMLDetailsElement | null>())\n\n const handleItemToggle =\n (id: number | string, itemOnToggle?: AccordionItemDef['onToggle']) =>\n (event: React.SyntheticEvent<HTMLDetailsElement>) => {\n itemOnToggle?.(event)\n if (!items) return\n const next = items\n .map((item, index) => item.id ?? index)\n .filter((key) => itemRefs.current.get(key)?.open)\n if (isExpandedControlled) {\n // React doesn't intercept a native <details> click the way it does controlled form\n // inputs, so the DOM has already toggled by the time this fires. Snap this element back\n // to the still-current controlled value — if the consumer's onExpandedChange updates\n // `expandedKeys` in response, the next render sets it back to the new value anyway.\n ;(event.currentTarget as HTMLDetailsElement).open = expandedKeys.includes(id)\n } else {\n setUncontrolledExpandedKeys(next)\n }\n onExpandedChange?.(next)\n }\n\n const content = items\n ? items.map((item, index) => {\n const id = item.id ?? index\n return (\n <AccordionItem\n key={id}\n className={item.className}\n open={isTrackingExpanded ? currentExpandedKeys.includes(id) : item.open}\n name={item.name}\n alwaysOpen={item.alwaysOpen}\n onToggle={handleItemToggle(id, item.onToggle)}\n ref={(node) => {\n itemRefs.current.set(id, node)\n }}\n >\n <AccordionHeader>{item.header}</AccordionHeader>\n <AccordionBody>{item.body}</AccordionBody>\n </AccordionItem>\n )\n })\n : children\n\n return (\n <div className={_className} {...rest} ref={ref}>\n <AccordionContext.Provider value={{ alwaysOpen, name: groupName }}>\n {content}\n </AccordionContext.Provider>\n </div>\n )\n }\n)\n\nAccordion.displayName = 'Accordion'\n"],"mappings":"A,yPA6BA,SAASG,EACP,CAAE,WAAU,YAAW,YAAW,GAAGC,GACrC,EACA,CACA,IAAMC,EAAYC,GAAa,MAE/B,MACE,kBAAA,cAACD,EAAD,CAAW,UAAWH,EAAW,iBAAkBK,CAAS,EAAG,GAAIH,EAAW,KAEnE,EADRI,CACQ,CAEf,CAEA,MAAaC,EAAgBC,EAC3BP,EACA,eACF,ECnCaQ,EAAkBC,GAC5B,CAAE,WAAU,YAAW,GAAGR,GAAQ,IAE/B,kBAAA,cAAC,UAAD,CAAS,UAAWF,EAAWK,CAAS,GAAK,IAAA,GAAW,GAAIH,EAAW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EAAK,IAAMC,CAAK,CAAC,CACtC,OAAQ,GAAQE,EAAS,QAAQ,IAAIM,CAAG,CAAC,EAAE,IAAI,EAC9ClB,EAKD,EAAO,cAAqC,KAAOC,EAAa,SAASkB,CAAE,EAE5Eb,EAA4BW,CAAI,EAElCb,IAAmBa,CAAI,CACzB,EAEIG,EAAUZ,EACZA,EAAM,KAAK,EAAM,IAAU,CACzB,IAAMW,EAAKV,EAAK,IAAMC,EACtB,MACE,kBAAA,cAACzB,EAAD,CACE,IAAKkC,EACL,UAAWV,EAAK,UAChB,KAAMP,EAAqBS,EAAoB,SAASQ,CAAE,EAAIV,EAAK,KACnE,KAAMA,EAAK,KACX,WAAYA,EAAK,WACjB,SAAUK,EAAiBK,EAAIV,EAAK,QAAQ,EAC5C,IAAM,GAAS,CACbG,EAAS,QAAQ,IAAIO,EAAIE,CAAI,CAC/B,CAIa,EAFb,kBAAA,cAACxC,EAAA,KAAiB4B,EAAK,MAAwB,EAC/C,kBAAA,cAAC9B,EAAA,KAAe8B,EAAK,IAAoB,CAC5B,CAEnB,CAAC,EACD/B,EAEJ,MACE,kBAAA,cAAC,MAAD,CAAK,UAAWmB,EAAY,GAAIvB,EAAW,KAItC,EAHH,kBAAA,cAACS,EAAiB,SAAlB,CAA2B,MAAO,CAAE,aAAY,KAAMQ,CAAU,CAErC,EADxB6B,CACwB,CACxB,CAET,CACF,EAEA,EAAU,YAAc,Y"}
|
|
1
|
+
{"version":3,"file":"accordion-DiYPbV_r.js","names":["devWarning","React","classNames","AccordionBodyRender","rest","Component","component","className","children","AccordionBody","createPolymorphicComponent","AccordionHeader","forwardRef","AccordionContext","createContext","AccordionItem","_itemKey","context","useContext","isAlwaysOpen","alwaysOpen","groupName","name","groupProps","Accordion","generatedName","useId","_className","caretEnd","size","isExpandedControlled","expandedKeys","isTrackingExpanded","defaultExpandedKeys","onExpandedChange","uncontrolledExpandedKeys","setUncontrolledExpandedKeys","useState","items","item","index","currentExpandedKeys","itemRefs","useRef","handleItemToggle","itemOnToggle","event","next","key","id","content","node"],"sources":["../../src/components/accordion/AccordionBody.tsx","../../src/components/accordion/AccordionHeader.tsx","../../src/components/accordion/context.ts","../../src/components/accordion/AccordionItem.tsx","../../src/components/accordion/Accordion.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 AccordionBodyOwnProps<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\nexport type AccordionBodyProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n AccordionBodyOwnProps<C>\n>\n\ntype AccordionBodyComponent = (<C extends ElementType = 'div'>(\n props: AccordionBodyProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction AccordionBodyRender<C extends ElementType = 'div'>(\n { children, className, component, ...rest }: AccordionBodyProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n\n return (\n <Component className={classNames('accordion-body', className)} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const AccordionBody = createPolymorphicComponent<AccordionBodyComponent>(\n AccordionBodyRender as ForwardRefRenderFunction<Element, AccordionBodyProps<ElementType>>,\n 'AccordionBody'\n)\n","import React, { forwardRef, HTMLAttributes } from 'react'\nimport classNames from 'classnames'\n\nexport interface AccordionHeaderProps extends HTMLAttributes<HTMLElement> {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n}\n\nexport const AccordionHeader = forwardRef<HTMLElement, AccordionHeaderProps>(\n ({ children, className, ...rest }, ref) => {\n return (\n <summary className={classNames(className) || undefined} {...rest} ref={ref}>\n <span className=\"accordion-title\">{children}</span>\n </summary>\n )\n }\n)\n\nAccordionHeader.displayName = 'AccordionHeader'\n","import { createContext } from 'react'\n\nexport interface AccordionContextProps {\n alwaysOpen?: boolean\n name?: string\n}\n\nexport const AccordionContext = createContext<AccordionContextProps>({})\n","import React, { forwardRef, DetailsHTMLAttributes, useContext } from 'react'\nimport classNames from 'classnames'\n\nimport { AccordionContext } from './context'\nimport { devWarning } from '../../utils/devWarning'\n\nexport interface AccordionItemProps extends DetailsHTMLAttributes<HTMLDetailsElement> {\n /**\n * Let this item stay open when another item opens, overriding the accordion's `alwaysOpen` setting.\n */\n alwaysOpen?: boolean\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * The group this item shares with other items so only one can be open at a time, overriding the\n * accordion's shared `name`.\n */\n name?: string\n /**\n * Start the item in the open state.\n */\n open?: boolean\n /**\n * @deprecated No longer used. The native details element manages its own state.\n */\n itemKey?: number | string\n}\n\nexport const AccordionItem = forwardRef<HTMLDetailsElement, AccordionItemProps>(\n ({ children, alwaysOpen, className, name, open, itemKey: _itemKey, ...rest }, ref) => {\n devWarning(\n _itemKey !== undefined,\n 'AccordionItem: the itemKey prop is deprecated and no longer used — the native ' +\n '<details> element manages its own state. It will be removed in a future major version.'\n )\n\n const context = useContext(AccordionContext)\n const isAlwaysOpen = alwaysOpen ?? context.alwaysOpen\n const groupName = name ?? context.name\n\n const groupProps = isAlwaysOpen ? {} : { name: groupName }\n\n return (\n <details\n className={classNames('accordion-item', className)}\n open={open}\n {...(groupProps as React.HTMLAttributes<HTMLDetailsElement>)}\n {...rest}\n ref={ref}\n >\n {children}\n </details>\n )\n }\n)\n\nAccordionItem.displayName = 'AccordionItem'\n","import React, { forwardRef, HTMLAttributes, ReactNode, useId, useRef, useState } from 'react'\nimport classNames from 'classnames'\n\nimport { AccordionBody } from './AccordionBody'\nimport { AccordionHeader } from './AccordionHeader'\nimport { AccordionItem } from './AccordionItem'\nimport { AccordionContext } from './context'\n\nexport interface AccordionItemDef {\n /**\n * Let this item stay open when another item opens, overriding the accordion's `alwaysOpen` setting.\n */\n alwaysOpen?: boolean\n /**\n * Body content, rendered inside a `AccordionBody`.\n */\n body: ReactNode\n /**\n * A string of all className you want applied to this item.\n */\n className?: string\n /**\n * Header content, rendered inside a `AccordionHeader`.\n */\n header: ReactNode\n /**\n * React key for this item. Falls back to its index when omitted.\n */\n id?: number | string\n /**\n * The group this item shares with other items so only one can be open at a time, overriding the\n * accordion's shared `name`.\n */\n name?: string\n /**\n * Callback fired when this item's open state changes. Chained after `Accordion`'s own handling\n * of `expandedKeys`/`onExpandedChange`, so it fires regardless of whether those are used.\n */\n onToggle?: (event: React.SyntheticEvent<HTMLDetailsElement>) => void\n /**\n * Start the item in the open state (uncontrolled). Ignored for items whose key is included in\n * `expandedKeys`/`defaultExpandedKeys` on the parent `Accordion`.\n */\n open?: boolean\n}\n\nexport interface AccordionProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Make accordion items stay open when another item is opened.\n */\n alwaysOpen?: boolean\n /**\n * Move the caret icon to the end of the header.\n */\n caretEnd?: boolean\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * The keys of the initially expanded items (uncontrolled). Only applies to items rendered via\n * the `items` prop — a composed `AccordionItem` already supports native controlled `open`/\n * `onToggle` directly.\n */\n defaultExpandedKeys?: Array<number | string>\n /**\n * The keys of the currently expanded items (controlled). Only applies to items rendered via the\n * `items` prop — a composed `AccordionItem` already supports native controlled `open`/`onToggle`\n * directly.\n */\n expandedKeys?: Array<number | string>\n /**\n * Removes the default background-context, some borders, and some rounded corners to render accordions edge-to-edge with their parent container.\n */\n flush?: boolean\n /**\n * Array of item definitions for data-driven rendering. When provided, children are ignored.\n */\n items?: AccordionItemDef[]\n /**\n * The shared group name used by items that don't set their own `name`. Defaults to an auto-generated id.\n */\n name?: string\n /**\n * Callback fired with the updated set of expanded item keys, reflecting the native `<details>`\n * elements' actual open state (including items the browser closed itself via a shared `name`\n * group). Only fires for items rendered via the `items` prop.\n */\n onExpandedChange?: (keys: Array<number | string>) => void\n /**\n * Size the component sm or lg.\n */\n size?: 'sm' | 'lg'\n}\n\nexport const Accordion = forwardRef<HTMLDivElement, AccordionProps>(\n (\n {\n children,\n alwaysOpen = false,\n caretEnd,\n className,\n defaultExpandedKeys,\n expandedKeys,\n flush,\n items,\n name,\n onExpandedChange,\n size,\n ...rest\n },\n ref\n ) => {\n const generatedName = useId()\n const groupName = name ?? generatedName\n const _className = classNames('accordion', { flush, 'caret-end': caretEnd }, size, className)\n\n const isExpandedControlled = expandedKeys !== undefined\n const isTrackingExpanded =\n isExpandedControlled || defaultExpandedKeys !== undefined || onExpandedChange !== undefined\n\n const [uncontrolledExpandedKeys, setUncontrolledExpandedKeys] = useState<\n Array<number | string>\n >(\n () =>\n defaultExpandedKeys ??\n // The key before the filter: an item with no `id` is keyed by its index in `items`, not\n // by its place among the open ones.\n items?.flatMap((item, index) => (item.open ? [item.id ?? index] : [])) ??\n []\n )\n const currentExpandedKeys = isExpandedControlled ? expandedKeys : uncontrolledExpandedKeys\n\n // Keyed by each item's id (or index) so a toggle handler can read every sibling's *actual*\n // DOM open state — the browser settles a whole shared-`name` group's open attributes\n // synchronously before dispatching any `toggle` events, so this is always the true next set,\n // regardless of which affected item's handler happens to run first.\n const itemRefs = useRef(new Map<number | string, HTMLDetailsElement | null>())\n\n const handleItemToggle =\n (id: number | string, itemOnToggle?: AccordionItemDef['onToggle']) =>\n (event: React.SyntheticEvent<HTMLDetailsElement>) => {\n itemOnToggle?.(event)\n if (!items) return\n const next = items\n .map((item, index) => item.id ?? index)\n .filter((key) => itemRefs.current.get(key)?.open)\n if (isExpandedControlled) {\n // React doesn't intercept a native <details> click the way it does controlled form\n // inputs, so the DOM has already toggled by the time this fires. Snap this element back\n // to the still-current controlled value — if the consumer's onExpandedChange updates\n // `expandedKeys` in response, the next render sets it back to the new value anyway.\n ;(event.currentTarget as HTMLDetailsElement).open = expandedKeys.includes(id)\n } else {\n setUncontrolledExpandedKeys(next)\n }\n onExpandedChange?.(next)\n }\n\n const content = items\n ? items.map((item, index) => {\n const id = item.id ?? index\n return (\n <AccordionItem\n key={id}\n className={item.className}\n open={isTrackingExpanded ? currentExpandedKeys.includes(id) : item.open}\n name={item.name}\n alwaysOpen={item.alwaysOpen}\n onToggle={handleItemToggle(id, item.onToggle)}\n ref={(node) => {\n itemRefs.current.set(id, node)\n }}\n >\n <AccordionHeader>{item.header}</AccordionHeader>\n <AccordionBody>{item.body}</AccordionBody>\n </AccordionItem>\n )\n })\n : children\n\n return (\n <div className={_className} {...rest} ref={ref}>\n <AccordionContext.Provider value={{ alwaysOpen, name: groupName }}>\n {content}\n </AccordionContext.Provider>\n </div>\n )\n }\n)\n\nAccordion.displayName = 'Accordion'\n"],"mappings":"A,yPA6BA,SAASG,EACP,CAAE,WAAU,YAAW,YAAW,GAAGC,GACrC,EACA,CACA,IAAMC,EAAYC,GAAa,MAE/B,MACE,kBAAA,cAACD,EAAD,CAAW,UAAWH,EAAW,iBAAkBK,CAAS,EAAG,GAAIH,EAAW,KAEnE,EADRI,CACQ,CAEf,CAEA,MAAaC,EAAgBC,EAC3BP,EACA,eACF,ECnCaQ,EAAkBC,GAC5B,CAAE,WAAU,YAAW,GAAGR,GAAQ,IAE/B,kBAAA,cAAC,UAAD,CAAS,UAAWF,EAAWK,CAAS,GAAK,IAAA,GAAW,GAAIH,EAAW,KAE9D,EADP,kBAAA,cAAC,OAAD,CAAM,UAAU,iBAAkC,EAAfI,CAAe,CAC3C,CAGf,EAEA,EAAgB,YAAc,kBCb9B,MAAaK,EAAmBC,EAAqC,CAAC,CAAC,ECuB1DC,EAAgBH,GAC1B,CAAE,WAAU,aAAY,YAAW,OAAM,OAAM,QAASI,EAAU,GAAGZ,GAAQ,IAAQ,CACpFJ,EACEgB,IAAa,IAAA,GACb,sKAEF,EAEA,IAAMC,EAAUC,EAAWL,CAAgB,EACrCM,EAAeC,GAAcH,EAAQ,WACrCI,EAAYC,GAAQL,EAAQ,KAE5BM,EAAaJ,EAAe,CAAC,EAAI,CAAE,KAAME,CAAU,EAEzD,MACE,kBAAA,cAAC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AiBK,EAAIV,EAAK,QAAQ,EAC5C,IAAM,GAAS,CACbG,EAAS,QAAQ,IAAIO,EAAIE,CAAI,CAC/B,CAIa,EAFb,kBAAA,cAACxC,EAAA,KAAiB4B,EAAK,MAAwB,EAC/C,kBAAA,cAAC9B,EAAA,KAAe8B,EAAK,IAAoB,CAC5B,CAEnB,CAAC,EACD/B,EAEJ,MACE,kBAAA,cAAC,MAAD,CAAK,UAAWmB,EAAY,GAAIvB,EAAW,KAItC,EAHH,kBAAA,cAACS,EAAiB,SAAlB,CAA2B,MAAO,CAAE,aAAY,KAAMQ,CAAU,CAErC,EADxB6B,CACwB,CACxB,CAET,CACF,EAEA,EAAU,YAAc,Y"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./focus-ring-Bs80iIBN.js";import{c as e}from"./slot-DagH0Gxq.js";import{t}from"./useForkedRef-WoqMqsWE.js";import{t as n}from"./polymorphic-mAKwlLiW.js";import{t as r}from"./useIsomorphicLayoutEffect-BbqRwuqn.js";import{t as i}from"./useDialogElement-yEgUSejP.js";import{t as a}from"./Icon-Dk5_q79o.js";import{n as o}from"./colorClassNames-YzGWu6qm.js";import{t as s}from"./CloseButton-CAQ--0sB.js";import{t as c}from"./Button-Cjenm3ku.js";import l,{createContext as u,forwardRef as d,useCallback as f,useContext as p,useId as m,useRef as h,useState as g}from"react";import _ from"classnames";const v=u({close:()=>{},registerPart:()=>()=>{}}),y=()=>p(v),b=d(({"aria-describedby":t,"aria-labelledby":n,backdrop:r=`static`,children:a,className:o,closeButton:c,closeLabel:u,defaultVisible:d,instant:p,keyboard:m=!1,onClick:h,onClose:y,onClosePrevented:b,onHidden:x,onKeyDown:S,onShow:C,onShown:w,onVisibleChange:T,open:E,visible:D,...O},k)=>{let{close:A,forkedRef:j,handleBackdropClick:M,handleCancel:N,handleKeyDown:P,handleNativeClose:F,hiding:I,staticBounce:L}=i({backdrop:r,defaultVisible:d,instant:p,isModal:!0,keyboard:m,onClick:h,onClose:y,onClosePrevented:b,onHidden:x,onKeyDown:S,onShow:C,onShown:w,onVisibleChange:T,open:E,ref:k,visible:D}),[R,z]=g([]),B=f((e,t,n)=>{let r={id:n,kind:e,node:t};return z(e=>[...e,r]),()=>z(e=>e.filter(e=>e!==r))},[]),V=e=>R.filter(t=>t.kind===e).sort((e,t)=>e.node.compareDocumentPosition(t.node)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1).map(({id:e})=>e),H=n||e(...V(`title`)),U=t||e(...V(`description`)),W={close:A,registerPart:B};return/* @__PURE__ */ l.createElement(v.Provider,{value:W},/* @__PURE__ */ l.createElement(`dialog`,{"aria-describedby":U,"aria-labelledby":H,role:`alertdialog`,tabIndex:-1,...O,open:E,className:_(`alert`,`dialog`,{instant:p,hiding:I,"dialog-static":L},o),onCancel:N,onClick:M,onClose:F,onKeyDown:P,ref:j},a,c&&/* @__PURE__ */ l.createElement(s,{label:u,onClick:A})))});b.displayName=`Alert`;function x({children:e,className:t,component:n,...r},i){let a=n??`div`;return/* @__PURE__ */ l.createElement(a,{className:_(`alert-body`,t),...r,ref:i},e)}const S=n(x,`AlertBody`),C=d(({color:e=`default`,onClick:t,...n},r)=>{let{close:i}=y();return/* @__PURE__ */ l.createElement(c,{color:e,"data-autofocus":``,...n,onClick:e=>{t?.(e),e.defaultPrevented||i()},ref:r})});C.displayName=`AlertCancel`;function w(e){let t=h(null),{registerPart:n}=y(),i=h({});return r(()=>{let r=t.current,a=r?.id||void 0;a!==i.current.id&&(i.current.unregister?.(),i.current=r&&a?{id:a,unregister:n(e,r,a)}:{})}),r(()=>()=>{i.current.unregister?.(),i.current={}},[n]),t}function T({children:e,className:n,component:r,id:i,...a},o){let s=r??`code`,c=m(),u=w(`description`),d=t(o,u);return/* @__PURE__ */ l.createElement(s,{className:_(`alert-code`,n),id:i??c,...a,ref:d},e)}const E=n(T,`AlertCode`);function D({children:e,className:t,component:n,stacked:r,...i},a){let o=n??`div`;return/* @__PURE__ */ l.createElement(o,{className:_(`alert-footer`,{stacked:r},t),...i,ref:a},e)}const O=n(D,`AlertFooter`),k=d(({className:e,color:t,...n},r)=>/* @__PURE__ */ l.createElement(a,{className:_(`alert-icon`,t&&o[t],e),...n,ref:r}));k.displayName=`AlertIcon`;function A({children:e,className:n,component:r,id:i,...a},o){let s=r??`p`,c=m(),u=w(`description`),d=t(o,u);return/* @__PURE__ */ l.createElement(s,{className:n,id:i??c,...a,ref:d},e)}const j=n(A,`AlertText`);function M({children:e,className:n,component:r,id:i,...a},o){let s=r??`h2`,c=m(),u=w(`title`),d=t(o,u);return/* @__PURE__ */ l.createElement(s,{className:_(`alert-title`,n),id:i??c,...a,ref:d},e)}const N=n(M,`AlertTitle`);export{E as a,b as c,O as i,j as n,C as o,k as r,S as s,N as t};
|
|
2
|
+
//# sourceMappingURL=alert-oSKrhxkI.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-DSLg5MBb.js","names":["joinIds","createPolymorphicComponent","useIsomorphicLayoutEffect","useDialogElement","Icon","ICON_COLOR_CLASS_NAMES","CloseButton","Button","React","classNames","AlertContext","createContext","useAlertContext","useContext","Alert","forwardRef","ariaDescribedBy","ariaLabelledBy","rest","parts","setParts","useState","registerPart","useCallback","part","current","entry","idsOf","kind","a","b","id","labelledBy","describedBy","contextValue","staticBounce","className","handleCancel","handleBackdropClick","handleNativeClose","handleKeyDown","forkedRef","children","closeButton","closeLabel","close","AlertBodyRender","Component","component","AlertBody","AlertCancel","onClick","event","useAlertPart","nodeRef","useRef","registered","node","AlertCodeRender","generatedId","useId","useForkedRef","ref","AlertCode","AlertFooterRender","AlertFooter","AlertIcon","color","AlertTextRender","AlertText","AlertTitleRender","AlertTitle"],"sources":["../../src/components/alert/Alert.tsx","../../src/components/alert/AlertBody.tsx","../../src/components/alert/AlertCancel.tsx","../../src/components/alert/useAlertPart.ts","../../src/components/alert/AlertCode.tsx","../../src/components/alert/AlertFooter.tsx","../../src/components/alert/AlertIcon.tsx","../../src/components/alert/AlertText.tsx","../../src/components/alert/AlertTitle.tsx"],"sourcesContent":["import React, {\n createContext,\n DialogHTMLAttributes,\n forwardRef,\n useCallback,\n useContext,\n useState\n} from 'react'\nimport classNames from 'classnames'\n\nimport { useDialogElement } from '../../hooks'\nimport { joinIds } from '../../utils/idRefs'\nimport { CloseButton } from '../close-button/CloseButton'\n\nexport interface AlertProps extends Omit<\n DialogHTMLAttributes<HTMLDialogElement>,\n 'onCancel' | 'onClose'\n> {\n /**\n * Whether a click on the backdrop closes the alert. By default it doesn't (`'static'`): the\n * alert bounces, since an alert dialog waits for an explicit choice. Set `true` to let it close.\n */\n backdrop?: true | 'static'\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Adds a close button in the corner, for an alert that needs a way out besides its actions.\n */\n closeButton?: boolean\n /**\n * The close button's accessible name. Defaults to `'Close'`; set it for non-English UIs.\n */\n closeLabel?: string\n /**\n * Whether the alert is open when it first renders. Such an alert is uncontrolled: it closes\n * itself on a close request. Use `visible` to open and close it from outside.\n */\n defaultVisible?: boolean\n /**\n * Disable the open/close transition entirely.\n */\n instant?: boolean\n /**\n * Whether the Escape key closes the alert. By default it doesn't: the alert bounces instead.\n */\n keyboard?: boolean\n /**\n * Renders the alert open from its first paint, server HTML included, as a non-modal dialog: a\n * static preview. It stays open until a close request. Use `visible` or `defaultVisible` to\n * open it as a modal dialog.\n */\n open?: boolean\n /**\n * Callback fired when the alert asks to be closed: `AlertCancel`, the close button, and, when\n * allowed, Escape or a backdrop click.\n */\n onClose?: () => void\n /**\n * Callback fired when a close attempt is blocked: a click on a static backdrop, or Escape\n * while `keyboard` is off.\n */\n onClosePrevented?: () => void\n /**\n * Callback fired after the exit transition completes and the alert is fully hidden.\n */\n onHidden?: () => void\n /**\n * Callback fired when the alert starts to open.\n */\n onShow?: () => void\n /**\n * Callback fired after the entry transition completes and the alert is fully visible.\n */\n onShown?: () => void\n /**\n * Callback fired with `false` when the alert asks to be closed, at the same moments as\n * `onClose`. It makes `visible` and `onVisibleChange` a pair that takes a state setter.\n */\n onVisibleChange?: (visible: boolean) => void\n /**\n * Whether the alert is open. The alert is then controlled: a close request only fires `onClose`\n * and `onVisibleChange`, and the alert closes when this becomes `false`.\n */\n visible?: boolean\n}\n\nexport type AlertPartKind = 'title' | 'description'\n\nexport interface AlertContextProps {\n /**\n * Asks the alert to close: fires `onClose` and `onVisibleChange(false)`.\n */\n close: () => void\n /**\n * Adds a rendered element to the alert's `aria-labelledby` (a title) or `aria-describedby` (a\n * code or text), under the id it has in the DOM, and returns the function that takes it out.\n * The parts call it through `useAlertPart`.\n */\n registerPart: (kind: AlertPartKind, node: HTMLElement, id: string) => () => void\n}\n\nexport const AlertContext = createContext<AlertContextProps>({\n close: () => {},\n registerPart: () => () => {}\n})\n\nexport const useAlertContext = () => useContext(AlertContext)\n\n// chassis-css's alert dialog: a `<dialog class=\"alert dialog\" role=\"alertdialog\">`, opened with\n// `showModal()` by the same machinery as `Modal` (`useDialogElement`). What differs is the\n// defaults an alert dialog wants (a static backdrop, no Escape) and how it is named and\n// described. `aria-labelledby` and `aria-describedby` list the `AlertTitle`, `AlertCode` and\n// `AlertText` elements that are rendered, under the ids they have in the DOM (a child's own id\n// under `asChild`, a caller's `id`), in document order. The parts register from a layout effect\n// (`useAlertPart`), so the server's HTML names no id that isn't in it, and both attributes are\n// set before the first paint.\nexport const Alert = forwardRef<HTMLDialogElement, AlertProps>(\n (\n {\n 'aria-describedby': ariaDescribedBy,\n 'aria-labelledby': ariaLabelledBy,\n backdrop = 'static',\n children,\n className,\n closeButton,\n closeLabel,\n defaultVisible,\n instant,\n keyboard = false,\n onClick,\n onClose,\n onClosePrevented,\n onHidden,\n onKeyDown,\n onShow,\n onShown,\n onVisibleChange,\n open,\n visible,\n ...rest\n },\n ref\n ) => {\n const {\n close,\n forkedRef,\n handleBackdropClick,\n handleCancel,\n handleKeyDown,\n handleNativeClose,\n hiding,\n staticBounce\n } = useDialogElement({\n backdrop,\n defaultVisible,\n instant,\n isModal: true,\n keyboard,\n onClick,\n onClose,\n onClosePrevented,\n onHidden,\n onKeyDown,\n onShow,\n onShown,\n onVisibleChange,\n open,\n ref,\n visible\n })\n\n const [parts, setParts] = useState<{ id: string; kind: AlertPartKind; node: HTMLElement }[]>([])\n const registerPart = useCallback((kind: AlertPartKind, node: HTMLElement, id: string) => {\n const part = { id, kind, node }\n setParts((current) => [...current, part])\n return () => setParts((current) => current.filter((entry) => entry !== part))\n }, [])\n\n const idsOf = (kind: AlertPartKind) =>\n parts\n .filter((part) => part.kind === kind)\n .sort((a, b) =>\n a.node.compareDocumentPosition(b.node) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1\n )\n .map(({ id }) => id)\n // An empty string counts as unset.\n const labelledBy = ariaLabelledBy || joinIds(...idsOf('title'))\n const describedBy = ariaDescribedBy || joinIds(...idsOf('description'))\n\n const contextValue = { close, registerPart }\n\n return (\n <AlertContext.Provider value={contextValue}>\n <dialog\n aria-describedby={describedBy}\n aria-labelledby={labelledBy}\n role=\"alertdialog\"\n {...rest}\n open={open}\n className={classNames(\n 'alert',\n 'dialog',\n { instant, hiding, 'dialog-static': staticBounce },\n className\n )}\n onCancel={handleCancel}\n onClick={handleBackdropClick}\n onClose={handleNativeClose}\n onKeyDown={handleKeyDown}\n ref={forkedRef}\n >\n {children}\n {closeButton && <CloseButton label={closeLabel} onClick={close} />}\n </dialog>\n </AlertContext.Provider>\n )\n }\n)\n\nAlert.displayName = 'Alert'\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 AlertBodyOwnProps<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 an HTML element or a component.\n *\n * @default 'div'\n */\n component?: C\n}\n\nexport type AlertBodyProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n AlertBodyOwnProps<C>\n>\n\ntype AlertBodyComponent = (<C extends ElementType = 'div'>(\n props: AlertBodyProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\n// `.alert-body`: the column that holds the title, an optional code and the message.\n\nfunction AlertBodyRender<C extends ElementType = 'div'>(\n { children, className, component, ...rest }: AlertBodyProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n\n return (\n <Component className={classNames('alert-body', className)} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const AlertBody = createPolymorphicComponent<AlertBodyComponent>(\n AlertBodyRender as ForwardRefRenderFunction<Element, AlertBodyProps<ElementType>>,\n 'AlertBody'\n)\n","import React, { forwardRef, MouseEvent } from 'react'\n\nimport { Button, ButtonProps } from '../button/Button'\nimport { useAlertContext } from './Alert'\n\nexport type AlertCancelProps = Omit<ButtonProps<'button'>, 'asChild' | 'component' | 'href'>\n\n// The least destructive action: it closes the alert, and it has focus when the alert opens, as\n// an alert dialog should (WAI-ARIA APG). An element of your own with `data-autofocus` earlier in\n// the alert takes focus instead.\nexport const AlertCancel = forwardRef<HTMLButtonElement, AlertCancelProps>(\n ({ color = 'default', onClick, ...rest }, ref) => {\n const { close } = useAlertContext()\n return (\n <Button\n color={color}\n data-autofocus=\"\"\n {...rest}\n onClick={(event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event)\n if (!event.defaultPrevented) close()\n }}\n ref={ref}\n />\n )\n }\n)\n\nAlertCancel.displayName = 'AlertCancel'\n","import { useRef } from 'react'\n\nimport { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect'\nimport { AlertPartKind, useAlertContext } from './Alert'\n\n// Registers the element behind the returned ref with the enclosing `Alert`, under the id it has in\n// the DOM after each commit. That is the part's own id, a caller's `id`, or, under `asChild`, the\n// child's own id, which wins over the part's. A changed id registers again; unmounting takes the\n// element out. Outside an `Alert` it does nothing.\nexport function useAlertPart(kind: AlertPartKind) {\n const nodeRef = useRef<HTMLElement | null>(null)\n const { registerPart } = useAlertContext()\n const registered = useRef<{ id?: string; unregister?: () => void }>({})\n\n useIsomorphicLayoutEffect(() => {\n const node = nodeRef.current\n const id = node?.id || undefined\n if (id === registered.current.id) return\n registered.current.unregister?.()\n registered.current = node && id ? { id, unregister: registerPart(kind, node, id) } : {}\n })\n\n useIsomorphicLayoutEffect(\n () => () => {\n registered.current.unregister?.()\n registered.current = {}\n },\n [registerPart]\n )\n\n return nodeRef\n}\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement, useId } from 'react'\nimport classNames from 'classnames'\n\nimport { useForkedRef } from '../../hooks/useForkedRef'\nimport { useAlertPart } from './useAlertPart'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype AlertCodeOwnProps<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 an HTML element or a component.\n *\n * @default 'code'\n */\n component?: C\n}\n\nexport type AlertCodeProps<C extends ElementType = 'code'> = PolymorphicComponentProps<\n C,\n AlertCodeOwnProps<C>\n>\n\ntype AlertCodeComponent = (<C extends ElementType = 'code'>(\n props: AlertCodeProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\n// `.alert-code`: a machine-readable reference, such as an error code, shown under the title. Its\n// id joins the alert's `aria-describedby`, in document order with the text's.\n\nfunction AlertCodeRender<C extends ElementType = 'code'>(\n { children, className, component, id, ...rest }: AlertCodeProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'code'\n const generatedId = useId()\n const nodeRef = useAlertPart('description')\n const forkedRef = useForkedRef(ref, nodeRef)\n\n return (\n <Component\n className={classNames('alert-code', className)}\n id={id ?? generatedId}\n {...rest}\n ref={forkedRef}\n >\n {children}\n </Component>\n )\n}\n\nexport const AlertCode = createPolymorphicComponent<AlertCodeComponent>(\n AlertCodeRender as ForwardRefRenderFunction<Element, AlertCodeProps<ElementType>>,\n 'AlertCode'\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 AlertFooterOwnProps<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 an HTML element or a component.\n *\n * @default 'div'\n */\n component?: C\n /**\n * Stacks the actions as full-width rows on small screens, instead of sharing one row.\n */\n stacked?: boolean\n}\n\nexport type AlertFooterProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n AlertFooterOwnProps<C>\n>\n\ntype AlertFooterComponent = (<C extends ElementType = 'div'>(\n props: AlertFooterProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\n// `.alert-footer`: the actions. chassis-css lays them out right to left, so write the primary\n// action first. Give a separate destructive action `className=\"me-auto\"` to push it to the other\n// end.\n\nfunction AlertFooterRender<C extends ElementType = 'div'>(\n { children, className, component, stacked, ...rest }: AlertFooterProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n\n return (\n <Component className={classNames('alert-footer', { stacked }, className)} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const AlertFooter = createPolymorphicComponent<AlertFooterComponent>(\n AlertFooterRender as ForwardRefRenderFunction<Element, AlertFooterProps<ElementType>>,\n 'AlertFooter'\n)\n","import React, { forwardRef } from 'react'\nimport classNames from 'classnames'\n\nimport { ContextColor } from '../../types'\nimport { ICON_COLOR_CLASS_NAMES } from '../../utils/colorClassNames'\nimport { Icon, IconProps } from '../icon/Icon'\n\nexport type AlertIconProps = IconProps & {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Colors the icon with one of Chassis context colors, such as `danger` for a destructive\n * confirmation.\n */\n color?: ContextColor\n}\n\n// `.alert-icon`: an icon before the body. With it, chassis-css lays the alert out in two columns\n// from the `md` breakpoint up.\nexport const AlertIcon = forwardRef<HTMLSpanElement | SVGSVGElement, AlertIconProps>(\n ({ className, color, ...rest }, ref) => (\n <Icon\n className={classNames('alert-icon', color && ICON_COLOR_CLASS_NAMES[color], className)}\n {...rest}\n ref={ref}\n />\n )\n)\n\nAlertIcon.displayName = 'AlertIcon'\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement, useId } from 'react'\n\nimport { useForkedRef } from '../../hooks/useForkedRef'\nimport { useAlertPart } from './useAlertPart'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype AlertTextOwnProps<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 an HTML element or a component.\n *\n * @default 'p'\n */\n component?: C\n}\n\nexport type AlertTextProps<C extends ElementType = 'p'> = PolymorphicComponentProps<\n C,\n AlertTextOwnProps<C>\n>\n\ntype AlertTextComponent = (<C extends ElementType = 'p'>(\n props: AlertTextProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\n// The alert's message. Its id joins the alert's `aria-describedby`. chassis-css styles it as a\n// `<p>` inside `.alert-body`, with no class of its own.\n\nfunction AlertTextRender<C extends ElementType = 'p'>(\n { children, className, component, id, ...rest }: AlertTextProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'p'\n const generatedId = useId()\n const nodeRef = useAlertPart('description')\n const forkedRef = useForkedRef(ref, nodeRef)\n\n return (\n <Component className={className} id={id ?? generatedId} {...rest} ref={forkedRef}>\n {children}\n </Component>\n )\n}\n\nexport const AlertText = createPolymorphicComponent<AlertTextComponent>(\n AlertTextRender as ForwardRefRenderFunction<Element, AlertTextProps<ElementType>>,\n 'AlertText'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement, useId } from 'react'\nimport classNames from 'classnames'\n\nimport { useForkedRef } from '../../hooks/useForkedRef'\nimport { useAlertPart } from './useAlertPart'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype AlertTitleOwnProps<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 an HTML element or a component.\n *\n * @default 'h2'\n */\n component?: C\n}\n\nexport type AlertTitleProps<C extends ElementType = 'h2'> = PolymorphicComponentProps<\n C,\n AlertTitleOwnProps<C>\n>\n\ntype AlertTitleComponent = (<C extends ElementType = 'h2'>(\n props: AlertTitleProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\n// `.alert-title`: its id, whichever reaches the DOM, joins the alert's `aria-labelledby`.\n\nfunction AlertTitleRender<C extends ElementType = 'h2'>(\n { children, className, component, id, ...rest }: AlertTitleProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'h2'\n const generatedId = useId()\n const nodeRef = useAlertPart('title')\n const forkedRef = useForkedRef(ref, nodeRef)\n\n return (\n <Component\n className={classNames('alert-title', className)}\n id={id ?? generatedId}\n {...rest}\n ref={forkedRef}\n >\n {children}\n </Component>\n )\n}\n\nexport const AlertTitle = createPolymorphicComponent<AlertTitleComponent>(\n AlertTitleRender as ForwardRefRenderFunction<Element, AlertTitleProps<ElementType>>,\n 'AlertTitle'\n)\n"],"mappings":"A,wlBAuGA,MAAaU,EAAeC,EAAiC,CAC3D,UAAa,CAAC,EACd,qBAA0B,CAAC,CAC7B,CAAC,EAEYC,MAAwBC,EAAWH,CAAY,EAU/CI,EAAQC,GAEjB,CACE,mBAAoBC,EACpB,kBAAmBC,EACnB,WAAW,SACX,WACA,YACA,cACA,aACA,iBACA,UACA,WAAW,GACX,UACA,UACA,mBACA,WACA,YACA,SACA,UACA,kBACA,OACA,UACA,GAAGC,GAEL,IACG,CACH,GAAM,CACJ,QACA,YACA,sBACA,eACA,gBACA,oBACA,SACA,gBACEf,EAAiB,CACnB,WACA,i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phicComponent","useIsomorphicLayoutEffect","useDialogElement","Icon","ICON_COLOR_CLASS_NAMES","CloseButton","Button","React","classNames","AlertContext","createContext","useAlertContext","useContext","Alert","forwardRef","ariaDescribedBy","ariaLabelledBy","rest","parts","setParts","useState","registerPart","useCallback","part","current","entry","idsOf","kind","a","b","id","labelledBy","describedBy","contextValue","staticBounce","className","handleCancel","handleBackdropClick","handleNativeClose","handleKeyDown","forkedRef","children","closeButton","closeLabel","close","AlertBodyRender","Component","component","AlertBody","AlertCancel","onClick","event","useAlertPart","nodeRef","useRef","registered","node","AlertCodeRender","generatedId","useId","useForkedRef","ref","AlertCode","AlertFooterRender","AlertFooter","AlertIcon","color","AlertTextRender","AlertText","AlertTitleRender","AlertTitle"],"sources":["../../src/components/alert/Alert.tsx","../../src/components/alert/AlertBody.tsx","../../src/components/alert/AlertCancel.tsx","../../src/components/alert/useAlertPart.ts","../../src/components/alert/AlertCode.tsx","../../src/components/alert/AlertFooter.tsx","../../src/components/alert/AlertIcon.tsx","../../src/components/alert/AlertText.tsx","../../src/components/alert/AlertTitle.tsx"],"sourcesContent":["import React, {\n createContext,\n DialogHTMLAttributes,\n forwardRef,\n useCallback,\n useContext,\n useState\n} from 'react'\nimport classNames from 'classnames'\n\nimport { useDialogElement } from '../../hooks'\nimport { joinIds } from '../../utils/idRefs'\nimport { CloseButton } from '../close-button/CloseButton'\n\nexport interface AlertProps extends Omit<\n DialogHTMLAttributes<HTMLDialogElement>,\n 'onCancel' | 'onClose'\n> {\n /**\n * Whether a click on the backdrop closes the alert. By default it doesn't (`'static'`): the\n * alert bounces, since an alert dialog waits for an explicit choice. Set `true` to let it close.\n */\n backdrop?: true | 'static'\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Adds a close button in the corner, for an alert that needs a way out besides its actions.\n */\n closeButton?: boolean\n /**\n * The close button's accessible name. Defaults to `'Close'`; set it for non-English UIs.\n */\n closeLabel?: string\n /**\n * Whether the alert is open when it first renders. Such an alert is uncontrolled: it closes\n * itself on a close request. Use `visible` to open and close it from outside.\n */\n defaultVisible?: boolean\n /**\n * Disable the open/close transition entirely.\n */\n instant?: boolean\n /**\n * Whether the Escape key closes the alert. By default it doesn't: the alert bounces instead.\n */\n keyboard?: boolean\n /**\n * Renders the alert open from its first paint, server HTML included, as a non-modal dialog: a\n * static preview. It stays open until a close request. Use `visible` or `defaultVisible` to\n * open it as a modal dialog.\n */\n open?: boolean\n /**\n * Callback fired when the alert asks to be closed: `AlertCancel`, the close button, and, when\n * allowed, Escape or a backdrop click.\n */\n onClose?: () => void\n /**\n * Callback fired when a close attempt is blocked: a click on a static backdrop, or Escape\n * while `keyboard` is off.\n */\n onClosePrevented?: () => void\n /**\n * Callback fired after the exit transition completes and the alert is fully hidden.\n */\n onHidden?: () => void\n /**\n * Callback fired when the alert starts to open.\n */\n onShow?: () => void\n /**\n * Callback fired after the entry transition completes and the alert is fully visible.\n */\n onShown?: () => void\n /**\n * Callback fired with `false` when the alert asks to be closed, at the same moments as\n * `onClose`. It makes `visible` and `onVisibleChange` a pair that takes a state setter.\n */\n onVisibleChange?: (visible: boolean) => void\n /**\n * Whether the alert is open. The alert is then controlled: a close request only fires `onClose`\n * and `onVisibleChange`, and the alert closes when this becomes `false`.\n */\n visible?: boolean\n}\n\nexport type AlertPartKind = 'title' | 'description'\n\nexport interface AlertContextProps {\n /**\n * Asks the alert to close: fires `onClose` and `onVisibleChange(false)`.\n */\n close: () => void\n /**\n * Adds a rendered element to the alert's `aria-labelledby` (a title) or `aria-describedby` (a\n * code or text), under the id it has in the DOM, and returns the function that takes it out.\n * The parts call it through `useAlertPart`.\n */\n registerPart: (kind: AlertPartKind, node: HTMLElement, id: string) => () => void\n}\n\nexport const AlertContext = createContext<AlertContextProps>({\n close: () => {},\n registerPart: () => () => {}\n})\n\nexport const useAlertContext = () => useContext(AlertContext)\n\n// chassis-css's alert dialog: a `<dialog class=\"alert dialog\" role=\"alertdialog\">`, opened with\n// `showModal()` by the same machinery as `Modal` (`useDialogElement`). What differs is the\n// defaults an alert dialog wants (a static backdrop, no Escape) and how it is named and\n// described. `aria-labelledby` and `aria-describedby` list the `AlertTitle`, `AlertCode` and\n// `AlertText` elements that are rendered, under the ids they have in the DOM (a child's own id\n// under `asChild`, a caller's `id`), in document order. The parts register from a layout effect\n// (`useAlertPart`), so the server's HTML names no id that isn't in it, and both attributes are\n// set before the first paint.\nexport const Alert = forwardRef<HTMLDialogElement, AlertProps>(\n (\n {\n 'aria-describedby': ariaDescribedBy,\n 'aria-labelledby': ariaLabelledBy,\n backdrop = 'static',\n children,\n className,\n closeButton,\n closeLabel,\n defaultVisible,\n instant,\n keyboard = false,\n onClick,\n onClose,\n onClosePrevented,\n onHidden,\n onKeyDown,\n onShow,\n onShown,\n onVisibleChange,\n open,\n visible,\n ...rest\n },\n ref\n ) => {\n const {\n close,\n forkedRef,\n handleBackdropClick,\n handleCancel,\n handleKeyDown,\n handleNativeClose,\n hiding,\n staticBounce\n } = useDialogElement({\n backdrop,\n defaultVisible,\n instant,\n isModal: true,\n keyboard,\n onClick,\n onClose,\n onClosePrevented,\n onHidden,\n onKeyDown,\n onShow,\n onShown,\n onVisibleChange,\n open,\n ref,\n visible\n })\n\n const [parts, setParts] = useState<{ id: string; kind: AlertPartKind; node: HTMLElement }[]>([])\n const registerPart = useCallback((kind: AlertPartKind, node: HTMLElement, id: string) => {\n const part = { id, kind, node }\n setParts((current) => [...current, part])\n return () => setParts((current) => current.filter((entry) => entry !== part))\n }, [])\n\n const idsOf = (kind: AlertPartKind) =>\n parts\n .filter((part) => part.kind === kind)\n .sort((a, b) =>\n a.node.compareDocumentPosition(b.node) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1\n )\n .map(({ id }) => id)\n // An empty string counts as unset.\n const labelledBy = ariaLabelledBy || joinIds(...idsOf('title'))\n const describedBy = ariaDescribedBy || joinIds(...idsOf('description'))\n\n const contextValue = { close, registerPart }\n\n return (\n <AlertContext.Provider value={contextValue}>\n <dialog\n aria-describedby={describedBy}\n aria-labelledby={labelledBy}\n role=\"alertdialog\"\n // Out of Firefox's and Safari's Tab order, which takes in a `<dialog>` without a tabindex.\n tabIndex={-1}\n {...rest}\n open={open}\n className={classNames(\n 'alert',\n 'dialog',\n { instant, hiding, 'dialog-static': staticBounce },\n className\n )}\n onCancel={handleCancel}\n onClick={handleBackdropClick}\n onClose={handleNativeClose}\n onKeyDown={handleKeyDown}\n ref={forkedRef}\n >\n {children}\n {closeButton && <CloseButton label={closeLabel} onClick={close} />}\n </dialog>\n </AlertContext.Provider>\n )\n }\n)\n\nAlert.displayName = 'Alert'\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 AlertBodyOwnProps<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 an HTML element or a component.\n *\n * @default 'div'\n */\n component?: C\n}\n\nexport type AlertBodyProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n AlertBodyOwnProps<C>\n>\n\ntype AlertBodyComponent = (<C extends ElementType = 'div'>(\n props: AlertBodyProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\n// `.alert-body`: the column that holds the title, an optional code and the message.\n\nfunction AlertBodyRender<C extends ElementType = 'div'>(\n { children, className, component, ...rest }: AlertBodyProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n\n return (\n <Component className={classNames('alert-body', className)} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const AlertBody = createPolymorphicComponent<AlertBodyComponent>(\n AlertBodyRender as ForwardRefRenderFunction<Element, AlertBodyProps<ElementType>>,\n 'AlertBody'\n)\n","import React, { forwardRef, MouseEvent } from 'react'\n\nimport { Button, ButtonProps } from '../button/Button'\nimport { useAlertContext } from './Alert'\n\nexport type AlertCancelProps = Omit<ButtonProps<'button'>, 'asChild' | 'component' | 'href'>\n\n// The least destructive action: it closes the alert, and it has focus when the alert opens, as\n// an alert dialog should (WAI-ARIA APG). An element of your own with `data-autofocus` earlier in\n// the alert takes focus instead.\nexport const AlertCancel = forwardRef<HTMLButtonElement, AlertCancelProps>(\n ({ color = 'default', onClick, ...rest }, ref) => {\n const { close } = useAlertContext()\n return (\n <Button\n color={color}\n data-autofocus=\"\"\n {...rest}\n onClick={(event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event)\n if (!event.defaultPrevented) close()\n }}\n ref={ref}\n />\n )\n }\n)\n\nAlertCancel.displayName = 'AlertCancel'\n","import { useRef } from 'react'\n\nimport { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect'\nimport { AlertPartKind, useAlertContext } from './Alert'\n\n// Registers the element behind the returned ref with the enclosing `Alert`, under the id it has in\n// the DOM after each commit. That is the part's own id, a caller's `id`, or, under `asChild`, the\n// child's own id, which wins over the part's. A changed id registers again; unmounting takes the\n// element out. Outside an `Alert` it does nothing.\nexport function useAlertPart(kind: AlertPartKind) {\n const nodeRef = useRef<HTMLElement | null>(null)\n const { registerPart } = useAlertContext()\n const registered = useRef<{ id?: string; unregister?: () => void }>({})\n\n useIsomorphicLayoutEffect(() => {\n const node = nodeRef.current\n const id = node?.id || undefined\n if (id === registered.current.id) return\n registered.current.unregister?.()\n registered.current = node && id ? { id, unregister: registerPart(kind, node, id) } : {}\n })\n\n useIsomorphicLayoutEffect(\n () => () => {\n registered.current.unregister?.()\n registered.current = {}\n },\n [registerPart]\n )\n\n return nodeRef\n}\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement, useId } from 'react'\nimport classNames from 'classnames'\n\nimport { useForkedRef } from '../../hooks/useForkedRef'\nimport { useAlertPart } from './useAlertPart'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype AlertCodeOwnProps<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 an HTML element or a component.\n *\n * @default 'code'\n */\n component?: C\n}\n\nexport type AlertCodeProps<C extends ElementType = 'code'> = PolymorphicComponentProps<\n C,\n AlertCodeOwnProps<C>\n>\n\ntype AlertCodeComponent = (<C extends ElementType = 'code'>(\n props: AlertCodeProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\n// `.alert-code`: a machine-readable reference, such as an error code, shown under the title. Its\n// id joins the alert's `aria-describedby`, in document order with the text's.\n\nfunction AlertCodeRender<C extends ElementType = 'code'>(\n { children, className, component, id, ...rest }: AlertCodeProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'code'\n const generatedId = useId()\n const nodeRef = useAlertPart('description')\n const forkedRef = useForkedRef(ref, nodeRef)\n\n return (\n <Component\n className={classNames('alert-code', className)}\n id={id ?? generatedId}\n {...rest}\n ref={forkedRef}\n >\n {children}\n </Component>\n )\n}\n\nexport const AlertCode = createPolymorphicComponent<AlertCodeComponent>(\n AlertCodeRender as ForwardRefRenderFunction<Element, AlertCodeProps<ElementType>>,\n 'AlertCode'\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 AlertFooterOwnProps<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 an HTML element or a component.\n *\n * @default 'div'\n */\n component?: C\n /**\n * Stacks the actions as full-width rows on small screens, instead of sharing one row.\n */\n stacked?: boolean\n}\n\nexport type AlertFooterProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n AlertFooterOwnProps<C>\n>\n\ntype AlertFooterComponent = (<C extends ElementType = 'div'>(\n props: AlertFooterProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\n// `.alert-footer`: the actions. chassis-css lays them out right to left, so write the primary\n// action first. Give a separate destructive action `className=\"me-auto\"` to push it to the other\n// end.\n\nfunction AlertFooterRender<C extends ElementType = 'div'>(\n { children, className, component, stacked, ...rest }: AlertFooterProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n\n return (\n <Component className={classNames('alert-footer', { stacked }, className)} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const AlertFooter = createPolymorphicComponent<AlertFooterComponent>(\n AlertFooterRender as ForwardRefRenderFunction<Element, AlertFooterProps<ElementType>>,\n 'AlertFooter'\n)\n","import React, { forwardRef } from 'react'\nimport classNames from 'classnames'\n\nimport { ContextColor } from '../../types'\nimport { ICON_COLOR_CLASS_NAMES } from '../../utils/colorClassNames'\nimport { Icon, IconProps } from '../icon/Icon'\n\nexport type AlertIconProps = IconProps & {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Colors the icon with one of Chassis context colors, such as `danger` for a destructive\n * confirmation.\n */\n color?: ContextColor\n}\n\n// `.alert-icon`: an icon before the body. With it, chassis-css lays the alert out in two columns\n// from the `md` breakpoint up.\nexport const AlertIcon = forwardRef<HTMLSpanElement | SVGSVGElement, AlertIconProps>(\n ({ className, color, ...rest }, ref) => (\n <Icon\n className={classNames('alert-icon', color && ICON_COLOR_CLASS_NAMES[color], className)}\n {...rest}\n ref={ref}\n />\n )\n)\n\nAlertIcon.displayName = 'AlertIcon'\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement, useId } from 'react'\n\nimport { useForkedRef } from '../../hooks/useForkedRef'\nimport { useAlertPart } from './useAlertPart'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype AlertTextOwnProps<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 an HTML element or a component.\n *\n * @default 'p'\n */\n component?: C\n}\n\nexport type AlertTextProps<C extends ElementType = 'p'> = PolymorphicComponentProps<\n C,\n AlertTextOwnProps<C>\n>\n\ntype AlertTextComponent = (<C extends ElementType = 'p'>(\n props: AlertTextProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\n// The alert's message. Its id joins the alert's `aria-describedby`. chassis-css styles it as a\n// `<p>` inside `.alert-body`, with no class of its own.\n\nfunction AlertTextRender<C extends ElementType = 'p'>(\n { children, className, component, id, ...rest }: AlertTextProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'p'\n const generatedId = useId()\n const nodeRef = useAlertPart('description')\n const forkedRef = useForkedRef(ref, nodeRef)\n\n return (\n <Component className={className} id={id ?? generatedId} {...rest} ref={forkedRef}>\n {children}\n </Component>\n )\n}\n\nexport const AlertText = createPolymorphicComponent<AlertTextComponent>(\n AlertTextRender as ForwardRefRenderFunction<Element, AlertTextProps<ElementType>>,\n 'AlertText'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement, useId } from 'react'\nimport classNames from 'classnames'\n\nimport { useForkedRef } from '../../hooks/useForkedRef'\nimport { useAlertPart } from './useAlertPart'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype AlertTitleOwnProps<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 an HTML element or a component.\n *\n * @default 'h2'\n */\n component?: C\n}\n\nexport type AlertTitleProps<C extends ElementType = 'h2'> = PolymorphicComponentProps<\n C,\n AlertTitleOwnProps<C>\n>\n\ntype AlertTitleComponent = (<C extends ElementType = 'h2'>(\n props: AlertTitleProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\n// `.alert-title`: its id, whichever reaches the DOM, joins the alert's `aria-labelledby`.\n\nfunction AlertTitleRender<C extends ElementType = 'h2'>(\n { children, className, component, id, ...rest }: AlertTitleProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'h2'\n const generatedId = useId()\n const nodeRef = useAlertPart('title')\n const forkedRef = useForkedRef(ref, nodeRef)\n\n return (\n <Component\n className={classNames('alert-title', className)}\n id={id ?? generatedId}\n {...rest}\n ref={forkedRef}\n >\n {children}\n </Component>\n )\n}\n\nexport const AlertTitle = createPolymorphicComponent<AlertTitleComponent>(\n AlertTitleRender as ForwardRefRenderFunction<Element, AlertTitleProps<ElementType>>,\n 'AlertTitle'\n)\n"],"mappings":"A,wlBAuGA,MAAaU,EAAeC,EAAiC,CAC3D,UAAa,CAAC,EACd,qBAA0B,CAAC,CAC7B,CAAC,EAEYC,MAAwBC,EAAWH,CAAY,EAU/CI,EAAQC,GAEjB,CACE,mBAAoBC,EACpB,kBAAmBC,EACnB,WAAW,SACX,WACA,YACA,cACA,aACA,iBACA,UACA,WAAW,GACX,UACA,UACA,mBACA,WACA,YACA,SACA,UACA,kBACA,OACA,UACA,GAAGC,GAEL,IACG,CACH,GAAM,CACJ,QACA,YACA,sBACA,eACA,gBACA,oBACA,SACA,gBACEf,EAAiB,CACnB,WACA,iBACA,UACA,QAAS,GACT,WACA,UACA,UACA,mBACA,WACA,YACA,SACA,UACA,kBACA,OACA,MACA,SACF,CAAC,EAEK,CAACgB,EAAOC,GAAYC,EAAmE,CAAC,CAAC,EACzFC,EAAeC,GAAa,EAAqB,EAAmB,IAAe,CACvF,IAAMC,EAAO,CAAE,KAAI,OAAM,MAAK,EAE9B,OADAJ,EAAU,GAAY,CAAC,GAAGK,EAASD,CAAI,CAAC,MAC3BJ,EAAU,GAAYK,EAAQ,OAAQ,GAAUC,IAAUF,CAAI,CAAC,CAC9E,EAAG,CAAC,CAAC,EAECG,EAAS,GACbR,EACG,OAAQ,GAASK,EAAK,OAASI,CAAI,CAAC,CACpC,MAAM,EAAG,IACRC,EAAE,KAAK,wBAAwBC,EAAE,IAAI,EAAI,KAAK,4BAA8B,GAAK,CACnF,CAAC,CACA,KA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AAW,KAAI,GAAGlD,GACzC,EACA,CACA,IAAM6B,EAAYC,GAAa,IACzBW,EAAcC,EAAM,EACpBN,EAAUD,EAAa,aAAa,EACpCZ,EAAYoB,EAAaC,EAAKR,CAAO,EAE3C,MACE,kBAAA,cAACP,EAAD,CAAsB,YAAW,GAAIhB,GAAM4B,EAAa,GAAIzC,EAAM,IAAKuB,CAE5D,EADRC,CACQ,CAEf,CAEA,MAAa2B,EAAYpE,EACvBmE,EACA,WACF,ECnBA,SAASE,EACP,CAAE,WAAU,YAAW,YAAW,KAAI,GAAGpD,GACzC,EACA,CACA,IAAM6B,EAAYC,GAAa,KACzBW,EAAcC,EAAM,EACpBN,EAAUD,EAAa,OAAO,EAC9BZ,EAAYoB,EAAaC,EAAKR,CAAO,EAE3C,MACE,kBAAA,cAACP,EAAD,CACE,UAAWtC,EAAW,cAAe2B,CAAS,EAC9C,GAAIL,GAAM4B,EACV,GAAIzC,EACJ,IAAKuB,CAGI,EADRC,CACQ,CAEf,CAEA,MAAa6B,EAAatE,EACxBqE,EACA,YACF,E"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./focus-ring-Bs80iIBN.js";import{t as e}from"./useForkedRef-WoqMqsWE.js";import{t}from"./useControllableState-CPUJxfKW.js";import{i as n,r,s as ee,t as te}from"./overlayPlacement-D2vfhhg3.js";import{t as ne}from"./useFormField-q21MOgh8.js";import{t as re}from"./useFormReset-BK5Yb24_.js";import{t as ie}from"./useOverlayMaxHeight-5UnurH0W.js";import{t as ae}from"./useRequiredValueInput-CL7AIgqz.js";import{a as oe,i as se,n as ce,r as le,t as ue}from"./ComboboxListBox-Db0rSM3w.js";import{t as de}from"./Portal-BTDylxAi.js";import{t as fe}from"./renderFormField-CaZ8-xrn.js";import i,{forwardRef as a,useEffect as o,useMemo as s,useRef as c,useState as pe}from"react";import l from"classnames";import{mergeProps as u,useButton as d,useComboBox as f,useFilter as p,useOverlayPosition as me}from"react-aria";import{useComboBoxState as he}from"react-stately";const m=e=>null;m.displayName=`AutocompleteGroup`;const h=e=>null;h.displayName=`AutocompleteItem`;const g=e=>e==null?[]:Array.isArray(e)?e:[e],_=(e,t)=>{if(e!==void 0)return t?g(e):Array.isArray(e)?e[0]??null:e},ge=(e,t)=>{let n=g(e),r=g(t);return n.length===r.length&&n.every((e,t)=>e===r[t])},_e=e=>`${e} selected`,v=a(function({children:a,className:v,defaultValue:y,disabled:b,help:x,id:ve,invalid:S,invalidFeedback:C,items:w,label:T,multiple:E=!1,name:D,noResultsText:ye=`No results found`,onChange:be,placeholder:xe,required:O,searchPlaceholder:k,selectedText:A=_e,size:j,valid:M,validFeedback:N,value:P,...F},Se){let I=s(()=>w?le(w):ce(a,{Group:m,Item:h}),[w,a]),Ce=s(()=>oe(I),[I]),{contains:we}=p({sensitivity:`base`}),[L,R]=t(_(P,E),_(y,E)??(E?[]:null),be),[Te,z]=pe(``),B=he({children:se,defaultItems:I,disabledKeys:Ce,defaultFilter:we,selectionMode:E?`multiple`:`single`,value:L,onChange:e=>{let t=g(e),n=E?t:t[0]??null;z(``),ge(n,L)||R(n)},inputValue:Te,onInputChange:z,onOpenChange:e=>{e||z(``)},allowsEmptyCollection:!0,menuTrigger:`manual`}),V=c(null),Ee=e(Se,V),H=c(null),U=c(null),W=c(null),G=c(null);re(V,_(P,E)??_(y,E)??(E?[]:null),R);let K=g(B.value),{inputProps:q,missing:De,valid:J}=ae(G,{focus:()=>V.current?.focus(),invalid:S,required:O&&(!E||K.length===0),valid:M}),Y=S||De,{describedBy:Oe,feedbackId:ke,helpId:Ae,inputId:je,labelId:Me,labelledBy:X}=ne({ariaDescribedBy:F[`aria-describedby`],ariaLabelledBy:F[`aria-labelledby`],help:x,id:ve,invalid:Y,invalidFeedback:C,label:T,valid:J,validFeedback:N}),{buttonProps:Ne,inputProps:Pe,listBoxProps:Fe}=f({"aria-label":F[`aria-label`],"aria-labelledby":X,buttonRef:V,id:je,inputRef:H,listBoxRef:U,popoverRef:W,isDisabled:b,isRequired:O,placeholder:k},B),{buttonProps:Z}=d({...Ne,elementType:`div`,isDisabled:b,excludeFromTabOrder:!1},V),Q=c(B.isOpen);o(()=>{if(B.isOpen&&!Q.current)H.current?.focus();else if(!B.isOpen&&Q.current){let e=document.activeElement;(!e||e===document.body||W.current?.contains(e))&&V.current?.focus()}Q.current=B.isOpen},[B.isOpen]),o(()=>{if(!B.isOpen)return;let e=V.current;for(;e&&e!==document.body;)e.removeAttribute(`aria-hidden`),e=e.parentElement},[B.isOpen]);let{overlayProps:Ie,placement:Le}=me({targetRef:V,overlayRef:W,placement:n(`bottom-start`),offset:2,isOpen:B.isOpen,onClose:null});ie(W,B.isOpen);let Re=ee({close:B.close,isOpen:B.isOpen,triggerRef:V}),{menuStyle:ze,placementAttr:Be}=r(Ie.style,`bottom-start`,Le),Ve={...te,...ze},He=e=>B.selectionManager.toggleSelection(e),Ue=u(Pe,{onKeyDown:e=>{if(!E||e.key!==`Backspace`||e.currentTarget.value!==``)return;let t=B.selectedItems[B.selectedItems.length-1];t&&He(t.key)}}),$=B.selectedItems.length>0,We=$?B.selectedItems.length===1?B.selectedItems[0]?.textValue??``:A(B.selectedItems.length):xe;return fe({children:/* @__PURE__ */ i.createElement(i.Fragment,null,/* @__PURE__ */ i.createElement(`div`,{className:l(`form-input`,`combobox`,{sm:j===`sm`,lg:j===`lg`,disabled:b},{"is-invalid":Y,"is-valid":J},v),...u(F,Z),tabIndex:Z.tabIndex,"aria-label":F[`aria-label`],"aria-labelledby":X,"aria-describedby":Oe,"aria-invalid":Y||void 0,ref:Ee},/* @__PURE__ */ i.createElement(`span`,{className:l(`combobox-value`,{"combobox-placeholder":!$})},We)),/* @__PURE__ */ i.createElement(de,{container:Re},/* @__PURE__ */ i.createElement(`div`,{className:l(`menu`,{show:B.isOpen}),"data-cx-placement":Be,style:Ve,hidden:!B.isOpen,ref:W},/* @__PURE__ */ i.createElement(`div`,{className:`combobox-search`},/* @__PURE__ */ i.createElement(`input`,{autoComplete:`off`,className:`form-input combobox-search-input sm`,...Ue,ref:H})),/* @__PURE__ */ i.createElement(ue,{state:B,listBoxProps:Fe,listBoxRef:U}),B.collection.size===0&&/* @__PURE__ */ i.createElement(`div`,{className:`combobox-no-results`},ye))),E?/* @__PURE__ */ i.createElement(i.Fragment,null,D&&K.map(e=>/* @__PURE__ */ i.createElement(`input`,{key:e,type:`hidden`,name:D,value:e,disabled:b})),q&&/* @__PURE__ */ i.createElement(`input`,{disabled:b,value:``,...q,ref:G})):(D||O)&&/* @__PURE__ */ i.createElement(`input`,{type:`hidden`,name:D,value:K[0]??``,disabled:b,...q,ref:G})),help:x,ids:{feedback:ke,help:Ae,label:Me},invalid:Y,invalidFeedback:C,label:T,valid:J,validFeedback:N})});v.displayName=`Autocomplete`;export{h as n,m as r,v as t};
|
|
2
|
+
//# sourceMappingURL=autocomplete-wjDWeWDh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autocomplete-wjDWeWDh.js","names":["useForkedRef","toAriaPlacement","useFloatingOverlay","COMBOBOX_MENU_OVERLAY_STYLE","useFormField","useFormReset","useOverlayMaxHeight","useRequiredValueInput","getDisabledKeys","comboboxCollectionChildren","buildEntriesFromChildren","buildEntriesFromItemsDef","ComboboxListBox","Portal","renderFormField","React","classNames","AutocompleteGroup","AutocompleteItem","asKeyArray","value","toModeValue","multiple","isSameSelection","left","a","right","b","key","index","defaultSelectedText","count","Autocomplete","forwardRef","validProp","rest","entries","useMemo","items","children","disabledKeys","useFilter","selection","setSelection","useControllableState","defaultValue","onChange","query","setQuery","useState","state","useComboBoxState","contains","keyArray","keys","next","isOpen","triggerRef","useRef","forkedTriggerRef","ref","inputRef","listBoxRef","popoverRef","valueInputRef","selectedKeys","requiredInputProps","required","showInvalid","invalid","missing","useComboBox","labelledBy","inputId","disabled","searchPlaceholder","triggerButtonProps","useButton","buttonProps","wasOpen","useEffect","active","node","resolvedPlacement","useOverlayPosition","portalContainer","resolveMenuOverlayPositioning","overlayProps","overlayStyle","menuStyle","removeSelected","inputHtmlProps","mergeProps","inputProps","event","last","hasSelection","triggerText","selectedText","placeholder","size","valid","className","describedBy","placementAttr","noResultsText","name","feedbackId","helpId","labelId"],"sources":["../../src/components/autocomplete/AutocompleteGroup.tsx","../../src/components/autocomplete/AutocompleteItem.tsx","../../src/components/autocomplete/Autocomplete.tsx"],"sourcesContent":["import { ComboboxGroupProps } from '../combobox/ComboboxGroup'\n\n// Same shape as `ComboboxGroupProps` — see `AutocompleteItemProps` for why this is its own\n// named type instead of a re-export.\nexport type AutocompleteGroupProps = ComboboxGroupProps\n\n// `AutocompleteGroup` is never actually mounted — like `ComboboxGroup`, it's read as data by\n// `Autocomplete`, which splits its top-level children into groups (wrapping react-stately\n// `Section` nodes) and bare items. Groups and bare items can be mixed at the top level:\n//\n// <Autocomplete aria-label=\"Language\">\n// <AutocompleteGroup label=\"Frontend\">\n// <AutocompleteItem id=\"html\">HTML</AutocompleteItem>\n// <AutocompleteItem id=\"css\">CSS</AutocompleteItem>\n// </AutocompleteGroup>\n// <AutocompleteItem id=\"python\">Python</AutocompleteItem>\n// </Autocomplete>\nexport const AutocompleteGroup = (_props: AutocompleteGroupProps): null => null\n\nAutocompleteGroup.displayName = 'AutocompleteGroup'\n","import { ComboboxItemProps } from '../combobox/ComboboxItem'\n\n// Same shape as `ComboboxItemProps` — kept as its own named type (rather than re-exporting\n// `ComboboxItemProps` directly) so `Autocomplete`'s public API doesn't leak an unrelated\n// component's prop type, even though the two are structurally identical under the hood.\nexport type AutocompleteItemProps = ComboboxItemProps\n\n// `AutocompleteItem` is never actually mounted — like `ComboboxItem`, it's read as data by\n// `Autocomplete`, which builds react-aria's listbox collection from each item's `id` and\n// `children`. This keeps the public authoring shape as plain composed JSX:\n//\n// <Autocomplete aria-label=\"Fruit\">\n// <AutocompleteItem id=\"apple\">Apple</AutocompleteItem>\n// <AutocompleteItem id=\"banana\">Banana</AutocompleteItem>\n// </Autocomplete>\nexport const AutocompleteItem = (_props: AutocompleteItemProps): null => null\n\nAutocompleteItem.displayName = 'AutocompleteItem'\n","import React, {\n forwardRef,\n HTMLAttributes,\n InputHTMLAttributes,\n ReactNode,\n useEffect,\n useMemo,\n useRef,\n useState\n} from 'react'\nimport classNames from 'classnames'\nimport { mergeProps, useButton, useComboBox, useFilter, useOverlayPosition } from 'react-aria'\nimport { Key, useComboBoxState } from 'react-stately'\n\nimport {\n useControllableState,\n useFloatingOverlay,\n useForkedRef,\n useFormField,\n useOverlayMaxHeight,\n useFormReset,\n useRequiredValueInput\n} from '../../hooks'\nimport {\n buildEntriesFromChildren,\n buildEntriesFromItemsDef,\n ComboboxEntry,\n comboboxCollectionChildren,\n getDisabledKeys\n} from '../combobox/comboboxCollection'\nimport {\n COMBOBOX_MENU_OVERLAY_STYLE,\n resolveMenuOverlayPositioning,\n toAriaPlacement\n} from '../../utils/overlayPlacement'\nimport { Portal } from '../portal/Portal'\nimport { ComboboxListBox } from '../combobox/ComboboxListBox'\nimport { renderFormField } from '../form-field/renderFormField'\nimport { MenuItemsDef } from '../menu/MenuItemDef'\nimport { AutocompleteGroup } from './AutocompleteGroup'\nimport { AutocompleteItem } from './AutocompleteItem'\n\n// `useComboBoxState`/`useComboBox` are generic over a `SelectionMode` ('single' | 'multiple')\n// that only affects *types* — actual runtime behavior (whether a selection closes the menu,\n// disallows an empty selection, *and* whether `state.value`/`onChange`'s callback argument come\n// through as a bare `Key` or a `Key[]`) is driven entirely by the `selectionMode` *string* passed\n// at the call site below, not by this type parameter. Fixing the parameter at `'multiple'` here\n// (the more permissive of the two shapes) lets one component serve both modes without a full\n// code fork, but it means the type system's claim that `state.value`/`onChange`'s argument are\n// always `Key[]` is untrustworthy for single-select at runtime — confirmed by testing (the\n// naive `keys[0]` on a bare string key silently returned its first *character*). `asKeyArray`\n// normalizes either shape; every read of `state.value` or `onChange`'s argument goes through it.\nconst asKeyArray = (value: unknown): Key[] => {\n if (value == null) return []\n return Array.isArray(value) ? value : [value as Key]\n}\n\n// The selection in the shape of the mode: `Key[]` with `multiple`, else a `Key` or `null`, which\n// react-stately reads as \"nothing selected\" and keeps controlled. `undefined` stays `undefined`\n// (an uncontrolled `value`).\nconst toModeValue = (\n value: Key | Key[] | null | undefined,\n multiple: boolean\n): Key | Key[] | null | undefined => {\n if (value === undefined) return undefined\n if (multiple) return asKeyArray(value)\n return Array.isArray(value) ? (value[0] ?? null) : value\n}\n\nconst isSameSelection = (a: Key | Key[] | null, b: Key | Key[] | null) => {\n const left = asKeyArray(a)\n const right = asKeyArray(b)\n return left.length === right.length && left.every((key, index) => key === right[index])\n}\n\nconst defaultSelectedText = (count: number) => `${count} selected`\n\nexport interface AutocompleteProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'defaultValue'\n> {\n /**\n * An accessible label for the autocomplete, used when there's no visible `<label>`.\n */\n 'aria-label'?: string\n /**\n * Identifies a visible `<label>` element for the autocomplete.\n */\n 'aria-labelledby'?: string\n /**\n * `AutocompleteItem` elements, optionally wrapped in `AutocompleteGroup` — read as data by\n * `Autocomplete` to build the option list. Not rendered directly. Ignored when `items` is set.\n */\n children?: ReactNode\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * The initial selected option's id(s) (uncontrolled). An array when `multiple` is set.\n */\n defaultValue?: Key | Key[] | null\n /**\n * Prevents the autocomplete from being focused or interacted with.\n */\n disabled?: boolean\n /**\n * A description for the field, rendered below the autocomplete.\n */\n help?: ReactNode\n /**\n * `id` forwarded to the search input inside the popover. The toggle — the field's real,\n * always-focusable surface — has no single labelable element `<label for>` can target (it's a\n * `role=\"button\"` `<div>`, and the search input itself is hidden until open), so `label` is\n * associated via `aria-labelledby` on the toggle instead. See FORMS.md's \"role=group\" pattern.\n */\n id?: string\n /**\n * Set component validation state to invalid.\n */\n invalid?: boolean\n /**\n * An error message for the field, rendered below the autocomplete when `invalid` is set, and\n * after a submit that a `required` autocomplete with nothing selected held back.\n */\n invalidFeedback?: ReactNode\n /**\n * Array of item/header/divider definitions for data-driven rendering. When provided, children\n * are ignored. A `'header'` entry starts a group that all following items join until the next\n * header or the end of the array. `'divider'` entries are a no-op here — use\n * `AutocompleteGroup` composition instead if you need finer control over grouping. An entry's\n * `href`/`onClick` are `Menu`-only and are not read here — use `onChange` to react to the\n * selection instead.\n */\n items?: MenuItemsDef\n /**\n * The field's caption, rendered as a `FormLabel` associated with the toggle.\n */\n label?: ReactNode\n /**\n * Allows more than one option to be selected. The toggle shows the single selection's label,\n * or an \"N selected\" count once more than one is picked. The menu stays open after each\n * selection, and `Backspace` in the empty search field removes the last selected option.\n */\n multiple?: boolean\n /**\n * `name` of auto-created hidden input(s), kept in sync with the selection, for native form\n * submission. Single-select renders one; `multiple` renders one per selected key. Omit to skip\n * hidden-input creation.\n */\n name?: string\n /**\n * Text shown in the listbox when no options match the current query.\n */\n noResultsText?: ReactNode\n /**\n * Callback fired when the selection changes. Receives an array of keys when `multiple` is set.\n */\n onChange?: (value: Key | Key[] | null) => void\n /**\n * Text shown on the toggle when nothing is selected.\n */\n placeholder?: string\n /**\n * Toggle the required state for the component. A required autocomplete with nothing selected\n * holds its form back from submitting, takes focus on its toggle and shows as invalid, with\n * `invalidFeedback`, until an option is selected or the form is reset. `invalid`, once set, and\n * `valid` decide how it looks instead.\n */\n required?: boolean\n /**\n * Placeholder for the search field inside the dropdown.\n */\n searchPlaceholder?: string\n /**\n * Text the toggle of a `multiple` autocomplete shows once more than one option is selected,\n * from the count. A function, so a translation can choose its plural form. Defaults to\n * `` (count) => `${count} selected` ``.\n */\n selectedText?: (count: number) => ReactNode\n /**\n * Size the component sm or lg.\n */\n size?: 'sm' | 'lg'\n /**\n * Set component validation state to valid.\n */\n valid?: boolean\n /**\n * A success message for the field, rendered below the autocomplete when `valid` is set.\n */\n validFeedback?: ReactNode\n /**\n * The selected option's id(s) (controlled). An array when `multiple` is set.\n */\n value?: Key | Key[] | null\n}\n\n// `Autocomplete` implements chassis-css's button-trigger combobox — a display-only toggle\n// (not a text input) that opens a `.menu` containing its own search field, matching\n// https://chassis-ui.com/css/docs/forms/combobox/#search-field. This is deliberately NOT the\n// same composition as `Combobox` (whose text input *is* the trigger): here, react-aria's\n// `useComboBox` is given a separate `buttonRef` — a first-class option the hook supports\n// specifically for this \"button opens a listbox with its own input\" shape — so the real\n// `role=\"combobox\"` input lives inside the popover (styled as `.combobox-search-input`) while a\n// toggle serves as the always-visible, always-focusable trigger. The toggle is a `<div\n// role=\"button\">` (via `useButton`'s `elementType: 'div'`, the same pattern `Button.tsx` uses\n// for a non-native trigger) rather than a real `<button>` — an earlier version rendered\n// removable chips inside it for `multiple` mode, which a real (or ARIA) button can't legally\n// contain per axe's `nested-interactive` check; that's now plain \"N selected\" text instead (see\n// `triggerText` below), but the `<div>` stays since reverting buys little and this is proven.\n// `useComboBox`'s own `buttonProps` also sets `excludeFromTabOrder: true` by default — correct\n// for its usual \"auxiliary button beside an always-visible input\" composition, wrong here since\n// the toggle is the *only* focusable surface before opening; overridden back to reachable below.\n// The ref goes to the toggle, the `.combobox` element, as `Combobox`'s goes to its own.\nexport const Autocomplete = forwardRef<HTMLDivElement, AutocompleteProps>(function Autocomplete(\n {\n children,\n className,\n defaultValue,\n disabled,\n help,\n id,\n invalid,\n invalidFeedback,\n items,\n label,\n multiple = false,\n name,\n noResultsText = 'No results found',\n onChange,\n placeholder,\n required,\n searchPlaceholder,\n selectedText = defaultSelectedText,\n size,\n valid: validProp,\n validFeedback,\n value,\n ...rest\n },\n ref\n) {\n // `entries`/`disabledKeys` only need to change when the data driving them does — without this,\n // both re-derive from scratch on every render, including every keystroke while typing.\n const entries = useMemo(\n () =>\n items\n ? buildEntriesFromItemsDef(items)\n : buildEntriesFromChildren(children, { Group: AutocompleteGroup, Item: AutocompleteItem }),\n [items, children]\n )\n const disabledKeys = useMemo(() => getDisabledKeys(entries), [entries])\n\n // Case- and accent-insensitive substring matching, mirroring chassis-css's own\n // always-case-insensitive combobox.js filtering.\n const { contains } = useFilter({ sensitivity: 'base' })\n\n // The selection is held here and always given to react-stately as controlled, and so is the\n // text of the search field. react-stately's combobox treats the text as the selection's: it\n // writes the selected option's label into the field, and an emptied field clears an\n // uncontrolled selection. Here the field is a query only. It starts empty each time the list\n // opens and filters the list, and nothing typed in it, or taken out, changes the selection.\n const [selection, setSelection] = useControllableState<Key | Key[] | null>(\n toModeValue(value, multiple),\n toModeValue(defaultValue, multiple) ?? (multiple ? [] : null),\n onChange\n )\n const [query, setQuery] = useState('')\n\n const state = useComboBoxState<ComboboxEntry, 'multiple'>({\n children: comboboxCollectionChildren,\n defaultItems: entries,\n disabledKeys,\n defaultFilter: contains,\n // Cast: the actual runtime string ('single' or 'multiple') is what drives behavior — see the\n // `asKeyArray` comment above for why the *type* parameter above is fixed at 'multiple'.\n selectionMode: (multiple ? 'multiple' : 'single') as 'multiple',\n value: selection as Key[],\n // With both controlled, react-stately reports the selection again when the search field\n // blurs, or Enter picks the selected option: only a change is passed on.\n onChange: (keys) => {\n const keyArray = asKeyArray(keys)\n const next = multiple ? keyArray : (keyArray[0] ?? null)\n setQuery('')\n if (!isSameSelection(next, selection)) setSelection(next)\n },\n inputValue: query,\n onInputChange: setQuery,\n onOpenChange: (isOpen) => {\n if (!isOpen) setQuery('')\n },\n allowsEmptyCollection: true,\n // Opening is driven only by the toggle (see `buttonProps` below) — there's no input to focus\n // or type into until the panel is already open, so 'input'/'focus' triggers (the hook's\n // defaults, meant for `Combobox`'s text-input trigger) don't apply here.\n menuTrigger: 'manual'\n })\n\n const triggerRef = useRef<HTMLDivElement>(null)\n const forkedTriggerRef = useForkedRef(ref, triggerRef)\n const inputRef = useRef<HTMLInputElement>(null)\n const listBoxRef = useRef<HTMLElement>(null)\n const popoverRef = useRef<HTMLDivElement>(null)\n const valueInputRef = useRef<HTMLInputElement>(null)\n\n // A reset of the form puts the selection back to its first value, controlled or not, as the\n // text fields go back to theirs.\n useFormReset(\n triggerRef,\n toModeValue(value, multiple) ?? toModeValue(defaultValue, multiple) ?? (multiple ? [] : null),\n setSelection\n )\n\n // What is submitted under `name`: a key that isn't in the list is still a value.\n const selectedKeys = asKeyArray(state.value)\n\n // `required` has to reach an input a form validates (FORMS.md, gotcha 9). The toggle is no form\n // control, the search input holds a query and not the value, and the input that carries the\n // value is `type=\"hidden\"`, which a form doesn't validate. As in `TimeField`, a required\n // autocomplete's value input is a text input that isn't displayed, and `missing` shows the\n // field as invalid from a submit that input held back until an option is selected. The toggle\n // takes the focus a browser would give an input it displays. With `multiple` each key has a\n // hidden input of its own and none while nothing is selected: the text input is then rendered\n // alone, with no `name`, as nothing is submitted for an empty selection. A disabled input isn't\n // validated; the field has no read-only state to leave out.\n const {\n inputProps: requiredInputProps,\n missing,\n valid\n } = useRequiredValueInput(valueInputRef, {\n focus: () => triggerRef.current?.focus(),\n invalid,\n required: required && (!multiple || selectedKeys.length === 0),\n valid: validProp\n })\n const showInvalid = invalid || missing\n\n const { describedBy, feedbackId, helpId, inputId, labelId, labelledBy } = useFormField({\n ariaDescribedBy: rest['aria-describedby'],\n ariaLabelledBy: rest['aria-labelledby'],\n help,\n id,\n invalid: showInvalid,\n invalidFeedback,\n label,\n valid,\n validFeedback\n })\n\n const { buttonProps, inputProps, listBoxProps } = useComboBox<ComboboxEntry, 'multiple'>(\n {\n 'aria-label': rest['aria-label'],\n 'aria-labelledby': labelledBy,\n buttonRef: triggerRef,\n id: inputId,\n inputRef,\n listBoxRef,\n popoverRef,\n isDisabled: disabled,\n // `aria-required` on the search input, the `combobox` of this field. The toggle states\n // nothing: ARIA doesn't allow the attribute on a button.\n isRequired: required,\n placeholder: searchPlaceholder\n },\n state\n )\n\n // `useComboBox`'s own `buttonProps` sets `excludeFromTabOrder: true` — correct for its\n // intended composition (an auxiliary icon button *next to* an already-focusable, always-\n // visible input, e.g. a date picker's calendar-icon trigger), where the input is expected to\n // be the primary tab stop. That doesn't hold here: the input lives inside the popover, `hidden`\n // (and so untabbable) until opened, and this toggle is the *only* focusable surface before\n // that — leaving `excludeFromTabOrder` in place would make the whole control unreachable by\n // keyboard. Overriding it back to `false` is what actually makes the toggle the tab stop.\n const { buttonProps: triggerButtonProps } = useButton(\n { ...buttonProps, elementType: 'div', isDisabled: disabled, excludeFromTabOrder: false },\n triggerRef\n )\n\n // The search field autofocuses once the panel is actually open (chassis-css docs: \"When the\n // menu opens, focus jumps to the search field\"), and focus returns to the toggle once it\n // closes — `useComboBox` only knows about `inputRef` as its focus target, and that input is\n // `hidden` (via the panel) while closed, so without this, closing (via Escape, selection, or\n // outside click) would drop focus entirely instead of landing back on the toggle.\n // Only focus that the closing would lose is restored: still inside the panel, which is hidden\n // now, or already dropped to the body. Focus the user moved to another field, by Tab or a\n // press there, stays where they put it.\n const wasOpen = useRef(state.isOpen)\n useEffect(() => {\n if (state.isOpen && !wasOpen.current) {\n inputRef.current?.focus()\n } else if (!state.isOpen && wasOpen.current) {\n const active = document.activeElement\n const lost = !active || active === document.body || popoverRef.current?.contains(active)\n if (lost) triggerRef.current?.focus()\n }\n wasOpen.current = state.isOpen\n }, [state.isOpen])\n\n // `useComboBox` also runs react-aria's `ariaHideOutside` while open, to keep background\n // content out of screen readers' way — but it only knows to protect `inputRef`/`popoverRef`\n // (the elements it was given), not this separate toggle, so the toggle (and, in `multiple`\n // mode, its chips and their focusable remove buttons) would otherwise get `aria-hidden`\n // applied to it too while the panel is open. Walking up to `document.body` (rather than\n // clearing just `triggerRef.current` itself) matters now that the popover portals there too\n // (see `useFloatingOverlay` below): `ariaHideOutside` hides the *first* ancestor level whose\n // subtree contains no protected element, which — once the toggle and the popover no longer\n // share a common non-`body` container — can land on one of the toggle's own ancestors instead\n // of the toggle element itself. `ariaHideOutside`'s own doc comment says it watches for *new*\n // elements to hide, not attribute changes on existing ones, so removing it here (in an effect\n // that necessarily runs after react-aria's own — declared later in this same component)\n // doesn't get silently re-applied.\n useEffect(() => {\n if (!state.isOpen) return\n let node: HTMLElement | null = triggerRef.current\n while (node && node !== document.body) {\n node.removeAttribute('aria-hidden')\n node = node.parentElement\n }\n }, [state.isOpen])\n\n const { overlayProps, placement: resolvedPlacement } = useOverlayPosition({\n targetRef: triggerRef,\n overlayRef: popoverRef,\n placement: toAriaPlacement('bottom-start'),\n offset: 2,\n isOpen: state.isOpen,\n // Leaving `onClose` unset (`undefined`) doesn't actually disable react-aria's close-on-scroll\n // listener — only an explicit `null` does (`useCloseOnScroll` only early-returns on\n // `onClose === null`, not falsy). It happens to be a no-op today only because this toggle is\n // never registered in react-aria's `useOverlayTrigger`/`onCloseMap` backward-compat map (this\n // component calls `useComboBox`, not `useOverlayTrigger`) — an incidental, not guaranteed,\n // safety net. Passing `null` here makes the opt-out explicit, matching `Menu`/`Popover`.\n onClose: null\n })\n useOverlayMaxHeight(popoverRef, state.isOpen)\n\n // Portals the panel to `document.body` (or an enclosing open `<dialog>`) instead of rendering\n // it inline, matching `Popover`/`Tooltip`/`Combobox` — an inline-rendered panel gets clipped by\n // any ancestor with `overflow: hidden`/`auto` (a `ModalBody`, a scrollable card, a table cell),\n // and `Autocomplete` is commonly composed inside exactly those. See\n // `COMBOBOX_MENU_OVERLAY_STYLE` for the styling this trades away by leaving the DOM position\n // `.combobox + .menu` relies on.\n const portalContainer = useFloatingOverlay({\n close: state.close,\n isOpen: state.isOpen,\n triggerRef\n })\n\n const { menuStyle, placementAttr } = resolveMenuOverlayPositioning(\n overlayProps.style,\n 'bottom-start',\n resolvedPlacement\n )\n const overlayStyle: React.CSSProperties = { ...COMBOBOX_MENU_OVERLAY_STYLE, ...menuStyle }\n\n const removeSelected = (key: Key) => state.selectionManager.toggleSelection(key)\n\n // Backspace-removes-last-chip only touches the search field's own keydown handling — no\n // nested interactive element needed for it, unlike a rendered \"remove\" button would be (see\n // the trigger's `combobox-value` text below for why that path was dropped).\n const handleSearchKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (!multiple || event.key !== 'Backspace' || event.currentTarget.value !== '') return\n const last = state.selectedItems[state.selectedItems.length - 1]\n if (last) removeSelected(last.key)\n }\n\n const inputHtmlProps = mergeProps(inputProps, {\n onKeyDown: handleSearchKeyDown\n }) as InputHTMLAttributes<HTMLInputElement>\n\n const hasSelection = state.selectedItems.length > 0\n // Matches chassis-css's own vanilla multi-select combobox: the toggle shows the single\n // selected item's label, or \"N selected\" once more than one is picked — deliberately plain\n // text, not per-item chips with their own remove buttons. An earlier version rendered chips\n // here; that failed a real axe check (\"Interactive controls must not be nested\") because the\n // toggle is itself `role=\"button\"`, and a button can't correctly contain other focusable\n // controls. Deselecting an option is still possible by clicking it again in the open list\n // (native to `useComboBoxState`'s multiple-selection toggle behavior) or via Backspace in the\n // search field, just not from the toggle itself.\n const triggerText = !hasSelection\n ? placeholder\n : state.selectedItems.length === 1\n ? (state.selectedItems[0]?.textValue ?? '')\n : selectedText(state.selectedItems.length)\n\n return renderFormField({\n children: (\n <>\n <div\n className={classNames(\n 'form-input',\n 'combobox',\n { sm: size === 'sm', lg: size === 'lg', disabled },\n { 'is-invalid': showInvalid, 'is-valid': valid },\n className\n )}\n // `mergeProps`, so the caller's `onClick`, `onKeyDown` and `onFocus` run beside the\n // toggle's own instead of being replaced by them. It also lets a caller's value through\n // where the toggle's is `undefined`, which `tabIndex` is while disabled: set again.\n {...mergeProps(rest, triggerButtonProps)}\n tabIndex={triggerButtonProps.tabIndex}\n // `useComboBox`'s own `buttonProps` defaults to a generic \"Show suggestions\" label,\n // since its primary a11y attention goes to the search input — override with the same\n // label the input gets, so the toggle (the element actually reachable via Tab, since\n // the input is hidden until open) announces the field's real name, matching the\n // vanilla docs' own `aria-label=\"Select a country\"` on the toggle button.\n aria-label={rest['aria-label']}\n aria-labelledby={labelledBy}\n aria-describedby={describedBy}\n aria-invalid={showInvalid || undefined}\n ref={forkedTriggerRef}\n >\n <span className={classNames('combobox-value', { 'combobox-placeholder': !hasSelection })}>\n {triggerText}\n </span>\n </div>\n <Portal container={portalContainer}>\n <div\n className={classNames('menu', { show: state.isOpen })}\n data-cx-placement={placementAttr}\n style={overlayStyle}\n hidden={!state.isOpen}\n ref={popoverRef}\n >\n <div className=\"combobox-search\">\n <input\n autoComplete=\"off\"\n className=\"form-input combobox-search-input sm\"\n {...inputHtmlProps}\n ref={inputRef}\n />\n </div>\n <ComboboxListBox state={state} listBoxProps={listBoxProps} listBoxRef={listBoxRef} />\n {state.collection.size === 0 && (\n <div className=\"combobox-no-results\">{noResultsText}</div>\n )}\n </div>\n </Portal>\n {multiple ? (\n <>\n {name &&\n selectedKeys.map((key) => (\n <input key={key} type=\"hidden\" name={name} value={key} disabled={disabled} />\n ))}\n {requiredInputProps && (\n <input disabled={disabled} value=\"\" {...requiredInputProps} ref={valueInputRef} />\n )}\n </>\n ) : (\n (name || required) && (\n <input\n type=\"hidden\"\n name={name}\n value={selectedKeys[0] ?? ''}\n disabled={disabled}\n {...requiredInputProps}\n ref={valueInputRef}\n />\n )\n )}\n </>\n ),\n help,\n // No `input` id: the toggle is a `role=\"button\"` `<div>`, not a labelable element, so\n // `htmlFor` can't target it — `aria-labelledby={labelledBy}` on the toggle above (fed by\n // `labelId`) is what actually associates the label, matching DatePicker/OtpInput's\n // `role=\"group\"` pattern in FORMS.md. Passing `inputId` here would point `<label for>` at\n // the hidden search input instead, which sits inert until the popover opens.\n ids: { feedback: feedbackId, help: helpId, label: labelId },\n invalid: showInvalid,\n invalidFeedback,\n label,\n valid,\n validFeedback\n })\n})\n\nAutocomplete.displayName = 'Autocomplete'\n"],"mappings":"A,g2BAiBA,MAAaiB,EAAqB,GAAyC,KAE3E,EAAkB,YAAc,oBCJhC,MAAaC,EAAoB,GAAwC,KAEzE,EAAiB,YAAc,mBCmC/B,MAAMC,EAAc,GACdC,GAAS,KAAa,CAAC,EACpB,MAAM,QAAQA,CAAK,EAAIA,EAAQ,CAACA,CAAY,EAM/CC,GACJ,EACA,IACmC,CACnC,GAAID,IAAU,IAAA,GAEd,OADIE,EAAiBH,EAAWC,CAAK,EAC9B,MAAM,QAAQA,CAAK,EAAKA,EAAM,IAAM,KAAQA,CACrD,EAEMG,IAAmB,EAAuB,IAA0B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CAAA,CAGL,EAEJ,OAMA,IAAK,CAAE,SAAU2C,GAAY,KAAMC,GAAQ,MAAOC,EAAQ,EAC1D,QAASzC,EACT,kBACA,QACA,QACA,eACF,CAAC,CACH,CAAC,EAED,EAAa,YAAc,e"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./focus-ring-Bs80iIBN.js";import{f as e,m as t,p as n,v as r}from"./slot-
|
|
2
|
-
//# sourceMappingURL=avatar-
|
|
1
|
+
import"./focus-ring-Bs80iIBN.js";import{f as e,m as t,p as n,v as r}from"./slot-DagH0Gxq.js";import{t as i}from"./polymorphic-mAKwlLiW.js";import{t as a}from"./Link-B3SX50Od.js";import{t as o}from"./badge-D7XgWBXc.js";import{t as s}from"./VisuallyHidden-24WfUCsJ.js";import c,{forwardRef as l}from"react";import u from"classnames";const d=l(({className:e,...t},n)=>{let r=u(`avatar-image`,e);return/* @__PURE__ */ c.createElement(`img`,{className:r,...t,ref:n})});d.displayName=`AvatarImage`;function f({children:i,className:l,color:f,disabled:p,smooth:m,size:h,component:g,src:_,alt:v=`Profile picture`,href:y,status:b,statusLabel:x,...S},C){let w=t(g,y,`span`),T=r(w,y,S),E=n(T),D=u(`avatar`,f,h,{smooth:m},!E&&{disabled:p},l),O=E?a:w;return/* @__PURE__ */ c.createElement(O,{className:D,...E&&{component:w},...(E||T===`component`)&&{disabled:p},...e(T,y,`Avatar`),...T===`button`&&{type:`button`},...S,ref:C},_?/* @__PURE__ */ c.createElement(d,{src:_,alt:v}):i,b&&/* @__PURE__ */ c.createElement(o,{color:b,circle:!0},/* @__PURE__ */ c.createElement(s,null,x??b)))}const p=i(f,`Avatar`);function m({children:e,className:t,component:n,items:r,size:i,...a},o){let s=n??`div`,l=u(`avatar-stack`,i,t);return/* @__PURE__ */ c.createElement(s,{className:l,...a,ref:o},r?.map(({key:e,content:t,...n},r)=>/* @__PURE__ */ c.createElement(p,{key:e??r,...n},t)),e)}const h=i(m,`AvatarStack`);export{p as n,d as r,h as t};
|
|
2
|
+
//# sourceMappingURL=avatar-CvcvC9KA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar-
|
|
1
|
+
{"version":3,"file":"avatar-CvcvC9KA.js","names":["hrefProps","linkElement","isInteractiveKind","resolveLinkKind","createPolymorphicComponent","Link","Badge","VisuallyHidden","React","classNames","AvatarImage","forwardRef","rest","_className","className","AvatarRender","tag","component","href","kind","isInteractive","color","size","Component","src","children","status","statusLabel","Avatar","AvatarStackRender","items","item","key","index","content","AvatarStack"],"sources":["../../src/components/avatar/AvatarImage.tsx","../../src/components/avatar/Avatar.tsx","../../src/components/avatar/AvatarStack.tsx"],"sourcesContent":["import React, { forwardRef, ImgHTMLAttributes } from 'react'\nimport classNames from 'classnames'\n\nexport interface AvatarImageProps extends ImgHTMLAttributes<HTMLImageElement> {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n}\n\nexport const AvatarImage = forwardRef<HTMLImageElement, AvatarImageProps>(\n ({ className, ...rest }, ref) => {\n const _className = classNames('avatar-image', className)\n\n return <img className={_className} {...rest} ref={ref} />\n }\n)\n\nAvatarImage.displayName = 'AvatarImage'\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport { ContextColor, ExtendedSizing } from '../../types'\nimport { hrefProps, isInteractiveKind, linkElement, resolveLinkKind } from '../../utils/elementKind'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef,\n PolymorphicRefWithFallback\n} from '../../utils/polymorphic'\nimport { Link } from '../link/Link'\nimport { Badge } from '../badge'\nimport { AvatarImage } from './AvatarImage'\nimport { VisuallyHidden } from '../visually-hidden/VisuallyHidden'\n\ntype AvatarOwnProps<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 * Toggle the disabled state for the component. Only applies when `component` is `a` or `button`.\n */\n disabled?: boolean\n /**\n * Renders the smooth (tinted background) context variant instead of the solid default.\n */\n smooth?: boolean\n /**\n * Sets the size of the component to one of Chassis component sizes.\n */\n size?: ExtendedSizing\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. Set explicitly to `button` (or another\n * interactive element/component) to make a non-link avatar focusable and clickable.\n */\n component?: C\n /**\n * Image source. When set, renders an `AvatarImage` in place of `children`.\n */\n src?: string\n /**\n * Alt text for the image rendered when `src` is set.\n */\n alt?: string\n /**\n * Renders the avatar as a link to this URL. Defaults `component` to `a`. Passed through to a\n * custom `component` too, regardless of whether it resolves to a native `a`/`button`.\n */\n href?: string\n /**\n * Renders a status badge in the bottom-end corner, in one of the Chassis themed colors.\n */\n status?: ContextColor\n /**\n * Accessible label for the status badge, exposed to assistive tech as visually hidden text.\n * Falls back to the `status` value itself.\n */\n statusLabel?: string\n}\n\nexport type AvatarProps<C extends ElementType = 'span'> = PolymorphicComponentProps<\n C,\n AvatarOwnProps<C>\n>\n\ntype AvatarComponent = (<C extends ElementType = 'span'>(\n props: AvatarProps<C> & {\n ref?: PolymorphicRefWithFallback<C, HTMLSpanElement | HTMLAnchorElement>\n }\n) => ReactElement | null) & { displayName?: string }\n\nfunction AvatarRender<C extends ElementType = 'span'>(\n {\n children,\n className,\n color,\n disabled,\n smooth,\n size,\n component,\n src,\n alt = 'Profile picture',\n href,\n status,\n statusLabel,\n ...rest\n }: AvatarProps<C>,\n ref: PolymorphicRef<C>\n) {\n // `href` makes it an `<a>`, unless `component` or `asChild` chose the element (see\n // `linkElement`).\n const tag = linkElement(component, href, 'span')\n // The kind rather than the tag, counting a router link with `href` or `to` as an anchor: under `asChild`, `tag` is a `Slot` standing in for the caller's\n // element, and a slotted `<a>` is as interactive as `component=\"a\"`.\n const kind = resolveLinkKind(tag, href, rest)\n const isInteractive = isInteractiveKind(kind)\n\n const _className = classNames(\n 'avatar',\n color,\n size,\n { smooth },\n !isInteractive && { disabled },\n className\n )\n\n const Component = (isInteractive ? Link : tag) as ElementType\n\n return (\n <Component\n className={_className}\n {...(isInteractive && { component: tag })}\n // `Link` handles `disabled` on an `<a>` or `<button>`, a router link included; any other\n // component reference is trusted to. A plain tag has no `disabled` attribute and gets the\n // class alone.\n {...((isInteractive || kind === 'component') && { disabled })}\n {...hrefProps(kind, href, 'Avatar')}\n {...(kind === 'button' && { type: 'button' })}\n {...rest}\n ref={ref}\n >\n {src ? <AvatarImage src={src} alt={alt} /> : children}\n {status && (\n <Badge color={status} circle>\n <VisuallyHidden>{statusLabel ?? status}</VisuallyHidden>\n </Badge>\n )}\n </Component>\n )\n}\n\nexport const Avatar = createPolymorphicComponent<AvatarComponent>(\n AvatarRender as ForwardRefRenderFunction<Element, AvatarProps<ElementType>>,\n 'Avatar'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement, ReactNode } from 'react'\nimport classNames from 'classnames'\n\nimport { ContextColor, ExtendedSizing } from '../../types'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { Avatar } from './Avatar'\n\nexport interface AvatarStackItemDef {\n /**\n * React key for the rendered `Avatar`. Falls back to the item's index in `data`.\n */\n key?: string | number\n /**\n * Image source, rendered via `AvatarImage`.\n */\n src?: string\n /**\n * Alt text for the image rendered when `src` is set.\n */\n alt?: string\n /**\n * Renders the avatar as a link to this URL.\n */\n href?: string\n /**\n * Renders a status badge in one of the Chassis themed colors.\n */\n status?: ContextColor\n /**\n * Accessible label for the status badge.\n */\n statusLabel?: string\n /**\n * Content to render when `src` isn't set, e.g. initials or a \"+5\" overflow count.\n */\n content?: ReactNode\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: ElementType\n}\n\ntype AvatarStackOwnProps<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 * Sets the size of every `Avatar` in the stack to one of Chassis component sizes.\n */\n size?: ExtendedSizing\n /**\n * Renders a `Avatar` for each item, ahead of any JSX `children` (handy for a trailing \"+N\"\n * overflow avatar).\n */\n items?: AvatarStackItemDef[]\n}\n\nexport type AvatarStackProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n AvatarStackOwnProps<C>\n>\n\ntype AvatarStackComponent = (<C extends ElementType = 'div'>(\n props: AvatarStackProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction AvatarStackRender<C extends ElementType = 'div'>(\n { children, className, component, items, size, ...rest }: AvatarStackProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = (component ?? 'div') as ElementType\n const _className = classNames('avatar-stack', size, className)\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {items?.map(({ key, content, ...item }, index) => (\n <Avatar key={key ?? index} {...item}>\n {content}\n </Avatar>\n ))}\n {children}\n </Component>\n )\n}\n\nexport const AvatarStack = createPolymorphicComponent<AvatarStackComponent>(\n AvatarStackRender as ForwardRefRenderFunction<Element, AvatarStackProps<ElementType>>,\n 'AvatarStack'\n)\n"],"mappings":"A,2UAUA,MAAaU,EAAcC,GACxB,CAAE,YAAW,GAAGC,GAAQ,IAAQ,CAC/B,IAAMC,EAAaJ,EAAW,eAAgBK,CAAS,EAEvD,MAAO,kBAAA,cAAC,MAAD,CAAK,UAAWD,EAAY,GAAID,EAAW,KAAM,CAAA,CAC1D,CACF,EAEA,EAAY,YAAc,cC4D1B,SAASG,EACP,CACE,WACA,YACA,QACA,WACA,SACA,OACA,YACA,MACA,MAAM,kBACN,OACA,SACA,cACA,GAAGH,GAEL,EACA,CAGA,IAAMI,EAAMf,EAAYgB,EAAWC,EAAM,MAAM,EAGzCC,EAAOhB,EAAgBa,EAAKE,EAAMN,CAAI,EACtCQ,EAAgBlB,EAAkBiB,CAAI,EAEtCN,EAAaJ,EACjB,SACAY,EACAC,EACA,CAAE,QAAO,EACT,CAACF,GAAiB,CAAE,UAAS,EAC7BN,CACF,EAEMS,EAAaH,EAAgBf,EAAOW,EAE1C,MACE,kBAAA,cAACO,EAAD,CACE,UAAWV,EACX,GAAKO,GAAiB,CAAE,UAAWJ,CAAI,EAIvC,IAAMI,GAAiBD,IAAS,cAAgB,CAAE,UAAS,EAC3D,GAAInB,EAAUmB,EAAMD,EAAM,QAAQ,EAClC,GAAKC,IAAS,UAAY,CAAE,KAAM,QAAS,EAC3C,GAAIP,EACC,KAQI,EANRY,EAAM,kBAAA,cAACd,EAAD,CAAkB,MAAU,KAAM,CAAA,EAAIe,EAC5CC,GACC,kBAAA,cAACpB,EAAD,CAAO,MAAOoB,EAAQ,OAAA,EAEf,EADL,kBAAA,cAACnB,EAAA,KAAgBoB,GAAeD,CAAuB,CAClD,CAEA,CAEf,CAEA,MAAaE,EAASxB,EACpBW,EACA,QACF,EClEA,SAASc,EACP,CAAE,WAAU,YAAW,YAAW,QAAO,OAAM,GAAGjB,GAClD,EACA,CACA,IAAMW,EAAaN,GAAa,MAC1BJ,EAAaJ,EAAW,eAAgBa,EAAMR,CAAS,EAE7D,MACE,kBAAA,cAACS,EAAD,CAAW,UAAWV,EAAY,GAAID,EAAW,KAOtC,EANRkB,GAAO,KAAK,CAAE,MAAK,UAAS,GAAGC,GAAQ,IACtC,kBAAA,cAACH,EAAD,CAAQ,IAAKI,GAAOC,EAAO,GAAIF,CAEvB,EADLG,CACK,CACT,EACAT,CACQ,CAEf,CAEA,MAAaU,EAAc/B,EACzByB,EACA,aACF,E"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./focus-ring-Bs80iIBN.js";import{t as e}from"./polymorphic-
|
|
2
|
-
//# sourceMappingURL=badge-
|
|
1
|
+
import"./focus-ring-Bs80iIBN.js";import{t as e}from"./polymorphic-mAKwlLiW.js";import t from"react";import n from"classnames";function r({children:e,className:r,color:i,variant:a,component:o,position:s,circle:c,size:l,...u},d){let f=o??`span`,p=n(`badge`,i,l,{outline:a===`outline`,smooth:a===`smooth`,"position-absolute translate-middle":s,"top-0":s?.includes(`top`),"top-100":s?.includes(`bottom`),"start-100":s?.includes(`end`),"start-0":s?.includes(`start`)},{circle:c},r);return/* @__PURE__ */ t.createElement(f,{className:p,...u,ref:d},e)}const i=e(r,`Badge`);export{i as t};
|
|
2
|
+
//# sourceMappingURL=badge-D7XgWBXc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge-
|
|
1
|
+
{"version":3,"file":"badge-D7XgWBXc.js","names":["createPolymorphicComponent","React","classNames","BadgeRender","rest","Component","component","_className","color","size","variant","position","className","children","Badge"],"sources":["../../src/components/badge/Badge.tsx"],"sourcesContent":["import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport { ContextColor, ContextStyle, Sizing } from '../../types'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype BadgeOwnProps<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 * Sets the context style of the component. `solid`/`basic` render the default look with no extra class.\n */\n variant?: ContextStyle\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 * Position badge in one of the corners of a link or button.\n */\n position?: 'top-start' | 'top-end' | 'bottom-end' | 'bottom-start'\n /**\n * Select the shape of the component.\n */\n circle?: boolean\n /**\n * Sets the size of the component to one of Chassis component sizes.\n */\n size?: Sizing\n}\n\nexport type BadgeProps<C extends ElementType = 'span'> = PolymorphicComponentProps<\n C,\n BadgeOwnProps<C>\n>\n\ntype BadgeComponent = (<C extends ElementType = 'span'>(\n props: BadgeProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction BadgeRender<C extends ElementType = 'span'>(\n {\n children,\n className,\n color,\n variant,\n component,\n position,\n circle,\n size,\n ...rest\n }: BadgeProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'span'\n\n const _className = classNames(\n 'badge',\n color,\n size,\n {\n outline: variant === 'outline',\n smooth: variant === 'smooth',\n 'position-absolute translate-middle': position,\n 'top-0': position?.includes('top'),\n 'top-100': position?.includes('bottom'),\n 'start-100': position?.includes('end'),\n 'start-0': position?.includes('start')\n },\n { circle },\n className\n )\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const Badge = createPolymorphicComponent<BadgeComponent>(\n BadgeRender as ForwardRefRenderFunction<Element, BadgeProps<ElementType>>,\n 'Badge'\n)\n"],"mappings":"A,8HAkDA,SAASG,EACP,CACE,WACA,YACA,QACA,UACA,YACA,WACA,SACA,OACA,GAAGC,GAEL,EACA,CACA,IAAMC,EAAYC,GAAa,OAEzBC,EAAaL,EACjB,QACAM,EACAC,EACA,CACE,QAASC,IAAY,UACrB,OAAQA,IAAY,SACpB,qCAAsCC,EACtC,QAASA,GAAU,SAAS,KAAK,EACjC,UAAWA,GAAU,SAAS,QAAQ,EACtC,YAAaA,GAAU,SAAS,KAAK,EACrC,UAAWA,GAAU,SAAS,OAAO,CACvC,EACA,CAAE,QAAO,EACTC,CACF,EAEA,MACE,kBAAA,cAACP,EAAD,CAAW,UAAWE,EAAY,GAAIH,EAAW,KAEtC,EADRS,CACQ,CAEf,CAEA,MAAaC,EAAQd,EACnBG,EACA,OACF,E"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./focus-ring-Bs80iIBN.js";import{d as e}from"./slot-
|
|
2
|
-
//# sourceMappingURL=breadcrumb-
|
|
1
|
+
import"./focus-ring-Bs80iIBN.js";import{d as e}from"./slot-DagH0Gxq.js";import{t}from"./Link-B3SX50Od.js";import n,{forwardRef as r}from"react";import i from"classnames";const a=r(({children:r,active:a,className:o,href:s,...c},l)=>{let u=i(`breadcrumb-item`,{active:a},o);return/* @__PURE__ */ n.createElement(`li`,{className:u,...a&&{"aria-current":`page`},...c,ref:l},e(s)?/* @__PURE__ */ n.createElement(t,{href:s},r):r)});a.displayName=`BreadcrumbItem`;const o=r(({"aria-label":e=`breadcrumb`,children:t,className:r,items:o,...s},c)=>{let l=i(`breadcrumb`,r),u=o?o.map((e,t)=>{let r=t===o.length-1;return/* @__PURE__ */ n.createElement(a,{key:t,active:r,href:r?void 0:e.href},e.label)}):null;return/* @__PURE__ */ n.createElement(`nav`,{"aria-label":e},/* @__PURE__ */ n.createElement(`ol`,{className:l,...s,ref:c},u??t))});o.displayName=`Breadcrumb`;export{a as n,o as t};
|
|
2
|
+
//# sourceMappingURL=breadcrumb-DxCHVppV.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumb-
|
|
1
|
+
{"version":3,"file":"breadcrumb-DxCHVppV.js","names":["hasHref","React","classNames","BreadcrumbItem","forwardRef","rest","_className","className","active","href","Link","children","Breadcrumb","ariaLabel","autoContent","items","isLast","idx","item"],"sources":["../../src/components/breadcrumb/BreadcrumbItem.tsx","../../src/components/breadcrumb/Breadcrumb.tsx"],"sourcesContent":["import React, { forwardRef, HTMLAttributes } from 'react'\nimport classNames from 'classnames'\n\nimport { hasHref } from '../../utils/elementKind'\nimport { Link } from '../link/Link'\n\nexport interface BreadcrumbItemProps extends HTMLAttributes<HTMLLIElement> {\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 base component.\n */\n className?: string\n /**\n * The `href` attribute for the inner `<Link>` component.\n */\n href?: string\n}\n\nexport const BreadcrumbItem = forwardRef<HTMLLIElement, BreadcrumbItemProps>(\n ({ children, active, className, href, ...rest }, ref) => {\n const _className = classNames(\n 'breadcrumb-item',\n {\n active: active\n },\n className\n )\n return (\n <li className={_className} {...(active && { 'aria-current': 'page' })} {...rest} ref={ref}>\n {/* `href=\"\"` is a link too, to the current document (CONVENTIONS.md, \"href\"). */}\n {hasHref(href) ? <Link href={href}>{children}</Link> : children}\n </li>\n )\n }\n)\n\nBreadcrumbItem.displayName = 'BreadcrumbItem'\n","import React, { forwardRef, HTMLAttributes } from 'react'\nimport classNames from 'classnames'\n\nimport { BreadcrumbItem } from './BreadcrumbItem'\n\nexport interface BreadcrumbItemDef {\n /**\n * Label for the breadcrumb item.\n */\n label: React.ReactNode\n /**\n * URL for the breadcrumb link. The last item in the array is always rendered as active (no link needed).\n */\n href?: string\n}\n\nexport interface BreadcrumbProps extends HTMLAttributes<HTMLOListElement> {\n /**\n * Accessible name of the wrapping `<nav>` landmark. Defaults to the English `'breadcrumb'`;\n * override it to translate the landmark, or to tell two breadcrumb trails on the same page\n * apart (landmarks of the same role need distinct names to be distinguishable in a screen\n * reader's landmark list).\n *\n * @default 'breadcrumb'\n */\n 'aria-label'?: string\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Array of breadcrumb items for data-driven rendering. The last item is automatically marked active.\n * When provided, children are ignored.\n */\n items?: BreadcrumbItemDef[]\n}\n\nexport const Breadcrumb = forwardRef<HTMLOListElement, BreadcrumbProps>(\n ({ 'aria-label': ariaLabel = 'breadcrumb', children, className, items, ...rest }, ref) => {\n const _className = classNames('breadcrumb', className)\n\n const autoContent = items\n ? items.map((item, idx) => {\n const isLast = idx === items.length - 1\n return (\n <BreadcrumbItem\n // eslint-disable-next-line react/no-array-index-key\n key={idx}\n active={isLast}\n href={isLast ? undefined : item.href}\n >\n {item.label}\n </BreadcrumbItem>\n )\n })\n : null\n\n return (\n <nav aria-label={ariaLabel}>\n <ol className={_className} {...rest} ref={ref}>\n {autoContent ?? children}\n </ol>\n </nav>\n )\n }\n)\n\nBreadcrumb.displayName = 'Breadcrumb'\n"],"mappings":"A,0KAqBA,MAAaG,EAAiBC,GAC3B,CAAE,WAAU,SAAQ,YAAW,OAAM,GAAGC,GAAQ,IAAQ,CACvD,IAAMC,EAAaJ,EACjB,kBACA,CACU,QACV,EACAK,CACF,EACA,MACE,kBAAA,cAAC,KAAD,CAAI,UAAWD,EAAY,GAAKE,GAAU,CAAE,eAAgB,MAAO,EAAI,GAAIH,EAAW,KAGlF,EADDL,EAAQS,CAAI,EAAI,kBAAA,cAACC,EAAD,CAAY,MAAsB,EAAfC,CAAe,EAAIA,CACrD,CAER,CACF,EAEA,EAAe,YAAc,iBCF7B,MAAaC,EAAaR,GACvB,CAAE,aAAcS,EAAY,aAAc,WAAU,YAAW,QAAO,GAAGR,GAAQ,IAAQ,CACxF,IAAMC,EAAaJ,EAAW,aAAcK,CAAS,EAE/CO,EAAcC,EAChBA,EAAM,KAAK,EAAM,IAAQ,CACvB,IAAMC,EAASC,IAAQF,EAAM,OAAS,EACtC,MACE,kBAAA,cAACZ,EAAD,CAEE,IAAKc,EACL,OAAQD,EACR,KAAMA,EAAS,IAAA,GAAYE,EAAK,IAGlB,EADbA,EAAK,KACQ,CAEpB,CAAC,EACD,KAEJ,MACE,kBAAA,cAAC,MAAD,CAAK,aAAYL,CAIZ,EAHH,kBAAA,cAAC,KAAD,CAAI,UAAWP,EAAY,GAAID,EAAW,KAEtC,EADDS,GAAeH,CACd,CACD,CAET,CACF,EAEA,EAAW,YAAc,a"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./focus-ring-Bs80iIBN.js";import{t as e}from"./polymorphic-
|
|
2
|
-
//# sourceMappingURL=button-group-
|
|
1
|
+
import"./focus-ring-Bs80iIBN.js";import{t as e}from"./polymorphic-mAKwlLiW.js";import t from"react";import n from"classnames";function r({children:e,className:r,component:i,size:a,vertical:o,...s},c){let l=i??`div`,u=n(o?`button-group-vertical`:`button-group`,a,r);return/* @__PURE__ */ t.createElement(l,{className:u,...s,ref:c},e)}const i=e(r,`ButtonGroup`);function a({children:e,className:r,component:i,...a},o){let s=i??`div`,c=n(`button-toolbar`,r);return/* @__PURE__ */ t.createElement(s,{className:c,...a,ref:o},e)}const o=e(a,`ButtonToolbar`);export{i as n,o as t};
|
|
2
|
+
//# sourceMappingURL=button-group-CXMj0D4r.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-group-
|
|
1
|
+
{"version":3,"file":"button-group-CXMj0D4r.js","names":["createPolymorphicComponent","React","classNames","ButtonGroupRender","rest","Component","component","_className","vertical","size","className","children","ButtonGroup","ButtonToolbarRender","ButtonToolbar"],"sources":["../../src/components/button-group/ButtonGroup.tsx","../../src/components/button-group/ButtonToolbar.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 ButtonGroupOwnProps<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 * Size the component sm or lg.\n */\n size?: 'sm' | 'lg'\n /**\n * Create a set of buttons that appear vertically stacked rather than horizontally, with the\n * `.button-group-vertical` class in place of `.button-group`. Split button dropdowns are not\n * supported here, and `size` has no effect: chassis-css sizes the buttons of a horizontal group\n * only, so size the buttons of a vertical one themselves.\n */\n vertical?: boolean\n}\n\nexport type ButtonGroupProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n ButtonGroupOwnProps<C>\n>\n\ntype ButtonGroupComponent = (<C extends ElementType = 'div'>(\n props: ButtonGroupProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction ButtonGroupRender<C extends ElementType = 'div'>(\n { children, className, component, size, vertical, ...rest }: ButtonGroupProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n // chassis-css stacks a group with `.button-group-vertical` in place of `.button-group`: the two\n // share the base rules, and the horizontal ones (the overlap of the borders, the corners) hang\n // on `.button-group` alone.\n const _className = classNames(\n vertical ? 'button-group-vertical' : 'button-group',\n size,\n className\n )\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const ButtonGroup = createPolymorphicComponent<ButtonGroupComponent>(\n ButtonGroupRender as ForwardRefRenderFunction<Element, ButtonGroupProps<ElementType>>,\n 'ButtonGroup'\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 ButtonToolbarOwnProps<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\nexport type ButtonToolbarProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n ButtonToolbarOwnProps<C>\n>\n\ntype ButtonToolbarComponent = (<C extends ElementType = 'div'>(\n props: ButtonToolbarProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction ButtonToolbarRender<C extends ElementType = 'div'>(\n { children, className, component, ...rest }: ButtonToolbarProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames('button-toolbar', className)\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const ButtonToolbar = createPolymorphicComponent<ButtonToolbarComponent>(\n ButtonToolbarRender as ForwardRefRenderFunction<Element, ButtonToolbarProps<ElementType>>,\n 'ButtonToolbar'\n)\n"],"mappings":"A,8HAwCA,SAASG,EACP,CAAE,WAAU,YAAW,YAAW,OAAM,WAAU,GAAGC,GACrD,EACA,CACA,IAAMC,EAAYC,GAAa,MAIzBC,EAAaL,EACjBM,EAAW,wBAA0B,eACrCC,EACAC,CACF,EAEA,MACE,kBAAA,cAACL,EAAD,CAAW,UAAWE,EAAY,GAAIH,EAAW,KAEtC,EADRO,CACQ,CAEf,CAEA,MAAaC,EAAcZ,EACzBG,EACA,aACF,ECnCA,SAASU,EACP,CAAE,WAAU,YAAW,YAAW,GAAGT,GACrC,EACA,CACA,IAAMC,EAAYC,GAAa,MACzBC,EAAaL,EAAW,iBAAkBQ,CAAS,EAEzD,MACE,kBAAA,cAACL,EAAD,CAAW,UAAWE,EAAY,GAAIH,EAAW,KAEtC,EADRO,CACQ,CAEf,CAEA,MAAaG,EAAgBd,EAC3Ba,EACA,eACF,E"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./focus-ring-Bs80iIBN.js";import{
|
|
2
|
-
//# sourceMappingURL=card-
|
|
1
|
+
import"./focus-ring-Bs80iIBN.js";import{C as e}from"./slot-DagH0Gxq.js";import{t}from"./polymorphic-mAKwlLiW.js";import{t as n}from"./Link-B3SX50Od.js";import{a as r,i,n as a,r as o}from"./breakpoints-CGk8szzR.js";import{t as s}from"./spacingClassName-DVhk8m3P.js";import c from"react";import l from"classnames";function u({children:e,className:t,component:n,direction:a,gap:u,...d},f){let p=n??`div`,m=l(`card-body`,i([r(a,o)]),s(`gap`,u),t);return/* @__PURE__ */ c.createElement(p,{className:m,...d,ref:f},e)}const d=t(u,`CardBody`);function f({children:e,className:t,component:n,...r},i){let a=n??`div`,o=l(`card-footer`,t);return/* @__PURE__ */ c.createElement(a,{className:o,...r,ref:i},e)}const p=t(f,`CardFooter`),m=[`start`,`end`],h=[`sm:`,`md:`,`lg:`,`xl:`],g=(t,n)=>{let r=`${n}card-image-${t}`,i=n===``||m.includes(t)&&h.includes(n);return e(!i,`CardImage: \`orientation\` has no class to render for "${r}", which @chassis-ui/css doesn't have, so the value does nothing. Only \`start\` and \`end\` have breakpoint classes, from \`sm\` to \`xl\`; \`top\` and \`bottom\` apply at \`base\` alone.`),i?r:null};function _({children:e,className:t,component:n,orientation:o,...s},u){let d=n??`img`,f=l(a(o)===void 0&&`card-image`,i([r(o,g)]),t);return/* @__PURE__ */ c.createElement(d,{className:f,...s,ref:u},e)}const v=t(_,`CardImage`);function y({children:e,component:t,className:n,...r},i){let a=t??`h6`,o=l(`card-subtitle`,n);return/* @__PURE__ */ c.createElement(a,{className:o,...r,ref:i},e)}const b=t(y,`CardSubtitle`);function x({children:e,component:t,className:n,...r},i){let a=t??`p`,o=l(`card-text`,n);return/* @__PURE__ */ c.createElement(a,{className:o,...r,ref:i},e)}const S=t(x,`CardText`);function C({children:e,component:t,className:n,...r},i){let a=t??`h5`,o=l(`card-title`,n);return/* @__PURE__ */ c.createElement(a,{className:o,...r,ref:i},e)}const w=t(C,`CardTitle`);function T({children:e,className:t,color:n,component:a,direction:s,footer:u,image:f,imageAlt:m,imageOrientation:h=`top`,size:g,subtitle:_,text:y,title:x,variant:C,...T},E){let D=a??`div`,O=l(`card`,n,{context:!!n,solid:C===`solid`,smooth:C===`smooth`,outline:C===`outline`,sm:g===`sm`,lg:g===`lg`},i([r(s,o)]),t),k=f!=null||x!=null||_!=null||u!=null||y!=null,A=x!=null||_!=null||y!=null||e!=null,j=typeof f==`string`?/* @__PURE__ */ c.createElement(v,{orientation:h,src:f,alt:m??``}):f;return/* @__PURE__ */ c.createElement(D,{className:O,...T,ref:E},k?/* @__PURE__ */ c.createElement(c.Fragment,null,f!=null&&h===`top`&&j,A&&/* @__PURE__ */ c.createElement(d,null,x!=null&&/* @__PURE__ */ c.createElement(w,null,x),_!=null&&/* @__PURE__ */ c.createElement(b,null,_),y!=null&&/* @__PURE__ */ c.createElement(S,null,y),e),f!=null&&h===`bottom`&&j,u!=null&&/* @__PURE__ */ c.createElement(p,null,u)):e)}const E=t(T,`Card`);function D({children:e,className:t,component:n,...r},i){let a=n??`div`,o=l(`card-group`,t);return/* @__PURE__ */ c.createElement(a,{className:o,...r,ref:i},e)}const O=t(D,`CardGroup`);function k({children:e,className:t,component:n,...r},i){let a=n??`div`,o=l(`card-header`,t);return/* @__PURE__ */ c.createElement(a,{className:o,...r,ref:i},e)}const A=t(k,`CardHeader`);function j({children:e,className:t,component:n,...r},i){let a=n??`div`,o=l(`card-overlay`,t);return/* @__PURE__ */ c.createElement(a,{className:o,...r,ref:i},e)}const M=t(j,`CardImageOverlay`);function N({children:e,className:t,...r},i){let a=l(`card-link`,t);return/* @__PURE__ */ c.createElement(n,{className:a,...r,ref:i},e)}const P=t(N,`CardLink`);export{E as a,b as c,d,O as i,v as l,M as n,w as o,A as r,S as s,P as t,p as u};
|
|
2
|
+
//# sourceMappingURL=card-C6lPZs5J.js.map
|