@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 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-Bs80iIBN.js";import{t as e}from"./polymorphic-CZIFszAy.js";import{a as t,i as n,n as r,t as i}from"./breakpoints-CGk8szzR.js";import a from"react";import o from"classnames";function s({children:e,className:t,component:n,fluidUntil:r,fluid:i,...s},c){let l=n??`div`,u=o(`container`,i&&`fluid`,r,t);return/* @__PURE__ */ a.createElement(l,{className:u,...s,ref:c},e)}const c=e(s,`Container`),l=/* @__PURE__ */ new Set([`zero`,`4xs`,`3xs`,`2xs`,`xs`,`sm`,`md`,`lg`,`xl`,`2xl`,`3xl`,`4xl`,`5xl`,`6xl`]),u=(e,t=``)=>e!==void 0&&l.has(e)?`${t}gap-${e}`:null,d=e=>e!==void 0&&!l.has(e)?e:void 0,f=e=>e!==void 0&&Number.isInteger(e)&&e>=1&&e<=6,p=e=>e!==void 0&&!f(e)?`repeat(${e}, minmax(0, 1fr))`:void 0,m=e=>e!==void 0&&Number.isInteger(e)&&e>=1&&e<=12,h=(e,t)=>`${t}grid-flow-${e.replace(`column`,`col`)}`;function g({children:e,className:s,component:c,columns:l,rows:g,gap:_,flow:v,contained:y,fill:b,min:x,style:S,...C},w){let T=c??`div`,E=r(l),D=r(g),O=r(_),k=o(b?`grid-fill`:`grid`,y&&`contained`,n([t(l,(e,t)=>!b&&(t!==``||m(e))&&`${t}grid-cols-${e}`),t(g,(e,t)=>!b&&(t!==``||f(e))&&`${t}grid-rows-${e}`),t(_,u),t(v,h)],i),s),A={...S},j=d(O);if(j!==void 0&&(A[`--cx-grid-gap`]=j),b)x!==void 0&&(A[`--cx-grid-min`]=x);else{E!==void 0&&!m(E)&&(A[`--cx-grid-columns`]=E);let e=p(D);e!==void 0&&(A.gridTemplateRows=e)}return/* @__PURE__ */ a.createElement(T,{className:k,style:A,...C,ref:w},e)}const _=e(g,`Grid`);function v({children:e,className:r,component:s,span:c,start:l,end:m,rowSpan:h,rowStart:g,rowEnd:_,subgrid:v,rows:y,gap:b,style:x,...S},C){let w=s??`div`,T=o(n([t(c,(e,t)=>`${t}col-span-${e}`),t(l,(e,t)=>`${t}col-start-${e}`),t(m,(e,t)=>`${t}col-end-${e}`),t(h,(e,t)=>`${t}row-span-${e}`),t(g,(e,t)=>`${t}row-start-${e}`),t(_,(e,t)=>`${t}row-end-${e}`)],i),v&&`grid grid-cols-subgrid`,v&&f(y)&&`grid-rows-${y}`,v&&u(b),r),E={...x};if(v){let e=p(y);e!==void 0&&(E.gridTemplateRows=e);let t=d(b);t!==void 0&&(E[`--cx-grid-gap`]=t)}return/* @__PURE__ */ a.createElement(w,{className:T,style:E,...S,ref:C},e)}const y=e(v,`GridItem`);export{_ as n,c as r,y as t};
|
|
2
|
-
//# sourceMappingURL=grid-CkdPftit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"grid-CkdPftit.js","names":["createPolymorphicComponent","responsiveProp","responsiveClassNames","baseValue","GRID_BREAKPOINTS","React","classNames","ContainerRender","rest","Component","component","_className","fluid","fluidUntil","className","children","Container","SPACING_TOKENS","gapClassName","gap","prefix","gapValue","hasRowsClass","rows","rowsTemplate","hasColumnsClass","columns","flowClassName","flow","GridRender","baseColumns","baseRows","baseGap","fill","contained","value","_style","style","_gap","min","_rows","Grid","GridItemRender","span","start","end","rowSpan","rowStart","rowEnd","subgrid","GridItem"],"sources":["../../src/components/grid/Container.tsx","../../src/types.ts","../../src/components/grid/gap.ts","../../src/components/grid/rows.ts","../../src/components/grid/Grid.tsx","../../src/components/grid/GridItem.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'\nimport { Breakpoint } from '../../types'\n\ntype ContainerOwnProps<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 * Set container 100% wide until the given breakpoint, after which it scales up with `max-width`\n * at every larger breakpoint.\n *\n * @type Breakpoint\n */\n fluidUntil?: Breakpoint\n /**\n * Set container 100% wide, spanning the entire width of the viewport.\n */\n fluid?: boolean\n}\n\nexport type ContainerProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n ContainerOwnProps<C>\n>\n\ntype ContainerComponent = (<C extends ElementType = 'div'>(\n props: ContainerProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction ContainerRender<C extends ElementType = 'div'>(\n { children, className, component, fluidUntil, fluid, ...rest }: ContainerProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames('container', fluid && 'fluid', fluidUntil, className)\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const Container = createPolymorphicComponent<ContainerComponent>(\n ContainerRender as ForwardRefRenderFunction<Element, ContainerProps<ElementType>>,\n 'Container'\n)\n","/**\n * Breakpoints\n */\nexport type Breakpoint = 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n\n/**\n * Container breakpoints: the same widths, measured on the nearest query container instead of the\n * viewport. chassis-css's `@md:` classes.\n */\nexport type ContainerBreakpoint = '@sm' | '@md' | '@lg' | '@xl' | '@2xl'\n\n/**\n * A prop value that can change with the width. A plain value applies at every width. An object\n * holds one value per width: `base` from the narrowest, each breakpoint key from that breakpoint\n * up, as in `{ base: 'column', md: 'row' }`. `K` is the keys the prop reads: the viewport\n * breakpoints unless the component also takes the container ones.\n */\nexport type Responsive<T, K extends string = Breakpoint> =\n T | ({ base?: T } & Partial<Record<K, T>>)\n\n/**\n * Context colors\n */\nexport type ContextColor =\n | 'default'\n | 'alternate'\n | 'primary'\n | 'secondary'\n | 'neutral'\n | 'success'\n | 'danger'\n | 'warning'\n | 'info'\n | 'black'\n | 'white'\n\n/**\n * Context styles\n */\nexport type ContextStyle = 'basic' | 'solid' | 'outline' | 'smooth'\n\n/**\n * Component sizes\n */\nexport type Sizing = 'sm' | 'md' | 'lg'\n\n/**\n * Extended sizes\n */\nexport type ExtendedSizing = '2xs' | 'xs' | Sizing | 'xl' | '2xl'\n\n/**\n * Spacing values. `SPACING` is the runtime source of truth — `Spacing` is derived from it so the\n * two can't drift apart; anything needing the values at runtime (e.g. validating a string against\n * the scale) should import `SPACING`, not hand-copy the list.\n */\nexport const SPACING = [\n 'zero',\n '4xs',\n '3xs',\n '2xs',\n 'xs',\n 'sm',\n 'md',\n 'lg',\n 'xl',\n '2xl',\n '3xl',\n '4xl',\n '5xl',\n '6xl'\n] as const\n\nexport type Spacing = (typeof SPACING)[number]\n\n/**\n * Font families\n */\nexport type FontFamily = 'text' | 'display' | 'code' | 'html'\n\n/**\n * Font weights\n */\nexport type FontWeight = 'elegant' | 'normal' | 'strong' | 'mass'\n\n/**\n * Font sizes\n */\nexport type FontSize = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl'\n\n/**\n * Component placements\n */\nexport type Placements =\n | 'auto'\n | 'auto-start'\n | 'auto-end'\n | 'top-end'\n | 'top'\n | 'top-start'\n | 'bottom-end'\n | 'bottom'\n | 'bottom-start'\n | 'right-start'\n | 'right'\n | 'right-end'\n | 'left-start'\n | 'left'\n | 'left-end'\n\n/**\n * Component shapes\n */\nexport type Shapes =\n | 'rounded'\n | 'rounded-top'\n | 'rounded-end'\n | 'rounded-bottom'\n | 'rounded-start'\n | 'rounded-circle'\n | 'rounded-pill'\n | 'rounded-0'\n | 'rounded-1'\n | 'rounded-2'\n | 'rounded-3'\n\nexport type TextColor =\n | ContextColor\n | 'main'\n | 'subtle'\n | 'slight'\n | 'solid'\n | 'inverse'\n | 'highlight'\n | 'active'\n | 'contrast'\n\nexport type Triggers = 'hover' | 'focus' | 'click'\n","import { SPACING } from '../../types'\n\nconst SPACING_TOKENS = new Set<string>(SPACING)\n\n// A `Spacing` token is chassis-css's own `gap-{token}` utility, which a breakpoint prefix makes\n// responsive. Anything else (a raw CSS value, e.g. `\"1rem\"` or `\".25rem 1rem\"`) has no class and\n// goes to the `--cx-grid-gap` custom property instead: see `gapValue`.\nexport const gapClassName = (gap: string | undefined, prefix = ''): string | null =>\n gap !== undefined && SPACING_TOKENS.has(gap) ? `${prefix}gap-${gap}` : null\n\nexport const gapValue = (gap: string | undefined): string | undefined =>\n gap !== undefined && !SPACING_TOKENS.has(gap) ? gap : undefined\n","// chassis-css has `grid-rows-1` to `grid-rows-6`.\nexport const hasRowsClass = (rows: number | undefined) =>\n rows !== undefined && Number.isInteger(rows) && rows >= 1 && rows <= 6\n\n// A row count with no class is the declaration of the class, set inline: see `Grid`'s `rows`.\n// `grid-template-rows` isn't inherited, so unlike a custom property it stays on the one grid.\nexport const rowsTemplate = (rows: number | undefined): string | undefined =>\n rows !== undefined && !hasRowsClass(rows) ? `repeat(${rows}, minmax(0, 1fr))` : undefined\n","import React, { CSSProperties, ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport {\n baseValue,\n GRID_BREAKPOINTS,\n responsiveClassNames,\n responsiveProp\n} from '../../utils/breakpoints'\nimport { Breakpoint, ContainerBreakpoint, Responsive, Spacing } from '../../types'\nimport { gapClassName, gapValue } from './gap'\nimport { hasRowsClass, rowsTemplate } from './rows'\n\ntype GridStyle = CSSProperties & {\n '--cx-grid-columns'?: number\n '--cx-grid-gap'?: string\n '--cx-grid-min'?: string\n}\n\n/**\n * The direction a grid places its items in, and whether it fills earlier gaps (`dense`): the\n * values of CSS `grid-auto-flow`.\n */\nexport type GridFlow = 'row' | 'column' | 'dense' | 'row-dense' | 'column-dense'\n\n// A token is a class at any width. A raw CSS value is a custom property, which only the base\n// can be: an inline style holds no media query.\ntype GridGap = Spacing | (string & {})\n\ntype GridOwnProps<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 * Number of columns in the grid template (the column count of `@chassis-ui/css` when omitted,\n * `12` by default). A count from 1 to 12 is mapped to the `grid-cols-{n}` class, which applies\n * to this grid alone. Any other count has no class and is set via the `--cx-grid-columns`\n * custom property, which a grid nested in this one inherits: give that grid `columns` of its\n * own. Has no effect when `fill` is set.\n *\n * An object sets the count from a width up, as in `{ base: 1, md: 3 }`, here and on `rows`,\n * `gap` and `flow`. A breakpoint key (`md`) is a width of the viewport. A container key\n * (`'@md'`) is the same width of the nearest query container (an ancestor with the\n * `contains-inline` class), and wins over a breakpoint key where both apply. Without a query\n * container above the grid, a container key never applies. The count of a key is a class, so\n * a count from 1 to 12.\n */\n columns?: Responsive<number, Breakpoint | ContainerBreakpoint>\n /**\n * Number of equal rows in the grid template. A grid has none when omitted: its rows are as\n * tall as their content. A count from 1 to 6 is mapped to the `grid-rows-{n}` class; any other\n * count has no class and is set inline, as the `grid-template-rows` the class declares. Has no\n * effect when `fill` is set. An object sets the count from a width up, where it is a class, so\n * a count from 1 to 6.\n */\n rows?: Responsive<number, Breakpoint | ContainerBreakpoint>\n /**\n * Gap between grid items: a `Spacing` token (mapped to the `gap-{token}` class) or any raw CSS\n * `gap` value, including a `\"{row} {column}\"` pair (set via the `--cx-grid-gap` custom\n * property). The gutter of the current breakpoint when omitted, or of the query container when\n * `contained` is set. An object sets the gap from a width up: only a token fits a key other\n * than `base`, since a raw value has no class.\n *\n * @type { Spacing | string | { base?: Spacing | string } & Partial<Record<Breakpoint | ContainerBreakpoint, Spacing>> }\n */\n gap?: GridGap | ({ base?: GridGap } & Partial<Record<Breakpoint | ContainerBreakpoint, Spacing>>)\n /**\n * The direction items are placed in, mapped to the `grid-flow-*` classes: by `'row'` (the CSS\n * default) or by `'column'`, which fills the `rows` of one column before it starts the next.\n * `'dense'`, `'row-dense'` and `'column-dense'` also move later items into gaps that earlier,\n * wider ones left. An object sets the flow from a width up.\n */\n flow?: Responsive<GridFlow, Breakpoint | ContainerBreakpoint>\n /**\n * Adds the `contained` class: the default gutter and column count follow the width of the\n * nearest query container instead of the viewport, so a grid in a narrow column of a wide page\n * has the gutter of a narrow page. Without a query container above it the grid keeps the\n * values of the viewport. `columns` and `gap` still override them.\n */\n contained?: boolean\n /**\n * Renders `.grid-fill` instead of `.grid` — columns expand equally to fill the available\n * width, with the column count determined by the number of children rather than `columns`.\n */\n fill?: boolean\n /**\n * Minimum column width of a `fill` grid, set via the `--cx-grid-min` custom property: any CSS\n * length, e.g. `\"16rem\"`. Children wrap to a new row when they would get narrower. `12rem` in\n * `@chassis-ui/css` when omitted. Only relevant when `fill` is set.\n */\n min?: string\n}\n\nexport type GridProps<C extends ElementType = 'div'> = PolymorphicComponentProps<C, GridOwnProps<C>>\n\n// chassis-css has `grid-cols-1` to `grid-cols-12`.\nconst hasColumnsClass = (columns: number | undefined) =>\n columns !== undefined && Number.isInteger(columns) && columns >= 1 && columns <= 12\n\n// chassis-css names the values as Tailwind does: `grid-flow-col`, `grid-flow-col-dense`.\nconst flowClassName = (flow: GridFlow, prefix: string) =>\n `${prefix}grid-flow-${flow.replace('column', 'col')}`\n\ntype GridComponent = (<C extends ElementType = 'div'>(\n props: GridProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction GridRender<C extends ElementType = 'div'>(\n {\n children,\n className,\n component,\n columns,\n rows,\n gap,\n flow,\n contained,\n fill,\n min,\n style,\n ...rest\n }: GridProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n\n // A class where chassis-css has one: `--cx-grid-columns` set inline is inherited by every grid\n // nested in this one, which then has this grid's column count instead of its own. Only a base\n // count with no class falls back to the property; a breakpoint's can't, since an inline style\n // holds no media query. `.grid-fill` counts its own columns. A base row count with no class is\n // set inline too, as a declaration: see `rowsTemplate`.\n const baseColumns = baseValue(columns)\n const baseRows = baseValue(rows)\n const baseGap = baseValue<string>(gap)\n\n const _className = classNames(\n fill ? 'grid-fill' : 'grid',\n contained && 'contained',\n responsiveClassNames(\n [\n responsiveProp(\n columns,\n (value, prefix) =>\n !fill && (prefix !== '' || hasColumnsClass(value)) && `${prefix}grid-cols-${value}`\n ),\n responsiveProp(\n rows,\n (value, prefix) =>\n !fill && (prefix !== '' || hasRowsClass(value)) && `${prefix}grid-rows-${value}`\n ),\n responsiveProp<string>(gap, gapClassName),\n responsiveProp(flow, flowClassName)\n ],\n GRID_BREAKPOINTS\n ),\n className\n )\n\n const _style: GridStyle = { ...style }\n const _gap = gapValue(baseGap)\n\n if (_gap !== undefined) _style['--cx-grid-gap'] = _gap\n\n if (fill) {\n if (min !== undefined) _style['--cx-grid-min'] = min\n } else {\n if (baseColumns !== undefined && !hasColumnsClass(baseColumns)) {\n _style['--cx-grid-columns'] = baseColumns\n }\n const _rows = rowsTemplate(baseRows)\n if (_rows !== undefined) _style.gridTemplateRows = _rows\n }\n\n return (\n <Component className={_className} style={_style} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const Grid = createPolymorphicComponent<GridComponent>(\n GridRender as ForwardRefRenderFunction<Element, GridProps<ElementType>>,\n 'Grid'\n)\n","import React, { CSSProperties, ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { GRID_BREAKPOINTS, responsiveClassNames, responsiveProp } from '../../utils/breakpoints'\nimport { Breakpoint, ContainerBreakpoint, Responsive, Spacing } from '../../types'\nimport { gapClassName, gapValue } from './gap'\nimport { hasRowsClass, rowsTemplate } from './rows'\n\ntype GridItemStyle = CSSProperties & {\n '--cx-grid-gap'?: string\n}\n\ntype GridItemOwnProps<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 * Number of grid column tracks (of the parent `<Grid>`'s `columns`) this item spans, mapped to\n * the `col-span-{n}` class, or `'full'` for every track of the row (`col-span-full`). An item\n * with no `span` is one track wide.\n *\n * An object sets the span from a width up, as in `{ base: 'full', md: 6 }`, here and on\n * `start`, `end`, `rowSpan`, `rowStart` and `rowEnd`. A breakpoint key (`md`) is a width of\n * the viewport. A container key (`'@md'`) is the same width of the nearest query container\n * (an ancestor with the `contains-inline` class), and wins over a breakpoint key where both\n * apply. Without a query container above the grid, a container key never applies.\n *\n * @type { Responsive<number | 'full', Breakpoint | ContainerBreakpoint> }\n */\n span?: Responsive<number | 'full', Breakpoint | ContainerBreakpoint>\n /**\n * Grid column line to start this item at, mapped to the `col-start-{n}` class (1 to 12).\n * `'auto'` (`col-start-auto`) returns the item to the flow, to undo a start line at a wider\n * breakpoint: `{ base: 4, md: 'auto' }`.\n *\n * @type { Responsive<number | 'auto', Breakpoint | ContainerBreakpoint> }\n */\n start?: Responsive<number | 'auto', Breakpoint | ContainerBreakpoint>\n /**\n * Grid column line to end this item at, mapped to the `col-end-{n}` class (1 to 13, the line\n * after the last of 12 columns). With `span`, it places the item against the end edge of the\n * grid: `span={3} end={13}`. `'auto'` (`col-end-auto`) undoes an end line at a wider\n * breakpoint: `{ base: 13, md: 'auto' }`.\n *\n * @type { Responsive<number | 'auto', Breakpoint | ContainerBreakpoint> }\n */\n end?: Responsive<number | 'auto', Breakpoint | ContainerBreakpoint>\n /**\n * Number of grid row tracks this item spans, mapped to the `row-span-{n}` class. Takes an\n * object per width, as `span` does.\n */\n rowSpan?: Responsive<number, Breakpoint | ContainerBreakpoint>\n /**\n * Grid row line to start this item at, mapped to the `row-start-{n}` class (1 to 6), or\n * `'auto'` (`row-start-auto`) to return it to the flow. Takes an object per width, as `span`\n * does.\n *\n * @type { Responsive<number | 'auto', Breakpoint | ContainerBreakpoint> }\n */\n rowStart?: Responsive<number | 'auto', Breakpoint | ContainerBreakpoint>\n /**\n * Grid row line to end this item at, mapped to the `row-end-{n}` class (1 to 7, the line after\n * the last of 6 rows), or `'auto'` (`row-end-auto`) to undo an end line at a wider breakpoint.\n * Takes an object per width, as `span` does.\n *\n * @type { Responsive<number | 'auto', Breakpoint | ContainerBreakpoint> }\n */\n rowEnd?: Responsive<number | 'auto', Breakpoint | ContainerBreakpoint>\n /**\n * Turns this item into a nested subgrid: adds `.grid`/`.grid-cols-subgrid` alongside its\n * `col-span-{n}`/`col-start-{n}` placement classes, so its own children inherit the parent\n * `<Grid>`'s column tracks instead of defining new ones. Combine with `span` — a subgrid\n * item must itself be a grid item of the parent for `grid-template-columns: subgrid` to take\n * effect, which is why `subgrid` lives on `<GridItem>` (the element actually placed as a grid\n * item) rather than on a `<Grid>` nested inside it.\n */\n subgrid?: boolean\n /**\n * Number of equal rows in the subgrid's own row template: the `grid-rows-{n}` class for a\n * count from 1 to 6, the same `grid-template-rows` set inline for any other. Only relevant\n * when `subgrid` is set — subgrid only inherits the parent's column tracks, not its rows.\n */\n rows?: number\n /**\n * Gap between the subgrid's children: a `Spacing` token (mapped to the `gap-{token}` class) or\n * any raw CSS `gap` value (set via the `--cx-grid-gap` custom property). Only relevant when\n * `subgrid` is set. A subgrid has the gap of its own: when the parent `<Grid>` takes a `gap`\n * token, give the subgrid the same one, or its children are narrower than the parent's tracks.\n *\n * @type { Spacing | string }\n */\n gap?: Spacing | (string & {})\n}\n\nexport type GridItemProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n GridItemOwnProps<C>\n>\n\ntype GridItemComponent = (<C extends ElementType = 'div'>(\n props: GridItemProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction GridItemRender<C extends ElementType = 'div'>(\n {\n children,\n className,\n component,\n span,\n start,\n end,\n rowSpan,\n rowStart,\n rowEnd,\n subgrid,\n rows,\n gap,\n style,\n ...rest\n }: GridItemProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames(\n responsiveClassNames(\n [\n responsiveProp(span, (value, prefix) => `${prefix}col-span-${value}`),\n responsiveProp(start, (value, prefix) => `${prefix}col-start-${value}`),\n responsiveProp(end, (value, prefix) => `${prefix}col-end-${value}`),\n responsiveProp(rowSpan, (value, prefix) => `${prefix}row-span-${value}`),\n responsiveProp(rowStart, (value, prefix) => `${prefix}row-start-${value}`),\n responsiveProp(rowEnd, (value, prefix) => `${prefix}row-end-${value}`)\n ],\n GRID_BREAKPOINTS\n ),\n subgrid && 'grid grid-cols-subgrid',\n subgrid && hasRowsClass(rows) && `grid-rows-${rows}`,\n subgrid && gapClassName(gap),\n className\n )\n\n const _style: GridItemStyle = { ...style }\n\n if (subgrid) {\n const _rows = rowsTemplate(rows)\n if (_rows !== undefined) _style.gridTemplateRows = _rows\n const _gap = gapValue(gap)\n if (_gap !== undefined) _style['--cx-grid-gap'] = _gap\n }\n\n return (\n <Component className={_className} style={_style} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const GridItem = createPolymorphicComponent<GridItemComponent>(\n GridItemRender as ForwardRefRenderFunction<Element, GridItemProps<ElementType>>,\n 'GridItem'\n)\n"],"mappings":"A,iMAyCA,SAASO,EACP,CAAE,WAAU,YAAW,YAAW,aAAY,QAAO,GAAGC,GACxD,EACA,CACA,IAAMC,EAAYC,GAAa,MACzBC,EAAaL,EAAW,YAAaM,GAAS,QAASC,EAAYC,CAAS,EAElF,MACE,kBAAA,cAACL,EAAD,CAAW,UAAWE,EAAY,GAAIH,EAAW,KAEtC,EADRO,CACQ,CAEf,CAEA,MAAaC,EAAYhB,EACvBO,EACA,WACF,EExDMU,kBAAiB,IAAI,IAAY,CDuDrC,OACA,MACA,MACA,MACA,KACA,KACA,KACA,KACA,KACA,MACA,MACA,MACA,MACA,KCpEqC,CAAO,EAKjCC,GAAgB,EAAyB,EAAS,KAC7DC,IAAQ,IAAA,IAAaF,EAAe,IAAIE,CAAG,EAAI,GAAGC,EAAO,MAAMD,IAAQ,KAE5DE,EAAY,GACvBF,IAAQ,IAAA,IAAa,CAACF,EAAe,IAAIE,CAAG,EAAIA,EAAM,IAAA,GCV3CG,EAAgB,GAC3BC,IAAS,IAAA,IAAa,OAAO,UAAUA,CAAI,GAAKA,GAAQ,GAAKA,GAAQ,EAI1DC,EAAgB,GAC3BD,IAAS,IAAA,IAAa,CAACD,EAAaC,CAAI,EAAI,UAAUA,EAAK,mBAAqB,IAAA,GCmG5EE,EA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,MACA,UACA,WACA,SACA,UACA,OACA,MACA,QACA,GAAGlC,GAEL,EACA,CACA,IAAMC,EAAYC,GAAa,MACzBC,EAAaL,EACjBJ,EACE,CACED,EAAe0C,GAAO,EAAO,IAAW,GAAGvB,EAAO,WAAWe,GAAO,EACpElC,EAAe2C,GAAQ,EAAO,IAAW,GAAGxB,EAAO,YAAYe,GAAO,EACtElC,EAAe4C,GAAM,EAAO,IAAW,GAAGzB,EAAO,UAAUe,GAAO,EAClElC,EAAe6C,GAAU,EAAO,IAAW,GAAG1B,EAAO,WAAWe,GAAO,EACvElC,EAAe8C,GAAW,EAAO,IAAW,GAAG3B,EAAO,YAAYe,GAAO,EACzElC,EAAe+C,GAAS,EAAO,IAAW,GAAG5B,EAAO,UAAUe,GAAO,CACvE,EACA/B,CACF,EACA6C,GAAW,yBACXA,GAAW3B,EAAaC,CAAI,GAAK,aAAaA,IAC9C0B,GAAW/B,EAAaC,CAAG,EAC3BL,CACF,EAEMsB,EAAwB,CAAE,GAAGC,CAAM,EAEzC,GAAIY,EAAS,CACX,IAAMT,EAAQhB,EAAaD,CAAI,EAC3BiB,IAAU,IAAA,KAAW,EAAO,iBAAmBA,GACnD,IAAMF,EAAOjB,EAASF,CAAG,EACrBmB,IAAS,IAAA,KAAW,EAAO,iBAAmBA,EACpD,CAEA,MACE,kBAAA,cAAC7B,EAAD,CAAW,UAAWE,EAAY,MAAOyB,EAAQ,GAAI5B,EAAW,KAErD,EADRO,CACQ,CAEf,CAEA,MAAamC,EAAWlD,EACtB0C,EACA,UACF,E"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-Bs80iIBN.js";import{t as e}from"./polymorphic-CZIFszAy.js";import{t}from"./useOverlayMaxHeight-DTgbr4UQ.js";import{i as n,r}from"./overlayPlacement-Q6bcbXA5.js";import{t as i}from"./Portal-BTDylxAi.js";import{n as a,r as o}from"./Menu-BiE9CzNk.js";import{a as s,c as ee,i as c,l as te,o as ne,r as l,s as u}from"./MenuToggle-W-ZSHFwF.js";import d,{forwardRef as f,useCallback as p,useContext as m,useEffect as h,useId as re,useRef as g,useState as ie}from"react";import _ from"classnames";import{useLocale as v,useOverlayPosition as ae}from"react-aria";function y({children:e,className:t,component:n,...r},i){let a=n??`span`,o=_(`menu-text`,t);return/* @__PURE__ */ d.createElement(a,{className:o,...r,ref:i},e)}const b=e(y,`MenuText`),x=f(({children:e,activation:f=`both`,className:y,disabled:b,offset:x=[-4,0],placement:S,stacked:C,submenuDelay:w=100,trigger:T,...E},oe)=>{let D=re(),O=`${D}-trigger`,k=`${D}-menu`,[A,j]=ie(!1),M=g(void 0),N=g(void 0),P=g(!1),F=g(null),I=g(null),L=m(c),se=ne(),{portalContainer:ce,registerOverlay:le,visible:R}=m(a),z=m(s),{direction:B}=v(),V=B===`rtl`,H=S??(V?`left-start`:`right-start`),{overlayProps:U,placement:ue}=ae({targetRef:F,overlayRef:I,placement:n(H),offset:x[1],crossOffset:x[0],containerPadding:8,isOpen:A,onClose:null});t(I,A);let{menuStyle:de,placementAttr:fe}=r(U.style,H,ue),W=p(()=>{M.current!==void 0&&(window.clearTimeout(M.current),M.current=void 0)},[]),G=p(()=>{N.current!==void 0&&(cancelAnimationFrame(N.current),N.current=void 0)},[]),K=p(()=>{W(),G(),j(!1)},[W,G]),q=()=>{b||A||(W(),L?.notifyOpen(D),j(!0))},J=()=>{W(),M.current=window.setTimeout(K,w)};h(()=>L?.register(D,K),[L,D,K]),h(()=>W,[W]),h(()=>G,[G]),h(()=>{(!R||!z)&&K()},[R,z,K]);let Y=typeof window<`u`&&!!window.matchMedia&&window.matchMedia(`(hover: hover)`).matches,X=Y&&(f===`hover`||f===`both`),Z=f!==`hover`||!Y,Q=()=>{q(),G(),N.current=requestAnimationFrame(()=>{N.current=void 0,u(ee(I.current),`first`)})},$=()=>{P.current=!0,K()};h(()=>{!A&&P.current&&F.current?.focus(),P.current=!1},[A]);let pe=e=>{e.preventDefault(),o.add(e.nativeEvent),Z&&!b&&(A?K():Q())},me=V?`ArrowLeft`:`ArrowRight`,he=e=>{b||(e.key===`Enter`||e.key===` `||e.key===me)&&(e.preventDefault(),e.stopPropagation(),Q())},ge={close:$};return/* @__PURE__ */ d.createElement(`div`,{className:_(`submenu`,{show:A},y),...E,ref:oe},/* @__PURE__ */ d.createElement(`button`,{type:`button`,id:O,role:`menuitem`,className:`menu-item`,"aria-expanded":A,"aria-haspopup":`true`,"aria-controls":A?k:void 0,disabled:b,onClick:pe,onKeyDown:he,onMouseEnter:X?q:void 0,onMouseLeave:X?J:void 0,ref:e=>{F.current=e}},T),(()=>{let t=/* @__PURE__ */ d.createElement(`div`,{role:`menu`,id:k,"aria-labelledby":O,className:_(`menu`,{show:A,"submenu-stacked":C}),style:de,"data-cx-placement":fe,onKeyDown:e=>te(e,{onEscape:$,...V?{onArrowRight:$}:{onArrowLeft:$}}),onMouseEnter:X?W:void 0,onMouseLeave:X?J:void 0,ref:e=>{I.current=e,le(k,e)}},/* @__PURE__ */ d.createElement(l.Provider,{value:ge},/* @__PURE__ */ d.createElement(c.Provider,{value:se},/* @__PURE__ */ d.createElement(s.Provider,{value:A},e))));return C?t:/* @__PURE__ */ d.createElement(i,{container:ce,fallback:t},t)})())});x.displayName=`MenuSubmenu`;const S=f(({children:e,className:t,onClick:n,type:r=`button`,...i},a)=>{let o=m(l),s=e=>{n?.(e),o&&(e.stopPropagation(),o.close())};return/* @__PURE__ */ d.createElement(`button`,{type:r,role:`menuitem`,className:_(`submenu-back`,`menu-item`,t),...i,onClick:s,ref:a},e)});S.displayName=`MenuSubmenuBack`;export{x as n,b as r,S as t};
|
|
2
|
-
//# sourceMappingURL=menu-Bqlhottl.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-Bs80iIBN.js";import{y as e}from"./slot-BQVx1Eew.js";import{t}from"./polymorphic-CZIFszAy.js";import{t as n}from"./useIsomorphicLayoutEffect-BbqRwuqn.js";import{t as r}from"./useDialogElement-BfygWBPZ.js";import{t as i}from"./CloseButton-BPUI5iGX.js";import{t as a}from"./useDialogTitle-DiB4YDGI.js";import o,{createContext as s,forwardRef as c,useContext as l,useId as u}from"react";import d from"classnames";const f=s({close:()=>{}}),p=s(()=>()=>{}),m=c(({children:e,backdrop:t=!0,className:n,defaultVisible:i,fullscreen:s,instant:c,keyboard:l=!0,modal:m=!0,onClick:h,onClose:g,onClosePrevented:_,onHidden:v,onKeyDown:y,onShow:b,onShown:x,onVisibleChange:S,scrollable:C,size:w,open:T,visible:E,...D},O)=>{let{close:k,forkedRef:A,handleBackdropClick:j,handleCancel:M,handleKeyDown:N,handleNativeClose:P,hiding:F,staticBounce:I}=r({backdrop:t,defaultVisible:i,instant:c,isModal:m,keyboard:l,onClick:h,onClose:g,onClosePrevented:_,onHidden:v,onKeyDown:y,onShow:b,onShown:x,onVisibleChange:S,open:T,ref:O,visible:E}),L=u(),[R,z]=a(L),B=d(`modal`,`dialog`,{[typeof s==`boolean`?`fullscreen`:`max-${s}:fullscreen`]:s,[`${w}`]:w,instant:c,nonmodal:!m,scrollable:C,hiding:F,"dialog-static":I},n);return/* @__PURE__ */ o.createElement(f.Provider,{value:{close:k,titleId:L}},/* @__PURE__ */ o.createElement(p.Provider,{value:z},/* @__PURE__ */ o.createElement(`dialog`,{"aria-labelledby":D[`aria-label`]?void 0:R,...D,open:T,className:B,onCancel:M,onClick:j,onClose:P,onKeyDown:N,ref:A},e)))});m.displayName=`Modal`;function h({children:e,className:t,component:n,...r},i){let a=n??`div`,s=d(`modal-body`,t);return/* @__PURE__ */ o.createElement(a,{className:s,...r,ref:i},e)}const g=t(h,`ModalBody`);function _({children:e,className:t,component:n,stacked:r,...i},a){let s=n??`div`,c=d(`modal-footer`,{stacked:r},t);return/* @__PURE__ */ o.createElement(s,{className:c,...i,ref:a},e)}const v=t(_,`ModalFooter`),y=()=>l(f);function b({children:e,className:t,closeButton:n=!0,closeLabel:r,component:a,...s},c){let l=a??`div`,{close:u}=y(),f=d(`modal-header`,t);return/* @__PURE__ */ o.createElement(l,{className:f,...s,ref:c},e,n&&/* @__PURE__ */ o.createElement(i,{label:r,onClick:u}))}const x=t(b,`ModalHeader`);function S({children:t,component:r,className:i,id:a,...s},c){let{titleId:u}=y(),f=l(p),m=r??`h2`,h=d(`modal-title`,i),g=e(m)??a??u;return n(()=>g?f(g):void 0,[f,g]),/* @__PURE__ */ o.createElement(m,{className:h,id:g,...s,ref:c},t)}const C=t(S,`ModalTitle`);export{g as a,v as i,x as n,m as o,y as r,C as t};
|
|
2
|
-
//# sourceMappingURL=modal-CHvsDTyl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"modal-CHvsDTyl.js","names":["resolveSlottedId","useIsomorphicLayoutEffect","useDialogElement","CloseButton","useDialogTitle","React","classNames","ModalContext","createContext","ModalTitleContext","Modal","forwardRef","rest","modal","titleId","useId","labelledBy","registerTitle","_className","fullscreen","size","staticBounce","className","handleCancel","handleBackdropClick","handleNativeClose","handleKeyDown","forkedRef","children","ModalBodyRender","Component","component","ModalBody","createPolymorphicComponent","ModalFooterRender","ModalFooter","useModal","useContext","ModalHeaderRender","closeButton","closeLabel","close","ModalHeader","ModalTitleRender","resolvedId","id","ModalTitle"],"sources":["../../src/components/modal/Modal.tsx","../../src/components/modal/ModalBody.tsx","../../src/components/modal/ModalFooter.tsx","../../src/components/modal/useModal.ts","../../src/components/modal/ModalHeader.tsx","../../src/components/modal/ModalTitle.tsx"],"sourcesContent":["import React, { createContext, DialogHTMLAttributes, forwardRef, useId } from 'react'\nimport classNames from 'classnames'\n\nimport { useDialogElement } from '../../hooks'\nimport { RegisterDialogTitle, useDialogTitle } from '../../hooks/useDialogTitle'\n\nexport interface ModalProps extends Omit<\n DialogHTMLAttributes<HTMLDialogElement>,\n 'onCancel' | 'onClose'\n> {\n /**\n * Show a backdrop while the modal is open. `'static'` blocks closing on backdrop click\n * (the modal bounces instead). `false` is intentionally not equivalent to `modal={false}` —\n * unlike `Drawer`, whose vanilla chassis-css counterpart derives modality from `backdrop`,\n * chassis-css's vanilla `Dialog` only ever reads `backdrop` to distinguish `'static'` from\n * everything else; `modal` alone decides `showModal()`/`show()`. This mirrors that faithfully\n * rather than reintroducing an inconsistency with the vendored behavior.\n */\n backdrop?: boolean | 'static'\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Whether the modal is open when it first renders. Such a modal 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 * Set modal to cover the entire user viewport. A breakpoint value goes fullscreen only\n * below that breakpoint.\n */\n fullscreen?: boolean | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n /**\n * Disable the open/close transition entirely.\n */\n instant?: boolean\n /**\n * Closes the modal when the escape key is pressed.\n */\n keyboard?: boolean\n /**\n * Open with `showModal()` (top-layer, native backdrop). Set `false` to open with `show()`\n * instead — no backdrop, and the page behind the modal stays interactive.\n */\n modal?: boolean\n /**\n * Renders the modal 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 modal requests to be closed (escape, backdrop click, or close button).\n */\n onClose?: () => void\n /**\n * Callback fired when a close attempt is blocked (static backdrop click, or escape with `keyboard=false`).\n */\n onClosePrevented?: () => void\n /**\n * Callback fired after the exit transition completes and the modal is fully hidden.\n */\n onHidden?: () => void\n /**\n * Callback fired when the modal starts to open.\n */\n onShow?: () => void\n /**\n * Callback fired after the entry transition completes and the modal is fully visible.\n */\n onShown?: () => void\n /**\n * Callback fired with `false` when the modal requests 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 * Create a scrollable modal — the header and footer stay fixed while the body scrolls.\n */\n scrollable?: boolean\n /**\n * Size the component sm, lg, or extra lg.\n */\n size?: 'sm' | 'lg' | 'xl'\n /**\n * Whether the modal is open. The modal is then controlled: a close request only fires\n * `onClose` and `onVisibleChange`, and the modal closes when this becomes `false`.\n */\n visible?: boolean\n}\n\nexport interface ModalContextProps {\n /**\n * Requests the modal be closed — fires `onClose`. Wire this to any element's `onClick`; see\n * `useModal`.\n */\n close: () => void\n /**\n * Id generated by `Modal` and applied automatically by `ModalTitle` to itself, so the\n * dialog's `aria-labelledby` resolves to it without any manual wiring.\n */\n titleId?: string\n}\n\nexport const ModalContext = createContext<ModalContextProps>({ close: () => {} })\n\n// How a rendered `ModalTitle` tells its `Modal` the id it has (`useDialogTitle`). Apart from\n// `ModalContext`, whose value `useModal` returns to callers.\nexport const ModalTitleContext = createContext<RegisterDialogTitle>(() => () => {})\n\nexport const Modal = forwardRef<HTMLDialogElement, ModalProps>(\n (\n {\n children,\n backdrop = true,\n className,\n defaultVisible,\n fullscreen,\n instant,\n keyboard = true,\n modal = true,\n onClick,\n onClose,\n onClosePrevented,\n onHidden,\n onKeyDown,\n onShow,\n onShown,\n onVisibleChange,\n scrollable,\n size,\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: modal,\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 titleId = useId()\n // Labelled by the title that is rendered, under the id it has, unless the caller names the\n // dialog itself: `aria-labelledby` would outrank that `aria-label`.\n const [labelledBy, registerTitle] = useDialogTitle(titleId)\n\n const _className = classNames(\n 'modal',\n 'dialog',\n {\n [typeof fullscreen === 'boolean' ? 'fullscreen' : `max-${fullscreen}:fullscreen`]:\n fullscreen,\n [`${size}`]: size,\n instant,\n nonmodal: !modal,\n scrollable,\n hiding,\n 'dialog-static': staticBounce\n },\n className\n )\n\n return (\n <ModalContext.Provider value={{ close, titleId }}>\n <ModalTitleContext.Provider value={registerTitle}>\n <dialog\n aria-labelledby={rest['aria-label'] ? undefined : labelledBy}\n {...rest}\n open={open}\n className={_className}\n onCancel={handleCancel}\n onClick={handleBackdropClick}\n onClose={handleNativeClose}\n onKeyDown={handleKeyDown}\n ref={forkedRef}\n >\n {children}\n </dialog>\n </ModalTitleContext.Provider>\n </ModalContext.Provider>\n )\n }\n)\n\nModal.displayName = 'Modal'\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 ModalBodyOwnProps<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 ModalBodyProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n ModalBodyOwnProps<C>\n>\n\ntype ModalBodyComponent = (<C extends ElementType = 'div'>(\n props: ModalBodyProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction ModalBodyRender<C extends ElementType = 'div'>(\n { children, className, component, ...rest }: ModalBodyProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames('modal-body', className)\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const ModalBody = createPolymorphicComponent<ModalBodyComponent>(\n ModalBodyRender as ForwardRefRenderFunction<Element, ModalBodyProps<ElementType>>,\n 'ModalBody'\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 ModalFooterOwnProps<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 * Stack the footer actions as full-width columns instead of a right-aligned row.\n */\n stacked?: boolean\n}\n\nexport type ModalFooterProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n ModalFooterOwnProps<C>\n>\n\ntype ModalFooterComponent = (<C extends ElementType = 'div'>(\n props: ModalFooterProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction ModalFooterRender<C extends ElementType = 'div'>(\n { children, className, component, stacked, ...rest }: ModalFooterProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames('modal-footer', { stacked }, className)\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const ModalFooter = createPolymorphicComponent<ModalFooterComponent>(\n ModalFooterRender as ForwardRefRenderFunction<Element, ModalFooterProps<ElementType>>,\n 'ModalFooter'\n)\n","import { useContext } from 'react'\nimport { ModalContext, ModalContextProps } from './Modal'\n\nexport type UseModalResult = ModalContextProps\n\n// Reach the enclosing `Modal`'s close handler from anywhere in its composed markup — e.g. to\n// close it from a plain `Button` placed in a `ModalFooter`. Only meaningful inside a `Modal`;\n// outside one it returns a no-op `close`.\nexport const useModal = (): UseModalResult => useContext(ModalContext)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport { useModal } from './useModal'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { CloseButton } from '../close-button/CloseButton'\n\ntype ModalHeaderOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Add a close button component to the header.\n */\n closeButton?: boolean\n /**\n * Overrides the close button's accessible name (defaults to `'Close'`). Set this for\n * non-English UIs.\n */\n closeLabel?: 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 ModalHeaderProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n ModalHeaderOwnProps<C>\n>\n\ntype ModalHeaderComponent = (<C extends ElementType = 'div'>(\n props: ModalHeaderProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction ModalHeaderRender<C extends ElementType = 'div'>(\n { children, className, closeButton = true, closeLabel, component, ...rest }: ModalHeaderProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const { close } = useModal()\n const _className = classNames('modal-header', className)\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n {closeButton && <CloseButton label={closeLabel} onClick={close} />}\n </Component>\n )\n}\n\nexport const ModalHeader = createPolymorphicComponent<ModalHeaderComponent>(\n ModalHeaderRender as ForwardRefRenderFunction<Element, ModalHeaderProps<ElementType>>,\n 'ModalHeader'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement, useContext } from 'react'\nimport classNames from 'classnames'\n\nimport { useIsomorphicLayoutEffect } from '../../hooks'\nimport { ModalTitleContext } from './Modal'\nimport { useModal } from './useModal'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { resolveSlottedId } from '../../utils/elementKind'\n\ntype ModalTitleOwnProps<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 ModalTitleProps<C extends ElementType = 'h2'> = PolymorphicComponentProps<\n C,\n ModalTitleOwnProps<C>\n>\n\ntype ModalTitleComponent = (<C extends ElementType = 'h2'>(\n props: ModalTitleProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction ModalTitleRender<C extends ElementType = 'h2'>(\n { children, component, className, id, ...rest }: ModalTitleProps<C>,\n ref: PolymorphicRef<C>\n) {\n const { titleId } = useModal()\n const registerTitle = useContext(ModalTitleContext)\n const Component = component ?? 'h2'\n const _className = classNames('modal-title', className)\n // Under `asChild` the child's own `id` is the one rendered (`Slot`), so it is the one registered.\n const resolvedId = resolveSlottedId(Component) ?? id ?? titleId\n\n // The modal is labelled by this title, under the id it has here.\n useIsomorphicLayoutEffect(\n () => (resolvedId ? registerTitle(resolvedId) : undefined),\n [registerTitle, resolvedId]\n )\n\n return (\n <Component className={_className} id={resolvedId} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const ModalTitle = createPolymorphicComponent<ModalTitleComponent>(\n ModalTitleRender as ForwardRefRenderFunction<Element, ModalTitleProps<ElementType>>,\n 'ModalTitle'\n)\n"],"mappings":"A,6aAyGA,MAAaO,EAAeC,EAAiC,CAAE,UAAa,CAAC,CAAE,CAAC,EAInEC,EAAoBD,UAA+C,CAAC,CAAC,EAErEE,EAAQC,GAEjB,CACE,WACA,WAAW,GACX,YACA,iBACA,aACA,UACA,WAAW,GACX,QAAQ,GACR,UACA,UACA,mBACA,WACA,YACA,SACA,UACA,kBACA,aACA,OACA,OACA,UACA,GAAGC,GAEL,IACG,CACH,GAAM,CACJ,QACA,YACA,sBACA,eACA,gBACA,oBACA,SACA,gBACEV,EAAiB,CACnB,WACA,iBACA,UACA,QAASW,EACT,WACA,UACA,UACA,mBACA,WACA,YACA,SACA,UACA,kBACA,OACA,MACA,SACF,CAAC,EAEKC,EAAUC,EAAM,EAGhB,CAACC,EAAYC,GAAiBb,EAAeU,CAAO,EAEpDI,EAAaZ,EACjB,QACA,SACA,EACG,OAAOa,GAAe,UAAY,aAAe,OAAOA,EAAW,cAClEA,GACD,GAAGC,KAASA,EACb,UACA,SAAU,CAACP,EACX,aACA,SACA,gBAAiBQ,CACnB,EACAC,CACF,EAEA,MACE,kBAAA,cAACf,EAAa,SAAd,CAAuB,MAAO,CAAE,QAAO,SAAQ,CAgBxB,EAfrB,kBAAA,cAACE,EAAkB,SAAnB,CAA4B,MAAOQ,CAcP,EAb1B,kBAAA,cAAC,SAAD,CACE,kBAAiBL,EAAK,cAAgB,IAAA,G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5CqB,EAAYC,GAAa,KACzBb,EAAaZ,EAAW,cAAegB,CAAS,EAEhDsB,EAAa5C,EAAiB8B,CAAS,GAAKe,GAAM/B,EAQxD,OALAb,MACS2C,EAAa3B,EAAc2B,CAAU,EAAI,IAAA,GAChD,CAAC3B,EAAe2B,CAAU,CAC5B,EAGE,kBAAA,cAACd,EAAD,CAAW,UAAWZ,EAAY,GAAI0B,EAAY,GAAIhC,EAAW,KAEtD,EADRgB,CACQ,CAEf,CAEA,MAAakB,EAAab,EACxBU,EACA,YACF,E"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-Bs80iIBN.js";import{S as e,d as t,g as n}from"./slot-BQVx1Eew.js";import{t as r}from"./useForkedRef-WoqMqsWE.js";import{t as i}from"./polymorphic-CZIFszAy.js";import{t as a}from"./Link-DE8NSAXJ.js";import{a as o,i as s,o as c,r as l,s as u}from"./navOverflow-C_QJmkPM.js";import{t as d}from"./navVariant-D4wiKS8I.js";import f,{forwardRef as p}from"react";import m from"classnames";function h({children:e,className:t,...n},r){let i=m(`nav-link`,t),s=c();return/* @__PURE__ */ f.createElement(f.Fragment,null,/* @__PURE__ */ f.createElement(a,{className:i,...n,ref:r},e),s&&/* @__PURE__ */ f.createElement(o,{props:{...n,children:e}}))}const g=i(h,`NavLink`),_=/* @__PURE__ */ new Set([`active`,`color`,`disabled`,`iconLink`,`reset`,`stretched`,`type`]);function v({children:n,className:i,keepVisible:a,...o},s){let c=m(`nav-item`,{"nav-overflow-keep":a},i),{asChild:d,component:p,href:h}=o,v=u(),y=r(s,v.ref),b=v.hidden?{"data-cx-nav-overflow":`true`}:void 0;if(t(h)||p!==void 0||d)return/* @__PURE__ */ f.createElement(`li`,{className:c,...b,ref:y},/* @__PURE__ */ f.createElement(l,{value:v.scope},/* @__PURE__ */ f.createElement(g,o,n)));let{active:x,disabled:S}=o,C=Object.fromEntries(Object.entries(o).filter(([e])=>!_.has(e)));return e(!!x||!!S,"NavItem: `active` and `disabled` style its link, and without `href`, `component` or `asChild` it renders none. Put them on the link inside it."),/* @__PURE__ */ f.createElement(`li`,{className:c,...C,...b,ref:y},/* @__PURE__ */ f.createElement(l,{value:v.scope},n))}const y=p(v);y.displayName=`NavItem`;function b({children:e,className:t,component:r,items:i,layout:a,size:o,variant:c,...l},u){let p=r??`ul`,h=m(`nav`,o,{[`nav-${a}`]:a},d(c,`Nav`),t),g=i?i.map((e,t)=>/* @__PURE__ */ f.createElement(y,{key:t,active:e.active,disabled:e.disabled,href:e.href},e.label)):null;return/* @__PURE__ */ f.createElement(p,{className:h,...l,ref:u},/* @__PURE__ */ f.createElement(s,{tag:n(p)},g??e))}const x=i(b,`Nav`),S=p(({children:e,className:t,...n},r)=>{let i=m(`nav-title`,t);return/* @__PURE__ */ f.createElement(`li`,{className:i,...n,ref:r},e)});S.displayName=`NavTitle`;export{g as i,x as n,y as r,S as t};
|
|
2
|
-
//# sourceMappingURL=nav-B4U_Hqs7.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nav-B4U_Hqs7.js","names":["devWarning","hasHref","resolveElementTag","useForkedRef","createPolymorphicComponent","Link","NavOverflowLink","NavOverflowItems","useIsNavOverflowLink","NavOverflowItemScope","useNavOverflowItem","navVariantClassName","React","classNames","NavLinkRender","rest","_className","className","isOverflowLink","children","NavLink","LINK_ONLY_PROPS","NavItemRender","keepVisible","overflow","forkedRef","ref","overflowProps","href","component","asChild","itemProps","key","active","disabled","NavItem","forwardRef","NavRender","Component","size","layout","variant","autoContent","items","idx","item","Nav","NavTitle"],"sources":["../../src/components/nav/NavLink.tsx","../../src/components/nav/NavItem.tsx","../../src/components/nav/Nav.tsx","../../src/components/nav/NavTitle.tsx"],"sourcesContent":["import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport { NavOverflowLink, useIsNavOverflowLink } from '../../utils/navOverflow'\nimport { createPolymorphicComponent, PolymorphicRef } from '../../utils/polymorphic'\nimport { LinkProps, Link } from '../link/Link'\n\ntype NavLinkOwnProps = {\n /**\n * Toggle the active state for the component.\n */\n active?: boolean\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Toggle the disabled state for the component.\n */\n disabled?: boolean\n}\n\nexport type NavLinkProps<C extends ElementType = 'a'> = LinkProps<C> & NavLinkOwnProps\n\ntype NavLinkComponent = (<C extends ElementType = 'a'>(\n props: NavLinkProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction NavLinkRender<C extends ElementType = 'a'>(\n { children, className, ...rest }: NavLinkProps<C>,\n ref: PolymorphicRef<C>\n) {\n const _className = classNames('nav-link', className)\n // Inside a `NavOverflow`, the link of an item that doesn't fit is shown in the menu instead, as\n // a `MenuItem` with these props.\n const isOverflowLink = useIsNavOverflowLink()\n\n return (\n <>\n <Link\n className={_className}\n {...(rest as Record<string, unknown>)}\n ref={ref as PolymorphicRef<ElementType>}\n >\n {children}\n </Link>\n {isOverflowLink && <NavOverflowLink props={{ ...rest, children }} />}\n </>\n )\n}\n\nexport const NavLink = createPolymorphicComponent<NavLinkComponent>(\n NavLinkRender as ForwardRefRenderFunction<Element, NavLinkProps<ElementType>>,\n 'NavLink'\n)\n","import React, {\n ElementType,\n ForwardRefRenderFunction,\n forwardRef,\n ReactElement,\n ReactNode,\n Ref\n} from 'react'\nimport classNames from 'classnames'\n\nimport { useForkedRef } from '../../hooks'\nimport { devWarning } from '../../utils/devWarning'\nimport { hasHref } from '../../utils/elementKind'\nimport { NavOverflowItemScope, useNavOverflowItem } from '../../utils/navOverflow'\nimport { NavLink, NavLinkProps } from './NavLink'\n\nexport type NavItemProps<C extends ElementType = 'a'> = NavLinkProps<C> & {\n /**\n * Keeps the item in the list inside a `NavOverflow`, whatever the width.\n */\n keepVisible?: boolean\n}\n\ntype NavItemComponent = (<C extends ElementType = 'a'>(\n props: NavItemProps<C> & { ref?: Ref<HTMLLIElement> }\n) => ReactElement | null) & { displayName?: string }\n\nconst LINK_ONLY_PROPS = new Set([\n 'active',\n 'color',\n 'disabled',\n 'iconLink',\n 'reset',\n 'stretched',\n 'type'\n])\n\n// A `.nav-item` wrapping a `.nav-link` when there is a link to render: an `href`, or a `component`\n// or `asChild` element, which `NavLink` renders. Otherwise a bare `<li>` around `children`, such as\n// a `MenuToggle`. Only the `<li>` takes the caller's own attributes then: `active`, `disabled` and\n// the other `NavLink` props style a link, and on the `<li>` they were written out as invalid\n// attributes (`disabled=\"\"`, `component=\"button\"`).\nfunction NavItemRender<C extends ElementType = 'a'>(\n { children, className, keepVisible, ...rest }: NavItemProps<C>,\n ref: Ref<HTMLLIElement>\n) {\n const _className = classNames('nav-item', { 'nav-overflow-keep': keepVisible }, className)\n const { asChild, component, href } = rest as {\n asChild?: boolean\n component?: ElementType\n href?: string\n }\n // Inside a `NavOverflow`: the `<li>` is what it measures, and hides when the item is in the\n // menu. chassis-css hides it by this attribute.\n const overflow = useNavOverflowItem()\n const forkedRef = useForkedRef(ref, overflow.ref)\n const overflowProps = overflow.hidden ? { 'data-cx-nav-overflow': 'true' } : undefined\n\n if (hasHref(href) || component !== undefined || asChild) {\n return (\n <li className={_className} {...overflowProps} ref={forkedRef}>\n <NavOverflowItemScope value={overflow.scope}>\n <NavLink {...(rest as Record<string, unknown>)}>{children as ReactNode}</NavLink>\n </NavOverflowItemScope>\n </li>\n )\n }\n\n const { active, disabled } = rest as NavLinkProps<'a'>\n const itemProps = Object.fromEntries(\n Object.entries(rest).filter(([key]) => !LINK_ONLY_PROPS.has(key))\n )\n devWarning(\n !!active || !!disabled,\n 'NavItem: `active` and `disabled` style its link, and without `href`, `component` or ' +\n '`asChild` it renders none. Put them on the link inside it.'\n )\n return (\n <li className={_className} {...itemProps} {...overflowProps} ref={forkedRef}>\n <NavOverflowItemScope value={overflow.scope}>{children}</NavOverflowItemScope>\n </li>\n )\n}\n\nexport const NavItem = forwardRef(\n NavItemRender as ForwardRefRenderFunction<HTMLLIElement, NavItemProps<ElementType>>\n) as NavItemComponent\n\nNavItem.displayName = 'NavItem'\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport { resolveElementTag } from '../../utils/elementKind'\nimport { NavOverflowItems } from '../../utils/navOverflow'\nimport { NavVariant, navVariantClassName } from '../../utils/navVariant'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { NavItem } from './NavItem'\n\nexport interface NavItemDef {\n /**\n * Label content for the nav item.\n */\n label: React.ReactNode\n /**\n * URL for the nav link.\n */\n href?: string\n /**\n * Marks the item as active.\n */\n active?: boolean\n /**\n * Marks the item as disabled.\n */\n disabled?: boolean\n}\n\ntype NavOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n /**\n * Array of nav item definitions for data-driven rendering. When provided, children are ignored.\n */\n items?: NavItemDef[]\n /**\n * Specify a layout type for component.\n */\n layout?: 'fill' | 'justified'\n /**\n * Size the component sm or lg.\n */\n size?: 'sm' | 'lg'\n /**\n * Set the nav variant to tabs, to segments (a segmented control) or to underline, which\n * underlines the active link. `'pills'` is the former name of `'segments'`: deprecated, it\n * renders the same.\n *\n * @type { 'tabs' | 'segments' | 'underline' | 'pills' }\n */\n variant?: NavVariant\n}\n\nexport type NavProps<C extends ElementType = 'ul'> = PolymorphicComponentProps<C, NavOwnProps<C>>\n\ntype NavComponent = (<C extends ElementType = 'ul'>(\n props: NavProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction NavRender<C extends ElementType = 'ul'>(\n { children, className, component, items, layout, size, variant, ...rest }: NavProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'ul'\n const _className = classNames(\n 'nav',\n size,\n { [`nav-${layout}`]: layout },\n navVariantClassName(variant, 'Nav'),\n className\n )\n\n const autoContent = items\n ? items.map((item, idx) => (\n <NavItem\n // eslint-disable-next-line react/no-array-index-key\n key={idx}\n active={item.active}\n disabled={item.disabled}\n href={item.href}\n >\n {item.label}\n </NavItem>\n ))\n : null\n\n // No `role`: `navigation` on the `<ul>` took away its list semantics, and `ul` doesn't allow\n // that role. A landmark is the caller's `<nav>` around it, or `component=\"nav\"` holding\n // `NavLink`s without items.\n return (\n <Component className={_className} {...rest} ref={ref}>\n {/* Inside a `NavOverflow`, the items it collapses and its toggle item. */}\n <NavOverflowItems tag={resolveElementTag(Component)}>\n {autoContent ?? children}\n </NavOverflowItems>\n </Component>\n )\n}\n\nexport const Nav = createPolymorphicComponent<NavComponent>(\n NavRender as ForwardRefRenderFunction<Element, NavProps<ElementType>>,\n 'Nav'\n)\n","import React, { forwardRef, HTMLAttributes } from 'react'\nimport classNames from 'classnames'\n\nexport interface NavTitleProps extends HTMLAttributes<HTMLLIElement> {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n}\n\nexport const NavTitle = forwardRef<HTMLLIElement, NavTitleProps>(\n ({ children, className, ...rest }, ref) => {\n const _className = classNames('nav-title', className)\n return (\n <li className={_className} {...rest} ref={ref}>\n {children}\n </li>\n )\n }\n)\n\nNavTitle.displayName = 'NavTitle'\n"],"mappings":"A,iZA4BA,SAASc,EACP,CAAE,WAAU,YAAW,GAAGC,GAC1B,EACA,CACA,IAAMC,EAAaH,EAAW,WAAYI,CAAS,EAG7CC,EAAiBV,EAAqB,EAE5C,MACE,kBAAA,cAAAI,EAAA,SAAA,KACE,kBAAA,cAACP,EAAD,CACE,UAAWW,EACX,GAAKD,EACA,KAGD,EADHI,CACG,EACLD,GAAkB,kBAAA,cAACZ,EAAD,CAAiB,MAAO,CAAE,GAAGS,EAAM,UAAS,CAAI,CAAA,CACnE,CAEN,CAEA,MAAaK,EAAUhB,EACrBU,EACA,SACF,EC3BMO,kBAAkB,IAAI,IAAI,CAC9B,SACA,QACA,WACA,WACA,QACA,YACA,MACF,CAAC,EAOD,SAASC,EAC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AEE,IAAKS,EACL,OAAQC,EAAK,OACb,SAAUA,EAAK,SACf,KAAMA,EAAK,IAGJ,EADNA,EAAK,KACC,CACV,EACD,KAKJ,MACE,kBAAA,cAACP,EAAD,CAAW,UAAWtB,EAAY,GAAID,EAAW,KAKtC,EAHT,kBAAA,cAACR,EAAD,CAAkB,IAAKL,EAAkBoC,CAAS,CAEhC,EADfI,GAAevB,CACA,CACT,CAEf,CAEA,MAAa2B,EAAM1C,EACjBiC,EACA,KACF,ECtGaU,EAAWX,GACrB,CAAE,WAAU,YAAW,GAAGrB,GAAQ,IAAQ,CACzC,IAAMC,EAAaH,EAAW,YAAaI,CAAS,EACpD,MACE,kBAAA,cAAC,KAAD,CAAI,UAAWD,EAAY,GAAID,EAAW,KAEtC,EADDI,CACC,CAER,CACF,EAEA,EAAS,YAAc,W"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-Bs80iIBN.js";import{t as e}from"./useForkedRef-WoqMqsWE.js";import{t}from"./useControllableState-CPUJxfKW.js";import{t as n}from"./useFormField-DH2tlc3e.js";import{t as r}from"./useHeldBack-eeTfpa_t.js";import{t as i}from"./renderFormField-_6WswnEX.js";import{t as a}from"./direction-LN6uwsK5.js";import{t as o}from"./validationClassName-gRGs4KBm.js";import s,{Fragment as c,forwardRef as l,useEffect as u,useMemo as d,useRef as f}from"react";import p from"classnames";import{mergeProps as m,useFocusRing as h,useObjectRef as g,useTextField as _}from"react-aria";const v=l(({disabled:e,index:t,invalid:n,mask:r,onChangeValue:i,onFocusBox:a,onKeyDownBox:c,onPasteBox:l,required:u,size:d,valid:f,value:v},y)=>{let b=g(y),{focusProps:x,isFocusVisible:S}=h(),{inputProps:C}=_({"aria-label":`Digit ${t+1}`,autoComplete:t===0||r?`one-time-code`:`off`,isDisabled:e,isInvalid:n,isRequired:u,maxLength:1,onFocus:e=>{e.target.select(),a()},onKeyDown:c,type:r?`password`:`text`,value:v},b);return/* @__PURE__ */ s.createElement(`input`,{...m(C,x),"aria-describedby":void 0,"aria-required":void 0,className:p(`form-input`,d,o(n,f)),"data-focus-visible":S||void 0,inputMode:`numeric`,onChange:e=>i(e.target.value),onPaste:l,pattern:`\\d*`,ref:b,required:u||void 0})});v.displayName=`OtpBox`;const y=e=>e.replace(/\D/g,``),b=(e,t)=>{let n=[...y(e)].slice(0,t);return Array.from({length:t},(e,t)=>n[t]??``)},x=l(({className:l,defaultValue:m,disabled:h,groupSizes:g,help:_,id:x,inputGroup:S,invalid:C,invalidFeedback:w,label:T,length:E=6,mask:D,name:O,onChange:k,onComplete:A,required:ee,separator:te=`–`,size:ne,valid:j,validFeedback:M,value:N,...P},F)=>{let I=g&&g.length>0?g.reduce((e,t)=>e+t,0):E,[L,R]=t(N,m??``,k),z=d(()=>b(L,I),[L,I]),B=f([]),V=e=>B.current[e]?.focus(),H=f(null),U=e(F,H),{invalid:W,valid:G}=r(H,{invalid:C,valid:j}),K=f(z);K.current=z;let q=e=>{let t=K.current.indexOf(``);t!==-1&&e>t&&V(t)},J=f(()=>{});J.current=()=>{let e=m??``;e!==L&&R(e)},u(()=>{let e=B.current[0]?.form;if(!e)return;let t=()=>J.current();return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)},[]);let Y=e=>{K.current=e;let t=e.join(``);R(t),e.length===I&&e.every(e=>e!==``)&&A?.(t)},X=(e,t)=>{let n=y(t);if(n.length>1){let t=[...n],r=[...z];for(let n=0;n<t.length&&e+n<I;n++)r[e+n]=t[n];Y(r),V(Math.min(e+t.length,I-1));return}let r=[...z];r[e]=n,Y(r),n&&e<I-1&&V(e+1)},re=(e,t)=>{if(!h)switch(t.key){case`Backspace`:if(!z[e]&&e>0){t.preventDefault();let n=[...z];n[e-1]=``,Y(n),V(e-1)}break;case`Delete`:{t.preventDefault();let n=[...z];for(let t=e;t<I-1;t++)n[t]=n[t+1];n[I-1]=``,Y(n);break}case`ArrowLeft`:case`ArrowRight`:{let n=t.key===`ArrowRight`===a(t.currentTarget)?e-1:e+1;n>=0&&n<I&&(t.preventDefault(),V(n));break}}},ie=e=>{if(e.preventDefault(),h)return;let t=y(e.clipboardData.getData(`text`)).slice(0,I);t&&(Y(b(t,I)),V(Math.min(t.length,I-1)))},Z=(e,t)=>Array.from({length:t},(t,n)=>e+n).map(e=>/* @__PURE__ */ s.createElement(v,{disabled:h,index:e,invalid:W,key:e,mask:D,onChangeValue:t=>X(e,t),onFocusBox:()=>q(e),onKeyDownBox:t=>re(e,t),onPasteBox:ie,ref:t=>{B.current[e]=t},required:ee,size:ne,valid:G,value:z[e]??``})),Q;if(g&&g.length>0){let e=0;Q=g.map((t,n)=>{let r=e;return e+=t,/* @__PURE__ */ s.createElement(c,{key:n},n>0&&/* @__PURE__ */ s.createElement(`span`,{className:`form-otp-separator`},te),S?/* @__PURE__ */ s.createElement(`div`,{className:`input-group`},Z(r,t)):Z(r,t))})}else Q=Z(0,I);let{describedBy:ae,feedbackId:oe,helpId:se,inputId:ce,labelId:le,labelledBy:$}=n({ariaDescribedBy:P[`aria-describedby`],ariaLabelledBy:P[`aria-labelledby`],help:_,id:x,invalid:W,invalidFeedback:w,label:T,valid:G,validFeedback:M});return i({children:/* @__PURE__ */ s.createElement(`div`,{...P,"aria-describedby":ae,"aria-labelledby":$,className:p(`form-otp`,{"input-group":S&&!(g&&g.length>0)},o(W,G),l),id:ce,ref:U,role:`group`},Q,O&&/* @__PURE__ */ s.createElement(`input`,{disabled:h,name:O,type:`hidden`,value:z.join(``)})),help:_,ids:{feedback:oe,help:se,label:le},invalid:W,invalidFeedback:w,label:T,valid:G,validFeedback:M})});x.displayName=`OtpInput`;export{x as t};
|
|
2
|
-
//# sourceMappingURL=otp-input-DUtCMg8P.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"otp-input-DUtCMg8P.js","names":["useForkedRef","useFormField","useHeldBack","renderFormField","isRTL","validationClassName","React","classNames","OtpBox","forwardRef","ref","useObjectRef","forwardedRef","useFocusRing","useTextField","index","mask","disabled","invalid","required","event","onFocusBox","onKeyDownBox","mergeProps","inputProps","focusProps","size","valid","isFocusVisible","onChangeValue","onPasteBox","onlyDigits","raw","toBoxes","digits","total","i","OtpInput","invalidProp","validProp","rest","groupSizes","a","b","length","rawValue","setRawValue","useControllableState","value","defaultValue","onChange","boxes","useMemo","boxRefs","useRef","focusBox","containerRef","forkedRef","latestBoxes","handleFocus","firstEmpty","resetCode","initial","useEffect","form","onReset","commit","nextBoxes","next","box","onComplete","handleChange","chars","handleKeyDown","nextIndex","handlePaste","renderBoxes","count","start","el","content","cursor","groupSize","Fragment","groupIndex","separator","inputGroup","groupId","describedBy","labelledBy","className","name","feedbackId","helpId","labelId"],"sources":["../../src/components/otp-input/OtpBox.tsx","../../src/components/otp-input/OtpInput.tsx"],"sourcesContent":["import React, { ClipboardEvent, ForwardedRef, forwardRef, KeyboardEvent } from 'react'\nimport classNames from 'classnames'\nimport { mergeProps, useFocusRing, useObjectRef, useTextField } from 'react-aria'\n\nimport { validationClassName } from '../../utils/validationClassName'\n\ninterface OtpBoxProps {\n disabled?: boolean\n index: number\n invalid?: boolean\n mask?: boolean\n onChangeValue: (value: string) => void\n onFocusBox: () => void\n onKeyDownBox: (event: KeyboardEvent<HTMLInputElement>) => void\n onPasteBox: (event: ClipboardEvent<HTMLInputElement>) => void\n required?: boolean\n size?: 'sm' | 'lg'\n valid?: boolean\n value: string\n}\n\nexport const OtpBox = forwardRef(\n (\n {\n disabled,\n index,\n invalid,\n mask,\n onChangeValue,\n onFocusBox,\n onKeyDownBox,\n onPasteBox,\n required,\n size,\n valid,\n value\n }: OtpBoxProps,\n forwardedRef: ForwardedRef<HTMLInputElement>\n ) => {\n const ref = useObjectRef(forwardedRef)\n const { focusProps, isFocusVisible } = useFocusRing()\n const { inputProps } = useTextField(\n {\n 'aria-label': `Digit ${index + 1}`,\n // Only the first box takes the whole code; the others turn autofill off. Browsers ignore\n // `off` on a password field, though, so a masked box would be offered saved passwords:\n // every masked box says it takes a one-time code instead, the one other value that fits.\n autoComplete: index === 0 || mask ? 'one-time-code' : 'off',\n isDisabled: disabled,\n isInvalid: invalid,\n isRequired: required,\n maxLength: 1,\n // No `onChange` here: react-aria resets each box to its first value on a form reset and\n // reports it there, and each box then wrote itself into the same code. `OtpInput` resets\n // the whole code once; the input's own `onChange` below reports what is typed.\n onFocus: (event) => {\n ;(event.target as HTMLInputElement).select()\n onFocusBox()\n },\n onKeyDown: onKeyDownBox,\n type: mask ? 'password' : 'text',\n value\n },\n ref\n )\n\n return (\n <input\n {...mergeProps(inputProps, focusProps)}\n // The group describes the boxes. react-aria's own ids here are never rendered (FORMS.md,\n // gotcha 6).\n aria-describedby={undefined}\n // The native `required` below says the same.\n aria-required={undefined}\n className={classNames('form-input', size, validationClassName(invalid, valid))}\n data-focus-visible={isFocusVisible || undefined}\n inputMode=\"numeric\"\n onChange={(event) => onChangeValue(event.target.value)}\n onPaste={onPasteBox}\n pattern=\"\\d*\"\n ref={ref}\n // A required code is one with every box filled, so each box is required: a form is held\n // back by the first empty one, which react-aria's listener then focuses. The hidden input\n // that carries `name` is barred from constraint validation (FORMS.md, gotcha 9), and\n // react-aria writes `aria-required` alone, which no form checks.\n required={required || undefined}\n />\n )\n }\n)\n\nOtpBox.displayName = 'OtpBox'\n","import React, {\n ClipboardEvent,\n forwardRef,\n Fragment,\n HTMLAttributes,\n KeyboardEvent,\n ReactNode,\n useEffect,\n useMemo,\n useRef\n} from 'react'\nimport classNames from 'classnames'\n\nimport { useControllableState, useForkedRef, useFormField, useHeldBack } from '../../hooks'\nimport { validationClassName } from '../../utils/validationClassName'\nimport { renderFormField } from '../form-field/renderFormField'\nimport { OtpBox } from './OtpBox'\nimport { isRTL } from '../../utils/direction'\n\nexport interface OtpInputProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'defaultValue'\n> {\n /**\n * Identifies the element that describes the group, e.g. a `FormHelp` help element.\n */\n 'aria-describedby'?: string\n /**\n * An accessible label for the group, used when there's no visible `<label>`.\n */\n 'aria-label'?: string\n /**\n * Identifies a visible `<label>` element for the group.\n */\n 'aria-labelledby'?: string\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * The initial code (uncontrolled), e.g. `\"123\"` for a partially filled code.\n */\n defaultValue?: string\n /**\n * Prevents input and makes every box non-interactive.\n */\n disabled?: boolean\n /**\n * Splits the boxes into groups (e.g. `[3, 3]` for a \"123-456\" layout), rendering a\n * `.form-otp-separator` between each group. The total number of boxes becomes the sum of\n * `groupSizes`, overriding `length`.\n */\n groupSizes?: number[]\n /**\n * A description for the field, rendered below the boxes.\n */\n help?: ReactNode\n /**\n * `id` forwarded to the group container.\n */\n id?: string\n /**\n * Visually connects the boxes into a single bordered control. When `groupSizes` is set, each\n * group is connected separately.\n */\n inputGroup?: boolean\n /**\n * Set component validation state to invalid. Left unset, the component shows as invalid by itself\n * from a submit it held back (an empty `required` one, say) until it no longer would, or its\n * form is reset. Set it, to `false` too, and it alone decides.\n */\n invalid?: boolean\n /**\n * An error message for the field, rendered below the boxes when `invalid` is set, and after a\n * submit the field held back, until it no longer would.\n */\n invalidFeedback?: ReactNode\n /**\n * The field's caption, rendered as a `FormLabel` associated with the group via\n * `aria-labelledby` (there's no single input to target with `htmlFor`).\n */\n label?: ReactNode\n /**\n * Number of digit boxes. Ignored when `groupSizes` is set. Defaults to `6`.\n */\n length?: number\n /**\n * Mask entered digits using `type=\"password\"` boxes.\n */\n mask?: boolean\n /**\n * `name` of an auto-created hidden input kept in sync with the code, for native form\n * submission. Omit to skip creating it.\n */\n name?: string\n /**\n * Callback fired whenever the code changes.\n */\n onChange?: (value: string) => void\n /**\n * Callback fired once every box is filled.\n */\n onComplete?: (value: string) => void\n /**\n * Toggle the required state for the component. Every box is then required: a code with a box\n * left empty holds its form back from submitting, and the first empty box takes focus.\n */\n required?: boolean\n /**\n * Content of the separator rendered between groups when `groupSizes` is set. Defaults to `–`.\n */\n separator?: ReactNode\n /**\n * Size the boxes 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 boxes when `valid` is set.\n */\n validFeedback?: ReactNode\n /**\n * The code (controlled), digits only, e.g. `\"123456\"`.\n */\n value?: string\n}\n\nconst onlyDigits = (raw: string) => raw.replace(/\\D/g, '')\n\nconst toBoxes = (raw: string, total: number): string[] => {\n const digits = [...onlyDigits(raw)].slice(0, total)\n return Array.from({ length: total }, (_, i) => digits[i] ?? '')\n}\n\nexport const OtpInput = forwardRef<HTMLDivElement, OtpInputProps>(\n (\n {\n className,\n defaultValue,\n disabled,\n groupSizes,\n help,\n id,\n inputGroup,\n invalid: invalidProp,\n invalidFeedback,\n label,\n length = 6,\n mask,\n name,\n onChange,\n onComplete,\n required,\n separator = '–',\n size,\n valid: validProp,\n validFeedback,\n value,\n ...rest\n }: OtpInputProps,\n ref\n ): ReactNode => {\n const total =\n groupSizes && groupSizes.length > 0 ? groupSizes.reduce((a, b) => a + b, 0) : length\n\n const [rawValue, setRawValue] = useControllableState(value, defaultValue ?? '', onChange)\n const boxes = useMemo(() => toBoxes(rawValue, total), [rawValue, total])\n\n const boxRefs = useRef<Array<HTMLInputElement | null>>([])\n const focusBox = (index: number) => boxRefs.current[index]?.focus()\n const containerRef = useRef<HTMLDivElement>(null)\n const forkedRef = useForkedRef(ref, containerRef)\n // Shown as invalid from a submit it held back until it no longer would (`useHeldBack`):\n // react-aria cancels the browser's own message, and the form stayed with nothing to say why.\n // The container hears every box.\n const { invalid, valid } = useHeldBack(containerRef, { invalid: invalidProp, valid: validProp })\n\n // The boxes as last committed. A box focused by the handler that committed them (the next box,\n // after a digit) is focused before the render that shows them.\n const latestBoxes = useRef(boxes)\n latestBoxes.current = boxes\n\n // The code is one string with no gaps, so a digit typed past the first empty box would land in\n // that box. Focus on a box past it goes to it.\n const handleFocus = (index: number) => {\n const firstEmpty = latestBoxes.current.indexOf('')\n if (firstEmpty !== -1 && index > firstEmpty) focusBox(firstEmpty)\n }\n\n // A form reset puts the code back once. Each box restoring its own first digit wrote each into\n // the same stale code, which left one digit short and reported every box.\n const resetCode = useRef(() => {})\n resetCode.current = () => {\n const initial = defaultValue ?? ''\n if (initial !== rawValue) setRawValue(initial)\n }\n useEffect(() => {\n const form = boxRefs.current[0]?.form\n if (!form) return\n const onReset = () => resetCode.current()\n form.addEventListener('reset', onReset)\n return () => form.removeEventListener('reset', onReset)\n }, [])\n\n const commit = (nextBoxes: string[]) => {\n latestBoxes.current = nextBoxes\n const next = nextBoxes.join('')\n setRawValue(next)\n if (nextBoxes.length === total && nextBoxes.every((box) => box !== '')) {\n onComplete?.(next)\n }\n }\n\n const handleChange = (index: number, raw: string) => {\n const digits = onlyDigits(raw)\n\n if (digits.length > 1) {\n // Multi-character value landing in a single box (autofill, or a fast typist outrunning\n // the auto-advance) — distribute across this and subsequent boxes, matching chassis-css's\n // vanilla otp-input.js `_handleInput`.\n const chars = [...digits]\n const nextBoxes = [...boxes]\n for (let i = 0; i < chars.length && index + i < total; i++) {\n nextBoxes[index + i] = chars[i]!\n }\n commit(nextBoxes)\n focusBox(Math.min(index + chars.length, total - 1))\n return\n }\n\n const nextBoxes = [...boxes]\n nextBoxes[index] = digits\n commit(nextBoxes)\n if (digits && index < total - 1) focusBox(index + 1)\n }\n\n const handleKeyDown = (index: number, event: KeyboardEvent<HTMLInputElement>) => {\n if (disabled) return\n\n switch (event.key) {\n case 'Backspace': {\n if (!boxes[index] && index > 0) {\n event.preventDefault()\n const nextBoxes = [...boxes]\n nextBoxes[index - 1] = ''\n commit(nextBoxes)\n focusBox(index - 1)\n }\n break\n }\n case 'Delete': {\n event.preventDefault()\n // `boxes` (and every copy derived from it) is always exactly `total` entries long — see\n // `toBoxes` — so `i + 1` (bounded by `i < total - 1`) never reads past the end.\n const nextBoxes = [...boxes]\n for (let i = index; i < total - 1; i++) nextBoxes[i] = nextBoxes[i + 1]!\n nextBoxes[total - 1] = ''\n commit(nextBoxes)\n break\n }\n // Arrow keys move by *visual* direction, so they mirror under RTL: the box to the left of\n // the focused one is the next box, not the previous. `Carousel` and `MenuSubmenu` already\n // mirror their own arrow handling this way; this used to hardcode the LTR mapping and sent\n // an RTL user backwards through the field.\n case 'ArrowLeft':\n case 'ArrowRight': {\n const movesForward = (event.key === 'ArrowRight') !== isRTL(event.currentTarget)\n const nextIndex = movesForward ? index + 1 : index - 1\n if (nextIndex >= 0 && nextIndex < total) {\n event.preventDefault()\n focusBox(nextIndex)\n }\n break\n }\n default:\n break\n }\n }\n\n const handlePaste = (event: ClipboardEvent<HTMLInputElement>) => {\n event.preventDefault()\n if (disabled) return\n const digits = onlyDigits(event.clipboardData.getData('text')).slice(0, total)\n if (!digits) return\n commit(toBoxes(digits, total))\n // The next empty box, as the autofill branch of `handleChange` does: a box selects its\n // content on focus, so on the last filled one the next digit typed would replace it.\n focusBox(Math.min(digits.length, total - 1))\n }\n\n const renderBoxes = (start: number, count: number) =>\n Array.from({ length: count }, (_, i) => start + i).map((i) => (\n <OtpBox\n disabled={disabled}\n index={i}\n invalid={invalid}\n key={i}\n mask={mask}\n onChangeValue={(next) => handleChange(i, next)}\n onFocusBox={() => handleFocus(i)}\n onKeyDownBox={(event) => handleKeyDown(i, event)}\n onPasteBox={handlePaste}\n ref={(el) => {\n boxRefs.current[i] = el\n }}\n required={required}\n size={size}\n valid={valid}\n value={boxes[i] ?? ''}\n />\n ))\n\n let content: ReactNode\n if (groupSizes && groupSizes.length > 0) {\n let cursor = 0\n content = groupSizes.map((groupSize, groupIndex) => {\n const start = cursor\n cursor += groupSize\n return (\n // eslint-disable-next-line react/no-array-index-key\n <Fragment key={groupIndex}>\n {groupIndex > 0 && <span className=\"form-otp-separator\">{separator}</span>}\n {inputGroup ? (\n <div className=\"input-group\">{renderBoxes(start, groupSize)}</div>\n ) : (\n renderBoxes(start, groupSize)\n )}\n </Fragment>\n )\n })\n } else {\n content = renderBoxes(0, total)\n }\n\n const {\n describedBy,\n feedbackId,\n helpId,\n inputId: groupId,\n labelId,\n labelledBy\n } = useFormField({\n ariaDescribedBy: rest['aria-describedby'],\n ariaLabelledBy: rest['aria-labelledby'],\n help,\n id,\n invalid,\n invalidFeedback,\n label,\n valid,\n validFeedback\n })\n\n return renderFormField({\n children: (\n <div\n {...rest}\n aria-describedby={describedBy}\n aria-labelledby={labelledBy}\n className={classNames(\n 'form-otp',\n { 'input-group': inputGroup && !(groupSizes && groupSizes.length > 0) },\n validationClassName(invalid, valid),\n className\n )}\n id={groupId}\n ref={forkedRef}\n role=\"group\"\n >\n {content}\n {name && <input disabled={disabled} name={name} type=\"hidden\" value={boxes.join('')} />}\n </div>\n ),\n help,\n ids: { feedback: feedbackId, help: helpId, label: labelId },\n invalid,\n invalidFeedback,\n label,\n valid,\n validFeedback\n })\n }\n)\n\nOtpInput.displayName = 'OtpInput'\n"],"mappings":"A,ukBAqBA,MAAaQ,EAASC,GAElB,CACE,WACA,QACA,UACA,OACA,gBACA,aACA,eACA,aACA,WACA,OACA,QACA,SAEF,IACG,CACH,IAAMC,EAAMC,EAAaC,CAAY,EAC/B,CAAE,aAAY,kBAAmBC,EAAa,EAC9C,CAAE,cAAeC,EACrB,CACE,aAAc,SAASC,EAAQ,IAI/B,aAAcA,IAAU,GAAKC,EAAO,gBAAkB,MACtD,WAAYC,EACZ,UAAWC,EACX,WAAYC,EACZ,UAAW,EAIX,QAAU,GAAU,CACjBC,EAAO,OAA4B,OAAO,EAC3CC,EAAW,CACb,EACA,UAAWC,EACX,KAAMN,EAAO,WAAa,OAC1B,OACF,EACAN,CACF,EAEA,MACE,kBAAA,cAAC,QAAD,CACE,GAAIa,EAAWC,EAAYC,CAAU,EAGrC,mBAAkB,IAAA,GAElB,gBAAe,IAAA,GACf,UAAWlB,EAAW,aAAcmB,EAAMrB,EAAoBa,EAASS,CAAK,CAAC,EAC7E,qBAAoBC,GAAkB,IAAA,GACtC,UAAU,UACV,SAAW,GAAUC,EAAcT,EAAM,OAAO,KAAK,EACrD,QAASU,EACT,QAAQ,OACH,MAKL,SA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ACvC,IAAIwC,EAAS,EACb,EAAUxC,EAAW,KAAK,EAAW,IAAe,CAClD,IAAMqC,EAAQG,EAEd,MADA,IAAUC,EAGR,kBAAA,cAACC,EAAD,CAAU,IAAKC,CAOL,EANPA,EAAa,GAAK,kBAAA,cAAC,OAAD,CAAM,UAAU,oBAAsC,EAAhBC,EAAgB,EACxEC,EACC,kBAAA,cAAC,MAAD,CAAK,UAAU,aAAkD,EAAnCV,EAAYE,EAAOI,CAAS,CAAO,EAEjEN,EAAYE,EAAOI,CAAS,CAEtB,CAEd,CAAC,CACH,KACE,GAAUN,EAAY,EAAGzC,CAAK,EAGhC,GAAM,CACJ,eACA,cACA,UACA,QAASoD,GACT,WACA,cACEtF,EAAa,CACf,gBAAiBuC,EAAK,oBACtB,eAAgBA,EAAK,mBACrB,OACA,KACA,UACA,kBACA,QACA,QACA,eACF,CAAC,EAED,OAAOrC,EAAgB,CACrB,SACE,kBAAA,cAAC,MAAD,CACE,GAAIqC,EACJ,mBAAkBgD,GAClB,kBAAiBC,EACjB,UAAWlF,EACT,WACA,CAAE,cAAe+E,GAAc,EAAE7C,GAAcA,EAAW,OAAS,EAAG,EACtEpC,EAAoBa,EAASS,CAAK,EAClC+D,CACF,EACA,GAAIH,GACJ,IAAK9B,EACL,KAAK,OAIF,EAFFuB,EACAW,GAAQ,kBAAA,cAAC,QAAD,CAAiB,WAAgB,OAAM,KAAK,SAAS,MAAOxC,EAAM,KAAK,EAAE,CAAI,CAAA,CACnF,EAEP,OACA,IAAK,CAAE,SAAUyC,GAAY,KAAMC,GAAQ,MAAOC,EAAQ,EAC1D,UACA,kBACA,QACA,QACA,eACF,CAAC,CACH,CACF,EAEA,EAAS,YAAc,W"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e={top:`top`,"top-start":`top start`,"top-end":`top end`,bottom:`bottom`,"bottom-start":`bottom start`,"bottom-end":`bottom end`,left:`left`,"left-start":`left top`,"left-end":`left bottom`,right:`right`,"right-start":`right top`,"right-end":`right bottom`},t=t=>e[t],n=(e,t)=>{if(!t||t===`center`)return e;let n=e.split(`-`)[1];return n?`${t}-${n}`:t},r=(e,t,r)=>({menuStyle:{position:e?.position,top:e?.top,left:e?.left},placementAttr:n(t,r)}),i={"--cx-menu-max-height":`320px`,"--cx-menu-overflow-y":`auto`};export{t as i,n,r,i as t};
|
|
2
|
-
//# sourceMappingURL=overlayPlacement-Q6bcbXA5.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"overlayPlacement-Q6bcbXA5.js","names":["ARIA_PLACEMENT","toAriaPlacement","placement","resolveDataPlacement","resolvedMain","requested","cross","resolveMenuOverlayPositioning","overlayStyle","requestedPlacement","resolvedPlacement","COMBOBOX_MENU_OVERLAY_STYLE"],"sources":["../../src/utils/overlayPlacement.ts"],"sourcesContent":["import type { CSSProperties } from 'react'\nimport type { Placement as AriaPlacement, PlacementAxis } from 'react-aria'\n\n// Chassis CSS's floating components (`.menu`, `.tooltip`, `.popover`) read a `data-cx-placement`\n// attribute in this hyphenated, compound form (`\"bottom-end\"`, `\"top-start\"`, ...) to pick the\n// right transform-origin for the open/close animation. React Aria's `useOverlayPosition` speaks a\n// different, space-separated placement vocabulary (`\"bottom end\"`) and only reports back the\n// resolved main axis after flipping, not the full compound value — this module bridges the two.\nexport type Placement =\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'left'\n | 'left-start'\n | 'left-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n\nconst ARIA_PLACEMENT: Record<Placement, AriaPlacement> = {\n top: 'top',\n 'top-start': 'top start',\n 'top-end': 'top end',\n bottom: 'bottom',\n 'bottom-start': 'bottom start',\n 'bottom-end': 'bottom end',\n left: 'left',\n 'left-start': 'left top',\n 'left-end': 'left bottom',\n right: 'right',\n 'right-start': 'right top',\n 'right-end': 'right bottom'\n}\n\n// Translates chassis-react's public `placement` prop values into the strings\n// `useOverlayPosition` expects.\nexport const toAriaPlacement = (placement: Placement): AriaPlacement => ARIA_PLACEMENT[placement]\n\n// `useOverlayPosition`'s own `shouldFlip` only ever swaps the main axis (top<->bottom or\n// left<->right) — it never changes the requested cross-axis alignment — so the resolved compound\n// value is always the requested cross-axis suffix reattached to the (possibly flipped) main axis\n// `useOverlayPosition` reports back.\nexport const resolveDataPlacement = (\n requested: Placement,\n resolvedMain: PlacementAxis | null\n): string => {\n if (!resolvedMain || resolvedMain === 'center') return requested\n const cross = requested.split('-')[1]\n return cross ? `${resolvedMain}-${cross}` : resolvedMain\n}\n\n// Shared between `Menu`/`MenuSubmenu` and `Combobox`/`Autocomplete`, whose floating panels all\n// position via `useOverlayPosition` the same way: only `position`/`top`/`left` are taken from the\n// hook's computed style (`zIndex`/`maxHeight` stay owned by chassis-css's own `--zindex`/\n// `--max-height` tokens, see `_menu.scss`; the inline `max-height` the hook writes on the element\n// itself is kept by `useOverlayMaxHeight` only where it is smaller than that cap), and\n// `data-cx-placement` needs the resolved main axis reattached to the originally-requested\n// cross-axis alignment. Pure positioning that renders\n// nothing and belongs to none of the four, so it lives here and not in `components/menu/`.\nexport interface MenuOverlayPositioning {\n menuStyle: CSSProperties\n placementAttr: string\n}\n\nexport const resolveMenuOverlayPositioning = (\n overlayStyle: CSSProperties | undefined,\n requestedPlacement: Placement,\n resolvedPlacement: PlacementAxis | null\n): MenuOverlayPositioning => ({\n menuStyle: {\n position: overlayStyle?.position,\n top: overlayStyle?.top,\n left: overlayStyle?.left\n },\n placementAttr: resolveDataPlacement(requestedPlacement, resolvedPlacement)\n})\n\n// chassis-css's `.combobox + .menu` sibling-selector rule (`_combobox.scss`) sets\n// `--cx-menu-max-height`/`--cx-menu-overflow-y` from `$combobox-menu-max-height`/\n// `$combobox-menu-overflow-y` (320px/auto by default) — but only while the panel is an adjacent\n// DOM sibling of `.combobox`. `Autocomplete`/`Combobox` portal their panel to `document.body` (or\n// an enclosing open `<dialog>`, via `useFloatingOverlay`), breaking that adjacency, so both inline\n// this as a fallback matching the shipped Sass defaults instead of the generic, uncapped `.menu`\n// fallback (`max-height: none`). The names carry the `cx-` prefix of chassis-css's built CSS:\n// unprefixed, as they were, nothing read them, and only the inline `max-height` react-aria wrote\n// (`useOverlayMaxHeight`) capped the list. A consumer who customized either Sass variable needs to\n// re-override `--cx-menu-max-height`/`--cx-menu-overflow-y` on `.menu` directly, since the\n// sibling-selector auto-application can no longer reach a portaled panel.\nexport const COMBOBOX_MENU_OVERLAY_STYLE: CSSProperties = {\n '--cx-menu-max-height': '320px',\n '--cx-menu-overflow-y': 'auto'\n} as CSSProperties\n"],"mappings":"AAsBA,MAAMA,EAAmD,CACvD,IAAK,MACL,YAAa,YACb,UAAW,UACX,OAAQ,SACR,eAAgB,eAChB,aAAc,aACd,KAAM,OACN,aAAc,WACd,WAAY,cACZ,MAAO,QACP,cAAe,YACf,YAAa,cACf,EAIaC,EAAmB,GAAwCD,EAAeE,GAM1EC,GACX,EACA,IACW,CACX,GAAI,CAACC,GAAgBA,IAAiB,SAAU,OAAOC,EACvD,IAAMC,EAAQD,EAAU,MAAM,GAAG,CAAC,CAAC,GACnC,OAAOC,EAAQ,GAAGF,EAAa,GAAGE,IAAUF,CAC9C,EAeaG,GACX,EACA,EACA,KAC4B,CAC5B,UAAW,CACT,SAAUC,GAAc,SACxB,IAAKA,GAAc,IACnB,KAAMA,GAAc,IACtB,EACA,cAAeL,EAAqBM,EAAoBC,CAAiB,CAC3E,GAaaC,EAA6C,CACxD,uBAAwB,QACxB,uBAAwB,MAC1B,E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pagination-Dvz8lccd.js","names":["hrefProps","linkElement","resolveLinkKind","createPolymorphicComponent","useButtonSemantics","focusRedirect","IconSlot","React","classNames","usePagination","prevRef","useRef","nextRef","pending","useEffect","from","prevDisabled","nextDisabled","event","onPrev","onNext","PaginationItemRender","rest","_className","className","Component","component","href","kind","linkProps","NativeButton","Anchor","handleClick","disabled","onClick","needsButtonSemantics","ref","currentProps","active","children","mergeProps","buttonProps","forkedRef","PaginationItem","ALIGN_CLASS_NAMES","getPageRange","safeMaxVisible","maxVisible","pages","i","half","start","activePage","end","result","Pagination","forwardRef","ariaLabel","size","align","isSmart","clampedActivePage","onActivePageChange","smartContent","showPrevNext","handlePrevClick","previousLabel","previousIcon","showPageNumbers","maxVisiblePages","page","idx","handleNextClick","nextLabel","nextIcon"],"sources":["../../src/hooks/usePagination.ts","../../src/components/pagination/PaginationItem.tsx","../../src/components/pagination/Pagination.tsx"],"sourcesContent":["import { MouseEvent, RefObject, useEffect, useRef } from 'react'\n\nimport { focusRedirect } from '../utils/focusRedirect'\n\nexport interface UsePaginationOptions {\n /**\n * Whether the Previous control is currently disabled.\n */\n prevDisabled: boolean\n /**\n * Whether the Next control is currently disabled.\n */\n nextDisabled: boolean\n /**\n * Called when Previous is clicked, before the state change that may disable it.\n */\n onPrev: () => void\n /**\n * Called when Next is clicked, before the state change that may disable it.\n */\n onNext: () => void\n}\n\nexport interface UsePaginationResult<T extends HTMLElement = HTMLButtonElement> {\n // `RefObject<T | null>`, not `RefObject<T>`: these come from `useRef<T>(null)`, so `.current`\n // really is null before mount (and whenever the control isn't rendered — a hand-composed\n // pagination may omit Prev/Next entirely). Declaring the non-null form let a consumer write\n // `prevRef.current.focus()` with no type error and crash at runtime.\n prevRef: RefObject<T | null>\n nextRef: RefObject<T | null>\n handlePrevClick: (event: MouseEvent<T>) => void\n handleNextClick: (event: MouseEvent<T>) => void\n}\n\ninterface Pending {\n from: 'prev' | 'next'\n // A `click` fired by real pointer activation has `detail >= 1`; one fired by keyboard\n // activation (Enter/Space on a focused button) has `detail === 0`.\n viaPointer: boolean\n}\n\n// Native `disabled` buttons are blurred by the browser the instant they're disabled. Clicking a\n// Prev/Next control into the first/last page disables that very control, silently dropping focus\n// to `<body>`. Wire `handlePrevClick`/`handleNextClick` up as each control's `onClick` — they call\n// `onPrev`/`onNext` and redirect focus to the still-enabled sibling in one step, so callers don't\n// hand-wrap their own click handler around a separate mark-then-focus call.\n// Works for `Pagination`'s built-in smart mode and for hand-composed Prev/Next controls alike —\n// pass the element type of whatever you're attaching the refs to (`PaginationItem` defaults to\n// an `HTMLButtonElement`, but renders an `HTMLAnchorElement` when given `href` or `component`).\nexport function usePagination<T extends HTMLElement = HTMLButtonElement>({\n prevDisabled,\n nextDisabled,\n onPrev,\n onNext\n}: UsePaginationOptions): UsePaginationResult<T> {\n const prevRef = useRef<T>(null)\n const nextRef = useRef<T>(null)\n const pending = useRef<Pending | null>(null)\n\n // Deliberately no dependency array: this must run after every render, not just ones where\n // prevDisabled/nextDisabled change value. A Prev/Next click that doesn't cross a boundary\n // (e.g. moving between two enabled middle pages) leaves both booleans unchanged, so a\n // dependency-gated effect would skip and leave `pending` stale — a later, unrelated render\n // that does flip one of the booleans (e.g. jumping straight to the first/last page via a\n // page-number click) would then wrongly consume that stale mark and redirect focus.\n useEffect(() => {\n const from = pending.current\n pending.current = null\n if (!from) return\n if (from.from === 'prev' && prevDisabled) {\n focusRedirect(nextRef.current, from.viaPointer)\n } else if (from.from === 'next' && nextDisabled) {\n focusRedirect(prevRef.current, from.viaPointer)\n }\n })\n\n return {\n prevRef,\n nextRef,\n handlePrevClick: (event) => {\n pending.current = { from: 'prev', viaPointer: event.detail !== 0 }\n onPrev()\n },\n handleNextClick: (event) => {\n pending.current = { from: 'next', viaPointer: event.detail !== 0 }\n onNext()\n }\n }\n}\n","import React, {\n ElementType,\n ForwardRefRenderFunction,\n MouseEvent,\n MouseEventHandler,\n ReactElement,\n Ref\n} from 'react'\nimport classNames from 'classnames'\nimport { mergeProps } from 'react-aria'\n\nimport { useButtonSemantics } from '../../hooks'\nimport { hrefProps, linkElement, resolveLinkKind } from '../../utils/elementKind'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef,\n PolymorphicRefWithFallback\n} from '../../utils/polymorphic'\n\ntype PaginationItemOwnProps<C extends ElementType> = {\n /**\n * Toggle the active state for the component.\n */\n active?: boolean\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n /**\n * Toggle the disabled state for the component.\n */\n disabled?: boolean\n /**\n * The href attribute. When provided the item renders as an `<a>` tag; otherwise as a `<button>`.\n */\n href?: string\n}\n\nexport type PaginationItemProps<C extends ElementType = 'button'> = PolymorphicComponentProps<\n C,\n PaginationItemOwnProps<C>\n>\n\ntype PaginationItemComponent = (<C extends ElementType = 'button'>(\n props: PaginationItemProps<C> & {\n ref?: PolymorphicRefWithFallback<C, HTMLButtonElement | HTMLAnchorElement | HTMLSpanElement>\n }\n) => ReactElement | null) & { displayName?: string }\n\nfunction PaginationItemRender<C extends ElementType = 'button'>(\n {\n active,\n children,\n className,\n component,\n disabled,\n href,\n onClick,\n ...rest\n }: PaginationItemProps<C>,\n ref: PolymorphicRef<C>\n) {\n const _className = classNames(\n 'pagination-item',\n {\n active,\n disabled\n },\n className\n )\n\n // The active page keeps whatever element it would render anyway (`<button>`, or `<a>` when\n // given `href`) rather than collapsing to a `<span>`. Swapping the tag on activation made React\n // unmount the focused control and mount a different element in its place, so a keyboard user who\n // activated a page was dropped to `<body>` and had to tab in from the top of the document again\n // (WCAG 2.4.3). The `<span>` wasn't even inert: `Pagination`'s smart mode passes an `onClick`,\n // so `useButtonSemantics` gave it `role=\"button\"` and `tabIndex={0}` — a synthetic button,\n // strictly worse than the real one it replaced. Styling is unaffected either way: chassis-css\n // matches `.pagination-link { &.active, .active > & }`, and `active` still lands on the `<li>`.\n const Component = linkElement(component, href, 'button')\n // The kind rather than the tag, counting a router link with `href` or `to` as an anchor: under `asChild`, `Component` is a `Slot` standing in for the\n // caller's element, and a slotted `<a>` needs what `component=\"a\"` gets. Each branch below\n // renders `Component` typed as its tag, which is the tag itself or that `Slot`.\n const kind = resolveLinkKind(Component, href, rest)\n // A router link as `component` takes `href` too; it used to get none.\n const linkProps = hrefProps(kind, href, 'PaginationItem')\n const NativeButton = Component as 'button'\n const Anchor = Component as 'a'\n\n // `<a>` has no real `disabled` attribute, so a disabled anchor pagination item still fires\n // click (and still navigates) unless it's blocked here, same guard `Button` applies.\n const handleClick = (event: MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => {\n if (kind === 'anchor' && disabled) {\n event.preventDefault()\n return\n }\n onClick?.(event as never)\n }\n\n // A custom `component`/default (non-`button`/`a`) branch gets a raw `onClick` with no keyboard\n // semantics otherwise — the same gap `Link` fills via `useButtonSemantics`.\n const needsButtonSemantics = kind !== 'button' && kind !== 'anchor' && !!onClick\n const { buttonProps, forkedRef } = useButtonSemantics<HTMLElement>(ref as Ref<HTMLElement>, {\n disabled,\n onClick: onClick as MouseEventHandler<HTMLElement> | undefined\n })\n\n // `aria-current=\"page\"` goes on the control itself, not the wrapping `<li>` — that's where the\n // WAI-ARIA pagination pattern puts it, and it's what a screen reader conveys when focus lands on\n // the control. On the `<li>` it was attached to a presentational list item nothing focuses.\n const currentProps = active ? { 'aria-current': 'page' as const } : {}\n\n return (\n <li className={_className}>\n {kind === 'button' ? (\n <NativeButton\n {...(rest as Record<string, unknown>)}\n className=\"pagination-link\"\n type=\"button\"\n disabled={disabled}\n onClick={handleClick}\n {...currentProps}\n ref={ref as Ref<HTMLButtonElement>}\n >\n {children}\n </NativeButton>\n ) : kind === 'anchor' ? (\n <Anchor\n {...(rest as Record<string, unknown>)}\n className=\"pagination-link\"\n {...linkProps}\n onClick={handleClick}\n {...(disabled && { 'aria-disabled': true, tabIndex: -1 })}\n {...currentProps}\n ref={ref as Ref<HTMLAnchorElement>}\n >\n {children}\n </Anchor>\n ) : (\n <Component\n className=\"pagination-link\"\n {...(mergeProps(rest, needsButtonSemantics ? buttonProps : {}) as Record<\n string,\n unknown\n >)}\n {...(!needsButtonSemantics && { onClick: handleClick })}\n {...linkProps}\n {...currentProps}\n ref={needsButtonSemantics ? forkedRef : ref}\n >\n {children}\n </Component>\n )}\n </li>\n )\n}\n\nexport const PaginationItem = createPolymorphicComponent<PaginationItemComponent>(\n PaginationItemRender as ForwardRefRenderFunction<Element, PaginationItemProps<ElementType>>,\n 'PaginationItem'\n)\n","import React, { forwardRef, HTMLAttributes } from 'react'\nimport { IconValue } from '../../utils/iconConfig'\nimport { IconSlot } from '../icon/iconSlot'\nimport classNames from 'classnames'\n\nimport { PaginationItem } from './PaginationItem'\nimport { usePagination } from '../../hooks'\n\n// Whole class names, not `justify-content-${align}`: see `utils/colorClassNames.ts`.\nconst ALIGN_CLASS_NAMES: Record<NonNullable<PaginationProps['align']>, string> = {\n start: 'justify-content-start',\n center: 'justify-content-center',\n end: 'justify-content-end'\n}\n\nexport interface PaginationProps extends HTMLAttributes<HTMLElement> {\n /**\n * Current active page (1-indexed). Used with `pages` for data-driven mode.\n */\n activePage?: number\n /**\n * Set the alignment of pagination components.\n */\n align?: 'start' | 'center' | 'end'\n /**\n * Accessible label for the pagination `<nav>` landmark. Override for non-English locales,\n * or when multiple paginators appear on the same page.\n *\n * @default 'Pagination'\n */\n 'aria-label'?: string\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Maximum number of visible page buttons (default: 5). Flanking pages are collapsed to ellipsis.\n */\n maxVisiblePages?: number\n /**\n * The \"next page\" control's icon in smart pagination mode: an icon name, or an element of your\n * own icon set. Defaults to `IconProvider`'s `next` icon.\n */\n nextIcon?: IconValue\n /**\n * Accessible label for the \"next page\" control, used in smart pagination mode. Override for\n * non-English locales.\n *\n * @default 'Next'\n */\n nextLabel?: string\n /**\n * Callback fired when the active page changes.\n */\n onActivePageChange?: (page: number) => void\n /**\n * Total number of pages. When provided alongside `activePage` and `onActivePageChange`,\n * the component renders a fully-controlled smart paginator with Prev/Next and ellipsis.\n */\n pages?: number\n /**\n * The \"previous page\" control's icon in smart pagination mode: an icon name, or an element of\n * your own icon set. Defaults to `IconProvider`'s `previous` icon.\n */\n previousIcon?: IconValue\n /**\n * Accessible label for the \"previous page\" control, used in smart pagination mode. Override\n * for non-English locales.\n *\n * @default 'Previous'\n */\n previousLabel?: string\n /**\n * Show the numbered page buttons in smart pagination mode. Set `false` alongside\n * `showPrevNext` to build a Prev/Next-only paginator.\n *\n * @default true\n */\n showPageNumbers?: boolean\n /**\n * Show the Prev/Next controls in smart pagination mode. Set `false` alongside\n * `showPageNumbers` to build a page-numbers-only paginator.\n *\n * @default true\n */\n showPrevNext?: boolean\n /**\n * Size the component sm or lg.\n */\n size?: 'sm' | 'lg'\n}\n\nfunction getPageRange(activePage: number, pages: number, maxVisible: number): (number | '...')[] {\n const safeMaxVisible = Math.max(1, maxVisible)\n\n if (pages <= safeMaxVisible) {\n return Array.from({ length: pages }, (_, i) => i + 1)\n }\n\n const half = Math.floor(safeMaxVisible / 2)\n let start = Math.max(1, activePage - half)\n const end = Math.min(pages, start + safeMaxVisible - 1)\n\n if (end - start < safeMaxVisible - 1) {\n start = Math.max(1, end - safeMaxVisible + 1)\n }\n\n const result: (number | '...')[] = []\n\n if (start > 1) {\n result.push(1)\n if (start > 2) result.push('...')\n }\n\n for (let i = start; i <= end; i++) {\n result.push(i)\n }\n\n if (end < pages) {\n if (end < pages - 1) result.push('...')\n result.push(pages)\n }\n\n return result\n}\n\nexport const Pagination = forwardRef<HTMLElement, PaginationProps>(\n (\n {\n activePage = 1,\n align,\n 'aria-label': ariaLabel = 'Pagination',\n children,\n className,\n maxVisiblePages = 5,\n nextIcon,\n nextLabel = 'Next',\n onActivePageChange,\n pages,\n previousIcon,\n previousLabel = 'Previous',\n showPageNumbers = true,\n showPrevNext = true,\n size,\n ...rest\n },\n ref\n ) => {\n const _className = classNames('pagination', size, align && ALIGN_CLASS_NAMES[align], className)\n\n // `pages != null`, not truthiness: `pages={0}` is a pagination with no pages, both of its\n // controls disabled. It rendered `children` instead, an empty navigation landmark.\n const isSmart = pages != null\n const clampedActivePage = isSmart ? Math.min(Math.max(activePage, 1), pages) : activePage\n const prevDisabled = isSmart ? clampedActivePage <= 1 : false\n const nextDisabled = isSmart ? clampedActivePage >= pages : false\n\n const { prevRef, nextRef, handlePrevClick, handleNextClick } = usePagination({\n prevDisabled,\n nextDisabled,\n onPrev: () => onActivePageChange && onActivePageChange(clampedActivePage - 1),\n onNext: () => onActivePageChange && onActivePageChange(clampedActivePage + 1)\n })\n\n const smartContent = isSmart ? (\n <>\n {showPrevNext && (\n <PaginationItem\n ref={prevRef}\n disabled={prevDisabled}\n onClick={handlePrevClick}\n aria-label={previousLabel}\n >\n <IconSlot icon=\"previous\" override={previousIcon} className=\"directional-icon\" />\n </PaginationItem>\n )}\n {showPageNumbers &&\n getPageRange(clampedActivePage, pages, maxVisiblePages).map((page, idx) =>\n page === '...' ? (\n // eslint-disable-next-line react/no-array-index-key\n <PaginationItem key={`ellipsis-${idx}`} disabled component=\"span\" aria-hidden=\"true\">\n …\n </PaginationItem>\n ) : (\n <PaginationItem\n key={page}\n active={page === clampedActivePage}\n onClick={() => onActivePageChange && onActivePageChange(page)}\n >\n {page}\n </PaginationItem>\n )\n )}\n {showPrevNext && (\n <PaginationItem\n ref={nextRef}\n disabled={nextDisabled}\n onClick={handleNextClick}\n aria-label={nextLabel}\n >\n <IconSlot icon=\"next\" override={nextIcon} className=\"directional-icon\" />\n </PaginationItem>\n )}\n </>\n ) : null\n\n return (\n <nav aria-label={ariaLabel} ref={ref} {...rest}>\n <ul className={_className}>{smartContent ?? children}</ul>\n </nav>\n )\n }\n)\n\nPagination.displayName = 'Pagination'\n"],"mappings":"A,uZAiDA,SAAgBS,EAAyD,CACvE,eACA,eACA,SACA,UAC+C,CAC/C,IAAMC,EAAUC,EAAU,IAAI,EACxBC,EAAUD,EAAU,IAAI,EACxBE,EAAUF,EAAuB,IAAI,EAmB3C,OAXAG,MAAgB,CACd,IAAMC,EAAOF,EAAQ,QACrB,EAAQ,QAAU,KACbE,IACDA,EAAK,OAAS,QAAUC,EAC1BX,EAAcO,EAAQ,QAASG,EAAK,UAAU,EACrCA,EAAK,OAAS,QAAUE,GACjCZ,EAAcK,EAAQ,QAASK,EAAK,UAAU,EAElD,CAAC,EAEM,CACL,UACA,UACA,gBAAkB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slot-BQVx1Eew.js";import{t}from"./polymorphic-CZIFszAy.js";import n from"react";import r from"classnames";const i={start:`float-start`,center:`d-block mx-auto`,end:`float-end`};function a({align:t,alt:a,className:o,color:s,component:c,fluid:l,height:u,rounded:d,src:f,text:p,thumbnail:m,title:h=`Placeholder`,variant:g,width:_,...v},y){let b=h!==!1,x=p===!1?void 0:p??(_!==void 0&&u!==void 0?`${_}x${u}`:void 0),S=x!==void 0,C=[b&&h,S&&x].filter(Boolean).join(`: `)||void 0;if(f||e(c)){let e=c??`img`,s=r({image:l||m,fluid:l,rounded:d,thumbnail:m},t&&i[t],o);return/* @__PURE__ */ n.createElement(e,{src:f,width:_,height:u,alt:a??C??``,className:s,...v,ref:y})}let w=r(`image`,{context:!!(s||g)},s,g||`bg-evident`,`fg-subtle`,o);return/* @__PURE__ */ n.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:_,height:u,"aria-label":C,"aria-hidden":!C||void 0,className:w,preserveAspectRatio:`xMidYMid slice`,role:C?`img`:void 0,...v,ref:y},b&&/* @__PURE__ */ n.createElement(`title`,null,h),S&&/* @__PURE__ */ n.createElement(`text`,{dy:`.3em`,fill:`currentColor`,textAnchor:`middle`,x:`50%`,y:`50%`},x))}const o=t(a,`Placeholder`);export{o as t};
|
|
2
|
-
//# sourceMappingURL=placeholder-SPoVRkKE.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{S as e,a as t,b as n,n as r,r as i,s as a,t as o}from"./slot-BQVx1Eew.js";import{createElement as s,forwardRef as c}from"react";function l(l,u){let d=c(({asChild:c,...d},f)=>{let p=a(),m=c?i(d.children,u):null;return m?(e(d.component!==void 0,`${u}: both \`asChild\` and \`component\` were passed; \`asChild\` wins and \`component\` is ignored.`),s(o,{value:m},n(m,()=>l({...d,component:r(m),children:m.props.children},f)))):t(d.component)?n(p,()=>l(d,f)):l(d,f)});return d.displayName=u,d}export{l as t};
|
|
2
|
-
//# sourceMappingURL=polymorphic-CZIFszAy.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-Bs80iIBN.js";import{i as e,o as t}from"./slot-BQVx1Eew.js";import{t as n}from"./useForkedRef-WoqMqsWE.js";import{n as r}from"./overlayStack-BXtTGCRm.js";import{t as i}from"./useHydrated-Dud4JEwp.js";import{t as a}from"./useTransitionState-sQUQey74.js";import{n as o,r as s,t as c}from"./useFloatingOverlay-BuiI_CCn.js";import{t as l}from"./useOpenStateProps-BhjSQ3f6.js";import{i as u,n as d}from"./overlayPlacement-Q6bcbXA5.js";import{t as f}from"./Portal-BTDylxAi.js";import{n as p,t as m}from"./insideEvents-CWcNrMu7.js";import h,{forwardRef as g,useEffect as _,useId as v,useRef as y}from"react";import b from"classnames";import{mergeProps as x,useDialog as S,useOverlayPosition as C,useOverlayTrigger as w}from"react-aria";import{useOverlayTriggerState as T}from"react-stately";const E=({arrowProps:e,content:t,overlayRef:r,overlayTriggerProps:i,title:a,...o})=>{let s=y(null),l=n(r,s),{dialogProps:u,titleProps:d}=S({},s);return/* @__PURE__ */ h.createElement(`div`,{...x(i,u,o),ref:l},/* @__PURE__ */ h.createElement(`div`,{className:`popover-arrow`,...e,style:c(e)}),a&&/* @__PURE__ */ h.createElement(`div`,{className:`popover-header`,...d},a),/* @__PURE__ */ h.createElement(`div`,{className:`popover-body`},t))},D=g(function({children:c,className:g,content:S,defaultVisible:D,placement:O=`right`,offset:k=[0,8],onHide:A,onShow:j,onVisibleChange:M,style:N,title:P,visible:F,...I},L){let R=y(null),z=y(null),B=y(null),V=n(L,B),H=e(c,`Popover`),U=v(),W=H&&!P&&I[`aria-label`]==null&&I[`aria-labelledby`]==null?H.props.id??`${U}-trigger`:void 0,G=T(l({defaultVisible:D,onVisibleChange:M,visible:F},`Popover`)),{triggerProps:{onPress:ee,...K},overlayProps:q}=w({type:`dialog`},G,z),J=s({close:G.close,isOpen:G.isOpen,onHide:A,onShow:j,triggerRef:z}),Y=F!==void 0&&!M;_(()=>{if(G.isOpen&&!Y)return r({nodes:()=>[B.current,z.current],onEscape:()=>G.close()})},[G.isOpen,G.close,Y]),_(()=>{if(!G.isOpen)return;let e=(e,t)=>!!t&&e.includes(t),t=t=>{let n=t.composedPath();e(n,z.current)||e(n,B.current)||p(t,B)||G.close()},n=window.setTimeout(()=>{window.addEventListener(`pointerdown`,t)});return()=>{window.clearTimeout(n),window.removeEventListener(`pointerdown`,t)}},[G.isOpen,G.close]);let{overlayProps:X,arrowProps:Z,placement:Q}=C({targetRef:z,overlayRef:B,placement:u(O),offset:k[1],crossOffset:k[0],arrowSize:8,arrowRef:R,isOpen:G.isOpen,onClose:null}),$={...N,position:X.style?.position,top:X.style?.top,left:X.style?.left},te=d(O,Q),{isMounted:ne,phase:re}=a({in:G.isOpen&&J!==null,mountOnEnter:!0,nodeRef:B,onExited:()=>{let e=z.current;if(!e||!document.contains(e))return;let t=document.activeElement,n=!t||t===document.body,r=!!t&&!!B.current?.contains(t);(n||r)&&e.focus()},unmountOnExit:!0}),ie=i();return/* @__PURE__ */ h.createElement(h.Fragment,null,H?t(H,{...W&&{id:W},onClick:()=>G.toggle()},z,ie?K:{...K,"aria-controls":void 0}):c,/* @__PURE__ */ h.createElement(f,{container:J},ne&&/* @__PURE__ */ h.createElement(E,{className:b(`popover cx-popover-auto`,o(re),g),"data-cx-placement":te,style:$,overlayTriggerProps:q,overlayRef:V,arrowProps:Z,title:P,content:S,"aria-labelledby":W,...x(I,m(B))})))});D.displayName=`Popover`;export{D as t};
|
|
2
|
-
//# sourceMappingURL=popover-C_32yD9W.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"popover-C_32yD9W.js","names":["getTriggerChild","renderSlotted","useForkedRef","pushOverlay","useHydrated","useTransitionState","getOverlayTransitionClass","useFloatingOverlay","getOverlayArrowStyle","useOpenStateProps","toAriaPlacement","resolveDataPlacement","Portal","isEventInside","insideEventProps","React","classNames","PopoverPanel","rest","panelRef","useRef","forkedRef","overlayRef","useDialog","mergeProps","overlayTriggerProps","dialogProps","arrowProps","title","titleProps","content","Popover","forwardRef","offsetProp","arrowRef","triggerRef","floatingRef","forkedFloatingRef","ref","triggerElement","children","generatedId","useId","triggerId","state","useOverlayTriggerState","_onPress","triggerProps","useOverlayTrigger","portalContainer","isHeld","visible","onVisibleChange","useEffect","isInside","node","path","handleDismiss","event","id","resolvedPlacement","useOverlayPosition","placement","floatingStyle","style","overlayProps","placementAttr","trigger","active","focusIsLoose","focusIsInPanel","hydrated","isMounted","phase","className"],"sources":["../../src/components/popover/Popover.tsx"],"sourcesContent":["import React, {\n forwardRef,\n HTMLAttributes,\n ReactElement,\n ReactNode,\n Ref,\n useEffect,\n useId,\n useRef\n} from 'react'\nimport classNames from 'classnames'\nimport { mergeProps, useDialog, useOverlayPosition, useOverlayTrigger } from 'react-aria'\nimport { useOverlayTriggerState } from 'react-stately'\n\nimport {\n getOverlayArrowStyle,\n getOverlayTransitionClass,\n useFloatingOverlay,\n useForkedRef,\n useOpenStateProps,\n useTransitionState\n} from '../../hooks'\nimport { insideEventProps, isEventInside } from '../../utils/insideEvents'\nimport { Placement, resolveDataPlacement, toAriaPlacement } from '../../utils/overlayPlacement'\nimport { pushOverlay } from '../../utils/overlayStack'\nimport { useHydrated } from '../../hooks/useHydrated'\nimport { Portal } from '../portal/Portal'\nimport { getTriggerChild, renderSlotted } from '../../utils/slot'\n\ninterface PopoverPanelProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'content'> {\n arrowProps: HTMLAttributes<HTMLDivElement>\n content: ReactNode | string\n overlayRef: Ref<HTMLDivElement>\n overlayTriggerProps: HTMLAttributes<HTMLDivElement>\n title?: ReactNode | string\n}\n\n// A distinct component (rather than inline JSX in `Popover`) so `useDialog`'s own mount-focus\n// effect — which only fires on this component's mount, not on `overlayRef.current` merely\n// becoming non-null — actually runs each time the popover opens. `Popover` unmounts this once\n// it has exited and mounts it again on every open, giving `useDialog` a fresh mount each time.\nconst PopoverPanel = ({\n arrowProps,\n content,\n overlayRef,\n overlayTriggerProps,\n title,\n ...rest\n}: PopoverPanelProps) => {\n // `useDialog` focuses the panel through a ref object; the caller's ref is forked onto the same\n // node.\n const panelRef = useRef<HTMLDivElement>(null)\n const forkedRef = useForkedRef(overlayRef, panelRef)\n const { dialogProps, titleProps } = useDialog({}, panelRef)\n\n return (\n <div {...mergeProps(overlayTriggerProps, dialogProps, rest)} ref={forkedRef}>\n <div className=\"popover-arrow\" {...arrowProps} style={getOverlayArrowStyle(arrowProps)}></div>\n {title && (\n <div className=\"popover-header\" {...titleProps}>\n {title}\n </div>\n )}\n <div className=\"popover-body\">{content}</div>\n </div>\n )\n}\n\n// Every attribute besides the component's own props goes to the panel, the `.popover` element:\n// `className`, `style`, `id`, `data-*`, ARIA attributes and event handlers. So does the ref.\nexport interface PopoverProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'children' | 'content' | 'title'\n> {\n /**\n * The trigger: a single element, which opens the popover on click.\n */\n children: ReactElement\n /**\n * Content node for your component.\n */\n content: ReactNode | string\n /**\n * Whether the popover is open when it first renders. Use it instead of `visible` when nothing\n * outside needs to control the popover.\n */\n defaultVisible?: boolean\n /**\n * Offset of the popover relative to its target, as `[crossAxis, mainAxis]`.\n */\n offset?: [number, number]\n /**\n * Callback fired when the popover hides.\n */\n onHide?: () => void\n /**\n * Callback fired when the popover shows.\n */\n onShow?: () => void\n /**\n * Callback fired when the popover asks to show or hide: a click on the trigger, a click\n * outside, the Escape key, or the closing of the dialog it is in. Receives the state it asks\n * for. With `visible` set, the popover changes only when `visible` does.\n */\n onVisibleChange?: (visible: boolean) => void\n /**\n * Title node for your component.\n */\n title?: ReactNode | string\n /**\n * Describes the preferred placement of your component. Chassis will flip it to keep it in\n * view.\n */\n placement?: Placement\n /**\n * Whether the popover is open. Setting it makes the popover controlled: it shows and hides\n * only when this changes, so pair it with `onVisibleChange`. Leave it unset, or use\n * `defaultVisible`, for a popover that opens and closes itself.\n */\n visible?: boolean\n}\n\nexport const Popover = forwardRef<HTMLDivElement, PopoverProps>(function Popover(\n {\n children,\n className,\n content,\n defaultVisible,\n placement = 'right',\n offset: offsetProp = [0, 8],\n onHide,\n onShow,\n onVisibleChange,\n style,\n title,\n visible,\n ...rest\n },\n ref\n) {\n const arrowRef = useRef<HTMLDivElement>(null)\n const triggerRef = useRef<HTMLElement | null>(null)\n const floatingRef = useRef<HTMLDivElement>(null)\n const forkedFloatingRef = useForkedRef(ref, floatingRef)\n\n // The trigger is rendered as `asChild` renders a child (`renderSlotted`): the child's own\n // `onClick` chains after this one, and `triggerRef` is forked with the ref the caller put on\n // the child. `triggerProps` state the popover's condition (`aria-expanded`, `aria-controls`),\n // so they win over the child's own.\n const triggerElement = getTriggerChild(children, 'Popover')\n\n // A popover is a dialog, which needs a name. With no `title` to label it and none given, it is\n // named by its trigger, under the trigger's own id when it has one.\n const generatedId = useId()\n const triggerId =\n triggerElement && !title && rest['aria-label'] == null && rest['aria-labelledby'] == null\n ? ((triggerElement.props.id as string | undefined) ?? `${generatedId}-trigger`)\n : undefined\n\n const state = useOverlayTriggerState(\n useOpenStateProps({ defaultVisible, onVisibleChange, visible }, 'Popover')\n )\n const {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n triggerProps: { onPress: _onPress, ...triggerProps },\n overlayProps: overlayTriggerProps\n } = useOverlayTrigger({ type: 'dialog' }, state, triggerRef)\n\n const portalContainer = useFloatingOverlay({\n close: state.close,\n isOpen: state.isOpen,\n onHide,\n onShow,\n triggerRef\n })\n\n // A popover held open by `visible` with no `onVisibleChange` can't close on the key, and takes no\n // place in the stack: on top of it, it prevented every Escape, so a dialog under it couldn't\n // close either. `Tooltip` keeps such a tooltip out of react-aria's Escape handling the same way.\n const isHeld = visible !== undefined && !onVisibleChange\n\n // Escape should always close the popover, regardless of where focus currently is — a\n // mouse-opened popover leaves focus on the trigger, not inside the panel. Through the stack of\n // open overlays, so the key closes this popover only while nothing opened since is still open\n // (a menu or another popover in its content), and never the dialog around it with it.\n // `onExited` below already returns focus to the trigger once the exit transition finishes, so\n // this doesn't need to do that itself.\n useEffect(() => {\n if (!state.isOpen || isHeld) return undefined\n return pushOverlay({\n nodes: () => [floatingRef.current, triggerRef.current],\n onEscape: () => state.close()\n })\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [state.isOpen, state.close, isHeld])\n\n // A press outside closes the popover. A press rather than a click, as `ContextMenu` reads it:\n // an element its own click handler takes out of the document (a chip's remove button) is no\n // longer inside anything by the time a click listener here would ask. Inside is the trigger,\n // and anything React renders under the panel, wherever it is portaled (`insideEvents`): a\n // popover or a menu opened from the content, a date picker's calendar.\n // Deferred so a press whose own handler opens the popover doesn't close it again on its way\n // up to `window`.\n useEffect(() => {\n if (!state.isOpen) return undefined\n\n // By the event's path rather than its target: a trigger inside a shadow root is seen from\n // `window` as the shadow host, which the trigger doesn't contain, so pressing the trigger\n // closed the popover and its click opened it again.\n const isInside = (path: EventTarget[], node: Element | null) => !!node && path.includes(node)\n\n const handleDismiss = (event: PointerEvent) => {\n const path = event.composedPath()\n if (isInside(path, triggerRef.current)) return\n if (isInside(path, floatingRef.current) || isEventInside(event, floatingRef)) return\n state.close()\n }\n\n const id = window.setTimeout(() => {\n window.addEventListener('pointerdown', handleDismiss)\n })\n\n return () => {\n window.clearTimeout(id)\n window.removeEventListener('pointerdown', handleDismiss)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [state.isOpen, state.close])\n\n const {\n overlayProps,\n arrowProps,\n placement: resolvedPlacement\n } = useOverlayPosition({\n targetRef: triggerRef,\n overlayRef: floatingRef,\n placement: toAriaPlacement(placement),\n offset: offsetProp[1],\n crossOffset: offsetProp[0],\n arrowSize: 8,\n arrowRef,\n isOpen: state.isOpen,\n // `useOverlayPosition` closes on any window scroll via a backward-compat `WeakMap` that\n // `useOverlayTrigger` populates for `triggerRef.current` above. Passing `null` opts out so\n // the popover repositions with its trigger instead of vanishing — matching\n // `Autocomplete`/`Combobox`, neither of which is wired into that map.\n onClose: null\n })\n\n // The caller's `style` first: the position is the component's to set.\n const floatingStyle: React.CSSProperties = {\n ...style,\n position: overlayProps.style?.position as React.CSSProperties['position'],\n top: overlayProps.style?.top,\n left: overlayProps.style?.left\n }\n const placementAttr = resolveDataPlacement(placement, resolvedPlacement)\n\n // The panel mounts once its container is known (`useFloatingOverlay`), and only there.\n const { isMounted, phase } = useTransitionState({\n in: state.isOpen && portalContainer !== null,\n mountOnEnter: true,\n nodeRef: floatingRef,\n onExited: () => {\n const trigger = triggerRef.current\n if (!trigger || !document.contains(trigger)) return\n // Only reclaim focus when the popover still owns it, or when nothing does.\n // `useDialog` moves focus into the panel on open, so the panel still holds it here\n // for an Escape/inside close (`onExited` runs before the panel is taken out of the DOM,\n // so this reads the pre-removal state); an outside click on plain page\n // content instead leaves focus loose on `<body>`. Both are worth restoring. Any\n // other active element means the user deliberately put focus there — dismissing by\n // clicking another control, or the app closing the popover via `visible` while\n // they were typing somewhere else — and this used to steal it straight back off\n // them. Mirrors react-aria's own `shouldRestoreFocus` condition.\n const active = document.activeElement\n const focusIsLoose = !active || active === document.body\n const focusIsInPanel = !!active && !!floatingRef.current?.contains(active)\n if (!focusIsLoose && !focusIsInPanel) return\n trigger.focus()\n },\n unmountOnExit: true\n })\n\n // The panel is portaled, so it exists only once hydration has finished: until then the trigger\n // doesn't point `aria-controls` at it, or its HTML would refer to an id no element has.\n const hydrated = useHydrated()\n\n return (\n <>\n {triggerElement\n ? renderSlotted(\n triggerElement,\n { ...(triggerId && { id: triggerId }), onClick: () => state.toggle() },\n triggerRef,\n hydrated ? triggerProps : { ...triggerProps, 'aria-controls': undefined }\n )\n : children}\n <Portal container={portalContainer}>\n {isMounted && (\n <PopoverPanel\n className={classNames(\n 'popover cx-popover-auto',\n getOverlayTransitionClass(phase),\n className\n )}\n data-cx-placement={placementAttr}\n style={floatingStyle}\n overlayTriggerProps={overlayTriggerProps}\n overlayRef={forkedFloatingRef}\n arrowProps={arrowProps}\n title={title}\n content={content}\n aria-labelledby={trigger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,CAAiB,EAGjE,CAAE,aAAW,UAAUvD,EAAmB,CAC9C,GAAIuC,EAAM,QAAUK,IAAoB,KACxC,aAAc,GACd,QAASb,EACT,aAAgB,CACd,IAAM+B,EAAUhC,EAAW,QAC3B,GAAI,CAACgC,GAAW,CAAC,SAAS,SAASA,CAAO,EAAG,OAU7C,IAAMC,EAAS,SAAS,cAClBC,EAAe,CAACD,GAAUA,IAAW,SAAS,KAC9CE,EAAiB,CAAC,CAACF,GAAU,CAAC,CAAChC,EAAY,SAAS,SAASgC,CAAM,GACpEC,GAAiBC,IACtBH,EAAQ,MAAM,CAChB,EACA,cAAe,EACjB,CAAC,EAIKI,GAAWnE,EAAY,EAE7B,MACE,kBAAA,cAAAW,EAAA,SAAA,KACGwB,EACGtC,EACEsC,EACA,CAAE,GAAII,GAAa,CAAE,GAAIA,CAAU,EAAI,YAAeC,EAAM,OAAO,CAAE,EACrET,EACAoC,GAAWxB,EAAe,CAAE,GAAGA,EAAc,gBAAiB,IAAA,EAAU,CAC1E,EACAP,EACJ,kBAAA,cAAC5B,EAAD,CAAQ,UAAWqC,CAmBX,EAlBLuB,IACC,kBAAA,cAACvD,EAAD,CACE,UAAWD,EACT,0BACAV,EAA0BmE,EAAK,EAC/BC,CACF,EACA,oBAAmBR,GACnB,MAAOH,EACc,sBACrB,WAAY1B,EACA,aACL,QACE,UACT,kBAAiBM,EACjB,GAAInB,EAAWN,EAAMJ,EAAiBsB,CAAW,CAAC,CACnD,CAAA,CAEG,CACR,CAEN,CAAC,EAED,EAAQ,YAAc,U"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-Bs80iIBN.js";import{t as e}from"./useForkedRef-WoqMqsWE.js";import{t}from"./useFormField-DH2tlc3e.js";import{t as n}from"./useHeldBack-eeTfpa_t.js";import{t as r}from"./renderFormField-_6WswnEX.js";import{t as i}from"./validationClassName-gRGs4KBm.js";import a,{forwardRef as o,useRef as s}from"react";import c from"classnames";const l=o(({className:o,help:l,id:u,invalid:d,invalidFeedback:f,label:p,valid:m,validFeedback:h,...g},_)=>{let v=s(null),y=e(_,v),{invalid:b,valid:x}=n(v,{invalid:d,valid:m}),{describedBy:S,feedbackId:C,helpId:w,inputId:T}=t({ariaDescribedBy:g[`aria-describedby`],help:l,id:u,invalid:b,invalidFeedback:f,valid:x,validFeedback:h}),E=c(`form-range`,i(b,x),o);return r({children:/* @__PURE__ */ a.createElement(`input`,{...g,"aria-describedby":S,"aria-invalid":b||void 0,className:E,id:T,ref:y,type:`range`}),help:l,ids:{feedback:C,help:w,input:T},invalid:b,invalidFeedback:f,label:p,valid:x,validFeedback:h})});l.displayName=`RangeInput`;export{l as t};
|
|
2
|
-
//# sourceMappingURL=range-input-DeZq_9S7.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"range-input-DeZq_9S7.js","names":["useForkedRef","useHeldBack","renderFormField","validationClassName","React","classNames","RangeInput","forwardRef","invalidProp","validProp","rest","inputRef","useRef","forkedRef","ref","useFormField","_className","invalid","valid","className","describedBy","inputId","feedbackId","helpId"],"sources":["../../src/components/range-input/RangeInput.tsx"],"sourcesContent":["import React, {\n ChangeEventHandler,\n forwardRef,\n InputHTMLAttributes,\n ReactNode,\n useRef\n} from 'react'\nimport classNames from 'classnames'\n\nimport { useForkedRef, useFormField, useHeldBack } from '../../hooks'\nimport { validationClassName } from '../../utils/validationClassName'\nimport { renderFormField } from '../form-field/renderFormField'\n\nexport interface RangeInputProps extends InputHTMLAttributes<HTMLInputElement> {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Toggle the disabled state for the component.\n */\n disabled?: boolean\n /**\n * A description for the field, rendered below the range input.\n */\n help?: ReactNode\n /**\n * Set component validation state to invalid.\n */\n invalid?: boolean\n /**\n * An error message for the field, rendered below the range input when `invalid` is set.\n */\n invalidFeedback?: ReactNode\n /**\n * The field's caption, rendered as a `FormLabel` associated with this range input.\n */\n label?: ReactNode\n /**\n * Specifies the maximum value for the component.\n */\n max?: number\n /**\n * Specifies the minimum value for the component.\n */\n min?: number\n /**\n * Method called immediately after the `value` prop changes.\n */\n onChange?: ChangeEventHandler<HTMLInputElement>\n /**\n * Toggle the readonly state for the component.\n */\n readOnly?: boolean\n /**\n * Specifies the interval between legal numbers in the component.\n */\n step?: number\n /**\n * Set component validation state to valid.\n */\n valid?: boolean\n /**\n * A success message for the field, rendered below the range input when `valid` is set.\n */\n validFeedback?: ReactNode\n /**\n * The `value` attribute of component.\n *\n * @controllable onChange\n * */\n value?: string | number\n}\n\nexport const RangeInput = forwardRef<HTMLInputElement, RangeInputProps>(\n (\n {\n className,\n help,\n id,\n invalid: invalidProp,\n invalidFeedback,\n label,\n valid: validProp,\n validFeedback,\n ...rest\n },\n ref\n ) => {\n const inputRef = useRef<HTMLInputElement>(null)\n const forkedRef = useForkedRef(ref, inputRef)\n // A range input always has a value and holds no form back, but a `validated` form shows it\n // as valid (`useHeldBack`).\n const { invalid, valid } = useHeldBack(inputRef, { invalid: invalidProp, valid: validProp })\n\n const { describedBy, feedbackId, helpId, inputId } = useFormField({\n ariaDescribedBy: rest['aria-describedby'],\n help,\n id,\n invalid,\n invalidFeedback,\n valid,\n validFeedback\n })\n\n const _className = classNames('form-range', validationClassName(invalid, valid), className)\n\n return renderFormField({\n children: (\n <input\n {...rest}\n aria-describedby={describedBy}\n aria-invalid={invalid || undefined}\n className={_className}\n id={inputId}\n ref={forkedRef}\n type=\"range\"\n />\n ),\n help,\n ids: { feedback: feedbackId, help: helpId, input: inputId },\n invalid,\n invalidFeedback,\n label,\n valid,\n validFeedback\n })\n }\n)\n\nRangeInput.displayName = 'RangeInput'\n"],"mappings":"A,4VA0EA,MAAaM,EAAaC,GAEtB,CACE,YACA,OACA,KACA,QAASC,EACT,kBACA,QACA,MAAOC,EACP,gBACA,GAAGC,GAEL,IACG,CACH,IAAMC,EAAWC,EAAyB,IAAI,EACxCC,EAAYb,EAAac,EAAKH,CAAQ,EAGtC,CAAE,UAAS,SAAUV,EAAYU,EAAU,CAAE,QAASH,EAAa,MAAOC,CAAU,CAAC,EAErF,CAAE,cAAa,aAAY,SAAQ,WAAYM,EAAa,CAChE,gBAAiBL,EAAK,oBACtB,OACA,KACA,UACA,kBACA,QACA,eACF,CAAC,EAEKM,EAAaX,EAAW,aAAcF,EAAoBc,EAASC,CAAK,EAAGC,CAAS,EAE1F,OAAOjB,EAAgB,CACrB,SACE,kBAAA,cAAC,QAAD,CACE,GAAIQ,EACJ,mBAAkBU,EAClB,eAAcH,GAAW,IAAA,GACzB,UAAWD,EACX,GAAIK,EACJ,IAAKR,EACL,KAAK,OACN,CAAA,EAEH,OACA,IAAK,CAAE,SAAUS,EAAY,KAAMC,EAAQ,MAAOF,CAAQ,EAC1D,UACA,kBACA,QACA,QACA,eACF,CAAC,CACH,CACF,EAEA,EAAW,YAAc,a"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-Bs80iIBN.js";import{S as e}from"./slot-BQVx1Eew.js";import{t}from"./useForkedRef-WoqMqsWE.js";import{t as n}from"./useFormField-DH2tlc3e.js";import{t as r}from"./useHeldBack-eeTfpa_t.js";import{t as i}from"./renderFormField-_6WswnEX.js";import{t as a}from"./validationClassName-gRGs4KBm.js";import o,{forwardRef as s,useRef as c}from"react";import l from"classnames";const u=s(({adornEnd:s,adornStart:u,children:d,className:f,help:p,htmlSize:m,id:h,invalid:g,invalidFeedback:_,label:v,multiple:y,options:b,placeholder:x,size:S,valid:C,validFeedback:w,...T},E)=>{let D=c(null),O=t(E,D),{invalid:k,valid:A}=r(D,{invalid:g,valid:C}),j=Array.isArray(b)?b.filter(e=>typeof e==`object`&&!!e.selected).map(e=>e.value==null?e.label??``:String(e.value)):[];e(!y&&j.length>1,"Select: more than one option has `selected: true` but `multiple` is not set — only the last one will be selected, matching native <select> behavior.");let M=T.value!==void 0||T.defaultValue!==void 0?void 0:j.length?y?j:j[j.length-1]:x&&!y?``:void 0,{describedBy:N,feedbackId:P,helpId:F,inputId:I}=n({ariaDescribedBy:T[`aria-describedby`],help:p,id:h,invalid:k,invalidFeedback:_,valid:A,validFeedback:w}),L=u!=null||s!=null,R=!y&&(!m||m<=1),z=l(L?`ghost-input`:`form-input`,!L&&S,a(k,A),!L&&f),B=e=>{let t=D.current,n=e.target;if(t&&!t.disabled&&R&&n!==t&&!n.closest(`button, a`)){t.focus();try{t.showPicker?.()}catch{}}},V=/* @__PURE__ */ o.createElement(`select`,{...T,"aria-describedby":N,"aria-invalid":k||void 0,className:z,id:I,multiple:y,ref:O,size:m,...M!==void 0&&{defaultValue:M}},x&&/* @__PURE__ */ o.createElement(`option`,{value:``,disabled:!0},x),b?b.map((e,t)=>/* @__PURE__ */ o.createElement(`option`,{...typeof e==`object`&&e.disabled&&{disabled:e.disabled},...typeof e==`object`&&e.value!=null&&{value:e.value},key:t},typeof e==`string`?e:e.label??String(e.value??``))):d),H=L?/* @__PURE__ */ o.createElement(`div`,{className:l(`form-input`,R&&`form-caret`,S,f),onClick:B},u,V,s):V;return i({children:H,help:p,ids:{feedback:P,help:F,input:I},invalid:k,invalidFeedback:_,label:v,valid:A,validFeedback:w})});u.displayName=`Select`;export{u as t};
|
|
2
|
-
//# sourceMappingURL=select-DwyL6aqY.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"select-DwyL6aqY.js","names":["devWarning","useFormField","useHeldBack","renderFormField","validationClassName","React","classNames","Select","forwardRef","invalidProp","validProp","rest","selectRef","useRef","forkedRef","useForkedRef","ref","selectedValues","options","option","multiple","inferredDefaultValue","placeholder","hasAdorn","adornStart","adornEnd","isDropdown","htmlSize","selectClassName","size","invalid","valid","className","handleWrapperClick","node","target","event","select","describedBy","inputId","index","children","rendered","feedbackId","helpId"],"sources":["../../src/components/select/Select.tsx"],"sourcesContent":["import React, {\n ChangeEventHandler,\n forwardRef,\n InputHTMLAttributes,\n MouseEventHandler,\n ReactNode,\n useRef\n} from 'react'\nimport classNames from 'classnames'\n\nimport { useForkedRef, useFormField, useHeldBack } from '../../hooks'\nimport { validationClassName } from '../../utils/validationClassName'\nimport { renderFormField } from '../form-field/renderFormField'\nimport { devWarning } from '../../utils/devWarning'\n\nexport interface SelectOptionDef {\n /**\n * Marks the option as disabled — it can't be clicked or reached via the keyboard.\n */\n disabled?: boolean\n /**\n * Label text rendered inside the option. Falls back to the browser's default (the `value`,\n * stringified) when omitted.\n */\n label?: string\n /**\n * Marks the option as selected by default (uncontrolled) — resolved into the select's own\n * `defaultValue`, and ignored when the select's `value`/`defaultValue` is set directly. Set on\n * more than one option only when `multiple` is also set on `Select` — otherwise, matching\n * native `<select>` behavior, only the last option with `selected` set wins.\n */\n selected?: boolean\n /**\n * The option's value attribute.\n */\n value?: string | number\n}\nexport interface SelectProps extends Omit<InputHTMLAttributes<HTMLSelectElement>, 'size'> {\n /**\n * Content rendered at the select's trailing edge, e.g. a `InputAdorn` icon, text, or button.\n * Setting either `adornStart` or `adornEnd` renders a `.form-input` wrapper around a\n * `.ghost-input`, matching chassis-css's [input help](https://chassis-ui.com/css/docs/forms/input-adorn) pattern.\n * Clicking anywhere in the wrapper (other than an actionable adorn) opens the select, since the\n * native element itself no longer fills the wrapper's full width.\n */\n adornEnd?: ReactNode\n /**\n * Content rendered at the select's leading edge, e.g. a `InputAdorn` icon, text, or button.\n * Setting either `adornStart` or `adornEnd` renders a `.form-input` wrapper around a\n * `.ghost-input`, matching chassis-css's [input help](https://chassis-ui.com/css/docs/forms/input-adorn) pattern.\n * Clicking anywhere in the wrapper (other than an actionable adorn) opens the select, since the\n * native element itself no longer fills the wrapper's full width.\n */\n adornStart?: ReactNode\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * A description for the field, rendered below the select.\n */\n help?: ReactNode\n /**\n * Specifies the number of visible options in a drop-down list.\n */\n htmlSize?: number\n /**\n * Set component validation state to invalid. Left unset, the component shows as invalid by itself\n * from a submit it held back (an empty `required` one, say) until it no longer would, or its\n * form is reset. Set it, to `false` too, and it alone decides.\n */\n invalid?: boolean\n /**\n * An error message for the field, rendered below the select when `invalid` is set, and after a\n * submit the field held back, until it no longer would.\n */\n invalidFeedback?: ReactNode\n /**\n * The field's caption, rendered as a `FormLabel` associated with this select.\n */\n label?: ReactNode\n /**\n * Allows more than one option to be selected at once. Pass `value` as a string array (or set\n * `selected` on more than one `options` entry) to control the selection.\n */\n multiple?: boolean\n /**\n * Method called immediately after the `value` prop changes.\n */\n onChange?: ChangeEventHandler<HTMLSelectElement>\n /**\n * Options list of the select component. Available keys: `label`, `value`, `disabled`,\n * `selected`.\n * Examples:\n * - `options={[{ value: 'js', label: 'JavaScript' }, { value: 'html', label: 'HTML', disabled: true }]}`\n * - `options={['js', 'html']}`\n */\n options?: SelectOptionDef[] | string[]\n /**\n * Renders a disabled placeholder option as the first item (e.g. `\"Select a country…\"`).\n * The option has an empty value so it is not selectable once another option is chosen. A\n * single select with no `value`, `defaultValue` or `selected` option starts on it, so its value\n * is `''` and a `required` one holds its form back until an option is chosen.\n */\n placeholder?: string\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 select when `valid` is set.\n */\n validFeedback?: ReactNode\n /**\n * The `value` attribute of component.\n *\n * @controllable onChange\n * */\n value?: string | string[] | number\n}\n\nexport const Select = forwardRef<HTMLSelectElement, SelectProps>(\n (\n {\n adornEnd,\n adornStart,\n children,\n className,\n help,\n htmlSize,\n id,\n invalid: invalidProp,\n invalidFeedback,\n label,\n multiple,\n options,\n placeholder,\n size,\n valid: validProp,\n validFeedback,\n ...rest\n },\n ref\n ) => {\n const selectRef = useRef<HTMLSelectElement>(null)\n const forkedRef = useForkedRef(ref, selectRef)\n // Shown as invalid from a submit it held back until it no longer would (`useHeldBack`). The\n // browser's own message stays: no react-aria hook is given this control to cancel it. It is\n // on the first invalid control of the form alone, and gone at the next click.\n const { invalid, valid } = useHeldBack(selectRef, { invalid: invalidProp, valid: validProp })\n\n const selectedValues = Array.isArray(options)\n ? options\n .filter(\n (option): option is SelectOptionDef => typeof option === 'object' && !!option.selected\n )\n // The value the option renders with: its `value`, else its text, as for a native\n // `<option>` with no `value` attribute.\n .map((option) => (option.value != null ? String(option.value) : (option.label ?? '')))\n : []\n\n devWarning(\n !multiple && selectedValues.length > 1,\n 'Select: more than one option has `selected: true` but `multiple` is not set — only ' +\n 'the last one will be selected, matching native <select> behavior.'\n )\n\n // React warns against setting `selected` directly on <option>, recommending `defaultValue`/\n // `value` on <select> instead — so `options[].selected` is resolved into a `defaultValue`\n // here rather than rendered as an attribute. Left alone when the caller already controls\n // `value`/`defaultValue` themselves. A single select with a `placeholder` and nothing chosen\n // starts on the placeholder: a browser selects the first option that isn't disabled instead,\n // which made that option the value and let a `required` select submit with nothing chosen.\n const isUnset = rest.value === undefined && rest.defaultValue === undefined\n const inferredDefaultValue = !isUnset\n ? undefined\n : selectedValues.length\n ? multiple\n ? selectedValues\n : selectedValues[selectedValues.length - 1]\n : placeholder && !multiple\n ? ''\n : undefined\n\n const { describedBy, feedbackId, helpId, inputId } = useFormField({\n ariaDescribedBy: rest['aria-describedby'],\n help,\n id,\n invalid,\n invalidFeedback,\n valid,\n validFeedback\n })\n\n const hasAdorn = adornStart != null || adornEnd != null\n // A caret can only pop the dropdown open when the select actually renders as one - an inline\n // listbox (`multiple`, or a `size` greater than 1) has no picker to show.\n const isDropdown = !multiple && (!htmlSize || htmlSize <= 1)\n\n // chassis-css's `.form-input:has(.ghost-input.is-valid)` selector reads validation state off\n // the inner select, not the wrapper, once adorns turn `.form-input` into a flex container -\n // see https://chassis-ui.com/css/docs/forms/input-adorn.\n const selectClassName = classNames(\n hasAdorn ? 'ghost-input' : 'form-input',\n !hasAdorn && size,\n validationClassName(invalid, valid),\n !hasAdorn && className\n )\n\n const handleWrapperClick: MouseEventHandler<HTMLDivElement> = (event) => {\n const node = selectRef.current\n const target = event.target as HTMLElement\n if (!node || node.disabled || !isDropdown || target === node || target.closest('button, a'))\n return\n node.focus()\n try {\n // showPicker() opens the native dropdown from a proxy click; unsupported browsers fall\n // back to the focus() above, same as tabbing to a bare select and pressing Space/Down.\n node.showPicker?.()\n } catch {\n // Can throw without a user activation or under a policy-restricted embed - focus() still\n // leaves the select reachable via the keyboard.\n }\n }\n\n const select = (\n <select\n {...rest}\n aria-describedby={describedBy}\n aria-invalid={invalid || undefined}\n className={selectClassName}\n id={inputId}\n multiple={multiple}\n ref={forkedRef}\n size={htmlSize}\n {...(inferredDefaultValue !== undefined && { defaultValue: inferredDefaultValue })}\n >\n {placeholder && (\n <option value=\"\" disabled>\n {placeholder}\n </option>\n )}\n {options\n ? options.map((option, index) => {\n return (\n <option\n {...(typeof option === 'object' &&\n option.disabled && { disabled: option.disabled })}\n {...(typeof option === 'object' &&\n option.value != null && { value: option.value })}\n // eslint-disable-next-line react/no-array-index-key\n key={index}\n >\n {typeof option === 'string'\n ? option\n : (option.label ?? String(option.value ?? ''))}\n </option>\n )\n })\n : children}\n </select>\n )\n\n const rendered = hasAdorn ? (\n <div\n className={classNames('form-input', isDropdown && 'form-caret', size, className)}\n onClick={handleWrapperClick}\n >\n {adornStart}\n {select}\n {adornEnd}\n </div>\n ) : (\n select\n )\n\n return renderFormField({\n children: rendered,\n help,\n ids: { feedback: feedbackId, help: helpId, input: inputId },\n invalid,\n invalidFeedback,\n label,\n valid,\n validFeedback\n })\n }\n)\n\nSelect.displayName = 'Select'\n"],"mappings":"A,mYA6HA,MAAaO,EAASC,GAElB,CACE,WACA,aACA,WACA,YACA,OACA,WACA,KACA,QAASC,EACT,kBACA,QACA,WACA,UACA,cACA,OACA,MAAOC,EACP,gBACA,GAAGC,GAEL,IACG,CACH,IAAMC,EAAYC,EAA0B,IAAI,EAC1CC,EAAYC,EAAaC,EAAKJ,CAAS,EAIvC,CAAE,UAAS,SAAUV,EAAYU,EAAW,CAAE,QAASH,EAAa,MAAOC,CAAU,CAAC,EAEtFO,EAAiB,MAAM,QAAQC,CAAO,EACxCA,EACG,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CACE,GAAK,OAAOC,GAAW,UACrBA,EAAO,UAAY,CAAE,SAAUA,EAAO,QAAS,EACjD,GAAK,OAAOA,GAAW,UACrBA,EAAO,OAAS,MAAQ,CAAE,MAAOA,EAAO,KAAM,EAEhD,IAAKqB,CAKC,EAHL,OAAOrB,GAAW,SACfA,EACCA,EAAO,OAAS,OAAOA,EAAO,OAAS,EAAE,CACxC,CAEX,EACDsB,CACE,EAGJC,EAAWnB,EACf,kBAAA,cAAC,MAAD,CACE,UAAWjB,EAAW,aAAcoB,GAAc,aAAcG,EAAMG,CAAS,EAC/E,QAASC,CAKN,EAHFT,EACAa,EACAZ,CACE,EAELY,EAGF,OAAOlC,EAAgB,CACrB,SAAUuC,EACV,OACA,IAAK,CAAE,SAAUC,EAAY,KAAMC,EAAQ,MAAOL,CAAQ,EAC1D,UACA,kBACA,QACA,QACA,eACF,CAAC,CACH,CACF,EAEA,EAAO,YAAc,S"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./lazyElement-tfMG21pZ.js";import{t}from"./useForkedRef-WoqMqsWE.js";import n,{Fragment as r,cloneElement as i,createContext as a,forwardRef as o,isValidElement as s,useContext as c}from"react";import{mergeProps as l}from"react-aria";const u=process.env.NODE_ENV!==`production`,d=/* @__PURE__ */ new Set;function f(e,t){u&&e&&!d.has(t)&&(d.add(t),console.warn(t))}function p(e,t){u&&e&&!d.has(t)&&(d.add(t),console.error(t))}function m(e){switch(e){case`a`:return`anchor`;case`button`:return`button`;case`input`:return`input`;default:return`host`}}let h=null;function g(e,t){let n=h;h=e;try{return t()}finally{h=n}}function _(e){if(typeof e==`string`)return m(e);let t=e.slotKind;return t===`component`&&h?x(h):t??`component`}function v(e){if(typeof e.slotKind!=`string`||!h)return;let t=h.props.id;return typeof t==`string`&&t!==``?t:void 0}function y(e){return typeof e==`string`?e:e.slotTag}function b(e,t,n){let r=_(e);if(r!==`component`)return r;let i=n?.to;return t!=null||i!=null?`anchor`:r}function x(e){return b(e.type,e.props.href,e.props)}function S(t){let n=t.asChild?e(t.children):void 0;return s(n)?x(n):t.component===void 0?C(t.href)?`anchor`:void 0:b(t.component,t.href,t)}const C=e=>e!=null;function w(e,t,n){return e??(C(t)?`a`:n)}function T(e,t,n){return C(t)?e===`anchor`||e===`component`?{href:t}:(f(!0,`${n}: \`href\` was ignored, because the element it renders isn't a link. Leave out \`component\` to render an <a>, or pass a link as \`component\` or as the \`asChild\` element.`),{}):{}}const E=e=>e===`anchor`||e===`button`,D=(...e)=>e.filter(Boolean).join(` `)||void 0,O=(...e)=>D(...new Set(e.flatMap(e=>e?e.split(` `):[]))),k=(e,...t)=>D(...(e?.split(` `)??[]).filter(e=>!t.includes(e))),A=(e,...t)=>({...e,"aria-describedby":k(e[`aria-describedby`],...t.map(e=>e.id))}),j=a(null),M=j.Provider,N=()=>c(j);function P(e){return e.props.ref}function F(e,r){let a=o(function({children:e,...r},a){let o=c(j),s=t(a,o?P(o):void 0);if(!o)return null;let u={...l(r,o.props)},d=r.style,f=o.props.style;d&&f&&(u.style={...d,...f});let p=D(r[`aria-describedby`],o.props[`aria-describedby`]);return p?u[`aria-describedby`]=p:delete u[`aria-describedby`],o.props[`aria-label`]!=null&&o.props[`aria-labelledby`]==null&&delete u[`aria-labelledby`],r[`aria-disabled`]===!0&&(u.onClick=r.onClick),/* @__PURE__ */ n.createElement(j.Provider,{value:null},i(o,{...u,ref:s},e))});return Object.assign(a,{slotKind:e,slotTag:r})}const I=F(`component`,void 0),L=/* @__PURE__ */ new Map;function R(e){let t=e.type;if(typeof t!=`string`)return I;let n=L.get(t);return n||(n=F(x(e),t),L.set(t,n)),n}function z(e,t,r,a={}){let o=Object.entries(a).filter(([,e])=>e!==void 0),s=o.length?i(e,Object.fromEntries(o)):e;return/* @__PURE__ */ n.createElement(M,{value:s},/* @__PURE__ */ n.createElement(I,{...t,ref:r},e.props.children))}const B=e=>typeof e?.slotKind==`string`;function V(t){let n=e(t);return s(n)&&n.type!==r?n:null}function H(e,t){let n=V(e);return f(!n,`${t}: \`asChild\` expects exactly one React element as its child (not text, a fragment, or several elements); rendering the default element instead.`),n}function U(e,t){let n=V(e);return f(!n,`${t}: expects exactly one React element as its trigger (not text, a fragment, or several elements); rendering the children with nothing to open it.`),n}export{f as S,S as _,B as a,g as b,D as c,C as d,T as f,y as g,_ as h,U as i,O as l,w as m,R as n,z as o,E as p,H as r,N as s,M as t,A as u,b as v,p as x,v as y};
|
|
2
|
-
//# sourceMappingURL=slot-BQVx1Eew.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slot-BQVx1Eew.js","names":["resolveLazy","React","IS_DEV","warned","devWarning","condition","message","devError","kindOfTag","tag","slotted","withSlottedElement","previous","element","render","resolveElementKind","component","kind","resolveSlottedKind","resolveSlottedId","id","resolveElementTag","resolveLinkKind","to","props","href","resolveKindFromProps","child","isValidElement","hasHref","linkElement","fallback","hrefProps","displayName","isInteractiveKind","joinIds","ids","joinUniqueIds","values","value","withoutIds","withoutSlotIds","slots","slot","SlotContext","createContext","SlotProvider","useSlotElement","useContext","getElementRef","createSlot","Slot","forwardRef","slotProps","forkedRef","useForkedRef","ref","mergeProps","slotStyle","childStyle","describedBy","cloneElement","children","ComponentSlot","tagSlots","getSlot","renderSlotted","defined","owned","isSlot","getSingleElement","Fragment","getSlotChild","getTriggerChild"],"sources":["../../src/utils/devWarning.ts","../../src/utils/elementKind.ts","../../src/utils/idRefs.ts","../../src/utils/slot.tsx"],"sourcesContent":["// Development-only misuse warnings, in one place so every component reports misuse the same way\n// and none of it reaches a consumer's production bundle.\n//\n// Two problems this fixes over calling `console.warn` directly, which is what every call site used\n// to do:\n//\n// 1. **They fired in production.** Nothing in this package guarded on `NODE_ENV`, so every\n// `console.warn` ran for end users of a consuming app. `process.env.NODE_ENV` is the idiom\n// bundlers (Vite, webpack, Turbopack, Rollup) replace with a literal, so in a production build\n// `IS_DEV` folds to `false` and no warning is ever emitted. Relying on that substitution adds\n// no new constraint: `react-dom` — a peer dependency, so always present — already requires\n// exactly the same replacement.\n// 2. **They repeated.** Most call sites warn during render, so a warning re-fired on every\n// re-render, and twice per render under StrictMode's double-invoke. De-duplicating on the\n// message means a misuse is reported once and stays readable in the console.\n//\n// What this does *not* do is strip the message strings from the bundle. Measured with esbuild\n// against the built `dist/index.js`: a `NODE_ENV=production` consumer bundle still contains them.\n// `tsdown` minifies this package's own output first (`minify: true`), collapsing each function to\n// a `IS_DEV && cond && ...` expression, and a consumer's minifier won't then inline that call to\n// discover its arguments are droppable. Building unminified would let them drop, at the cost of\n// shipping pretty-printed dist — not worth it for a few hundred gzipped bytes. The behavior that\n// mattered (nothing logged in production, nothing repeated in development) is the part that's\n// fixed; treat the strings as part of the bundle's fixed cost.\nconst IS_DEV = process.env.NODE_ENV !== 'production'\n\nconst warned = new Set<string>()\n\n/**\n * Resets the de-duplication set. Test-only — the suite asserts on these warnings, and without a\n * reset between tests the *second* test in a file to trigger the same message would see nothing.\n * Called from a global `beforeEach` in `test/setup.ts`.\n */\nexport function resetDevWarnings(): void {\n warned.clear()\n}\n\n/**\n * Logs `message` once via `console.warn` when `condition` is true, in development builds only.\n * Use for a recoverable misuse: the component still renders something sensible.\n */\nexport function devWarning(condition: boolean, message: string): void {\n if (!IS_DEV) return\n if (!condition || warned.has(message)) return\n warned.add(message)\n console.warn(message)\n}\n\n/**\n * Logs `message` once via `console.error` when `condition` is true, in development builds only.\n * Use for a misuse that leaves the component genuinely broken (e.g. a required prop missing).\n */\nexport function devError(condition: boolean, message: string): void {\n if (!IS_DEV) return\n if (!condition || warned.has(message)) return\n warned.add(message)\n console.error(message)\n}\n","import { ElementType, isValidElement, ReactElement, ReactNode } from 'react'\n\nimport { devWarning } from './devWarning'\nimport { resolveLazy } from './lazyElement'\n\n// What a polymorphic component ends up rendering, as far as its own semantics care:\n//\n// - `anchor`, `button`, `input`: the native element, which the component gives its full handling\n// (a real `disabled` attribute, or `aria-disabled`/`tabIndex`/a click guard on an anchor).\n// - `host`: any other HTML tag, which has no semantics of its own to rely on.\n// - `component`: a component reference, trusted to handle its own semantics.\n//\n// A render function asks `resolveElementKind(Component)` instead of comparing `Component` to a tag\n// name, because under `asChild` `Component` is a `Slot` (see `./slot`), not the tag the caller's\n// child element renders. The `Slot` carries that element's kind and tag.\nexport type ElementKind = 'anchor' | 'button' | 'input' | 'host' | 'component'\n\nfunction kindOfTag(tag: string): ElementKind {\n switch (tag) {\n case 'a':\n return 'anchor'\n case 'button':\n return 'button'\n case 'input':\n return 'input'\n default:\n return 'host'\n }\n}\n\ntype SlotLike = { slotKind?: ElementKind; slotTag?: string }\n\ntype SlottedElement = ReactElement<Record<string, unknown>>\n\n// The element the `Slot` of the render function now running stands in for. A host element's\n// `Slot` carries its kind, which can't change without the element changing. A component element's\n// kind follows its `href` and `to`, which come and go, and a `Slot` chosen by them would be a new\n// component, remounting the caller's child, each time they did. So component elements share one\n// `Slot`, and their kind is read from the element itself while the render function runs.\nlet slotted: SlottedElement | null = null\n\n// Runs a render function whose `component` is a `Slot` standing in for `element`. Only\n// `createPolymorphicComponent` calls it.\nexport function withSlottedElement<T>(element: SlottedElement | null, render: () => T): T {\n const previous = slotted\n slotted = element\n try {\n return render()\n } finally {\n slotted = previous\n }\n}\n\nexport function resolveElementKind(component: ElementType): ElementKind {\n if (typeof component === 'string') return kindOfTag(component)\n const kind = (component as SlotLike).slotKind\n // `component` only for the `Slot` of a component element: a tag is never that kind.\n if (kind === 'component' && slotted) return resolveSlottedKind(slotted)\n return kind ?? 'component'\n}\n\n// The `id` the caller's `asChild` element carries, which wins over the component's own in the\n// `Slot`'s merge. A component that points another element at its own (a dialog title, a context\n// menu region) reads it here, while it renders, so the reference names the id that is rendered.\nexport function resolveSlottedId(component: ElementType): string | undefined {\n if (typeof (component as SlotLike).slotKind !== 'string' || !slotted) return undefined\n const id = slotted.props.id\n return typeof id === 'string' && id !== '' ? id : undefined\n}\n\n// The HTML tag that gets rendered, for a render function whose markup depends on a tag that has\n// no kind of its own (`List` renders `<li>` items only inside a `<ul>`/`<ol>`). `undefined` for a\n// component, whose output isn't known.\nexport function resolveElementTag(component: ElementType): string | undefined {\n return typeof component === 'string' ? component : (component as SlotLike).slotTag\n}\n\n// The kind of what a component renders, given the props it renders it with. A component reference\n// with a link target (`<Link href=\"/login\">` of Next.js, `<Link to=\"/login\">` of React Router)\n// counts as an anchor: router links render an `<a>` and forward what they're given to it, so they\n// need the anchor's disabled handling (`aria-disabled`, `tabindex=\"-1\"`, a blocked click), not a\n// `disabled` attribute passed through. This holds for the link passed as `component` and for the\n// one handed to `asChild` alike. `props` is where `to` is found: a component's remaining props.\nexport function resolveLinkKind(\n component: ElementType,\n href: unknown,\n props?: Record<string, unknown> | object\n): ElementKind {\n const kind = resolveElementKind(component)\n if (kind !== 'component') return kind\n const to = (props as { to?: unknown } | undefined)?.to\n return href != null || to != null ? 'anchor' : kind\n}\n\n// The kind of the element a caller handed to `asChild`.\nexport function resolveSlottedKind(element: SlottedElement): ElementKind {\n return resolveLinkKind(element.type as ElementType, element.props.href, element.props)\n}\n\n// The same question asked from outside, by a parent reading a child's props (`List` deciding its\n// own tag from its `ListItem`s). `undefined` when the child chose nothing and renders its default.\nexport function resolveKindFromProps(props: {\n asChild?: boolean\n children?: ReactNode\n component?: ElementType\n href?: string\n to?: unknown\n}): ElementKind | undefined {\n const child = props.asChild ? resolveLazy(props.children) : undefined\n if (isValidElement<Record<string, unknown>>(child)) return resolveSlottedKind(child)\n if (props.component !== undefined) return resolveLinkKind(props.component, props.href, props)\n return hasHref(props.href) ? 'anchor' : undefined\n}\n\n// One rule for `href`, followed by every component that accepts one:\n//\n// - The element is `component`, or the `asChild` element, when one is given. Otherwise `href` makes\n// it an `<a>`, and without `href` the component renders its own default (`linkElement`).\n// - `href` reaches the rendered element only when that element can take it: an `<a>`, or a\n// component reference, which is trusted to take it (a router link does). A `<button>`, an `<li>`\n// or any other tag never gets one, and in development the component says so (`hrefProps`).\n// - A component reference given `href` or `to` is a link, and is handled as an anchor\n// (`resolveLinkKind`).\n//\n// An empty string is set: `href=\"\"` is a link to the current document.\nexport const hasHref = (href: string | null | undefined): href is string => href != null\n\nexport function linkElement(\n component: ElementType | undefined,\n href: string | undefined,\n fallback: ElementType\n): ElementType {\n return component ?? (hasHref(href) ? 'a' : fallback)\n}\n\nexport function hrefProps(\n kind: ElementKind,\n href: string | undefined,\n displayName: string\n): { href?: string } {\n if (!hasHref(href)) return {}\n if (kind === 'anchor' || kind === 'component') return { href }\n devWarning(\n true,\n `${displayName}: \\`href\\` was ignored, because the element it renders isn't a link. Leave ` +\n `out \\`component\\` to render an <a>, or pass a link as \\`component\\` or as the \\`asChild\\` ` +\n `element.`\n )\n return {}\n}\n\nexport const isInteractiveKind = (kind: ElementKind | undefined): boolean =>\n kind === 'anchor' || kind === 'button'\n","// An id-reference attribute (`aria-describedby`, `aria-labelledby`) from the ids that apply, or\n// `undefined` when none does, so the attribute is left out rather than written empty.\nexport const joinIds = (...ids: (string | false | null | undefined)[]): string | undefined =>\n ids.filter(Boolean).join(' ') || undefined\n\n// As `joinIds`, for values that may each hold several ids and may repeat one: a consumer's own\n// `aria-labelledby` naming the label that a wrapper already hands down.\nexport const joinUniqueIds = (\n ...values: (string | false | null | undefined)[]\n): string | undefined =>\n joinIds(...new Set(values.flatMap((value) => (value ? value.split(' ') : []))))\n\n// `value` without the given ids: for an id-reference attribute a react-aria hook built from ids\n// that may not be rendered, such as the description and error-message ids of its `useField`.\nexport const withoutIds = (\n value: string | undefined,\n ...ids: (string | undefined)[]\n): string | undefined => joinIds(...(value?.split(' ') ?? []).filter((id) => !ids.includes(id)))\n\n// `props` with the ids of react-aria's description and error-message slots taken out of its\n// `aria-describedby`. `useField` always writes both into the server's HTML and drops each only\n// after hydration, once it finds no element with that id: this library renders its own help and\n// feedback under other ids. See FORMS.md, gotcha 6.\nexport const withoutSlotIds = <P extends { 'aria-describedby'?: string }>(\n props: P,\n ...slots: { id?: string }[]\n): P => ({\n ...props,\n 'aria-describedby': withoutIds(props['aria-describedby'], ...slots.map((slot) => slot.id))\n})\n","import React, {\n cloneElement,\n createContext,\n CSSProperties,\n forwardRef,\n Fragment,\n isValidElement,\n ReactElement,\n ReactNode,\n Ref,\n useContext\n} from 'react'\nimport { mergeProps } from 'react-aria'\n\nimport { useForkedRef } from '../hooks/useForkedRef'\nimport { devWarning } from './devWarning'\nimport { ElementKind, resolveSlottedKind } from './elementKind'\nimport { joinIds } from './idRefs'\nimport { resolveLazy } from './lazyElement'\n\n// Backs the `asChild` prop every polymorphic component accepts (see `createPolymorphicComponent`).\n// The component renders a `Slot` as its `component`; the `Slot` then renders the caller's child\n// element in its place, with the props the component computed (className, handlers, ARIA\n// attributes, ref) merged onto it.\n//\n// There is one `Slot` per tag, and one for every component element, and the component gets the\n// one that matches the child. A render function reads the child's kind and tag back with\n// `resolveElementKind(Component)`/`resolveElementTag(Component)` (see `./elementKind`) and gives a\n// slotted `<a>` the handling it gives `component=\"a\"`. A tag's kind travels on its `Slot` rather\n// than in a prop, so nothing extra can reach the DOM. A component element's kind is whether it\n// has a link target, which can change between renders, so it is read from the element while the\n// render function runs (`withSlottedElement`): a `Slot` per kind would remount the child when its\n// `href` came or went.\n//\n// The child element travels through context rather than a prop because a render function spreads\n// its `rest` props onto `component` in its own way (some filter them, some don't forward every\n// one) — context reaches `Slot` no matter how the render function wires it up. `Slot` resets the\n// context for its own subtree, so a polymorphic component nested *inside* the child doesn't pick\n// up the outer one's element.\ntype SlotElement = ReactElement<Record<string, unknown>>\n\nconst SlotContext = createContext<SlotElement | null>(null)\n\nexport const SlotProvider = SlotContext.Provider\n\n// The element `asChild` handed to the nearest polymorphic component, for a component rendered\n// beside its `Slot`. A render function can't read it: it runs above the provider.\nexport const useSlotElement = (): SlotElement | null => useContext(SlotContext)\n\n// The ref the caller put on an element. React 19 made `ref` an ordinary prop, and warns on\n// reading `element.ref`.\nexport function getElementRef<T = unknown>(element: ReactElement): Ref<T> | undefined {\n return (element.props as { ref?: Ref<T> }).ref\n}\n\n// `Record` rather than a declared prop list: `Slot` forwards whatever the render function hands it.\ntype SlotProps = Record<string, unknown>\n\nfunction createSlot(slotKind: ElementKind, slotTag: string | undefined) {\n const Slot = forwardRef<unknown, SlotProps>(function Slot({ children, ...slotProps }, ref) {\n const element = useContext(SlotContext)\n const forkedRef = useForkedRef(ref, element ? getElementRef(element) : undefined)\n if (!element) return null\n\n // react-aria's `mergeProps`: the child's own props win over the component's, except that\n // classNames concatenate, event handlers chain (the component's first), and ids merge.\n // Descriptions add up too: a child's own `aria-describedby` keeps the component's (a\n // `Tooltip`'s) rather than replacing it.\n const props: Record<string, unknown> = { ...mergeProps(slotProps, element.props) }\n // `mergeProps` takes the child's `style` whole, which dropped the inline styles the component\n // computed (a `Grid`'s `--cx-grid-gap`, a `GridItem`'s `gridTemplateRows`) under a child with\n // any style of its own. Property by property instead, the child's winning.\n const slotStyle = slotProps.style as CSSProperties | undefined\n const childStyle = element.props.style as CSSProperties | undefined\n if (slotStyle && childStyle) props.style = { ...slotStyle, ...childStyle }\n // Written only when there is one: a key set to `undefined` would replace a description the\n // child's own component writes before spreading its props.\n const describedBy = joinIds(\n slotProps['aria-describedby'] as string | undefined,\n element.props['aria-describedby'] as string | undefined\n )\n if (describedBy) props['aria-describedby'] = describedBy\n else delete props['aria-describedby']\n // The child's own name wins too. `aria-labelledby` outranks `aria-label` when an element is\n // named, so the component's (a `Divider`'s label) would replace the name the child was given.\n if (element.props['aria-label'] != null && element.props['aria-labelledby'] == null) {\n delete props['aria-labelledby']\n }\n // A component marks an element that has no `disabled` attribute (an `<a>`, a `<div>`) with\n // `aria-disabled`, and blocks its click itself. The child's own `onClick` would still run\n // from the chain, so the component's handler replaces it: a disabled element doesn't act on\n // a click.\n if (slotProps['aria-disabled'] === true) props.onClick = slotProps.onClick\n\n return (\n <SlotContext.Provider value={null}>\n {cloneElement(element, { ...props, ref: forkedRef }, children as ReactNode)}\n </SlotContext.Provider>\n )\n })\n return Object.assign(Slot, { slotKind, slotTag })\n}\n\n// The `Slot` of every component element, and the one `renderSlotted` renders for any element. A\n// `Slot` has to be the same component on every render, or React would remount the child, and one\n// chosen by the element's kind would change when its `href` came or went.\nconst ComponentSlot = createSlot('component', undefined)\n\n// Created on first use and kept, for the same reason. A host element changes with its tag\n// anyway, so its `Slot` can carry the tag and the kind.\nconst tagSlots = new Map<string, ReturnType<typeof createSlot>>()\n\n// The `Slot` a component renders for this child element.\nexport function getSlot(element: SlotElement) {\n const tag = element.type\n if (typeof tag !== 'string') return ComponentSlot\n let slot = tagSlots.get(tag)\n if (!slot) {\n slot = createSlot(resolveSlottedKind(element), tag)\n tagSlots.set(tag, slot)\n }\n return slot\n}\n\n// Renders an element the component doesn't own, such as the trigger of a `Tooltip` or a\n// `Popover`, the way `asChild` renders a child: with the component's `props` merged into the\n// element's own and `ref` forked with the element's ref. `owned` holds the attributes that state\n// the component's own condition (a `Popover` trigger's `aria-expanded` and `aria-controls`): they\n// win over the element's, which the merge would otherwise let win.\nexport function renderSlotted(\n element: SlotElement,\n props: object,\n ref: Ref<unknown>,\n owned: Record<string, unknown> = {}\n): ReactElement {\n const defined = Object.entries(owned).filter(([, value]) => value !== undefined)\n const slotted = defined.length ? cloneElement(element, Object.fromEntries(defined)) : element\n return (\n <SlotProvider value={slotted}>\n <ComponentSlot {...props} ref={ref}>\n {element.props.children as ReactNode}\n </ComponentSlot>\n </SlotProvider>\n )\n}\n\n// Whether a render function's `component` is a `Slot`, that is, whether it renders under `asChild`.\nexport const isSlot = (component: unknown): boolean =>\n typeof (component as { slotKind?: ElementKind } | null)?.slotKind === 'string'\n\n// The single element in `children`, or `null` when it isn't exactly one (text, a fragment,\n// several elements).\n//\n// A Server Component's child can arrive as a lazy node (#37, see `./lazyElement`): it is resolved\n// first, which suspends this component while the child is still loading.\nfunction getSingleElement(children: ReactNode): SlotElement | null {\n const child = resolveLazy(children)\n return isValidElement<Record<string, unknown>>(child) && child.type !== Fragment ? child : null\n}\n\n// The single element `asChild` renders in place of the component's own element, or `null` (with\n// a dev warning) when `children` isn't exactly one — the component then falls back to rendering\n// its default element, so a misuse degrades to a working, if unstyled-as-intended, UI.\nexport function getSlotChild(children: ReactNode, displayName: string): SlotElement | null {\n const child = getSingleElement(children)\n devWarning(\n !child,\n `${displayName}: \\`asChild\\` expects exactly one React element as its child (not text, a ` +\n `fragment, or several elements); rendering the default element instead.`\n )\n return child\n}\n\n// The trigger of a `Tooltip` or `Popover`, rendered with `renderSlotted`, or `null` (with a dev\n// warning) when `children` isn't exactly one element. The component then renders `children` as\n// they are, with nothing to open it.\nexport function getTriggerChild(children: ReactNode, displayName: string): SlotElement | null {\n const child = getSingleElement(children)\n devWarning(\n !child,\n `${displayName}: expects exactly one React element as its trigger (not text, a fragment, ` +\n `or several elements); rendering the children with nothing to open it.`\n )\n return child\n}\n"],"mappings":"A,6PAwBA,MAAME,EAAS,QAAQ,IAAI,WAAa,aAElCC,kBAAS,IAAI,IAenB,SAAgBC,EAAW,EAAoB,EAAuB,CAC/DF,GACAG,GAAa,GAAO,IAAIC,CAAO,IACpCH,EAAO,IAAIG,CAAO,EAClB,QAAQ,KAAKA,CAAO,EACtB,CAMA,SAAgBC,EAAS,EAAoB,EAAuB,CAC7DL,GACAG,GAAa,GAAO,IAAIC,CAAO,IACpCH,EAAO,IAAIG,CAAO,EAClB,QAAQ,MAAMA,CAAO,EACvB,CCxCA,SAASE,EAAU,EAA0B,CAC3C,OAAQC,EAAR,CACE,IAAK,IACH,MAAO,SACT,IAAK,SACH,MAAO,SACT,IAAK,QACH,MAAO,QACT,QACE,MAAO,MACX,CACF,CAWA,IAAIC,EAAiC,KAIrC,SAAgBC,EAAsB,EAAgC,EAAoB,CACxF,IAAMC,EAAWF,EACjB,EAAUG,EACV,GAAI,CACF,OAAOC,EAAO,CAChB,QAAU,CACR,EAAUF,CACZ,CACF,CAEA,SAAgBG,EAAmB,EAAqC,CACtE,GAAI,OAAOC,GAAc,SAAU,OAAOR,EAAUQ,CAAS,EAC7D,IAAMC,EAA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,EAAQ2C,EAAiBR,CAAQ,EAMvC,OALA1D,EACE,CAACuB,EACD,GAAGM,EAAY,iJAEjB,EACON,CACT,CAKA,SAAgB8C,EAAgB,EAAqB,EAAyC,CAC5F,IAAM9C,EAAQ2C,EAAiBR,CAAQ,EAMvC,OALA1D,EACE,CAACuB,EACD,GAAGM,EAAY,gJAEjB,EACON,CACT,C"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-Bs80iIBN.js";import{t as e}from"./useForkedRef-WoqMqsWE.js";import{t}from"./useHeldBack-eeTfpa_t.js";import{t as n}from"./FormLabel-CpzWYh6U.js";import{t as r}from"./validationClassName-gRGs4KBm.js";import{n as i,r as a}from"./unhandledProps-9Kdj7WVf.js";import o,{forwardRef as s,useRef as c}from"react";import l from"classnames";import{useSwitch as u}from"react-aria";import{useToggleState as d}from"react-stately";const f=({bareClassName:e,checkInputClassName:t,className:r,input:i,label:a,style:s})=>a?/* @__PURE__ */ o.createElement(n,{customClassName:r,style:s},/* @__PURE__ */ o.createElement(`span`,{className:t},i),a):/* @__PURE__ */ o.createElement(`span`,{className:e,style:s},i),p=({className:e,color:t,forkedRef:n,id:i,inputProps:a,invalid:s,label:c,size:u,style:d,valid:p})=>{let m=l(r(s,p)),h=l(`check-input`,t,r(s,p)),g=l(`form-check form-switch`,u,r(s,p),e);return f({bareClassName:l(h,e),checkInputClassName:h,className:g,input:/* @__PURE__ */ o.createElement(`input`,{...a,className:m,id:i,ref:n}),label:c,style:d})},m=s(({className:n,children:r,color:o,defaultSelected:s,disabled:l,id:f,invalid:m,isSelected:h,label:g,onChange:_,size:v,style:y,valid:b,...x},S)=>{let C=c(null),w=e(S,C),{invalid:T,valid:E}=t(C,{invalid:m,valid:b}),D=g??r,O=d({defaultSelected:s,isDisabled:l,isSelected:h,onChange:_}),{inputProps:k}=u({...x,children:D,isDisabled:l,isInvalid:T,value:x.value},O,C);return p({className:n,color:o,forkedRef:w,id:f,inputProps:{...a(k,x,i),"aria-describedby":x[`aria-describedby`]},invalid:T,label:D,size:v,style:y,valid:E})});m.displayName=`SwitchCheckbox`;const h=s(({children:n,className:r,color:i,defaultSelected:a,disabled:o,id:s,invalid:l,isSelected:u,label:d,onChange:f,size:m,style:h,valid:g,..._},v)=>{let y=c(null),b=e(v,y),{invalid:x,valid:S}=t(y,{invalid:l,valid:g}),C=d??n,w={..._,"aria-invalid":x||void 0,checked:u,defaultChecked:a,disabled:o,onChange:e=>f?.(e.target.checked),role:`switch`,type:`radio`};return p({className:r,color:i,forkedRef:b,id:s,inputProps:w,invalid:x,label:C,size:m,style:h,valid:S})});h.displayName=`SwitchRadio`;const g=s(({type:e=`checkbox`,...t},n)=>e===`radio`?/* @__PURE__ */ o.createElement(h,{...t,ref:n}):/* @__PURE__ */ o.createElement(m,{...t,ref:n}));g.displayName=`Switch`;export{g as t};
|
|
2
|
-
//# sourceMappingURL=switch-cp3IZg3L.js.map
|