@chassis-ui/react 0.4.1 → 0.5.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 +7 -6
- package/dist/accordion.d.ts +1 -1
- package/dist/accordion.js +1 -1
- package/dist/alert.d.ts +1 -1
- package/dist/alert.js +1 -1
- package/dist/autocomplete.d.ts +1 -1
- package/dist/autocomplete.js +1 -1
- package/dist/avatar.d.ts +1 -1
- package/dist/avatar.js +1 -1
- package/dist/badge.d.ts +1 -1
- package/dist/badge.js +1 -1
- package/dist/breadcrumb.d.ts +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/button-group.d.ts +1 -1
- package/dist/button-group.js +1 -1
- package/dist/button.d.ts +2 -2
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +1 -1
- package/dist/calendar.js +1 -1
- package/dist/card.d.ts +1 -1
- package/dist/card.js +1 -1
- package/dist/carousel.d.ts +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.d.ts +1 -1
- package/dist/chip-input.js +1 -1
- package/dist/chip.d.ts +1 -1
- package/dist/chip.js +1 -1
- package/dist/chunks/{Button-BuZ_GOHS.d.ts → Button-DblYVwl-.d.ts} +4 -2
- package/dist/chunks/Button-ZU-x1uN_.js +2 -0
- package/dist/chunks/Button-ZU-x1uN_.js.map +1 -0
- package/dist/chunks/Chip-C7QlFCvx.js +2 -0
- package/dist/chunks/Chip-C7QlFCvx.js.map +1 -0
- package/dist/chunks/CloseButton-BPUI5iGX.js +2 -0
- package/dist/chunks/CloseButton-BPUI5iGX.js.map +1 -0
- package/dist/chunks/ComboboxListBox-Db0rSM3w.js +2 -0
- package/dist/chunks/ComboboxListBox-Db0rSM3w.js.map +1 -0
- package/dist/chunks/DateField-4cdcwt0v.js +2 -0
- package/dist/chunks/DateField-4cdcwt0v.js.map +1 -0
- package/dist/chunks/FormHelp-B1eSoack.js +2 -0
- package/dist/chunks/FormHelp-B1eSoack.js.map +1 -0
- package/dist/chunks/FormLabel-CpzWYh6U.js +2 -0
- package/dist/chunks/FormLabel-CpzWYh6U.js.map +1 -0
- package/dist/chunks/{Icon-DLB1f88W.js → Icon-Dk5_q79o.js} +2 -2
- package/dist/chunks/Icon-Dk5_q79o.js.map +1 -0
- package/dist/chunks/Link-DE8NSAXJ.js +2 -0
- package/dist/chunks/Link-DE8NSAXJ.js.map +1 -0
- package/dist/chunks/Menu-264aGoBR.js +2 -0
- package/dist/chunks/Menu-264aGoBR.js.map +1 -0
- package/dist/chunks/{Menu-QeYOzrUL.d.ts → Menu-CCYshRuL.d.ts} +3 -2
- package/dist/chunks/MenuToggle-DcPEh55c.js +2 -0
- package/dist/chunks/MenuToggle-DcPEh55c.js.map +1 -0
- package/dist/chunks/Portal-BTDylxAi.js +2 -0
- package/dist/chunks/Portal-BTDylxAi.js.map +1 -0
- package/dist/chunks/RangeCalendar-mM3OeTlU.js +2 -0
- package/dist/chunks/RangeCalendar-mM3OeTlU.js.map +1 -0
- package/dist/chunks/VisuallyHidden-CGv-mBuQ.js +2 -0
- package/dist/chunks/VisuallyHidden-CGv-mBuQ.js.map +1 -0
- package/dist/chunks/accordion-BZlX2uk8.js +2 -0
- package/dist/chunks/accordion-BZlX2uk8.js.map +1 -0
- package/dist/chunks/alert-DSLg5MBb.js +2 -0
- package/dist/chunks/alert-DSLg5MBb.js.map +1 -0
- package/dist/chunks/autocomplete-99usnvgh.js +2 -0
- package/dist/chunks/autocomplete-99usnvgh.js.map +1 -0
- package/dist/chunks/avatar-BQBbcnk6.js +2 -0
- package/dist/chunks/avatar-BQBbcnk6.js.map +1 -0
- package/dist/chunks/{badge-D2oztCvs.js → badge-Ths1Qn1a.js} +2 -2
- package/dist/chunks/badge-Ths1Qn1a.js.map +1 -0
- package/dist/chunks/breadcrumb-BTiQikk-.js +2 -0
- package/dist/chunks/breadcrumb-BTiQikk-.js.map +1 -0
- package/dist/chunks/breakpoints-CGk8szzR.js.map +1 -1
- package/dist/chunks/button-group-CefkGeYL.js +2 -0
- package/dist/chunks/button-group-CefkGeYL.js.map +1 -0
- package/dist/chunks/card-CEQgHIaL.js +2 -0
- package/dist/chunks/card-CEQgHIaL.js.map +1 -0
- package/dist/chunks/carousel-DC-UGc6W.js +2 -0
- package/dist/chunks/carousel-DC-UGc6W.js.map +1 -0
- package/dist/chunks/checkbox-ko6CdtoT.js +2 -0
- package/dist/chunks/checkbox-ko6CdtoT.js.map +1 -0
- package/dist/chunks/chip-input-CugY8EOc.js +2 -0
- package/dist/chunks/chip-input-CugY8EOc.js.map +1 -0
- package/dist/chunks/{collapse--Go2Y73B.js → collapse-CBi3RWTf.js} +2 -2
- package/dist/chunks/collapse-CBi3RWTf.js.map +1 -0
- package/dist/chunks/color-input-C4zMWlvm.js +2 -0
- package/dist/chunks/color-input-C4zMWlvm.js.map +1 -0
- package/dist/chunks/colorClassNames-YzGWu6qm.js +2 -0
- package/dist/chunks/colorClassNames-YzGWu6qm.js.map +1 -0
- package/dist/chunks/combobox-BQh3uJWB.js +2 -0
- package/dist/chunks/combobox-BQh3uJWB.js.map +1 -0
- package/dist/chunks/context-DCg95BgR.js +2 -0
- package/dist/chunks/context-DCg95BgR.js.map +1 -0
- package/dist/chunks/context-HDVxTNPi.js +2 -0
- package/dist/chunks/context-HDVxTNPi.js.map +1 -0
- package/dist/chunks/context-menu-8KIuH4cJ.js +2 -0
- package/dist/chunks/context-menu-8KIuH4cJ.js.map +1 -0
- package/dist/chunks/datagrid-n9vFeXN1.js +2 -0
- package/dist/chunks/datagrid-n9vFeXN1.js.map +1 -0
- package/dist/chunks/datepicker-DqztYJD6.js +2 -0
- package/dist/chunks/datepicker-DqztYJD6.js.map +1 -0
- package/dist/chunks/{dialogTransition-i9vw0i2Z.js → dialogTransition-C8fYTsSa.js} +2 -2
- package/dist/chunks/dialogTransition-C8fYTsSa.js.map +1 -0
- package/dist/chunks/direction-LN6uwsK5.js.map +1 -1
- package/dist/chunks/divider-C1-NoKMV.js +2 -0
- package/dist/chunks/divider-C1-NoKMV.js.map +1 -0
- package/dist/chunks/drawer-CRv9jmbp.js +2 -0
- package/dist/chunks/drawer-CRv9jmbp.js.map +1 -0
- package/dist/chunks/file-input-D_Gl1h-T.js +2 -0
- package/dist/chunks/file-input-D_Gl1h-T.js.map +1 -0
- package/dist/chunks/{flex-B52oLCCC.js → flex-C2jV5LyV.js} +2 -2
- package/dist/chunks/flex-C2jV5LyV.js.map +1 -0
- package/dist/chunks/floating-input-D4gWFfOU.js +2 -0
- package/dist/chunks/floating-input-D4gWFfOU.js.map +1 -0
- package/dist/chunks/focus-ring-Bs80iIBN.js +2 -0
- package/dist/chunks/focus-ring-Bs80iIBN.js.map +1 -0
- package/dist/chunks/focusRedirect-CrBl4p_n.js +2 -0
- package/dist/chunks/focusRedirect-CrBl4p_n.js.map +1 -0
- package/dist/chunks/form-CPS2eNw1.js +2 -0
- package/dist/chunks/form-CPS2eNw1.js.map +1 -0
- package/dist/chunks/{form-field-CNPGTMiW.js → form-field-Bcx96ezd.js} +2 -2
- package/dist/chunks/form-field-Bcx96ezd.js.map +1 -0
- package/dist/chunks/grid-CkdPftit.js +2 -0
- package/dist/chunks/grid-CkdPftit.js.map +1 -0
- package/dist/chunks/icon-CVD3rTr-.js +2 -0
- package/dist/chunks/icon-CVD3rTr-.js.map +1 -0
- package/dist/chunks/iconSlot-DU_WcSL_.js +2 -0
- package/dist/chunks/iconSlot-DU_WcSL_.js.map +1 -0
- package/dist/chunks/{index-91YA-jkp.d.ts → index-3JVLrDHv.d.ts} +11 -3
- package/dist/chunks/{index-DMbdEm__.d.ts → index-5mW1Y9Lm.d.ts} +7 -4
- package/dist/chunks/{index-Cc4SSslb.d.ts → index-5qsV1-cc.d.ts} +3 -3
- package/dist/chunks/{index-CYvVmTPR.d.ts → index-6PnrAJmb.d.ts} +4 -4
- package/dist/chunks/{index-BA-raEMm.d.ts → index-B5f6haU-.d.ts} +2 -2
- package/dist/chunks/{index-4cKG9KWB.d.ts → index-B8OIYfGw.d.ts} +2 -2
- package/dist/chunks/{index-CjT_4IZx.d.ts → index-BAvt_oPe.d.ts} +14 -5
- package/dist/chunks/{index-DtbUXxjz.d.ts → index-BB8UNxnM.d.ts} +2 -2
- package/dist/chunks/{index-aRdgpeRb.d.ts → index-BEAZrhyV.d.ts} +2 -2
- package/dist/chunks/{index-BOx8v-oT.d.ts → index-BISMaKaC.d.ts} +14 -2
- package/dist/chunks/{index-DtvHH_Mb.d.ts → index-BOroLDDZ.d.ts} +2 -2
- package/dist/chunks/{index-C4Dks__B.d.ts → index-BZpHSGlk.d.ts} +2 -2
- package/dist/chunks/{index-C9gzVqwX.d.ts → index-BbZzaApz.d.ts} +2 -2
- package/dist/chunks/{index-DAoPg59I.d.ts → index-Bca_HQWF.d.ts} +7 -3
- package/dist/chunks/{index-B0-8n-Gs.d.ts → index-Bl-_sC4y.d.ts} +12 -4
- package/dist/chunks/{index-BSLneLYu.d.ts → index-BxJ6Vrhm.d.ts} +2 -2
- package/dist/chunks/{index-CTpwB1yR.d.ts → index-BxrIOrAc.d.ts} +11 -6
- package/dist/chunks/{index-DHcztR18.d.ts → index-ByBbC4Jh.d.ts} +3 -3
- package/dist/chunks/{index-DHGgezXU.d.ts → index-C-IrFdKe.d.ts} +2 -2
- package/dist/chunks/{index-B8uaSJA9.d.ts → index-C0g8NSXY.d.ts} +13 -4
- package/dist/chunks/{index-CFnQubsV.d.ts → index-C1RKm3hQ.d.ts} +5 -3
- package/dist/chunks/{index-BxROljJI.d.ts → index-C3qqMzs5.d.ts} +2 -2
- package/dist/chunks/{index-Dcc_W6Kv.d.ts → index-C6F3DQCd.d.ts} +2 -2
- package/dist/chunks/{index-x0vZRyoU.d.ts → index-CEPAXElM.d.ts} +4 -3
- package/dist/chunks/{index-DaHQdNul.d.ts → index-COVY45gK.d.ts} +2 -2
- package/dist/chunks/{index-DJfga0Ce.d.ts → index-COq1jJ6Y.d.ts} +2 -2
- package/dist/chunks/{index-HrKN6s8z.d.ts → index-CSRGr7pU.d.ts} +2 -2
- package/dist/chunks/{index-B1kw0jzM.d.ts → index-CTNqEMug.d.ts} +6 -3
- package/dist/chunks/{index-6uob77s9.d.ts → index-CW94lG-e.d.ts} +7 -4
- package/dist/chunks/{index-Ddd7iWfm.d.ts → index-CY-A60p6.d.ts} +2 -2
- package/dist/chunks/{index-lSPcxiii.d.ts → index-CbcFEGCh.d.ts} +5 -3
- package/dist/chunks/{index-9rQeMqVI.d.ts → index-Ce0f-bDM.d.ts} +2 -2
- package/dist/chunks/{index-Ci7AEgEc.d.ts → index-Cf3gHDjh.d.ts} +2 -2
- package/dist/chunks/{index-BVGGIaPX.d.ts → index-Cm3rPbI1.d.ts} +10 -5
- package/dist/chunks/{index-DPCwFiJL.d.ts → index-CmljNQ8F.d.ts} +2 -2
- package/dist/chunks/{index-DQImhbhy.d.ts → index-Cpifcw5a.d.ts} +2 -2
- package/dist/chunks/{index-B_UzbGOa.d.ts → index-Ctf5hLue.d.ts} +3 -3
- package/dist/chunks/{index-DM01FX3a.d.ts → index-D0Dhs7YI.d.ts} +18 -6
- package/dist/chunks/{index-BAsbRx5n.d.ts → index-D5KJRfMg.d.ts} +2 -2
- package/dist/chunks/{index-Bz8MDq0H.d.ts → index-DD6Z5NW-.d.ts} +7 -4
- package/dist/chunks/{index-Dfg4Ftb8.d.ts → index-DFKBJxqA.d.ts} +7 -4
- package/dist/chunks/{index-BMkbJVHg.d.ts → index-DGGyvlEQ.d.ts} +3 -3
- package/dist/chunks/{index-YJ9QdBuq.d.ts → index-DOxVxbb9.d.ts} +6 -5
- package/dist/chunks/{index-CxjNw4ss.d.ts → index-DVK16_FU.d.ts} +2 -2
- package/dist/chunks/{index-DHOG_rjE.d.ts → index-DVfH_2Ma.d.ts} +7 -4
- package/dist/chunks/{index-0jbACjYQ.d.ts → index-DXBkVdWc.d.ts} +2 -2
- package/dist/chunks/{index-CsARGAzD.d.ts → index-Davd7Cue.d.ts} +10 -5
- package/dist/chunks/{index-Bi8FFadV.d.ts → index-Dc50UjJy.d.ts} +13 -4
- package/dist/chunks/{index-BF3OWUVc.d.ts → index-Dci43Xhl.d.ts} +3 -3
- package/dist/chunks/{index-B2K-O9kl.d.ts → index-DdFipHYL.d.ts} +5 -4
- package/dist/chunks/{index-Du9fBqkT.d.ts → index-DmmLEHVo.d.ts} +2 -2
- package/dist/chunks/{index-Dzga1f4w.d.ts → index-DsU3M0oP.d.ts} +2 -2
- package/dist/chunks/{index-DP5xugE-.d.ts → index-Es9I0fIS.d.ts} +3 -3
- package/dist/chunks/{index-CqZ68Z8R.d.ts → index-HNUhTj5e.d.ts} +25 -6
- package/dist/chunks/{index-CCXJXToc.d.ts → index-OnB4_h6x.d.ts} +7 -4
- package/dist/chunks/{index-CftERHnE.d.ts → index-QeI-KSng.d.ts} +3 -2
- package/dist/chunks/{index-BLS1jhSJ.d.ts → index-RyE80_VH.d.ts} +2 -2
- package/dist/chunks/{index-CIwzgZJi.d.ts → index-UjmJQRaG.d.ts} +2 -2
- package/dist/chunks/{index-B19ZH3fm.d.ts → index-YzIZhXZ1.d.ts} +2 -2
- package/dist/chunks/{index-CHQR8x8_.d.ts → index-Z_5ArZpE.d.ts} +4 -2
- package/dist/chunks/{index-BNf0jIIL.d.ts → index-doVyX-4i.d.ts} +7 -4
- package/dist/chunks/{index-NGgDkhyn.d.ts → index-mLtlx-d9.d.ts} +6 -3
- package/dist/chunks/{index-g74gO0pc.d.ts → index-sT0Hnr_n.d.ts} +12 -10
- package/dist/chunks/{index-Bkj17NEQ.d.ts → index-t3k_T3Dv.d.ts} +2 -2
- package/dist/chunks/{index-BfEJYF4c.d.ts → index-yVsGuikp.d.ts} +2 -2
- package/dist/chunks/input-adorn-DV9tuWXh.js +2 -0
- package/dist/chunks/input-adorn-DV9tuWXh.js.map +1 -0
- package/dist/chunks/input-group-YB_zoKud.js +2 -0
- package/dist/chunks/input-group-YB_zoKud.js.map +1 -0
- package/dist/chunks/insideEvents-CWcNrMu7.js +2 -0
- package/dist/chunks/insideEvents-CWcNrMu7.js.map +1 -0
- package/dist/chunks/lazyElement-tfMG21pZ.js.map +1 -1
- package/dist/chunks/list-BPBZR66Y.js +2 -0
- package/dist/chunks/list-BPBZR66Y.js.map +1 -0
- package/dist/chunks/menu-DEu-Nbv8.js +2 -0
- package/dist/chunks/menu-DEu-Nbv8.js.map +1 -0
- package/dist/chunks/modal-CHvsDTyl.js +2 -0
- package/dist/chunks/modal-CHvsDTyl.js.map +1 -0
- package/dist/chunks/nav-B4U_Hqs7.js +2 -0
- package/dist/chunks/nav-B4U_Hqs7.js.map +1 -0
- package/dist/chunks/nav-overflow-DpX_lRYf.js +2 -0
- package/dist/chunks/nav-overflow-DpX_lRYf.js.map +1 -0
- package/dist/chunks/navOverflow-C_QJmkPM.js +2 -0
- package/dist/chunks/navOverflow-C_QJmkPM.js.map +1 -0
- package/dist/chunks/{navVariant-DeGTk9B7.js → navVariant-D4wiKS8I.js} +2 -2
- package/dist/chunks/navVariant-D4wiKS8I.js.map +1 -0
- package/dist/chunks/navbar-C7dO0YRs.js +2 -0
- package/dist/chunks/navbar-C7dO0YRs.js.map +1 -0
- package/dist/chunks/notification-oIrUtDhl.js +2 -0
- package/dist/chunks/notification-oIrUtDhl.js.map +1 -0
- package/dist/chunks/number-field-ChPTSBwI.js +2 -0
- package/dist/chunks/number-field-ChPTSBwI.js.map +1 -0
- package/dist/chunks/otp-input-DUtCMg8P.js +2 -0
- package/dist/chunks/otp-input-DUtCMg8P.js.map +1 -0
- package/dist/chunks/{overlayPlacement-BtS90IVf.js → overlayPlacement-Q6bcbXA5.js} +2 -2
- package/dist/chunks/overlayPlacement-Q6bcbXA5.js.map +1 -0
- package/dist/chunks/overlayStack-BXtTGCRm.js +2 -0
- package/dist/chunks/overlayStack-BXtTGCRm.js.map +1 -0
- package/dist/chunks/pagination-Dvz8lccd.js +2 -0
- package/dist/chunks/pagination-Dvz8lccd.js.map +1 -0
- package/dist/chunks/{password-strength-DDK8pHRq.js → password-strength-Qg5GHBmu.js} +2 -2
- package/dist/chunks/password-strength-Qg5GHBmu.js.map +1 -0
- package/dist/chunks/placeholder-SPoVRkKE.js +2 -0
- package/dist/chunks/placeholder-SPoVRkKE.js.map +1 -0
- package/dist/chunks/polymorphic-CZIFszAy.js +2 -0
- package/dist/chunks/polymorphic-CZIFszAy.js.map +1 -0
- package/dist/chunks/popover-C_32yD9W.js +2 -0
- package/dist/chunks/popover-C_32yD9W.js.map +1 -0
- package/dist/chunks/progress-CiSJDNwx.js +2 -0
- package/dist/chunks/progress-CiSJDNwx.js.map +1 -0
- package/dist/chunks/radio-C42F_5OD.js +2 -0
- package/dist/chunks/radio-C42F_5OD.js.map +1 -0
- package/dist/chunks/range-input-DeZq_9S7.js +2 -0
- package/dist/chunks/range-input-DeZq_9S7.js.map +1 -0
- package/dist/chunks/renderFormCheck-DvpfK_I4.js +2 -0
- package/dist/chunks/renderFormCheck-DvpfK_I4.js.map +1 -0
- package/dist/chunks/renderFormField-_6WswnEX.js +2 -0
- package/dist/chunks/renderFormField-_6WswnEX.js.map +1 -0
- package/dist/chunks/renderMenuItemContent-DNdj-Ukz.js +2 -0
- package/dist/chunks/renderMenuItemContent-DNdj-Ukz.js.map +1 -0
- package/dist/chunks/scrollspy-BEZEVyIw.js +2 -0
- package/dist/chunks/scrollspy-BEZEVyIw.js.map +1 -0
- package/dist/chunks/scrollspy-D_lPjb92.js.map +1 -1
- package/dist/chunks/search-field-OFsb3t4L.js +2 -0
- package/dist/chunks/search-field-OFsb3t4L.js.map +1 -0
- package/dist/chunks/select-DwyL6aqY.js +2 -0
- package/dist/chunks/select-DwyL6aqY.js.map +1 -0
- package/dist/chunks/skeleton-B2blJGWj.js +2 -0
- package/dist/chunks/skeleton-B2blJGWj.js.map +1 -0
- package/dist/chunks/slot-BQVx1Eew.js +2 -0
- package/dist/chunks/slot-BQVx1Eew.js.map +1 -0
- package/dist/chunks/spacingClassName-DVhk8m3P.js.map +1 -1
- package/dist/chunks/spinner-D8lQCW4u.js +2 -0
- package/dist/chunks/spinner-D8lQCW4u.js.map +1 -0
- package/dist/chunks/stack-DtzW54UK.js +2 -0
- package/dist/chunks/stack-DtzW54UK.js.map +1 -0
- package/dist/chunks/static-table-C7ZtFQ66.js +2 -0
- package/dist/chunks/static-table-C7ZtFQ66.js.map +1 -0
- package/dist/chunks/stepper-tSA84huJ.js +2 -0
- package/dist/chunks/stepper-tSA84huJ.js.map +1 -0
- package/dist/chunks/switch-cp3IZg3L.js +2 -0
- package/dist/chunks/switch-cp3IZg3L.js.map +1 -0
- package/dist/chunks/table-CBTg5Yuq.js +2 -0
- package/dist/chunks/table-CBTg5Yuq.js.map +1 -0
- package/dist/chunks/tableClassName-jRfRDXA3.js +2 -0
- package/dist/chunks/tableClassName-jRfRDXA3.js.map +1 -0
- package/dist/chunks/tabs-DMFSLjnV.js +2 -0
- package/dist/chunks/tabs-DMFSLjnV.js.map +1 -0
- package/dist/chunks/text-input-CR73x-8D.js +2 -0
- package/dist/chunks/text-input-CR73x-8D.js.map +1 -0
- package/dist/chunks/textarea-C-1cMyH4.js +2 -0
- package/dist/chunks/textarea-C-1cMyH4.js.map +1 -0
- package/dist/chunks/time-field-CbCfOQZz.js +2 -0
- package/dist/chunks/time-field-CbCfOQZz.js.map +1 -0
- package/dist/chunks/toast-Dd0J2e1z.js +2 -0
- package/dist/chunks/toast-Dd0J2e1z.js.map +1 -0
- package/dist/chunks/tooltip-CmKeQwYw.js +2 -0
- package/dist/chunks/tooltip-CmKeQwYw.js.map +1 -0
- package/dist/chunks/tree-DNj_EfUl.js +2 -0
- package/dist/chunks/tree-DNj_EfUl.js.map +1 -0
- package/dist/chunks/unhandledProps-9Kdj7WVf.js.map +1 -1
- package/dist/chunks/{useButtonSemantics-CILM_lhi.js → useButtonSemantics-B1SbGaDO.js} +2 -2
- package/dist/chunks/useButtonSemantics-B1SbGaDO.js.map +1 -0
- package/dist/chunks/useControllableState-CPUJxfKW.js.map +1 -1
- package/dist/chunks/useDialogElement-BfygWBPZ.js +2 -0
- package/dist/chunks/useDialogElement-BfygWBPZ.js.map +1 -0
- package/dist/chunks/useDialogTitle-DiB4YDGI.js +2 -0
- package/dist/chunks/useDialogTitle-DiB4YDGI.js.map +1 -0
- package/dist/chunks/useDisabledAnchorGuard-CH6df46a.js +2 -0
- package/dist/chunks/useDisabledAnchorGuard-CH6df46a.js.map +1 -0
- package/dist/chunks/useFloatingOverlay-BuiI_CCn.js +2 -0
- package/dist/chunks/useFloatingOverlay-BuiI_CCn.js.map +1 -0
- package/dist/chunks/useForkedRef-WoqMqsWE.js +2 -0
- package/dist/chunks/useForkedRef-WoqMqsWE.js.map +1 -0
- package/dist/chunks/useFormField-DH2tlc3e.js +2 -0
- package/dist/chunks/useFormField-DH2tlc3e.js.map +1 -0
- package/dist/chunks/useHeldBack-eeTfpa_t.js +2 -0
- package/dist/chunks/useHeldBack-eeTfpa_t.js.map +1 -0
- package/dist/chunks/useHydrated-Dud4JEwp.js +2 -0
- package/dist/chunks/useHydrated-Dud4JEwp.js.map +1 -0
- package/dist/chunks/useIsomorphicLayoutEffect-BbqRwuqn.js.map +1 -1
- package/dist/chunks/{useOpenStateProps-DykUbnPJ.js → useOpenStateProps-BhjSQ3f6.js} +2 -2
- package/dist/chunks/useOpenStateProps-BhjSQ3f6.js.map +1 -0
- package/dist/chunks/useOverlayMaxHeight-8mQL2Q6d.js +2 -0
- package/dist/chunks/useOverlayMaxHeight-8mQL2Q6d.js.map +1 -0
- package/dist/chunks/useRequiredValueInput-gYN8I-LY.js +2 -0
- package/dist/chunks/useRequiredValueInput-gYN8I-LY.js.map +1 -0
- package/dist/chunks/useToastRegionQueue-CuAMxAIA.js +2 -0
- package/dist/chunks/useToastRegionQueue-CuAMxAIA.js.map +1 -0
- package/dist/chunks/{useTransitionState-e5ToY7eX.js → useTransitionState-sQUQey74.js} +2 -2
- package/dist/chunks/useTransitionState-sQUQey74.js.map +1 -0
- package/dist/chunks/validationClassName-gRGs4KBm.js.map +1 -1
- package/dist/chunks/{visibleState-B_i1zHu2.js → visibleState-CWyQak65.js} +2 -2
- package/dist/chunks/visibleState-CWyQak65.js.map +1 -0
- package/dist/close-button.d.ts +1 -1
- package/dist/close-button.js +1 -1
- package/dist/collapse.d.ts +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.d.ts +1 -1
- package/dist/combobox.js +1 -1
- package/dist/context-menu.d.ts +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.d.ts +1 -1
- package/dist/datepicker.js +1 -1
- package/dist/divider.d.ts +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.d.ts +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.d.ts +1 -1
- package/dist/form-field.js +1 -1
- package/dist/form.d.ts +1 -1
- package/dist/form.js +1 -1
- package/dist/grid.d.ts +1 -1
- package/dist/grid.js +1 -1
- package/dist/icon.d.ts +1 -1
- package/dist/icon.js +1 -1
- package/dist/index.d.ts +68 -68
- package/dist/index.js +1 -1
- package/dist/input-adorn.d.ts +1 -1
- package/dist/input-adorn.js +1 -1
- package/dist/input-group.d.ts +1 -1
- package/dist/input-group.js +1 -1
- package/dist/link.d.ts +1 -1
- package/dist/link.js +1 -1
- package/dist/list.d.ts +1 -1
- package/dist/list.js +1 -1
- package/dist/menu.d.ts +2 -2
- package/dist/menu.js +1 -1
- package/dist/modal.d.ts +1 -1
- package/dist/modal.js +1 -1
- package/dist/nav-overflow.d.ts +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.d.ts +1 -1
- package/dist/navbar.js +1 -1
- package/dist/notification.d.ts +1 -1
- package/dist/notification.js +1 -1
- package/dist/number-field.d.ts +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/password-strength.d.ts +1 -1
- package/dist/password-strength.js +1 -1
- package/dist/placeholder.d.ts +1 -1
- package/dist/placeholder.js +1 -1
- package/dist/popover.d.ts +1 -1
- package/dist/popover.js +1 -1
- package/dist/portal.d.ts +1 -1
- package/dist/portal.js +1 -1
- package/dist/progress.d.ts +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/scrollspy.d.ts +1 -1
- package/dist/scrollspy.js +1 -1
- package/dist/search-field.d.ts +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.d.ts +1 -1
- package/dist/skeleton.js +1 -1
- package/dist/spinner.d.ts +1 -1
- package/dist/spinner.js +1 -1
- package/dist/stack.d.ts +1 -1
- package/dist/stack.js +1 -1
- package/dist/static-table.js +1 -1
- package/dist/stepper.d.ts +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.d.ts +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text-input.d.ts +1 -1
- package/dist/text-input.js +1 -1
- package/dist/textarea.d.ts +1 -1
- package/dist/textarea.js +1 -1
- package/dist/time-field.d.ts +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.d.ts +1 -1
- package/dist/tooltip.js +1 -1
- package/dist/tree.d.ts +1 -1
- package/dist/tree.js +1 -1
- package/dist/visually-hidden.d.ts +1 -1
- package/dist/visually-hidden.js +1 -1
- package/package.json +29 -28
- package/dist/chunks/Button-BoymWE-L.js +0 -2
- package/dist/chunks/Button-BoymWE-L.js.map +0 -1
- package/dist/chunks/Chip-DCaWaBqo.js +0 -2
- package/dist/chunks/Chip-DCaWaBqo.js.map +0 -1
- package/dist/chunks/CloseButton-DPgQztE0.js +0 -2
- package/dist/chunks/CloseButton-DPgQztE0.js.map +0 -1
- package/dist/chunks/ComboboxListBox-Cm3L1ULl.js +0 -2
- package/dist/chunks/ComboboxListBox-Cm3L1ULl.js.map +0 -1
- package/dist/chunks/DateSegment-2agXAd0f.js +0 -2
- package/dist/chunks/DateSegment-2agXAd0f.js.map +0 -1
- package/dist/chunks/FormHelp-AE6_iSLJ.js +0 -2
- package/dist/chunks/FormHelp-AE6_iSLJ.js.map +0 -1
- package/dist/chunks/FormLabel-CYcQiFUI.js +0 -2
- package/dist/chunks/FormLabel-CYcQiFUI.js.map +0 -1
- package/dist/chunks/Icon-DLB1f88W.js.map +0 -1
- package/dist/chunks/Link-DyZyAQFj.js +0 -2
- package/dist/chunks/Link-DyZyAQFj.js.map +0 -1
- package/dist/chunks/Menu-CSBg2Zmc.js +0 -2
- package/dist/chunks/Menu-CSBg2Zmc.js.map +0 -1
- package/dist/chunks/MenuToggle-7RQ0dmtZ.js +0 -2
- package/dist/chunks/MenuToggle-7RQ0dmtZ.js.map +0 -1
- package/dist/chunks/Portal-CgeR1WXV.js +0 -2
- package/dist/chunks/Portal-CgeR1WXV.js.map +0 -1
- package/dist/chunks/RangeCalendar-BJl-j4W2.js +0 -2
- package/dist/chunks/RangeCalendar-BJl-j4W2.js.map +0 -1
- package/dist/chunks/VisuallyHidden-C2dM7HhC.js +0 -2
- package/dist/chunks/VisuallyHidden-C2dM7HhC.js.map +0 -1
- package/dist/chunks/accordion-B8UWyvQB.js +0 -2
- package/dist/chunks/accordion-B8UWyvQB.js.map +0 -1
- package/dist/chunks/alert-3kTBfWFw.js +0 -2
- package/dist/chunks/alert-3kTBfWFw.js.map +0 -1
- package/dist/chunks/autocomplete-Baf9VSHN.js +0 -2
- package/dist/chunks/autocomplete-Baf9VSHN.js.map +0 -1
- package/dist/chunks/avatar-MklqAKcz.js +0 -2
- package/dist/chunks/avatar-MklqAKcz.js.map +0 -1
- package/dist/chunks/badge-D2oztCvs.js.map +0 -1
- package/dist/chunks/breadcrumb-CHxTiZLt.js +0 -2
- package/dist/chunks/breadcrumb-CHxTiZLt.js.map +0 -1
- package/dist/chunks/button-group-BGppPrIv.js +0 -2
- package/dist/chunks/button-group-BGppPrIv.js.map +0 -1
- package/dist/chunks/card-CTP9K8xG.js +0 -2
- package/dist/chunks/card-CTP9K8xG.js.map +0 -1
- package/dist/chunks/carousel-fTVPqnSV.js +0 -2
- package/dist/chunks/carousel-fTVPqnSV.js.map +0 -1
- package/dist/chunks/checkbox-ZyQn5Ku5.js +0 -2
- package/dist/chunks/checkbox-ZyQn5Ku5.js.map +0 -1
- package/dist/chunks/chip-input-BpVDRERg.js +0 -2
- package/dist/chunks/chip-input-BpVDRERg.js.map +0 -1
- package/dist/chunks/collapse--Go2Y73B.js.map +0 -1
- package/dist/chunks/color-input-Bwl5ef5B.js +0 -2
- package/dist/chunks/color-input-Bwl5ef5B.js.map +0 -1
- package/dist/chunks/colorClassNames-CEh5Yzfp.js +0 -2
- package/dist/chunks/colorClassNames-CEh5Yzfp.js.map +0 -1
- package/dist/chunks/combobox-Bp1tIaiW.js +0 -2
- package/dist/chunks/combobox-Bp1tIaiW.js.map +0 -1
- package/dist/chunks/context-menu-B4a0tS-h.js +0 -2
- package/dist/chunks/context-menu-B4a0tS-h.js.map +0 -1
- package/dist/chunks/datagrid-DOYxx0sF.js +0 -3
- package/dist/chunks/datagrid-DOYxx0sF.js.map +0 -1
- package/dist/chunks/datepicker-bOiM_zhJ.js +0 -2
- package/dist/chunks/datepicker-bOiM_zhJ.js.map +0 -1
- package/dist/chunks/dialogTransition-i9vw0i2Z.js.map +0 -1
- package/dist/chunks/divider-CjbF4OfA.js +0 -2
- package/dist/chunks/divider-CjbF4OfA.js.map +0 -1
- package/dist/chunks/drawer-C7Tz4XU_.js +0 -2
- package/dist/chunks/drawer-C7Tz4XU_.js.map +0 -1
- package/dist/chunks/file-input-CDM6qrmV.js +0 -2
- package/dist/chunks/file-input-CDM6qrmV.js.map +0 -1
- package/dist/chunks/flex-B52oLCCC.js.map +0 -1
- package/dist/chunks/floating-input-DmSZZc27.js +0 -2
- package/dist/chunks/floating-input-DmSZZc27.js.map +0 -1
- package/dist/chunks/focus-ring-SR_LwaN7.js +0 -2
- package/dist/chunks/focus-ring-SR_LwaN7.js.map +0 -1
- package/dist/chunks/focusRedirect-BrvK3U_o.js +0 -2
- package/dist/chunks/focusRedirect-BrvK3U_o.js.map +0 -1
- package/dist/chunks/form-GpdAyWWi.js +0 -2
- package/dist/chunks/form-GpdAyWWi.js.map +0 -1
- package/dist/chunks/form-field-CNPGTMiW.js.map +0 -1
- package/dist/chunks/grid-C7tO-ppc.js +0 -2
- package/dist/chunks/grid-C7tO-ppc.js.map +0 -1
- package/dist/chunks/icon-BQsT6YtE.js +0 -2
- package/dist/chunks/icon-BQsT6YtE.js.map +0 -1
- package/dist/chunks/iconSlot-BNu2MrFI.js +0 -2
- package/dist/chunks/iconSlot-BNu2MrFI.js.map +0 -1
- package/dist/chunks/input-adorn-DwdX-jxA.js +0 -2
- package/dist/chunks/input-adorn-DwdX-jxA.js.map +0 -1
- package/dist/chunks/input-group-Cuiuf4Dl.js +0 -2
- package/dist/chunks/input-group-Cuiuf4Dl.js.map +0 -1
- package/dist/chunks/list-07e2a1Ym.js +0 -2
- package/dist/chunks/list-07e2a1Ym.js.map +0 -1
- package/dist/chunks/menu-Upf6P-2P.js +0 -2
- package/dist/chunks/menu-Upf6P-2P.js.map +0 -1
- package/dist/chunks/modal-bgDR29Jh.js +0 -2
- package/dist/chunks/modal-bgDR29Jh.js.map +0 -1
- package/dist/chunks/nav-DI6oEULI.js +0 -2
- package/dist/chunks/nav-DI6oEULI.js.map +0 -1
- package/dist/chunks/nav-overflow-DlLer6EK.js +0 -2
- package/dist/chunks/nav-overflow-DlLer6EK.js.map +0 -1
- package/dist/chunks/navOverflow-B5krZe6D.js +0 -2
- package/dist/chunks/navOverflow-B5krZe6D.js.map +0 -1
- package/dist/chunks/navVariant-DeGTk9B7.js.map +0 -1
- package/dist/chunks/navbar-DxIwt0sc.js +0 -2
- package/dist/chunks/navbar-DxIwt0sc.js.map +0 -1
- package/dist/chunks/notification-Dbci5Ka3.js +0 -2
- package/dist/chunks/notification-Dbci5Ka3.js.map +0 -1
- package/dist/chunks/number-field-IBIX2IWH.js +0 -2
- package/dist/chunks/number-field-IBIX2IWH.js.map +0 -1
- package/dist/chunks/otp-input-ws393uPB.js +0 -2
- package/dist/chunks/otp-input-ws393uPB.js.map +0 -1
- package/dist/chunks/overlayPlacement-BtS90IVf.js.map +0 -1
- package/dist/chunks/pagination-BREQp-ZC.js +0 -2
- package/dist/chunks/pagination-BREQp-ZC.js.map +0 -1
- package/dist/chunks/password-strength-DDK8pHRq.js.map +0 -1
- package/dist/chunks/placeholder-DhNpUJqv.js +0 -2
- package/dist/chunks/placeholder-DhNpUJqv.js.map +0 -1
- package/dist/chunks/polymorphic-BhGNZQja.js +0 -2
- package/dist/chunks/polymorphic-BhGNZQja.js.map +0 -1
- package/dist/chunks/popover-Bdg8D4sm.js +0 -2
- package/dist/chunks/popover-Bdg8D4sm.js.map +0 -1
- package/dist/chunks/progress-BqgWezdG.js +0 -2
- package/dist/chunks/progress-BqgWezdG.js.map +0 -1
- package/dist/chunks/radio-B6gJdtoN.js +0 -2
- package/dist/chunks/radio-B6gJdtoN.js.map +0 -1
- package/dist/chunks/range-input-CT_8TKL7.js +0 -2
- package/dist/chunks/range-input-CT_8TKL7.js.map +0 -1
- package/dist/chunks/renderFormCheck-DN_-V62U.js +0 -2
- package/dist/chunks/renderFormCheck-DN_-V62U.js.map +0 -1
- package/dist/chunks/renderFormField-Brkw1yA6.js +0 -2
- package/dist/chunks/renderFormField-Brkw1yA6.js.map +0 -1
- package/dist/chunks/renderMenuItemContent-DUezZrpj.js +0 -2
- package/dist/chunks/renderMenuItemContent-DUezZrpj.js.map +0 -1
- package/dist/chunks/scrollspy-C2HmrnZ4.js +0 -2
- package/dist/chunks/scrollspy-C2HmrnZ4.js.map +0 -1
- package/dist/chunks/search-field--nDoCI_E.js +0 -2
- package/dist/chunks/search-field--nDoCI_E.js.map +0 -1
- package/dist/chunks/select-BwJIfv9f.js +0 -2
- package/dist/chunks/select-BwJIfv9f.js.map +0 -1
- package/dist/chunks/skeleton-Bjv9gGd3.js +0 -2
- package/dist/chunks/skeleton-Bjv9gGd3.js.map +0 -1
- package/dist/chunks/slot-CNhFZdHF.js +0 -2
- package/dist/chunks/slot-CNhFZdHF.js.map +0 -1
- package/dist/chunks/spinner-DBuvQvMR.js +0 -2
- package/dist/chunks/spinner-DBuvQvMR.js.map +0 -1
- package/dist/chunks/stack-DK5F53VT.js +0 -2
- package/dist/chunks/stack-DK5F53VT.js.map +0 -1
- package/dist/chunks/static-table-uu297Liz.js +0 -2
- package/dist/chunks/static-table-uu297Liz.js.map +0 -1
- package/dist/chunks/stepper-CVXMJ2yg.js +0 -2
- package/dist/chunks/stepper-CVXMJ2yg.js.map +0 -1
- package/dist/chunks/switch-C6s3LxEv.js +0 -2
- package/dist/chunks/switch-C6s3LxEv.js.map +0 -1
- package/dist/chunks/table-DPLOygg0.js +0 -2
- package/dist/chunks/table-DPLOygg0.js.map +0 -1
- package/dist/chunks/tableClassName-DleBjOj2.js +0 -2
- package/dist/chunks/tableClassName-DleBjOj2.js.map +0 -1
- package/dist/chunks/tabs-91T7-8qq.js +0 -2
- package/dist/chunks/tabs-91T7-8qq.js.map +0 -1
- package/dist/chunks/text-input-B4pTv6SU.js +0 -2
- package/dist/chunks/text-input-B4pTv6SU.js.map +0 -1
- package/dist/chunks/textarea-1A1nABQE.js +0 -2
- package/dist/chunks/textarea-1A1nABQE.js.map +0 -1
- package/dist/chunks/time-field-B3MA7ED_.js +0 -2
- package/dist/chunks/time-field-B3MA7ED_.js.map +0 -1
- package/dist/chunks/toast-CGHl3-oU.js +0 -2
- package/dist/chunks/toast-CGHl3-oU.js.map +0 -1
- package/dist/chunks/tooltip-Bc-u6nIW.js +0 -2
- package/dist/chunks/tooltip-Bc-u6nIW.js.map +0 -1
- package/dist/chunks/tree-Cql1veeZ.js +0 -2
- package/dist/chunks/tree-Cql1veeZ.js.map +0 -1
- package/dist/chunks/useButtonSemantics-CILM_lhi.js.map +0 -1
- package/dist/chunks/useDialogElement-CgOnJAzu.js +0 -2
- package/dist/chunks/useDialogElement-CgOnJAzu.js.map +0 -1
- package/dist/chunks/useDisabledAnchorGuard-Cz58UCXy.js +0 -2
- package/dist/chunks/useDisabledAnchorGuard-Cz58UCXy.js.map +0 -1
- package/dist/chunks/useFloatingOverlay-DLIvwx-8.js +0 -2
- package/dist/chunks/useFloatingOverlay-DLIvwx-8.js.map +0 -1
- package/dist/chunks/useForkedRef-DVEfT-KI.js +0 -2
- package/dist/chunks/useForkedRef-DVEfT-KI.js.map +0 -1
- package/dist/chunks/useFormField-BOqmBTC4.js +0 -2
- package/dist/chunks/useFormField-BOqmBTC4.js.map +0 -1
- package/dist/chunks/useOpenStateProps-DykUbnPJ.js.map +0 -1
- package/dist/chunks/useToastRegionQueue-CIV5SdiE.js +0 -2
- package/dist/chunks/useToastRegionQueue-CIV5SdiE.js.map +0 -1
- package/dist/chunks/useTransitionState-e5ToY7eX.js.map +0 -1
- package/dist/chunks/visibleState-B_i1zHu2.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"card-CTP9K8xG.js","names":[],"sources":["../../src/components/card/CardBody.tsx","../../src/components/card/CardFooter.tsx","../../src/components/card/CardImage.tsx","../../src/components/card/CardSubtitle.tsx","../../src/components/card/CardText.tsx","../../src/components/card/CardTitle.tsx","../../src/components/card/Card.tsx","../../src/components/card/CardGroup.tsx","../../src/components/card/CardHeader.tsx","../../src/components/card/CardImageOverlay.tsx","../../src/components/card/CardLink.tsx"],"sourcesContent":["import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport { Responsive, Spacing } from '../../types'\nimport {\n flexDirectionClassName,\n FlexDirection,\n responsiveClassNames,\n responsiveProp\n} from '../../utils/breakpoints'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { spacingClassName } from '../../utils/spacingClassName'\n\ntype CardBodyOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n /**\n * Switches the body from its default stacked (column) layout to a side-by-side (row) layout —\n * for placing an image beside text within a single padded region. Give the image and the text\n * a width utility (`w-4/12`, `w-8/12`) to control each side's width, and nest another\n * `CardBody` (with `.p-0`) for the text side so it doesn't receive double padding. An object\n * sets the direction from a breakpoint up: `{ md: 'row' }`.\n */\n direction?: Responsive<FlexDirection>\n /**\n * Spacing between children, mapped to the `gap-*` utility classes. Overrides the card's default\n * gap between body children.\n *\n * @type { Spacing | 0 }\n */\n gap?: Spacing | 0\n}\n\nexport type CardBodyProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n CardBodyOwnProps<C>\n>\n\ntype CardBodyComponent = (<C extends ElementType = 'div'>(\n props: CardBodyProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction CardBodyRender<C extends ElementType = 'div'>(\n { children, className, component, direction, gap, ...rest }: CardBodyProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames(\n 'card-body',\n responsiveClassNames([responsiveProp(direction, flexDirectionClassName)]),\n spacingClassName('gap', gap),\n className\n )\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const CardBody = createPolymorphicComponent<CardBodyComponent>(\n CardBodyRender as ForwardRefRenderFunction<Element, CardBodyProps<ElementType>>,\n 'CardBody'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype CardFooterOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n}\n\nexport type CardFooterProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n CardFooterOwnProps<C>\n>\n\ntype CardFooterComponent = (<C extends ElementType = 'div'>(\n props: CardFooterProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction CardFooterRender<C extends ElementType = 'div'>(\n { children, className, component, ...rest }: CardFooterProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames('card-footer', className)\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const CardFooter = createPolymorphicComponent<CardFooterComponent>(\n CardFooterRender as ForwardRefRenderFunction<Element, CardFooterProps<ElementType>>,\n 'CardFooter'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport { Responsive } from '../../types'\nimport { baseValue, responsiveClassNames, responsiveProp } from '../../utils/breakpoints'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype CardImageOrientation = 'top' | 'bottom' | 'start' | 'end'\n\ntype CardImageOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component —\n * e.g. a framework's own `Image` component. Its own props (`src`, `fill`, `priority`, etc.)\n * are type-checked at the call site once passed here.\n */\n component?: C\n /**\n * Orientates the image to the top or bottom of the card as an \"image cap\", or to the start/end\n * for a horizontal layout. Omit to round all four corners for use inside `CardBody`. An object\n * sets the orientation from a breakpoint up — e.g. `{ base: 'top', lg: 'start' }` to switch an\n * image cap from `top` to `start` once the card lays out horizontally.\n */\n orientation?: Responsive<CardImageOrientation>\n}\n\nexport type CardImageProps<C extends ElementType = 'img'> = PolymorphicComponentProps<\n C,\n CardImageOwnProps<C>\n>\n\ntype CardImageComponent = (<C extends ElementType = 'img'>(\n props: CardImageProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nconst orientationClassName = (orientation: CardImageOrientation, prefix: string) =>\n `${prefix}card-image-${orientation}`\n\nfunction CardImageRender<C extends ElementType = 'img'>(\n { children, className, component, orientation, ...rest }: CardImageProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'img'\n const _className = classNames(\n // With no orientation at the base, the image is the plain one of `CardBody`.\n baseValue(orientation) === undefined && 'card-image',\n responsiveClassNames([responsiveProp(orientation, orientationClassName)]),\n className\n )\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const CardImage = createPolymorphicComponent<CardImageComponent>(\n CardImageRender as ForwardRefRenderFunction<Element, CardImageProps<ElementType>>,\n 'CardImage'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype CardSubtitleOwnProps<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 CardSubtitleProps<C extends ElementType = 'h6'> = PolymorphicComponentProps<\n C,\n CardSubtitleOwnProps<C>\n>\n\ntype CardSubtitleComponent = (<C extends ElementType = 'h6'>(\n props: CardSubtitleProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction CardSubtitleRender<C extends ElementType = 'h6'>(\n { children, component, className, ...rest }: CardSubtitleProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'h6'\n const _className = classNames('card-subtitle', className)\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const CardSubtitle = createPolymorphicComponent<CardSubtitleComponent>(\n CardSubtitleRender as ForwardRefRenderFunction<Element, CardSubtitleProps<ElementType>>,\n 'CardSubtitle'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype CardTextOwnProps<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 CardTextProps<C extends ElementType = 'p'> = PolymorphicComponentProps<\n C,\n CardTextOwnProps<C>\n>\n\ntype CardTextComponent = (<C extends ElementType = 'p'>(\n props: CardTextProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction CardTextRender<C extends ElementType = 'p'>(\n { children, component, className, ...rest }: CardTextProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'p'\n const _className = classNames('card-text', className)\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const CardText = createPolymorphicComponent<CardTextComponent>(\n CardTextRender as ForwardRefRenderFunction<Element, CardTextProps<ElementType>>,\n 'CardText'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype CardTitleOwnProps<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 CardTitleProps<C extends ElementType = 'h5'> = PolymorphicComponentProps<\n C,\n CardTitleOwnProps<C>\n>\n\ntype CardTitleComponent = (<C extends ElementType = 'h5'>(\n props: CardTitleProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction CardTitleRender<C extends ElementType = 'h5'>(\n { children, component, className, ...rest }: CardTitleProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'h5'\n const _className = classNames('card-title', className)\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const CardTitle = createPolymorphicComponent<CardTitleComponent>(\n CardTitleRender as ForwardRefRenderFunction<Element, CardTitleProps<ElementType>>,\n 'CardTitle'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement, ReactNode } from 'react'\nimport classNames from 'classnames'\n\nimport { ContextColor, ContextStyle, Responsive, Sizing } from '../../types'\nimport {\n flexDirectionClassName,\n FlexDirection,\n responsiveClassNames,\n responsiveProp\n} from '../../utils/breakpoints'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { CardBody } from './CardBody'\nimport { CardFooter } from './CardFooter'\nimport { CardImage } from './CardImage'\nimport { CardSubtitle } from './CardSubtitle'\nimport { CardText } from './CardText'\nimport { CardTitle } from './CardTitle'\n\ntype CardOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n /**\n * Sets the color of the component to one of Chassis context colors.\n */\n color?: ContextColor\n /**\n * Switches the card from its default stacked (column) layout to a side-by-side (row) layout.\n * Give the image and the body a width utility (`w-4/12`, `w-8/12`) to control each side's\n * width. An object sets the direction from a breakpoint up — e.g. `{ lg: 'row' }` to lay the\n * card out horizontally from `lg` up while stacking below it.\n */\n direction?: Responsive<FlexDirection>\n /**\n * Shorthand for a `CardFooter`, rendered after the image/title/subtitle/text/`children` block.\n */\n footer?: ReactNode\n /**\n * Shorthand for a `CardImage` — pass either a `src` URL (combine with `imageAlt`/\n * `imageOrientation`) or a fully-formed element — a `<CardImage>`, `<Skeleton>`,\n * `<Placeholder>`, or anything else — rendered as-is in its place. `imageAlt`/`imageOrientation`\n * only apply to the `src` form; set them directly on your own element otherwise. For a\n * horizontal layout or an overlay, omit this and compose `CardImage` directly as a child\n * instead.\n */\n image?: ReactNode\n /**\n * Accessible alt text for `image`. Ignored unless `image` is set.\n */\n imageAlt?: string\n /**\n * Orientates `image` to the top (default) or bottom of the card.\n */\n imageOrientation?: 'top' | 'bottom'\n /**\n * Sets the size of the component to one of Chassis component sizes.\n */\n size?: Sizing\n /**\n * Shorthand for a `CardSubtitle`, rendered directly after `title`.\n */\n subtitle?: ReactNode\n /**\n * Shorthand for a `CardText`, rendered after `title`/`subtitle`.\n */\n text?: ReactNode\n /**\n * Shorthand for a `CardTitle`. Set alongside `subtitle`/`text` (or plain `children`, e.g. a\n * `Button`) to build a standard card without composing `CardBody`/`CardTitle` yourself — all\n * render together inside a single `CardBody`, in that order. Only takes effect when at least\n * one of `image`/`title`/`subtitle`/`text`/`footer` is set; otherwise `children` render as-is,\n * so full manual composition (`CardHeader`, lists, overlays, nav headers, …) keeps working\n * unchanged. Mixing shorthand props with a manually-composed `children` tree isn't supported —\n * pick one approach per card.\n */\n title?: ReactNode\n /**\n * Sets the context style of the component. `basic` (the default) renders with no extra class.\n */\n variant?: ContextStyle\n}\n\nexport type CardProps<C extends ElementType = 'div'> = PolymorphicComponentProps<C, CardOwnProps<C>>\n\ntype CardComponent = (<C extends ElementType = 'div'>(\n props: CardProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction CardRender<C extends ElementType = 'div'>(\n {\n children,\n className,\n color,\n component,\n direction,\n footer,\n image,\n imageAlt,\n imageOrientation = 'top',\n size,\n subtitle,\n text,\n title,\n variant,\n ...rest\n }: CardProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames(\n 'card',\n color,\n {\n context: !!color,\n solid: variant === 'solid',\n smooth: variant === 'smooth',\n outline: variant === 'outline',\n sm: size === 'sm',\n lg: size === 'lg'\n },\n responsiveClassNames([responsiveProp(direction, flexDirectionClassName)]),\n className\n )\n\n const hasShorthand =\n image != null || title != null || subtitle != null || footer != null || text != null\n const hasBodyContent = title != null || subtitle != null || text != null || children != null\n const renderedImage =\n typeof image === 'string' ? (\n <CardImage orientation={imageOrientation} src={image} alt={imageAlt ?? ''} />\n ) : (\n image\n )\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {hasShorthand ? (\n <>\n {image != null && imageOrientation === 'top' && renderedImage}\n {hasBodyContent && (\n <CardBody>\n {title != null && <CardTitle>{title}</CardTitle>}\n {subtitle != null && <CardSubtitle>{subtitle}</CardSubtitle>}\n {text != null && <CardText>{text}</CardText>}\n {children}\n </CardBody>\n )}\n {image != null && imageOrientation === 'bottom' && renderedImage}\n {footer != null && <CardFooter>{footer}</CardFooter>}\n </>\n ) : (\n children\n )}\n </Component>\n )\n}\n\nexport const Card = createPolymorphicComponent<CardComponent>(\n CardRender as ForwardRefRenderFunction<Element, CardProps<ElementType>>,\n 'Card'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype CardGroupOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n}\n\nexport type CardGroupProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n CardGroupOwnProps<C>\n>\n\ntype CardGroupComponent = (<C extends ElementType = 'div'>(\n props: CardGroupProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\n// Arranges direct-child Cards as an equal-width row, joined edge-to-edge, once its container\n// reaches the sm container breakpoint — below that, cards stack vertically. Requires a\n// `.contains-inline` ancestor (not applied by CardGroup itself, e.g. a wrapping\n// `<div className=\"contains-inline\">`) to establish the container query context.\nfunction CardGroupRender<C extends ElementType = 'div'>(\n { children, className, component, ...rest }: CardGroupProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames('card-group', className)\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const CardGroup = createPolymorphicComponent<CardGroupComponent>(\n CardGroupRender as ForwardRefRenderFunction<Element, CardGroupProps<ElementType>>,\n 'CardGroup'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype CardHeaderOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n}\n\nexport type CardHeaderProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n CardHeaderOwnProps<C>\n>\n\ntype CardHeaderComponent = (<C extends ElementType = 'div'>(\n props: CardHeaderProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction CardHeaderRender<C extends ElementType = 'div'>(\n { children, className, component, ...rest }: CardHeaderProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames('card-header', className)\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const CardHeader = createPolymorphicComponent<CardHeaderComponent>(\n CardHeaderRender as ForwardRefRenderFunction<Element, CardHeaderProps<ElementType>>,\n 'CardHeader'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype CardImageOverlayOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n}\n\nexport type CardImageOverlayProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n CardImageOverlayOwnProps<C>\n>\n\ntype CardImageOverlayComponent = (<C extends ElementType = 'div'>(\n props: CardImageOverlayProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction CardImageOverlayRender<C extends ElementType = 'div'>(\n { children, className, component, ...rest }: CardImageOverlayProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames('card-overlay', className)\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const CardImageOverlay = createPolymorphicComponent<CardImageOverlayComponent>(\n CardImageOverlayRender as ForwardRefRenderFunction<Element, CardImageOverlayProps<ElementType>>,\n 'CardImageOverlay'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport { createPolymorphicComponent, PolymorphicRef } from '../../utils/polymorphic'\nimport { Link, LinkProps } from '../link/Link'\n\ntype CardLinkOwnProps = {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n}\n\nexport type CardLinkProps<C extends ElementType = 'a'> = LinkProps<C> & CardLinkOwnProps\n\ntype CardLinkComponent = (<C extends ElementType = 'a'>(\n props: CardLinkProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction CardLinkRender<C extends ElementType = 'a'>(\n { children, className, ...rest }: CardLinkProps<C>,\n ref: PolymorphicRef<C>\n) {\n const _className = classNames('card-link', className)\n\n return (\n <Link\n className={_className}\n {...(rest as Record<string, unknown>)}\n ref={ref as PolymorphicRef<ElementType>}\n >\n {children}\n </Link>\n )\n}\n\nexport const CardLink = createPolymorphicComponent<CardLinkComponent>(\n CardLinkRender as ForwardRefRenderFunction<Element, CardLinkProps<ElementType>>,\n 'CardLink'\n)\n"],"mappings":"sRAoDA,SAAS,EACP,CAAE,WAAU,YAAW,YAAW,YAAW,MAAK,GAAG,GACrD,EACA,CACA,IAAM,EAAY,GAAa,MACzB,EAAa,EACjB,YACA,EAAqB,CAAC,EAAe,EAAW,CAAsB,CAAC,CAAC,EACxE,EAAiB,MAAO,CAAG,EAC3B,CACF,EAEA,OACE,EAAA,cAAC,EAAD,CAAW,UAAW,EAAY,GAAI,EAAW,KAEtC,EADR,CACQ,CAEf,CAEA,MAAa,EAAW,EACtB,EACA,UACF,EC7CA,SAAS,EACP,CAAE,WAAU,YAAW,YAAW,GAAG,GACrC,EACA,CACA,IAAM,EAAY,GAAa,MACzB,EAAa,EAAW,cAAe,CAAS,EAEtD,OACE,EAAA,cAAC,EAAD,CAAW,UAAW,EAAY,GAAI,EAAW,KAEtC,EADR,CACQ,CAEf,CAEA,MAAa,EAAa,EACxB,EACA,YACF,ECJM,GAAwB,EAAmC,IAC/D,GAAG,EAAO,aAAa,IAEzB,SAAS,EACP,CAAE,WAAU,YAAW,YAAW,cAAa,GAAG,GAClD,EACA,CACA,IAAM,EAAY,GAAa,MACzB,EAAa,EAEjB,EAAU,CAAW,IAAM,IAAA,IAAa,aACxC,EAAqB,CAAC,EAAe,EAAa,CAAoB,CAAC,CAAC,EACxE,CACF,EAEA,OACE,EAAA,cAAC,EAAD,CAAW,UAAW,EAAY,GAAI,EAAW,KAEtC,EADR,CACQ,CAEf,CAEA,MAAa,EAAY,EACvB,EACA,WACF,ECtCA,SAAS,EACP,CAAE,WAAU,YAAW,YAAW,GAAG,GACrC,EACA,CACA,IAAM,EAAY,GAAa,KACzB,EAAa,EAAW,gBAAiB,CAAS,EAExD,OACE,EAAA,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ADH,CACG,CAEV,CAEA,MAAa,EAAW,EACtB,EACA,UACF"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{v as e}from"./slot-CNhFZdHF.js";import{t}from"./useForkedRef-DVEfT-KI.js";import{t as n}from"./lazyElement-tfMG21pZ.js";import{t as r}from"./polymorphic-BhGNZQja.js";import{t as i}from"./useControllableState-CPUJxfKW.js";import{t as a}from"./useIsomorphicLayoutEffect-BbqRwuqn.js";import{t as o}from"./focusRedirect-BrvK3U_o.js";import{t as s}from"./iconSlot-BNu2MrFI.js";import{t as c}from"./VisuallyHidden-C2dM7HhC.js";import{t as l}from"./direction-LN6uwsK5.js";import u,{Children as d,Fragment as f,createContext as p,forwardRef as m,isValidElement as h,useCallback as g,useContext as _,useEffect as v,useRef as y,useState as b}from"react";import x from"classnames";const S=new WeakSet;function ee(e){S.add(e)}function te(e){if(!e)return!1;let t=S.has(e);return S.delete(e),t}const C=p(null),w=()=>{let e=_(C);if(!e)throw Error(`Carousel sub-components must be rendered inside a Carousel`);return e};function T(e){return Array.from(e.querySelectorAll(`:scope > .carousel-item:not(.carousel-item-clone)`))}function E(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function ne(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 D(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 l(e)?i.right-(r.right-a):i.left-(r.left+a)}function O(e){return e.scrollWidth-e.clientWidth>0}const re=e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2;function ie(e,t,n){if(E()||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);if(e.scrollTo({left:r+i*re(n),behavior:`instant`}),n<1){o=requestAnimationFrame(l);return}c()},u=setTimeout(c,500);return o=requestAnimationFrame(l),()=>{s||(s=!0,o!==null&&cancelAnimationFrame(o),clearTimeout(u))}}function ae(e,t,n){return Number.isNaN(e)||t===0?null:e<0?n?t-1:null:e>t-1?n?0:null:e}function oe(e,t,n){let r=t>e;return n?r?`right`:`left`:r?`left`:`right`}function se(e,t){return t?e?`right`:`left`:e?`left`:`right`}function ce(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 le({children:e,className:t,component:n,interval:r,...i},a){let o=n??`div`,s=_(C),c=_(ue),l=s&&c?{"aria-label":`${c.index+1} of ${c.count}`,"aria-roledescription":`slide`,role:`group`}:{},d=x(`carousel-item`,{active:!!s&&!!c&&c.index===s.activeIndex},t);return u.createElement(o,{className:d,"data-interval":r,...l,...i,ref:a},e)}const k=r(le,`CarouselItem`),ue=p(void 0);function A(e){let t=j(e);return{nodes:t,positioned:t.every(e=>n(e,k))}}function j(e){return d.toArray(e).flatMap(e=>n(e,f)?j(e.props.children).map(t=>h(t)?u.cloneElement(t,{key:`${e.key}/${t.key}`}):t):[e])}function de({children:e,className:n,component:r,...i},a){let{registerViewport:o}=w(),s=r??`div`,c=t(a,o),l=x(`carousel-inner`,n),{nodes:d,positioned:f}=A(e);return u.createElement(s,{className:l,...i,ref:c},d.map((e,t)=>u.createElement(ue.Provider,{key:h(e)?e.key:t,value:f?{count:d.length,index:t}:void 0},e)))}const fe=r(de,`CarouselInner`),pe=m(({children:n,activeIndex:r,auto:s,autoplay:d=!1,center:f,className:p,defaultActiveIndex:m=0,ends:h=`loop`,interval:_=5e3,items:S,itemsGap:ee,itemsPeek:w,keyboard:re=!0,onKeyDown:le,onMouseEnter:k,onMouseLeave:ue,onSlid:A,onSlide:j,pause:de=`hover`,style:fe,transition:pe=`scroll`,...M},he)=>{e(r!==void 0&&!j&&!A,"Carousel: `activeIndex` is set (controlled) but neither `onSlide` nor `onSlid` is — nothing feeds the new index back to your state, so the carousel will visually freeze on click/swipe/autoplay. Pass `onSlide` or `onSlid` and update `activeIndex` from it.");let N=y(null),P=t(he,N),[F,ge]=b(null),I=g(e=>ge(e),[]),[L,_e]=i(r,m),R=y(L);a(()=>{R.current=L},[L]);let[z,ve]=b(()=>me(n)),B=y(z);a(()=>{B.current=z},[z]);let[V,ye]=b(d),[be,xe]=b(!1),[H,Se]=b(L<=0),[U,Ce]=b(z>0&&L>=z-Math.max(1,S??1)),W=y(!1),G=y(!1),we=y(!1),K=y(null),q=y(null),Te=y(new Map),J=y(null),Ee=y(!1),De=y(!1),Oe=y(!1),[ke,Ae]=b(``),je=y(!1),Y=y({from:L,to:L,direction:`left`}),Me=y(new Set),Ne=y(new Set),X=pe===`fade`,Z=Math.max(1,S??1),Pe=h!==`stop`,Fe=e=>{R.current=e,_e(e)};a(()=>{let e=Math.max(0,z-Z);Se(L<=0),Ce(L>=e)},[L,z,Z]),v(()=>{if(!F)return;let e=()=>{if(W.current||!O(F))return;let e=F.scrollWidth-F.clientWidth,t=F.scrollLeft,n=l(F)?Math.max(-e,Math.min(0,t)):Math.max(0,Math.min(e,t)),r=Math.abs(n);Se(r<=1),Ce(r>=e-1)};return F.addEventListener(`scroll`,e,{passive:!0}),()=>F.removeEventListener(`scroll`,e)},[F]),a(()=>{if(!F)return;let e=()=>{let e=T(F);if(ve(e.length),q.current?.disconnect(),q.current=null,Te.current=new Map,!(X||typeof IntersectionObserver>`u`)){q.current=new IntersectionObserver(e=>{for(let t of e)Te.current.set(t.target,t.isIntersecting?t.intersectionRatio:0);if(W.current||G.current)return;let t=T(F).map(e=>Te.current.get(e)??0),n=Math.max(0,...t),r=R.current;if(n>0){let e=t.findIndex(e=>e>=n-.05);e!==-1&&(r=e)}if(r!==R.current){let e=R.current,t={from:e,to:r,direction:oe(e,r,l(F))};Y.current=t,j?.(t),we.current=!0,Fe(r)}},{root:F,threshold:[0,.25,.5,.75,1]});for(let t of e)q.current.observe(t)}};e();let t=new MutationObserver(e);return t.observe(F,{childList:!0}),()=>{t.disconnect(),q.current?.disconnect()}},[F,X]),a(()=>{if(!F)return;let e=T(F);for(let[t,n]of e.entries())n.classList.toggle(`active`,t===L),n.hasAttribute(`role`)||n.setAttribute(`role`,`group`),n.setAttribute(`aria-roledescription`,`slide`),n.setAttribute(`aria-label`,`${t+1} of ${e.length}`)},[F,L,z]),a(()=>{if(we.current){we.current=!1;return}if(!F||W.current||X)return;let e=T(F)[L];if(!e||!O(F))return;let t=!Ee.current;Ee.current=!0;let n=D(F,e,!!f);Math.abs(n)<1||(K.current?.(),G.current=!0,F.style.scrollSnapType=`none`,t?(F.scrollTo({left:F.scrollLeft+n,behavior:`instant`}),F.style.scrollSnapType=``,G.current=!1,K.current=null):(je.current=!0,K.current=ie(F,F.scrollLeft+n,()=>{F.style.scrollSnapType=``,G.current=!1,K.current=null,je.current=!1,A?.(Y.current)})))},[F,L,z,f,X]),v(()=>{if(!De.current){De.current=!0;return}je.current||A?.(Y.current)},[L]),v(()=>{if(!Oe.current){Oe.current=!0;return}Ae(`Slide ${L+1} of ${z}`)},[L]),v(()=>()=>{J.current&&clearTimeout(J.current),q.current?.disconnect(),K.current?.()},[]);let Ie=e=>{let t=F;if(!t)return;K.current?.(),G.current=!1;let n=T(t),r=n.length-1,i=R.current,a=e?0:r,o=se(e,l(t));j?.({from:i,to:a,direction:o}),W.current=!0;let s=()=>{Y.current={from:i,to:a,direction:o},Fe(a),W.current=!1},c=e?n[0]:n[r],u=n[i],d=n[a];if(!O(t)||!c||!u||!d){s();return}let p=c.cloneNode(!0);p.classList.add(`carousel-item-clone`),p.classList.remove(`active`),p.removeAttribute(`id`);for(let e of Array.from(p.querySelectorAll(`[id]`)))e.removeAttribute(`id`);p.setAttribute(`aria-hidden`,`true`),p.setAttribute(`inert`,``),t.style.scrollSnapType=`none`,e?t.append(p):(t.prepend(p),t.scrollTo({left:t.scrollLeft+D(t,u,!!f),behavior:`instant`}));let m=D(t,p,!!f);ie(t,t.scrollLeft+m,()=>{p.remove();let e=D(t,d,!!f);t.scrollTo({left:t.scrollLeft+e,behavior:`instant`}),t.style.scrollSnapType=``,s()})},Le=e=>{if(W.current)return;let t=B.current;if(t===0)return;let n=Math.max(0,t-Z);if(h===`loop`&&!X&&!E()&&N.current&&ce(N.current,t,X,!!f,!!s)){if(e>n){Ie(!0);return}if(e<0){Ie(!1);return}}let r=ae(e,n+1,Pe),i=R.current;if(r===null||r===i)return;let a=oe(i,e,F?l(F):!1);j?.({from:i,to:r,direction:a}),Y.current={from:i,to:r,direction:a},Fe(r)},Re=()=>Le(R.current+1),ze=()=>Le(R.current-1),Be=e=>Le(e),Q=()=>{J.current&&clearTimeout(J.current),J.current=null,xe(!1)},Ve=(e=R.current)=>{J.current&&clearTimeout(J.current);let t=(F?T(F):[])[e]?.dataset.interval,n=t&&!Number.isNaN(Number(t))?Number(t):_;N.current?.style.setProperty(`--cx-carousel-interval`,`${n}ms`),J.current=setTimeout(()=>{let t=B.current,n=Math.max(0,t-Z),r=ae(R.current+1,n+1,Pe);if(!(typeof document>`u`||document.visibilityState===`visible`&&ne(N.current))){Ve(e);return}if(Re(),r===null){Q();return}Ve(r)},n)},He=()=>{Ve(),xe(!0)},$=()=>{ye(!1),Q()},Ue=()=>{if(V){$();return}ye(!0),He()};v(()=>{if(F)return V&&He(),()=>Q()},[F]),v(()=>{if(!F)return;let e=()=>$();return F.addEventListener(`pointerdown`,e),()=>F.removeEventListener(`pointerdown`,e)},[F]),v(()=>{if(h!==`stop`)return;let e=document.activeElement,t=H&&!!e&&Me.current.has(e),n=U&&!!e&&Ne.current.has(e);if(!t&&!n)return;let r=t?Ne.current:Me.current,i=(t?!U:!H)?Array.from(r)[0]:null,a=te(e);if(i){o(i,a,{preventScroll:!0});return}F&&(F.hasAttribute(`tabindex`)||F.setAttribute(`tabindex`,`-1`),o(F,a,{preventScroll:!0}))},[H,U,h,F]);let We=g((e,t)=>{let n=e===`prev`?Me.current:Ne.current;return n.add(t),()=>{n.delete(t)}},[]),Ge=e=>{le?.(e),re&&(e.target.closest(`input, textarea, select, [contenteditable="true"]`)||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),$(),e.key===`ArrowLeft`?ze():Re()))},Ke=e=>{k?.(e),de===`hover`&&Q()},qe=e=>{ue?.(e),de===`hover`&&V&&He()},Je={activeIndex:L,atEnd:U,atStart:H,ends:h,itemCount:z,itemsVisible:Z,next:()=>{$(),Re()},playing:V,prev:()=>{$(),ze()},registerControl:We,registerViewport:I,to:e=>{$(),Be(e)},togglePlayPause:Ue},Ye=x(`carousel`,{"carousel-fade":X,"carousel-center":f,"carousel-auto":s,"carousel-playing":be},p),Xe={...fe,...S!=null&&{"--cx-carousel-items":S},...ee!=null&&{"--cx-carousel-items-gap":ee},...w!=null&&{"--cx-carousel-items-peek":w}};return u.createElement(`div`,{role:`region`,"aria-roledescription":`carousel`,className:Ye,style:Xe,onKeyDown:Ge,onMouseEnter:Ke,onMouseLeave:qe,...M,ref:P},u.createElement(C.Provider,{value:Je},n),u.createElement(c,{role:`status`},ke))});pe.displayName=`Carousel`;function me(e){for(let t of d.toArray(e)){if(n(t,fe)){let{nodes:e,positioned:n}=A(t.props.children);return n?e.length:0}if(!h(t))continue;let e=me(t.props.children);if(e>0)return e}return 0}const M=m(({children:e,className:n,direction:r,disabled:i,icon:a,label:o,onClick:l,...d},f)=>{let{atEnd:p,atStart:m,ends:h,next:g,prev:_,registerControl:b}=w(),S=y(null),te=t(f,S);v(()=>{let e=S.current;if(e)return b(r,e)},[b,r]);let C=r===`next`?p:m,T=r===`next`?g:_,E=i||h===`stop`&&C;return u.createElement(`button`,{type:`button`,className:x(`button sm icon-only`,n),disabled:E,onClick:e=>{l?.(e),e.detail!==0&&ee(e.currentTarget),T()},...d,ref:te},e??u.createElement(u.Fragment,null,u.createElement(s,{icon:r===`next`?`next`:`previous`,override:a,className:`directional-icon`}),u.createElement(c,null,o)))});M.displayName=`CarouselControlButton`;const he=m(({label:e=`Next slide`,...t},n)=>u.createElement(M,{...t,direction:`next`,label:e,ref:n}));he.displayName=`CarouselControlNext`;const N=m(({label:e=`Previous slide`,...t},n)=>u.createElement(M,{...t,direction:`prev`,label:e,ref:n}));N.displayName=`CarouselControlPrev`;const P=m(({className:e,label:t=e=>`Slide ${e}`,...n},r)=>{let{activeIndex:i,itemCount:a,itemsVisible:o,to:s}=w(),c=x(`carousel-indicators`,e),l=a===0?0:Math.max(1,a-o+1);return u.createElement(`ol`,{className:c,...n,ref:r},Array.from({length:l},(e,t)=>t).map(e=>u.createElement(`li`,{key:e},u.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)}))))});P.displayName=`CarouselIndicators`;function F({children:e,className:t,component:n,...r},i){let a=n??`div`,o=x(`carousel-overlay`,t);return u.createElement(a,{className:o,...r,ref:i},e)}const ge=r(F,`CarouselOverlay`),I=m(({children:e,className:t,onClick:n,pauseIcon:r,pauseLabel:i=`Pause`,playIcon:a,playLabel:o=`Play`,...c},l)=>{let{playing:d,togglePlayPause:f}=w(),p=x(`carousel-control-play-pause button sm icon-only`,{paused:!d},t);return u.createElement(`button`,{type:`button`,className:p,"aria-label":d?i:o,onClick:e=>{n?.(e),f()},...c,ref:l},e??u.createElement(u.Fragment,null,u.createElement(s,{icon:`pause`,override:r,className:`carousel-icon-pause`}),u.createElement(s,{icon:`play`,override:a,className:`carousel-icon-play`})))});I.displayName=`CarouselPlayPause`;export{he as a,k as c,N as i,ge as n,pe as o,P as r,fe as s,I as t};
|
|
2
|
-
//# sourceMappingURL=carousel-fTVPqnSV.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"carousel-fTVPqnSV.js","names":[],"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\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: 'prev' | 'next', 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, 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 { 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` or `onSlid` to feed the\n * new index back — they're the only way a controlled carousel's `activeIndex` gets updated.\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 carousel.\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\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`/`onSlid` — not a dedicated `onChange` — are the only way a controlled\n // `activeIndex` gets fed back (see the CarouselProps `activeIndex` doc and carousel.mdx's\n // \"Controlled usage\" section). Missing both means every click/swipe/autoplay advance updates\n // internal state that `useControllableState` immediately discards (controlled mode always\n // mirrors the prop), so the carousel silently freezes instead of erroring.\n devWarning(\n activeIndexProp !== undefined && !onSlide && !onSlid,\n 'Carousel: `activeIndex` is set (controlled) but neither `onSlide` nor `onSlid` is — ' +\n 'nothing feeds the new index back to your state, so the carousel will visually freeze ' +\n 'on click/swipe/autoplay. Pass `onSlide` or `onSlid` and update `activeIndex` from it.'\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 [activeIndex, setActiveIndex] = useControllableState(activeIndexProp, defaultActiveIndex)\n const activeIndexRef = useRef(activeIndex)\n useIsomorphicLayoutEffect(() => {\n activeIndexRef.current = activeIndex\n }, [activeIndex])\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 // Set right before an `activeIndex` change originates from the IntersectionObserver (i.e. the\n // user physically scrolled/swiped there) so the scroll-sync effect below can skip it. Without\n // this, every threshold the observer crosses mid-gesture — before the browser's own\n // scroll-snap has actually settled the position — would make that effect \"correct\" the\n // still-in-progress native scroll, fighting the user's own touch/wheel input.\n const skipScrollSyncRef = useRef(false)\n const cancelScrollSyncRef = 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 lastTransitionRef = useRef<CarouselSlideDetail>({\n from: activeIndex,\n to: activeIndex,\n direction: 'left'\n })\n const prevControlsRef = useRef<Set<HTMLButtonElement>>(new Set())\n const nextControlsRef = 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 }\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 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 viewportEl.addEventListener('scroll', handleScroll, { passive: true })\n return () => viewportEl.removeEventListener('scroll', handleScroll)\n }, [viewportEl])\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 onSlide?.(detail)\n skipScrollSyncRef.current = true\n setActiveIndexInternal(bestIndex)\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 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 node.setAttribute('aria-label', `${index + 1} of ${nodes.length}`)\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 `skipScrollSyncRef` 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 (skipScrollSyncRef.current) {\n skipScrollSyncRef.current = false\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 // 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\n syncingScrollRef.current = true\n viewportEl.style.scrollSnapType = 'none'\n\n if (instant) {\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 cancelScrollSyncRef.current = animateScrollTo(\n viewportEl,\n viewportEl.scrollLeft + delta,\n () => {\n viewportEl.style.scrollSnapType = ''\n syncingScrollRef.current = false\n cancelScrollSyncRef.current = null\n deferOnSlidRef.current = false\n onSlid?.(lastTransitionRef.current)\n }\n )\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [viewportEl, activeIndex, itemCount, center, isFade])\n\n useEffect(() => {\n if (!mountedForSlidRef.current) {\n mountedForSlidRef.current = true\n return\n }\n if (deferOnSlidRef.current) return\n onSlid?.(lastTransitionRef.current)\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 observerRef.current?.disconnect()\n cancelScrollSyncRef.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 loopingRef.current = true\n\n const finish = () => {\n lastTransitionRef.current = { from, to, direction }\n setActiveIndexInternal(to)\n loopingRef.current = false\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 animateScrollTo(viewport, viewport.scrollLeft + targetDelta, () => {\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 // `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 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(() => {\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 if (upcoming === null) {\n pauseCycle()\n return\n }\n\n scheduleAutoplay(upcoming)\n }, ms)\n }\n\n const startCycle = () => {\n scheduleAutoplay()\n setCycling(true)\n }\n\n const stopPlayingForGood = () => {\n setPlaying(false)\n pauseCycle()\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 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.\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 = atEnd && !!focused && nextControlsRef.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, 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: 'prev' | 'next', element: HTMLButtonElement) => {\n const set = kind === 'prev' ? prevControlsRef.current : nextControlsRef.current\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 if (event.key === 'ArrowLeft') goPrev()\n else goNext()\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 '../../utils/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 } from 'react'\nimport classNames from 'classnames'\n\nimport { IconValue } from '../../utils/iconConfig'\nimport { IconSlot } from '../../utils/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.\n */\nexport const CarouselPlayPause = forwardRef<HTMLButtonElement, CarouselPlayPauseProps>(\n (\n {\n children,\n className,\n onClick,\n pauseIcon,\n pauseLabel = 'Pause',\n playIcon,\n playLabel = 'Play',\n ...rest\n },\n ref\n ) => {\n const { playing, togglePlayPause } = useCarouselContext()\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 onClick={handleClick}\n {...rest}\n ref={ref}\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":"ssBASA,MAAM,EAAgB,IAAI,QAE1B,SAAgB,GAAiB,EAAuB,CACtD,EAAc,IAAI,CAAE,CACtB,CAEA,SAAgB,GAAoB,EAAiC,CACnE,GAAI,CAAC,EAAI,MAAO,GAChB,IAAM,EAAa,EAAc,IAAI,CAAE,EAEvC,OADA,EAAc,OAAO,CAAE,EAChB,CACT,CCAA,MAAa,EAAkB,EAA2C,IAAI,EAEjE,MAAiD,CAC5D,IAAM,EAAU,EAAW,CAAe,EAC1C,GAAI,CAAC,EACH,MAAU,MA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i,t as a}from"./FormHelp-AE6_iSLJ.js";import{t as o}from"./validationClassName-gRGs4KBm.js";import{t as s}from"./renderFormCheck-DN_-V62U.js";import{n as c,r as l}from"./unhandledProps-9Kdj7WVf.js";import{t as u}from"./flex-B52oLCCC.js";import d,{createContext as f,forwardRef as p,useContext as m,useEffect as h,useRef as g}from"react";import _ from"classnames";import{useCheckbox as v,useCheckboxGroup as y,useCheckboxGroupItem as b}from"react-aria";import{useCheckboxGroupState as x,useToggleState as S}from"react-stately";const C=f(null),w=p(({button:e,children:t,className:n,color:i,defaultSelected:a,disabled:u,id:f,indeterminate:p,invalid:m,isSelected:h,label:y,onChange:b,size:x,style:C,valid:w,...T},E)=>{let D=g(null),O=r(E,D),k=S({defaultSelected:a,isDisabled:u,isSelected:h,onChange:b}),A=y??t,{inputProps:j}=v({...T,children:A,isDisabled:u,isIndeterminate:p,isInvalid:m,value:T.value},k,D),M=_(o(m,w));return s({button:e,className:n,color:i,input:d.createElement(`input`,{...l(j,T,c),"aria-describedby":T[`aria-describedby`],className:M,id:f,ref:O}),invalid:m,label:A,size:x,style:C,valid:w})});w.displayName=`CheckboxStandalone`;const T=p(({button:i,children:a,className:u,color:f,defaultSelected:p,disabled:m,groupDescribedBy:v,groupState:y,groupValid:x,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??x,F=g(null),I=r(M,F);h(()=>{e(!j.value,"Checkbox: a `value` prop is required when rendered inside a CheckboxGroup."),n(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}=b({...j,children:L,isDisabled:m,isIndeterminate:C,isInvalid:N,value:j.value},y,F),z=_(o(N,P));return s({button:i,className:u,color:f,input:d.createElement(`input`,{...l(R,j,c),"aria-describedby":t(j[`aria-describedby`],v),className:z,id:S,ref:I}),invalid:N,label:L,size:O,style:k,valid:P})});T.displayName=`CheckboxGroupItem`;const E=p((e,t)=>{let n=m(C);return n?d.createElement(T,{...e,groupDescribedBy:n.describedBy,groupState:n.state,groupValid:n.valid,ref:t}):d.createElement(w,{...e,ref:t})});E.displayName=`Checkbox`;const D=p(({children:e,className:n,defaultValue:r,description:s,disabled:c,errorMessage:l,invalid:f,label:p,name:m,onChange:h,orientation:g,required:v,valid:b,value:S,...w},T)=>{let E={...w,defaultValue:r,description:s,errorMessage:l,isDisabled:c,isInvalid:f,isRequired:v,label:p,name:m,onChange:h,value:S},D=x(E),{groupProps:O,labelProps:k,descriptionProps:A,errorMessageProps:j}=y(E,D),M=_(`form-field`,o(f,b),n),N=t(!!s&&A.id,!!(f&&l)&&j.id),P=d.createElement(C.Provider,{value:{describedBy:N,state:D,valid:b}},e);return d.createElement(`fieldset`,{...w,...O,"aria-describedby":t(N,w[`aria-describedby`]),className:M,ref:T},p&&d.createElement(`legend`,{className:`form-label`,...k},p),g===`horizontal`?d.createElement(u,{wrap:`wrap`,gap:`md`},P):P,s&&d.createElement(a,A,s),f&&l&&d.createElement(i,{invalid:!0,...j},l))});D.displayName=`CheckboxGroup`;export{E as n,D as t};
|
|
2
|
-
//# sourceMappingURL=checkbox-ZyQn5Ku5.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-ZyQn5Ku5.js","names":[],"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 } 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.\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,\n isSelected,\n label,\n onChange,\n size,\n style,\n valid,\n ...rest\n },\n ref\n ) => {\n const inputRef = useRef<HTMLInputElement>(null)\n const forkedRef = useForkedRef(ref, inputRef)\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 isInvalid: invalid,\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 className={inputClassName}\n id={id}\n ref={forkedRef}\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 } from 'react'\nimport classNames from 'classnames'\nimport { AriaCheckboxGroupProps, useCheckboxGroup } from 'react-aria'\nimport { useCheckboxGroupState } from 'react-stately'\n\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.\n */\n errorMessage?: ReactNode\n /**\n * Set group validation state to invalid.\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 * Marks the group as required.\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 invalid,\n label,\n name,\n onChange,\n orientation,\n required,\n valid,\n value,\n ...rest\n },\n ref\n ) => {\n const groupProps = {\n ...rest,\n defaultValue,\n description,\n errorMessage,\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 ref={ref}\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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J,mBAAkB,EAAQ,EAAa,EAAK,mBAAmB,EAC/D,UAAW,EACN,KAoBG,EAlBP,GACC,EAAA,cAAC,SAAD,CAAQ,UAAU,aAAa,GAAI,CAE3B,EADL,CACK,EAET,IAAgB,aACf,EAAA,cAAC,EAAD,CAAM,KAAK,OAAO,IAAI,IAEhB,EADH,CACG,EAEN,EAED,GAAe,EAAA,cAAC,EAAa,EAAmB,CAAsB,EACtE,GAAW,GACV,EAAA,cAAC,EAAD,CAAc,QAAA,GAAQ,GAAI,CAEZ,EADX,CACW,CAER,CAEd,CACF,EAEA,EAAc,YAAc"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{t as e}from"./useForkedRef-DVEfT-KI.js";import{t}from"./useControllableState-CPUJxfKW.js";import{t as n}from"./useFormField-BOqmBTC4.js";import{t as r}from"./renderFormField-Brkw1yA6.js";import{t as i}from"./CloseButton-DPgQztE0.js";import{t as a}from"./direction-LN6uwsK5.js";import{t as o}from"./validationClassName-gRGs4KBm.js";import{t as s}from"./Chip-DCaWaBqo.js";import c,{forwardRef as l,useMemo as u,useRef as d,useState as f}from"react";import p from"classnames";import{useButton as m,useTag as h,useTagGroup as g,useTextField as _}from"react-aria";import{Item as v,useListState as ee}from"react-stately";const te=({chipVariant:e,disabled:t,groupRef:n,props:r,size:i,state:a})=>{let{gridProps:o}=g(r,a,n);return c.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=>c.createElement(y,{chipVariant:e,disabled:t,item:n,key:n.key,size:i,state:a})))},y=({chipVariant:e,disabled:t,item:n,size:r,state:a})=>{let o=d(null),{rowProps:l,gridCellProps:u,removeButtonProps:f,allowsRemoving:g}=h({item:n},a,o),_=d(null),{buttonProps:v}=m(f,_);return c.createElement(s,{...l,"aria-labelledby":void 0,className:p(e,{active:a.selectionManager.isSelected(n.key)}),component:`div`,disabled:t,ref:o,size:r},c.createElement(`div`,{...u,style:{display:`contents`}},n.rendered,g&&c.createElement(i,{...v,ref:_})))},ne=e=>{let t=new Map;return e.map(e=>{let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}\u0000${n}`})},b=l(({allowDuplicates:i=!1,"aria-describedby":s,"aria-label":l,"aria-labelledby":m,chipVariant:h=`default`,className:g,defaultValue:y,disabled:b,help:x,id:re,invalid:S,invalidFeedback:C,label:w,maxChips:T,name:E,onChange:D,placeholder:O,separator:k=`,`,size:A,valid:j,validFeedback:M,value:N,...P},F)=>{let[I,L]=t(N,y??[],D),R=u(()=>ne(I),[I]),z=(e,t)=>t!==``&&(i||!e.includes(t)),B=e=>{let t=e.trim();z(I,t)&&(T!=null&&I.length>=T||L([...I,t]))},ie=e=>{let t=new Set(e);L(I.filter((e,n)=>!t.has(R[n])))},V=u(()=>I.map((e,t)=>({id:R[t],value:e})),[I,R]),H=ee({children:e=>c.createElement(v,{key:e.id,textValue:e.value},e.value),disabledKeys:b?V.map(e=>e.id):void 0,items:V,selectionMode:`multiple`}),U=d(null),W=d(null),G=e(F,W),K=d(null),[q,J]=f(``),Y=e=>{if(I.length===0)return;let t=R[R.length-1];e?H.selectionManager.extendSelection(t):H.selectionManager.replaceSelection(t);let n=U.current?.querySelectorAll(`[role="row"]`);n?.[n.length-1]?.focus()},ae=e=>{if(!b){if(k&&e.key===k){e.preventDefault(),B(q),J(``);return}switch(e.key){case`Enter`:e.preventDefault(),B(q),J(``);break;case`Backspace`:case`Delete`:q===``&&(e.preventDefault(),Y(!1));break;case`ArrowLeft`:case`ArrowRight`:{let t=K.current;if(!t)break;e.key===`ArrowLeft`!==a(t)&&t.selectionStart===0&&t.selectionEnd===0&&(e.preventDefault(),Y(e.shiftKey));break}case`Escape`:J(``),H.selectionManager.clearSelection(),K.current?.blur()}}},oe=e=>{if(b||!k)return;let t=e.clipboardData.getData(`text`);if(!t.includes(k))return;e.preventDefault();let n=t.split(k),r=I,i=0;for(;i<n.length-1&&!(T!=null&&r.length>=T);i++){let e=n[i].trim();z(r,e)&&(r=[...r,e])}r!==I&&L(r),J(n.slice(i).join(k))},{describedBy:X,feedbackId:se,helpId:ce,inputId:Z,labelId:le,labelledBy:Q}=n({ariaDescribedBy:s,ariaLabelledBy:m,help:x,id:re,invalid:S,invalidFeedback:C,label:w,valid:j,validFeedback:M}),{inputProps:$}=_({"aria-describedby":X,"aria-label":l??(m||w?void 0:`Add value`),"aria-labelledby":Q,id:Z,isDisabled:b,isInvalid:S,onChange:J,onFocus:()=>H.selectionManager.clearSelection(),onKeyDown:ae,placeholder:O,value:q},K);return r({children:c.createElement(`div`,{className:p(`form-input`,`chip-input`,A,{disabled:b},o(S,j),g),...P,ref:G},c.createElement(te,{chipVariant:h,disabled:b,groupRef:U,props:{"aria-label":l,"aria-labelledby":Q,onRemove:b?void 0:ie},size:A,state:H}),c.createElement(`input`,{...$,"aria-describedby":X,className:`ghost-input`,onPaste:oe,ref:K}),E&&V.map(e=>c.createElement(`input`,{disabled:b,key:e.id,name:E,type:`hidden`,value:e.value}))),help:x,ids:{feedback:se,help:ce,input:Z,label:le},invalid:S,invalidFeedback:C,label:w,valid:j,validFeedback:M})});b.displayName=`ChipInput`;export{b as t};
|
|
2
|
-
//# sourceMappingURL=chip-input-BpVDRERg.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chip-input-BpVDRERg.js","names":[],"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 { useControllableState, useForkedRef, useFormField } 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.\n */\n invalid?: boolean\n /**\n * An error message for the field, rendered below the chips when `invalid` is set.\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 * 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\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,\n invalidFeedback,\n label,\n maxChips,\n name,\n onChange,\n placeholder,\n separator = ',',\n size,\n valid,\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 `addTag` 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 const addTag = (raw: string) => {\n const trimmed = raw.trim()\n if (!isAddableValue(tags, trimmed)) return\n if (maxChips != null && tags.length >= maxChips) return\n updateTags([...tags, trimmed])\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 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 addTag(inputValue)\n setInputValue('')\n return\n }\n\n switch (event.key) {\n case 'Enter': {\n event.preventDefault()\n addTag(inputValue)\n setInputValue('')\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 calling `addTag` per part: each call to `addTag` reads\n // `tags` from this render's closure, so several calls in a row within one event would all\n // start from the same 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 'aria-label': ariaLabel ?? (ariaLabelledBy || label ? undefined : 'Add value'),\n 'aria-labelledby': labelledBy,\n id: inputId,\n isDisabled: disabled,\n isInvalid: invalid,\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 className=\"ghost-input\"\n onPaste={handlePaste}\n ref={inputRef}\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":"+oBAwBA,MAAa,IAAY,CACvB,cACA,WACA,WACA,QACA,OACA,WACmB,CACnB,GAAM,CAAE,aAAc,EAAY,EAAO,EAAO,CAAQ,EAKxD,OACE,EAAA,cAAC,MAAD,CACE,GAAI,EACJ,mBAAkB,IAAA,GAClB,uBACE,EAAU,OAAS,OAAS,EAAU,wBAA0B,IAAA,GAElE,MAAO,CAAE,QAAS,UAAW,EAC7B,IAAK,CAYF,EAVF,CAAC,GAAG,EAAM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Ae,EAAU,iBAAiB,eAAe,EACzD,UAAW,GACX,cACA,MAAO,CACT,EACA,CACF,EAEA,OAAO,EAAgB,CACrB,SACE,EAAA,cAAC,MAAD,CACE,UAAW,EACT,aACA,aACA,EACA,CAAE,UAAS,EACX,EAAoB,EAAS,CAAK,EAClC,CACF,EACA,GAAI,EACJ,IAAK,CAgCF,EA9BH,EAAA,cAAC,GAAD,CACe,cACH,WACA,WACV,MAAO,CACL,aAAc,EACd,kBAAmB,EACnB,SAAU,EAAW,IAAA,GAAY,EACnC,EACM,OACN,MAAO,CACR,CAAA,EAED,EAAA,cAAC,QAAD,CACE,GAAI,EACJ,mBAAkB,EAClB,UAAU,cACV,QAAS,GACT,IAAK,CACN,CAAA,EACA,GACC,EAAM,IAAK,GACT,EAAA,cAAC,QAAD,CACY,WACV,IAAK,EAAK,GACJ,OACN,KAAK,SACL,MAAO,EAAK,KACb,CAAA,CACF,CACA,EAEP,OACA,IAAK,CAAE,SAAU,GAAY,KAAM,GAAQ,MAAO,EAAS,MAAO,EAAQ,EAC1E,UACA,kBACA,QACA,QACA,eACF,CAAC,CACH,CACF,EAEA,EAAU,YAAc"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collapse--Go2Y73B.js","names":[],"sources":["../../src/components/collapse/Collapse.tsx"],"sourcesContent":["import React, { forwardRef, HTMLAttributes, useRef, useState } from 'react'\nimport classNames from 'classnames'\n\nimport { TransitionPhase, useForkedRef, useTransitionState } from '../../hooks'\n\nexport interface CollapseProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Set horizontal collapsing to transition the width instead of height.\n */\n horizontal?: boolean\n /**\n * Callback fired when the component requests to be hidden.\n */\n onHide?: () => void\n /**\n * Callback fired when the component requests to be shown.\n */\n onShow?: () => void\n /**\n * Toggle the visibility of component.\n */\n visible?: boolean\n}\n\nconst getTransitionClass = (phase: TransitionPhase) =>\n phase === 'entering' || phase === 'exiting'\n ? 'collapsing'\n : phase === 'entered'\n ? 'collapse show'\n : 'collapse'\n\n// chassis-css animates the size itself and needs both ends of it as lengths: `.collapsing` is 0,\n// and the content's own size is `auto`, which a transition can't start from or end at. So the\n// open end is measured and set inline for as long as the transition runs, the way chassis-css's\n// own collapse plugin does it.\nexport const Collapse = forwardRef<HTMLDivElement, CollapseProps>(\n ({ children, className, horizontal, onHide, onShow, style, visible, ...rest }, ref) => {\n const [size, setSize] = useState<number>()\n const collapseRef = useRef<HTMLDivElement>(null)\n const forkedRef = useForkedRef(ref, collapseRef)\n const dimension = horizontal ? 'width' : 'height'\n\n const { phase } = useTransitionState({\n in: !!visible,\n nodeRef: collapseRef,\n // Reading the content's size also computes the 0 of `.collapsing`, which the transition\n // starts from.\n onEntering: () => {\n onShow?.()\n const node = collapseRef.current\n if (node) setSize(horizontal ? node.scrollWidth : node.scrollHeight)\n },\n onEntered: () => setSize(undefined),\n // Still open here: pin the size it has, as a length.\n onExit: () => {\n const node = collapseRef.current\n if (node) setSize(node.getBoundingClientRect()[dimension])\n },\n // Pinned and `.collapsing` now. Compute that, then let go, and it shrinks to 0.\n onExiting: () => {\n onHide?.()\n void collapseRef.current?.offsetHeight\n setSize(undefined)\n },\n onExited: () => setSize(undefined)\n })\n\n return (\n <div\n className={classNames(\n { 'collapse-horizontal': horizontal },\n className,\n getTransitionClass(phase)\n )}\n style={size ? { ...style, [dimension]: size } : style}\n {...rest}\n ref={forkedRef}\n >\n {children}\n </div>\n )\n }\n)\n\nCollapse.displayName = 'Collapse'\n"],"mappings":"0NA4BA,MAAM,EAAsB,GAC1B,IAAU,YAAc,IAAU,UAC9B,aACA,IAAU,UACR,gBACA,WAMK,EAAW,GACrB,CAAE,WAAU,YAAW,aAAY,SAAQ,SAAQ,QAAO,UAAS,GAAG,GAAQ,IAAQ,CACrF,GAAM,CAAC,EAAM,GAAW,EAAiB,EACnC,EAAc,EAAuB,IAAI,EACzC,EAAY,EAAa,EAAK,CAAW,EACzC,EAAY,EAAa,QAAU,SAEnC,CAAE,SAAU,EAAmB,CACnC,GAAI,CAAC,CAAC,EACN,QAAS,EAGT,eAAkB,CAChB,IAAS,EACT,IAAM,EAAO,EAAY,QACrB,GAAM,EAAQ,EAAa,EAAK,YAAc,EAAK,YAAY,CACrE,EACA,cAAiB,EAAQ,IAAA,EAAS,EAElC,WAAc,CACZ,IAAM,EAAO,EAAY,QACrB,GAAM,EAAQ,EAAK,sBAAsB,CAAC,CAAC,EAAU,CAC3D,EAEA,cAAiB,CACf,IAAS,EACT,EAAiB,SAAS,aAC1B,EAAQ,IAAA,EAAS,CACnB,EACA,aAAgB,EAAQ,IAAA,EAAS,CACnC,CAAC,EAED,OACE,EAAA,cAAC,MAAD,CACE,UAAW,EACT,CAAE,sBAAuB,CAAW,EACpC,EACA,EAAmB,CAAK,CAC1B,EACA,MAAO,EAAO,CAAE,GAAG,GAAQ,GAAY,CAAK,EAAI,EAChD,GAAI,EACJ,IAAK,CAGF,EADF,CACE,CAET,CACF,EAEA,EAAS,YAAc"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{t as e}from"./useFormField-BOqmBTC4.js";import{t}from"./renderFormField-Brkw1yA6.js";import{t as n}from"./validationClassName-gRGs4KBm.js";import r,{forwardRef as i}from"react";import a from"classnames";const o=i(({className:i,help:o,id:s,invalid:c,invalidFeedback:l,label:u,size:d,valid:f,validFeedback:p,...m},h)=>{let{describedBy:g,feedbackId:_,helpId:v,inputId:y}=e({ariaDescribedBy:m[`aria-describedby`],help:o,id:s,invalid:c,invalidFeedback:l,valid:f,validFeedback:p}),b=a(`form-input`,d,n(c,f),i);return t({children:r.createElement(`input`,{...m,"aria-describedby":g,"aria-invalid":c||void 0,className:b,id:y,ref:h,type:`color`}),help:o,ids:{feedback:_,help:v,input:y},invalid:c,invalidFeedback:l,label:u,valid:f,validFeedback:p})});o.displayName=`ColorInput`;export{o as t};
|
|
2
|
-
//# sourceMappingURL=color-input-Bwl5ef5B.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"color-input-Bwl5ef5B.js","names":[],"sources":["../../src/components/color-input/ColorInput.tsx"],"sourcesContent":["import React, { ChangeEventHandler, forwardRef, InputHTMLAttributes, ReactNode } from 'react'\nimport classNames from 'classnames'\n\nimport { useFormField } 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 { className, help, id, invalid, invalidFeedback, label, size, valid, validFeedback, ...rest },\n ref\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={ref}\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":"mPA4DA,MAAa,EAAa,GAEtB,CAAE,YAAW,OAAM,KAAI,UAAS,kBAAiB,QAAO,OAAM,QAAO,gBAAe,GAAG,GACvF,IACG,CACH,GAAM,CAAE,cAAa,aAAY,SAAQ,WAAY,EAAa,CAChE,gBAAiB,EAAK,oBACtB,OACA,KACA,UACA,kBACA,QACA,eACF,CAAC,EAEK,EAAa,EACjB,aACA,EACA,EAAoB,EAAS,CAAK,EAClC,CACF,EAEA,OAAO,EAAgB,CACrB,SACE,EAAA,cAAC,QAAD,CACE,GAAI,EACJ,mBAAkB,EAClB,eAAc,GAAW,IAAA,GACzB,UAAW,EACX,GAAI,EACC,MACL,KAAK,OACN,CAAA,EAEH,OACA,IAAK,CAAE,SAAU,EAAY,KAAM,EAAQ,MAAO,CAAQ,EAC1D,UACA,kBACA,QACA,QACA,eACF,CAAC,CACH,CACF,EAEA,EAAW,YAAc"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e={default:`bg-default`,alternate:`bg-alternate`,primary:`bg-primary`,secondary:`bg-secondary`,neutral:`bg-neutral`,success:`bg-success`,danger:`bg-danger`,warning:`bg-warning`,info:`bg-info`,black:`bg-black`,white:`bg-white`},t={default:`fg-default`,alternate:`fg-alternate`,primary:`fg-primary`,secondary:`fg-secondary`,neutral:`fg-neutral`,success:`fg-success`,danger:`fg-danger`,warning:`fg-warning`,info:`fg-info`,black:`fg-black`,white:`fg-white`},n={default:`icon-default`,alternate:`icon-alternate`,primary:`icon-primary`,secondary:`icon-secondary`,neutral:`icon-neutral`,success:`icon-success`,danger:`icon-danger`,warning:`icon-warning`,info:`icon-info`,black:`icon-black`,white:`icon-white`},r={default:`link-default`,alternate:`link-alternate`,primary:`link-primary`,secondary:`link-secondary`,neutral:`link-neutral`,success:`link-success`,danger:`link-danger`,warning:`link-warning`,info:`link-info`,black:`link-black`,white:`link-white`};export{r as i,t as n,n as r,e as t};
|
|
2
|
-
//# sourceMappingURL=colorClassNames-CEh5Yzfp.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"colorClassNames-CEh5Yzfp.js","names":[],"sources":["../../src/utils/colorClassNames.ts"],"sourcesContent":["import { ContextColor } from '../types'\n\n// The class of a context color, per family, as whole names: never `bg-${color}`.\n//\n// In the Tailwind entry of chassis-css these are utilities, generated only where Tailwind's\n// scanner finds the full class name in a source file, and it cannot read a name joined at\n// runtime: the class would have no rule, with no warning. A whole name in `dist` is found once a\n// project registers the package with `@source`. `test/utils/tailwindClassNames.spec.tsx` fails on\n// a utility name built from parts anywhere in `src/`.\n//\n// `Record<ContextColor, string>` fails the type check when a color joins the type and not a table.\n\nexport const BG_COLOR_CLASS_NAMES: Record<ContextColor, string> = {\n default: 'bg-default',\n alternate: 'bg-alternate',\n primary: 'bg-primary',\n secondary: 'bg-secondary',\n neutral: 'bg-neutral',\n success: 'bg-success',\n danger: 'bg-danger',\n warning: 'bg-warning',\n info: 'bg-info',\n black: 'bg-black',\n white: 'bg-white'\n}\n\nexport const FG_COLOR_CLASS_NAMES: Record<ContextColor, string> = {\n default: 'fg-default',\n alternate: 'fg-alternate',\n primary: 'fg-primary',\n secondary: 'fg-secondary',\n neutral: 'fg-neutral',\n success: 'fg-success',\n danger: 'fg-danger',\n warning: 'fg-warning',\n info: 'fg-info',\n black: 'fg-black',\n white: 'fg-white'\n}\n\nexport const ICON_COLOR_CLASS_NAMES: Record<ContextColor, string> = {\n default: 'icon-default',\n alternate: 'icon-alternate',\n primary: 'icon-primary',\n secondary: 'icon-secondary',\n neutral: 'icon-neutral',\n success: 'icon-success',\n danger: 'icon-danger',\n warning: 'icon-warning',\n info: 'icon-info',\n black: 'icon-black',\n white: 'icon-white'\n}\n\nexport const LINK_COLOR_CLASS_NAMES: Record<ContextColor, string> = {\n default: 'link-default',\n alternate: 'link-alternate',\n primary: 'link-primary',\n secondary: 'link-secondary',\n neutral: 'link-neutral',\n success: 'link-success',\n danger: 'link-danger',\n warning: 'link-warning',\n info: 'link-info',\n black: 'link-black',\n white: 'link-white'\n}\n"],"mappings":"AAYA,MAAa,EAAqD,CAChE,QAAS,aACT,UAAW,eACX,QAAS,aACT,UAAW,eACX,QAAS,aACT,QAAS,aACT,OAAQ,YACR,QAAS,aACT,KAAM,UACN,MAAO,WACP,MAAO,UACT,EAEa,EAAqD,CAChE,QAAS,aACT,UAAW,eACX,QAAS,aACT,UAAW,eACX,QAAS,aACT,QAAS,aACT,OAAQ,YACR,QAAS,aACT,KAAM,UACN,MAAO,WACP,MAAO,UACT,EAEa,EAAuD,CAClE,QAAS,eACT,UAAW,iBACX,QAAS,eACT,UAAW,iBACX,QAAS,eACT,QAAS,eACT,OAAQ,cACR,QAAS,eACT,KAAM,YACN,MAAO,aACP,MAAO,YACT,EAEa,EAAuD,CAClE,QAAS,eACT,UAAW,iBACX,QAAS,eACT,UAAW,iBACX,QAAS,eACT,QAAS,eACT,OAAQ,cACR,QAAS,eACT,KAAM,YACN,MAAO,aACP,MAAO,YACT"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{t as ee}from"./useForkedRef-DVEfT-KI.js";import{t as e}from"./Portal-CgeR1WXV.js";import{r as t}from"./useFloatingOverlay-DLIvwx-8.js";import{t as n}from"./useFormField-BOqmBTC4.js";import{i as r,r as i,t as te}from"./overlayPlacement-BtS90IVf.js";import{a as ne,i as re,n as a,o,r as s,t as c}from"./ComboboxListBox-Cm3L1ULl.js";import{t as l}from"./renderFormField-Brkw1yA6.js";import{t as u}from"./validationClassName-gRGs4KBm.js";import d,{forwardRef as f,useId as p,useMemo as m,useRef as h}from"react";import g from"classnames";import{useComboBox as _,useFilter as v,useOverlayPosition as ie}from"react-aria";import{useComboBoxState as ae}from"react-stately";const y=ee=>null;y.displayName=`ComboboxGroup`;const b=f(({"aria-describedby":f,"aria-label":b,"aria-labelledby":oe,children:x,className:S,defaultValue:C,disabled:w,help:T,id:E,invalid:D,invalidFeedback:O,items:k,label:A,name:j,noResultsText:M=`No results found`,onChange:N,placeholder:P,size:F,valid:I,validFeedback:L,value:R,...z},B)=>{let V=m(()=>k?s(k):a(x,{Group:y,Item:o}),[k,x]),H=m(()=>ne(V),[V]),{contains:U}=v({sensitivity:`base`}),W=ae({children:re,defaultItems:V,disabledKeys:H,defaultFilter:U,defaultValue:C,value:R,onChange:N,allowsEmptyCollection:!0,menuTrigger:`focus`}),G=h(null),K=ee(B,G),q=h(null),J=h(null),Y=h(null),X=p(),{describedBy:se,feedbackId:ce,helpId:le,inputId:Z,labelId:ue,labelledBy:de}=n({ariaDescribedBy:f,ariaLabelledBy:oe,help:T,id:E,invalid:D,invalidFeedback:O,label:A,valid:I,validFeedback:L}),{inputProps:fe,listBoxProps:pe}=_({"aria-label":b,"aria-labelledby":de,id:Z,inputRef:q,listBoxRef:J,popoverRef:Y,isDisabled:w,placeholder:P},W),{overlayProps:me,placement:Q}=ie({targetRef:G,overlayRef:Y,placement:r(`bottom-start`),offset:2,isOpen:W.isOpen,onClose:null}),he=t({close:W.close,isOpen:W.isOpen,triggerRef:G}),{menuStyle:ge,placementAttr:_e}=i(me.style,`bottom-start`,Q),ve={...te,...ge},ye=fe,$=W.collection.size===0,be=[se,$&&X].filter(Boolean).join(` `)||void 0;return l({children:d.createElement(d.Fragment,null,d.createElement(`div`,{className:g(`form-input`,`combobox`,F,{disabled:w},u(D,I),S),ref:K,...z},d.createElement(`input`,{autoComplete:`off`,className:`combobox-value`,...ye,"aria-describedby":be,"aria-invalid":D||void 0,ref:q})),d.createElement(e,{container:he},d.createElement(`div`,{className:g(`menu`,{show:W.isOpen}),"data-cx-placement":_e,style:ve,hidden:!W.isOpen,ref:Y},d.createElement(c,{state:W,listBoxProps:pe,listBoxRef:J}),$&&d.createElement(`div`,{className:`combobox-no-results`,id:X,role:`status`},M))),j&&d.createElement(`input`,{type:`hidden`,name:j,value:W.value??``,disabled:w})),help:T,ids:{feedback:ce,help:le,input:Z,label:ue},invalid:D,invalidFeedback:O,label:A,valid:I,validFeedback:L})});b.displayName=`Combobox`;export{y as n,b as t};
|
|
2
|
-
//# sourceMappingURL=combobox-Bp1tIaiW.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"combobox-Bp1tIaiW.js","names":[],"sources":["../../src/components/combobox/ComboboxGroup.tsx","../../src/components/combobox/Combobox.tsx"],"sourcesContent":["import { ReactNode } from 'react'\n\nexport interface ComboboxGroupProps {\n /**\n * Items belonging to this group.\n */\n children: ReactNode\n /**\n * Header content for the group (`.menu-header`).\n */\n label: ReactNode\n}\n\n// `ComboboxGroup` is never actually mounted — like `ComboboxItem`, it's read as data by\n// `Combobox`, 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// <Combobox aria-label=\"Language\">\n// <ComboboxGroup label=\"Frontend\">\n// <ComboboxItem id=\"html\">HTML</ComboboxItem>\n// <ComboboxItem id=\"css\">CSS</ComboboxItem>\n// </ComboboxGroup>\n// <ComboboxItem id=\"python\">Python</ComboboxItem>\n// </Combobox>\nexport const ComboboxGroup = (_props: ComboboxGroupProps): null => null\n\nComboboxGroup.displayName = 'ComboboxGroup'\n","import React, {\n forwardRef,\n HTMLAttributes,\n InputHTMLAttributes,\n ReactNode,\n useId,\n useMemo,\n useRef\n} from 'react'\nimport classNames from 'classnames'\nimport { useComboBox, useFilter, useOverlayPosition } from 'react-aria'\nimport { Key, useComboBoxState } from 'react-stately'\n\nimport { useFloatingOverlay, useForkedRef, useFormField } from '../../hooks'\nimport {\n buildEntriesFromChildren,\n buildEntriesFromItemsDef,\n ComboboxEntry,\n comboboxCollectionChildren,\n getDisabledKeys\n} from '../../utils/comboboxCollection'\nimport {\n COMBOBOX_MENU_OVERLAY_STYLE,\n resolveMenuOverlayPositioning,\n toAriaPlacement\n} from '../../utils/overlayPlacement'\nimport { Portal } from '../portal/Portal'\nimport { validationClassName } from '../../utils/validationClassName'\nimport { renderFormField } from '../form-field/renderFormField'\nimport { MenuItemsDef } from '../menu/MenuItemDef'\nimport { ComboboxGroup } from './ComboboxGroup'\nimport { ComboboxItem } from './ComboboxItem'\nimport { ComboboxListBox } from './ComboboxListBox'\n\nexport interface ComboboxProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'defaultValue'\n> {\n /**\n * An accessible label for the combobox, used when there's no visible `<label>`.\n */\n 'aria-label'?: string\n /**\n * Identifies a visible `<label>` element for the combobox.\n */\n 'aria-labelledby'?: string\n /**\n * `ComboboxItem` elements, optionally wrapped in `ComboboxGroup` — read as data by\n * `Combobox` 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 (uncontrolled).\n */\n defaultValue?: Key | null\n /**\n * Prevents the combobox from being focused or interacted with.\n */\n disabled?: boolean\n /**\n * A description for the field, rendered below the combobox.\n */\n help?: ReactNode\n /**\n * `id` forwarded to the input element — useful for pairing with a `<label for>`.\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 combobox when `invalid` is set.\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 (dividers aren't\n * meaningful for a listbox/option collection) — use `ComboboxGroup` composition instead if\n * you need finer control over grouping. An entry's `href`/`onClick` are `Menu`-only and are not\n * read here — use `onChange` to react to the selection instead.\n */\n items?: MenuItemsDef\n /**\n * The field's caption, rendered as a `FormLabel` associated with the input.\n */\n label?: ReactNode\n /**\n * `name` of an auto-created hidden input, kept in sync with the selection, for native form\n * submission. Omit to skip creating one.\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 selected option changes.\n */\n onChange?: (value: Key | null) => void\n /**\n * Placeholder shown in the input when nothing is selected.\n */\n placeholder?: string\n /**\n * Size the component sm or lg.\n */\n size?: 'sm' | 'lg'\n /**\n * Set component validation state to valid.\n */\n valid?: boolean\n /**\n * A success message for the field, rendered below the combobox when `valid` is set.\n */\n validFeedback?: ReactNode\n /**\n * The selected option's id (controlled).\n */\n value?: Key | null\n}\n\nexport const Combobox = forwardRef<HTMLDivElement, ComboboxProps>(\n (\n {\n 'aria-describedby': ariaDescribedBy,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n children,\n className,\n defaultValue,\n disabled,\n help,\n id,\n invalid,\n invalidFeedback,\n items,\n label,\n name,\n noResultsText = 'No results found',\n onChange,\n placeholder,\n size,\n valid,\n validFeedback,\n value,\n ...rest\n }: ComboboxProps,\n ref\n ): ReactNode => {\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: ComboboxGroup, Item: ComboboxItem }),\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 const state = useComboBoxState<ComboboxEntry>({\n children: comboboxCollectionChildren,\n defaultItems: entries,\n disabledKeys,\n defaultFilter: contains,\n defaultValue,\n value,\n onChange,\n allowsEmptyCollection: true,\n // Matches chassis-css's vanilla combobox.js: the menu opens on focus, not only once the\n // user starts typing.\n menuTrigger: 'focus'\n })\n\n const wrapperRef = useRef<HTMLDivElement>(null)\n const forkedWrapperRef = useForkedRef(ref, wrapperRef)\n const inputRef = useRef<HTMLInputElement>(null)\n const listBoxRef = useRef<HTMLElement>(null)\n const popoverRef = useRef<HTMLDivElement>(null)\n const noResultsId = useId()\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, listBoxProps } = useComboBox<ComboboxEntry>(\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': labelledBy,\n id: inputId,\n inputRef,\n listBoxRef,\n popoverRef,\n isDisabled: disabled,\n placeholder\n },\n state\n )\n\n const { overlayProps, placement: resolvedPlacement } = useOverlayPosition({\n targetRef: wrapperRef,\n overlayRef: popoverRef,\n placement: toAriaPlacement('bottom-start'),\n offset: 2,\n isOpen: state.isOpen,\n // Leaving `onClose` unset doesn't actually disable react-aria's close-on-scroll listener —\n // only an explicit `null` does. Matches the fix already applied to `Autocomplete`'s identical\n // positioning call.\n onClose: null\n })\n\n // Portals the panel to `document.body` (or an enclosing open `<dialog>`) instead of rendering\n // it inline, matching `Popover`/`Tooltip` — an inline-rendered panel gets clipped by any\n // ancestor with `overflow: hidden`/`auto` (a `ModalBody`, a scrollable card, a table cell), and\n // `Combobox` is commonly composed inside exactly those. See `COMBOBOX_MENU_OVERLAY_STYLE` for\n // the styling this trades away by leaving the DOM position `.combobox + .menu` relies on.\n const portalContainer = useFloatingOverlay({\n close: state.close,\n isOpen: state.isOpen,\n triggerRef: wrapperRef\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 inputHtmlProps = inputProps as InputHTMLAttributes<HTMLInputElement>\n const showNoResults = state.collection.size === 0\n // Merges the no-results message into the input's own description (for AT that reads\n // descriptions on demand) in addition to the `aria-live` region below (for AT that announces\n // live-region changes proactively as the user types) — belt and braces, since screen reader\n // support for announcing a freshly-mounted live region is inconsistent.\n const inputDescribedBy =\n [describedBy, showNoResults && noResultsId].filter(Boolean).join(' ') || undefined\n\n return renderFormField({\n children: (\n <>\n <div\n className={classNames(\n 'form-input',\n 'combobox',\n size,\n { disabled },\n validationClassName(invalid, valid),\n className\n )}\n ref={forkedWrapperRef}\n {...rest}\n >\n <input\n autoComplete=\"off\"\n className=\"combobox-value\"\n {...inputHtmlProps}\n aria-describedby={inputDescribedBy}\n aria-invalid={invalid || undefined}\n ref={inputRef}\n />\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 <ComboboxListBox state={state} listBoxProps={listBoxProps} listBoxRef={listBoxRef} />\n {showNoResults && (\n <div className=\"combobox-no-results\" id={noResultsId} role=\"status\">\n {noResultsText}\n </div>\n )}\n </div>\n </Portal>\n {name && (\n <input type=\"hidden\" name={name} value={state.value ?? ''} disabled={disabled} />\n )}\n </>\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\nCombobox.displayName = 'Combobox'\n"],"mappings":"isBAwBA,MAAa,EAAiB,IAAqC,KAEnE,EAAc,YAAc,gBCqG5B,MAAa,EAAW,GAEpB,CACE,mBAAoB,EACpB,aAAc,EACd,kBAAmB,GACnB,WACA,YACA,eACA,WACA,OACA,KACA,UACA,kBACA,QACA,QACA,OACA,gBAAgB,mBAChB,WACA,cACA,OACA,QACA,gBACA,QACA,GAAG,GAEL,IACc,CAGd,IAAM,EAAU,MAEZ,EACI,EAAyB,CAAK,EAC9B,EAAyB,EAAU,CAAE,MAAO,EAAe,KAAM,CAAa,CAAC,EACrF,CAAC,EAAO,CAAQ,CAClB,EACM,EAAe,MAAc,GAAgB,CAAO,EAAG,CAAC,CAAO,CAAC,EAIhE,CAAE,YAAa,EAAU,CAAE,YAA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Ac,GAAW,IAAA,GACzB,IAAK,CACN,CAAA,CACE,EACL,EAAA,cAAC,EAAD,CAAQ,UAAW,EAeX,EAdN,EAAA,cAAC,MAAD,CACE,UAAW,EAAW,OAAQ,CAAE,KAAM,EAAM,MAAO,CAAC,EACpD,oBAAmB,GACnB,MAAO,GACP,OAAQ,CAAC,EAAM,OACf,IAAK,CAQF,EANH,EAAA,cAAC,EAAD,CAAwB,QAAqB,gBAA0B,YAAa,CAAA,EACnF,GACC,EAAA,cAAC,MAAD,CAAK,UAAU,sBAAsB,GAAI,EAAa,KAAK,QAEtD,EADF,CACE,CAEJ,CACC,EACP,GACC,EAAA,cAAC,QAAD,CAAO,KAAK,SAAe,OAAM,MAAO,EAAM,OAAS,GAAc,UAAW,CAAA,CAElF,EAEJ,OACA,IAAK,CAAE,SAAU,GAAY,KAAM,GAAQ,MAAO,EAAS,MAAO,EAAQ,EAC1E,UACA,kBACA,QACA,QACA,eACF,CAAC,CACH,CACF,EAEA,EAAS,YAAc"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{t as e}from"./useForkedRef-DVEfT-KI.js";import{t}from"./polymorphic-BhGNZQja.js";import{t as n}from"./useIsomorphicLayoutEffect-BbqRwuqn.js";import{r}from"./useFloatingOverlay-DLIvwx-8.js";import{t as i}from"./useOpenStateProps-DykUbnPJ.js";import{i as a,r as ee}from"./overlayPlacement-BtS90IVf.js";import{n as te}from"./Menu-CSBg2Zmc.js";import o,{useEffect as s,useId as c,useMemo as ne,useRef as l,useState as u}from"react";import re from"classnames";import{mergeProps as d,useLocale as f,useOverlayPosition as p}from"react-aria";import{useMenuTriggerState as m}from"react-stately";const h=(e,t)=>({x:e,y:t,top:t,left:e,right:e,bottom:t,width:0,height:0,toJSON:()=>({x:e,y:t,width:0,height:0})});function g({children:t,autoClose:g=!0,className:_,component:v,defaultVisible:y,disabled:b=!1,id:x,onHide:ie,onShow:ae,onVisibleChange:oe,visible:se,...ce},le){let ue=v??`div`,S=c(),[C,de]=u(()=>x??`${S}-trigger`),w=`${S}-menu`,T=l(null),E=e(le,T);n(()=>{let e=T.current?.id;e&&e!==C&&de(e)},[C]),n(()=>{T.current?.style.setProperty(`-webkit-touch-callout`,`none`)},[]);let D=l(null),O=l(null),k=l(null),A=l(new Map),j=(e,t)=>{t?A.current.set(e,t):A.current.delete(e)},M=m(i({defaultVisible:y,onVisibleChange:oe,visible:se},`ContextMenu`)),N=l(null),[P,F]=u(0),I=l(null),L=e=>{b||(N.current=e,M.isOpen||(I.current=document.activeElement),F(e=>e+1),M.open(`first`))},R=()=>{I.current=null,M.close()},z=()=>M.close();s(()=>{if(M.isOpen)return;let e=I.current;if(I.current=null,!e||!document.contains(e))return;let t=document.activeElement,n=!t||t===document.body,r=!!t&&!!D.current?.contains(t);(n||r)&&e.focus()},[M.isOpen]);let B=r({close:M.close,isOpen:M.isOpen,onHide:ie,onShow:ae,triggerRef:T}),{direction:V}=f(),H=V===`rtl`?`bottom-end`:`bottom-start`,{overlayProps:fe,placement:pe,updatePosition:me}=p({targetRef:T,overlayRef:D,placement:a(H),containerPadding:8,isOpen:M.isOpen,onClose:null,getTargetRect:()=>{let e=N.current;if(e)return e.kind===`point`?h(e.x,e.y):e.element.getBoundingClientRect()}});n(()=>{M.isOpen&&me()},[M.isOpen,P]);let{menuStyle:U,placementAttr:W}=ee(fe.style,H,pe);s(()=>{if(!M.isOpen||g===!1)return;let e=e=>!!D.current?.contains(e)||Array.from(A.current.values()).some(t=>t.contains(e)),t=t=>{let n=t.target;e(n)||g===`inside`||t.button===2&&T.current?.contains(n)||R()},n=t=>{let n=t.target;e(n)&&g!==`outside`&&(/input|select|option|textarea|form/i.test(n.tagName??``)||z())},r=t=>{t.key!==`Tab`||e(t.target)||R()};return window.addEventListener(`pointerdown`,t),window.addEventListener(`click`,n),window.addEventListener(`keyup`,r),()=>{window.removeEventListener(`pointerdown`,t),window.removeEventListener(`click`,n),window.removeEventListener(`keyup`,r)}},[M.isOpen,g]),s(()=>{if(!M.isOpen)return;let e=e=>{e.key===`Escape`&&z()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[M.isOpen]);let G=l(b);s(()=>{b&&!G.current&&R(),G.current=b},[b]);let K=e=>e.currentTarget.contains(e.target),he=e=>{b||(e.preventDefault(),K(e)&&L({kind:`point`,x:e.clientX,y:e.clientY}))},q=e=>e.key===`ContextMenu`||e.key===`F10`&&e.shiftKey,ge=e=>{!b&&q(e)&&(e.preventDefault(),K(e)&&L({kind:`element`,element:e.target}))},_e=e=>{!b&&q(e)&&e.preventDefault()},J=l(null),Y=l(null),ve=()=>{let e=T.current;e&&Y.current!==null&&(e.style.setProperty(`-webkit-user-select`,Y.current),e.style.setProperty(`user-select`,Y.current),Y.current=null)},X=()=>{J.current&&=(window.clearTimeout(J.current.timer),null)},Z=()=>{X(),ve()},Q=l(null),$=()=>{Q.current?.(),Q.current=null},ye=()=>{$();let e=e=>{e.preventDefault(),e.stopPropagation(),$()};window.addEventListener(`click`,e,{capture:!0});let t=window.setTimeout($,1e3);Q.current=()=>{window.removeEventListener(`click`,e,{capture:!0}),window.clearTimeout(t)}};s(()=>()=>{Z(),$()},[]);let be=e=>{if(b||e.pointerType===`mouse`||!K(e))return;Z();let t=e.currentTarget;Y.current=t.style.getPropertyValue(`user-select`),t.style.setProperty(`-webkit-user-select`,`none`),t.style.setProperty(`user-select`,`none`);let{clientX:n,clientY:r}=e;J.current={x:n,y:r,timer:window.setTimeout(()=>{J.current=null,ye(),L({kind:`point`,x:n,y:r})},500)}},xe=e=>{let t=J.current;t&&Math.hypot(e.clientX-t.x,e.clientY-t.y)>10&&X()},Se=ne(()=>({autoClose:g,close:z,container:B??!0,focusStrategy:M.focusStrategy,hide:R,menuId:w,menuStyle:U,menuTriggerProps:{},overlayRef:D,placementAttr:W,reference:`toggle`,registerOverlay:j,show:e=>M.open(e??`first`),targetRef:k,toggle:e=>M.toggle(e??`first`),toggleNodeRef:O,triggerId:C,visible:M.isOpen}),[g,w,U,W,B,M.focusStrategy,M.isOpen,C]);return o.createElement(te.Provider,{value:Se},o.createElement(ue,{id:C,className:re(`context-menu`,_),...d({onContextMenu:he,onKeyDown:ge,onKeyUp:_e,onPointerDown:be,onPointerMove:xe,onPointerUp:Z,onPointerCancel:Z,onPointerLeave:Z},ce),ref:E},t))}const _=t(g,`ContextMenu`);export{_ as t};
|
|
2
|
-
//# sourceMappingURL=context-menu-B4a0tS-h.js.map
|