@chassis-ui/react 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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-BQh3uJWB.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-DEu-Nbv8.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-DpX_lRYf.js → nav-overflow-BxAhoMh3.js} +2 -2
- package/dist/chunks/{nav-overflow-DpX_lRYf.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-264aGoBR.js +0 -2
- package/dist/chunks/Menu-264aGoBR.js.map +0 -1
- package/dist/chunks/MenuToggle-DcPEh55c.js +0 -2
- package/dist/chunks/MenuToggle-DcPEh55c.js.map +0 -1
- package/dist/chunks/alert-DSLg5MBb.js +0 -2
- package/dist/chunks/autocomplete-99usnvgh.js +0 -2
- package/dist/chunks/autocomplete-99usnvgh.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-BQh3uJWB.js +0 -2
- package/dist/chunks/context-menu-8KIuH4cJ.js +0 -2
- package/dist/chunks/context-menu-8KIuH4cJ.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-DEu-Nbv8.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-8mQL2Q6d.js +0 -2
- package/dist/chunks/useOverlayMaxHeight-8mQL2Q6d.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{c as e}from"./slot-BQVx1Eew.js";import{t}from"./useForkedRef-WoqMqsWE.js";import{t as n}from"./polymorphic-CZIFszAy.js";import{t as r}from"./useIsomorphicLayoutEffect-BbqRwuqn.js";import{t as i}from"./useDialogElement-BfygWBPZ.js";import{t as a}from"./Icon-Dk5_q79o.js";import{n as o}from"./colorClassNames-YzGWu6qm.js";import{t as s}from"./CloseButton-BPUI5iGX.js";import{t as c}from"./Button-ZU-x1uN_.js";import l,{createContext as u,forwardRef as d,useCallback as f,useContext as p,useId as m,useRef as h,useState as g}from"react";import _ from"classnames";const v=u({close:()=>{},registerPart:()=>()=>{}}),y=()=>p(v),b=d(({"aria-describedby":t,"aria-labelledby":n,backdrop:r=`static`,children:a,className:o,closeButton:c,closeLabel:u,defaultVisible:d,instant:p,keyboard:m=!1,onClick:h,onClose:y,onClosePrevented:b,onHidden:x,onKeyDown:S,onShow:C,onShown:w,onVisibleChange:T,open:E,visible:D,...O},k)=>{let{close:A,forkedRef:j,handleBackdropClick:M,handleCancel:N,handleKeyDown:P,handleNativeClose:F,hiding:I,staticBounce:L}=i({backdrop:r,defaultVisible:d,instant:p,isModal:!0,keyboard:m,onClick:h,onClose:y,onClosePrevented:b,onHidden:x,onKeyDown:S,onShow:C,onShown:w,onVisibleChange:T,open:E,ref:k,visible:D}),[R,z]=g([]),B=f((e,t,n)=>{let r={id:n,kind:e,node:t};return z(e=>[...e,r]),()=>z(e=>e.filter(e=>e!==r))},[]),V=e=>R.filter(t=>t.kind===e).sort((e,t)=>e.node.compareDocumentPosition(t.node)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1).map(({id:e})=>e),H=n||e(...V(`title`)),U=t||e(...V(`description`)),W={close:A,registerPart:B};return/* @__PURE__ */ l.createElement(v.Provider,{value:W},/* @__PURE__ */ l.createElement(`dialog`,{"aria-describedby":U,"aria-labelledby":H,role:`alertdialog`,...O,open:E,className:_(`alert`,`dialog`,{instant:p,hiding:I,"dialog-static":L},o),onCancel:N,onClick:M,onClose:F,onKeyDown:P,ref:j},a,c&&/* @__PURE__ */ l.createElement(s,{label:u,onClick:A})))});b.displayName=`Alert`;function x({children:e,className:t,component:n,...r},i){let a=n??`div`;return/* @__PURE__ */ l.createElement(a,{className:_(`alert-body`,t),...r,ref:i},e)}const S=n(x,`AlertBody`),C=d(({color:e=`default`,onClick:t,...n},r)=>{let{close:i}=y();return/* @__PURE__ */ l.createElement(c,{color:e,"data-autofocus":``,...n,onClick:e=>{t?.(e),e.defaultPrevented||i()},ref:r})});C.displayName=`AlertCancel`;function w(e){let t=h(null),{registerPart:n}=y(),i=h({});return r(()=>{let r=t.current,a=r?.id||void 0;a!==i.current.id&&(i.current.unregister?.(),i.current=r&&a?{id:a,unregister:n(e,r,a)}:{})}),r(()=>()=>{i.current.unregister?.(),i.current={}},[n]),t}function T({children:e,className:n,component:r,id:i,...a},o){let s=r??`code`,c=m(),u=w(`description`),d=t(o,u);return/* @__PURE__ */ l.createElement(s,{className:_(`alert-code`,n),id:i??c,...a,ref:d},e)}const E=n(T,`AlertCode`);function D({children:e,className:t,component:n,stacked:r,...i},a){let o=n??`div`;return/* @__PURE__ */ l.createElement(o,{className:_(`alert-footer`,{stacked:r},t),...i,ref:a},e)}const O=n(D,`AlertFooter`),k=d(({className:e,color:t,...n},r)=>/* @__PURE__ */ l.createElement(a,{className:_(`alert-icon`,t&&o[t],e),...n,ref:r}));k.displayName=`AlertIcon`;function A({children:e,className:n,component:r,id:i,...a},o){let s=r??`p`,c=m(),u=w(`description`),d=t(o,u);return/* @__PURE__ */ l.createElement(s,{className:n,id:i??c,...a,ref:d},e)}const j=n(A,`AlertText`);function M({children:e,className:n,component:r,id:i,...a},o){let s=r??`h2`,c=m(),u=w(`title`),d=t(o,u);return/* @__PURE__ */ l.createElement(s,{className:_(`alert-title`,n),id:i??c,...a,ref:d},e)}const N=n(M,`AlertTitle`);export{E as a,b as c,O as i,j as n,C as o,k as r,S as s,N as t};
|
|
2
|
-
//# sourceMappingURL=alert-DSLg5MBb.js.map
|
|
@@ -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{r as n}from"./useFloatingOverlay-BuiI_CCn.js";import{t as r}from"./useFormField-DH2tlc3e.js";import{t as ee}from"./useOverlayMaxHeight-8mQL2Q6d.js";import{i as te,r as ne,t as re}from"./overlayPlacement-Q6bcbXA5.js";import{t as ie}from"./useRequiredValueInput-gYN8I-LY.js";import{a as ae,i as oe,n as se,r as ce,t as le}from"./ComboboxListBox-Db0rSM3w.js";import{t as ue}from"./Portal-BTDylxAi.js";import{t as de}from"./renderFormField-_6WswnEX.js";import i,{forwardRef as a,useEffect as o,useMemo as s,useRef as c,useState as fe}from"react";import l from"classnames";import{mergeProps as u,useButton as d,useComboBox as f,useFilter as p,useOverlayPosition as m}from"react-aria";import{useComboBoxState as pe}from"react-stately";const h=e=>null;h.displayName=`AutocompleteGroup`;const g=e=>null;g.displayName=`AutocompleteItem`;const _=e=>e==null?[]:Array.isArray(e)?e:[e],v=(e,t)=>{if(e!==void 0)return t?_(e):Array.isArray(e)?e[0]??null:e},me=(e,t)=>{let n=_(e),r=_(t);return n.length===r.length&&n.every((e,t)=>e===r[t])},y=a(function({children:a,className:y,defaultValue:he,disabled:b,help:x,id:ge,invalid:S,invalidFeedback:C,items:w,label:T,multiple:E=!1,name:D,noResultsText:_e=`No results found`,onChange:ve,placeholder:O,required:k,searchPlaceholder:A,size:j,valid:M,validFeedback:N,value:P,...F},ye){let I=s(()=>w?ce(w):se(a,{Group:h,Item:g}),[w,a]),be=s(()=>ae(I),[I]),{contains:xe}=p({sensitivity:`base`}),[L,Se]=t(v(P,E),v(he,E)??(E?[]:null),ve),[Ce,R]=fe(``),z=pe({children:oe,defaultItems:I,disabledKeys:be,defaultFilter:xe,selectionMode:E?`multiple`:`single`,value:L,onChange:e=>{let t=_(e),n=E?t:t[0]??null;R(``),me(n,L)||Se(n)},inputValue:Ce,onInputChange:R,onOpenChange:e=>{e||R(``)},allowsEmptyCollection:!0,menuTrigger:`manual`}),B=c(null),we=e(ye,B),V=c(null),H=c(null),U=c(null),W=c(null),G=_(z.value),{inputProps:K,missing:Te,valid:q}=ie(W,{focus:()=>B.current?.focus(),invalid:S,required:k&&(!E||G.length===0),valid:M}),J=S||Te,{describedBy:Ee,feedbackId:De,helpId:Oe,inputId:ke,labelId:Ae,labelledBy:Y}=r({ariaDescribedBy:F[`aria-describedby`],ariaLabelledBy:F[`aria-labelledby`],help:x,id:ge,invalid:J,invalidFeedback:C,label:T,valid:q,validFeedback:N}),{buttonProps:je,inputProps:Me,listBoxProps:Ne}=f({"aria-label":F[`aria-label`],"aria-labelledby":Y,buttonRef:B,id:ke,inputRef:V,listBoxRef:H,popoverRef:U,isDisabled:b,isRequired:k,placeholder:A},z),{buttonProps:X}=d({...je,elementType:`div`,isDisabled:b,excludeFromTabOrder:!1},B),Z=c(z.isOpen);o(()=>{if(z.isOpen&&!Z.current)V.current?.focus();else if(!z.isOpen&&Z.current){let e=document.activeElement;(!e||e===document.body||U.current?.contains(e))&&B.current?.focus()}Z.current=z.isOpen},[z.isOpen]),o(()=>{if(!z.isOpen)return;let e=B.current;for(;e&&e!==document.body;)e.removeAttribute(`aria-hidden`),e=e.parentElement},[z.isOpen]);let{overlayProps:Pe,placement:Fe}=m({targetRef:B,overlayRef:U,placement:te(`bottom-start`),offset:2,isOpen:z.isOpen,onClose:null});ee(U,z.isOpen);let Ie=n({close:z.close,isOpen:z.isOpen,triggerRef:B}),{menuStyle:Le,placementAttr:Re}=ne(Pe.style,`bottom-start`,Fe),Q={...re,...Le},ze=e=>z.selectionManager.toggleSelection(e),Be=u(Me,{onKeyDown:e=>{if(!E||e.key!==`Backspace`||e.currentTarget.value!==``)return;let t=z.selectedItems[z.selectedItems.length-1];t&&ze(t.key)}}),$=z.selectedItems.length>0,Ve=$?z.selectedItems.length===1?z.selectedItems[0]?.textValue??``:`${z.selectedItems.length} selected`:O;return de({children:/* @__PURE__ */ i.createElement(i.Fragment,null,/* @__PURE__ */ i.createElement(`div`,{className:l(`form-input`,`combobox`,{sm:j===`sm`,lg:j===`lg`,disabled:b},{"is-invalid":J,"is-valid":q},y),...u(F,X),tabIndex:X.tabIndex,"aria-label":F[`aria-label`],"aria-labelledby":Y,"aria-describedby":Ee,"aria-invalid":J||void 0,ref:we},/* @__PURE__ */ i.createElement(`span`,{className:l(`combobox-value`,{"combobox-placeholder":!$})},Ve)),/* @__PURE__ */ i.createElement(ue,{container:Ie},/* @__PURE__ */ i.createElement(`div`,{className:l(`menu`,{show:z.isOpen}),"data-cx-placement":Re,style:Q,hidden:!z.isOpen,ref:U},/* @__PURE__ */ i.createElement(`div`,{className:`combobox-search`},/* @__PURE__ */ i.createElement(`input`,{autoComplete:`off`,className:`form-input combobox-search-input sm`,...Be,ref:V})),/* @__PURE__ */ i.createElement(le,{state:z,listBoxProps:Ne,listBoxRef:H}),z.collection.size===0&&/* @__PURE__ */ i.createElement(`div`,{className:`combobox-no-results`},_e))),E?/* @__PURE__ */ i.createElement(i.Fragment,null,D&&G.map(e=>/* @__PURE__ */ i.createElement(`input`,{key:e,type:`hidden`,name:D,value:e,disabled:b})),K&&/* @__PURE__ */ i.createElement(`input`,{disabled:b,value:``,...K,ref:W})):(D||k)&&/* @__PURE__ */ i.createElement(`input`,{type:`hidden`,name:D,value:G[0]??``,disabled:b,...K,ref:W})),help:x,ids:{feedback:De,help:Oe,label:Ae},invalid:J,invalidFeedback:C,label:T,valid:q,validFeedback:N})});y.displayName=`Autocomplete`;export{g as n,h as r,y as t};
|
|
2
|
-
//# sourceMappingURL=autocomplete-99usnvgh.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete-99usnvgh.js","names":["useForkedRef","useFloatingOverlay","useFormField","useOverlayMaxHeight","toAriaPlacement","resolveMenuOverlayPositioning","COMBOBOX_MENU_OVERLAY_STYLE","useRequiredValueInput","getDisabledKeys","comboboxCollectionChildren","buildEntriesFromChildren","buildEntriesFromItemsDef","ComboboxListBox","Portal","renderFormField","React","classNames","AutocompleteGroup","AutocompleteItem","asKeyArray","value","toModeValue","multiple","isSameSelection","left","a","right","b","key","index","Autocomplete","forwardRef","validProp","rest","entries","useMemo","items","children","disabledKeys","useFilter","selection","setSelection","useControllableState","defaultValue","onChange","query","setQuery","useState","state","useComboBoxState","contains","keyArray","keys","next","isOpen","triggerRef","useRef","forkedTriggerRef","ref","inputRef","listBoxRef","popoverRef","valueInputRef","selectedKeys","requiredInputProps","required","showInvalid","invalid","missing","useComboBox","labelledBy","inputId","disabled","searchPlaceholder","triggerButtonProps","useButton","buttonProps","wasOpen","useEffect","active","node","resolvedPlacement","useOverlayPosition","portalContainer","overlayProps","overlayStyle","menuStyle","removeSelected","inputHtmlProps","mergeProps","inputProps","event","last","hasSelection","triggerText","placeholder","size","valid","className","describedBy","placementAttr","noResultsText","name","feedbackId","helpId","labelId"],"sources":["../../src/components/autocomplete/AutocompleteGroup.tsx","../../src/components/autocomplete/AutocompleteItem.tsx","../../src/components/autocomplete/Autocomplete.tsx"],"sourcesContent":["import { ComboboxGroupProps } from '../combobox/ComboboxGroup'\n\n// Same shape as `ComboboxGroupProps` — see `AutocompleteItemProps` for why this is its own\n// named type instead of a re-export.\nexport type AutocompleteGroupProps = ComboboxGroupProps\n\n// `AutocompleteGroup` is never actually mounted — like `ComboboxGroup`, it's read as data by\n// `Autocomplete`, which splits its top-level children into groups (wrapping react-stately\n// `Section` nodes) and bare items. Groups and bare items can be mixed at the top level:\n//\n// <Autocomplete aria-label=\"Language\">\n// <AutocompleteGroup label=\"Frontend\">\n// <AutocompleteItem id=\"html\">HTML</AutocompleteItem>\n// <AutocompleteItem id=\"css\">CSS</AutocompleteItem>\n// </AutocompleteGroup>\n// <AutocompleteItem id=\"python\">Python</AutocompleteItem>\n// </Autocomplete>\nexport const AutocompleteGroup = (_props: AutocompleteGroupProps): null => null\n\nAutocompleteGroup.displayName = 'AutocompleteGroup'\n","import { ComboboxItemProps } from '../combobox/ComboboxItem'\n\n// Same shape as `ComboboxItemProps` — kept as its own named type (rather than re-exporting\n// `ComboboxItemProps` directly) so `Autocomplete`'s public API doesn't leak an unrelated\n// component's prop type, even though the two are structurally identical under the hood.\nexport type AutocompleteItemProps = ComboboxItemProps\n\n// `AutocompleteItem` is never actually mounted — like `ComboboxItem`, it's read as data by\n// `Autocomplete`, which builds react-aria's listbox collection from each item's `id` and\n// `children`. This keeps the public authoring shape as plain composed JSX:\n//\n// <Autocomplete aria-label=\"Fruit\">\n// <AutocompleteItem id=\"apple\">Apple</AutocompleteItem>\n// <AutocompleteItem id=\"banana\">Banana</AutocompleteItem>\n// </Autocomplete>\nexport const AutocompleteItem = (_props: AutocompleteItemProps): null => null\n\nAutocompleteItem.displayName = 'AutocompleteItem'\n","import React, {\n forwardRef,\n HTMLAttributes,\n InputHTMLAttributes,\n ReactNode,\n useEffect,\n useMemo,\n useRef,\n useState\n} from 'react'\nimport classNames from 'classnames'\nimport { mergeProps, useButton, useComboBox, useFilter, useOverlayPosition } from 'react-aria'\nimport { Key, useComboBoxState } from 'react-stately'\n\nimport {\n useControllableState,\n useFloatingOverlay,\n useForkedRef,\n useFormField,\n useOverlayMaxHeight,\n useRequiredValueInput\n} from '../../hooks'\nimport {\n buildEntriesFromChildren,\n buildEntriesFromItemsDef,\n ComboboxEntry,\n comboboxCollectionChildren,\n getDisabledKeys\n} from '../combobox/comboboxCollection'\nimport {\n COMBOBOX_MENU_OVERLAY_STYLE,\n resolveMenuOverlayPositioning,\n toAriaPlacement\n} from '../../utils/overlayPlacement'\nimport { Portal } from '../portal/Portal'\nimport { ComboboxListBox } from '../combobox/ComboboxListBox'\nimport { renderFormField } from '../form-field/renderFormField'\nimport { MenuItemsDef } from '../menu/MenuItemDef'\nimport { AutocompleteGroup } from './AutocompleteGroup'\nimport { AutocompleteItem } from './AutocompleteItem'\n\n// `useComboBoxState`/`useComboBox` are generic over a `SelectionMode` ('single' | 'multiple')\n// that only affects *types* — actual runtime behavior (whether a selection closes the menu,\n// disallows an empty selection, *and* whether `state.value`/`onChange`'s callback argument come\n// through as a bare `Key` or a `Key[]`) is driven entirely by the `selectionMode` *string* passed\n// at the call site below, not by this type parameter. Fixing the parameter at `'multiple'` here\n// (the more permissive of the two shapes) lets one component serve both modes without a full\n// code fork, but it means the type system's claim that `state.value`/`onChange`'s argument are\n// always `Key[]` is untrustworthy for single-select at runtime — confirmed by testing (the\n// naive `keys[0]` on a bare string key silently returned its first *character*). `asKeyArray`\n// normalizes either shape; every read of `state.value` or `onChange`'s argument goes through it.\nconst asKeyArray = (value: unknown): Key[] => {\n if (value == null) return []\n return Array.isArray(value) ? value : [value as Key]\n}\n\n// The selection in the shape of the mode: `Key[]` with `multiple`, else a `Key` or `null`, which\n// react-stately reads as \"nothing selected\" and keeps controlled. `undefined` stays `undefined`\n// (an uncontrolled `value`).\nconst toModeValue = (\n value: Key | Key[] | null | undefined,\n multiple: boolean\n): Key | Key[] | null | undefined => {\n if (value === undefined) return undefined\n if (multiple) return asKeyArray(value)\n return Array.isArray(value) ? (value[0] ?? null) : value\n}\n\nconst isSameSelection = (a: Key | Key[] | null, b: Key | Key[] | null) => {\n const left = asKeyArray(a)\n const right = asKeyArray(b)\n return left.length === right.length && left.every((key, index) => key === right[index])\n}\n\nexport interface AutocompleteProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'defaultValue'\n> {\n /**\n * An accessible label for the autocomplete, used when there's no visible `<label>`.\n */\n 'aria-label'?: string\n /**\n * Identifies a visible `<label>` element for the autocomplete.\n */\n 'aria-labelledby'?: string\n /**\n * `AutocompleteItem` elements, optionally wrapped in `AutocompleteGroup` — read as data by\n * `Autocomplete` to build the option list. Not rendered directly. Ignored when `items` is set.\n */\n children?: ReactNode\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * The initial selected option's id(s) (uncontrolled). An array when `multiple` is set.\n */\n defaultValue?: Key | Key[] | null\n /**\n * Prevents the autocomplete from being focused or interacted with.\n */\n disabled?: boolean\n /**\n * A description for the field, rendered below the autocomplete.\n */\n help?: ReactNode\n /**\n * `id` forwarded to the search input inside the popover. The toggle — the field's real,\n * always-focusable surface — has no single labelable element `<label for>` can target (it's a\n * `role=\"button\"` `<div>`, and the search input itself is hidden until open), so `label` is\n * associated via `aria-labelledby` on the toggle instead. See FORMS.md's \"role=group\" pattern.\n */\n id?: string\n /**\n * Set component validation state to invalid.\n */\n invalid?: boolean\n /**\n * An error message for the field, rendered below the autocomplete when `invalid` is set, and\n * after a submit that a `required` autocomplete with nothing selected held back.\n */\n invalidFeedback?: ReactNode\n /**\n * Array of item/header/divider definitions for data-driven rendering. When provided, children\n * are ignored. A `'header'` entry starts a group that all following items join until the next\n * header or the end of the array. `'divider'` entries are a no-op here — use\n * `AutocompleteGroup` composition instead if you need finer control over grouping. An entry's\n * `href`/`onClick` are `Menu`-only and are not read here — use `onChange` to react to the\n * selection instead.\n */\n items?: MenuItemsDef\n /**\n * The field's caption, rendered as a `FormLabel` associated with the toggle.\n */\n label?: ReactNode\n /**\n * Allows more than one option to be selected. The toggle shows the single selection's label,\n * or an \"N selected\" count once more than one is picked. The menu stays open after each\n * selection, and `Backspace` in the empty search field removes the last selected option.\n */\n multiple?: boolean\n /**\n * `name` of auto-created hidden input(s), kept in sync with the selection, for native form\n * submission. Single-select renders one; `multiple` renders one per selected key. Omit to skip\n * hidden-input creation.\n */\n name?: string\n /**\n * Text shown in the listbox when no options match the current query.\n */\n noResultsText?: ReactNode\n /**\n * Callback fired when the selection changes. Receives an array of keys when `multiple` is set.\n */\n onChange?: (value: Key | Key[] | null) => void\n /**\n * Text shown on the toggle when nothing is selected.\n */\n placeholder?: string\n /**\n * Toggle the required state for the component. A required autocomplete with nothing selected\n * holds its form back from submitting, takes focus on its toggle and shows as invalid, with\n * `invalidFeedback`, until an option is selected or the form is reset. `invalid`, once set, and\n * `valid` decide how it looks instead.\n */\n required?: boolean\n /**\n * Placeholder for the search field inside the dropdown.\n */\n searchPlaceholder?: string\n /**\n * Size the component sm or lg.\n */\n size?: 'sm' | 'lg'\n /**\n * Set component validation state to valid.\n */\n valid?: boolean\n /**\n * A success message for the field, rendered below the autocomplete when `valid` is set.\n */\n validFeedback?: ReactNode\n /**\n * The selected option's id(s) (controlled). An array when `multiple` is set.\n */\n value?: Key | Key[] | null\n}\n\n// `Autocomplete` implements chassis-css's button-trigger combobox — a display-only toggle\n// (not a text input) that opens a `.menu` containing its own search field, matching\n// https://chassis-ui.com/css/docs/forms/combobox/#search-field. This is deliberately NOT the\n// same composition as `Combobox` (whose text input *is* the trigger): here, react-aria's\n// `useComboBox` is given a separate `buttonRef` — a first-class option the hook supports\n// specifically for this \"button opens a listbox with its own input\" shape — so the real\n// `role=\"combobox\"` input lives inside the popover (styled as `.combobox-search-input`) while a\n// toggle serves as the always-visible, always-focusable trigger. The toggle is a `<div\n// role=\"button\">` (via `useButton`'s `elementType: 'div'`, the same pattern `Button.tsx` uses\n// for a non-native trigger) rather than a real `<button>` — an earlier version rendered\n// removable chips inside it for `multiple` mode, which a real (or ARIA) button can't legally\n// contain per axe's `nested-interactive` check; that's now plain \"N selected\" text instead (see\n// `triggerText` below), but the `<div>` stays since reverting buys little and this is proven.\n// `useComboBox`'s own `buttonProps` also sets `excludeFromTabOrder: true` by default — correct\n// for its usual \"auxiliary button beside an always-visible input\" composition, wrong here since\n// the toggle is the *only* focusable surface before opening; overridden back to reachable below.\n// The ref goes to the toggle, the `.combobox` element, as `Combobox`'s goes to its own.\nexport const Autocomplete = forwardRef<HTMLDivElement, AutocompleteProps>(function Autocomplete(\n {\n children,\n className,\n defaultValue,\n disabled,\n help,\n id,\n invalid,\n invalidFeedback,\n items,\n label,\n multiple = false,\n name,\n noResultsText = 'No results found',\n onChange,\n placeholder,\n required,\n searchPlaceholder,\n size,\n valid: validProp,\n validFeedback,\n value,\n ...rest\n },\n ref\n) {\n // `entries`/`disabledKeys` only need to change when the data driving them does — without this,\n // both re-derive from scratch on every render, including every keystroke while typing.\n const entries = useMemo(\n () =>\n items\n ? buildEntriesFromItemsDef(items)\n : buildEntriesFromChildren(children, { Group: AutocompleteGroup, Item: AutocompleteItem }),\n [items, children]\n )\n const disabledKeys = useMemo(() => getDisabledKeys(entries), [entries])\n\n // Case- and accent-insensitive substring matching, mirroring chassis-css's own\n // always-case-insensitive combobox.js filtering.\n const { contains } = useFilter({ sensitivity: 'base' })\n\n // The selection is held here and always given to react-stately as controlled, and so is the\n // text of the search field. react-stately's combobox treats the text as the selection's: it\n // writes the selected option's label into the field, and an emptied field clears an\n // uncontrolled selection. Here the field is a query only. It starts empty each time the list\n // opens and filters the list, and nothing typed in it, or taken out, changes the selection.\n const [selection, setSelection] = useControllableState<Key | Key[] | null>(\n toModeValue(value, multiple),\n toModeValue(defaultValue, multiple) ?? (multiple ? [] : null),\n onChange\n )\n const [query, setQuery] = useState('')\n\n const state = useComboBoxState<ComboboxEntry, 'multiple'>({\n children: comboboxCollectionChildren,\n defaultItems: entries,\n disabledKeys,\n defaultFilter: contains,\n // Cast: the actual runtime string ('single' or 'multiple') is what drives behavior — see the\n // `asKeyArray` comment above for why the *type* parameter above is fixed at 'multiple'.\n selectionMode: (multiple ? 'multiple' : 'single') as 'multiple',\n value: selection as Key[],\n // With both controlled, react-stately reports the selection again when the search field\n // blurs, or Enter picks the selected option: only a change is passed on.\n onChange: (keys) => {\n const keyArray = asKeyArray(keys)\n const next = multiple ? keyArray : (keyArray[0] ?? null)\n setQuery('')\n if (!isSameSelection(next, selection)) setSelection(next)\n },\n inputValue: query,\n onInputChange: setQuery,\n onOpenChange: (isOpen) => {\n if (!isOpen) setQuery('')\n },\n allowsEmptyCollection: true,\n // Opening is driven only by the toggle (see `buttonProps` below) — there's no input to focus\n // or type into until the panel is already open, so 'input'/'focus' triggers (the hook's\n // defaults, meant for `Combobox`'s text-input trigger) don't apply here.\n menuTrigger: 'manual'\n })\n\n const triggerRef = useRef<HTMLDivElement>(null)\n const forkedTriggerRef = useForkedRef(ref, triggerRef)\n const inputRef = useRef<HTMLInputElement>(null)\n const listBoxRef = useRef<HTMLElement>(null)\n const popoverRef = useRef<HTMLDivElement>(null)\n const valueInputRef = useRef<HTMLInputElement>(null)\n\n // What is submitted under `name`: a key that isn't in the list is still a value.\n const selectedKeys = asKeyArray(state.value)\n\n // `required` has to reach an input a form validates (FORMS.md, gotcha 9). The toggle is no form\n // control, the search input holds a query and not the value, and the input that carries the\n // value is `type=\"hidden\"`, which a form doesn't validate. As in `TimeField`, a required\n // autocomplete's value input is a text input that isn't displayed, and `missing` shows the\n // field as invalid from a submit that input held back until an option is selected. The toggle\n // takes the focus a browser would give an input it displays. With `multiple` each key has a\n // hidden input of its own and none while nothing is selected: the text input is then rendered\n // alone, with no `name`, as nothing is submitted for an empty selection. A disabled input isn't\n // validated; the field has no read-only state to leave out.\n const {\n inputProps: requiredInputProps,\n missing,\n valid\n } = useRequiredValueInput(valueInputRef, {\n focus: () => triggerRef.current?.focus(),\n invalid,\n required: required && (!multiple || selectedKeys.length === 0),\n valid: validProp\n })\n const showInvalid = invalid || missing\n\n const { describedBy, feedbackId, helpId, inputId, labelId, labelledBy } = useFormField({\n ariaDescribedBy: rest['aria-describedby'],\n ariaLabelledBy: rest['aria-labelledby'],\n help,\n id,\n invalid: showInvalid,\n invalidFeedback,\n label,\n valid,\n validFeedback\n })\n\n const { buttonProps, inputProps, listBoxProps } = useComboBox<ComboboxEntry, 'multiple'>(\n {\n 'aria-label': rest['aria-label'],\n 'aria-labelledby': labelledBy,\n buttonRef: triggerRef,\n id: inputId,\n inputRef,\n listBoxRef,\n popoverRef,\n isDisabled: disabled,\n // `aria-required` on the search input, the `combobox` of this field. The toggle states\n // nothing: ARIA doesn't allow the attribute on a button.\n isRequired: required,\n placeholder: searchPlaceholder\n },\n state\n )\n\n // `useComboBox`'s own `buttonProps` sets `excludeFromTabOrder: true` — correct for its\n // intended composition (an auxiliary icon button *next to* an already-focusable, always-\n // visible input, e.g. a date picker's calendar-icon trigger), where the input is expected to\n // be the primary tab stop. That doesn't hold here: the input lives inside the popover, `hidden`\n // (and so untabbable) until opened, and this toggle is the *only* focusable surface before\n // that — leaving `excludeFromTabOrder` in place would make the whole control unreachable by\n // keyboard. Overriding it back to `false` is what actually makes the toggle the tab stop.\n const { buttonProps: triggerButtonProps } = useButton(\n { ...buttonProps, elementType: 'div', isDisabled: disabled, excludeFromTabOrder: false },\n triggerRef\n )\n\n // The search field autofocuses once the panel is actually open (chassis-css docs: \"When the\n // menu opens, focus jumps to the search field\"), and focus returns to the toggle once it\n // closes — `useComboBox` only knows about `inputRef` as its focus target, and that input is\n // `hidden` (via the panel) while closed, so without this, closing (via Escape, selection, or\n // outside click) would drop focus entirely instead of landing back on the toggle.\n // Only focus that the closing would lose is restored: still inside the panel, which is hidden\n // now, or already dropped to the body. Focus the user moved to another field, by Tab or a\n // press there, stays where they put it.\n const wasOpen = useRef(state.isOpen)\n useEffect(() => {\n if (state.isOpen && !wasOpen.current) {\n inputRef.current?.focus()\n } else if (!state.isOpen && wasOpen.current) {\n const active = document.activeElement\n const lost = !active || active === document.body || popoverRef.current?.contains(active)\n if (lost) triggerRef.current?.focus()\n }\n wasOpen.current = state.isOpen\n }, [state.isOpen])\n\n // `useComboBox` also runs react-aria's `ariaHideOutside` while open, to keep background\n // content out of screen readers' way — but it only knows to protect `inputRef`/`popoverRef`\n // (the elements it was given), not this separate toggle, so the toggle (and, in `multiple`\n // mode, its chips and their focusable remove buttons) would otherwise get `aria-hidden`\n // applied to it too while the panel is open. Walking up to `document.body` (rather than\n // clearing just `triggerRef.current` itself) matters now that the popover portals there too\n // (see `useFloatingOverlay` below): `ariaHideOutside` hides the *first* ancestor level whose\n // subtree contains no protected element, which — once the toggle and the popover no longer\n // share a common non-`body` container — can land on one of the toggle's own ancestors instead\n // of the toggle element itself. `ariaHideOutside`'s own doc comment says it watches for *new*\n // elements to hide, not attribute changes on existing ones, so removing it here (in an effect\n // that necessarily runs after react-aria's own — declared later in this same component)\n // doesn't get silently re-applied.\n useEffect(() => {\n if (!state.isOpen) return\n let node: HTMLElement | null = triggerRef.current\n while (node && node !== document.body) {\n node.removeAttribute('aria-hidden')\n node = node.parentElement\n }\n }, [state.isOpen])\n\n const { overlayProps, placement: resolvedPlacement } = useOverlayPosition({\n targetRef: triggerRef,\n overlayRef: popoverRef,\n placement: toAriaPlacement('bottom-start'),\n offset: 2,\n isOpen: state.isOpen,\n // Leaving `onClose` unset (`undefined`) doesn't actually disable react-aria's close-on-scroll\n // listener — only an explicit `null` does (`useCloseOnScroll` only early-returns on\n // `onClose === null`, not falsy). It happens to be a no-op today only because this toggle is\n // never registered in react-aria's `useOverlayTrigger`/`onCloseMap` backward-compat map (this\n // component calls `useComboBox`, not `useOverlayTrigger`) — an incidental, not guaranteed,\n // safety net. Passing `null` here makes the opt-out explicit, matching `Menu`/`Popover`.\n onClose: null\n })\n useOverlayMaxHeight(popoverRef, state.isOpen)\n\n // Portals the panel to `document.body` (or an enclosing open `<dialog>`) instead of rendering\n // it inline, matching `Popover`/`Tooltip`/`Combobox` — an inline-rendered panel gets clipped by\n // any ancestor with `overflow: hidden`/`auto` (a `ModalBody`, a scrollable card, a table cell),\n // and `Autocomplete` is commonly composed inside exactly those. See\n // `COMBOBOX_MENU_OVERLAY_STYLE` for the styling this trades away by leaving the DOM position\n // `.combobox + .menu` relies on.\n const portalContainer = useFloatingOverlay({\n close: state.close,\n isOpen: state.isOpen,\n triggerRef\n })\n\n const { menuStyle, placementAttr } = resolveMenuOverlayPositioning(\n overlayProps.style,\n 'bottom-start',\n resolvedPlacement\n )\n const overlayStyle: React.CSSProperties = { ...COMBOBOX_MENU_OVERLAY_STYLE, ...menuStyle }\n\n const removeSelected = (key: Key) => state.selectionManager.toggleSelection(key)\n\n // Backspace-removes-last-chip only touches the search field's own keydown handling — no\n // nested interactive element needed for it, unlike a rendered \"remove\" button would be (see\n // the trigger's `combobox-value` text below for why that path was dropped).\n const handleSearchKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (!multiple || event.key !== 'Backspace' || event.currentTarget.value !== '') return\n const last = state.selectedItems[state.selectedItems.length - 1]\n if (last) removeSelected(last.key)\n }\n\n const inputHtmlProps = mergeProps(inputProps, {\n onKeyDown: handleSearchKeyDown\n }) as InputHTMLAttributes<HTMLInputElement>\n\n const hasSelection = state.selectedItems.length > 0\n // Matches chassis-css's own vanilla multi-select combobox: the toggle shows the single\n // selected item's label, or \"N selected\" once more than one is picked — deliberately plain\n // text, not per-item chips with their own remove buttons. An earlier version rendered chips\n // here; that failed a real axe check (\"Interactive controls must not be nested\") because the\n // toggle is itself `role=\"button\"`, and a button can't correctly contain other focusable\n // controls. Deselecting an option is still possible by clicking it again in the open list\n // (native to `useComboBoxState`'s multiple-selection toggle behavior) or via Backspace in the\n // search field, just not from the toggle itself.\n const triggerText = !hasSelection\n ? placeholder\n : state.selectedItems.length === 1\n ? (state.selectedItems[0]?.textValue ?? '')\n : `${state.selectedItems.length} selected`\n\n return renderFormField({\n children: (\n <>\n <div\n className={classNames(\n 'form-input',\n 'combobox',\n { sm: size === 'sm', lg: size === 'lg', disabled },\n { 'is-invalid': showInvalid, 'is-valid': valid },\n className\n )}\n // `mergeProps`, so the caller's `onClick`, `onKeyDown` and `onFocus` run beside the\n // toggle's own instead of being replaced by them. It also lets a caller's value through\n // where the toggle's is `undefined`, which `tabIndex` is while disabled: set again.\n {...mergeProps(rest, triggerButtonProps)}\n tabIndex={triggerButtonProps.tabIndex}\n // `useComboBox`'s own `buttonProps` defaults to a generic \"Show suggestions\" label,\n // since its primary a11y attention goes to the search input — override with the same\n // label the input gets, so the toggle (the element actually reachable via Tab, since\n // the input is hidden until open) announces the field's real name, matching the\n // vanilla docs' own `aria-label=\"Select a country\"` on the toggle button.\n aria-label={rest['aria-label']}\n aria-labelledby={labelledBy}\n aria-describedby={describedBy}\n aria-invalid={showInvalid || undefined}\n ref={forkedTriggerRef}\n >\n <span className={classNames('combobox-value', { 'combobox-placeholder': !hasSelection })}>\n {triggerText}\n </span>\n </div>\n <Portal container={portalContainer}>\n <div\n className={classNames('menu', { show: state.isOpen })}\n data-cx-placement={placementAttr}\n style={overlayStyle}\n hidden={!state.isOpen}\n ref={popoverRef}\n >\n <div className=\"combobox-search\">\n <input\n autoComplete=\"off\"\n className=\"form-input combobox-search-input sm\"\n {...inputHtmlProps}\n ref={inputRef}\n />\n </div>\n <ComboboxListBox state={state} listBoxProps={listBoxProps} listBoxRef={listBoxRef} />\n {state.collection.size === 0 && (\n <div className=\"combobox-no-results\">{noResultsText}</div>\n )}\n </div>\n </Portal>\n {multiple ? (\n <>\n {name &&\n selectedKeys.map((key) => (\n <input key={key} type=\"hidden\" name={name} value={key} disabled={disabled} />\n ))}\n {requiredInputProps && (\n <input disabled={disabled} value=\"\" {...requiredInputProps} ref={valueInputRef} />\n )}\n </>\n ) : (\n (name || required) && (\n <input\n type=\"hidden\"\n name={name}\n value={selectedKeys[0] ?? ''}\n disabled={disabled}\n {...requiredInputProps}\n ref={valueInputRef}\n />\n )\n )}\n </>\n ),\n help,\n // No `input` id: the toggle is a `role=\"button\"` `<div>`, not a labelable element, so\n // `htmlFor` can't target it — `aria-labelledby={labelledBy}` on the toggle above (fed by\n // `labelId`) is what actually associates the label, matching DatePicker/OtpInput's\n // `role=\"group\"` pattern in FORMS.md. Passing `inputId` here would point `<label for>` at\n // the hidden search input instead, which sits inert until the popover opens.\n ids: { feedback: feedbackId, help: helpId, label: labelId },\n invalid: showInvalid,\n invalidFeedback,\n label,\n valid,\n validFeedback\n })\n})\n\nAutocomplete.displayName = 'Autocomplete'\n"],"mappings":"A,k2BAiBA,MAAaiB,EAAqB,GAAyC,KAE3E,EAAkB,YAAc,oBCJhC,MAAaC,EAAoB,GAAwC,KAEzE,EAAiB,YAAc,mBCkC/B,MAAMC,EAAc,GACdC,GAAS,KAAa,CAAC,EACpB,MAAM,QAAQA,CAAK,EAAIA,EAAQ,CAACA,CAAY,EAM/CC,GACJ,EACA,IACmC,CACnC,GAAID,IAAU,IAAA,GAEd,OADIE,EAAiBH,EAAWC,CAAK,EAC9B,MAAM,QAAQA,CAAK,EAAKA,EAAM,IAAM,KAAQA,CACrD,EAEMG,IAAmB,EAAuB,IAA0B,CACxE,IAAMC,EAAOL,EAAWM,CAAC,E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./focus-ring-Bs80iIBN.js";import{S as e}from"./slot-BQVx1Eew.js";import{t}from"./lazyElement-tfMG21pZ.js";import{t as n}from"./useForkedRef-WoqMqsWE.js";import{t as r}from"./polymorphic-CZIFszAy.js";import{t as i}from"./useControllableState-CPUJxfKW.js";import{t as a}from"./useIsomorphicLayoutEffect-BbqRwuqn.js";import{n as o,t as s}from"./dialogTransition-C8fYTsSa.js";import{t as c}from"./focusRedirect-CrBl4p_n.js";import{t as l}from"./iconSlot-DU_WcSL_.js";import{t as u}from"./VisuallyHidden-CGv-mBuQ.js";import{t as d}from"./direction-LN6uwsK5.js";import f,{Children as p,Fragment as m,createContext as h,forwardRef as g,isValidElement as _,useCallback as v,useContext as y,useEffect as b,useRef as x,useState as S}from"react";import C from"classnames";const w=/* @__PURE__ */ new WeakSet;function ee(e){w.add(e)}function te(e){if(!e)return!1;let t=w.has(e);return w.delete(e),t}const T=h(null),E=()=>{let e=y(T);if(!e)throw Error(`Carousel sub-components must be rendered inside a Carousel`);return e};function D(e){return Array.from(e.querySelectorAll(`:scope > .carousel-item:not(.carousel-item-clone)`))}function ne(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function re(e){if(!e)return!1;let t=e.getBoundingClientRect();return t.top<(window.innerHeight||document.documentElement.clientHeight)&&t.bottom>0&&t.left<(window.innerWidth||document.documentElement.clientWidth)&&t.right>0}function O(e,t,n){let r=e.getBoundingClientRect(),i=t.getBoundingClientRect();if(n)return i.left+i.width/2-(r.left+r.width/2);let a=Number.parseFloat(getComputedStyle(e).scrollPaddingInlineStart)||0;return d(e)?i.right-(r.right-a):i.left-(r.left+a)}function ie(e){return e.scrollWidth-e.clientWidth>0}const ae=e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2;function oe(e,t,n){if(ne()||typeof requestAnimationFrame>`u`)return e.scrollTo({left:t,behavior:`instant`}),n(),()=>{};let r=e.scrollLeft,i=t-r,a=null,o=null,s=!1,c=()=>{s||(s=!0,o!==null&&cancelAnimationFrame(o),clearTimeout(u),e.scrollTo({left:t,behavior:`instant`}),n())},l=t=>{if(s)return;a===null&&(a=t);let n=Math.min((t-a)/300,1);e.scrollTo({left:r+i*ae(n),behavior:`instant`}),n<1?o=requestAnimationFrame(l):c()},u=setTimeout(c,500);return o=requestAnimationFrame(l),()=>{s||(s=!0,o!==null&&cancelAnimationFrame(o),clearTimeout(u))}}function se(e,t,n){return Number.isNaN(e)||t===0?null:e<0?n?t-1:null:e>t-1?n?0:null:e}function ce(e,t,n){let r=t>e;return n?r?`right`:`left`:r?`left`:`right`}function le(e,t){return t?e?`right`:`left`:e?`left`:`right`}function ue(e,t,n,r,i){if(n||t<2||r||i)return!1;let a=getComputedStyle(e),o=e=>Number.parseFloat(a.getPropertyValue(e))||0;return(o(`--cx-carousel-items`)||1)===1&&o(`--cx-carousel-items-peek`)===0}function de({children:e,className:t,component:n,interval:r,...i},a){let o=n??`div`,s=y(T),c=y(pe),l=s&&c?{"aria-label":`${c.index+1} of ${c.count}`,"aria-roledescription":`slide`,role:`group`}:{},u=C(`carousel-item`,{active:!!s&&!!c&&c.index===s.activeIndex},t);return/* @__PURE__ */ f.createElement(o,{className:u,"data-interval":r,...l,...i,ref:a},e)}const fe=r(de,`CarouselItem`),pe=h(void 0);function k(e){let n=A(e);return{nodes:n,positioned:n.every(e=>t(e,fe))}}function A(e){return p.toArray(e).flatMap(e=>t(e,m)?A(e.props.children).map(t=>_(t)?f.cloneElement(t,{key:`${e.key}/${t.key}`}):t):[e])}function me({children:e,className:t,component:r,...i},a){let{registerViewport:o}=E(),s=r??`div`,c=n(a,o),l=C(`carousel-inner`,t),{nodes:u,positioned:d}=k(e);return/* @__PURE__ */ f.createElement(s,{className:l,...i,ref:c},u.map((e,t)=>/* @__PURE__ */ f.createElement(pe.Provider,{key:_(e)?e.key:t,value:d?{count:u.length,index:t}:void 0},e)))}const he=r(me,`CarouselInner`),ge=g(({children:t,activeIndex:r,auto:l,autoplay:p=!1,center:m,className:h,defaultActiveIndex:g=0,ends:_=`loop`,interval:y=5e3,items:w,itemsGap:ee,itemsPeek:E,keyboard:ae=!0,onKeyDown:de,onMouseEnter:fe,onMouseLeave:pe,onSlid:k,onSlide:A,pause:me=`hover`,style:he,transition:ge=`scroll`,...j},ve)=>{e(r!==void 0&&!A,"Carousel: `activeIndex` is set (controlled) without `onSlide`: nothing feeds the new index back to your state, so the carousel will visually freeze on click/swipe/autoplay. Pass `onSlide` and update `activeIndex` from it. `onSlid` cannot do this: it fires once a slide has arrived, which under a controlled `activeIndex` only happens after the prop has changed.");let M=x(null),ye=n(ve,M),[N,be]=S(null),xe=v(e=>be(e),[]),Se=r!==void 0,[P,Ce]=i(r,g),F=x(P),I=x(P),L=x({from:P,to:P,direction:`left`});a(()=>{let e=I.current;if(F.current=P,I.current=P,e===P)return;let t=L.current;(t.from!==e||t.to!==P)&&(L.current={from:e,to:P,direction:ce(e,P,N?d(N):!1)})},[P]);let we=x(A),R=x(k);a(()=>{we.current=A,R.current=k});let[z,Te]=S(()=>_e(t)),B=x(z);a(()=>{B.current=z},[z]);let[V,Ee]=S(p),[De,Oe]=S(!1),[ke,Ae]=S(P<=0),[je,Me]=S(z>0&&P>=z-Math.max(1,w??1)),H=x(!1),U=x(!1),W=x(null),G=x(null),Ne=x(!1),K=x(null),Pe=x(null),q=x(null),Fe=x(/* @__PURE__ */ new Map),J=x(null),Ie=x(!1),Le=x(!1),Re=x(!1),[ze,Be]=S(``),Ve=x(!1),He=x(/* @__PURE__ */ new Set),Ue=x(/* @__PURE__ */ new Set),We=x(/* @__PURE__ */ new Set),Y=ge===`fade`,X=Math.max(1,w??1),Z=_!==`stop`,Ge=e=>{F.current=e,Ce(e),Se&&queueMicrotask(()=>{F.current=I.current})},Ke=(e,t,n)=>{K.current?.(),U.current=!0,e.style.scrollSnapType=`none`,K.current=oe(e,e.scrollLeft+t,()=>{e.style.scrollSnapType=``,U.current=!1,K.current=null,n?.()})},qe=()=>{G.current&&clearTimeout(G.current),G.current=setTimeout(()=>Xe.current(),500)};a(()=>{let e=Math.max(0,z-X);Ae(P<=0),Me(P>=e)},[P,z,X]),b(()=>{if(!N)return;let e=()=>{if(W.current!==null&&qe(),H.current||!ie(N))return;let e=N.scrollWidth-N.clientWidth,t=N.scrollLeft,n=d(N)?Math.max(-e,Math.min(0,t)):Math.max(0,Math.min(e,t)),r=Math.abs(n);Ae(r<=1),Me(r>=e-1)},t=()=>{Ne.current=!0},n=e=>{Ne.current=e.touches.length>0};return N.addEventListener(`scroll`,e,{passive:!0}),N.addEventListener(`touchstart`,t,{passive:!0}),N.addEventListener(`touchend`,n),N.addEventListener(`touchcancel`,n),()=>{N.removeEventListener(`scroll`,e),N.removeEventListener(`touchstart`,t),N.removeEventListener(`touchend`,n),N.removeEventListener(`touchcancel`,n)}},[N]),a(()=>{if(!N||z===0||D(N).length!==z)return;let e=Math.max(0,z-X);if(P<=e)return;let t={from:P,to:e,direction:ce(P,e,d(N))};L.current=t,we.current?.(t),Ge(e)},[N,P,z,X]),a(()=>{if(!N)return;let e=()=>{let e=D(N);if(Te(e.length),q.current?.disconnect(),q.current=null,Fe.current=/* @__PURE__ */ new Map,!(Y||typeof IntersectionObserver>`u`)){q.current=new IntersectionObserver(e=>{for(let t of e)Fe.current.set(t.target,t.isIntersecting?t.intersectionRatio:0);if(H.current||U.current)return;let t=D(N).map(e=>Fe.current.get(e)??0),n=Math.max(0,...t),r=F.current;if(n>0){let e=t.findIndex(e=>e>=n-.05);e!==-1&&(r=e)}if(r!==F.current){let e=F.current,t={from:e,to:r,direction:ce(e,r,d(N))};L.current=t,we.current?.(t),W.current=r,Ge(r),qe()}},{root:N,threshold:[0,.25,.5,.75,1]});for(let t of e)q.current.observe(t)}};e();let t=new MutationObserver(e);return t.observe(N,{childList:!0}),()=>{t.disconnect(),q.current?.disconnect()}},[N,Y]);let Je=x(/* @__PURE__ */ new WeakMap);a(()=>{if(!N)return;let e=D(N);for(let[t,n]of e.entries()){n.classList.toggle(`active`,t===P),n.hasAttribute(`role`)||n.setAttribute(`role`,`group`),n.setAttribute(`aria-roledescription`,`slide`);let r=n.getAttribute(`aria-label`);if(r===null||r===Je.current.get(n)){let r=`${t+1} of ${e.length}`;n.setAttribute(`aria-label`,r),Je.current.set(n,r)}}},[N,P,z]),a(()=>{if(W.current===P){W.current=null;return}if(!N||H.current||Y)return;let e=D(N)[P];if(!e||!ie(N))return;let t=!Ie.current;Ie.current=!0;let n=O(N,e,!!m);Math.abs(n)<1||(t?(K.current?.(),U.current=!0,N.style.scrollSnapType=`none`,N.scrollTo({left:N.scrollLeft+n,behavior:`instant`}),N.style.scrollSnapType=``,U.current=!1,K.current=null):(Ve.current=!0,Ke(N,n,()=>{Ve.current=!1,R.current?.(L.current)})))},[N,P,z,m,Y]);let Ye=()=>{if(G.current=null,W.current===null)return;if(Ne.current){qe();return}if(W.current=null,!N||H.current||U.current||Y)return;let e=D(N)[I.current];if(!e)return;let t=O(N,e,!!m);Math.abs(t)>=1&&Ke(N,t)},Xe=x(Ye);a(()=>{Xe.current=Ye}),b(()=>{if(!Le.current){Le.current=!0;return}if(Ve.current||H.current)return;let e=L.current,t=Y&&N?D(N)[P]:void 0;if(t)return s(t,()=>R.current?.(e),o(t)>0);k?.(e)},[P]),b(()=>{Re.current?Be(`Slide ${P+1} of ${z}`):Re.current=!0},[P]),b(()=>()=>{J.current&&clearTimeout(J.current),G.current&&clearTimeout(G.current),q.current?.disconnect(),K.current?.(),Pe.current?.()},[]);let Ze=e=>{let t=N;if(!t)return;K.current?.(),U.current=!1;let n=D(t),r=n.length-1,i=F.current,a=e?0:r,o=le(e,d(t));A?.({from:i,to:a,direction:o}),L.current={from:i,to:a,direction:o},H.current=!0;let s=()=>{L.current={from:i,to:a,direction:o},H.current=!1,I.current===a?R.current?.(L.current):Ge(a)},c=e?n[0]:n[r],l=n[i],u=n[a];if(!ie(t)||!c||!l||!u){s();return}let f=c.cloneNode(!0);f.classList.add(`carousel-item-clone`),f.classList.remove(`active`),f.removeAttribute(`id`);for(let e of Array.from(f.querySelectorAll(`[id]`)))e.removeAttribute(`id`);f.setAttribute(`aria-hidden`,`true`),f.setAttribute(`inert`,``),t.style.scrollSnapType=`none`,e?t.append(f):(t.prepend(f),t.scrollTo({left:t.scrollLeft+O(t,l,!!m),behavior:`instant`}));let p=O(t,f,!!m);Pe.current=oe(t,t.scrollLeft+p,()=>{Pe.current=null,f.remove();let e=O(t,u,!!m);t.scrollTo({left:t.scrollLeft+e,behavior:`instant`}),t.style.scrollSnapType=``,s()})},Qe=e=>{if(H.current)return;let t=B.current;if(t===0)return;let n=Math.max(0,t-X);if(_===`loop`&&!Y&&!ne()&&M.current&&ue(M.current,t,Y,!!m,!!l)){if(e>n){Ze(!0);return}if(e<0){Ze(!1);return}}let r=se(e,n+1,Z),i=F.current;if(r===null||r===i)return;W.current=null;let a=ce(i,e,N?d(N):!1);A?.({from:i,to:r,direction:a}),L.current={from:i,to:r,direction:a},Ge(r)},$e=()=>Qe(F.current+1),et=()=>Qe(F.current-1),tt=e=>Qe(e),nt=()=>{J.current&&clearTimeout(J.current),J.current=null,Oe(!1)},rt=x(()=>void 0),Q=(e=F.current)=>{J.current&&clearTimeout(J.current);let t=(N?D(N):[])[e]?.dataset.interval,n=t&&!Number.isNaN(Number(t))?Number(t):y;M.current?.style.setProperty(`--cx-carousel-interval`,`${n}ms`),J.current=setTimeout(()=>rt.current(e),n)},$=()=>{Ee(!1),nt()},it=e=>{let t=B.current,n=Math.max(0,t-X),r=se(F.current+1,n+1,Z);typeof document>`u`||document.visibilityState===`visible`&&re(M.current)?($e(),r===null?$():Q(r)):Q(e)};a(()=>{rt.current=it});let at=()=>{let e=B.current;return!Z&&e>0&&F.current>=Math.max(0,e-X)},ot=()=>{at()?$():(Q(),Oe(!0))},st=()=>{V?$():(Ee(!0),ot())};b(()=>{if(N)return V&&ot(),()=>nt()},[N]),b(()=>{J.current&&!Z&&z!==0&&P>=Math.max(0,z-X)&&$()},[P,z,X,Z]),b(()=>{J.current&&Q()},[y]),b(()=>{if(!N)return;let e=()=>$();return N.addEventListener(`pointerdown`,e),()=>N.removeEventListener(`pointerdown`,e)},[N]),b(()=>{if(_!==`stop`)return;let e=document.activeElement,t=ke&&!!e&&He.current.has(e),n=je&&!!e&&(Ue.current.has(e)||!V&&We.current.has(e));if(!t&&!n)return;let r=t?Ue.current:He.current,i=(t?!je:!ke)?Array.from(r)[0]:null,a=te(e);i?c(i,a,{preventScroll:!0}):N&&(N.hasAttribute(`tabindex`)||N.setAttribute(`tabindex`,`-1`),c(N,a,{preventScroll:!0}))},[ke,je,_,V,N]);let ct=v((e,t)=>{let n={next:Ue.current,play:We.current,prev:He.current}[e];return n.add(t),()=>{n.delete(t)}},[]),lt=e=>{if(de?.(e),!ae||e.target.closest(`input, textarea, select, [contenteditable="true"]`)||e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault(),$();let t=d(e.currentTarget)?`ArrowLeft`:`ArrowRight`;e.key===t?$e():et()},ut=e=>{fe?.(e),me===`hover`&&nt()},dt=e=>{pe?.(e),me===`hover`&&V&&ot()},ft={activeIndex:P,atEnd:je,atStart:ke,ends:_,itemCount:z,itemsVisible:X,next:()=>{$(),$e()},playing:V,prev:()=>{$(),et()},registerControl:ct,registerViewport:xe,to:e=>{$(),tt(e)},togglePlayPause:st},pt=C(`carousel`,{"carousel-fade":Y,"carousel-center":m,"carousel-auto":l,"carousel-playing":De},h),mt={...he,...w!=null&&{"--cx-carousel-items":w},...ee!=null&&{"--cx-carousel-items-gap":ee},...E!=null&&{"--cx-carousel-items-peek":E}};return/* @__PURE__ */ f.createElement(`div`,{role:`region`,"aria-roledescription":`carousel`,className:pt,style:mt,onKeyDown:lt,onMouseEnter:ut,onMouseLeave:dt,...j,ref:ye},/* @__PURE__ */ f.createElement(T.Provider,{value:ft},t),/* @__PURE__ */ f.createElement(u,{role:`status`},ze))});ge.displayName=`Carousel`;function _e(e){for(let n of p.toArray(e)){if(t(n,he)){let{nodes:e,positioned:t}=k(n.props.children);return t?e.length:0}if(!_(n))continue;let e=_e(n.props.children);if(e>0)return e}return 0}const j=g(({children:e,className:t,direction:r,disabled:i,icon:a,label:o,onClick:s,...c},d)=>{let{atEnd:p,atStart:m,ends:h,next:g,prev:_,registerControl:v}=E(),y=x(null),S=n(d,y);b(()=>{let e=y.current;if(e)return v(r,e)},[v,r]);let w=r===`next`?p:m,te=r===`next`?g:_,T=i||h===`stop`&&w;return/* @__PURE__ */ f.createElement(`button`,{type:`button`,className:C(`button sm icon-only`,t),disabled:T,onClick:e=>{s?.(e),e.detail!==0&&ee(e.currentTarget),te()},...c,ref:S},e??/* @__PURE__ */ f.createElement(f.Fragment,null,/* @__PURE__ */ f.createElement(l,{icon:r===`next`?`next`:`previous`,override:a,className:`directional-icon`}),/* @__PURE__ */ f.createElement(u,null,o)))});j.displayName=`CarouselControlButton`;const ve=g(({label:e=`Next slide`,...t},n)=>/* @__PURE__ */ f.createElement(j,{...t,direction:`next`,label:e,ref:n}));ve.displayName=`CarouselControlNext`;const M=g(({label:e=`Previous slide`,...t},n)=>/* @__PURE__ */ f.createElement(j,{...t,direction:`prev`,label:e,ref:n}));M.displayName=`CarouselControlPrev`;const ye=g(({className:e,label:t=e=>`Slide ${e}`,...n},r)=>{let{activeIndex:i,itemCount:a,itemsVisible:o,to:s}=E(),c=C(`carousel-indicators`,e),l=a===0?0:Math.max(1,a-o+1);return/* @__PURE__ */ f.createElement(`ol`,{className:c,...n,ref:r},Array.from({length:l},(e,t)=>t).map(e=>/* @__PURE__ */ f.createElement(`li`,{key:e},/* @__PURE__ */ f.createElement(`button`,{type:`button`,className:e===i?`active`:void 0,"aria-current":e===i?`true`:void 0,"aria-label":t(e+1),onClick:()=>s(e)}))))});ye.displayName=`CarouselIndicators`;function N({children:e,className:t,component:n,...r},i){let a=n??`div`,o=C(`carousel-overlay`,t);return/* @__PURE__ */ f.createElement(a,{className:o,...r,ref:i},e)}const be=r(N,`CarouselOverlay`),xe=g(({children:e,className:t,disabled:r,onClick:i,pauseIcon:a,pauseLabel:o=`Pause`,playIcon:s,playLabel:c=`Play`,...u},d)=>{let{atEnd:p,ends:m,playing:h,registerControl:g,togglePlayPause:_}=E(),v=x(null),y=n(d,v);b(()=>{let e=v.current;if(e)return g(`play`,e)},[g]);let S=r||m===`stop`&&p&&!h,w=C(`carousel-control-play-pause button sm icon-only`,{paused:!h},t);return/* @__PURE__ */ f.createElement(`button`,{type:`button`,className:w,"aria-label":h?o:c,disabled:S,onClick:e=>{i?.(e),_()},...u,ref:y},e??/* @__PURE__ */ f.createElement(f.Fragment,null,/* @__PURE__ */ f.createElement(l,{icon:`pause`,override:a,className:`carousel-icon-pause`}),/* @__PURE__ */ f.createElement(l,{icon:`play`,override:s,className:`carousel-icon-play`})))});xe.displayName=`CarouselPlayPause`;export{ve as a,fe as c,M as i,be as n,ge as o,ye as r,he as s,xe as t};
|
|
2
|
-
//# sourceMappingURL=carousel-DC-UGc6W.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"carousel-DC-UGc6W.js","names":["devWarning","useForkedRef","createPolymorphicComponent","useControllableState","useIsomorphicLayoutEffect","getTransitionDuration","executeAfterTransition","focusRedirect","IconSlot","VisuallyHidden","isRTL","React","classNames","pointerClicks","markPointerClick","el","consumePointerClick","wasPointer","CarouselContext","createContext","useCarouselContext","context","useContext","getCarouselItems","viewport","prefersReducedMotion","isElementVisible","element","rect","scrollDeltaFor","viewportRect","target","center","padStart","isViewportScrollable","easeInOutCubic","progress","animateScrollTo","targetLeft","onSettled","startLeft","distance","startTime","frame","done","finish","safetyTimer","step","now","normalizeIndex","index","length","wraps","directionBetween","isNext","to","from","rtl","loopDirection","canLoop","isFade","itemCount","auto","styles","carouselElement","num","name","CarouselItemRender","rest","Component","component","carousel","slide","SlidePositionContext","position","_className","className","interval","children","CarouselItem","readSlides","nodes","flatten","isElementOfType","node","Children","child","Fragment","isValidElement","CarouselInnerRender","forkedRef","ref","registerViewport","positioned","CarouselInner","Carousel","forwardRef","activeIndexProp","onSlide","carouselRef","useRef","viewportEl","setViewportEl","useState","useCallback","isControlled","activeIndex","setActiveIndex","defaultActiveIndex","activeIndexRef","committedIndexRef","lastTransitionRef","asked","onSlideRef","onSlidRef","onSlid","setItemCount","countSlides","itemCountRef","playing","setPlaying","autoplay","cycling","setCycling","atStart","setAtStart","atEnd","setAtEnd","items","loopingRef","syncingScrollRef","swipedToRef","swipeSettleTimerRef","touchingRef","cancelScrollSyncRef","cancelLoopRef","observerRef","visibilityRef","timeoutRef","scrollSyncedRef","mountedForSlidRef","mountedForLiveRegionRef","liveMessage","setLiveMessage","deferOnSlidRef","prevControlsRef","nextControlsRef","playControlsRef","transition","itemsVisible","ends","setActiveIndexInternal","next","animateTrackBy","delta","onArrived","awaitSwipeSettle","settleSwipeRef","maxIndex","useEffect","handleScroll","maxScroll","rawScrollLeft","clampedScrollLeft","scrollLeft","handleTouchStart","handleTouchEnd","event","last","detail","syncItems","entry","entries","ratios","maxRatio","bestIndex","found","ratio","mutationObserver","positionLabelsRef","label","instant","settleSwipe","incoming","performLoopTransition","direction","source","fromItem","toItem","clone","targetDelta","finalDelta","navigate","effectiveLast","rawTarget","goNext","goPrev","goTo","pauseCycle","autoplayTickRef","scheduleAutoplay","attr","fromIndex","ms","stopPlayingForGood","autoplayTick","upcoming","hasNothingToPlay","startCycle","togglePlayPause","handlePointerDown","focused","focusedIsPrev","focusedIsNext","oppositeSet","fallback","viaPointer","registerControl","set","kind","handleKeyDown","onKeyDown","keyboard","nextKey","handleMouseEnter","onMouseEnter","pause","handleMouseLeave","onMouseLeave","contextValue","_style","style","itemsGap","itemsPeek","count","CarouselControlButton","buttonRef","atBoundary","prev","isDisabled","disabled","onClick","icon","CarouselControlNext","CarouselControlPrev","CarouselIndicators","indicatorCount","CarouselOverlayRender","CarouselOverlay","CarouselPlayPause","pauseLabel","playLabel","pauseIcon","playIcon"],"sources":["../../src/utils/pointerInteraction.ts","../../src/components/carousel/context.ts","../../src/components/carousel/carouselEngine.ts","../../src/components/carousel/CarouselItem.tsx","../../src/components/carousel/slides.tsx","../../src/components/carousel/CarouselInner.tsx","../../src/components/carousel/Carousel.tsx","../../src/components/carousel/CarouselControlButton.tsx","../../src/components/carousel/CarouselControlNext.tsx","../../src/components/carousel/CarouselControlPrev.tsx","../../src/components/carousel/CarouselIndicators.tsx","../../src/components/carousel/CarouselOverlay.tsx","../../src/components/carousel/CarouselPlayPause.tsx"],"sourcesContent":["// Tracks, per-element, whether its most recent activation came from a real pointer click rather\n// than a keyboard one (a `click` fired by pointer activation has `detail >= 1`; one fired by\n// keyboard activation, e.g. Enter/Space on a focused button, has `detail === 0`) — for callers\n// that need that information later, asynchronously, once React has committed the state update the\n// click triggered (see `Carousel.tsx`'s disabled-end focus redirect, which needs it to decide\n// whether `focusRedirect` should suppress Safari's script-focus-after-pointer-click ring). A\n// `WeakSet` rather than a DOM attribute so it doesn't leak into markup/snapshots, and consuming it\n// clears the entry so a later, unrelated keyboard activation on the same element isn't\n// misattributed as pointer-triggered.\nconst pointerClicks = new WeakSet<HTMLElement>()\n\nexport function markPointerClick(el: HTMLElement): void {\n pointerClicks.add(el)\n}\n\nexport function consumePointerClick(el: HTMLElement | null): boolean {\n if (!el) return false\n const wasPointer = pointerClicks.has(el)\n pointerClicks.delete(el)\n return wasPointer\n}\n","import { createContext, useContext } from 'react'\n\nexport type CarouselEnds = 'loop' | 'wrap' | 'stop'\n\n// The buttons the carousel moves focus away from when the end of an `ends=\"stop\"` track\n// disables the focused one.\nexport type CarouselControlKind = 'prev' | 'next' | 'play'\n\nexport interface CarouselContextProps {\n activeIndex: number\n atEnd: boolean\n atStart: boolean\n ends: CarouselEnds\n itemCount: number\n itemsVisible: number\n next: () => void\n playing: boolean\n prev: () => void\n registerControl: (kind: CarouselControlKind, element: HTMLButtonElement) => () => void\n registerViewport: (node: HTMLDivElement | null) => void\n to: (index: number) => void\n togglePlayPause: () => void\n}\n\nexport const CarouselContext = createContext<CarouselContextProps | null>(null)\n\nexport const useCarouselContext = (): CarouselContextProps => {\n const context = useContext(CarouselContext)\n if (!context) {\n throw new Error('Carousel sub-components must be rendered inside a Carousel')\n }\n return context\n}\n","// Internal helpers shared by the carousel family. Not exported from the component's public\n// barrel (see CONVENTIONS.md's helper-module carve-out).\n\nimport { isRTL } from '../../utils/direction'\n\nexport const ITEM_SELECTOR = '.carousel-item:not(.carousel-item-clone)'\n\nexport function getCarouselItems(viewport: HTMLElement): HTMLElement[] {\n return Array.from(viewport.querySelectorAll<HTMLElement>(`:scope > ${ITEM_SELECTOR}`))\n}\n\nexport { isRTL }\n\nexport function prefersReducedMotion(): boolean {\n return (\n typeof window !== 'undefined' &&\n typeof window.matchMedia === 'function' &&\n window.matchMedia('(prefers-reduced-motion: reduce)').matches\n )\n}\n\nexport function isElementVisible(element: Element | null): boolean {\n if (!element) return false\n const rect = element.getBoundingClientRect()\n return (\n rect.top < (window.innerHeight || document.documentElement.clientHeight) &&\n rect.bottom > 0 &&\n rect.left < (window.innerWidth || document.documentElement.clientWidth) &&\n rect.right > 0\n )\n}\n\n// Horizontal distance to scroll `viewport` so `target` rests where the active slide belongs —\n// centered when `center` is set, otherwise flush with the scroll-padding (peek) offset, which is\n// exactly where scroll-snap settles. Scrolling the viewport itself (rather than\n// `target.scrollIntoView()`) keeps an off-screen carousel from yanking the whole page to itself.\nexport function scrollDeltaFor(\n viewport: HTMLElement,\n target: HTMLElement,\n center: boolean\n): number {\n const viewportRect = viewport.getBoundingClientRect()\n const rect = target.getBoundingClientRect()\n\n if (center) {\n return rect.left + rect.width / 2 - (viewportRect.left + viewportRect.width / 2)\n }\n\n const padStart = Number.parseFloat(getComputedStyle(viewport).scrollPaddingInlineStart) || 0\n\n return isRTL(viewport)\n ? rect.right - (viewportRect.right - padStart)\n : rect.left - (viewportRect.left + padStart)\n}\n\nexport function isViewportScrollable(viewport: HTMLElement): boolean {\n return viewport.scrollWidth - viewport.clientWidth > 0\n}\n\nconst SCROLL_DURATION_MS = 300\n// Safety net above the animation's own duration, in case `requestAnimationFrame` stalls (a\n// backgrounded tab, a frozen/suspended webview) and never drives the animation to completion.\n// `setTimeout` still fires in that situation — throttled, but not indefinitely suspended the way\n// rAF can be — so this guarantees the scroll lands on target and callers relying on completion to\n// release a lock (e.g. re-enabling the IntersectionObserver) can never get stuck forever.\nconst SCROLL_SAFETY_MS = SCROLL_DURATION_MS + 200\n\nconst easeInOutCubic = (progress: number) =>\n progress < 0.5 ? 4 * progress * progress * progress : 1 - (-2 * progress + 2) ** 3 / 2\n\n// Animates `viewport.scrollLeft` to `targetLeft` by stepping the position by hand each frame,\n// resolving deterministically once the animation completes — not by waiting on the `scrollend`\n// event or a fixed timeout as the *primary* signal. Both of those only approximate when a native\n// `scrollTo({behavior:'smooth'})` actually finishes, and firing early restores CSS scroll-snap\n// mid-flight, which snaps the track back to the nearest point instead of the intended one rather\n// than letting it arrive. Using `behavior: 'instant'` for every step keeps this animation from\n// fighting the viewport's own CSS `scroll-behavior: smooth`. Returns a canceller so a caller that\n// starts a newer scroll before this one finishes can stop it instead of both fighting over the\n// position.\nexport function animateScrollTo(\n viewport: HTMLElement,\n targetLeft: number,\n onSettled: () => void\n): () => void {\n if (prefersReducedMotion() || typeof requestAnimationFrame === 'undefined') {\n viewport.scrollTo({ left: targetLeft, behavior: 'instant' })\n onSettled()\n return () => {}\n }\n\n const startLeft = viewport.scrollLeft\n const distance = targetLeft - startLeft\n let startTime: number | null = null\n let frame: number | null = null\n let done = false\n\n const finish = () => {\n if (done) return\n done = true\n if (frame !== null) cancelAnimationFrame(frame)\n clearTimeout(safetyTimer)\n viewport.scrollTo({ left: targetLeft, behavior: 'instant' })\n onSettled()\n }\n\n const step = (now: number) => {\n if (done) return\n if (startTime === null) startTime = now\n\n const progress = Math.min((now - startTime) / SCROLL_DURATION_MS, 1)\n viewport.scrollTo({\n left: startLeft + distance * easeInOutCubic(progress),\n behavior: 'instant'\n })\n\n if (progress < 1) {\n frame = requestAnimationFrame(step)\n return\n }\n\n finish()\n }\n\n const safetyTimer = setTimeout(finish, SCROLL_SAFETY_MS)\n frame = requestAnimationFrame(step)\n\n return () => {\n if (done) return\n done = true\n if (frame !== null) cancelAnimationFrame(frame)\n clearTimeout(safetyTimer)\n }\n}\n\nexport function normalizeIndex(index: number, length: number, wraps: boolean): number | null {\n if (Number.isNaN(index) || length === 0) return null\n if (index < 0) return wraps ? length - 1 : null\n if (index > length - 1) return wraps ? 0 : null\n return index\n}\n\nexport type CarouselDirection = 'left' | 'right'\n\nexport function directionBetween(from: number, to: number, rtl: boolean): CarouselDirection {\n const isNext = to > from\n if (rtl) return isNext ? 'right' : 'left'\n return isNext ? 'left' : 'right'\n}\n\nexport function loopDirection(isNext: boolean, rtl: boolean): CarouselDirection {\n if (rtl) return isNext ? 'right' : 'left'\n return isNext ? 'left' : 'right'\n}\n\n// Seamless looping only reads right for the plain single-slide scroll layout — multi-item, peek,\n// centered, and variable-width layouts fall back to a `wrap` jump instead (see `canLoop`).\nexport function canLoop(\n carouselElement: HTMLElement,\n itemCount: number,\n isFade: boolean,\n center: boolean,\n auto: boolean\n): boolean {\n if (isFade || itemCount < 2 || center || auto) return false\n\n const styles = getComputedStyle(carouselElement)\n const num = (name: string) => Number.parseFloat(styles.getPropertyValue(name)) || 0\n\n return (num('--cx-carousel-items') || 1) === 1 && num('--cx-carousel-items-peek') === 0\n}\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement, useContext } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { CarouselContext } from './context'\nimport { SlidePositionContext } from './slides'\n\ntype CarouselItemOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n /**\n * Milliseconds to wait before autoplay advances past this slide, overriding the carousel's own `interval`.\n */\n interval?: number\n}\n\nexport type CarouselItemProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n CarouselItemOwnProps<C>\n>\n\ntype CarouselItemComponent = (<C extends ElementType = 'div'>(\n props: CarouselItemProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction CarouselItemRender<C extends ElementType = 'div'>(\n { children, className, component, interval, ...rest }: CarouselItemProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n // Where this slide sits, when `CarouselInner` can tell (see `slides.tsx`), so the first render,\n // the server's too, marks the active slide. `Carousel` applies the same from the DOM otherwise.\n const carousel = useContext(CarouselContext)\n const slide = useContext(SlidePositionContext)\n const position =\n carousel && slide\n ? {\n 'aria-label': `${slide.index + 1} of ${slide.count}`,\n 'aria-roledescription': 'slide',\n role: 'group'\n }\n : {}\n const _className = classNames(\n 'carousel-item',\n { active: !!carousel && !!slide && slide.index === carousel.activeIndex },\n className\n )\n\n return (\n <Component className={_className} data-interval={interval} {...position} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const CarouselItem = createPolymorphicComponent<CarouselItemComponent>(\n CarouselItemRender as ForwardRefRenderFunction<Element, CarouselItemProps<ElementType>>,\n 'CarouselItem'\n)\n","import React, { Children, createContext, Fragment, isValidElement, ReactNode } from 'react'\n\nimport { isElementOfType } from '../../utils/lazyElement'\nimport { CarouselItem } from './CarouselItem'\n\n// Internal to the carousel family (see CONVENTIONS.md's helper-module carve-out).\n//\n// The carousel finds its slides in the DOM (`getCarouselItems`), which a server doesn't have: the\n// first render drew no indicators and no active slide, so a `fade` carousel, whose inactive\n// slides are transparent, was blank until the JavaScript had loaded. These read the slides from\n// `CarouselInner`'s children instead, the way the server sees them.\n\nexport interface SlidePosition {\n count: number\n index: number\n}\n\n// Each slide's position, from `CarouselInner` to its `CarouselItem`. Unset when `CarouselInner`\n// can't tell (see `readSlides`), and for a slide of a carousel nested inside another one's slide,\n// which its own `CarouselInner` resets.\nexport const SlidePositionContext = createContext<SlidePosition | undefined>(undefined)\n\nexport interface Slides {\n // `children` with fragments flattened, each keyed as React would key it.\n nodes: ReactNode[]\n // Whether every one of them is a `CarouselItem`. Anything else, such as a slide inside a\n // component of your own, sits somewhere among them that this can't see, and a position counted\n // without it would contradict the DOM's.\n positioned: boolean\n}\n\nexport function readSlides(children: ReactNode): Slides {\n const nodes = flatten(children)\n return { nodes, positioned: nodes.every((node) => isElementOfType(node, CarouselItem)) }\n}\n\nfunction flatten(children: ReactNode): ReactNode[] {\n return Children.toArray(children).flatMap((child) =>\n isElementOfType<{ children?: ReactNode }>(child, Fragment)\n ? flatten(child.props.children).map((node) =>\n isValidElement(node)\n ? React.cloneElement(node, { key: `${child.key}/${node.key}` })\n : node\n )\n : [child]\n )\n}\n","import React, { ElementType, ForwardRefRenderFunction, isValidElement, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport { useForkedRef } from '../../hooks'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { useCarouselContext } from './context'\nimport { readSlides, SlidePositionContext } from './slides'\n\ntype CarouselInnerOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n}\n\nexport type CarouselInnerProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n CarouselInnerOwnProps<C>\n>\n\ntype CarouselInnerComponent = (<C extends ElementType = 'div'>(\n props: CarouselInnerProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\n/**\n * The scroll viewport — a real horizontally-scrolling container using CSS scroll-snap. Wrap\n * CarouselItem children in this rather than passing them directly to Carousel, so controls and\n * indicators can sit alongside it (above, below, or overlaid) instead of inside the scroll track.\n */\nfunction CarouselInnerRender<C extends ElementType = 'div'>(\n { children, className, component, ...rest }: CarouselInnerProps<C>,\n ref: PolymorphicRef<C>\n) {\n const { registerViewport } = useCarouselContext()\n const Component = component ?? 'div'\n const forkedRef = useForkedRef(ref, registerViewport)\n const _className = classNames('carousel-inner', className)\n const { nodes, positioned } = readSlides(children)\n\n // Every child is wrapped the same way whether or not the positions are known, so a child that\n // comes and goes (a loading spinner beside the slides) doesn't remount the slides. Unknown\n // positions are provided as unset, which also keeps an enclosing carousel's from leaking in.\n return (\n <Component className={_className} {...rest} ref={forkedRef}>\n {nodes.map((node, index) => (\n <SlidePositionContext.Provider\n key={isValidElement(node) ? node.key : index}\n value={positioned ? { count: nodes.length, index } : undefined}\n >\n {node}\n </SlidePositionContext.Provider>\n ))}\n </Component>\n )\n}\n\nexport const CarouselInner = createPolymorphicComponent<CarouselInnerComponent>(\n CarouselInnerRender as ForwardRefRenderFunction<Element, CarouselInnerProps<ElementType>>,\n 'CarouselInner'\n)\n","import React, {\n Children,\n CSSProperties,\n forwardRef,\n HTMLAttributes,\n isValidElement,\n ReactNode,\n useCallback,\n useEffect,\n useRef,\n useState\n} from 'react'\nimport classNames from 'classnames'\n\nimport { useControllableState, useForkedRef, useIsomorphicLayoutEffect } from '../../hooks'\nimport { focusRedirect } from '../../utils/focusRedirect'\nimport { consumePointerClick } from '../../utils/pointerInteraction'\nimport { CarouselContext, CarouselContextProps, CarouselControlKind, CarouselEnds } from './context'\nimport {\n animateScrollTo,\n canLoop,\n directionBetween,\n getCarouselItems,\n isElementVisible,\n isRTL,\n isViewportScrollable,\n loopDirection,\n normalizeIndex,\n prefersReducedMotion,\n scrollDeltaFor\n} from './carouselEngine'\nimport { devWarning } from '../../utils/devWarning'\nimport { executeAfterTransition, getTransitionDuration } from '../../utils/dialogTransition'\nimport { isElementOfType } from '../../utils/lazyElement'\nimport { CarouselInner } from './CarouselInner'\nimport { readSlides } from './slides'\nimport { VisuallyHidden } from '../visually-hidden/VisuallyHidden'\n\nexport type { CarouselEnds }\nexport type CarouselTransition = 'scroll' | 'fade'\n\nexport interface CarouselSlideDetail {\n /**\n * Direction of travel, mirrored in RTL.\n */\n direction: 'left' | 'right'\n /**\n * Index of the outgoing slide.\n */\n from: number\n /**\n * Index of the incoming slide.\n */\n to: number\n}\n\nexport interface CarouselProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * The active slide's index, for controlled usage. Pair with `onSlide` to feed the new index\n * back: it is the only way a controlled carousel's `activeIndex` gets updated. `onSlid` can't\n * do that, as it reports a slide that has arrived, which a controlled carousel doesn't leave\n * for until `activeIndex` names it.\n */\n activeIndex?: number\n /**\n * Let each CarouselItem size itself instead of dividing the track evenly; snap points still land on every slide.\n */\n auto?: boolean\n /**\n * Cycle through slides automatically on mount.\n */\n autoplay?: boolean\n /**\n * Snap the active slide to the center of the viewport instead of its start.\n */\n center?: boolean\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * The active slide's index, for uncontrolled usage.\n */\n defaultActiveIndex?: number\n /**\n * Behavior at the first/last slide. `loop` continues seamlessly past the ends for a single-slide layout, falling back to `wrap` for multi-item, peek, centered, or variable-width layouts, and under reduced motion. `wrap` jumps from the last slide back to the first, and vice versa. `stop` hard-stops and disables the previous/next controls at each end.\n */\n ends?: CarouselEnds\n /**\n * Milliseconds to wait before automatically advancing to the next slide. Override per slide with CarouselItem's own `interval` prop.\n */\n interval?: number\n /**\n * Number of whole slides visible per view, applied as the `--cx-carousel-items` custom property.\n */\n items?: number\n /**\n * Space between slides, applied as the `--cx-carousel-items-gap` custom property.\n */\n itemsGap?: string\n /**\n * How much of the neighboring slides to reveal, applied as the `--cx-carousel-items-peek` custom property.\n */\n itemsPeek?: string\n /**\n * Move to the previous/next slide with the Left/Right arrow keys while focus is inside the\n * carousel. The keys follow the slides: in a right-to-left layout the next slide is to the\n * left, and Left Arrow moves to it.\n */\n keyboard?: boolean\n /**\n * Callback fired once a slide transition completes.\n */\n onSlid?: (detail: CarouselSlideDetail) => void\n /**\n * Callback fired when a slide transition begins.\n */\n onSlide?: (detail: CarouselSlideDetail) => void\n /**\n * Pause autoplay on `mouseenter`, resuming on `mouseleave`. Set to `false` to disable pause-on-hover.\n */\n pause?: 'hover' | false\n /**\n * Replace the scroll transition with a crossfade.\n */\n transition?: CarouselTransition\n}\n\nconst ACTIVE_RATIO_TOLERANCE = 0.05\n// How long the track must have stopped scrolling for a swipe to be over, and for a controlled\n// parent that hasn't followed it to be taken as not following. `scrollend` would say the first\n// outright, but not every supported browser has it, and it can come before the observer's last\n// report of the same frame. Half a second and not the 150 ms a scroll needs to settle: a parent\n// that keeps the index somewhere slow (the URL, a store behind a transition) answers `onSlide`\n// later than that, and the track went back and then forward again under it.\nconst SWIPE_SETTLE_MS = 500\n\nexport const Carousel = forwardRef<HTMLDivElement, CarouselProps>(\n (\n {\n children,\n activeIndex: activeIndexProp,\n auto,\n autoplay = false,\n center,\n className,\n defaultActiveIndex = 0,\n ends = 'loop',\n interval = 5000,\n items,\n itemsGap,\n itemsPeek,\n keyboard = true,\n onKeyDown,\n onMouseEnter,\n onMouseLeave,\n onSlid,\n onSlide,\n pause = 'hover',\n style,\n transition = 'scroll',\n ...rest\n },\n ref\n ) => {\n // `onSlide`, not a dedicated `onChange`, is the only way a controlled `activeIndex` gets fed\n // back (see the CarouselProps `activeIndex` doc and carousel.mdx's \"Controlled usage\"\n // section). Without it every click, swipe and autoplay advance is a request nobody hears, and\n // the carousel silently freezes instead of erroring. `onSlid` is no substitute: it reports a\n // slide that has arrived, and a controlled carousel only leaves for one once `activeIndex`\n // names it. This warning and the docs offered `onSlid` too, and a carousel fed from it alone\n // never moved.\n devWarning(\n activeIndexProp !== undefined && !onSlide,\n 'Carousel: `activeIndex` is set (controlled) without `onSlide`: nothing feeds the new ' +\n 'index back to your state, so the carousel will visually freeze on click/swipe/autoplay. ' +\n 'Pass `onSlide` and update `activeIndex` from it. `onSlid` cannot do this: it fires once ' +\n 'a slide has arrived, which under a controlled `activeIndex` only happens after the ' +\n 'prop has changed.'\n )\n\n const carouselRef = useRef<HTMLDivElement>(null)\n const forkedRef = useForkedRef(ref, carouselRef)\n\n const [viewportEl, setViewportEl] = useState<HTMLDivElement | null>(null)\n // Stable identity: this goes into `contextValue` and on to `useForkedRef` in `CarouselInner`,\n // whose memo is keyed on the refs array — a fresh closure every render would keep detaching\n // and reattaching the viewport ref instead of running once per mount.\n const registerViewport = useCallback((node: HTMLDivElement | null) => setViewportEl(node), [])\n\n const isControlled = activeIndexProp !== undefined\n const [activeIndex, setActiveIndex] = useControllableState(activeIndexProp, defaultActiveIndex)\n const activeIndexRef = useRef(activeIndex)\n // The index of the last commit, which `activeIndexRef` may run ahead of (see\n // `setActiveIndexInternal`).\n const committedIndexRef = useRef(activeIndex)\n // The step last asked for, until `activeIndex` changes: then the step that happened, which\n // `onSlid` reports.\n const lastTransitionRef = useRef<CarouselSlideDetail>({\n from: activeIndex,\n to: activeIndex,\n direction: 'left'\n })\n useIsomorphicLayoutEffect(() => {\n const from = committedIndexRef.current\n activeIndexRef.current = activeIndex\n committedIndexRef.current = activeIndex\n if (from === activeIndex) return\n // The parent of a controlled carousel can choose a slide nobody asked for, or answer a\n // request with another slide. `onSlid` then reported the last request as it stood, an\n // earlier step. A request that was followed is kept whole: it has the direction that was\n // asked for, which the two indexes of a step that wrapped round would give the other way.\n const asked = lastTransitionRef.current\n if (asked.from === from && asked.to === activeIndex) return\n lastTransitionRef.current = {\n from,\n to: activeIndex,\n direction: directionBetween(from, activeIndex, viewportEl ? isRTL(viewportEl) : false)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [activeIndex])\n\n // A timer, an observer and a running animation outlive the render that started them. The\n // callbacks they report to are read from here, so they are the latest render's.\n const onSlideRef = useRef(onSlide)\n const onSlidRef = useRef(onSlid)\n useIsomorphicLayoutEffect(() => {\n onSlideRef.current = onSlide\n onSlidRef.current = onSlid\n })\n\n // Counted from the DOM once the viewport is mounted (the layout effect below), which never\n // happens on the server: `CarouselIndicators` rendered an empty list there. The first render\n // counts the slides written inside `CarouselInner` instead.\n const [itemCount, setItemCount] = useState(() => countSlides(children))\n const itemCountRef = useRef(itemCount)\n useIsomorphicLayoutEffect(() => {\n itemCountRef.current = itemCount\n }, [itemCount])\n\n const [playing, setPlaying] = useState(autoplay)\n const [cycling, setCycling] = useState(false)\n // From the same index math as the layout effect below, so the server's HTML disables the\n // right end control. With no slides counted yet, neither end is known.\n const [atStart, setAtStart] = useState(activeIndex <= 0)\n const [atEnd, setAtEnd] = useState(\n itemCount > 0 && activeIndex >= itemCount - Math.max(1, items ?? 1)\n )\n\n const loopingRef = useRef(false)\n // True while a programmatic scroll-sync animation is in flight, so the IntersectionObserver\n // doesn't treat a slide passing through mid-scroll (e.g. slide 2 on the way from 1 to 3) as\n // the new active slide and hijack the navigation before it reaches its real target.\n const syncingScrollRef = useRef(false)\n // The slide the IntersectionObserver last asked for (i.e. the user physically scrolled/swiped\n // there), so the scroll-sync effect below can skip the change to it. Without this, every\n // threshold the observer crosses mid-gesture — before the browser's own scroll-snap has\n // actually settled the position — would make that effect \"correct\" the still-in-progress\n // native scroll, fighting the user's own touch/wheel input. It names the slide, and isn't a\n // plain flag, because the parent of a controlled carousel may not follow: a flag stayed set\n // then, and the next step that was followed, to any slide, didn't scroll. `settleSwipe`\n // clears the mark of a swipe nobody followed.\n const swipedToRef = useRef<number | null>(null)\n const swipeSettleTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n const touchingRef = useRef(false)\n const cancelScrollSyncRef = useRef<(() => void) | null>(null)\n // The loop transition's animation, which an unmount cancels as it cancels a scroll sync.\n const cancelLoopRef = useRef<(() => void) | null>(null)\n const observerRef = useRef<IntersectionObserver | null>(null)\n const visibilityRef = useRef(new Map<Element, number>())\n const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n const scrollSyncedRef = useRef(false)\n const mountedForSlidRef = useRef(false)\n const mountedForLiveRegionRef = useRef(false)\n const [liveMessage, setLiveMessage] = useState('')\n // Set while the scroll-sync effect below owns firing `onSlid` for the in-flight\n // `animateScrollTo` animation, so the generic effect doesn't fire it early — before the slide\n // has actually finished sliding into place.\n const deferOnSlidRef = useRef(false)\n const prevControlsRef = useRef<Set<HTMLButtonElement>>(new Set())\n const nextControlsRef = useRef<Set<HTMLButtonElement>>(new Set())\n const playControlsRef = useRef<Set<HTMLButtonElement>>(new Set())\n\n const isFade = transition === 'fade'\n const itemsVisible = Math.max(1, items ?? 1)\n const wraps = ends !== 'stop'\n\n const setActiveIndexInternal = (next: number) => {\n // Update the ref synchronously, not just via the layout effect below — that effect only\n // runs after React re-renders and commits, so two `next()` calls fired back-to-back in the\n // same tick (a fast double-click, or any rapid programmatic call) would both read the same\n // stale `activeIndexRef.current` and target the same index instead of advancing twice.\n activeIndexRef.current = next\n setActiveIndex(next)\n // A controlled carousel only asks. A parent that leaves `activeIndex` where it is renders\n // nothing, so no effect would put the ref back and every later step would start from a\n // slide that isn't shown. The ref runs ahead for the rest of this tick, which is all the\n // back-to-back calls above need, and is the prop's again after it.\n if (isControlled) {\n queueMicrotask(() => {\n activeIndexRef.current = committedIndexRef.current\n })\n }\n }\n\n // Moves the track by `delta` with scroll-snap off, which would pull it to the nearest slide\n // on the way, and with the observer told not to act on the slides that pass.\n const animateTrackBy = (viewport: HTMLDivElement, delta: number, onArrived?: () => void) => {\n // Cancel any previous scroll-sync still animating so it can't finish later and clobber\n // this newer target, and so `syncingScrollRef` isn't cleared early while this one runs.\n cancelScrollSyncRef.current?.()\n syncingScrollRef.current = true\n viewport.style.scrollSnapType = 'none'\n cancelScrollSyncRef.current = animateScrollTo(viewport, viewport.scrollLeft + delta, () => {\n viewport.style.scrollSnapType = ''\n syncingScrollRef.current = false\n cancelScrollSyncRef.current = null\n onArrived?.()\n })\n }\n\n // (Re)starts the wait for a swipe to come to rest. Refs only: the observer and the scroll\n // listener that call it belong to an earlier render.\n const awaitSwipeSettle = () => {\n if (swipeSettleTimerRef.current) clearTimeout(swipeSettleTimerRef.current)\n swipeSettleTimerRef.current = setTimeout(() => settleSwipeRef.current(), SWIPE_SETTLE_MS)\n }\n\n // Index math alone (not real geometry) drives `atStart`/`atEnd` so end-control state and\n // navigation clamping are correct even before layout exists (SSR, jsdom tests). The scroll\n // listener below refines it further for peek/variable-width layouts, where a whole number of\n // \"visible items\" can't be derived from `items` alone.\n useIsomorphicLayoutEffect(() => {\n const maxIndex = Math.max(0, itemCount - itemsVisible)\n setAtStart(activeIndex <= 0)\n setAtEnd(activeIndex >= maxIndex)\n }, [activeIndex, itemCount, itemsVisible])\n\n useEffect(() => {\n if (!viewportEl) return undefined\n\n const handleScroll = () => {\n // Still moving: a swipe waiting for its answer isn't over yet.\n if (swipedToRef.current !== null) awaitSwipeSettle()\n if (loopingRef.current || !isViewportScrollable(viewportEl)) return\n const maxScroll = viewportEl.scrollWidth - viewportEl.clientWidth\n // Elastic overscroll (iOS Safari/macOS trackpad rubber-banding) can push `scrollLeft`\n // slightly past either edge mid-gesture. Clamp to the real [0, maxScroll] range (mirrored\n // for RTL's negative `scrollLeft` convention) before the RTL-normalizing `abs()` below, so\n // a bounce at the start edge doesn't briefly read as \"away from start\" - which flickered\n // `ends=\"stop\"` controls enabled while still at the first/last slide.\n const rawScrollLeft = viewportEl.scrollLeft\n const clampedScrollLeft = isRTL(viewportEl)\n ? Math.max(-maxScroll, Math.min(0, rawScrollLeft))\n : Math.max(0, Math.min(maxScroll, rawScrollLeft))\n const scrollLeft = Math.abs(clampedScrollLeft)\n setAtStart(scrollLeft <= 1)\n setAtEnd(scrollLeft >= maxScroll - 1)\n }\n\n // A finger resting on the track mid-swipe stops the scroll events too.\n const handleTouchStart = () => {\n touchingRef.current = true\n }\n const handleTouchEnd = (event: TouchEvent) => {\n touchingRef.current = event.touches.length > 0\n }\n\n viewportEl.addEventListener('scroll', handleScroll, { passive: true })\n viewportEl.addEventListener('touchstart', handleTouchStart, { passive: true })\n viewportEl.addEventListener('touchend', handleTouchEnd)\n viewportEl.addEventListener('touchcancel', handleTouchEnd)\n return () => {\n viewportEl.removeEventListener('scroll', handleScroll)\n viewportEl.removeEventListener('touchstart', handleTouchStart)\n viewportEl.removeEventListener('touchend', handleTouchEnd)\n viewportEl.removeEventListener('touchcancel', handleTouchEnd)\n }\n }, [viewportEl])\n\n // Fewer slides than the active index needs: none would be active, the end control would be\n // disabled and the other one a no-op under `ends=\"stop\"`. The index moves to the last one\n // there is, which a controlled carousel asks for through `onSlide`. Once the count is the\n // DOM's: the first render's, read from `children`, may be short of slides inside components.\n useIsomorphicLayoutEffect(() => {\n if (!viewportEl || itemCount === 0 || getCarouselItems(viewportEl).length !== itemCount)\n return\n const last = Math.max(0, itemCount - itemsVisible)\n if (activeIndex <= last) return\n const detail: CarouselSlideDetail = {\n from: activeIndex,\n to: last,\n direction: directionBetween(activeIndex, last, isRTL(viewportEl))\n }\n lastTransitionRef.current = detail\n onSlideRef.current?.(detail)\n setActiveIndexInternal(last)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [viewportEl, activeIndex, itemCount, itemsVisible])\n\n // A layout effect, not a plain effect: `itemCount` must be measured before paint so the\n // atStart/atEnd layout effect above (which runs first, in declaration order) sees the real\n // count once React re-renders to flush this effect's `setItemCount` — otherwise the first\n // paint briefly shows `atEnd=true` (itemCount still 0) even on a carousel with many slides.\n useIsomorphicLayoutEffect(() => {\n if (!viewportEl) return undefined\n\n const syncItems = () => {\n const nodes = getCarouselItems(viewportEl)\n setItemCount(nodes.length)\n\n observerRef.current?.disconnect()\n observerRef.current = null\n visibilityRef.current = new Map()\n\n if (isFade || typeof IntersectionObserver === 'undefined') return\n\n observerRef.current = new IntersectionObserver(\n (entries) => {\n // Always merge entries so `visibilityRef` tracks reality even mid-animation —\n // dropping them here would leave the outgoing slide's last-known ratio stale (e.g.\n // still 1.0 from before the scroll started), which the comparison below would then\n // wrongly treat as still the most-visible slide once the animation completes. Only\n // acting on the result is guarded, so a slide passing through mid-programmatic-scroll\n // can't hijack the navigation before it reaches its real target.\n for (const entry of entries) {\n visibilityRef.current.set(\n entry.target,\n entry.isIntersecting ? entry.intersectionRatio : 0\n )\n }\n\n if (loopingRef.current || syncingScrollRef.current) return\n\n const currentNodes = getCarouselItems(viewportEl)\n const ratios = currentNodes.map((node) => visibilityRef.current.get(node) ?? 0)\n const maxRatio = Math.max(0, ...ratios)\n let bestIndex = activeIndexRef.current\n\n if (maxRatio > 0) {\n const found = ratios.findIndex((ratio) => ratio >= maxRatio - ACTIVE_RATIO_TOLERANCE)\n if (found !== -1) bestIndex = found\n }\n\n if (bestIndex !== activeIndexRef.current) {\n const from = activeIndexRef.current\n const detail = {\n from,\n to: bestIndex,\n direction: directionBetween(from, bestIndex, isRTL(viewportEl))\n }\n lastTransitionRef.current = detail\n onSlideRef.current?.(detail)\n swipedToRef.current = bestIndex\n setActiveIndexInternal(bestIndex)\n awaitSwipeSettle()\n }\n },\n { root: viewportEl, threshold: [0, 0.25, 0.5, 0.75, 1] }\n )\n\n for (const node of nodes) observerRef.current.observe(node)\n }\n\n syncItems()\n const mutationObserver = new MutationObserver(syncItems)\n mutationObserver.observe(viewportEl, { childList: true })\n\n return () => {\n mutationObserver.disconnect()\n observerRef.current?.disconnect()\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [viewportEl, isFade])\n\n // `activeIndex` is the source of truth for which slide is active, and fade mode's crossfade is\n // driven entirely by the `active` class. `CarouselItem` renders it, and the WAI-ARIA carousel\n // pattern's per-slide `role`/`aria-roledescription`/positional `aria-label`, when\n // `CarouselInner` can tell it its position (see `slides.tsx`), so the server's HTML has them.\n // This applies the same to the DOM, which also covers slides rendered by your own components.\n // A slide's own `aria-label` stays: the position is written only where there is none, or over\n // the one written here before (`positionLabelsRef`). It overwrote a `CarouselItem`'s own.\n const positionLabelsRef = useRef(new WeakMap<Element, string>())\n useIsomorphicLayoutEffect(() => {\n if (!viewportEl) return\n const nodes = getCarouselItems(viewportEl)\n for (const [index, node] of nodes.entries()) {\n node.classList.toggle('active', index === activeIndex)\n // A `group`, as the pattern has it: `aria-label` isn't allowed on an element with no role.\n if (!node.hasAttribute('role')) node.setAttribute('role', 'group')\n node.setAttribute('aria-roledescription', 'slide')\n const label = node.getAttribute('aria-label')\n if (label === null || label === positionLabelsRef.current.get(node)) {\n const position = `${index + 1} of ${nodes.length}`\n node.setAttribute('aria-label', position)\n positionLabelsRef.current.set(node, position)\n }\n }\n }, [viewportEl, activeIndex, itemCount])\n\n // Best-effort visual sync: scrolls the real DOM position to match `activeIndex` after a\n // programmatic navigation. A user-driven drag/swipe goes the other way (observer above), which\n // sets `swipedToRef` so this effect no-ops for it instead of fighting a gesture that's\n // still physically in progress — see the ref's own comment for why that matters.\n useIsomorphicLayoutEffect(() => {\n if (swipedToRef.current === activeIndex) {\n swipedToRef.current = null\n return\n }\n if (!viewportEl || loopingRef.current || isFade) return\n const nodes = getCarouselItems(viewportEl)\n const target = nodes[activeIndex]\n if (!target || !isViewportScrollable(viewportEl)) return\n\n // Marked as soon as this effect has a real viewport to sync against — on mount, even if\n // there's nothing to scroll (delta below is ~0). Otherwise the mount pass never sets it\n // (it returns early below without scrolling), and the *first real navigation* ends up\n // mistaken for the initial sync and forced instant instead of animated.\n const instant = !scrollSyncedRef.current\n scrollSyncedRef.current = true\n\n const delta = scrollDeltaFor(viewportEl, target, !!center)\n if (Math.abs(delta) < 1) return\n\n if (instant) {\n // Cancel any previous scroll-sync still animating so it can't finish later and clobber\n // this newer target, and so `syncingScrollRef` isn't cleared early while this one runs.\n cancelScrollSyncRef.current?.()\n syncingScrollRef.current = true\n viewportEl.style.scrollSnapType = 'none'\n viewportEl.scrollTo({ left: viewportEl.scrollLeft + delta, behavior: 'instant' })\n viewportEl.style.scrollSnapType = ''\n syncingScrollRef.current = false\n cancelScrollSyncRef.current = null\n } else {\n deferOnSlidRef.current = true\n animateTrackBy(viewportEl, delta, () => {\n deferOnSlidRef.current = false\n onSlidRef.current?.(lastTransitionRef.current)\n })\n }\n }, [viewportEl, activeIndex, itemCount, center, isFade])\n\n // A swipe is a request like any other, made after the track has moved. When the parent of a\n // controlled carousel doesn't follow it, the track is put back on the active slide: it stayed\n // on the slide the user had swiped to, with `activeIndex`, the indicators and the slide\n // marked `active` all naming another. Not before the swipe has come to rest, since a scroll\n // from here would fight the gesture (see `swipedToRef`): that is a pause in the track's\n // scroll events with no finger on it. An uncontrolled carousel has followed by then, and so\n // has a parent that does: the mark is gone and there is nothing to do.\n const settleSwipe = () => {\n swipeSettleTimerRef.current = null\n if (swipedToRef.current === null) return\n if (touchingRef.current) {\n awaitSwipeSettle()\n return\n }\n swipedToRef.current = null\n if (!viewportEl || loopingRef.current || syncingScrollRef.current || isFade) return\n const target = getCarouselItems(viewportEl)[committedIndexRef.current]\n if (!target) return\n const delta = scrollDeltaFor(viewportEl, target, !!center)\n if (Math.abs(delta) >= 1) animateTrackBy(viewportEl, delta)\n }\n // The timer outlives the render that set it, as the autoplay timer does.\n const settleSwipeRef = useRef(settleSwipe)\n useIsomorphicLayoutEffect(() => {\n settleSwipeRef.current = settleSwipe\n })\n\n useEffect(() => {\n if (!mountedForSlidRef.current) {\n mountedForSlidRef.current = true\n return\n }\n // The loop transition fires it once it has arrived (`performLoopTransition`).\n if (deferOnSlidRef.current || loopingRef.current) return\n const detail = lastTransitionRef.current\n // A crossfade is over when the incoming slide's opacity transition is: `onSlid` used to\n // fire on the commit `onSlide` did. It waits on the element's own transition, so a themed\n // duration is followed, and one that has none (reduced motion) doesn't wait. The cleanup\n // drops a fade another step overtook, as a scroll overtaken mid-flight reports nothing.\n const incoming = isFade && viewportEl ? getCarouselItems(viewportEl)[activeIndex] : undefined\n if (incoming) {\n return executeAfterTransition(\n incoming,\n () => onSlidRef.current?.(detail),\n getTransitionDuration(incoming) > 0\n )\n }\n onSlid?.(detail)\n return undefined\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [activeIndex])\n\n // Announces the active slide's position to assistive tech, per the WAI-ARIA carousel pattern.\n // Gated the same way as the `onSlid` effect above so mounting with a non-zero\n // `defaultActiveIndex`/`activeIndex` doesn't announce anything before the user has interacted.\n useEffect(() => {\n if (!mountedForLiveRegionRef.current) {\n mountedForLiveRegionRef.current = true\n return\n }\n setLiveMessage(`Slide ${activeIndex + 1} of ${itemCount}`)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [activeIndex])\n\n useEffect(() => {\n return () => {\n if (timeoutRef.current) clearTimeout(timeoutRef.current)\n if (swipeSettleTimerRef.current) clearTimeout(swipeSettleTimerRef.current)\n observerRef.current?.disconnect()\n cancelScrollSyncRef.current?.()\n cancelLoopRef.current?.()\n }\n }, [])\n\n const performLoopTransition = (isNext: boolean) => {\n const viewport = viewportEl\n if (!viewport) return\n\n // Drop any in-flight regular scroll-sync (e.g. a fast second navigation crossing the loop\n // boundary) so its stale onSettled can't fire mid-loop or after this transition completes.\n cancelScrollSyncRef.current?.()\n syncingScrollRef.current = false\n\n const nodes = getCarouselItems(viewport)\n const last = nodes.length - 1\n const from = activeIndexRef.current\n const to = isNext ? 0 : last\n const direction = loopDirection(isNext, isRTL(viewport))\n\n onSlide?.({ from, to, direction })\n // Now, not only in `finish`: a controlled parent follows `onSlide` while the loop still\n // runs, and the step that happened is matched against this one.\n lastTransitionRef.current = { from, to, direction }\n loopingRef.current = true\n\n const finish = () => {\n lastTransitionRef.current = { from, to, direction }\n loopingRef.current = false\n // A controlled parent that followed `onSlide` has already moved `activeIndex` to `to`,\n // during the loop, where `onSlid` waited (the effect that fires it): the slide has arrived\n // now. Otherwise the commit of this step fires it.\n if (committedIndexRef.current === to) onSlidRef.current?.(lastTransitionRef.current)\n else setActiveIndexInternal(to)\n }\n\n const source = isNext ? nodes[0] : nodes[last]\n const fromItem = nodes[from]\n const toItem = nodes[to]\n\n if (!isViewportScrollable(viewport) || !source || !fromItem || !toItem) {\n finish()\n return\n }\n\n const clone = source.cloneNode(true) as HTMLElement\n clone.classList.add('carousel-item-clone')\n clone.classList.remove('active')\n clone.removeAttribute('id')\n for (const node of Array.from(clone.querySelectorAll('[id]'))) node.removeAttribute('id')\n clone.setAttribute('aria-hidden', 'true')\n clone.setAttribute('inert', '')\n\n viewport.style.scrollSnapType = 'none'\n\n if (isNext) {\n viewport.append(clone)\n } else {\n viewport.prepend(clone)\n // Prepending shifts the real slides right; realign instantly so the insertion doesn't\n // flash. `scrollTo(..., 'instant')` rather than a raw `scrollLeft +=` — the compound\n // assignment's read/write isn't reliably observed by the browser right after a DOM\n // mutation changes `scrollWidth` (see the matching note by the final jump below).\n viewport.scrollTo({\n left: viewport.scrollLeft + scrollDeltaFor(viewport, fromItem, !!center),\n behavior: 'instant'\n })\n }\n\n const targetDelta = scrollDeltaFor(viewport, clone, !!center)\n cancelLoopRef.current = animateScrollTo(viewport, viewport.scrollLeft + targetDelta, () => {\n cancelLoopRef.current = null\n clone.remove()\n\n // `clone.remove()` shrinks `scrollWidth`, and the browser clamps `scrollLeft` to the new\n // max as a side effect — sometimes before a subsequent `scrollLeft +=` on the same tick\n // observes it, landing short of the real target. `scrollTo(..., 'instant')` with the full\n // absolute target doesn't have that race.\n const finalDelta = scrollDeltaFor(viewport, toItem, !!center)\n viewport.scrollTo({ left: viewport.scrollLeft + finalDelta, behavior: 'instant' })\n\n viewport.style.scrollSnapType = ''\n finish()\n })\n }\n\n const navigate = (rawTarget: number) => {\n if (loopingRef.current) return\n const length = itemCountRef.current\n if (length === 0) return\n\n const effectiveLast = Math.max(0, length - itemsVisible)\n\n if (\n ends === 'loop' &&\n !isFade &&\n !prefersReducedMotion() &&\n carouselRef.current &&\n canLoop(carouselRef.current, length, isFade, !!center, !!auto)\n ) {\n if (rawTarget > effectiveLast) {\n performLoopTransition(true)\n return\n }\n if (rawTarget < 0) {\n performLoopTransition(false)\n return\n }\n }\n\n const target = normalizeIndex(rawTarget, effectiveLast + 1, wraps)\n const from = activeIndexRef.current\n if (target === null || target === from) return\n\n // This step is the carousel's own, and scrolls: a swipe still waiting for its answer no\n // longer says where the track should be.\n swipedToRef.current = null\n\n // `rawTarget`, not the post-wrap `target`, so a wrap-around still reports the direction the\n // caller actually asked for (e.g. Next wrapping last -> 0 stays \"next\", not \"previous\").\n const direction = directionBetween(from, rawTarget, viewportEl ? isRTL(viewportEl) : false)\n onSlide?.({ from, to: target, direction })\n lastTransitionRef.current = { from, to: target, direction }\n setActiveIndexInternal(target)\n }\n\n const goNext = () => navigate(activeIndexRef.current + 1)\n const goPrev = () => navigate(activeIndexRef.current - 1)\n const goTo = (index: number) => navigate(index)\n\n const pauseCycle = () => {\n if (timeoutRef.current) clearTimeout(timeoutRef.current)\n timeoutRef.current = null\n setCycling(false)\n }\n\n // What the autoplay timer does when it fires. The timer is set in one render and fires in a\n // later one, and each tick used to run the closure of the render that started the cycle:\n // its `interval`, `ends`, `items`, `transition` and `onSlide`, whatever they had become.\n const autoplayTickRef = useRef<(fromIndex: number) => void>(() => undefined)\n\n const scheduleAutoplay = (fromIndex: number = activeIndexRef.current) => {\n if (timeoutRef.current) clearTimeout(timeoutRef.current)\n\n const nodes = viewportEl ? getCarouselItems(viewportEl) : []\n const attr = nodes[fromIndex]?.dataset.interval\n const ms = attr && !Number.isNaN(Number(attr)) ? Number(attr) : interval\n carouselRef.current?.style.setProperty('--cx-carousel-interval', `${ms}ms`)\n\n timeoutRef.current = setTimeout(() => autoplayTickRef.current(fromIndex), ms)\n }\n\n const stopPlayingForGood = () => {\n setPlaying(false)\n pauseCycle()\n }\n\n const autoplayTick = (fromIndex: number) => {\n const length = itemCountRef.current\n const effectiveLast = Math.max(0, length - itemsVisible)\n const upcoming = normalizeIndex(activeIndexRef.current + 1, effectiveLast + 1, wraps)\n const canAdvance =\n typeof document === 'undefined' ||\n (document.visibilityState === 'visible' && isElementVisible(carouselRef.current))\n\n if (!canAdvance) {\n scheduleAutoplay(fromIndex)\n return\n }\n\n goNext()\n\n // Nothing after the last slide of `ends=\"stop\"`: autoplay is over, not paused, and\n // `CarouselPlayPause` says so. Left `playing`, it still read \"Pause\", and took one click to\n // stop what had stopped and another to start again.\n if (upcoming === null) {\n stopPlayingForGood()\n return\n }\n\n scheduleAutoplay(upcoming)\n }\n useIsomorphicLayoutEffect(() => {\n autoplayTickRef.current = autoplayTick\n })\n\n // Under `ends=\"stop\"` there is nothing to play from the last slide: a cycle started there\n // ran one interval, with the indicator filling, for a tick that had no slide to go to.\n const hasNothingToPlay = () => {\n const length = itemCountRef.current\n return !wraps && length > 0 && activeIndexRef.current >= Math.max(0, length - itemsVisible)\n }\n\n const startCycle = () => {\n if (hasNothingToPlay()) {\n stopPlayingForGood()\n return\n }\n scheduleAutoplay()\n setCycling(true)\n }\n\n const togglePlayPause = () => {\n if (playing) {\n stopPlayingForGood()\n return\n }\n setPlaying(true)\n startCycle()\n }\n\n useEffect(() => {\n if (!viewportEl) return undefined\n if (playing) startCycle()\n return () => pauseCycle()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [viewportEl])\n\n // Under `ends=\"stop\"` autoplay is over when it arrives at the last slide. It used to wait one\n // more interval there, for the tick that finds nothing to go to, with the indicator's\n // progress filling and `CarouselPlayPause` reading \"Pause\" all the while. An effect and not a\n // line of the tick, so that the slide is the one being shown: a controlled parent may not\n // follow the tick, or may move there by itself. Only a cycle that is running ends, so Play\n // on the last slide still starts one.\n useEffect(() => {\n if (!timeoutRef.current || wraps || itemCount === 0) return\n if (activeIndex >= Math.max(0, itemCount - itemsVisible)) stopPlayingForGood()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [activeIndex, itemCount, itemsVisible, wraps])\n\n // A new `interval` applies to the slide being shown, not from the one after it. A slide's own\n // `interval` still wins, in `scheduleAutoplay`.\n useEffect(() => {\n if (timeoutRef.current) scheduleAutoplay()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [interval])\n\n useEffect(() => {\n if (!viewportEl) return undefined\n const handlePointerDown = () => stopPlayingForGood()\n viewportEl.addEventListener('pointerdown', handlePointerDown)\n return () => viewportEl.removeEventListener('pointerdown', handlePointerDown)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [viewportEl])\n\n // a11y: when a control at a disabled end is focused, move focus to the opposite control (if\n // it stays enabled) or the viewport, so focus never lands on nothing. `CarouselPlayPause` is\n // disabled at the end too, once autoplay is over there: the viewer who pressed Play and let\n // it run to the last slide has focus on it. From there, as from the next control, the way on\n // is back.\n useEffect(() => {\n if (ends !== 'stop') return\n const focused = document.activeElement as HTMLButtonElement | null\n const focusedIsPrev = atStart && !!focused && prevControlsRef.current.has(focused)\n const focusedIsNext =\n atEnd &&\n !!focused &&\n (nextControlsRef.current.has(focused) || (!playing && playControlsRef.current.has(focused)))\n if (!focusedIsPrev && !focusedIsNext) return\n\n const oppositeSet = focusedIsPrev ? nextControlsRef.current : prevControlsRef.current\n const oppositeStaysEnabled = focusedIsPrev ? !atEnd : !atStart\n const fallback = oppositeStaysEnabled ? Array.from(oppositeSet)[0] : null\n // `focused` is the control whose click (if any) just drove this redirect — `consumePointerClick`\n // reads (and clears) the pointer-vs-keyboard mark left on it, if `CarouselControlPrev`/\n // `CarouselControlNext` left one, so a stale mark from an earlier, unrelated interaction can't\n // leak into this one. See `focusRedirect`'s own comment for why this distinction matters\n // (Safari-only: a script-focused element still shows a ring there, unlike Chromium/Firefox).\n const viaPointer = consumePointerClick(focused)\n\n if (fallback) {\n focusRedirect(fallback, viaPointer, { preventScroll: true })\n return\n }\n\n if (viewportEl) {\n if (!viewportEl.hasAttribute('tabindex')) viewportEl.setAttribute('tabindex', '-1')\n focusRedirect(viewportEl, viaPointer, { preventScroll: true })\n }\n }, [atStart, atEnd, ends, playing, viewportEl])\n\n // Stable identity for the same reason as `registerViewport` above — the controls' own\n // registration effect depends on it.\n const registerControl = useCallback((kind: CarouselControlKind, element: HTMLButtonElement) => {\n const set = {\n next: nextControlsRef.current,\n play: playControlsRef.current,\n prev: prevControlsRef.current\n }[kind]\n set.add(element)\n return () => {\n set.delete(element)\n }\n }, [])\n\n // Compose rather than let a caller's handler silently replace the carousel's own — same rule\n // `CarouselControlButton`/`CarouselPlayPause` follow for `onClick`. These three sit on the\n // root element, so before this they were simply overwritten by the `{...rest}` spread below:\n // passing `onKeyDown` turned off arrow-key navigation and passing `onMouseEnter`/\n // `onMouseLeave` turned off pause-on-hover, both silently.\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event)\n if (!keyboard) return\n const target = event.target as HTMLElement\n if (target.closest('input, textarea, select, [contenteditable=\"true\"]')) return\n if (event.key !== 'ArrowLeft' && event.key !== 'ArrowRight') return\n\n event.preventDefault()\n stopPlayingForGood()\n // The key that points where the next slide is: to the right, or to the left in a\n // right-to-left layout, as `directionBetween` reports the direction of travel.\n const nextKey = isRTL(event.currentTarget) ? 'ArrowLeft' : 'ArrowRight'\n if (event.key === nextKey) goNext()\n else goPrev()\n }\n\n const handleMouseEnter = (event: React.MouseEvent<HTMLDivElement>) => {\n onMouseEnter?.(event)\n if (pause === 'hover') pauseCycle()\n }\n\n const handleMouseLeave = (event: React.MouseEvent<HTMLDivElement>) => {\n onMouseLeave?.(event)\n if (pause === 'hover' && playing) startCycle()\n }\n\n const contextValue: CarouselContextProps = {\n activeIndex,\n atEnd,\n atStart,\n ends,\n itemCount,\n itemsVisible,\n next: () => {\n stopPlayingForGood()\n goNext()\n },\n playing,\n prev: () => {\n stopPlayingForGood()\n goPrev()\n },\n registerControl,\n registerViewport,\n to: (index: number) => {\n stopPlayingForGood()\n goTo(index)\n },\n togglePlayPause\n }\n\n const _className = classNames(\n 'carousel',\n {\n 'carousel-fade': isFade,\n 'carousel-center': center,\n 'carousel-auto': auto,\n 'carousel-playing': cycling\n },\n className\n )\n\n const _style = {\n ...style,\n ...(items != null && { '--cx-carousel-items': items }),\n ...(itemsGap != null && { '--cx-carousel-items-gap': itemsGap }),\n ...(itemsPeek != null && { '--cx-carousel-items-peek': itemsPeek })\n } as CSSProperties\n\n return (\n <div\n role=\"region\"\n aria-roledescription=\"carousel\"\n className={_className}\n style={_style}\n onKeyDown={handleKeyDown}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n {...rest}\n ref={forkedRef}\n >\n <CarouselContext.Provider value={contextValue}>{children}</CarouselContext.Provider>\n <VisuallyHidden role=\"status\">{liveMessage}</VisuallyHidden>\n </div>\n )\n }\n)\n\nCarousel.displayName = 'Carousel'\n\n// The slides of the first `CarouselInner` found in `children` (see `slides.tsx`), or 0 when they\n// can't be told from here: they are then counted from the DOM once the carousel has mounted.\nfunction countSlides(children: ReactNode): number {\n for (const child of Children.toArray(children)) {\n if (isElementOfType<{ children?: ReactNode }>(child, CarouselInner)) {\n const { nodes, positioned } = readSlides(child.props.children)\n return positioned ? nodes.length : 0\n }\n if (!isValidElement<{ children?: ReactNode }>(child)) continue\n const count = countSlides(child.props.children)\n if (count > 0) return count\n }\n return 0\n}\n","import React, { ButtonHTMLAttributes, forwardRef, useEffect, useRef } from 'react'\nimport classNames from 'classnames'\n\nimport { useForkedRef } from '../../hooks'\nimport { markPointerClick } from '../../utils/pointerInteraction'\nimport { IconValue } from '../../utils/iconConfig'\nimport { IconSlot } from '../icon/iconSlot'\nimport { useCarouselContext } from './context'\nimport { VisuallyHidden } from '../visually-hidden/VisuallyHidden'\n\ninterface CarouselControlButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Which direction this control navigates, and which end-of-track state disables it.\n */\n direction: 'prev' | 'next'\n /**\n * The control's icon: an icon name, or an element of your own icon set. Defaults to\n * `IconProvider`'s `previous`/`next` icon.\n */\n icon?: IconValue\n /**\n * The accessible label announced by assistive technology.\n */\n label?: string\n}\n\n// Shared prev/next control, used by both CarouselControlPrev and CarouselControlNext — mirrors\n// how CalendarNavButton.tsx factors the same shape for Calendar/RangeCalendar.\nexport const CarouselControlButton = forwardRef<HTMLButtonElement, CarouselControlButtonProps>(\n ({ children, className, direction, disabled, icon, label, onClick, ...rest }, ref) => {\n const { atEnd, atStart, ends, next, prev, registerControl } = useCarouselContext()\n const buttonRef = useRef<HTMLButtonElement>(null)\n const forkedRef = useForkedRef(ref, buttonRef)\n\n useEffect(() => {\n const element = buttonRef.current\n if (!element) return undefined\n return registerControl(direction, element)\n }, [registerControl, direction])\n\n const atBoundary = direction === 'next' ? atEnd : atStart\n const navigate = direction === 'next' ? next : prev\n\n // Compose rather than let a caller's `onClick`/`disabled` silently replace navigation: the\n // carousel's own end-of-track state can only ever add a disable, and the click handler always\n // still navigates the carousel alongside whatever the caller's handler does.\n const isDisabled = disabled || (ends === 'stop' && atBoundary)\n const handleClick: typeof onClick = (event) => {\n onClick?.(event)\n if (event.detail !== 0) markPointerClick(event.currentTarget)\n navigate()\n }\n\n return (\n <button\n type=\"button\"\n className={classNames('button sm icon-only', className)}\n disabled={isDisabled}\n onClick={handleClick}\n {...rest}\n ref={forkedRef}\n >\n {children ?? (\n <>\n <IconSlot\n icon={direction === 'next' ? 'next' : 'previous'}\n override={icon}\n className=\"directional-icon\"\n />\n <VisuallyHidden>{label}</VisuallyHidden>\n </>\n )}\n </button>\n )\n }\n)\n\nCarouselControlButton.displayName = 'CarouselControlButton'\n","import React, { ButtonHTMLAttributes, forwardRef } from 'react'\n\nimport { IconValue } from '../../utils/iconConfig'\nimport { CarouselControlButton } from './CarouselControlButton'\n\nexport interface CarouselControlNextProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * The control's icon: an icon name, or an element of your own icon set. Defaults to\n * `IconProvider`'s `next` icon.\n */\n icon?: IconValue\n /**\n * The accessible label announced by assistive technology.\n */\n label?: string\n}\n\nexport const CarouselControlNext = forwardRef<HTMLButtonElement, CarouselControlNextProps>(\n ({ label = 'Next slide', ...rest }, ref) => (\n <CarouselControlButton {...rest} direction=\"next\" label={label} ref={ref} />\n )\n)\n\nCarouselControlNext.displayName = 'CarouselControlNext'\n","import React, { ButtonHTMLAttributes, forwardRef } from 'react'\n\nimport { IconValue } from '../../utils/iconConfig'\nimport { CarouselControlButton } from './CarouselControlButton'\n\nexport interface CarouselControlPrevProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * The control's icon: an icon name, or an element of your own icon set. Defaults to\n * `IconProvider`'s `previous` icon.\n */\n icon?: IconValue\n /**\n * The accessible label announced by assistive technology.\n */\n label?: string\n}\n\nexport const CarouselControlPrev = forwardRef<HTMLButtonElement, CarouselControlPrevProps>(\n ({ label = 'Previous slide', ...rest }, ref) => (\n <CarouselControlButton {...rest} direction=\"prev\" label={label} ref={ref} />\n )\n)\n\nCarouselControlPrev.displayName = 'CarouselControlPrev'\n","import React, { forwardRef, HTMLAttributes } from 'react'\nimport classNames from 'classnames'\n\nimport { useCarouselContext } from './context'\n\nexport interface CarouselIndicatorsProps extends HTMLAttributes<HTMLOListElement> {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Accessible label for each indicator button. Receives the slide's 1-based position.\n */\n label?: (position: number) => string\n}\n\nexport const CarouselIndicators = forwardRef<HTMLOListElement, CarouselIndicatorsProps>(\n ({ className, label = (position) => `Slide ${position}`, ...rest }, ref) => {\n const { activeIndex, itemCount, itemsVisible, to } = useCarouselContext()\n const _className = classNames('carousel-indicators', className)\n // One indicator per reachable position, not per item — mirrors `navigate()`'s own clamping so\n // an indicator never targets an index the carousel can't actually land on (e.g. with\n // `items > 1`, the last few slides only ever appear alongside an earlier one).\n const indicatorCount = itemCount === 0 ? 0 : Math.max(1, itemCount - itemsVisible + 1)\n\n return (\n <ol className={_className} {...rest} ref={ref}>\n {Array.from({ length: indicatorCount }, (_, index) => index).map((index) => (\n <li key={index}>\n <button\n type=\"button\"\n className={index === activeIndex ? 'active' : undefined}\n aria-current={index === activeIndex ? 'true' : undefined}\n aria-label={label(index + 1)}\n onClick={() => to(index)}\n />\n </li>\n ))}\n </ol>\n )\n }\n)\n\nCarouselIndicators.displayName = 'CarouselIndicators'\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 CarouselOverlayOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n}\n\nexport type CarouselOverlayProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n CarouselOverlayOwnProps<C>\n>\n\ntype CarouselOverlayComponent = (<C extends ElementType = 'div'>(\n props: CarouselOverlayProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\n/**\n * Overlays its children (typically controls and indicators) on top of the slides instead of\n * stacking them in the flow.\n */\nfunction CarouselOverlayRender<C extends ElementType = 'div'>(\n { children, className, component, ...rest }: CarouselOverlayProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames('carousel-overlay', className)\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const CarouselOverlay = createPolymorphicComponent<CarouselOverlayComponent>(\n CarouselOverlayRender as ForwardRefRenderFunction<Element, CarouselOverlayProps<ElementType>>,\n 'CarouselOverlay'\n)\n","import React, { ButtonHTMLAttributes, forwardRef, useEffect, useRef } from 'react'\nimport classNames from 'classnames'\n\nimport { useForkedRef } from '../../hooks'\nimport { IconValue } from '../../utils/iconConfig'\nimport { IconSlot } from '../icon/iconSlot'\nimport { useCarouselContext } from './context'\n\nexport interface CarouselPlayPauseProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * The icon shown while autoplay is running: an icon name, or an element of your own icon set.\n * Defaults to `IconProvider`'s `pause` icon.\n */\n pauseIcon?: IconValue\n /**\n * The accessible label announced while autoplay is running.\n */\n pauseLabel?: string\n /**\n * The accessible label announced while autoplay is stopped.\n */\n playLabel?: string\n /**\n * The icon shown while autoplay is stopped: an icon name, or an element of your own icon set.\n * Defaults to `IconProvider`'s `play` icon.\n */\n playIcon?: IconValue\n}\n\n/**\n * A discoverable toggle so a viewer can stop an autoplaying carousel, as required by WCAG 2.2\n * Success Criterion 2.2.2 (Pause, Stop, Hide). Reflects the current state automatically — a pause\n * icon while playing, a play icon once stopped. On the last slide of an `ends=\"stop\"` carousel\n * there is nothing left to play, and the stopped toggle is disabled, as the next control is.\n */\nexport const CarouselPlayPause = forwardRef<HTMLButtonElement, CarouselPlayPauseProps>(\n (\n {\n children,\n className,\n disabled,\n onClick,\n pauseIcon,\n pauseLabel = 'Pause',\n playIcon,\n playLabel = 'Play',\n ...rest\n },\n ref\n ) => {\n const { atEnd, ends, playing, registerControl, togglePlayPause } = useCarouselContext()\n const buttonRef = useRef<HTMLButtonElement>(null)\n const forkedRef = useForkedRef(ref, buttonRef)\n\n // Registered as the previous and next controls are, so the carousel moves focus off it when\n // the end of the track disables it.\n useEffect(() => {\n const element = buttonRef.current\n if (!element) return undefined\n return registerControl('play', element)\n }, [registerControl])\n\n // Pressed on the last slide of `ends=\"stop\"`, Play started a cycle with no slide to go to.\n // Disabled there as the next control is, and only once stopped: while autoplay runs the\n // toggle is the way to pause it (WCAG 2.2.2). Composed with the caller's own `disabled`,\n // which the carousel's state can only add to.\n const isDisabled = disabled || (ends === 'stop' && atEnd && !playing)\n const _className = classNames(\n 'carousel-control-play-pause button sm icon-only',\n { paused: !playing },\n className\n )\n // Compose rather than let a caller's `onClick` silently replace the toggle.\n const handleClick: typeof onClick = (event) => {\n onClick?.(event)\n togglePlayPause()\n }\n\n return (\n <button\n type=\"button\"\n className={_className}\n aria-label={playing ? pauseLabel : playLabel}\n disabled={isDisabled}\n onClick={handleClick}\n {...rest}\n ref={forkedRef}\n >\n {children ?? (\n <>\n <IconSlot icon=\"pause\" override={pauseIcon} className=\"carousel-icon-pause\" />\n <IconSlot icon=\"play\" override={playIcon} className=\"carousel-icon-play\" />\n </>\n )}\n </button>\n )\n }\n)\n\nCarouselPlayPause.displayName = 'CarouselPlayPause'\n"],"mappings":"A,gwBASA,MAAMa,kBAAgB,IAAI,QAE1B,SAAgBC,GAAiB,EAA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,UAAS,kBAAiB,mBAAoBhD,EAAmB,EAChFwN,EAAYxI,EAA0B,IAAI,EAC1CV,EAAYzF,EAAa0F,EAAKiJ,CAAS,EAI7C7E,MAAgB,CACd,IAAMpI,EAAUiN,EAAU,QAC1B,GAAKjN,EACL,OAAO8L,EAAgB,OAAQ9L,CAAO,CACxC,EAAG,CAAC8L,CAAe,CAAC,EAMpB,IAAMsB,EAAaC,GAAa1F,IAAS,QAAUxB,GAAS,CAACP,EACvD5C,EAAa/D,EACjB,kDACA,CAAE,OAAQ,CAAC2G,CAAQ,EACnB3C,CACF,EAOA,MACE,kBAAA,cAAC,SAAD,CACE,KAAK,SACL,UAAWD,EACX,aAAY4C,EAAUmI,EAAaC,EACnC,SAAUZ,EACV,QAXiC,GAAU,CAC7CE,IAAU1E,CAAK,EACf0C,EAAgB,CAClB,EASI,GAAI7I,EACJ,IAAKsB,CAQC,EANLZ,GACC,kBAAA,cAAAnE,EAAA,SAAA,KACE,kBAAA,cAACH,EAAD,CAAU,KAAK,QAAQ,SAAUoP,EAAW,UAAU,qBAAuB,CAAA,EAC7E,kBAAA,cAACpP,EAAD,CAAU,KAAK,OAAO,SAAUqP,EAAU,UAAU,oBAAsB,CAAA,CAC1E,CAEE,CAEZ,CACF,EAEA,GAAkB,YAAc,oB"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-Bs80iIBN.js";import{S as e,c as t,x as n}from"./slot-BQVx1Eew.js";import{t as r}from"./useForkedRef-WoqMqsWE.js";import{t as i}from"./useHeldBack-eeTfpa_t.js";import{n as a,t as o}from"./FormHelp-B1eSoack.js";import{t as s}from"./validationClassName-gRGs4KBm.js";import{t as c}from"./renderFormCheck-DvpfK_I4.js";import{n as l,r as u}from"./unhandledProps-9Kdj7WVf.js";import{t as d}from"./flex-C2jV5LyV.js";import f,{createContext as p,forwardRef as m,useContext as h,useEffect as g,useRef as _}from"react";import v from"classnames";import{useCheckbox as y,useCheckboxGroup as b,useCheckboxGroupItem as x}from"react-aria";import{useCheckboxGroupState as S,useToggleState as C}from"react-stately";const w=p(null),T=m(({button:e,children:t,className:n,color:a,defaultSelected:o,disabled:d,id:p,indeterminate:m,invalid:h,isSelected:g,label:b,onChange:x,size:S,style:w,valid:T,...E},D)=>{let O=_(null),k=r(D,O),{invalid:A,valid:j}=i(O,{invalid:h,valid:T}),M=C({defaultSelected:o,isDisabled:d,isSelected:g,onChange:x}),N=b??t,{inputProps:P}=y({...E,children:N,isDisabled:d,isIndeterminate:m,isInvalid:A,value:E.value},M,O),F=v(s(A,j));return c({button:e,className:n,color:a,input:/* @__PURE__ */ f.createElement(`input`,{...u(P,E,l),"aria-describedby":E[`aria-describedby`],className:F,id:p,ref:k}),invalid:A,label:N,size:S,style:w,valid:j})});T.displayName=`CheckboxStandalone`;const E=m(({button:i,children:a,className:o,color:d,defaultSelected:p,disabled:m,groupDescribedBy:h,groupState:y,groupValid:b,id:S,indeterminate:C,invalid:w,isSelected:T,label:E,onChange:D,size:O,style:k,valid:A,...j},M)=>{let N=w??y.isInvalid,P=A??b,F=_(null),I=r(M,F);g(()=>{n(!j.value,"Checkbox: a `value` prop is required when rendered inside a CheckboxGroup."),e(p!==void 0||T!==void 0||D!==void 0,"Checkbox: `defaultSelected`, `isSelected`, and `onChange` are ignored inside a CheckboxGroup — selection is owned by the group's `value`/`defaultValue`/`onChange`.")},[]);let L=E??a,{inputProps:R}=x({...j,children:L,isDisabled:m,isIndeterminate:C,isInvalid:w,value:j.value},y,F),z=v(s(N,P));return c({button:i,className:o,color:d,input:/* @__PURE__ */ f.createElement(`input`,{...u(R,j,l),"aria-describedby":t(j[`aria-describedby`],h),"aria-required":void 0,className:z,id:S,ref:I,required:j.required??(y.isRequired||void 0)}),invalid:N,label:L,size:O,style:k,valid:P})});E.displayName=`CheckboxGroupItem`;const D=m((e,t)=>{let n=h(w);return n?/* @__PURE__ */ f.createElement(E,{...e,groupDescribedBy:n.describedBy,groupState:n.state,groupValid:n.valid,ref:t}):/* @__PURE__ */ f.createElement(T,{...e,ref:t})});D.displayName=`Checkbox`;const O=m(({children:e,className:n,defaultValue:c,description:l,disabled:u,errorMessage:p,form:m,invalid:h,label:g,name:y,onChange:x,orientation:C,required:T,valid:E,value:D,...O},k)=>{let A=_(null),j=r(k,A),{invalid:M,valid:N}=i(A,{invalid:h,valid:E}),P={...O,defaultValue:c,description:l,errorMessage:p,form:m,isDisabled:u,isInvalid:M,isRequired:T,label:g,name:y,onChange:x,value:D},F=S(P),{groupProps:I,labelProps:L,descriptionProps:R,errorMessageProps:z}=b(P,F),B=v(`form-field`,s(M,N),n),V=t(!!l&&R.id,!!(M&&p)&&z.id),H=/* @__PURE__ */ f.createElement(w.Provider,{value:{describedBy:V,state:F,valid:N}},e);return/* @__PURE__ */ f.createElement(`fieldset`,{...O,...I,"aria-describedby":t(V,O[`aria-describedby`]),className:B,form:m,ref:j},g&&/* @__PURE__ */ f.createElement(`legend`,{className:`form-label`,...L},g),C===`horizontal`?/* @__PURE__ */ f.createElement(d,{wrap:`wrap`,gap:`md`},H):H,l&&/* @__PURE__ */ f.createElement(o,R,l),M&&p&&/* @__PURE__ */ f.createElement(a,{invalid:!0,...z},p))});O.displayName=`CheckboxGroup`;export{D as n,O as t};
|
|
2
|
-
//# sourceMappingURL=checkbox-ko6CdtoT.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-ko6CdtoT.js","names":["devWarning","joinIds","devError","useForkedRef","useHeldBack","FormFeedback","FormHelp","validationClassName","renderFormCheck","TOGGLE_PROPS","mergeUnhandledProps","Flex","React","classNames","CheckboxGroupContext","createContext","CheckboxStandalone","forwardRef","invalidProp","validProp","rest","inputRef","useRef","forkedRef","ref","toggleState","useToggleState","disabled","resolvedLabel","label","children","useCheckbox","indeterminate","invalid","inputClassName","valid","inputProps","CheckboxGroupItem","_defaultSelected","itemInvalid","_isSelected","_onChange","itemValid","groupState","groupValid","useEffect","useCheckboxGroupItem","groupDescribedBy","Checkbox","group","useContext","props","CheckboxGroup","fieldsetRef","groupProps","required","state","useCheckboxGroupState","ariaGroupProps","useCheckboxGroup","_className","className","describedBy","description","descriptionProps","errorMessage","errorMessageProps","items","labelProps","orientation"],"sources":["../../src/components/checkbox/context.ts","../../src/components/checkbox/Checkbox.tsx","../../src/components/checkbox/CheckboxGroup.tsx"],"sourcesContent":["import { createContext } from 'react'\nimport { CheckboxGroupState } from 'react-stately'\n\nexport interface CheckboxGroupContextValue {\n state: CheckboxGroupState\n /**\n * `CheckboxGroup`'s own `valid` prop, mirrored here since it has no react-stately equivalent to\n * read off `state` the way `isInvalid` does — each `Checkbox` needs it to apply its own\n * `is-valid` class when the item doesn't set its own (same pattern as `RadioGroupContext`).\n */\n valid?: boolean\n /**\n * The ids of the group's description and error message, when they are rendered. Each item is\n * described by them too.\n */\n describedBy?: string\n}\n\nexport const CheckboxGroupContext = createContext<CheckboxGroupContextValue | null>(null)\n","import React, {\n forwardRef,\n InputHTMLAttributes,\n ReactNode,\n useContext,\n useEffect,\n useRef\n} from 'react'\nimport classNames from 'classnames'\nimport {\n AriaCheckboxGroupItemProps,\n AriaCheckboxProps,\n useCheckbox,\n useCheckboxGroupItem\n} from 'react-aria'\nimport { CheckboxGroupState, useToggleState } from 'react-stately'\n\nimport { useForkedRef, useHeldBack } from '../../hooks'\nimport { ContextColor } from '../../types'\nimport { validationClassName } from '../../utils/validationClassName'\n\nimport { CheckboxGroupContext } from './context'\nimport { ButtonObject, renderFormCheck } from '../form/renderFormCheck'\nimport { devError, devWarning } from '../../utils/devWarning'\nimport { joinIds } from '../../utils/idRefs'\nimport { mergeUnhandledProps, TOGGLE_PROPS } from '../../utils/unhandledProps'\n\nexport type { ButtonObject } from '../form/renderFormCheck'\n\nexport interface CheckboxProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'checked' | 'defaultChecked' | 'onChange' | 'size'\n> {\n /**\n * Create button-like checkboxes.\n */\n button?: ButtonObject\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Sets the color of the check indicator to one of Chassis context colors. Ignored when `button` is set.\n */\n color?: ContextColor\n /**\n * Whether the checkbox is selected, uncontrolled. Ignored when rendered inside a `<CheckboxGroup>` —\n * the group's `value`/`defaultValue` owns selection there.\n */\n defaultSelected?: boolean\n /**\n * The id global attribute defines an identifier (ID) that must be unique in the whole document.\n */\n id?: string\n /**\n * Checkbox indeterminate property.\n */\n indeterminate?: 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 * Whether the checkbox is selected, controlled. Ignored when rendered inside a `<CheckboxGroup>` —\n * the group's `value`/`defaultValue` owns selection there.\n */\n isSelected?: boolean\n /**\n * The element represents a caption for a component.\n *\n * Children are accepted as an alias for this prop — `label` wins when both are given.\n * react-aria, which backs this component, calls the same thing `children`; this package renames\n * it to `label`, and honouring both means the shape React developers reach for first still\n * names the control instead of silently producing an unlabelled one.\n */\n label?: ReactNode\n /**\n * Callback fired when the selected state changes. Ignored when rendered inside a `<CheckboxGroup>` —\n * use the group's `onChange` instead.\n */\n onChange?: (isSelected: boolean) => void\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 * The value of the checkbox, used when submitting an HTML form. Required when rendered inside a\n * `<CheckboxGroup>` — it identifies this item within the group's selected values.\n */\n value?: string\n}\n\nconst CheckboxStandalone = forwardRef<HTMLInputElement, CheckboxProps>(\n (\n {\n button,\n children,\n className,\n color,\n defaultSelected,\n disabled,\n id,\n indeterminate,\n invalid: invalidProp,\n isSelected,\n label,\n onChange,\n size,\n style,\n valid: validProp,\n ...rest\n },\n ref\n ) => {\n const inputRef = useRef<HTMLInputElement>(null)\n const forkedRef = useForkedRef(ref, inputRef)\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 const { invalid, valid } = useHeldBack(inputRef, { invalid: invalidProp, valid: validProp })\n\n const toggleState = useToggleState({\n defaultSelected,\n isDisabled: disabled,\n isSelected,\n onChange\n })\n\n // `label` is this package's name for what react-aria calls `children`. Accept either, so the\n // shape React developers reach for first names the control instead of vanishing.\n const resolvedLabel = label ?? children\n\n const { inputProps } = useCheckbox(\n {\n ...rest,\n children: resolvedLabel,\n isDisabled: disabled,\n isIndeterminate: indeterminate,\n isInvalid: invalid,\n value: rest.value as string | undefined\n } as AriaCheckboxProps,\n toggleState,\n inputRef\n )\n\n const inputClassName = classNames(validationClassName(invalid, valid))\n\n return renderFormCheck({\n button,\n className,\n color,\n // `aria-describedby` after the spread: react-aria's own adds ids it never renders (FORMS.md,\n // gotcha 6).\n input: (\n <input\n {...mergeUnhandledProps(inputProps, rest, TOGGLE_PROPS)}\n aria-describedby={rest['aria-describedby']}\n className={inputClassName}\n id={id}\n ref={forkedRef}\n />\n ),\n invalid,\n label: resolvedLabel,\n size,\n style,\n valid\n })\n }\n)\nCheckboxStandalone.displayName = 'CheckboxStandalone'\n\ninterface CheckboxGroupItemProps extends CheckboxProps {\n groupDescribedBy?: string\n groupState: CheckboxGroupState\n groupValid?: boolean\n}\n\nconst CheckboxGroupItem = forwardRef<HTMLInputElement, CheckboxGroupItemProps>(\n (\n {\n button,\n children,\n className,\n color,\n defaultSelected: _defaultSelected,\n disabled,\n groupDescribedBy,\n groupState,\n groupValid,\n id,\n indeterminate,\n invalid: itemInvalid,\n isSelected: _isSelected,\n label,\n onChange: _onChange,\n size,\n style,\n valid: itemValid,\n ...rest\n },\n ref\n ) => {\n // The group's own invalid/valid cascades to every item, same as RadioGroup does for Radio —\n // but an item can still override it with its own invalid/valid, since (unlike a lone Radio) a\n // lone Checkbox's validity is independently meaningful (see FORMS.md).\n const invalid = itemInvalid ?? groupState.isInvalid\n const valid = itemValid ?? groupValid\n const inputRef = useRef<HTMLInputElement>(null)\n const forkedRef = useForkedRef(ref, inputRef)\n\n // Once per mount, not on every render — these are dev-time misuse warnings, not something\n // that needs to re-fire for every keystroke a parent's re-render happens to cause.\n useEffect(() => {\n devError(\n !rest.value,\n 'Checkbox: a `value` prop is required when rendered inside a CheckboxGroup.'\n )\n devWarning(\n _defaultSelected !== undefined || _isSelected !== undefined || _onChange !== undefined,\n 'Checkbox: `defaultSelected`, `isSelected`, and `onChange` are ignored inside a ' +\n \"CheckboxGroup — selection is owned by the group's `value`/`defaultValue`/`onChange`.\"\n )\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n // `label` is this package's name for what react-aria calls `children`. Accept either, so the\n // shape React developers reach for first names the control instead of vanishing.\n const resolvedLabel = label ?? children\n\n const { inputProps } = useCheckboxGroupItem(\n {\n ...rest,\n children: resolvedLabel,\n isDisabled: disabled,\n isIndeterminate: indeterminate,\n // The item's own `invalid`, not the group's read back from `groupState`: react-aria\n // registers an invalid item with the group, whose state then stays invalid for as long\n // as the item is, so a group's `invalid` handed back to its items never came off them\n // again. The hook shows the group's state on each item by itself.\n isInvalid: itemInvalid,\n value: rest.value as string\n } as AriaCheckboxGroupItemProps,\n groupState,\n inputRef\n )\n\n const inputClassName = classNames(validationClassName(invalid, valid))\n\n return renderFormCheck({\n button,\n className,\n color,\n // Described by the group's description and error message, as react-aria intends, but only\n // by those the group renders (FORMS.md, gotcha 6).\n input: (\n <input\n {...mergeUnhandledProps(inputProps, rest, TOGGLE_PROPS)}\n aria-describedby={joinIds(rest['aria-describedby'], groupDescribedBy)}\n // The native `required` below says the same.\n aria-required={undefined}\n className={inputClassName}\n id={id}\n ref={forkedRef}\n // A required group asks for one of its checkboxes, which HTML has no attribute for:\n // every checkbox is required while none is selected, as react-aria's own native\n // validation does it (`groupState.isRequired` is false once one is). react-aria writes\n // `aria-required` alone, which no form checks.\n required={rest.required ?? (groupState.isRequired || undefined)}\n />\n ),\n invalid,\n label: resolvedLabel,\n size,\n style,\n valid\n })\n }\n)\nCheckboxGroupItem.displayName = 'CheckboxGroupItem'\n\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {\n const group = useContext(CheckboxGroupContext)\n return group ? (\n <CheckboxGroupItem\n {...props}\n groupDescribedBy={group.describedBy}\n groupState={group.state}\n groupValid={group.valid}\n ref={ref}\n />\n ) : (\n <CheckboxStandalone {...props} ref={ref} />\n )\n})\n\nCheckbox.displayName = 'Checkbox'\n","import React, { forwardRef, HTMLAttributes, ReactNode, useRef } from 'react'\nimport classNames from 'classnames'\nimport { AriaCheckboxGroupProps, useCheckboxGroup } from 'react-aria'\nimport { useCheckboxGroupState } from 'react-stately'\n\nimport { useForkedRef, useHeldBack } from '../../hooks'\nimport { validationClassName } from '../../utils/validationClassName'\nimport { joinIds } from '../../utils/idRefs'\n\nimport { CheckboxGroupContext } from './context'\nimport { FormFeedback } from '../form/FormFeedback'\nimport { FormHelp } from '../form/FormHelp'\nimport { Flex } from '../flex'\n\nexport interface CheckboxGroupProps extends Omit<\n HTMLAttributes<HTMLFieldSetElement>,\n 'defaultValue' | 'onChange'\n> {\n /**\n * One or more `<Checkbox>` elements.\n */\n children: ReactNode\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * The selected values, uncontrolled.\n */\n defaultValue?: string[]\n /**\n * A description for the group, rendered below the options.\n */\n description?: ReactNode\n /**\n * Disables every checkbox in the group.\n */\n disabled?: boolean\n /**\n * An error message for the group, rendered below the options when `invalid` is set, and after\n * a submit the group held back, until it no longer would.\n */\n errorMessage?: ReactNode\n /**\n * The id of the `<form>` the group belongs to, for a group rendered outside it. Reaches every\n * checkbox; a `Checkbox` with its own `form` keeps it.\n */\n form?: string\n /**\n * Set group validation state to invalid. Left unset, the group 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 * The group's caption, rendered as a `<legend>`.\n */\n label?: ReactNode\n /**\n * The name for the group, used for native form submission.\n */\n name?: string\n /**\n * Callback fired when the selected values change.\n */\n onChange?: (value: string[]) => void\n /**\n * Lay the group's checkboxes out on the same horizontal row instead of stacking them.\n */\n orientation?: 'horizontal' | 'vertical'\n /**\n * Requires at least one checkbox of the group. While none is selected each carries the native\n * `required`, so a form isn't submitted until one is; a `Checkbox` with its own `required`\n * stays required whatever the others are.\n */\n required?: boolean\n /**\n * Set group validation state to valid.\n */\n valid?: boolean\n /**\n * The selected values, controlled.\n */\n value?: string[]\n}\n\nexport const CheckboxGroup = forwardRef<HTMLFieldSetElement, CheckboxGroupProps>(\n (\n {\n children,\n className,\n defaultValue,\n description,\n disabled,\n errorMessage,\n form,\n invalid: invalidProp,\n label,\n name,\n onChange,\n orientation,\n required,\n valid: validProp,\n value,\n ...rest\n },\n ref\n ) => {\n const fieldsetRef = useRef<HTMLFieldSetElement>(null)\n const forkedRef = useForkedRef(ref, fieldsetRef)\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 fieldset hears every checkbox, and the group shows it for them all, with `errorMessage`.\n const { invalid, valid } = useHeldBack(fieldsetRef, { invalid: invalidProp, valid: validProp })\n\n const groupProps = {\n ...rest,\n defaultValue,\n description,\n errorMessage,\n form,\n isDisabled: disabled,\n isInvalid: invalid,\n isRequired: required,\n label,\n name,\n onChange,\n value\n }\n\n const state = useCheckboxGroupState(groupProps)\n const {\n groupProps: ariaGroupProps,\n labelProps,\n descriptionProps,\n errorMessageProps\n } = useCheckboxGroup(groupProps as AriaCheckboxGroupProps, state)\n\n const _className = classNames('form-field', validationClassName(invalid, valid), className)\n\n // Only the ids this group renders. react-aria's own describe the group and every item by a\n // description and an error message whether or not they exist (FORMS.md, gotcha 6).\n const describedBy = joinIds(\n Boolean(description) && descriptionProps.id,\n Boolean(invalid && errorMessage) && errorMessageProps.id\n )\n\n const items = (\n <CheckboxGroupContext.Provider value={{ describedBy, state, valid }}>\n {children}\n </CheckboxGroupContext.Provider>\n )\n\n return (\n <fieldset\n {...rest}\n {...ariaGroupProps}\n aria-describedby={joinIds(describedBy, rest['aria-describedby'])}\n className={_className}\n // The fieldset's own form owner. react-aria hands the group's `form` to each of its\n // checkboxes, under one that has its own.\n form={form}\n ref={forkedRef}\n >\n {label && (\n <legend className=\"form-label\" {...labelProps}>\n {label}\n </legend>\n )}\n {orientation === 'horizontal' ? (\n <Flex wrap=\"wrap\" gap=\"md\">\n {items}\n </Flex>\n ) : (\n items\n )}\n {description && <FormHelp {...descriptionProps}>{description}</FormHelp>}\n {invalid && errorMessage && (\n <FormFeedback invalid {...errorMessageProps}>\n {errorMessage}\n </FormFeedback>\n )}\n </fieldset>\n )\n }\n)\n\nCheckboxGroup.displayName = 'CheckboxGroup'\n"],"mappings":"A,6sBAkBA,MAAac,EAAuBC,EAAgD,IAAI,ECgFlFC,EAAqBC,GAEvB,CACE,SACA,WACA,YACA,QACA,kBACA,WACA,KACA,gBACA,QAASC,EACT,aACA,QACA,WACA,OACA,QACA,MAAOC,EACP,GAAGC,GAEL,IACG,CACH,IAAMC,EAAWC,EAAyB,IAAI,EACxCC,EAAYpB,EAAaqB,EAAKH,CAAQ,EAGtC,CAAE,UAAS,SAAUjB,EAAYiB,EAAU,CAAE,QAASH,EAAa,MAAOC,CAAU,CAAC,EAErFM,EAAcC,EAAe,CACjC,kBACA,WAAYC,EACZ,aACA,UACF,CAAC,EAIKC,EAAgBC,GAASC,EAEzB,CAAE,cAAeC,EACrB,CACE,GAAGX,EACH,SAAUQ,EACV,WAAYD,EACZ,gBAAiBK,EACjB,UAAWC,EACX,MAAOb,EAAK,KACd,EACAK,EACAJ,CACF,EAEMa,EAAiBrB,EAAWN,EAAoB0B,EAASE,CAAK,CAAC,EAErE,OAAO3B,EAAgB,CACrB,SACA,YACA,QAGA,MACE,kBAAA,cAAC,QAAD,CACE,GAAIE,EAAoB0B,EAAYhB,EAAMX,CAAY,EACtD,mBAAkBW,EAAK,oBACvB,UAAWc,EACP,KACJ,IAAKX,CACN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B,EADHwD,CACG,EAENA,EAEDJ,GAAe,kBAAA,cAACzD,EAAa0D,EAAmBD,CAAsB,EACtE9B,GAAWgC,GACV,kBAAA,cAAC5D,EAAD,CAAc,QAAA,GAAQ,GAAI6D,CAEZ,EADXD,CACW,CAER,CAEd,CACF,EAEA,EAAc,YAAc,gB"}
|
|
@@ -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"./useIsomorphicLayoutEffect-BbqRwuqn.js";import{t as r}from"./useFormField-DH2tlc3e.js";import{t as i}from"./useHeldBack-eeTfpa_t.js";import{t as a}from"./renderFormField-_6WswnEX.js";import{t as o}from"./CloseButton-BPUI5iGX.js";import{t as s}from"./direction-LN6uwsK5.js";import{t as c}from"./validationClassName-gRGs4KBm.js";import{t as l}from"./Chip-C7QlFCvx.js";import u,{forwardRef as d,useMemo as f,useRef as p,useState as m}from"react";import h from"classnames";import{useButton as g,useTag as _,useTagGroup as v,useTextField as ee}from"react-aria";import{Item as y,useListState as te}from"react-stately";const ne=({chipVariant:e,disabled:t,groupRef:n,props:r,size:i,state:a})=>{let{gridProps:o}=v(r,a,n);return/* @__PURE__ */ u.createElement(`div`,{...o,"aria-describedby":void 0,"aria-multiselectable":o.role===`grid`?o[`aria-multiselectable`]:void 0,style:{display:`contents`},ref:n},[...a.collection].map(n=>/* @__PURE__ */ u.createElement(b,{chipVariant:e,disabled:t,item:n,key:n.key,size:i,state:a})))},b=({chipVariant:e,disabled:t,item:n,size:r,state:i})=>{let a=p(null),{rowProps:s,gridCellProps:c,removeButtonProps:d,allowsRemoving:f}=_({item:n},i,a),m=p(null),{buttonProps:v}=g(d,m);return/* @__PURE__ */ u.createElement(l,{...s,"aria-labelledby":void 0,className:h(e,{active:i.selectionManager.isSelected(n.key)}),component:`div`,disabled:t,ref:a,size:r},/* @__PURE__ */ u.createElement(`div`,{...c,style:{display:`contents`}},n.rendered,f&&/* @__PURE__ */ u.createElement(o,{...v,ref:m})))},re=e=>{let t=/* @__PURE__ */ new Map;return e.map(e=>{let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}\u0000${n}`})},x=d(({allowDuplicates:o=!1,"aria-describedby":l,"aria-label":d,"aria-labelledby":g,chipVariant:_=`default`,className:v,defaultValue:b,disabled:x,help:S,id:ie,invalid:ae,invalidFeedback:C,label:w,maxChips:T,name:E,onChange:oe,placeholder:se,required:D,separator:O=`,`,size:k,valid:ce,validFeedback:A,value:le,...ue},j)=>{let[M,N]=t(le,b??[],oe),P=f(()=>re(M),[M]),F=(e,t)=>t!==``&&(o||!e.includes(t)),I=()=>{if(T!=null&&M.length>=T)return;let e=U.trim();F(M,e)&&N([...M,e]),W(``)},de=e=>{let t=new Set(e);N(M.filter((e,n)=>!t.has(P[n])))},L=f(()=>M.map((e,t)=>({id:P[t],value:e})),[M,P]),R=te({children:e=>/* @__PURE__ */ u.createElement(y,{key:e.id,textValue:e.value},e.value),disabledKeys:x?L.map(e=>e.id):void 0,items:L,selectionMode:`multiple`}),z=p(null),B=p(null),V=e(j,B),H=p(null),[U,W]=m(``),G=!!D&&M.length===0;n(()=>{H.current?.setCustomValidity(G?`Add a chip.`:``)});let{invalid:K,valid:q}=i(H,{invalid:ae,valid:ce}),J=e=>{if(M.length===0)return;let t=P[P.length-1];e?R.selectionManager.extendSelection(t):R.selectionManager.replaceSelection(t);let n=z.current?.querySelectorAll(`[role="row"]`);n?.[n.length-1]?.focus()},fe=e=>{if(!x){if(O&&e.key===O)e.preventDefault(),I();else switch(e.key){case`Enter`:e.preventDefault(),I();break;case`Backspace`:case`Delete`:U===``&&(e.preventDefault(),J(!1));break;case`ArrowLeft`:case`ArrowRight`:{let t=H.current;if(!t)break;e.key===`ArrowLeft`!==s(t)&&t.selectionStart===0&&t.selectionEnd===0&&(e.preventDefault(),J(e.shiftKey));break}case`Escape`:W(``),R.selectionManager.clearSelection(),H.current?.blur()}}},pe=e=>{if(x||!O)return;let t=e.clipboardData.getData(`text`);if(!t.includes(O))return;e.preventDefault();let n=t.split(O),r=M,i=0;for(;i<n.length-1&&!(T!=null&&r.length>=T);i++){let e=n[i].trim();F(r,e)&&(r=[...r,e])}r!==M&&N(r),W(n.slice(i).join(O))},{describedBy:Y,feedbackId:X,helpId:me,inputId:Z,labelId:he,labelledBy:Q}=r({ariaDescribedBy:l,ariaLabelledBy:g,help:S,id:ie,invalid:K,invalidFeedback:C,label:w,valid:q,validFeedback:A}),{inputProps:$}=ee({"aria-describedby":Y,"aria-label":d??(Q?void 0:`Add value`),"aria-labelledby":Q,id:Z,isDisabled:x,isInvalid:K,isRequired:D,onChange:W,onFocus:()=>R.selectionManager.clearSelection(),onKeyDown:fe,placeholder:se,value:U},H);return a({children:/* @__PURE__ */ u.createElement(`div`,{className:h(`form-input`,`chip-input`,k,{disabled:x},c(K,q),v),...ue,ref:V},/* @__PURE__ */ u.createElement(ne,{chipVariant:_,disabled:x,groupRef:z,props:{"aria-label":d,"aria-labelledby":Q,onRemove:x?void 0:de},size:k,state:R}),/* @__PURE__ */ u.createElement(`input`,{...$,"aria-describedby":Y,"aria-required":G?void 0:$[`aria-required`],className:`ghost-input`,onPaste:pe,ref:H,required:G||void 0}),E&&L.map(e=>/* @__PURE__ */ u.createElement(`input`,{disabled:x,key:e.id,name:E,type:`hidden`,value:e.value}))),help:S,ids:{feedback:X,help:me,input:Z,label:he},invalid:K,invalidFeedback:C,label:w,valid:q,validFeedback:A})});x.displayName=`ChipInput`;export{x as t};
|
|
2
|
-
//# sourceMappingURL=chip-input-CugY8EOc.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chip-input-CugY8EOc.js","names":["useForkedRef","useIsomorphicLayoutEffect","useFormField","useHeldBack","renderFormField","CloseButton","isRTL","validationClassName","Chip","React","classNames","ChipList","useTagGroup","props","state","groupRef","gridProps","ChipRow","item","ref","useRef","useTag","buttonRef","useButton","removeButtonProps","rowProps","chipVariant","gridCellProps","allowsRemoving","buttonProps","buildTagIds","seen","list","occurrence","tag","ChipInput","forwardRef","ariaDescribedBy","ariaLabel","ariaLabelledBy","invalidProp","validProp","rest","tags","updateTags","useControllableState","value","defaultValue","onChange","ids","useMemo","isAddableValue","trimmed","allowDuplicates","commitInput","maxChips","inputValue","setInputValue","removeTags","toRemove","keys","index","items","listState","useListState","Item","disabled","containerRef","forkedRef","inputRef","useState","needsChip","required","focusLastChip","lastKey","extend","rows","handleKeyDown","separator","event","input","handlePaste","pasted","parts","next","useTextField","describedBy","labelledBy","inputId","invalid","size","valid","className","inputProps","name","feedbackId","helpId","labelId"],"sources":["../../src/components/chip-input/ChipList.tsx","../../src/components/chip-input/ChipInput.tsx"],"sourcesContent":["import React, { RefObject, useRef } from 'react'\nimport classNames from 'classnames'\nimport { AriaTagGroupOptions, useButton, useTag, useTagGroup } from 'react-aria'\nimport { ListState, Node } from 'react-stately'\n\nimport { Chip } from '../chip/Chip'\nimport { CloseButton } from '../close-button/CloseButton'\n\n// react-stately's collection builder caches nodes in a WeakMap keyed by each item's own\n// identity, so `items` must be objects — plain tag strings can't be WeakMap keys.\nexport interface ChipItem {\n id: string\n value: string\n}\n\ninterface ChipListProps {\n chipVariant?: string\n disabled?: boolean\n groupRef: RefObject<HTMLDivElement | null>\n props: AriaTagGroupOptions<ChipItem>\n size?: 'sm' | 'lg'\n state: ListState<ChipItem>\n}\n\nexport const ChipList = ({\n chipVariant,\n disabled,\n groupRef,\n props,\n size,\n state\n}: ChipListProps) => {\n const { gridProps } = useTagGroup(props, state, groupRef)\n\n // react-aria describes the list by a description and an error message it never renders here\n // (FORMS.md, gotcha 6), and keeps `aria-multiselectable` when an empty list turns from a `grid`\n // into a `group`, which doesn't allow it.\n return (\n <div\n {...gridProps}\n aria-describedby={undefined}\n aria-multiselectable={\n gridProps.role === 'grid' ? gridProps['aria-multiselectable'] : undefined\n }\n style={{ display: 'contents' }}\n ref={groupRef as RefObject<HTMLDivElement>}\n >\n {[...state.collection].map((item) => (\n <ChipRow\n chipVariant={chipVariant}\n disabled={disabled}\n item={item}\n key={item.key}\n size={size}\n state={state}\n />\n ))}\n </div>\n )\n}\n\ninterface ChipRowProps {\n chipVariant?: string\n disabled?: boolean\n item: Node<ChipItem>\n size?: 'sm' | 'lg'\n state: ListState<ChipItem>\n}\n\n// Renders one tag as the shared `Chip` component, wrapped in the row/gridcell markup\n// `useTag`'s grid semantics require — see FORMS.md-adjacent notes in ChipInput.tsx for why the\n// grid role lives on `ChipList`'s own wrapper rather than `.chip-input` itself. The `active`\n// class communicates selection directly (react-aria's `aria-selected`, from `rowProps`, is the\n// actual ARIA signal); `Chip`'s own `pressed`/`aria-pressed` prop is deliberately left unset\n// here since `aria-pressed` isn't a valid property on a `role=\"row\"` element.\nconst ChipRow = ({ chipVariant, disabled, item, size, state }: ChipRowProps) => {\n const ref = useRef<HTMLDivElement>(null)\n const { rowProps, gridCellProps, removeButtonProps, allowsRemoving } = useTag(\n { item },\n state,\n ref\n )\n const buttonRef = useRef<HTMLButtonElement>(null)\n const { buttonProps } = useButton(removeButtonProps, buttonRef)\n\n return (\n <Chip\n {...rowProps}\n // Labelled by its `aria-label`. react-aria adds a description id it never renders here.\n aria-labelledby={undefined}\n className={classNames(chipVariant, { active: state.selectionManager.isSelected(item.key) })}\n component=\"div\"\n disabled={disabled}\n ref={ref}\n size={size}\n >\n <div {...gridCellProps} style={{ display: 'contents' }}>\n {item.rendered}\n {allowsRemoving && (\n // react-aria's generic ButtonHTMLAttributes typing includes a legacy `color?: string`\n // attribute that's wider than CloseButton's `color?: ContextColor` prop; buttonProps\n // never actually sets it, so it's safe to omit from the spread's type.\n <CloseButton {...(buttonProps as Omit<typeof buttonProps, 'color'>)} ref={buttonRef} />\n )}\n </div>\n </Chip>\n )\n}\n","import React, {\n forwardRef,\n HTMLAttributes,\n KeyboardEvent,\n ReactNode,\n useMemo,\n useRef,\n useState\n} from 'react'\nimport classNames from 'classnames'\nimport { useTextField } from 'react-aria'\nimport { Item, Key, useListState } from 'react-stately'\n\nimport {\n useControllableState,\n useForkedRef,\n useFormField,\n useHeldBack,\n useIsomorphicLayoutEffect\n} from '../../hooks'\nimport { validationClassName } from '../../utils/validationClassName'\nimport { renderFormField } from '../form-field/renderFormField'\nimport { ChipList, ChipItem } from './ChipList'\nimport { isRTL } from '../../utils/direction'\n\n// `allowDuplicates` means two tags can share a value, but react-stately's collection needs a\n// unique key per item — keying on the value alone collapses duplicates into the same node, so\n// selecting or removing one affects all of them. Key on (value, occurrence-within-the-array)\n// instead, recomputed fresh from `tags` on every call rather than cached, so it stays correct\n// whether the array changed via our own add/remove or via an externally-controlled `value` prop.\nconst buildTagIds = (list: string[]): string[] => {\n const seen = new Map<string, number>()\n return list.map((tag) => {\n const occurrence = seen.get(tag) ?? 0\n seen.set(tag, occurrence + 1)\n return occurrence === 0 ? tag : `${tag}\\u0000${occurrence}`\n })\n}\n\nexport interface ChipInputProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'defaultValue'\n> {\n /**\n * An accessible label for the chip group, used when there's no visible `<label>`.\n */\n 'aria-label'?: string\n /**\n * Identifies a visible `<label>` element for the chip group.\n */\n 'aria-labelledby'?: string\n /**\n * Allow the same value to be added more than once. Defaults to `false`.\n */\n allowDuplicates?: boolean\n /**\n * Space-separated chassis-css chip modifier classes (e.g. `\"primary smooth\"`) applied to every\n * chip. Defaults to `\"default\"`.\n */\n chipVariant?: string\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * The initial set of chip values (uncontrolled).\n */\n defaultValue?: string[]\n /**\n * Prevents new chips from being added and makes existing chips non-interactive.\n */\n disabled?: boolean\n /**\n * A description for the field, rendered below the chips.\n */\n help?: ReactNode\n /**\n * `id` forwarded to the text input — useful for pairing with a `<label for>`.\n */\n id?: string\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 chips 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 text input.\n */\n label?: ReactNode\n /**\n * Maximum number of chips allowed. Omit for no limit.\n */\n maxChips?: number\n /**\n * `name` of an auto-created hidden input per chip, kept in sync with the values, for native\n * form submission. Omit to skip creating them.\n */\n name?: string\n /**\n * Callback fired whenever a chip is added or removed.\n */\n onChange?: (values: string[]) => void\n /**\n * Placeholder shown in the input when empty.\n */\n placeholder?: string\n /**\n * Toggle the required state for the component. A required chip input with no chips holds its\n * form back from submitting, and its text input takes focus: text typed there and not added as\n * a chip is not a value.\n */\n required?: boolean\n /**\n * Character that creates a new chip when typed, or pasted text is split on. Set to `null` to\n * disable. Defaults to `,`.\n */\n separator?: string | null\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 chips when `valid` is set.\n */\n validFeedback?: ReactNode\n /**\n * The set of chip values (controlled).\n */\n value?: string[]\n}\n\n// See `needsChip`.\nconst NEEDS_CHIP_MESSAGE = 'Add a chip.'\n\nexport const ChipInput = forwardRef<HTMLDivElement, ChipInputProps>(\n (\n {\n allowDuplicates = false,\n 'aria-describedby': ariaDescribedBy,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n chipVariant = 'default',\n className,\n defaultValue,\n disabled,\n help,\n id,\n invalid: invalidProp,\n invalidFeedback,\n label,\n maxChips,\n name,\n onChange,\n placeholder,\n required,\n separator = ',',\n size,\n valid: validProp,\n validFeedback,\n value,\n ...rest\n }: ChipInputProps,\n ref\n ): ReactNode => {\n const [tags, updateTags] = useControllableState<string[]>(value, defaultValue ?? [], onChange)\n\n // The one memoized computation of `tags`' ids — `removeTags`, `items`, and `focusLastChip`\n // below all used to independently recompute this same array from scratch (fresh on every\n // render, not just when `tags` actually changed); they now all read this instead.\n const ids = useMemo(() => buildTagIds(tags), [tags])\n\n // Shared by `commitInput` and the paste handler's loop: whether `raw` (already trimmed) is\n // addable to `list` given `allowDuplicates`. `maxChips` is deliberately not part of this\n // predicate — the paste loop needs to `break` (stop entirely) on hitting the limit, while an\n // empty/duplicate value should just be skipped and the loop should keep going.\n const isAddableValue = (list: string[], trimmed: string) =>\n trimmed !== '' && (allowDuplicates || !list.includes(trimmed))\n\n // Takes the typed text, as a paste takes each part: an empty or duplicate value is dropped,\n // and text past `maxChips` stays in the input.\n const commitInput = () => {\n if (maxChips != null && tags.length >= maxChips) return\n const trimmed = inputValue.trim()\n if (isAddableValue(tags, trimmed)) updateTags([...tags, trimmed])\n setInputValue('')\n }\n\n const removeTags = (keys: Iterable<Key>) => {\n const toRemove = new Set(keys)\n updateTags(tags.filter((_tag, index) => !toRemove.has(ids[index]!)))\n }\n\n const items = useMemo<ChipItem[]>(\n () => tags.map((tag, index) => ({ id: ids[index]!, value: tag })),\n [tags, ids]\n )\n\n const listState = useListState<ChipItem>({\n children: (item: ChipItem) => (\n <Item key={item.id} textValue={item.value}>\n {item.value}\n </Item>\n ),\n disabledKeys: disabled ? items.map((item) => item.id) : undefined,\n items,\n selectionMode: 'multiple'\n })\n\n const groupRef = useRef<HTMLDivElement>(null)\n const containerRef = useRef<HTMLDivElement>(null)\n const forkedRef = useForkedRef(ref, containerRef)\n const inputRef = useRef<HTMLInputElement>(null)\n const [inputValue, setInputValue] = useState('')\n\n // Required asks for one chip at least, which HTML has no attribute for. The text input is\n // the field's one input a form validates (the chips' own are `type=\"hidden\"`, which is barred\n // from it: FORMS.md, gotcha 9), so it carries the native `required` while there are no chips,\n // as each checkbox of a required `CheckboxGroup` does while none is checked. That alone would\n // let text through that was typed and never added: the input isn't empty, and nothing is\n // submitted under `name`. A custom validity covers it: with no chips the input is invalid\n // whatever its text. The message is never shown: react-aria cancels the input's `invalid`\n // event, which keeps a browser's bubble away, and focuses the input instead. A disabled input\n // isn't validated; the field has no read-only state to leave out.\n //\n // Set after each render, as the input may be a new one, in a layout effect declared before\n // `useHeldBack`, whose own layout effect reads the validity after each render, and for an\n // empty input too: the hook's `input` listener reads\n // it before the render a keystroke causes, where the first character typed would have made\n // an empty input valid.\n const needsChip = Boolean(required) && tags.length === 0\n useIsomorphicLayoutEffect(() => {\n inputRef.current?.setCustomValidity(needsChip ? NEEDS_CHIP_MESSAGE : '')\n })\n\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 const { invalid, valid } = useHeldBack(inputRef, { invalid: invalidProp, valid: validProp })\n\n const focusLastChip = (extend: boolean) => {\n if (tags.length === 0) return\n const lastKey = ids[ids.length - 1]!\n if (extend) {\n listState.selectionManager.extendSelection(lastKey)\n } else {\n listState.selectionManager.replaceSelection(lastKey)\n }\n const rows = groupRef.current?.querySelectorAll<HTMLElement>('[role=\"row\"]')\n rows?.[rows.length - 1]?.focus()\n }\n\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (disabled) return\n\n if (separator && event.key === separator) {\n event.preventDefault()\n commitInput()\n return\n }\n\n switch (event.key) {\n case 'Enter': {\n event.preventDefault()\n commitInput()\n break\n }\n case 'Backspace':\n case 'Delete': {\n if (inputValue === '') {\n event.preventDefault()\n focusLastChip(false)\n }\n break\n }\n // Stepping backwards out of the text field and into the chips is a *visual* movement, so\n // the key that does it mirrors under RTL — ArrowLeft in an LTR field, ArrowRight in an RTL\n // one, matching where the chips actually sit relative to the caret. The caret check is\n // unchanged: `selectionStart === 0` is the start of the text in either direction.\n case 'ArrowLeft':\n case 'ArrowRight': {\n const input = inputRef.current\n if (!input) break\n const movesBackward = (event.key === 'ArrowLeft') !== isRTL(input)\n if (movesBackward && input.selectionStart === 0 && input.selectionEnd === 0) {\n event.preventDefault()\n focusLastChip(event.shiftKey)\n }\n break\n }\n case 'Escape': {\n setInputValue('')\n listState.selectionManager.clearSelection()\n inputRef.current?.blur()\n break\n }\n default:\n break\n }\n }\n\n const handlePaste = (event: React.ClipboardEvent<HTMLInputElement>) => {\n if (disabled || !separator) return\n const pasted = event.clipboardData.getData('text')\n if (!pasted.includes(separator)) return\n\n event.preventDefault()\n const parts = pasted.split(separator)\n\n // Accumulate locally rather than committing per part: each commit reads `tags` from this\n // render's closure, so several in a row within one event would all start from the same\n // stale array instead of building on each other.\n let next = tags\n // `i` tracks how far the loop got, so a `maxChips` cutoff can leave everything from that\n // point on (not just the final unsplit part) in the input instead of silently dropping it.\n let i = 0\n for (; i < parts.length - 1; i++) {\n if (maxChips != null && next.length >= maxChips) break\n const trimmed = parts[i]!.trim()\n if (!isAddableValue(next, trimmed)) continue\n next = [...next, trimmed]\n }\n if (next !== tags) updateTags(next)\n setInputValue(parts.slice(i).join(separator))\n }\n\n const { describedBy, feedbackId, helpId, inputId, labelId, labelledBy } = useFormField({\n ariaDescribedBy,\n ariaLabelledBy,\n help,\n id,\n invalid,\n invalidFeedback,\n label,\n valid,\n validFeedback\n })\n\n const { inputProps } = useTextField(\n {\n 'aria-describedby': describedBy,\n // The merged `labelledBy`, not the raw props: a wrapping `FloatingInput` names the field\n // too, and react-aria puts an `aria-label` given beside `aria-labelledby` in front of it.\n 'aria-label': ariaLabel ?? (labelledBy ? undefined : 'Add value'),\n 'aria-labelledby': labelledBy,\n id: inputId,\n isDisabled: disabled,\n isInvalid: invalid,\n isRequired: required,\n onChange: setInputValue,\n onFocus: () => listState.selectionManager.clearSelection(),\n onKeyDown: handleKeyDown,\n placeholder,\n value: inputValue\n },\n inputRef\n )\n\n return renderFormField({\n children: (\n <div\n className={classNames(\n 'form-input',\n 'chip-input',\n size,\n { disabled },\n validationClassName(invalid, valid),\n className\n )}\n {...rest}\n ref={forkedRef}\n >\n <ChipList\n chipVariant={chipVariant}\n disabled={disabled}\n groupRef={groupRef}\n props={{\n 'aria-label': ariaLabel,\n 'aria-labelledby': labelledBy,\n onRemove: disabled ? undefined : removeTags\n }}\n size={size}\n state={listState}\n />\n {/* `aria-describedby` after the spread: see `TextInput`. */}\n <input\n {...inputProps}\n aria-describedby={describedBy}\n // With no chips the native `required` says it; with chips react-aria's\n // `aria-required` still does, of a field that stays required.\n aria-required={needsChip ? undefined : inputProps['aria-required']}\n className=\"ghost-input\"\n onPaste={handlePaste}\n ref={inputRef}\n required={needsChip || undefined}\n />\n {name &&\n items.map((item) => (\n <input\n disabled={disabled}\n key={item.id}\n name={name}\n type=\"hidden\"\n value={item.value}\n />\n ))}\n </div>\n ),\n help,\n ids: { feedback: feedbackId, help: helpId, input: inputId, label: labelId },\n invalid,\n invalidFeedback,\n label,\n valid,\n validFeedback\n })\n }\n)\n\nChipInput.displayName = 'ChipInput'\n"],"mappings":"A,0vBAwBA,MAAaW,IAAY,CACvB,cACA,WACA,WACA,QACA,OACA,WACmB,CACnB,GAAM,CAAE,aAAcC,EAAYC,EAAOC,EAAOC,CAAQ,EAKxD,MACE,kBAAA,cAAC,MAAD,CACE,GAAIC,EACJ,mBAAkB,IAAA,GAClB,uBACEA,EAAU,OAAS,OAASA,EAAU,wBAA0B,IAAA,GAElE,MAAO,CAAE,QAAS,UAAW,EAC7B,IAAKD,CAYF,EAVF,CAAC,GAAGD,EAAM,UAAU,CAAC,CAAC,IAAK,GAC1B,kBAAA,cAACG,EAAD,CACe,cACH,WACJ,OACN,IAAKC,EAAK,IACJ,OACC,OACR,CAAA,CACF,CACE,CAET,EAgBMD,GAAW,CAAE,cAAa,WAAU,OAAM,OAAM,WAA0B,CAC9E,IAAME,EAAMC,EAAuB,IAAI,EACjC,CAAE,WAAU,gBAAe,oBAAmB,kBAAmBC,EACrE,CAAE,MAAK,EACPP,EACAK,CACF,EACMG,EAAYF,EAA0B,IAAI,EAC1C,CAAE,eAAgBG,EAAUC,EAAmBF,CAAS,EAE9D,MACE,kBAAA,cAACd,EAAD,CACE,GAAIiB,EAEJ,kBAAiB,IAAA,GACjB,UAAWf,EAAWgB,EAAa,CAAE,OAAQZ,EA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AAeM,EAAU,iBAAiB,eAAe,EACzD,UAAWc,GACX,eACA,MAAOrB,CACT,EACAa,CACF,EAEA,OAAOjE,EAAgB,CACrB,SACE,kBAAA,cAAC,MAAD,CACE,UAAWM,EACT,aACA,aACAgF,EACA,CAAE,UAAS,EACXnF,EAAoBkF,EAASE,CAAK,EAClCC,CACF,EACA,GAAIlD,GACJ,IAAK0B,CAoCF,EAlCH,kBAAA,cAACzD,GAAD,CACe,cACH,WACA,WACV,MAAO,CACL,aAAc2B,EACd,kBAAmBiD,EACnB,SAAUrB,EAAW,IAAA,GAAYR,EACnC,EACM,OACN,MAAOK,CACR,CAAA,EAED,kBAAA,cAAC,QAAD,CACE,GAAI8B,EACJ,mBAAkBP,EAGlB,gBAAef,EAAY,IAAA,GAAYsB,EAAW,iBAClD,UAAU,cACV,QAASZ,GACT,IAAKZ,EACL,SAAUE,GAAa,IAAA,EACxB,CAAA,EACAuB,GACChC,EAAM,IAAK,GACT,kBAAA,cAAC,QAAD,CACY,WACV,IAAK5C,EAAK,GACJ,OACN,KAAK,SACL,MAAOA,EAAK,KACb,CAAA,CACF,CACA,EAEP,OACA,IAAK,CAAE,SAAU6E,EAAY,KAAMC,GAAQ,MAAOR,EAAS,MAAOS,EAAQ,EAC1E,UACA,kBACA,QACA,QACA,eACF,CAAC,CACH,CACF,EAEA,EAAU,YAAc,Y"}
|
|
@@ -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,size:m,valid:h,validFeedback:g,..._},v)=>{let y=s(null),b=e(v,y),{invalid:x,valid:S}=n(y,{invalid:d,valid:h}),{describedBy:C,feedbackId:w,helpId:T,inputId:E}=t({ariaDescribedBy:_[`aria-describedby`],help:l,id:u,invalid:x,invalidFeedback:f,valid:S,validFeedback:g}),D=c(`form-input`,m,i(x,S),o);return r({children:/* @__PURE__ */ a.createElement(`input`,{..._,"aria-describedby":C,"aria-invalid":x||void 0,className:D,id:E,ref:b,type:`color`}),help:l,ids:{feedback:w,help:T,input:E},invalid:x,invalidFeedback:f,label:p,valid:S,validFeedback:g})});l.displayName=`ColorInput`;export{l as t};
|
|
2
|
-
//# sourceMappingURL=color-input-C4zMWlvm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"color-input-C4zMWlvm.js","names":["useForkedRef","useHeldBack","renderFormField","validationClassName","React","classNames","ColorInput","forwardRef","invalidProp","validProp","rest","inputRef","useRef","forkedRef","ref","useFormField","_className","size","invalid","valid","className","describedBy","inputId","feedbackId","helpId"],"sources":["../../src/components/color-input/ColorInput.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 ColorInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * The value of the input, uncontrolled.\n */\n defaultValue?: string\n /**\n * Toggle the disabled state for the component.\n */\n disabled?: boolean\n /**\n * A description for the field, rendered below the 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 input when `invalid` is set.\n */\n invalidFeedback?: ReactNode\n /**\n * The field's caption, rendered as a `FormLabel` associated with this input.\n */\n label?: ReactNode\n /**\n * Method called immediately after the `value` prop changes.\n */\n onChange?: ChangeEventHandler<HTMLInputElement>\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 input when `valid` is set.\n */\n validFeedback?: ReactNode\n /**\n * The `value` attribute of component.\n *\n * @controllable onChange\n * */\n value?: string\n}\n\nexport const ColorInput = forwardRef<HTMLInputElement, ColorInputProps>(\n (\n {\n className,\n help,\n id,\n invalid: invalidProp,\n invalidFeedback,\n label,\n size,\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 color 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(\n 'form-input',\n size,\n validationClassName(invalid, valid),\n className\n )\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=\"color\"\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\nColorInput.displayName = 'ColorInput'\n"],"mappings":"A,4VAkEA,MAAaM,EAAaC,GAEtB,CACE,YACA,OACA,KACA,QAASC,EACT,kBACA,QACA,OACA,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,EACjB,aACAY,EACAd,EAAoBe,EAASC,CAAK,EAClCC,CACF,EAEA,OAAOlB,EAAgB,CACrB,SACE,kBAAA,cAAC,QAAD,CACE,GAAIQ,EACJ,mBAAkBW,EAClB,eAAcH,GAAW,IAAA,GACzB,UAAWF,EACX,GAAIM,EACJ,IAAKT,EACL,KAAK,OACN,CAAA,EAEH,OACA,IAAK,CAAE,SAAUU,EAAY,KAAMC,EAAQ,MAAOF,CAAQ,EAC1D,UACA,kBACA,QACA,QACA,eACF,CAAC,CACH,CACF,EAEA,EAAW,YAAc,a"}
|