@chassis-ui/react 0.4.1 → 0.5.1
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-BiE9CzNk.js +2 -0
- package/dist/chunks/Menu-BiE9CzNk.js.map +1 -0
- package/dist/chunks/{Menu-QeYOzrUL.d.ts → Menu-CCYshRuL.d.ts} +3 -2
- package/dist/chunks/MenuToggle-W-ZSHFwF.js +2 -0
- package/dist/chunks/MenuToggle-W-ZSHFwF.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-Btcsjrh3.js +2 -0
- package/dist/chunks/autocomplete-Btcsjrh3.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-DNqR4d3V.js +2 -0
- package/dist/chunks/combobox-DNqR4d3V.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-D3DNFN-P.js +2 -0
- package/dist/chunks/context-menu-D3DNFN-P.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-Bqlhottl.js +2 -0
- package/dist/chunks/menu-Bqlhottl.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-GWARvoQZ.js +2 -0
- package/dist/chunks/nav-overflow-GWARvoQZ.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-DTgbr4UQ.js +2 -0
- package/dist/chunks/useOverlayMaxHeight-DTgbr4UQ.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,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{t as e}from"./useForkedRef-DVEfT-KI.js";import{t}from"./useFormField-BOqmBTC4.js";import{t as n}from"./iconSlot-BNu2MrFI.js";import{t as r}from"./renderFormField-Brkw1yA6.js";import{t as i}from"./validationClassName-gRGs4KBm.js";import{r as a,t as o}from"./unhandledProps-9Kdj7WVf.js";import s,{forwardRef as c,useRef as l}from"react";import u from"classnames";import{mergeProps as d,useButton as f,useSearchField as p}from"react-aria";import{useSearchFieldState as m}from"react-stately";function h({ariaLabel:e,buttonProps:t,icon:r}){let i=l(null),{buttonProps:a}=f({...t,"aria-label":e??t[`aria-label`]},i);return s.createElement(`button`,{...a,className:`button icon-only input-adorn search-field-clear`,ref:i},s.createElement(n,{icon:`clear`,override:r}))}const g=c(({className:c,clearAriaLabel:f,clearIcon:g,defaultValue:_,disabled:v,help:y,id:b,invalid:x,invalidFeedback:S,label:C,onChange:w,onClear:T,onSubmit:E,readOnly:D,searchIcon:O,size:k,style:A,valid:j,validFeedback:M,value:N,...P},F)=>{let I=l(null),L=e(F,I),{describedBy:R,feedbackId:z,helpId:B,inputId:V,labelId:H,labelledBy:U}=t({ariaDescribedBy:P[`aria-describedby`],ariaLabelledBy:P[`aria-labelledby`],help:y,id:b,invalid:x,invalidFeedback:S,label:C,valid:j,validFeedback:M}),W={...P,"aria-describedby":R,"aria-labelledby":U,defaultValue:_,id:V,isDisabled:v,isInvalid:x,isReadOnly:D,onChange:w,onClear:T,onSubmit:E,value:N},G=m(W),{clearButtonProps:K,inputProps:q}=p(W,G,I);return r({children:s.createElement(`div`,{className:u(`form-input`,`search-field`,k,c),style:A},O!==!1&&s.createElement(`span`,{className:`input-adorn search-field-icon`},s.createElement(n,{icon:`search`,override:O})),s.createElement(`input`,{...a(d(q,{onKeyDown:e=>{let t=e.shiftKey||e.altKey||e.ctrlKey||e.metaKey;E&&e.key===`Enter`&&!e.nativeEvent.isComposing&&(t||D)&&(e.preventDefault(),E(G.value))}}),P,o),"aria-describedby":R,className:u(`ghost-input`,i(x,j)),ref:L}),G.value!==``&&!v&&!D&&s.createElement(h,{ariaLabel:f,buttonProps:K,icon:g})),help:y,ids:{feedback:z,help:B,input:V,label:H},invalid:x,invalidFeedback:S,label:C,valid:j,validFeedback:M})});g.displayName=`SearchField`;export{g as t};
|
|
2
|
-
//# sourceMappingURL=search-field--nDoCI_E.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search-field--nDoCI_E.js","names":[],"sources":["../../src/components/search-field/SearchField.tsx"],"sourcesContent":["import React, {\n forwardRef,\n InputHTMLAttributes,\n KeyboardEvent,\n ReactNode,\n RefObject,\n useRef\n} from 'react'\nimport classNames from 'classnames'\nimport { AriaSearchFieldProps, mergeProps, useButton, useSearchField } from 'react-aria'\nimport { useSearchFieldState } from 'react-stately'\n\nimport './SearchField.scss'\nimport { useForkedRef, useFormField } from '../../hooks'\nimport { IconValue } from '../../utils/iconConfig'\nimport { IconSlot } from '../../utils/iconSlot'\nimport { mergeUnhandledProps, TEXT_FIELD_PROPS } from '../../utils/unhandledProps'\nimport { validationClassName } from '../../utils/validationClassName'\nimport { renderFormField } from '../form-field/renderFormField'\n\nexport interface SearchFieldProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'defaultValue' | 'onChange' | 'onSubmit' | 'size' | 'type' | 'value'\n> {\n /**\n * The accessible name of the clear button. Defaults to react-aria's, in the locale's language\n * (\"Clear search\").\n */\n clearAriaLabel?: string\n /**\n * The icon of the clear button, in place of `IconProvider`'s `clear` icon.\n */\n clearIcon?: IconValue\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * The value of the field, 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 it.\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 it when `invalid` is set.\n */\n invalidFeedback?: ReactNode\n /**\n * The field's caption, rendered as a `FormLabel` associated with the input.\n */\n label?: ReactNode\n /**\n * Handler that is called when the value changes.\n */\n onChange?: (value: string) => void\n /**\n * Handler that is called when the field is cleared, by the clear button or the Escape key.\n */\n onClear?: () => void\n /**\n * Handler that is called when the Enter key is pressed, with the value. When set, Enter, with\n * or without a modifier key, no longer submits the input's form.\n */\n onSubmit?: (value: string) => void\n /**\n * Toggle the readonly state for the component.\n */\n readOnly?: boolean\n /**\n * The icon at the field's start, in place of `IconProvider`'s `search` icon. `false` leaves it\n * out.\n */\n searchIcon?: IconValue | false\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 it when `valid` is set.\n */\n validFeedback?: ReactNode\n /**\n * The value of the field, controlled.\n */\n value?: string\n}\n\n// The clear button. A `<button>` react-aria keeps out of the tab order, since Escape does the\n// same; a press leaves focus on the input.\nfunction ClearButton({\n ariaLabel,\n buttonProps,\n icon\n}: {\n ariaLabel?: string\n buttonProps: ReturnType<typeof useSearchField>['clearButtonProps']\n icon?: IconValue\n}) {\n const ref = useRef<HTMLButtonElement>(null)\n const { buttonProps: props } = useButton(\n { ...buttonProps, 'aria-label': ariaLabel ?? buttonProps['aria-label'] },\n ref as RefObject<HTMLButtonElement | null>\n )\n return (\n <button {...props} className=\"button icon-only input-adorn search-field-clear\" ref={ref}>\n <IconSlot icon=\"clear\" override={icon} />\n </button>\n )\n}\n\nexport const SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(\n (\n {\n className,\n clearAriaLabel,\n clearIcon,\n defaultValue,\n disabled,\n help,\n id,\n invalid,\n invalidFeedback,\n label,\n onChange,\n onClear,\n onSubmit,\n readOnly,\n searchIcon,\n size,\n style,\n valid,\n validFeedback,\n value,\n ...rest\n },\n ref\n ) => {\n const inputRef = useRef<HTMLInputElement>(null)\n const forkedRef = useForkedRef(ref, inputRef)\n\n const { describedBy, feedbackId, helpId, inputId, labelId, labelledBy } = useFormField({\n ariaDescribedBy: rest['aria-describedby'],\n ariaLabelledBy: rest['aria-labelledby'],\n help,\n id,\n invalid,\n invalidFeedback,\n label,\n valid,\n validFeedback\n })\n\n const fieldProps = {\n ...rest,\n 'aria-describedby': describedBy,\n 'aria-labelledby': labelledBy,\n defaultValue,\n id: inputId,\n isDisabled: disabled,\n isInvalid: invalid,\n isReadOnly: readOnly,\n onChange,\n onClear,\n onSubmit,\n value\n } as AriaSearchFieldProps\n const state = useSearchFieldState(fieldProps)\n const { clearButtonProps, inputProps } = useSearchField(fieldProps, state, inputRef)\n\n // react-aria's Enter shortcut matches Enter alone, and a read-only field has none, so with\n // `onSubmit` Shift+Enter, or Enter in a read-only field, would still submit the form.\n const submitProps = {\n onKeyDown: (event: KeyboardEvent<HTMLInputElement>) => {\n const modified = event.shiftKey || event.altKey || event.ctrlKey || event.metaKey\n if (!onSubmit || event.key !== 'Enter' || event.nativeEvent.isComposing) return\n if (!modified && !readOnly) return\n event.preventDefault()\n onSubmit(state.value)\n }\n }\n\n return renderFormField({\n // The input adorn shape of chassis-css: a `.form-input` around a `.ghost-input`, which takes\n // the validation classes, with the icon and the clear button as `.input-adorn`s. `style`\n // goes on the wrapper, with `className`. `aria-describedby` after the spread: react-aria's\n // own adds ids it never renders (FORMS.md, gotcha 6).\n children: (\n <div className={classNames('form-input', 'search-field', size, className)} style={style}>\n {searchIcon !== false && (\n <span className=\"input-adorn search-field-icon\">\n <IconSlot icon=\"search\" override={searchIcon} />\n </span>\n )}\n <input\n {...mergeUnhandledProps(mergeProps(inputProps, submitProps), rest, TEXT_FIELD_PROPS)}\n aria-describedby={describedBy}\n className={classNames('ghost-input', validationClassName(invalid, valid))}\n ref={forkedRef}\n />\n {state.value !== '' && !disabled && !readOnly && (\n <ClearButton\n ariaLabel={clearAriaLabel}\n buttonProps={clearButtonProps}\n icon={clearIcon}\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\nSearchField.displayName = 'SearchField'\n"],"mappings":"ghBAuGA,SAAS,EAAY,CACnB,YACA,cACA,QAKC,CACD,IAAM,EAAM,EAA0B,IAAI,EACpC,CAAE,YAA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,EACtB,CAgB+D,CAAC,EAAG,EAAM,CAAgB,EACnF,mBAAkB,EAClB,UAAW,EAAW,cAAe,EAAoB,EAAS,CAAK,CAAC,EACxE,IAAK,CACN,CAAA,EACA,EAAM,QAAU,IAAM,CAAC,GAAY,CAAC,GACnC,EAAA,cAAC,EAAD,CACE,UAAW,EACX,YAAa,EACb,KAAM,CACP,CAAA,CAEA,EAEP,OACA,IAAK,CAAE,SAAU,EAAY,KAAM,EAAQ,MAAO,EAAS,MAAO,CAAQ,EAC1E,UACA,kBACA,QACA,QACA,eACF,CAAC,CACH,CACF,EAEA,EAAY,YAAc"}
|
|
@@ -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"./useFormField-BOqmBTC4.js";import{t as r}from"./renderFormField-Brkw1yA6.js";import{t as i}from"./validationClassName-gRGs4KBm.js";import a,{forwardRef as o,useRef as s}from"react";import c from"classnames";const l=o(({adornEnd:o,adornStart:l,children:u,className:d,help:f,htmlSize:p,id:m,invalid:h,invalidFeedback:g,label:_,multiple:v,options:y,placeholder:b,size:x,valid:S,validFeedback:C,...w},T)=>{let E=s(null),D=t(T,E),O=Array.isArray(y)?y.filter(e=>typeof e==`object`&&!!e.selected).map(e=>String(e.value??``)):[];e(!v&&O.length>1,"Select: more than one option has `selected: true` but `multiple` is not set — only the last one will be selected, matching native <select> behavior.");let k=O.length&&w.value===void 0&&w.defaultValue===void 0?v?O:O[O.length-1]:void 0,{describedBy:A,feedbackId:j,helpId:M,inputId:N}=n({ariaDescribedBy:w[`aria-describedby`],help:f,id:m,invalid:h,invalidFeedback:g,valid:S,validFeedback:C}),P=l!=null||o!=null,F=!v&&(!p||p<=1),I=c(P?`ghost-input`:`form-input`,!P&&x,i(h,S),!P&&d),L=e=>{let t=E.current,n=e.target;if(t&&!t.disabled&&F&&n!==t&&!n.closest(`button, a`)){t.focus();try{t.showPicker?.()}catch{}}},R=a.createElement(`select`,{...w,"aria-describedby":A,"aria-invalid":h||void 0,className:I,id:N,multiple:v,ref:D,size:p,...k!==void 0&&{defaultValue:k}},b&&a.createElement(`option`,{value:``,disabled:!0},b),y?y.map((e,t)=>a.createElement(`option`,{...typeof e==`object`&&e.disabled&&{disabled:e.disabled},...typeof e==`object`&&e.value!=null&&{value:e.value},key:t},typeof e==`string`?e:e.label??String(e.value??``))):u),z=P?a.createElement(`div`,{className:c(`form-input`,F&&`form-caret`,x,d),onClick:L},l,R,o):R;return r({children:z,help:f,ids:{feedback:j,help:M,input:N},invalid:h,invalidFeedback:g,label:_,valid:S,validFeedback:C})});l.displayName=`Select`;export{l as t};
|
|
2
|
-
//# sourceMappingURL=select-BwJIfv9f.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"select-BwJIfv9f.js","names":[],"sources":["../../src/components/select/Select.tsx"],"sourcesContent":["import React, {\n ChangeEventHandler,\n forwardRef,\n InputHTMLAttributes,\n MouseEventHandler,\n ReactNode,\n useRef\n} from 'react'\nimport classNames from 'classnames'\n\nimport { useForkedRef, useFormField } from '../../hooks'\nimport { validationClassName } from '../../utils/validationClassName'\nimport { renderFormField } from '../form-field/renderFormField'\nimport { devWarning } from '../../utils/devWarning'\n\nexport interface SelectOptionDef {\n /**\n * Marks the option as disabled — it can't be clicked or reached via the keyboard.\n */\n disabled?: boolean\n /**\n * Label text rendered inside the option. Falls back to the browser's default (the `value`,\n * stringified) when omitted.\n */\n label?: string\n /**\n * Marks the option as selected by default (uncontrolled) — resolved into the select's own\n * `defaultValue`, and ignored when the select's `value`/`defaultValue` is set directly. Set on\n * more than one option only when `multiple` is also set on `Select` — otherwise, matching\n * native `<select>` behavior, only the last option with `selected` set wins.\n */\n selected?: boolean\n /**\n * The option's value attribute.\n */\n value?: string | number\n}\nexport interface SelectProps extends Omit<InputHTMLAttributes<HTMLSelectElement>, 'size'> {\n /**\n * Content rendered at the select's trailing edge, e.g. a `InputAdorn` icon, text, or button.\n * Setting either `adornStart` or `adornEnd` renders a `.form-input` wrapper around a\n * `.ghost-input`, matching chassis-css's [input help](https://chassis-ui.com/css/docs/forms/input-adorn) pattern.\n * Clicking anywhere in the wrapper (other than an actionable adorn) opens the select, since the\n * native element itself no longer fills the wrapper's full width.\n */\n adornEnd?: ReactNode\n /**\n * Content rendered at the select's leading edge, e.g. a `InputAdorn` icon, text, or button.\n * Setting either `adornStart` or `adornEnd` renders a `.form-input` wrapper around a\n * `.ghost-input`, matching chassis-css's [input help](https://chassis-ui.com/css/docs/forms/input-adorn) pattern.\n * Clicking anywhere in the wrapper (other than an actionable adorn) opens the select, since the\n * native element itself no longer fills the wrapper's full width.\n */\n adornStart?: ReactNode\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * A description for the field, rendered below the select.\n */\n help?: ReactNode\n /**\n * Specifies the number of visible options in a drop-down list.\n */\n htmlSize?: number\n /**\n * Set component validation state to invalid.\n */\n invalid?: boolean\n /**\n * An error message for the field, rendered below the select when `invalid` is set.\n */\n invalidFeedback?: ReactNode\n /**\n * The field's caption, rendered as a `FormLabel` associated with this select.\n */\n label?: ReactNode\n /**\n * Allows more than one option to be selected at once. Pass `value` as a string array (or set\n * `selected` on more than one `options` entry) to control the selection.\n */\n multiple?: boolean\n /**\n * Method called immediately after the `value` prop changes.\n */\n onChange?: ChangeEventHandler<HTMLSelectElement>\n /**\n * Options list of the select component. Available keys: `label`, `value`, `disabled`,\n * `selected`.\n * Examples:\n * - `options={[{ value: 'js', label: 'JavaScript' }, { value: 'html', label: 'HTML', disabled: true }]}`\n * - `options={['js', 'html']}`\n */\n options?: SelectOptionDef[] | string[]\n /**\n * Renders a disabled placeholder option as the first item (e.g. `\"Select a country…\"`).\n * The option has an empty value so it is not selectable once another option is chosen.\n */\n placeholder?: string\n /**\n * Size the component sm or lg.\n */\n size?: 'sm' | 'lg'\n /**\n * Set component validation state to valid.\n */\n valid?: boolean\n /**\n * A success message for the field, rendered below the select when `valid` is set.\n */\n validFeedback?: ReactNode\n /**\n * The `value` attribute of component.\n *\n * @controllable onChange\n * */\n value?: string | string[] | number\n}\n\nexport const Select = forwardRef<HTMLSelectElement, SelectProps>(\n (\n {\n adornEnd,\n adornStart,\n children,\n className,\n help,\n htmlSize,\n id,\n invalid,\n invalidFeedback,\n label,\n multiple,\n options,\n placeholder,\n size,\n valid,\n validFeedback,\n ...rest\n },\n ref\n ) => {\n const selectRef = useRef<HTMLSelectElement>(null)\n const forkedRef = useForkedRef(ref, selectRef)\n\n const selectedValues = Array.isArray(options)\n ? options\n .filter(\n (option): option is SelectOptionDef => typeof option === 'object' && !!option.selected\n )\n .map((option) => String(option.value ?? ''))\n : []\n\n devWarning(\n !multiple && selectedValues.length > 1,\n 'Select: more than one option has `selected: true` but `multiple` is not set — only ' +\n 'the last one will be selected, matching native <select> behavior.'\n )\n\n // React warns against setting `selected` directly on <option>, recommending `defaultValue`/\n // `value` on <select> instead — so `options[].selected` is resolved into a `defaultValue`\n // here rather than rendered as an attribute. Left alone when the caller already controls\n // `value`/`defaultValue` themselves.\n const inferredDefaultValue =\n selectedValues.length && rest.value === undefined && rest.defaultValue === undefined\n ? multiple\n ? selectedValues\n : selectedValues[selectedValues.length - 1]\n : undefined\n\n const { describedBy, feedbackId, helpId, inputId } = useFormField({\n ariaDescribedBy: rest['aria-describedby'],\n help,\n id,\n invalid,\n invalidFeedback,\n valid,\n validFeedback\n })\n\n const hasAdorn = adornStart != null || adornEnd != null\n // A caret can only pop the dropdown open when the select actually renders as one - an inline\n // listbox (`multiple`, or a `size` greater than 1) has no picker to show.\n const isDropdown = !multiple && (!htmlSize || htmlSize <= 1)\n\n // chassis-css's `.form-input:has(.ghost-input.is-valid)` selector reads validation state off\n // the inner select, not the wrapper, once adorns turn `.form-input` into a flex container -\n // see https://chassis-ui.com/css/docs/forms/input-adorn.\n const selectClassName = classNames(\n hasAdorn ? 'ghost-input' : 'form-input',\n !hasAdorn && size,\n validationClassName(invalid, valid),\n !hasAdorn && className\n )\n\n const handleWrapperClick: MouseEventHandler<HTMLDivElement> = (event) => {\n const node = selectRef.current\n const target = event.target as HTMLElement\n if (!node || node.disabled || !isDropdown || target === node || target.closest('button, a'))\n return\n node.focus()\n try {\n // showPicker() opens the native dropdown from a proxy click; unsupported browsers fall\n // back to the focus() above, same as tabbing to a bare select and pressing Space/Down.\n node.showPicker?.()\n } catch {\n // Can throw without a user activation or under a policy-restricted embed - focus() still\n // leaves the select reachable via the keyboard.\n }\n }\n\n const select = (\n <select\n {...rest}\n aria-describedby={describedBy}\n aria-invalid={invalid || undefined}\n className={selectClassName}\n id={inputId}\n multiple={multiple}\n ref={forkedRef}\n size={htmlSize}\n {...(inferredDefaultValue !== undefined && { defaultValue: inferredDefaultValue })}\n >\n {placeholder && (\n <option value=\"\" disabled>\n {placeholder}\n </option>\n )}\n {options\n ? options.map((option, index) => {\n return (\n <option\n {...(typeof option === 'object' &&\n option.disabled && { disabled: option.disabled })}\n {...(typeof option === 'object' &&\n option.value != null && { value: option.value })}\n // eslint-disable-next-line react/no-array-index-key\n key={index}\n >\n {typeof option === 'string'\n ? option\n : (option.label ?? String(option.value ?? ''))}\n </option>\n )\n })\n : children}\n </select>\n )\n\n const rendered = hasAdorn ? (\n <div\n className={classNames('form-input', isDropdown && 'form-caret', size, className)}\n onClick={handleWrapperClick}\n >\n {adornStart}\n {select}\n {adornEnd}\n </div>\n ) : (\n select\n )\n\n return renderFormField({\n children: rendered,\n help,\n ids: { feedback: feedbackId, help: helpId, input: inputId },\n invalid,\n invalidFeedback,\n label,\n valid,\n validFeedback\n })\n }\n)\n\nSelect.displayName = 'Select'\n"],"mappings":"qVAwHA,MAAa,EAAS,GAElB,CACE,WACA,aACA,WACA,YACA,OACA,WACA,KACA,UACA,kBACA,QACA,WACA,UACA,cACA,OACA,QACA,gBACA,GAAG,GAEL,IACG,CACH,IAAM,EAAY,EAA0B,IAAI,EAC1C,EAAY,EAAa,EAAK,CAAS,EAEvC,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,MAAQ,CAAE,MAAO,EAAO,KAAM,EAEhD,IAAK,CAKC,EAHL,OAAO,GAAW,SACf,EACC,EAAO,OAAS,OAAO,EAAO,OAAS,EAAE,CACxC,CAEX,EACD,CACE,EAGJ,EAAW,EACf,EAAA,cAAC,MAAD,CACE,UAAW,EAAW,aAAc,GAAc,aAAc,EAAM,CAAS,EAC/E,QAAS,CAKN,EAHF,EACA,EACA,CACE,EAEL,EAGF,OAAO,EAAgB,CACrB,SAAU,EACV,OACA,IAAK,CAAE,SAAU,EAAY,KAAM,EAAQ,MAAO,CAAQ,EAC1D,UACA,kBACA,QACA,QACA,eACF,CAAC,CACH,CACF,EAEA,EAAO,YAAc"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{t as e}from"./polymorphic-BhGNZQja.js";import{t}from"./colorClassNames-CEh5Yzfp.js";import{a as n,i as r}from"./breakpoints-CGk8szzR.js";import i,{Fragment as a,forwardRef as o}from"react";import s from"classnames";const c=(e,t)=>e===!0?`${t}flex-fill`:e===`auto`?`${t}w-auto`:typeof e==`number`||typeof e==`string`?Number(e)===12?`${t}w-100`:`${t}w-${e}/12`:null;function l({children:e,animation:a,className:o,color:l,component:u,span:d,...f},p){let m=u??`span`,h=s(`skeleton`,a&&`skeleton-${a}`,l&&t[l],r([n(d,c)]),o);return i.createElement(m,{className:h,...f,ref:p},e)}const u=e(l,`Skeleton`);function d({children:e,color:t,component:n,loading:r,spans:o,...s},c){if(!r)return i.createElement(i.Fragment,null,e);let l=o===void 0?[void 0]:Array.isArray(o)?o:[o];return i.createElement(i.Fragment,null,l.map((e,r)=>i.createElement(a,{key:r},r>0&&` `,i.createElement(u,{component:n,span:e,color:t,...s,ref:r===0?c:void 0}))))}const f=o(d);f.displayName=`SkeletonLoader`;export{u as n,f as t};
|
|
2
|
-
//# sourceMappingURL=skeleton-Bjv9gGd3.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skeleton-Bjv9gGd3.js","names":[],"sources":["../../src/components/skeleton/Skeleton.tsx","../../src/components/skeleton/SkeletonLoader.tsx"],"sourcesContent":["import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport { WidthSpan, responsiveClassNames, responsiveProp } from '../../utils/breakpoints'\nimport { ContextColor, Responsive } from '../../types'\nimport { BG_COLOR_CLASS_NAMES } from '../../utils/colorClassNames'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype SkeletonOwnProps<C extends ElementType> = {\n /**\n * Adds `skeleton-{animation}` alongside the base `skeleton` class, so the element animates\n * itself as well as any nested `<Skeleton>` children. Nest plain `<Skeleton>` children inside\n * it for the glow pulse to reach them too, or apply `wave` to a container of one or more\n * `<Skeleton>` children for a directional sweep across the whole group.\n */\n animation?: 'glow' | 'wave'\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Sets the color of the component to one of Chassis context colors.\n */\n color?: ContextColor\n /**\n * Component used for the root node. Either a string to use an HTML element or a component —\n * e.g. `Avatar` or `Button`. Its own props are type-checked at the call site once passed here.\n *\n * @default 'span'\n */\n component?: C\n /**\n * Width of the skeleton in twelfths of its parent (`span={6}` is half, mapped to the\n * `w-{n}/12` class; `span={12}` is `w-100`), `'auto'` for its natural width (`w-auto`), or\n * `true` to fill the rest of a flex row (`flex-fill`). Unset by default, so the rendered\n * element's own intrinsic width applies — set it explicitly (e.g. `span={12}`) for a\n * full-width text line; leave it unset when `component` is something that sizes itself, like\n * `Avatar` or `Button`. An object sets the width from a breakpoint up: `{ base: 12, md: 6 }`.\n *\n * @type { Responsive<'auto' | number | string | boolean> }\n */\n span?: Responsive<WidthSpan>\n}\n\nexport type SkeletonProps<C extends ElementType = 'span'> = PolymorphicComponentProps<\n C,\n SkeletonOwnProps<C>\n>\n\ntype SkeletonComponent = (<C extends ElementType = 'span'>(\n props: SkeletonProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\n// chassis-css has the fractions `w-1/12` to `w-11/12`; twelve twelfths is `w-100`.\nconst spanClassName = (span: WidthSpan, prefix: string) => {\n if (span === true) return `${prefix}flex-fill`\n if (span === 'auto') return `${prefix}w-auto`\n if (typeof span === 'number' || typeof span === 'string') {\n return Number(span) === 12 ? `${prefix}w-100` : `${prefix}w-${span}/12`\n }\n return null\n}\n\nfunction SkeletonRender<C extends ElementType = 'span'>(\n { children, animation, className, color, component, span, ...rest }: SkeletonProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'span'\n const _className = classNames(\n 'skeleton',\n animation && `skeleton-${animation}`,\n color && BG_COLOR_CLASS_NAMES[color],\n responsiveClassNames([responsiveProp(span, spanClassName)]),\n className\n )\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const Skeleton = createPolymorphicComponent<SkeletonComponent>(\n SkeletonRender as ForwardRefRenderFunction<Element, SkeletonProps<ElementType>>,\n 'Skeleton'\n)\n","import React, {\n ComponentPropsWithoutRef,\n ElementType,\n ForwardedRef,\n forwardRef,\n ForwardRefRenderFunction,\n Fragment,\n ReactElement,\n ReactNode\n} from 'react'\n\nimport { WidthSpan } from '../../utils/breakpoints'\nimport { PolymorphicRef } from '../../utils/polymorphic'\nimport { ContextColor } from '../../types'\nimport { Skeleton, SkeletonProps } from './Skeleton'\n\ntype SkeletonLoaderOwnProps<C extends ElementType> = {\n /**\n * The real content, rendered unchanged (no wrapping element) once `loading` is `false`.\n */\n children: ReactNode\n /**\n * Sets the color of the generated skeleton lines to one of Chassis context colors.\n */\n color?: ContextColor\n /**\n * Component used for the generated skeleton(s) — e.g. `Avatar` or `Button` — for swapping\n * non-text content, not just text runs. Its own props are type-checked at the call site once\n * passed here, same as `Skeleton`'s own `component` prop.\n *\n * @default 'span'\n */\n component?: C\n /**\n * Swaps `children` for one `<Skeleton>` per entry in `spans` while `true`.\n */\n loading: boolean\n /**\n * One skeleton line per entry, using the same values as `Skeleton`'s `span` prop — e.g.\n * `[12, 6]` for a full-width line followed by a half-width one. A single value (e.g. `6`) is\n * shorthand for a single line, equivalent to `[6]`. Leave unset for a single skeleton sized by\n * `component`'s own intrinsic width instead — e.g. an `Avatar`'s `size` prop. Rendered instead\n * of `children` while `loading` is `true`; ignored once `loading` is `false`.\n *\n * @type { 'auto' | number | string | boolean | Array<'auto' | number | string | boolean> }\n */\n spans?: WidthSpan | WidthSpan[]\n}\n\n// Spelled out rather than `PolymorphicComponentProps`, which adds `asChild`: `SkeletonLoader`\n// renders no element of its own (it swaps its `children` for generated `Skeleton` lines), so\n// there's nothing for a child element to stand in for. (`Omit`-ing it from that type instead\n// breaks `C`'s inference from `component`.)\nexport type SkeletonLoaderProps<C extends ElementType = 'span'> = SkeletonLoaderOwnProps<C> &\n Omit<ComponentPropsWithoutRef<C>, keyof SkeletonLoaderOwnProps<C> | 'asChild'>\n\ntype SkeletonLoaderComponent = (<C extends ElementType = 'span'>(\n props: SkeletonLoaderProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\n/**\n * A pure content swap: no wrapping element of its own, so `.skeleton-glow`/`.skeleton-wave`\n * won't reach the lines it generates unless applied to a container already in the tree — see\n * `Skeleton`'s own docs for why the animation classes need a `.skeleton` descendant to animate.\n *\n * The ref goes to the first generated skeleton while `loading`, and is `null` once the real\n * content shows: that content is the caller's, with refs of its own.\n */\nfunction SkeletonLoaderRender<C extends ElementType = 'span'>(\n { children, color, component, loading, spans, ...rest }: SkeletonLoaderProps<C>,\n ref: ForwardedRef<Element>\n) {\n if (!loading) return <>{children}</>\n\n const spanList = spans === undefined ? [undefined] : Array.isArray(spans) ? spans : [spans]\n\n return (\n <>\n {spanList.map((span, index) => (\n // eslint-disable-next-line react/no-array-index-key -- `spans` is a static prop array\n <Fragment key={index}>\n {index > 0 && ' '}\n {/* `rest` is `C`'s own props minus `SkeletonLoaderOwnProps`'s keys, which structurally\n satisfies what `Skeleton<C>` wants (`C`'s own props minus its own, different, key\n set) — TS can't verify that across two independently-generic components, hence the\n cast. */}\n <Skeleton\n component={component}\n span={span}\n color={color}\n {...(rest as unknown as SkeletonProps<C>)}\n ref={index === 0 ? ref : undefined}\n />\n </Fragment>\n ))}\n </>\n )\n}\n\n// `forwardRef` takes a render function that isn't generic, so the generic type is cast back on,\n// as `createPolymorphicComponent` does.\nexport const SkeletonLoader = forwardRef(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n SkeletonLoaderRender as ForwardRefRenderFunction<Element, any>\n) as unknown as SkeletonLoaderComponent\n\nSkeletonLoader.displayName = 'SkeletonLoader'\n"],"mappings":"+PA0DA,MAAM,GAAiB,EAAiB,IAClC,IAAS,GAAa,GAAG,EAAO,WAChC,IAAS,OAAe,GAAG,EAAO,QAClC,OAAO,GAAS,UAAY,OAAO,GAAS,SACvC,OAAO,CAAI,IAAM,GAAK,GAAG,EAAO,OAAS,GAAG,EAAO,IAAI,EAAK,KAE9D,KAGT,SAAS,EACP,CAAE,WAAU,YAAW,YAAW,QAAO,YAAW,OAAM,GAAG,GAC7D,EACA,CACA,IAAM,EAAY,GAAa,OACzB,EAAa,EACjB,WACA,GAAa,YAAY,IACzB,GAAS,EAAqB,GAC9B,EAAqB,CAAC,EAAe,EAAM,CAAa,CAAC,CAAC,EAC1D,CACF,EAEA,OACE,EAAA,cAAC,EAAD,CAAW,UAAW,EAAY,GAAI,EAAW,KAEtC,EADR,CACQ,CAEf,CAEA,MAAa,EAAW,EACtB,EACA,UACF,ECtBA,SAAS,EACP,CAAE,WAAU,QAAO,YAAW,UAAS,QAAO,GAAG,GACjD,EACA,CACA,GAAI,CAAC,EAAS,OAAO,EAAA,cAAA,EAAA,SAAA,KAAG,CAAW,EAEnC,IAAM,EAAW,IAAU,IAAA,GAAY,CAAC,IAAA,EAAS,EAAI,MAAM,QAAQ,CAAK,EAAI,EAAQ,CAAC,CAAK,EAE1F,OACE,EAAA,cAAA,EAAA,SAAA,KACG,EAAS,KAAK,EAAM,IAEnB,EAAA,cAAC,EAAD,CAAU,IAAK,CAaL,EAZP,EAAQ,GAAK,IAKd,EAAA,cAAC,EAAD,CACa,YACL,OACC,QACP,GAAK,EACL,IAAK,IAAU,EAAI,EAAM,IAAA,EAC1B,CAAA,CACO,CACX,CACD,CAEN,CAIA,MAAa,EAAiB,EAE5B,CACF,EAEA,EAAe,YAAc"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./useForkedRef-DVEfT-KI.js";import{n as t}from"./lazyElement-tfMG21pZ.js";import n,{Fragment as r,cloneElement as i,createContext as a,forwardRef as o,isValidElement as s,useContext as c}from"react";import{mergeProps as l}from"react-aria";const u=process.env.NODE_ENV!==`production`,d=new Set;function f(e,t){u&&e&&!d.has(t)&&(d.add(t),console.warn(t))}function p(e,t){u&&e&&!d.has(t)&&(d.add(t),console.error(t))}function m(e){switch(e){case`a`:return`anchor`;case`button`:return`button`;case`input`:return`input`;default:return`host`}}function h(e){return typeof e==`string`?m(e):e.slotKind??`component`}function g(e){return typeof e==`string`?e:e.slotTag}function _(e,t,n){let r=h(e);if(r!==`component`)return r;let i=n?.to;return t!=null||i!=null?`anchor`:r}function v(e){return _(e.type,e.props.href,e.props)}function y(e){let n=e.asChild?t(e.children):void 0;return s(n)?v(n):e.component===void 0?b(e.href)?`anchor`:void 0:_(e.component,e.href,e)}const b=e=>e!=null;function x(e,t,n){return e??(b(t)?`a`:n)}function S(e,t,n){return b(t)?e===`anchor`||e===`component`?{href:t}:(f(!0,`${n}: \`href\` was ignored, because the element it renders isn't a link. Leave out \`component\` to render an <a>, or pass a link as \`component\` or as the \`asChild\` element.`),{}):{}}const C=e=>e===`anchor`||e===`button`,w=(...e)=>e.filter(Boolean).join(` `)||void 0,T=(e,...t)=>w(...(e?.split(` `)??[]).filter(e=>!t.includes(e))),E=(e,...t)=>({...e,"aria-describedby":T(e[`aria-describedby`],...t.map(e=>e.id))}),D=a(null),O=D.Provider,k=()=>c(D);function A(e){return e.props.ref}function j(t,r){let a=o(function({children:t,...r},a){let o=c(D),s=e(a,o?A(o):void 0);if(!o)return null;let u={...l(r,o.props)},d=w(r[`aria-describedby`],o.props[`aria-describedby`]);return d?u[`aria-describedby`]=d:delete u[`aria-describedby`],o.props[`aria-label`]!=null&&o.props[`aria-labelledby`]==null&&delete u[`aria-labelledby`],r[`aria-disabled`]===!0&&(u.onClick=r.onClick),n.createElement(D.Provider,{value:null},i(o,{...u,ref:s},t))});return Object.assign(a,{slotKind:t,slotTag:r})}const M=new Map;function N(e){let t=v(e),n=typeof e.type==`string`?e.type:void 0,r=n??`:${t}`,i=M.get(r);return i||(i=j(t,n),M.set(r,i)),i}const P=j(`component`,void 0);function F(e,t,r,a={}){let o=Object.entries(a).filter(([,e])=>e!==void 0),s=o.length?i(e,Object.fromEntries(o)):e;return n.createElement(O,{value:s},n.createElement(P,{...t,ref:r},e.props.children))}const I=e=>typeof e?.slotKind==`string`;function L(e){let n=t(e);return s(n)&&n.type!==r?n:null}function R(e,t){let n=L(e);return f(!n,`${t}: \`asChild\` expects exactly one React element as its child (not text, a fragment, or several elements); rendering the default element instead.`),n}function z(e,t){let n=L(e);return f(!n,`${t}: expects exactly one React element as its trigger (not text, a fragment, or several elements); rendering the children with nothing to open it.`),n}export{p as _,I as a,w as c,S as d,C as f,_ as g,y as h,z as i,E as l,g as m,N as n,F as o,x as p,R as r,k as s,O as t,b as u,f as v};
|
|
2
|
-
//# sourceMappingURL=slot-CNhFZdHF.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slot-CNhFZdHF.js","names":[],"sources":["../../src/utils/devWarning.ts","../../src/utils/elementKind.ts","../../src/utils/idRefs.ts","../../src/utils/slot.tsx"],"sourcesContent":["// Development-only misuse warnings, in one place so every component reports misuse the same way\n// and none of it reaches a consumer's production bundle.\n//\n// Two problems this fixes over calling `console.warn` directly, which is what every call site used\n// to do:\n//\n// 1. **They fired in production.** Nothing in this package guarded on `NODE_ENV`, so every\n// `console.warn` ran for end users of a consuming app. `process.env.NODE_ENV` is the idiom\n// bundlers (Vite, webpack, Turbopack, Rollup) replace with a literal, so in a production build\n// `IS_DEV` folds to `false` and no warning is ever emitted. Relying on that substitution adds\n// no new constraint: `react-dom` — a peer dependency, so always present — already requires\n// exactly the same replacement.\n// 2. **They repeated.** Most call sites warn during render, so a warning re-fired on every\n// re-render, and twice per render under StrictMode's double-invoke. De-duplicating on the\n// message means a misuse is reported once and stays readable in the console.\n//\n// What this does *not* do is strip the message strings from the bundle. Measured with esbuild\n// against the built `dist/index.js`: a `NODE_ENV=production` consumer bundle still contains them.\n// `tsdown` minifies this package's own output first (`minify: true`), collapsing each function to\n// a `IS_DEV && cond && ...` expression, and a consumer's minifier won't then inline that call to\n// discover its arguments are droppable. Building unminified would let them drop, at the cost of\n// shipping pretty-printed dist — not worth it for a few hundred gzipped bytes. The behavior that\n// mattered (nothing logged in production, nothing repeated in development) is the part that's\n// fixed; treat the strings as part of the bundle's fixed cost.\nconst IS_DEV = process.env.NODE_ENV !== 'production'\n\nconst warned = new Set<string>()\n\n/**\n * Resets the de-duplication set. Test-only — the suite asserts on these warnings, and without a\n * reset between tests the *second* test in a file to trigger the same message would see nothing.\n * Called from a global `beforeEach` in `test/setup.ts`.\n */\nexport function resetDevWarnings(): void {\n warned.clear()\n}\n\n/**\n * Logs `message` once via `console.warn` when `condition` is true, in development builds only.\n * Use for a recoverable misuse: the component still renders something sensible.\n */\nexport function devWarning(condition: boolean, message: string): void {\n if (!IS_DEV) return\n if (!condition || warned.has(message)) return\n warned.add(message)\n console.warn(message)\n}\n\n/**\n * Logs `message` once via `console.error` when `condition` is true, in development builds only.\n * Use for a misuse that leaves the component genuinely broken (e.g. a required prop missing).\n */\nexport function devError(condition: boolean, message: string): void {\n if (!IS_DEV) return\n if (!condition || warned.has(message)) return\n warned.add(message)\n console.error(message)\n}\n","import { ElementType, isValidElement, ReactElement, ReactNode } from 'react'\n\nimport { devWarning } from './devWarning'\nimport { resolveLazy } from './lazyElement'\n\n// What a polymorphic component ends up rendering, as far as its own semantics care:\n//\n// - `anchor`, `button`, `input`: the native element, which the component gives its full handling\n// (a real `disabled` attribute, or `aria-disabled`/`tabIndex`/a click guard on an anchor).\n// - `host`: any other HTML tag, which has no semantics of its own to rely on.\n// - `component`: a component reference, trusted to handle its own semantics.\n//\n// A render function asks `resolveElementKind(Component)` instead of comparing `Component` to a tag\n// name, because under `asChild` `Component` is a `Slot` (see `./slot`), not the tag the caller's\n// child element renders. The `Slot` carries that element's kind and tag.\nexport type ElementKind = 'anchor' | 'button' | 'input' | 'host' | 'component'\n\nfunction kindOfTag(tag: string): ElementKind {\n switch (tag) {\n case 'a':\n return 'anchor'\n case 'button':\n return 'button'\n case 'input':\n return 'input'\n default:\n return 'host'\n }\n}\n\ntype SlotLike = { slotKind?: ElementKind; slotTag?: string }\n\nexport function resolveElementKind(component: ElementType): ElementKind {\n if (typeof component === 'string') return kindOfTag(component)\n return (component as SlotLike).slotKind ?? 'component'\n}\n\n// The HTML tag that gets rendered, for a render function whose markup depends on a tag that has\n// no kind of its own (`List` renders `<li>` items only inside a `<ul>`/`<ol>`). `undefined` for a\n// component, whose output isn't known.\nexport function resolveElementTag(component: ElementType): string | undefined {\n return typeof component === 'string' ? component : (component as SlotLike).slotTag\n}\n\n// The kind of what a component renders, given the props it renders it with. A component reference\n// with a link target (`<Link href=\"/login\">` of Next.js, `<Link to=\"/login\">` of React Router)\n// counts as an anchor: router links render an `<a>` and forward what they're given to it, so they\n// need the anchor's disabled handling (`aria-disabled`, `tabindex=\"-1\"`, a blocked click), not a\n// `disabled` attribute passed through. This holds for the link passed as `component` and for the\n// one handed to `asChild` alike. `props` is where `to` is found: a component's remaining props.\nexport function resolveLinkKind(\n component: ElementType,\n href: unknown,\n props?: Record<string, unknown> | object\n): ElementKind {\n const kind = resolveElementKind(component)\n if (kind !== 'component') return kind\n const to = (props as { to?: unknown } | undefined)?.to\n return href != null || to != null ? 'anchor' : kind\n}\n\n// The kind of the element a caller handed to `asChild`.\nexport function resolveSlottedKind(element: ReactElement<Record<string, unknown>>): ElementKind {\n return resolveLinkKind(element.type as ElementType, element.props.href, element.props)\n}\n\n// The same question asked from outside, by a parent reading a child's props (`List` deciding its\n// own tag from its `ListItem`s). `undefined` when the child chose nothing and renders its default.\nexport function resolveKindFromProps(props: {\n asChild?: boolean\n children?: ReactNode\n component?: ElementType\n href?: string\n to?: unknown\n}): ElementKind | undefined {\n const child = props.asChild ? resolveLazy(props.children) : undefined\n if (isValidElement<Record<string, unknown>>(child)) return resolveSlottedKind(child)\n if (props.component !== undefined) return resolveLinkKind(props.component, props.href, props)\n return hasHref(props.href) ? 'anchor' : undefined\n}\n\n// One rule for `href`, followed by every component that accepts one:\n//\n// - The element is `component`, or the `asChild` element, when one is given. Otherwise `href` makes\n// it an `<a>`, and without `href` the component renders its own default (`linkElement`).\n// - `href` reaches the rendered element only when that element can take it: an `<a>`, or a\n// component reference, which is trusted to take it (a router link does). A `<button>`, an `<li>`\n// or any other tag never gets one, and in development the component says so (`hrefProps`).\n// - A component reference given `href` or `to` is a link, and is handled as an anchor\n// (`resolveLinkKind`).\n//\n// An empty string is set: `href=\"\"` is a link to the current document.\nexport const hasHref = (href: string | null | undefined): href is string => href != null\n\nexport function linkElement(\n component: ElementType | undefined,\n href: string | undefined,\n fallback: ElementType\n): ElementType {\n return component ?? (hasHref(href) ? 'a' : fallback)\n}\n\nexport function hrefProps(\n kind: ElementKind,\n href: string | undefined,\n displayName: string\n): { href?: string } {\n if (!hasHref(href)) return {}\n if (kind === 'anchor' || kind === 'component') return { href }\n devWarning(\n true,\n `${displayName}: \\`href\\` was ignored, because the element it renders isn't a link. Leave ` +\n `out \\`component\\` to render an <a>, or pass a link as \\`component\\` or as the \\`asChild\\` ` +\n `element.`\n )\n return {}\n}\n\nexport const isInteractiveKind = (kind: ElementKind | undefined): boolean =>\n kind === 'anchor' || kind === 'button'\n","// An id-reference attribute (`aria-describedby`, `aria-labelledby`) from the ids that apply, or\n// `undefined` when none does, so the attribute is left out rather than written empty.\nexport const joinIds = (...ids: (string | false | null | undefined)[]): string | undefined =>\n ids.filter(Boolean).join(' ') || undefined\n\n// `value` without the given ids: for an id-reference attribute a react-aria hook built from ids\n// that may not be rendered, such as the description and error-message ids of its `useField`.\nexport const withoutIds = (\n value: string | undefined,\n ...ids: (string | undefined)[]\n): string | undefined => joinIds(...(value?.split(' ') ?? []).filter((id) => !ids.includes(id)))\n\n// `props` with the ids of react-aria's description and error-message slots taken out of its\n// `aria-describedby`. `useField` always writes both into the server's HTML and drops each only\n// after hydration, once it finds no element with that id: this library renders its own help and\n// feedback under other ids. See FORMS.md, gotcha 6.\nexport const withoutSlotIds = <P extends { 'aria-describedby'?: string }>(\n props: P,\n ...slots: { id?: string }[]\n): P => ({\n ...props,\n 'aria-describedby': withoutIds(props['aria-describedby'], ...slots.map((slot) => slot.id))\n})\n","import React, {\n cloneElement,\n createContext,\n forwardRef,\n Fragment,\n isValidElement,\n ReactElement,\n ReactNode,\n Ref,\n useContext\n} from 'react'\nimport { mergeProps } from 'react-aria'\n\nimport { useForkedRef } from '../hooks/useForkedRef'\nimport { devWarning } from './devWarning'\nimport { ElementKind, resolveSlottedKind } from './elementKind'\nimport { joinIds } from './idRefs'\nimport { resolveLazy } from './lazyElement'\n\n// Backs the `asChild` prop every polymorphic component accepts (see `createPolymorphicComponent`).\n// The component renders a `Slot` as its `component`; the `Slot` then renders the caller's child\n// element in its place, with the props the component computed (className, handlers, ARIA\n// attributes, ref) merged onto it.\n//\n// There is one `Slot` per tag, and two for component elements (a link, anything else), and the\n// component gets the one that matches the child. A render function reads the child's kind and\n// tag back with `resolveElementKind(Component)`/`resolveElementTag(Component)` (see\n// `./elementKind`) and gives a slotted `<a>` the handling it gives `component=\"a\"`. Both travel\n// on the component rather than in a prop, so nothing extra can reach the DOM.\n//\n// The child element travels through context rather than a prop because a render function spreads\n// its `rest` props onto `component` in its own way (some filter them, some don't forward every\n// one) — context reaches `Slot` no matter how the render function wires it up. `Slot` resets the\n// context for its own subtree, so a polymorphic component nested *inside* the child doesn't pick\n// up the outer one's element.\ntype SlotElement = ReactElement<Record<string, unknown>>\n\nconst SlotContext = createContext<SlotElement | null>(null)\n\nexport const SlotProvider = SlotContext.Provider\n\n// The element `asChild` handed to the nearest polymorphic component, for a component rendered\n// beside its `Slot`. A render function can't read it: it runs above the provider.\nexport const useSlotElement = (): SlotElement | null => useContext(SlotContext)\n\n// The ref the caller put on an element. React 19 made `ref` an ordinary prop, and warns on\n// reading `element.ref`.\nexport function getElementRef<T = unknown>(element: ReactElement): Ref<T> | undefined {\n return (element.props as { ref?: Ref<T> }).ref\n}\n\n// `Record` rather than a declared prop list: `Slot` forwards whatever the render function hands it.\ntype SlotProps = Record<string, unknown>\n\nfunction createSlot(slotKind: ElementKind, slotTag: string | undefined) {\n const Slot = forwardRef<unknown, SlotProps>(function Slot({ children, ...slotProps }, ref) {\n const element = useContext(SlotContext)\n const forkedRef = useForkedRef(ref, element ? getElementRef(element) : undefined)\n if (!element) return null\n\n // react-aria's `mergeProps`: the child's own props win over the component's, except that\n // classNames concatenate, event handlers chain (the component's first), and ids merge.\n // Descriptions add up too: a child's own `aria-describedby` keeps the component's (a\n // `Tooltip`'s) rather than replacing it.\n const props: Record<string, unknown> = { ...mergeProps(slotProps, element.props) }\n // Written only when there is one: a key set to `undefined` would replace a description the\n // child's own component writes before spreading its props.\n const describedBy = joinIds(\n slotProps['aria-describedby'] as string | undefined,\n element.props['aria-describedby'] as string | undefined\n )\n if (describedBy) props['aria-describedby'] = describedBy\n else delete props['aria-describedby']\n // The child's own name wins too. `aria-labelledby` outranks `aria-label` when an element is\n // named, so the component's (a `Divider`'s label) would replace the name the child was given.\n if (element.props['aria-label'] != null && element.props['aria-labelledby'] == null) {\n delete props['aria-labelledby']\n }\n // A component marks an element that has no `disabled` attribute (an `<a>`, a `<div>`) with\n // `aria-disabled`, and blocks its click itself. The child's own `onClick` would still run\n // from the chain, so the component's handler replaces it: a disabled element doesn't act on\n // a click.\n if (slotProps['aria-disabled'] === true) props.onClick = slotProps.onClick\n\n return (\n <SlotContext.Provider value={null}>\n {cloneElement(element, { ...props, ref: forkedRef }, children as ReactNode)}\n </SlotContext.Provider>\n )\n })\n return Object.assign(Slot, { slotKind, slotTag })\n}\n\n// Created on first use and kept: a `Slot` has to be the same component on every render, or React\n// would remount the child. Keyed by tag, or by kind for a component element (a tag can't start\n// with a colon).\nconst slots = new Map<string, ReturnType<typeof createSlot>>()\n\n// The `Slot` a component renders for this child element.\nexport function getSlot(element: SlotElement) {\n const kind = resolveSlottedKind(element)\n const tag = typeof element.type === 'string' ? element.type : undefined\n const key = tag ?? `:${kind}`\n let slot = slots.get(key)\n if (!slot) {\n slot = createSlot(kind, tag)\n slots.set(key, slot)\n }\n return slot\n}\n\n// The `Slot` `renderSlotted` renders. One for every element: the trigger of a `Tooltip` has no\n// kind for a render function to read, and a `Slot` chosen by kind would change, remounting the\n// caller's trigger, when its `href` came or went.\nconst TriggerSlot = createSlot('component', undefined)\n\n// Renders an element the component doesn't own, such as the trigger of a `Tooltip` or a\n// `Popover`, the way `asChild` renders a child: with the component's `props` merged into the\n// element's own and `ref` forked with the element's ref. `owned` holds the attributes that state\n// the component's own condition (a `Popover` trigger's `aria-expanded` and `aria-controls`): they\n// win over the element's, which the merge would otherwise let win.\nexport function renderSlotted(\n element: SlotElement,\n props: object,\n ref: Ref<unknown>,\n owned: Record<string, unknown> = {}\n): ReactElement {\n const defined = Object.entries(owned).filter(([, value]) => value !== undefined)\n const slotted = defined.length ? cloneElement(element, Object.fromEntries(defined)) : element\n return (\n <SlotProvider value={slotted}>\n <TriggerSlot {...props} ref={ref}>\n {element.props.children as ReactNode}\n </TriggerSlot>\n </SlotProvider>\n )\n}\n\n// Whether a render function's `component` is a `Slot`, that is, whether it renders under `asChild`.\nexport const isSlot = (component: unknown): boolean =>\n typeof (component as { slotKind?: ElementKind } | null)?.slotKind === 'string'\n\n// The single element in `children`, or `null` when it isn't exactly one (text, a fragment,\n// several elements).\n//\n// A Server Component's child can arrive as a lazy node (#37, see `./lazyElement`): it is resolved\n// first, which suspends this component while the child is still loading.\nfunction getSingleElement(children: ReactNode): SlotElement | null {\n const child = resolveLazy(children)\n return isValidElement<Record<string, unknown>>(child) && child.type !== Fragment ? child : null\n}\n\n// The single element `asChild` renders in place of the component's own element, or `null` (with\n// a dev warning) when `children` isn't exactly one — the component then falls back to rendering\n// its default element, so a misuse degrades to a working, if unstyled-as-intended, UI.\nexport function getSlotChild(children: ReactNode, displayName: string): SlotElement | null {\n const child = getSingleElement(children)\n devWarning(\n !child,\n `${displayName}: \\`asChild\\` expects exactly one React element as its child (not text, a ` +\n `fragment, or several elements); rendering the default element instead.`\n )\n return child\n}\n\n// The trigger of a `Tooltip` or `Popover`, rendered with `renderSlotted`, or `null` (with a dev\n// warning) when `children` isn't exactly one element. The component then renders `children` as\n// they are, with nothing to open it.\nexport function getTriggerChild(children: ReactNode, displayName: string): SlotElement | null {\n const child = getSingleElement(children)\n devWarning(\n !child,\n `${displayName}: expects exactly one React element as its trigger (not text, a fragment, ` +\n `or several elements); rendering the children with nothing to open it.`\n )\n return child\n}\n"],"mappings":"kQAwBA,MAAM,EAAS,QAAQ,IAAI,WAAa,aAElC,EAAS,IAAI,IAenB,SAAgB,EAAW,EAAoB,EAAuB,CAC/D,GACA,GAAa,GAAO,IAAI,CAAO,IACpC,EAAO,IAAI,CAAO,EAClB,QAAQ,KAAK,CAAO,EACtB,CAMA,SAAgB,EAAS,EAAoB,EAAuB,CAC7D,GACA,GAAa,GAAO,IAAI,CAAO,IACpC,EAAO,IAAI,CAAO,EAClB,QAAQ,MAAM,CAAO,EACvB,CCxCA,SAAS,EAAU,EAA0B,CAC3C,OAAQ,EAAR,CACE,IAAK,IACH,MAAO,SACT,IAAK,SACH,MAAO,SACT,IAAK,QACH,MAAO,QACT,QACE,MAAO,MACX,CACF,CAIA,SAAgB,EAAmB,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Ac,EAAW,YAAa,IAAA,EAAS,EAOrD,SAAgB,EACd,EACA,EACA,EACA,EAAiC,CAAC,EACpB,CACd,IAAM,EAAU,OAAO,QAAQ,CAAK,CAAC,CAAC,QAAQ,EAAG,KAAW,IAAU,IAAA,EAAS,EACzE,EAAU,EAAQ,OAAS,EAAa,EAAS,OAAO,YAAY,CAAO,CAAC,EAAI,EACtF,OACE,EAAA,cAAC,EAAD,CAAc,MAAO,CAIP,EAHZ,EAAA,cAAC,EAAD,CAAa,GAAI,EAAY,KAEhB,EADV,EAAQ,MAAM,QACJ,CACD,CAElB,CAGA,MAAa,EAAU,GACrB,OAAQ,GAAiD,UAAa,SAOxE,SAAS,EAAiB,EAAyC,CACjE,IAAM,EAAQ,EAAY,CAAQ,EAClC,OAAO,EAAwC,CAAK,GAAK,EAAM,OAAS,EAAW,EAAQ,IAC7F,CAKA,SAAgB,EAAa,EAAqB,EAAyC,CACzF,IAAM,EAAQ,EAAiB,CAAQ,EAMvC,OALA,EACE,CAAC,EACD,GAAG,EAAY,iJAEjB,EACO,CACT,CAKA,SAAgB,EAAgB,EAAqB,EAAyC,CAC5F,IAAM,EAAQ,EAAiB,CAAQ,EAMvC,OALA,EACE,CAAC,EACD,GAAG,EAAY,gJAEjB,EACO,CACT"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{t as e}from"./polymorphic-BhGNZQja.js";import{n as t}from"./colorClassNames-CEh5Yzfp.js";import{t as n}from"./VisuallyHidden-C2dM7HhC.js";import r from"react";import i from"classnames";const a={sm:`spinner-sm`};function o({className:e,color:o,component:s,size:c,variant:l=`border`,visuallyHiddenLabel:u=`Loading...`,...d},f){let p=s??`div`,m=i(`spinner-${l}`,o?t[o]:null,c&&a[c],e);return r.createElement(p,{className:m,role:`status`,...d,ref:f},r.createElement(n,null,u))}const s=e(o,`Spinner`);export{s as t};
|
|
2
|
-
//# sourceMappingURL=spinner-DBuvQvMR.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"spinner-DBuvQvMR.js","names":[],"sources":["../../src/components/spinner/Spinner.tsx"],"sourcesContent":["import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { ContextColor } from '../../types'\nimport { FG_COLOR_CLASS_NAMES } from '../../utils/colorClassNames'\nimport { VisuallyHidden } from '../visually-hidden/VisuallyHidden'\n\ntype SpinnerOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Sets the color of the component to one of Chassis context colors.\n */\n color?: ContextColor\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n /**\n * Renders a smaller spinner, with the `spinner-sm` class.\n */\n size?: 'sm'\n /**\n * Set the button variant to an outlined button or a ghost button.\n */\n variant?: 'border' | 'grow'\n /**\n * Set visually hidden label for accessibility purposes.\n */\n visuallyHiddenLabel?: string\n}\n\n// chassis-css sizes a spinner of either variant with the one `spinner-{size}` class. Whole class\n// names: see `utils/colorClassNames.ts`.\nconst SIZE_CLASS_NAMES: Record<NonNullable<SpinnerOwnProps<ElementType>['size']>, string> = {\n sm: 'spinner-sm'\n}\n\nexport type SpinnerProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n SpinnerOwnProps<C>\n>\n\ntype SpinnerComponent = (<C extends ElementType = 'div'>(\n props: SpinnerProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction SpinnerRender<C extends ElementType = 'div'>(\n {\n className,\n color,\n component,\n size,\n variant = 'border',\n visuallyHiddenLabel = 'Loading...',\n ...rest\n }: SpinnerProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames(\n `spinner-${variant}`,\n color ? FG_COLOR_CLASS_NAMES[color] : null,\n size && SIZE_CLASS_NAMES[size],\n className\n )\n\n return (\n <Component className={_className} role=\"status\" {...rest} ref={ref}>\n <VisuallyHidden>{visuallyHiddenLabel}</VisuallyHidden>\n </Component>\n )\n}\n\nexport const Spinner = createPolymorphicComponent<SpinnerComponent>(\n SpinnerRender as ForwardRefRenderFunction<Element, SpinnerProps<ElementType>>,\n 'Spinner'\n)\n"],"mappings":"iOAyCA,MAAM,EAAsF,CAC1F,GAAI,YACN,EAWA,SAAS,EACP,CACE,YACA,QACA,YACA,OACA,UAAU,SACV,sBAAsB,aACtB,GAAG,GAEL,EACA,CACA,IAAM,EAAY,GAAa,MACzB,EAAa,EACjB,WAAW,IACX,EAAQ,EAAqB,GAAS,KACtC,GAAQ,EAAiB,GACzB,CACF,EAEA,OACE,EAAA,cAAC,EAAD,CAAW,UAAW,EAAY,KAAK,SAAS,GAAI,EAAW,KAEpD,EADT,EAAA,cAAC,EAAA,KAAgB,CAAoC,CAC5C,CAEf,CAEA,MAAa,EAAU,EACrB,EACA,SACF"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{t as e}from"./polymorphic-BhGNZQja.js";import{a as t,i as n,n as r}from"./breakpoints-CGk8szzR.js";import{t as i}from"./spacingClassName-DVhk8m3P.js";import a from"react";import o from"classnames";const s=(e,t)=>`${t}${e===`vertical`?`vstack`:`hstack`}`;function c({children:e,className:c,component:l,direction:u=`horizontal`,gap:d,...f},p){let m=l??`div`,h=o(r(u)===void 0&&`hstack`,n([t(u,s)]),i(`gap`,d),c);return a.createElement(m,{className:h,...f,ref:p},e)}const l=e(c,`Stack`);export{l as t};
|
|
2
|
-
//# sourceMappingURL=stack-DK5F53VT.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stack-DK5F53VT.js","names":[],"sources":["../../src/components/stack/Stack.tsx"],"sourcesContent":["import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { baseValue, responsiveClassNames, responsiveProp } from '../../utils/breakpoints'\nimport { spacingClassName } from '../../utils/spacingClassName'\nimport { Responsive, Spacing } from '../../types'\n\nconst directionClassName = (direction: 'horizontal' | 'vertical', prefix: string) =>\n `${prefix}${direction === 'vertical' ? 'vstack' : 'hstack'}`\n\ntype StackOwnProps<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 * Lays children out in a row (`horizontal`, the default, maps to `.hstack`) or a column\n * (`vertical`, maps to `.vstack`). An object switches the direction from a breakpoint up:\n * `{ base: 'vertical', md: 'horizontal' }`. The breakpoints are container queries, so they\n * require a `.contains-inline` ancestor (not applied by `Stack` itself — see the docs) to\n * establish the container context they evaluate against.\n */\n direction?: Responsive<'horizontal' | 'vertical'>\n /**\n * Spacing between children, mapped to the `gap-*` utility classes.\n *\n * @type { Spacing | 0 }\n */\n gap?: Spacing | 0\n}\n\nexport type StackProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n StackOwnProps<C>\n>\n\ntype StackComponent = (<C extends ElementType = 'div'>(\n props: StackProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction StackRender<C extends ElementType = 'div'>(\n { children, className, component, direction = 'horizontal', gap, ...rest }: StackProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames(\n // An object with no `base` still starts from the default direction.\n baseValue(direction) === undefined && 'hstack',\n responsiveClassNames([responsiveProp(direction, directionClassName)]),\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 Stack = createPolymorphicComponent<StackComponent>(\n StackRender as ForwardRefRenderFunction<Element, StackProps<ElementType>>,\n 'Stack'\n)\n"],"mappings":"6OAYA,MAAM,GAAsB,EAAsC,IAChE,GAAG,IAAS,IAAc,WAAa,SAAW,WAoCpD,SAAS,EACP,CAAE,WAAU,YAAW,YAAW,YAAY,aAAc,MAAK,GAAG,GACpE,EACA,CACA,IAAM,EAAY,GAAa,MACzB,EAAa,EAEjB,EAAU,CAAS,IAAM,IAAA,IAAa,SACtC,EAAqB,CAAC,EAAe,EAAW,CAAkB,CAAC,CAAC,EACpE,EAAiB,MAAO,CAAG,EAC3B,CACF,EAEA,OACE,EAAA,cAAC,EAAD,CAAW,UAAW,EAAY,GAAI,EAAW,KAEtC,EADR,CACQ,CAEf,CAEA,MAAa,EAAQ,EACnB,EACA,OACF"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t}from"./tableClassName-DleBjOj2.js";import n,{forwardRef as r}from"react";const i=r(({align:r,bordered:i,borderless:a,caption:o,children:s,className:c,color:l,hover:u,responsive:d,sm:f,stacked:p,striped:m,...h},g)=>{let _=n.createElement(`table`,{...h,className:e({align:r,bordered:i,borderless:a,className:c,color:l,hover:u,sm:f,stacked:p,striped:m}),ref:g},o&&n.createElement(`caption`,null,o),s),v=t({responsive:d,stacked:p});return v?n.createElement(`div`,{className:v},_):_});i.displayName=`StaticTable`;export{i as t};
|
|
2
|
-
//# sourceMappingURL=static-table-uu297Liz.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"static-table-uu297Liz.js","names":[],"sources":["../../src/components/static-table/StaticTable.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode, TableHTMLAttributes } from 'react'\n\nimport { TableStyleProps, tableClassName, tableWrapperClassName } from '../../utils/tableClassName'\n\nexport interface StaticTableProps\n extends TableStyleProps, Omit<TableHTMLAttributes<HTMLTableElement>, 'align' | 'color'> {\n /**\n * Content shown above the table, functioning as a heading for it.\n */\n caption?: ReactNode\n /**\n * The table's own markup — plain `<thead>`/`<tbody>`/`<tfoot>`/`<tr>`/`<th>`/`<td>` elements,\n * rendered as-is.\n */\n children?: ReactNode\n /**\n * Convert rows into stacked label/value blocks below a container width, for tables with too\n * many columns to read comfortably even with horizontal scrolling. `true` always stacks; a\n * breakpoint name stacks only below it. Implies `responsive` when `responsive` isn't set\n * separately. Unlike `Table`, which derives each cell's label from its column header, a static\n * table has no collection to read labels from — give each `<td>` a `data-cell` attribute with\n * the label to show before its value.\n */\n stacked?: TableStyleProps['stacked']\n}\n\n// A plain, server-renderable `<table>` with `Table`'s styling props and none of its behavior — no\n// sorting, selection, or keyboard grid navigation, and no hooks, so it needs no client JavaScript\n// at all. Imported from `@chassis-ui/react/static-table`, whose entry deliberately has no\n// `'use client'` directive (see `RSC.md`). `forwardRef` is fine here: React Server Components\n// render forwardRef components like any other function component (a ref just can't be passed\n// from the server side).\nexport const StaticTable = forwardRef<HTMLTableElement, StaticTableProps>(\n (\n {\n align,\n bordered,\n borderless,\n caption,\n children,\n className,\n color,\n hover,\n responsive,\n sm,\n stacked,\n striped,\n ...rest\n },\n ref\n ) => {\n const table = (\n <table\n {...rest}\n className={tableClassName({\n align,\n bordered,\n borderless,\n className,\n color,\n hover,\n sm,\n stacked,\n striped\n })}\n ref={ref}\n >\n {caption && <caption>{caption}</caption>}\n {children}\n </table>\n )\n\n const wrapperClassName = tableWrapperClassName({ responsive, stacked })\n return wrapperClassName ? <div className={wrapperClassName}>{table}</div> : table\n }\n)\n\nStaticTable.displayName = 'StaticTable'\n"],"mappings":"8FAgCA,MAAa,EAAc,GAEvB,CACE,QACA,WACA,aACA,UACA,WACA,YACA,QACA,QACA,aACA,KACA,UACA,UACA,GAAG,GAEL,IACG,CACH,IAAM,EACJ,EAAA,cAAC,QAAD,CACE,GAAI,EACJ,UAAW,EAAe,CACxB,QACA,WACA,aACA,YACA,QACA,QACA,KACA,UACA,SACF,CAAC,EACI,KAIA,EAFJ,GAAW,EAAA,cAAC,UAAA,KAAS,CAAiB,EACtC,CACI,EAGH,EAAmB,EAAsB,CAAE,aAAY,SAAQ,CAAC,EACtE,OAAO,EAAmB,EAAA,cAAC,MAAD,CAAK,UAAW,CAA8B,EAAX,CAAW,EAAI,CAC9E,CACF,EAEA,EAAY,YAAc"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{d as e,f as t,g as n,h as r,m as i,p as a,u as o}from"./slot-CNhFZdHF.js";import{t as s}from"./lazyElement-tfMG21pZ.js";import{t as c}from"./polymorphic-BhGNZQja.js";import l,{Children as u}from"react";import d from"classnames";function f({active:t,children:r,className:i,color:o,component:s,href:c,...u},f){let p=a(s,c,`li`),m=d(`stepper-item`,o&&`context`,o,{active:t},i),h={...e(n(p,c,u),c,`StepperItem`),...t?{"aria-current":`step`}:{},...u};return l.createElement(p,{className:m,...h,ref:f},r)}const p=c(f,`StepperItem`);function m({children:e,className:n,component:a,color:c,icon:f,items:m,layout:h,overflow:g,..._},v){let y=m?m.some(e=>o(e.href)):u.toArray(e).some(e=>s(e,p)&&t(r(e.props))),b=a??(y?`div`:`ol`),x=i(b),S=x===`ol`||x===`ul`,C=d(`stepper`,c&&`context`,c,h,{"icon-stepper":f},n),w=(m?m.map((e,t)=>l.createElement(p,{key:t,active:e.active,color:e.color,component:o(e.href)||S?void 0:`div`,href:e.href},e.label)):null)??(S?e:u.map(e,e=>s(e,p)&&r(e.props)===void 0?l.cloneElement(e,{component:`div`}):e)),T=l.createElement(b,{className:C,..._,ref:v},w);return g?l.createElement(`div`,{className:`stepper-overflow`},T):T}const h=c(m,`Stepper`);export{p as n,h as t};
|
|
2
|
-
//# sourceMappingURL=stepper-CVXMJ2yg.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stepper-CVXMJ2yg.js","names":[],"sources":["../../src/components/stepper/StepperItem.tsx","../../src/components/stepper/Stepper.tsx"],"sourcesContent":["import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport { ContextColor } from '../../types'\nimport { hrefProps, linkElement, resolveLinkKind } from '../../utils/elementKind'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef,\n PolymorphicRefWithFallback\n} from '../../utils/polymorphic'\n\ntype StepperItemOwnProps<C extends ElementType> = {\n /**\n * Marks the item as the current step.\n */\n active?: boolean\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Sets the color of the component to one of Chassis context colors.\n */\n color?: ContextColor\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n /**\n * The `href` attribute for an interactive step rendered as a link. Renders an `<a>` in place of\n * the `<li>`, unless `component` or `asChild` chose the element. Inside a `Stepper`, the stepper\n * renders a `<div>` around it in place of the `<ol>`.\n */\n href?: string\n}\n\nexport type StepperItemProps<C extends ElementType = 'li'> = PolymorphicComponentProps<\n C,\n StepperItemOwnProps<C>\n>\n\ntype StepperItemComponent = (<C extends ElementType = 'li'>(\n props: StepperItemProps<C> & {\n ref?: PolymorphicRefWithFallback<C, HTMLLIElement | HTMLAnchorElement>\n }\n) => ReactElement | null) & { displayName?: string }\n\nfunction StepperItemRender<C extends ElementType = 'li'>(\n { active, children, className, color, component, href, ...rest }: StepperItemProps<C>,\n ref: PolymorphicRef<C>\n) {\n // `href` makes it an `<a>`, unless `component` or `asChild` chose the element (see\n // `linkElement`). It used to stay an `<li>` and carry `href` as an attribute.\n const Component = linkElement(component, href, 'li')\n const _className = classNames('stepper-item', color && 'context', color, { active }, className)\n\n const mergedProps = {\n ...hrefProps(resolveLinkKind(Component, href, rest), href, 'StepperItem'),\n ...(active ? { 'aria-current': 'step' } : {}),\n ...rest\n }\n\n return (\n <Component className={_className} {...mergedProps} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const StepperItem = createPolymorphicComponent<StepperItemComponent>(\n StepperItemRender as ForwardRefRenderFunction<Element, StepperItemProps<ElementType>>,\n 'StepperItem'\n)\n","import React, {\n Children,\n ElementType,\n ForwardRefRenderFunction,\n ReactElement,\n ReactNode\n} from 'react'\nimport classNames from 'classnames'\n\nimport { ContextColor } from '../../types'\nimport {\n hasHref,\n isInteractiveKind,\n resolveElementTag,\n resolveKindFromProps\n} from '../../utils/elementKind'\nimport { isElementOfType } from '../../utils/lazyElement'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { StepperItem } from './StepperItem'\n\nexport interface StepperItemDef {\n /**\n * Step label content.\n */\n label: React.ReactNode\n /**\n * Marks the item as the current step.\n */\n active?: boolean\n /**\n * Sets the color of the item.\n */\n color?: ContextColor\n /**\n * Renders the item as a link to the given URL.\n */\n href?: string\n}\n\ntype StepperOwnProps<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 * Defaults to `'ol'`, unless a step (a data-driven item with `href`, or a `<StepperItem>` child\n * rendering an `<a>`/`<button>` through `component` or `asChild`) is interactive — a bare `<a>`/\n * `<button>` isn't a valid direct child of `<ol>`, so the default switches to `'div'` instead.\n * Pass `component` explicitly to opt out of this.\n */\n component?: C\n /**\n * Sets the color of the component to one of Chassis context colors.\n */\n color?: ContextColor\n /**\n * Replaces the step counters with icons, driven by the `--status-icon` custom property.\n */\n icon?: boolean\n /**\n * Array of step definitions for data-driven rendering. When provided, children are ignored.\n */\n items?: StepperItemDef[]\n /**\n * Lays out steps side-by-side instead of stacking them vertically, either unconditionally or\n * from a given breakpoint up.\n */\n layout?:\n | 'horizontal'\n | 'sm:horizontal'\n | 'md:horizontal'\n | 'lg:horizontal'\n | 'xl:horizontal'\n | '2xl:horizontal'\n /**\n * Wraps the stepper in a horizontally scrollable container so steps keep their natural width\n * instead of shrinking to fit.\n */\n overflow?: boolean\n}\n\n// What `Stepper` reads off a `<StepperItem>` child to decide its own tag.\ntype StepperItemChildProps = {\n asChild?: boolean\n children?: ReactNode\n component?: ElementType\n href?: string\n}\n\nexport type StepperProps<C extends ElementType = 'ol'> = PolymorphicComponentProps<\n C,\n StepperOwnProps<C>\n>\n\ntype StepperComponent = (<C extends ElementType = 'ol'>(\n props: StepperProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction StepperRender<C extends ElementType = 'ol'>(\n {\n children,\n className,\n component,\n color,\n icon,\n items,\n layout,\n overflow,\n ...rest\n }: StepperProps<C>,\n ref: PolymorphicRef<C>\n) {\n // A linked step (data-driven `href`, or a `<StepperItem>` child rendering an `<a>`/`<button>`,\n // whether through `component` or as its `asChild` element) can't render as a bare\n // `<a>`/`<button>` inside the default `<ol>` root — only `<li>`/`script`/`template` are valid\n // children there. Default to `<div>` instead when that's the case (unless the caller already\n // chose their own `component`) — matching the `<Stepper component=\"div\">` pattern already\n // documented for composed interactive usage.\n const hasInteractiveItem = items\n ? items.some((item) => hasHref(item.href))\n : Children.toArray(children).some(\n (child) =>\n isElementOfType<StepperItemChildProps>(child, StepperItem) &&\n isInteractiveKind(resolveKindFromProps(child.props))\n )\n const Component = (component ?? (hasInteractiveItem ? 'div' : 'ol')) as ElementType\n // The tag rather than `Component`, which under `asChild` is a `Slot` holding the caller's\n // `<ol>`/`<ul>`.\n const rootTag = resolveElementTag(Component)\n const isListSemantic = rootTag === 'ol' || rootTag === 'ul'\n\n const _className = classNames(\n 'stepper',\n color && 'context',\n color,\n layout,\n { 'icon-stepper': icon },\n className\n )\n\n const autoContent = items\n ? items.map((item, idx) => (\n <StepperItem\n // eslint-disable-next-line react/no-array-index-key\n key={idx}\n active={item.active}\n color={item.color}\n // Left out with `href`, so the step renders its `<a>`.\n component={hasHref(item.href) || isListSemantic ? undefined : 'div'}\n href={item.href}\n >\n {item.label}\n </StepperItem>\n ))\n : null\n\n // When the root switched to `div` because of an interactive step, every plain `<StepperItem>`\n // sibling defaulting to `<li>` would be just as invalid (only valid inside `<ul>`/`<ol>`/\n // `<menu>`) — so give each `StepperItem` child the same `div` treatment the auto-generated\n // steps above already get, unless it chose its own element: `component`, `href` or its `asChild`\n // element. Other child types are left untouched — this is only meaningful for `Stepper`'s own\n // steps.\n const renderedChildren =\n autoContent ??\n (isListSemantic\n ? children\n : Children.map(children, (child) =>\n isElementOfType<StepperItemChildProps>(child, StepperItem) &&\n resolveKindFromProps(child.props) === undefined\n ? React.cloneElement(child, { component: 'div' })\n : child\n ))\n\n const stepperEl = (\n <Component className={_className} {...rest} ref={ref}>\n {renderedChildren}\n </Component>\n )\n\n if (!overflow) return stepperEl\n\n return <div className=\"stepper-overflow\">{stepperEl}</div>\n}\n\nexport const Stepper = createPolymorphicComponent<StepperComponent>(\n StepperRender as ForwardRefRenderFunction<Element, StepperProps<ElementType>>,\n 'Stepper'\n)\n"],"mappings":"4QAgDA,SAAS,EACP,CAAE,SAAQ,WAAU,YAAW,QAAO,YAAW,OAAM,GAAG,GAC1D,EACA,CAGA,IAAM,EAAY,EAAY,EAAW,EAAM,IAAI,EAC7C,EAAa,EAAW,eAAgB,GAAS,UAAW,EAAO,CAAE,QAAO,EAAG,CAAS,EAExF,EAAc,CAClB,GAAG,EAAU,EAAgB,EAAW,EAAM,CAAI,EAAG,EAAM,aAAa,EACxE,GAAI,EAAS,CAAE,eAAgB,MAAO,EAAI,CAAC,EAC3C,GAAG,CACL,EAEA,OACE,EAAA,cAAC,EAAD,CAAW,UAAW,EAAY,GAAI,EAAkB,KAE7C,EADR,CACQ,CAEf,CAEA,MAAa,EAAc,EACzB,EACA,aACF,EC8BA,SAAS,EACP,CACE,WACA,YACA,YACA,QACA,OACA,QACA,SACA,WACA,GAAG,GAEL,EACA,CAOA,IAAM,EAAqB,EACvB,EAAM,KAAM,GAAS,EAAQ,EAAK,IAAI,CAAC,EACvC,EAAS,QAAQ,CAAQ,CAAC,CAAC,KACxB,GACC,EAAuC,EAAO,CAAW,GACzD,EAAkB,EAAqB,EAAM,KAAK,CAAC,CACvD,EACE,EAAa,IAAc,EAAqB,MAAQ,MAGxD,EAAU,EAAkB,CAAS,EACrC,EAAiB,IAAY,MAAQ,IAAY,KAEjD,EAAa,EACjB,UACA,GAAS,UACT,EACA,EACA,CAAE,eAAgB,CAAK,EACvB,CACF,EAwBM,GAtBc,EAChB,EAAM,KAAK,EAAM,IACf,EAAA,cAAC,EAAD,CAEE,IAAK,EACL,OAAQ,EAAK,OACb,MAAO,EAAK,MAEZ,UAAW,EAAQ,EAAK,IAAI,GAAK,EAAiB,IAAA,GAAY,MAC9D,KAAM,EAAK,IAGA,EADV,EAAK,KACK,CACd,EACD,QAUD,EACG,EACA,EAAS,IAAI,EAAW,GACtB,EAAuC,EAAO,CAAW,GACzD,EAAqB,EAAM,KAAK,IAAM,IAAA,GAClC,EAAM,aAAa,EAAO,CAAE,UAAW,KAAM,CAAC,EAC9C,CACN,GAEA,EACJ,EAAA,cAAC,EAAD,CAAW,UAAW,EAAY,GAAI,EAAW,KAEtC,EADR,CACQ,EAKb,OAFK,EAEE,EAAA,cAAC,MAAD,CAAK,UAAU,kBAAmC,EAAf,CAAe,EAFnC,CAGxB,CAEA,MAAa,EAAU,EACrB,EACA,SACF"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{t as e}from"./useForkedRef-DVEfT-KI.js";import{t}from"./FormLabel-CYcQiFUI.js";import{t as n}from"./validationClassName-gRGs4KBm.js";import{n as r,r as i}from"./unhandledProps-9Kdj7WVf.js";import a,{forwardRef as o,useRef as s}from"react";import c from"classnames";import{useSwitch as l}from"react-aria";import{useToggleState as u}from"react-stately";const d=({checkInputClassName:e,className:n,input:r,label:i,style:o})=>i?a.createElement(t,{customClassName:n,style:o},a.createElement(`span`,{className:e},r),i):a.createElement(`span`,{className:e,style:o},r),f=({className:e,color:t,forkedRef:r,id:i,inputProps:o,invalid:s,label:l,size:u,style:f,valid:p})=>{let m=c(n(s,p)),h=c(`check-input`,t,n(s,p)),g=c(`form-check form-switch`,u,n(s,p),e);return d({checkInputClassName:h,className:g,input:a.createElement(`input`,{...o,className:m,id:i,ref:r}),label:l,style:f})},p=o(({className:t,children:n,color:a,defaultSelected:o,disabled:c,id:d,invalid:p,isSelected:m,label:h,onChange:g,size:_,style:v,valid:y,...b},x)=>{let S=s(null),C=e(x,S),w=h??n,T=u({defaultSelected:o,isDisabled:c,isSelected:m,onChange:g}),{inputProps:E}=l({...b,children:w,isDisabled:c,isInvalid:p,value:b.value},T,S);return f({className:t,color:a,forkedRef:C,id:d,inputProps:{...i(E,b,r),"aria-describedby":b[`aria-describedby`]},invalid:p,label:w,size:_,style:v,valid:y})});p.displayName=`SwitchCheckbox`;const m=o(({children:t,className:n,color:r,defaultSelected:i,disabled:a,id:o,invalid:c,isSelected:l,label:u,onChange:d,size:p,style:m,valid:h,...g},_)=>{let v=s(null),y=e(_,v),b=u??t,x={...g,"aria-invalid":c,checked:l,defaultChecked:i,disabled:a,onChange:d?e=>d(e.target.checked):void 0,role:`switch`,type:`radio`};return f({className:n,color:r,forkedRef:y,id:o,inputProps:x,invalid:c,label:b,size:p,style:m,valid:h})});m.displayName=`SwitchRadio`;const h=o(({type:e=`checkbox`,...t},n)=>e===`radio`?a.createElement(m,{...t,ref:n}):a.createElement(p,{...t,ref:n}));h.displayName=`Switch`;export{h as t};
|
|
2
|
-
//# sourceMappingURL=switch-C6s3LxEv.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"switch-C6s3LxEv.js","names":[],"sources":["../../src/components/switch/Switch.tsx"],"sourcesContent":["import React, { CSSProperties, forwardRef, InputHTMLAttributes, ReactNode, useRef } from 'react'\nimport classNames from 'classnames'\nimport { AriaSwitchProps, useSwitch } from 'react-aria'\nimport { useToggleState } from 'react-stately'\n\nimport { useForkedRef } from '../../hooks'\nimport { ContextColor } from '../../types'\nimport { mergeUnhandledProps, TOGGLE_PROPS } from '../../utils/unhandledProps'\nimport { validationClassName } from '../../utils/validationClassName'\n\nimport { FormLabel } from '../form/FormLabel'\n\nexport interface SwitchProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'checked' | 'defaultChecked' | 'onChange' | 'size'\n> {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Sets the color of the switch indicator to one of Chassis context colors.\n */\n color?: ContextColor\n /**\n * Whether the switch is selected, uncontrolled.\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 * Set component validation state to invalid.\n */\n invalid?: boolean\n /**\n * Whether the switch is selected, controlled.\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.\n */\n onChange?: (isSelected: boolean) => void\n /**\n * Size the component sm or lg.\n */\n size?: 'sm' | 'lg'\n /**\n * Specifies the type of component.\n */\n type?: 'checkbox' | 'radio'\n /**\n * Set component validation state to valid.\n */\n valid?: boolean\n}\n\ntype SwitchVariantProps = Omit<SwitchProps, 'type'>\n\ninterface RenderSwitchOptions {\n checkInputClassName: string\n className: string\n input: ReactNode\n label?: ReactNode\n style?: CSSProperties\n}\n\n// Mirrors renderFormCheck's nested-label/bare-span shape — Switch inlines its own markup (see\n// FORMS.md) rather than sharing that helper directly, since `role=\"switch\"` placement didn't fit\n// it cleanly. Keep this in sync with renderFormCheck by eye if either changes.\nconst renderSwitch = ({\n checkInputClassName,\n className,\n input,\n label,\n style\n}: RenderSwitchOptions) => {\n if (!label) {\n return (\n <span className={checkInputClassName} style={style}>\n {input}\n </span>\n )\n }\n return (\n <FormLabel customClassName={className} style={style}>\n <span className={checkInputClassName}>{input}</span>\n {label}\n </FormLabel>\n )\n}\n\ninterface RenderSwitchInputOptions {\n className?: string\n color?: ContextColor\n forkedRef: React.Ref<HTMLInputElement>\n id?: string\n inputProps: InputHTMLAttributes<HTMLInputElement>\n invalid?: boolean\n label?: ReactNode\n size?: 'sm' | 'lg'\n style?: CSSProperties\n valid?: boolean\n}\n\n// Shared className-building/markup for `SwitchCheckbox`/`SwitchRadio` — the two variants only\n// differ in how `inputProps` gets built (a react-aria hook vs. a hand-wired radio), everything\n// after that is identical. `style` goes on the outermost element, as `className` does.\nconst renderSwitchInput = ({\n className,\n color,\n forkedRef,\n id,\n inputProps,\n invalid,\n label,\n size,\n style,\n valid\n}: RenderSwitchInputOptions) => {\n const inputClassName = classNames(validationClassName(invalid, valid))\n const checkInputClassName = classNames('check-input', color, validationClassName(invalid, valid))\n const _className = classNames(\n 'form-check form-switch',\n size,\n validationClassName(invalid, valid),\n className\n )\n\n return renderSwitch({\n checkInputClassName,\n className: _className,\n input: <input {...inputProps} className={inputClassName} id={id} ref={forkedRef} />,\n label,\n style\n })\n}\n\n// Checkbox-backed switch: a real toggle, so it goes through react-aria's useSwitch/useToggleState\n// like Checkbox does. Split into its own component (rather than branching inside one Switch on\n// `type`) so SwitchRadio below never has to call these hooks just to discard their result —\n// calling them unconditionally and ignoring the output risked react-aria's own dev-mode warnings\n// (e.g. its missing-accessible-name check) firing for state that was never actually rendered.\nconst SwitchCheckbox = forwardRef<HTMLInputElement, SwitchVariantProps>(\n (\n {\n className,\n children,\n color,\n defaultSelected,\n disabled,\n id,\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 // `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 toggleState = useToggleState({\n defaultSelected,\n isDisabled: disabled,\n isSelected,\n onChange\n })\n\n const { inputProps: switchProps } = useSwitch(\n {\n ...rest,\n children: resolvedLabel,\n isDisabled: disabled,\n isInvalid: invalid,\n value: rest.value as string | undefined\n } as AriaSwitchProps,\n toggleState,\n inputRef\n )\n\n return renderSwitchInput({\n className,\n color,\n forkedRef,\n id,\n // `aria-describedby` over react-aria's own, which adds ids it never renders (FORMS.md,\n // gotcha 6).\n inputProps: {\n ...mergeUnhandledProps(switchProps, rest, TOGGLE_PROPS),\n 'aria-describedby': rest['aria-describedby']\n },\n invalid,\n label: resolvedLabel,\n size,\n style,\n valid\n })\n }\n)\nSwitchCheckbox.displayName = 'SwitchCheckbox'\n\n// Radio-backed switch: react-aria has no ungrouped radio hook (see Checkbox's own split for the\n// same reason), so this stays a native, hand-wired `<input type=\"radio\" role=\"switch\">` — no\n// react-aria hook to call here at all.\nconst SwitchRadio = forwardRef<HTMLInputElement, SwitchVariantProps>(\n (\n {\n children,\n className,\n color,\n defaultSelected,\n disabled,\n id,\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 // `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 radioProps = {\n ...rest,\n 'aria-invalid': invalid,\n checked: isSelected,\n defaultChecked: defaultSelected,\n disabled,\n onChange: onChange\n ? (event: React.ChangeEvent<HTMLInputElement>) => onChange(event.target.checked)\n : undefined,\n role: 'switch' as const,\n type: 'radio' as const\n }\n\n return renderSwitchInput({\n className,\n color,\n forkedRef,\n id,\n inputProps: radioProps,\n invalid,\n label: resolvedLabel,\n size,\n style,\n valid\n })\n }\n)\nSwitchRadio.displayName = 'SwitchRadio'\n\nexport const Switch = forwardRef<HTMLInputElement, SwitchProps>(\n ({ type = 'checkbox', ...rest }, ref) =>\n type === 'radio' ? <SwitchRadio {...rest} ref={ref} /> : <SwitchCheckbox {...rest} ref={ref} />\n)\n\nSwitch.displayName = 'Switch'\n"],"mappings":"uYAgFA,MAAM,GAAgB,CACpB,sBACA,YACA,QACA,QACA,WAEK,EAQH,EAAA,cAAC,EAAD,CAAW,gBAAiB,EAAkB,OAGnC,EAFT,EAAA,cAAC,OAAD,CAAM,UAAW,CAAkC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AG,EACH,eAAgB,EAChB,QAAS,EACT,eAAgB,EAChB,WACA,SAAU,EACL,GAA+C,EAAS,EAAM,OAAO,OAAO,EAC7E,IAAA,GACJ,KAAM,SACN,KAAM,OACR,EAEA,OAAO,EAAkB,CACvB,YACA,QACA,YACA,KACA,WAAY,EACZ,UACA,MAAO,EACP,OACA,QACA,OACF,CAAC,CACH,CACF,EACA,EAAY,YAAc,cAE1B,MAAa,EAAS,GACnB,CAAE,OAAO,WAAY,GAAG,GAAQ,IAC/B,IAAS,QAAU,EAAA,cAAC,EAAD,CAAa,GAAI,EAAW,KAAM,CAAA,EAAI,EAAA,cAAC,EAAD,CAAgB,GAAI,EAAW,KAAM,CAAA,CAClG,EAEA,EAAO,YAAc"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{t as e}from"./useForkedRef-DVEfT-KI.js";import{n as t,r as n}from"./tableClassName-DleBjOj2.js";import r,{forwardRef as i,useRef as a}from"react";import o from"classnames";import{useCheckbox as s,useTable as c,useTableCell as l,useTableColumnHeader as u,useTableHeaderRow as d,useTableRow as f,useTableRowGroup as p,useTableSelectAllCheckbox as m,useTableSelectionCheckbox as h}from"react-aria";import{Cell as g,Column as _,Row as v,TableBody as y,TableHeader as b,useTableState as x,useToggleState as S}from"react-stately";const C=i(({align:i,bordered:o,borderless:s,caption:l,children:u,className:d,color:f,disabledKeys:p,footer:m,hover:h,id:g,onSelectionChange:_,onSortChange:v,responsive:y,selectedKeys:b,selectionMode:S=`none`,sm:C,sortDescriptor:j,stacked:M,striped:N,...P},F)=>{let I=x({children:u,disabledKeys:p,onSelectionChange:_,onSortChange:v,selectedKeys:b,selectionMode:S,showSelectionCheckboxes:S===`multiple`,sortDescriptor:j}),L=a(null),R=e(L,F),{gridProps:z}=c({"aria-label":P[`aria-label`],"aria-labelledby":P[`aria-labelledby`],id:g},I,L),B=t({align:i,bordered:o,borderless:s,className:d,color:f,hover:h,sm:C,stacked:M,striped:N}),V=r.createElement(`table`,{...z,"aria-describedby":z[`aria-describedby`]||void 0,className:B,ref:R},l&&r.createElement(`caption`,null,l),r.createElement(w,{className:u[0].props.className,type:`thead`},I.collection.headerRows.map(e=>r.createElement(T,{key:e.key,item:e,state:I},[...I.collection.getChildren?.(e.key)??[]].map(e=>e.props?.isSelectionCell?r.createElement(D,{key:e.key,column:e,state:I}):r.createElement(E,{key:e.key,column:e,state:I}))))),r.createElement(w,{className:u[1].props.className,type:`tbody`},[...I.collection.body.childNodes].map(e=>r.createElement(O,{key:e.key,item:e,state:I},[...I.collection.getChildren?.(e.key)??[]].map(e=>e.props?.isSelectionCell?r.createElement(A,{key:e.key,cell:e,state:I}):r.createElement(k,{key:e.key,cell:e,stacked:!!M,state:I}))))),m&&r.createElement(`tfoot`,null,m)),H=n({responsive:y,stacked:M});return H?r.createElement(`div`,{className:H},V):V});C.displayName=`Table`;const w=({className:e,type:t,children:n})=>{let{rowGroupProps:i}=p();return r.createElement(t,{...i,className:e||void 0},n)},T=({children:e,item:t,state:n})=>{let i=a(null),{rowProps:o}=d({node:t},n,i);return r.createElement(`tr`,{...o,ref:i},e)},E=({column:e,state:t})=>{let n=a(null),{columnHeaderProps:i}=u({node:e},t,n),o=t.sortDescriptor?.column===e.key,s=t.sortDescriptor?.direction===`ascending`?`▲`:`▼`;return r.createElement(`th`,{...i,className:e.props?.className||void 0,colSpan:e.colSpan??void 0,scope:`col`,ref:n},e.rendered,e.props?.allowsSorting&&r.createElement(`span`,{"aria-hidden":`true`,className:`table-sort-icon`},o?s:`⇅`))},D=({column:e,state:t})=>{let n=a(null),{columnHeaderProps:i}=u({node:e},t,n),{checkboxProps:o}=m(t);return r.createElement(`th`,{...i,className:`table-selection-cell`,scope:`col`,suppressHydrationWarning:!0,ref:n},r.createElement(j,{checkboxProps:o}))},O=({children:e,item:t,state:n})=>{let i=a(null),{rowProps:s}=f({node:t},n,i),c=n.selectionManager.isSelected(t.key);return r.createElement(`tr`,{...s,className:o({active:c},t.props?.className),ref:i},e)},k=({cell:e,stacked:t,state:n})=>{let i=a(null),{gridCellProps:o}=l({node:e},n,i);return r.createElement(`td`,{...o,className:e.props?.className||void 0,"data-cell":t&&e.column?.textValue||void 0,ref:i},e.rendered)},A=({cell:e,state:t})=>{let n=a(null),{gridCellProps:i}=l({node:e},t,n),{checkboxProps:o}=h({key:e.parentKey},t);return r.createElement(`td`,{...i,className:`table-selection-cell`,suppressHydrationWarning:!0,ref:n},r.createElement(j,{checkboxProps:o}))},j=({checkboxProps:e})=>{let t=S(e),n=a(null),{inputProps:i}=s(e,t,n);return r.createElement(`input`,{...i,"aria-describedby":void 0,className:`check-input`,ref:n})},M=y,N=g,P=_,F=b,I=v;export{M as a,N as i,F as n,C as o,P as r,I as t};
|
|
2
|
-
//# sourceMappingURL=table-DPLOygg0.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"table-DPLOygg0.js","names":["TableRow","TableCell","TableBody","StatelyTableBody","TableHeader","StatelyTableHeader"],"sources":["../../src/components/table/Table.tsx","../../src/components/table/TableBody.tsx","../../src/components/table/TableCell.tsx","../../src/components/table/TableColumn.tsx","../../src/components/table/TableHeader.tsx","../../src/components/table/TableRow.tsx"],"sourcesContent":["import React, { ReactElement, ReactNode, Ref, forwardRef, useRef } from 'react'\nimport classNames from 'classnames'\nimport {\n AriaCheckboxProps,\n Key,\n useCheckbox,\n useTable,\n useTableCell,\n useTableColumnHeader,\n useTableHeaderRow,\n useTableRow,\n useTableRowGroup,\n useTableSelectAllCheckbox,\n useTableSelectionCheckbox\n} from 'react-aria'\nimport {\n Selection,\n SortDescriptor,\n TableBodyProps,\n TableHeaderProps,\n TableState,\n useTableState,\n useToggleState\n} from 'react-stately'\n\nimport { useForkedRef } from '../../hooks/useForkedRef'\nimport { ContextColor } from '../../types'\nimport { tableClassName, tableWrapperClassName } from '../../utils/tableClassName'\nimport './Table.css'\n\n// `GridNode<T>` (from `@react-types/shared`) isn't re-exported by either package's public\n// surface — derived from the hooks' own parameter types instead of adding an undeclared\n// dependency on react-aria/react-stately's shared internals package.\ntype ColumnNode<T> = Parameters<typeof useTableColumnHeader<T>>[0]['node']\ntype RowNode<T> = Parameters<typeof useTableRow<T>>[0]['node']\ntype CellNode<T> = Parameters<typeof useTableCell<T>>[0]['node']\n\nexport interface TableProps<T extends object> {\n /**\n * An accessible label for the table, used when there's no visible heading.\n */\n 'aria-label'?: string\n /**\n * Identifies a visible heading element for the table.\n */\n 'aria-labelledby'?: string\n /**\n * Set the vertical alignment of cell content.\n */\n align?: 'bottom' | 'middle' | 'top'\n /**\n * Add borders on all sides of the table and cells.\n */\n bordered?: boolean\n /**\n * Remove borders on all sides of the table and cells.\n */\n borderless?: boolean\n /**\n * Content shown above the table, functioning as a heading for it.\n */\n caption?: ReactNode\n /**\n * A `TableHeader` and a `TableBody`, each built from `TableColumn`/`TableRow`/\n * `TableCell` — read as data to build the table's collection. Not rendered directly.\n */\n children: [\n ReactElement<TableHeaderProps<T> & { className?: string }>,\n ReactElement<TableBodyProps<T> & { className?: string }>\n ]\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Sets the color of the component.\n */\n color?: ContextColor\n /**\n * A list of row keys to disable. Disabled rows cannot be selected, focused, or interacted with.\n */\n disabledKeys?: Iterable<Key>\n /**\n * Content shown below the table in a `<tfoot>`, e.g. a totals row. Rendered as plain markup —\n * not part of the keyboard-navigable grid.\n */\n footer?: ReactNode\n /**\n * Enable a hover state on table rows.\n */\n hover?: boolean\n /**\n * `id` forwarded to the table element.\n */\n id?: string\n /**\n * Handler that is called when the selection changes.\n */\n onSelectionChange?: (keys: Selection) => void\n /**\n * Handler that is called when a column is sorted.\n */\n onSortChange?: (descriptor: SortDescriptor) => void\n /**\n * Make any table responsive across all viewports or pick a maximum breakpoint.\n */\n responsive?: boolean | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n /**\n * The currently selected row keys (controlled).\n */\n selectedKeys?: Selection\n /**\n * The type of selection that is allowed.\n */\n selectionMode?: 'none' | 'single' | 'multiple'\n /**\n * Make table more compact by cutting all cell padding.\n */\n sm?: boolean\n /**\n * The current sort column and direction.\n */\n sortDescriptor?: SortDescriptor\n /**\n * Convert rows into stacked label/value blocks below a container width, for tables with too\n * many columns to read comfortably even with horizontal scrolling. `true` always stacks; a\n * breakpoint name stacks only below it. Implies `responsive` when `responsive` isn't set\n * separately, since stacking needs the same `.table-responsive` container-query ancestor.\n * Labels come from each `TableColumn`'s text (or its `textValue`, for non-text headers).\n */\n stacked?: boolean | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n /**\n * Add zebra-striping to table rows.\n */\n striped?: boolean\n}\n\nconst TableInner = <T extends object>(\n {\n align,\n bordered,\n borderless,\n caption,\n children,\n className,\n color,\n disabledKeys,\n footer,\n hover,\n id,\n onSelectionChange,\n onSortChange,\n responsive,\n selectedKeys,\n selectionMode = 'none',\n sm,\n sortDescriptor,\n stacked,\n striped,\n ...rest\n }: TableProps<T>,\n forwardedRef: Ref<HTMLTableElement>\n) => {\n const state = useTableState<T>({\n children,\n disabledKeys,\n onSelectionChange,\n onSortChange,\n selectedKeys,\n selectionMode,\n showSelectionCheckboxes: selectionMode === 'multiple',\n sortDescriptor\n })\n\n const internalRef = useRef<HTMLTableElement>(null)\n const ref = useForkedRef(internalRef, forwardedRef)\n const { gridProps } = useTable(\n { 'aria-label': rest['aria-label'], 'aria-labelledby': rest['aria-labelledby'], id },\n state,\n internalRef\n )\n\n const _className = tableClassName({\n align,\n bordered,\n borderless,\n className,\n color,\n hover,\n sm,\n stacked,\n striped\n })\n\n const tableEl = (\n // react-aria joins the table's descriptions without dropping an empty result, so a table\n // with none had `aria-describedby=\"\"`.\n <table\n {...gridProps}\n aria-describedby={gridProps['aria-describedby'] || undefined}\n className={_className}\n ref={ref}\n >\n {caption && <caption>{caption}</caption>}\n <TableRowGroup className={children[0].props.className} type=\"thead\">\n {state.collection.headerRows.map((headerRow) => (\n <TableHeaderRow key={headerRow.key} item={headerRow} state={state}>\n {[...(state.collection.getChildren?.(headerRow.key) ?? [])].map((column) =>\n column.props?.isSelectionCell ? (\n <TableSelectAllCell key={column.key} column={column} state={state} />\n ) : (\n <TableColumnHeader key={column.key} column={column} state={state} />\n )\n )}\n </TableHeaderRow>\n ))}\n </TableRowGroup>\n <TableRowGroup className={children[1].props.className} type=\"tbody\">\n {[...state.collection.body.childNodes].map((row) => (\n <TableRow key={row.key} item={row} state={state}>\n {[...(state.collection.getChildren?.(row.key) ?? [])].map((cell) =>\n cell.props?.isSelectionCell ? (\n <TableSelectionCell key={cell.key} cell={cell} state={state} />\n ) : (\n <TableCell key={cell.key} cell={cell} stacked={!!stacked} state={state} />\n )\n )}\n </TableRow>\n ))}\n </TableRowGroup>\n {footer && <tfoot>{footer}</tfoot>}\n </table>\n )\n\n const wrapperClassName = tableWrapperClassName({ responsive, stacked })\n if (!wrapperClassName) return tableEl\n\n return <div className={wrapperClassName}>{tableEl}</div>\n}\n\n// `forwardRef` erases type parameters, so the generic component is cast back to a generic\n// signature for callers — same reasoning as `TableHeader`/`TableBody`'s casts above.\nexport const Table = forwardRef(TableInner) as <T extends object>(\n props: TableProps<T> & { ref?: Ref<HTMLTableElement> }\n) => ReactElement\n\n;(Table as { displayName?: string }).displayName = 'Table'\n\nconst TableRowGroup = ({\n className,\n type: Element,\n children\n}: {\n children: ReactNode\n className?: string\n type: 'thead' | 'tbody'\n}) => {\n const { rowGroupProps } = useTableRowGroup()\n return (\n <Element {...rowGroupProps} className={className || undefined}>\n {children}\n </Element>\n )\n}\n\ninterface TableHeaderRowProps<T> {\n children: ReactNode\n item: RowNode<T>\n state: TableState<T>\n}\n\nconst TableHeaderRow = <T extends object>({ children, item, state }: TableHeaderRowProps<T>) => {\n const ref = useRef<HTMLTableRowElement>(null)\n const { rowProps } = useTableHeaderRow({ node: item }, state, ref)\n return (\n <tr {...rowProps} ref={ref}>\n {children}\n </tr>\n )\n}\n\ninterface TableColumnHeaderProps<T> {\n column: ColumnNode<T>\n state: TableState<T>\n}\n\nconst TableColumnHeader = <T extends object>({ column, state }: TableColumnHeaderProps<T>) => {\n const ref = useRef<HTMLTableCellElement>(null)\n const { columnHeaderProps } = useTableColumnHeader({ node: column }, state, ref)\n const sortActive = state.sortDescriptor?.column === column.key\n const sortIcon = state.sortDescriptor?.direction === 'ascending' ? '▲' : '▼'\n\n return (\n <th\n {...columnHeaderProps}\n className={column.props?.className || undefined}\n colSpan={column.colSpan ?? undefined}\n // react-aria's `useTableColumnHeader` supplies `role=\"columnheader\"` for the ARIA grid\n // pattern but no `scope`, so the native table semantics were left ambiguous — a `<th>` with\n // no `scope` fails WCAG H63, and assistive technology reading the table natively (rather\n // than through the grid roles) has to guess whether the header applies to its column or its\n // row. These are always column headers; the row-header case doesn't exist in this API.\n scope=\"col\"\n ref={ref}\n >\n {column.rendered}\n {column.props?.allowsSorting && (\n <span aria-hidden=\"true\" className=\"table-sort-icon\">\n {sortActive ? sortIcon : '⇅'}\n </span>\n )}\n </th>\n )\n}\n\ninterface TableSelectAllCellProps<T> {\n column: ColumnNode<T>\n state: TableState<T>\n}\n\nconst TableSelectAllCell = <T extends object>({ column, state }: TableSelectAllCellProps<T>) => {\n const ref = useRef<HTMLTableCellElement>(null)\n const { columnHeaderProps } = useTableColumnHeader({ node: column }, state, ref)\n const { checkboxProps } = useTableSelectAllCheckbox(state)\n\n return (\n <th\n {...columnHeaderProps}\n className=\"table-selection-cell\"\n scope=\"col\"\n // react-stately's internal \"select all\" column key is a module-scoped\n // `'row-header-column-' + Math.random()` constant (@react-stately/table's TableCollection),\n // computed once per JS environment rather than per render. Under SSR this makes `id`/\n // `data-key` here differ between the server module instance and the browser's, on every\n // request — a real react-stately bug, not something this component can influence (the key\n // never reaches a public prop) — see README.md's Table/DataGrid known-issue section for the\n // upstream write-up. The mismatch is confined to this internal bookkeeping attribute (no\n // visible content, nothing else references this id), so suppressing the warning is safe\n // rather than papering over a real functional break.\n suppressHydrationWarning\n ref={ref}\n >\n <TableCheckbox checkboxProps={checkboxProps} />\n </th>\n )\n}\n\ninterface TableRowProps<T> {\n children: ReactNode\n item: RowNode<T>\n state: TableState<T>\n}\n\nconst TableRow = <T extends object>({ children, item, state }: TableRowProps<T>) => {\n const ref = useRef<HTMLTableRowElement>(null)\n const { rowProps } = useTableRow({ node: item }, state, ref)\n const isSelected = state.selectionManager.isSelected(item.key)\n\n return (\n <tr\n {...rowProps}\n className={classNames({ active: isSelected }, item.props?.className)}\n ref={ref}\n >\n {children}\n </tr>\n )\n}\n\ninterface TableCellProps<T> {\n cell: CellNode<T>\n stacked?: boolean\n state: TableState<T>\n}\n\nconst TableCell = <T extends object>({ cell, stacked, state }: TableCellProps<T>) => {\n const ref = useRef<HTMLTableCellElement>(null)\n const { gridCellProps } = useTableCell({ node: cell }, state, ref)\n\n return (\n <td\n {...gridCellProps}\n className={cell.props?.className || undefined}\n data-cell={stacked ? cell.column?.textValue || undefined : undefined}\n ref={ref}\n >\n {cell.rendered}\n </td>\n )\n}\n\nconst TableSelectionCell = <T extends object>({ cell, state }: TableCellProps<T>) => {\n const ref = useRef<HTMLTableCellElement>(null)\n const { gridCellProps } = useTableCell({ node: cell }, state, ref)\n const { checkboxProps } = useTableSelectionCheckbox({ key: cell.parentKey! }, state)\n\n return (\n // See `TableSelectAllCell`'s comment: this cell's `id`/`data-key` derive from the same\n // module-scoped random column key and mismatch between server and client under SSR.\n <td {...gridCellProps} className=\"table-selection-cell\" suppressHydrationWarning ref={ref}>\n <TableCheckbox checkboxProps={checkboxProps} />\n </td>\n )\n}\n\nconst TableCheckbox = ({ checkboxProps }: { checkboxProps: AriaCheckboxProps }) => {\n const toggleState = useToggleState(checkboxProps)\n const ref = useRef<HTMLInputElement>(null)\n const { inputProps } = useCheckbox(checkboxProps, toggleState, ref)\n\n // `aria-describedby` after the spread: react-aria's own adds ids it never renders (FORMS.md,\n // gotcha 6).\n return <input {...inputProps} aria-describedby={undefined} className=\"check-input\" ref={ref} />\n}\n","import { ReactElement } from 'react'\nimport { TableBody as StatelyTableBody } from 'react-stately'\n\nexport interface TableBodyProps<T> {\n /**\n * `TableRow` elements, or a render function paired with `items` for dynamic row generation.\n */\n children: ReactElement | ReactElement[] | ((item: T) => ReactElement)\n /**\n * A string of all className you want applied to the `<tbody>` element.\n */\n className?: string\n /**\n * A list of row data objects, rendered via the function form of `children`.\n */\n items?: Iterable<T>\n}\n\n/**\n * Collection node, data-only — read by `Table` to build the table's row collection. Never\n * rendered directly.\n */\nexport const TableBody = StatelyTableBody as unknown as <T>(\n props: TableBodyProps<T>\n) => ReactElement\n","import { ReactElement, ReactNode } from 'react'\nimport { Cell } from 'react-stately'\n\nexport interface TableCellProps {\n /**\n * The contents of the cell.\n */\n children: ReactNode\n /**\n * A string of all className you want applied to the cell.\n */\n className?: string\n /**\n * Indicates how many columns the cell spans.\n */\n colSpan?: number\n /**\n * A string representation of the cell's contents, used for typeahead.\n */\n textValue?: string\n}\n\n/**\n * Collection node, data-only — see `TableHeader`. Read by `Table` to build a cell in the\n * table's collection; never rendered directly.\n */\nexport const TableCell = Cell as unknown as (props: TableCellProps) => ReactElement\n","import { ReactElement, ReactNode } from 'react'\nimport { Column } from 'react-stately'\n\nexport interface TableColumnProps {\n /**\n * Whether the column allows sorting. Adds a sort indicator and makes the header\n * clickable/keyboard-activatable.\n */\n allowsSorting?: boolean\n /**\n * Rendered contents of the column header.\n */\n children: ReactNode\n /**\n * A string of all className you want applied to the column header.\n */\n className?: string\n /**\n * A string representation of the column header, used for accessibility announcements and,\n * when `Table`'s `stacked` prop is set, as the label shown before each row's value for this\n * column. Defaults to `children` when it's a plain string — set this explicitly when the\n * header contains anything else (an icon, a `Tooltip`, etc.).\n */\n textValue?: string\n}\n\n/**\n * Collection node, data-only — see `TableHeader`. Read by `Table` to build a column in the\n * table's collection; never rendered directly.\n */\nexport const TableColumn = Column as unknown as (props: TableColumnProps) => ReactElement\n","import { ReactElement } from 'react'\nimport { TableHeader as StatelyTableHeader } from 'react-stately'\n\nexport interface TableHeaderProps<T> {\n /**\n * `TableColumn` elements, or a render function paired with `columns` for dynamic column\n * generation.\n */\n children: ReactElement | ReactElement[] | ((column: T) => ReactElement)\n /**\n * A string of all className you want applied to the `<thead>` element.\n */\n className?: string\n /**\n * A list of column data objects, rendered via the function form of `children`.\n */\n columns?: readonly T[]\n}\n\n/**\n * Collection node, data-only — read by `Table` to build the table's column collection. Never\n * rendered directly.\n */\nexport const TableHeader = StatelyTableHeader as unknown as <T>(\n props: TableHeaderProps<T>\n) => ReactElement\n","import { Key, ReactElement } from 'react'\nimport { Row } from 'react-stately'\n\nexport interface TableRowProps {\n /**\n * `TableCell` elements, or a render function called once per column with that column's key —\n * required when the row's parent `TableBody` uses the `items`/render-function form.\n */\n children: ReactElement | ReactElement[] | ((columnKey: Key) => ReactElement)\n /**\n * A string of all className you want applied to the row.\n */\n className?: string\n /**\n * A string representation of the row's contents, used for typeahead.\n */\n textValue?: string\n}\n\n/**\n * Collection node, data-only — see `TableHeader`. Read by `Table` to build a row in the\n * table's collection; never rendered directly.\n */\nexport const TableRow = Row as unknown as (props: TableRowProps) => ReactElement\n"],"mappings":"ojBAkPA,MAAa,EAAQ,GAxGnB,CACE,QACA,WACA,aACA,UACA,WACA,YACA,QACA,eACA,SACA,QACA,KACA,oBACA,eACA,aACA,eACA,gBAAgB,OAChB,KACA,iBACA,UACA,UACA,GAAG,GAEL,IACG,CACH,IAAM,EAAQ,EAAiB,CAC7B,WACA,eACA,oBACA,eACA,eACA,gBACA,wBAAyB,IAAkB,WAC3C,gBACF,CAAC,EAEK,EAAc,EAAyB,IAAI,EAC3C,EAAM,EAAa,EAAa,CAAY,EAC5C,CAAE,aAAc,EACpB,CAAE,aAAc,EAAK,cAAe,kBAAmB,EAAK,mBAAoB,IAAG,EACnF,EACA,CACF,EAEM,EAAa,EAAe,CAChC,QACA,WACA,aACA,YACA,QACA,QACA,KACA,UACA,SACF,CAAC,EAEK,EAGJ,EAAA,cAAC,QAAD,CACE,GAAI,EACJ,mBAA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({align:n,bordered:r,borderless:i,className:a,color:o,hover:s,sm:c,stacked:l,striped:u}){return e(`table`,o,n&&t[n],{bordered:r,borderless:i,hoverable:s,sm:c,stacked:l===!0,striped:u},typeof l==`string`?`max-${l}:stacked`:void 0,a)||void 0}function r({responsive:e,stacked:t}){if(e||t)return!e||e===!0?`table-responsive`:`max-${e}:table-responsive`}export{n,r,t};
|
|
2
|
-
//# sourceMappingURL=tableClassName-DleBjOj2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tableClassName-DleBjOj2.js","names":[],"sources":["../../src/utils/tableClassName.ts"],"sourcesContent":["import classNames from 'classnames'\n\nimport { Breakpoint, ContextColor } from '../types'\n\n// The styling props `Table` and `StaticTable` share. Kept in one place so the two can't drift into\n// applying different chassis-css classes for the same prop — `StaticTable` exists to be the\n// zero-JS twin of `Table`'s look, so a prop meaning something different on each would defeat it.\nexport interface TableStyleProps {\n /**\n * Set the vertical alignment of cell content.\n */\n align?: 'bottom' | 'middle' | 'top'\n /**\n * Add borders on all sides of the table and cells.\n */\n bordered?: boolean\n /**\n * Remove borders on all sides of the table and cells.\n */\n borderless?: boolean\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Sets the color of the component.\n */\n color?: ContextColor\n /**\n * Enable a hover state on table rows.\n */\n hover?: boolean\n /**\n * Make any table responsive across all viewports or pick a maximum breakpoint.\n */\n responsive?: boolean | Breakpoint\n /**\n * Make table more compact by cutting all cell padding.\n */\n sm?: boolean\n /**\n * Convert rows into stacked label/value blocks below a container width, for tables with too\n * many columns to read comfortably even with horizontal scrolling. `true` always stacks; a\n * breakpoint name stacks only below it. Implies `responsive` when `responsive` isn't set\n * separately, since stacking needs the same `.table-responsive` container-query ancestor.\n */\n stacked?: boolean | Breakpoint\n /**\n * Add zebra-striping to table rows.\n */\n striped?: boolean\n}\n\n// Whole class names, not `align-${align}`: see `utils/colorClassNames.ts`.\nexport const TABLE_ALIGN_CLASS_NAMES: Record<NonNullable<TableStyleProps['align']>, string> = {\n bottom: 'align-bottom',\n middle: 'align-middle',\n top: 'align-top'\n}\n\nexport function tableClassName({\n align,\n bordered,\n borderless,\n className,\n color,\n hover,\n sm,\n stacked,\n striped\n}: TableStyleProps): string | undefined {\n return (\n classNames(\n 'table',\n color,\n align && TABLE_ALIGN_CLASS_NAMES[align],\n {\n bordered,\n borderless,\n hoverable: hover,\n sm,\n stacked: stacked === true,\n striped\n },\n typeof stacked === 'string' ? `max-${stacked}:stacked` : undefined,\n className\n ) || undefined\n )\n}\n\n// `undefined` when the table needs no wrapper at all. Stacking needs the same `.table-responsive`\n// container-query ancestor as horizontal scrolling, so `stacked` alone still gets one.\nexport function tableWrapperClassName({\n responsive,\n stacked\n}: Pick<TableStyleProps, 'responsive' | 'stacked'>): string | undefined {\n if (!responsive && !stacked) return undefined\n if (!responsive || responsive === true) return 'table-responsive'\n return `max-${responsive}:table-responsive`\n}\n"],"mappings":"0BAsDA,MAAa,EAAiF,CAC5F,OAAQ,eACR,OAAQ,eACR,IAAK,WACP,EAEA,SAAgB,EAAe,CAC7B,QACA,WACA,aACA,YACA,QACA,QACA,KACA,UACA,WACsC,CACtC,OACE,EACE,QACA,EACA,GAAS,EAAwB,GACjC,CACE,WACA,aACA,UAAW,EACX,KACA,QAAS,IAAY,GACrB,SACF,EACA,OAAO,GAAY,SAAW,OAAO,EAAQ,UAAY,IAAA,GACzD,CACF,GAAK,IAAA,EAET,CAIA,SAAgB,EAAsB,CACpC,aACA,WACsE,CAClE,GAAC,GAAe,EAEpB,MADI,CAAC,GAAc,IAAe,GAAa,mBACxC,OAAO,EAAW,kBAC3B"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{t as e}from"./useForkedRef-DVEfT-KI.js";import{t}from"./lazyElement-tfMG21pZ.js";import{t as n}from"./polymorphic-BhGNZQja.js";import{t as r}from"./useIsomorphicLayoutEffect-BbqRwuqn.js";import{t as i}from"./useTransitionState-e5ToY7eX.js";import{i as a,n as o,s}from"./navOverflow-B5krZe6D.js";import{r as c}from"./unhandledProps-9Kdj7WVf.js";import{t as l}from"./navVariant-DeGTk9B7.js";import u,{createContext as d,forwardRef as f,useContext as p,useEffect as m,useRef as h,useState as g}from"react";import _ from"classnames";import{useLocale as v,useTab as y,useTabList as b,useTabPanel as x}from"react-aria";import{Item as S,useTabListState as C}from"react-stately";const w=d(null),T=()=>{let e=p(w);if(!e)throw Error(`TabList and TabPanel must be rendered inside a Tabs`);return e},E=f(({className:t,size:n,variant:r=`tabs`,...i},s)=>{let{keyboardActivation:d,orientation:f,state:m}=T(),y=h(null),x=e(s,y),{direction:S}=v(),{tabListProps:C}=b({keyboardActivation:d,orientation:f,...i},m,y),w=p(o)!==null,[E]=g(()=>new WeakMap),[A,j]=g(!1),M=_(`nav`,n,l(r,`TabList`),t),N=e=>{if(!w||f===`vertical`)return;let t=D(e.key,S===`rtl`);if(t===void 0)return;let n=O(e.currentTarget),r=n.findIndex(t=>t.contains(e.target));if(r===-1)return;e.preventDefault(),e.stopPropagation();let i=t===`first`?n[0]:t===`last`?n[n.length-1]:n[(r+t+n.length)%n.length];if(!i)return;i.focus();let a=E.get(i);a!==void 0&&d!==`manual`&&m.setSelectedKey(a)};return u.createElement(`ul`,{className:M,...c(C,i,[`children`]),onKeyDownCapture:N,...w&&{onBlurCapture:()=>j(!1),onFocusCapture:e=>j(e.target.matches(`.nav-overflow-toggle`))},ref:x},u.createElement(a,{tabs:!0},[...m.collection].map(e=>u.createElement(k,{key:e.key,item:e,tabKeys:E,tabStop:!A}))))});E.displayName=`TabList`;const D=(e,t)=>{switch(e){case`ArrowRight`:return t?-1:1;case`ArrowLeft`:return t?1:-1;case`Home`:return`first`;case`End`:return`last`;default:return}},O=e=>Array.from(e.children).flatMap(e=>{if(e.hasAttribute(`data-cx-nav-overflow`)||e.classList.contains(`d-none`))return[];let t=e.querySelector(`[role="tab"]:not([aria-disabled="true"])`);return t?[t]:[]}),k=({item:e,tabKeys:t,tabStop:n})=>{let{state:i}=T(),a=h(null),{tabProps:o,isSelected:c,isDisabled:l}=y({key:e.key},i,a),d=h(!1),f=s({children:e.rendered,disabled:l,onClick:()=>{d.current=!0,requestAnimationFrame(()=>{d.current=!1}),i.setSelectedKey(e.key)}});return r(()=>{a.current&&t.set(a.current,e.key)}),r(()=>{!f.hidden&&d.current&&(d.current=!1,a.current?.focus())},[f.hidden]),u.createElement(`li`,{className:_(`nav-item`,{"nav-overflow-keep":e.value?.props.keepVisible}),role:`presentation`,...f.hidden&&{"data-cx-nav-overflow":`true`},ref:f.ref},u.createElement(`a`,{className:_(`nav-link`,{active:c,disabled:l}),...o,tabIndex:n?c&&!l&&i.selectionManager.focusedKey==null?0:o.tabIndex:-1,ref:a},e.rendered))},A=f(({children:t,className:n,id:r,...a},o)=>{let{state:s,isInitialSelectionRef:c}=T(),l=h(null),d=e(o,l),{tabPanelProps:f}=x({id:r},s,l),p=s.selectedKey===r,{phase:m}=i({appear:!c.current,in:p,nodeRef:l,unmountOnExit:!0});return p?u.createElement(`div`,{className:_(`tab-pane`,`fade`,`active`,{show:m===`entering`||m===`entered`},n),...f,...a,ref:d},t):null});A.displayName=`TabPanel`;function j({children:e,className:t,component:n,defaultSelectedKey:r,disabledKeys:i,keyboardActivation:a,onSelectionChange:o,orientation:s,selectedKey:c,...l},d){let f=n??`div`,p=u.Children.toArray(e),g=p.find(e=>N(e)!==void 0),_=N(g),v=p.filter(e=>e!==g),y=(_?u.Children.toArray(_.props.children):[]).filter(e=>u.isValidElement(e)),b=y.filter(e=>e.props.disabled).map(e=>e.props.id),x=i?[...i,...b]:b,T=r??P(y,new Set(x)),E=C({children:e=>u.createElement(S,{key:e.props.id,textValue:typeof e.props.children==`string`?e.props.children:void 0},e.props.children),items:y,defaultSelectedKey:T,disabledKeys:x,selectedKey:c,onSelectionChange:o}),D=h(!1);m(()=>{D.current||(D.current=!0,c==null&&r==null&&T!=null&&o?.(T))},[]);let O=h(!0);return m(()=>{O.current=!1},[]),u.createElement(w.Provider,{value:{keyboardActivation:a,orientation:s,state:E,isInitialSelectionRef:O}},u.createElement(f,{className:t,...l,ref:d},g,u.createElement(`div`,{className:`tab-content`},v)))}const M=e=>t(e,E);function N(e,n=2){if(M(e))return e;if(!(n===0||t(e,A))&&u.isValidElement(e))for(let t of u.Children.toArray(e.props.children)){let e=N(t,n-1);if(e)return e}}function P(e,t){return(e.find(e=>!t.has(e.props.id))??e[0])?.props.id}const F=n(j,`Tabs`),I=e=>null;I.displayName=`Tab`;export{E as i,F as n,A as r,I as t};
|
|
2
|
-
//# sourceMappingURL=tabs-91T7-8qq.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tabs-91T7-8qq.js","names":[],"sources":["../../src/components/tabs/context.ts","../../src/components/tabs/TabList.tsx","../../src/components/tabs/TabPanel.tsx","../../src/components/tabs/Tabs.tsx","../../src/components/tabs/Tab.tsx"],"sourcesContent":["import { createContext, MutableRefObject, ReactElement, useContext } from 'react'\nimport { TabListState } from 'react-stately'\n\nimport { TabProps } from './Tab'\n\nexport interface TabsContextValue {\n keyboardActivation?: 'automatic' | 'manual'\n orientation?: 'horizontal' | 'vertical'\n state: TabListState<ReactElement<TabProps>>\n // Read by `TabPanel` at mount time to skip its fade-in for whichever panel is selected on the\n // very first render — only a tab *switch* should animate, not the page settling in. `Tabs`\n // flips this to `false` in an effect once the initial commit has painted.\n isInitialSelectionRef: MutableRefObject<boolean>\n}\n\nexport const TabsContext = createContext<TabsContextValue | null>(null)\n\nexport const useTabsContext = (): TabsContextValue => {\n const context = useContext(TabsContext)\n if (!context) {\n throw new Error('TabList and TabPanel must be rendered inside a Tabs')\n }\n return context\n}\n","import React, {\n AriaAttributes,\n FocusEvent,\n forwardRef,\n KeyboardEvent,\n ReactElement,\n ReactNode,\n useContext,\n useRef,\n useState\n} from 'react'\nimport classNames from 'classnames'\nimport { useLocale, useTab, useTabList } from 'react-aria'\nimport { Key, Node } from 'react-stately'\n\nimport { useForkedRef, useIsomorphicLayoutEffect } from '../../hooks'\nimport { NavOverflowContext, NavOverflowItems, useNavOverflowItem } from '../../utils/navOverflow'\nimport { NavVariant, navVariantClassName } from '../../utils/navVariant'\nimport { mergeUnhandledProps } from '../../utils/unhandledProps'\nimport { TabProps } from './Tab'\nimport { useTabsContext } from './context'\n\nexport interface TabListProps extends AriaAttributes {\n /**\n * `Tab` elements — read as data by `Tabs` to build the tab collection (see `Tabs.tsx`). Not\n * rendered directly.\n */\n children: ReactNode\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Size the component sm or lg.\n */\n size?: 'sm' | 'lg'\n /**\n * Set the tab list variant to tabs, to segments (a segmented control) or to underline, which\n * underlines the selected tab. `'pills'` is the former name of `'segments'`: deprecated, it\n * renders the same.\n *\n * @type { 'tabs' | 'segments' | 'underline' | 'pills' }\n */\n variant?: NavVariant\n}\n\n// Renders the actual, focusable tabs from `state.collection` — built by the ancestor `Tabs`\n// from this component's own `children` (see the comment there). This component's own `children`\n// prop is intentionally unused for rendering.\nexport const TabList = forwardRef<HTMLUListElement, TabListProps>(\n ({ className, size, variant = 'tabs', ...rest }, ref) => {\n const { keyboardActivation, orientation, state } = useTabsContext()\n const listRef = useRef<HTMLUListElement>(null)\n const forkedRef = useForkedRef(ref, listRef)\n const { direction } = useLocale()\n const { tabListProps } = useTabList(\n { keyboardActivation, orientation, ...rest },\n state,\n listRef\n )\n const overflows = useContext(NavOverflowContext) !== null\n const [tabKeys] = useState(() => new WeakMap<Element, Key>())\n // The list is one Tab stop. While the toggle has focus it is that stop, and no tab is: Tab\n // and Shift+Tab then leave the list from it, instead of stopping at a tab on the way.\n const [toggleFocused, setToggleFocused] = useState(false)\n\n const _className = classNames('nav', size, navVariantClassName(variant, 'TabList'), className)\n\n // Inside a `NavOverflow` some tabs are in its menu, hidden here, and its toggle is one more\n // stop among the tabs. react-aria's own arrow keys walk the whole collection, so they would\n // give focus to a hidden tab and never reach the toggle: the arrow keys, Home and End are\n // handled here instead, among the tabs that are shown and the toggle.\n const handleKeyDownCapture = (event: KeyboardEvent<HTMLUListElement>) => {\n if (!overflows || orientation === 'vertical') return\n const step = keyStep(event.key, direction === 'rtl')\n if (step === undefined) return\n const stops = tabStops(event.currentTarget)\n const index = stops.findIndex((stop) => stop.contains(event.target as globalThis.Node))\n if (index === -1) return\n\n event.preventDefault()\n event.stopPropagation()\n const next =\n step === 'first'\n ? stops[0]\n : step === 'last'\n ? stops[stops.length - 1]\n : stops[(index + step + stops.length) % stops.length]\n if (!next) return\n next.focus()\n const key = tabKeys.get(next)\n if (key !== undefined && keyboardActivation !== 'manual') state.setSelectedKey(key)\n }\n\n return (\n <ul\n className={_className}\n {...mergeUnhandledProps(tabListProps, rest, ['children'])}\n onKeyDownCapture={handleKeyDownCapture}\n {...(overflows && {\n onBlurCapture: () => setToggleFocused(false),\n onFocusCapture: (event: FocusEvent) =>\n setToggleFocused((event.target as Element).matches('.nav-overflow-toggle'))\n })}\n ref={forkedRef}\n >\n <NavOverflowItems tabs>\n {[...state.collection].map((item) => (\n <TabItem key={item.key} item={item} tabKeys={tabKeys} tabStop={!toggleFocused} />\n ))}\n </NavOverflowItems>\n </ul>\n )\n }\n)\n\nTabList.displayName = 'TabList'\n\nconst keyStep = (key: string, rtl: boolean): 1 | -1 | 'first' | 'last' | undefined => {\n switch (key) {\n case 'ArrowRight':\n return rtl ? -1 : 1\n case 'ArrowLeft':\n return rtl ? 1 : -1\n case 'Home':\n return 'first'\n case 'End':\n return 'last'\n default:\n return undefined\n }\n}\n\n// What the arrow keys move among: the tabs that are shown and enabled, then the overflow toggle\n// while it is shown. Walks `children` rather than querying with `:scope`, which jsdom misreads\n// under an id with a colon (see `menu/menuNavigation.ts`).\nconst tabStops = (list: HTMLElement): HTMLElement[] =>\n Array.from(list.children).flatMap((item) => {\n if (item.hasAttribute('data-cx-nav-overflow') || item.classList.contains('d-none')) return []\n const stop = item.querySelector<HTMLElement>('[role=\"tab\"]:not([aria-disabled=\"true\"])')\n return stop ? [stop] : []\n })\n\ninterface TabItemProps {\n item: Node<ReactElement<TabProps>>\n tabKeys: WeakMap<Element, Key>\n /**\n * Whether a tab may be the list's Tab stop now.\n */\n tabStop: boolean\n}\n\nconst TabItem = ({ item, tabKeys, tabStop }: TabItemProps) => {\n const { state } = useTabsContext()\n const ref = useRef<HTMLAnchorElement>(null)\n const { tabProps, isSelected, isDisabled } = useTab({ key: item.key }, state, ref)\n\n // Inside a `NavOverflow`, a tab that doesn't fit is shown in its menu as an item that selects\n // it. Selected, the tab is back in the list (the selected tab always is), and takes the focus\n // the menu item had.\n const focusWhenShownRef = useRef(false)\n const overflow = useNavOverflowItem({\n children: item.rendered,\n disabled: isDisabled,\n onClick: () => {\n focusWhenShownRef.current = true\n // Dropped if the tab isn't shown by then: a controlled `selectedKey` that didn't follow.\n requestAnimationFrame(() => {\n focusWhenShownRef.current = false\n })\n state.setSelectedKey(item.key)\n }\n })\n\n useIsomorphicLayoutEffect(() => {\n if (ref.current) tabKeys.set(ref.current, item.key)\n })\n\n useIsomorphicLayoutEffect(() => {\n if (overflow.hidden || !focusWhenShownRef.current) return\n focusWhenShownRef.current = false\n ref.current?.focus()\n }, [overflow.hidden])\n\n return (\n // ARIA's `tablist` role only permits `tab`-role children — `role=\"presentation\"` opts this\n // `<li>` wrapper out without hiding its content, same pattern as `MenuHeader`.\n <li\n className={classNames('nav-item', { 'nav-overflow-keep': item.value?.props.keepVisible })}\n role=\"presentation\"\n {...(overflow.hidden && { 'data-cx-nav-overflow': 'true' })}\n ref={overflow.ref}\n >\n <a\n className={classNames('nav-link', { active: isSelected, disabled: isDisabled })}\n {...tabProps}\n // react-aria makes the selected tab the tab stop in an effect, so the server's HTML had no\n // tab stop and Tab skipped the list until the JavaScript had loaded. A disabled tab never\n // is one.\n tabIndex={\n !tabStop\n ? -1\n : isSelected && !isDisabled && state.selectionManager.focusedKey == null\n ? 0\n : tabProps.tabIndex\n }\n ref={ref}\n >\n {item.rendered}\n </a>\n </li>\n )\n}\n","import React, { forwardRef, HTMLAttributes, ReactNode, useRef } from 'react'\nimport classNames from 'classnames'\nimport { useTabPanel } from 'react-aria'\nimport { Key } from 'react-stately'\n\nimport { useForkedRef, useTransitionState } from '../../hooks'\nimport { useTabsContext } from './context'\n\nexport interface TabPanelProps extends Omit<HTMLAttributes<HTMLDivElement>, 'id'> {\n /**\n * Content of the panel, shown while the `Tab` of the same `id` is selected.\n */\n children: ReactNode\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Pairs this panel with the `Tab` of the same `id`.\n */\n id: Key\n}\n\n// The counterpart to `Tab` — unlike `Tab`, `TabPanel` renders for real, but only while its `id`\n// matches the currently selected tab, and unmounts immediately (not staggered) once it isn't.\n// chassis-css's `.tab-content > .tab-pane`/`.active` rule (`_transitions.scss`) assumes exactly\n// one visible block-level panel at a time — there's no overlap/positioning support for a second\n// panel to occupy the same space while it exits, so staggering the *outgoing* panel's removal\n// would leave two full-height panels stacked in flow simultaneously and visibly shove the layout\n// around. Only the *incoming* panel gets a transition: it mounts without the `show` class —\n// `fade` alone means `opacity: 0` — and gets it once those styles are computed, so the panel\n// fades in instead of popping straight to full opacity. `appear` is gated on\n// `isInitialSelectionRef` so only an actual tab *switch* animates, not whichever panel happens to\n// be selected on first paint.\nexport const TabPanel = forwardRef<HTMLDivElement, TabPanelProps>(\n ({ children, className, id, ...rest }, ref) => {\n const { state, isInitialSelectionRef } = useTabsContext()\n const panelRef = useRef<HTMLDivElement>(null)\n const forkedRef = useForkedRef(ref, panelRef)\n const { tabPanelProps } = useTabPanel({ id }, state, panelRef)\n\n const isSelected = state.selectedKey === id\n const { phase } = useTransitionState({\n appear: !isInitialSelectionRef.current,\n in: isSelected,\n nodeRef: panelRef,\n unmountOnExit: true\n })\n\n // Not `isMounted`: that stays `true` through an exit, and this panel has none. With no\n // element left to wait on, the exit the hook starts ends at once.\n if (!isSelected) return null\n\n return (\n <div\n className={classNames(\n 'tab-pane',\n 'fade',\n 'active',\n { show: phase === 'entering' || phase === 'entered' },\n className\n )}\n {...tabPanelProps}\n {...rest}\n ref={forkedRef}\n >\n {children}\n </div>\n )\n }\n)\n\nTabPanel.displayName = 'TabPanel'\n","import React, {\n ElementType,\n ForwardRefRenderFunction,\n ReactElement,\n ReactNode,\n useEffect,\n useRef\n} from 'react'\nimport { Item, Key, useTabListState } from 'react-stately'\n\nimport { isElementOfType } from '../../utils/lazyElement'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { TabProps } from './Tab'\nimport { TabList } from './TabList'\nimport { TabPanel } from './TabPanel'\nimport { TabsContext } from './context'\n\ntype TabsOwnProps<C extends ElementType> = {\n /**\n * A `TabList` (containing `Tab` children) followed by one `TabPanel` per tab.\n */\n children?: ReactNode\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 * The initially selected tab's key (uncontrolled).\n */\n defaultSelectedKey?: Key\n /**\n * The keys of tabs that cannot be selected, focused, or otherwise interacted with.\n */\n disabledKeys?: Iterable<Key>\n /**\n * Whether tabs are selected automatically on arrow-key focus (`'automatic'`, the default) or\n * only on explicit activation — Enter/Space or click (`'manual'`).\n */\n keyboardActivation?: 'automatic' | 'manual'\n /**\n * Callback fired when the selected tab changes.\n */\n onSelectionChange?: (key: Key) => void\n /**\n * The orientation of the tab list.\n */\n orientation?: 'horizontal' | 'vertical'\n /**\n * The selected tab's key (controlled).\n */\n selectedKey?: Key\n}\n\nexport type TabsProps<C extends ElementType = 'div'> = PolymorphicComponentProps<C, TabsOwnProps<C>>\n\ntype TabsComponent = (<C extends ElementType = 'div'>(\n props: TabsProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction TabsRender<C extends ElementType = 'div'>(\n {\n children,\n className,\n component,\n defaultSelectedKey,\n disabledKeys,\n keyboardActivation,\n onSelectionChange,\n orientation,\n selectedKey,\n ...rest\n }: TabsProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n // `TabList`'s own children (the `Tab`s) are the source of truth for the collection —\n // `TabList` never renders them directly (see its own comment), it only reads them here,\n // at the point react-stately actually needs a collection to build `state` from. This keeps\n // the public authoring shape as plain composed JSX (matching every other chassis-react\n // component) instead of exposing react-aria's raw `items`/`Item` collection API directly.\n //\n // `isElementOfType` rather than `child.type === TabList`: written in a Server Component, the\n // children's types are lazy wrappers (see `utils/lazyElement`).\n const childArray = React.Children.toArray(children)\n // The `TabList`, or the element that holds it: a `NavOverflow` around the list is found inside\n // it, and rendered where the list would be.\n const tabListHolder = childArray.find((child) => findTabList(child) !== undefined)\n const tabListChild = findTabList(tabListHolder)\n const panelChildren = childArray.filter((child) => child !== tabListHolder)\n const tabs = (tabListChild ? React.Children.toArray(tabListChild.props.children) : []).filter(\n (child): child is ReactElement<TabProps> => React.isValidElement(child)\n )\n\n const tabDisabledKeys = tabs.filter((tab) => tab.props.disabled).map((tab) => tab.props.id)\n const allDisabledKeys = disabledKeys ? [...disabledKeys, ...tabDisabledKeys] : tabDisabledKeys\n\n // With no key given, react-stately selects the first enabled tab in an effect, which never runs\n // on the server: the server HTML had no selected tab and no panel. Choosing that tab here, by\n // react-stately's own rule (the first enabled tab, or the first tab when all are disabled),\n // selects it on the first render.\n const initialKey = defaultSelectedKey ?? firstEnabledKey(tabs, new Set(allDisabledKeys))\n\n const state = useTabListState<ReactElement<TabProps>>({\n children: (tab) => (\n <Item\n key={tab.props.id}\n textValue={typeof tab.props.children === 'string' ? tab.props.children : undefined}\n >\n {tab.props.children}\n </Item>\n ),\n items: tabs,\n defaultSelectedKey: initialKey,\n disabledKeys: allDisabledKeys,\n selectedKey,\n onSelectionChange\n })\n\n // react-stately's own selection of that tab reported it through `onSelectionChange`, which a key\n // given up front doesn't: report it once on mount, as before, so state kept from it (a\n // `selectedKey` that starts unset) learns the initial tab.\n const reportedInitialKeyRef = useRef(false)\n useEffect(() => {\n if (reportedInitialKeyRef.current) return\n reportedInitialKeyRef.current = true\n if (selectedKey == null && defaultSelectedKey == null && initialKey != null) {\n onSelectionChange?.(initialKey)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n // Flipped to `false` once the initial commit has painted, so `TabPanel` can tell \"selected on\n // load\" apart from \"selected by switching\" and only fade in the latter.\n const isInitialSelectionRef = useRef(true)\n useEffect(() => {\n isInitialSelectionRef.current = false\n }, [])\n\n return (\n <TabsContext.Provider value={{ keyboardActivation, orientation, state, isInitialSelectionRef }}>\n <Component className={className} {...rest} ref={ref}>\n {tabListHolder}\n <div className=\"tab-content\">{panelChildren}</div>\n </Component>\n </TabsContext.Provider>\n )\n}\n\ntype TabListElement = ReactElement<{ children?: ReactNode }>\n\nconst isTabList = (child: unknown): child is TabListElement =>\n isElementOfType<{ children?: ReactNode }>(child, TabList)\n\n// `child` when it is the `TabList`, or the `TabList` inside it: one level down, or two, which is\n// where `<NavOverflow asChild>` around an element of the caller's puts it. Never inside a\n// `TabPanel`: reading a panel's children would wait for content that isn't shown.\nfunction findTabList(child: unknown, depth = 2): TabListElement | undefined {\n if (isTabList(child)) return child\n if (depth === 0 || isElementOfType(child, TabPanel)) return undefined\n if (!React.isValidElement<{ children?: ReactNode }>(child)) return undefined\n for (const inner of React.Children.toArray(child.props.children)) {\n const found = findTabList(inner, depth - 1)\n if (found) return found\n }\n return undefined\n}\n\nfunction firstEnabledKey(tabs: ReactElement<TabProps>[], disabled: Set<Key>): Key | undefined {\n return (tabs.find((tab) => !disabled.has(tab.props.id)) ?? tabs[0])?.props.id\n}\n\nexport const Tabs = createPolymorphicComponent<TabsComponent>(\n TabsRender as ForwardRefRenderFunction<Element, TabsProps<ElementType>>,\n 'Tabs'\n)\n","import { ReactNode } from 'react'\nimport { Key } from 'react-stately'\n\nexport interface TabProps {\n /**\n * Label content for the tab. Must be a plain string for it to be used as the tab's accessible\n * name when the rendered content itself doesn't expose one (e.g. an icon-only tab).\n */\n children: ReactNode\n /**\n * Prevents the tab from being selected, focused, or otherwise interacted with.\n */\n disabled?: boolean\n /**\n * Identifies this tab and pairs it with the `TabPanel` of the same `id`.\n */\n id: Key\n /**\n * Keeps the tab in the list inside a `NavOverflow`, whatever the width.\n */\n keepVisible?: boolean\n}\n\n// `Tab` is never actually mounted — it's read as data by `Tabs`, which builds react-aria's tab\n// collection from each `Tab`'s `id` and `children` (see `Tabs.tsx`), and `TabList` renders the\n// real, focusable tab elements from that collection instead. This keeps the public authoring\n// shape as plain composed JSX:\n//\n// <TabList aria-label=\"...\">\n// <Tab id=\"home\">Home</Tab>\n// <Tab id=\"profile\">Profile</Tab>\n// </TabList>\n// <TabPanel id=\"home\">...</TabPanel>\n// <TabPanel id=\"profile\">...</TabPanel>\n//\n// `id` (not React's own `key`) is what pairs a tab with its panel — still give each `Tab`/\n// `TabPanel` a React `key` too, as you would for any list.\nexport const Tab = (_props: TabProps): null => null\n\nTab.displayName = 'Tab'\n"],"mappings":"usBAeA,MAAa,EAAc,EAAuC,IAAI,EAEzD,MAAyC,CACpD,IAAM,EAAU,EAAW,CAAW,EACtC,GAAI,CAAC,EACH,MAAU,MAAM,qDAAqD,EAEvE,OAAO,CACT,EC0Ba,EAAU,GACpB,CAAE,YAAW,OAAM,UAAU,OAAQ,GAAG,GAAQ,IAAQ,CACvD,GAAM,CAAE,qBAAoB,cAAa,SAAU,EAAe,EAC5D,EAAU,EAAyB,IAAI,EACvC,EAAY,EAAa,EAAK,CAAO,EACrC,CAAE,aAAc,EAAU,EAC1B,CAAE,gBAAiB,EACvB,CAAE,qBAAoB,cAAa,GAAG,CAAK,EAC3C,EACA,CACF,EACM,EAAY,EAAW,CAAkB,IAAM,KAC/C,CAAC,GAAW,MAAe,IAAI,OAAuB,EAGtD,CAAC,EAAe,GAAoB,EAAS,EAAK,EAElD,EAAa,EAAW,MAAO,EAAM,EAAoB,EAAS,SAAS,EAAG,CAAS,EAMvF,EAAwB,GAA2C,CAC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4.js";import{t as n}from"./renderFormField-Brkw1yA6.js";import{t as r}from"./validationClassName-gRGs4KBm.js";import{r as i,t as a}from"./unhandledProps-9Kdj7WVf.js";import o,{forwardRef as s,useRef as c}from"react";import l from"classnames";import{useTextField as u}from"react-aria";const d=s(({adornEnd:s,adornStart:d,className:f,disabled:p,help:m,id:h,invalid:g,invalidFeedback:_,label:v,plainText:y,readOnly:b,size:x,style:S,type:C=`text`,valid:w,validFeedback:T,...E},D)=>{let O=c(null),k=e(D,O),{describedBy:A,feedbackId:j,helpId:M,inputId:N,labelId:P,labelledBy:F}=t({ariaDescribedBy:E[`aria-describedby`],ariaLabelledBy:E[`aria-labelledby`],help:m,id:h,invalid:g,invalidFeedback:_,label:v,valid:w,validFeedback:T}),{inputProps:I}=u({...E,"aria-describedby":A,"aria-labelledby":F,id:N,isDisabled:p,isInvalid:g,isReadOnly:b,type:C},O),L=d!=null||s!=null,R=l(L?`ghost-input`:`form-input`,!L&&y&&`plaintext`,!L&&x,r(g,w),!L&&f),z=o.createElement(`input`,{...i(I,E,a),"aria-describedby":A,className:R,ref:k,style:L?void 0:S}),B=L?o.createElement(`div`,{className:l(`form-input`,y&&`plaintext`,x,f),style:S},d,z,s):z;return n({children:B,help:m,ids:{feedback:j,help:M,input:N,label:P},invalid:g,invalidFeedback:_,label:v,valid:w,validFeedback:T})});d.displayName=`TextInput`;export{d as t};
|
|
2
|
-
//# sourceMappingURL=text-input-B4pTv6SU.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text-input-B4pTv6SU.js","names":[],"sources":["../../src/components/text-input/TextInput.tsx"],"sourcesContent":["import React, { forwardRef, InputHTMLAttributes, ReactNode, useRef } from 'react'\nimport classNames from 'classnames'\nimport { AriaTextFieldProps, useTextField } from 'react-aria'\n\nimport { useForkedRef, useFormField } from '../../hooks'\nimport { mergeUnhandledProps, TEXT_FIELD_PROPS } from '../../utils/unhandledProps'\nimport { validationClassName } from '../../utils/validationClassName'\nimport { renderFormField } from '../form-field/renderFormField'\n\nexport interface TextInputProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'defaultValue' | 'onChange' | 'size' | 'value'\n> {\n /**\n * Content rendered at the input's trailing edge, e.g. a `InputAdorn` icon, text, or button.\n * Setting either `adornStart` or `adornEnd` renders a `.form-input` wrapper around a\n * `.ghost-input`, matching chassis-css's [input help](https://chassis-ui.com/css/docs/forms/input-adorn) pattern.\n */\n adornEnd?: ReactNode\n /**\n * Content rendered at the input's leading edge, e.g. a `InputAdorn` icon, text, or button.\n * Setting either `adornStart` or `adornEnd` renders a `.form-input` wrapper around a\n * `.ghost-input`, matching chassis-css's [input help](https://chassis-ui.com/css/docs/forms/input-adorn) pattern.\n */\n adornStart?: ReactNode\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 * Handler that is called when the value changes.\n */\n onChange?: (value: string) => void\n /**\n * Render the component styled as plain text. Removes the default form field styling and preserve the correct margin and padding. Recommend to use only along side `readonly` [docs]\n */\n plainText?: boolean\n /**\n * Toggle the readonly state for the component.\n */\n readOnly?: boolean\n /**\n * Size the component sm or lg.\n */\n size?: 'sm' | 'lg'\n /**\n * Specifies the type of component. For `color` or `file` inputs, use the dedicated `ColorInput` or `FileInput` components instead.\n */\n type?:\n | 'date'\n | 'datetime-local'\n | 'email'\n | 'month'\n | 'password'\n | 'search'\n | 'tel'\n | 'text'\n | 'time'\n | 'url'\n | 'week'\n | (string & {})\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 of the input, controlled.\n */\n value?: string\n}\n\nexport const TextInput = forwardRef<HTMLInputElement, TextInputProps>(\n (\n {\n adornEnd,\n adornStart,\n className,\n disabled,\n help,\n id,\n invalid,\n invalidFeedback,\n label,\n plainText,\n readOnly,\n size,\n style,\n type = 'text',\n valid,\n validFeedback,\n ...rest\n },\n ref\n ) => {\n const inputRef = useRef<HTMLInputElement>(null)\n const forkedRef = useForkedRef(ref, inputRef)\n\n const { describedBy, feedbackId, helpId, inputId, labelId, labelledBy } = useFormField({\n ariaDescribedBy: rest['aria-describedby'],\n ariaLabelledBy: rest['aria-labelledby'],\n help,\n id,\n invalid,\n invalidFeedback,\n label,\n valid,\n validFeedback\n })\n\n const { inputProps } = useTextField(\n {\n ...rest,\n 'aria-describedby': describedBy,\n 'aria-labelledby': labelledBy,\n id: inputId,\n isDisabled: disabled,\n isInvalid: invalid,\n isReadOnly: readOnly,\n type\n } as AriaTextFieldProps,\n inputRef\n )\n\n const hasAdorn = adornStart != null || adornEnd != null\n\n // chassis-css's `.form-input:has(.ghost-input.is-valid)` selector reads validation state off\n // the inner input, not the wrapper, once adorns turn `.form-input` into a flex container - see\n // https://chassis-ui.com/css/docs/forms/input-adorn.\n const inputClassName = classNames(\n hasAdorn ? 'ghost-input' : 'form-input',\n !hasAdorn && plainText && 'plaintext',\n !hasAdorn && size,\n validationClassName(invalid, valid),\n !hasAdorn && className\n )\n\n // `aria-describedby` after the spread: react-aria's own adds ids it never renders (FORMS.md,\n // gotcha 6). `style` goes where `className` does, on the outermost element.\n const input = (\n <input\n {...mergeUnhandledProps(inputProps, rest, TEXT_FIELD_PROPS)}\n aria-describedby={describedBy}\n className={inputClassName}\n ref={forkedRef}\n style={hasAdorn ? undefined : style}\n />\n )\n\n const children = hasAdorn ? (\n <div\n className={classNames('form-input', plainText && 'plaintext', size, className)}\n style={style}\n >\n {adornStart}\n {input}\n {adornEnd}\n </div>\n ) : (\n input\n )\n\n return renderFormField({\n children,\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\nTextInput.displayName = 'TextInput'\n"],"mappings":"gZAmGA,MAAa,EAAY,GAErB,CACE,WACA,aACA,YACA,WACA,OACA,KACA,UACA,kBACA,QACA,YACA,WACA,OACA,QACA,OAAO,OACP,QACA,gBACA,GAAG,GAEL,IACG,CACH,IAAM,EAAW,EAAyB,IAAI,EACxC,EAAY,EAAa,EAAK,CAAQ,EAEtC,CAAE,cAAa,aAAY,SAAQ,UAAS,UAAS,cAAe,EAAa,CACrF,gBAAiB,EAAK,oBACtB,eAAgB,EAAK,mBACrB,OACA,KACA,UACA,kBACA,QACA,QACA,eACF,CAAC,EAEK,CAAE,cAAe,EACrB,CACE,GAAG,EACH,mBAAoB,EACpB,kBAAmB,EACnB,GAAI,EACJ,WAAY,EACZ,UAAW,EACX,WAAY,EACZ,MACF,EACA,CACF,EAEM,EAAW,GAAc,MAAQ,GAAY,KAK7C,EAAiB,EACrB,EAAW,cAAgB,aAC3B,CAAC,GAAY,GAAa,YAC1B,CAAC,GAAY,EACb,EAAoB,EAAS,CAAK,EAClC,CAAC,GAAY,CACf,EAIM,EACJ,EAAA,cAAC,QAAD,CACE,GAAI,EAAoB,EAAY,EAAM,CAAgB,EAC1D,mBAAkB,EAClB,UAAW,EACX,IAAK,EACL,MAAO,EAAW,IAAA,GAAY,CAC/B,CAAA,EAGG,EAAW,EACf,EAAA,cAAC,MAAD,CACE,UAAW,EAAW,aAAc,GAAa,YAAa,EAAM,CAAS,EACtE,OAKJ,EAHF,EACA,EACA,CACE,EAEL,EAGF,OAAO,EAAgB,CACrB,WACA,OACA,IAAK,CAAE,SAAU,EAAY,KAAM,EAAQ,MAAO,EAAS,MAAO,CAAQ,EAC1E,UACA,kBACA,QACA,QACA,eACF,CAAC,CACH,CACF,EAEA,EAAU,YAAc"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{t as e}from"./useForkedRef-DVEfT-KI.js";import{t}from"./useFormField-BOqmBTC4.js";import{t as n}from"./renderFormField-Brkw1yA6.js";import{t as r}from"./validationClassName-gRGs4KBm.js";import{r as i,t as a}from"./unhandledProps-9Kdj7WVf.js";import o,{forwardRef as s,useRef as c}from"react";import l from"classnames";import{useTextField as u}from"react-aria";const d=s(({className:s,disabled:d,help:f,id:p,invalid:m,invalidFeedback:h,label:g,plainText:_,readOnly:v,rows:y,size:b,valid:x,validFeedback:S,...C},w)=>{let T=c(null),E=e(w,T),{describedBy:D,feedbackId:O,helpId:k,inputId:A,labelId:j,labelledBy:M}=t({ariaDescribedBy:C[`aria-describedby`],ariaLabelledBy:C[`aria-labelledby`],help:f,id:p,invalid:m,invalidFeedback:h,label:g,valid:x,validFeedback:S}),{inputProps:N}=u({...C,"aria-describedby":D,"aria-labelledby":M,id:A,inputElementType:`textarea`,isDisabled:d,isInvalid:m,isReadOnly:v},T),P=l(`form-input`,_&&`plaintext`,b,r(m,x),s);return n({children:o.createElement(`textarea`,{...i(N,C,a),"aria-describedby":D,rows:y,className:P,ref:E}),help:f,ids:{feedback:O,help:k,input:A,label:j},invalid:m,invalidFeedback:h,label:g,valid:x,validFeedback:S})});d.displayName=`Textarea`;export{d as t};
|
|
2
|
-
//# sourceMappingURL=textarea-1A1nABQE.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"textarea-1A1nABQE.js","names":[],"sources":["../../src/components/textarea/Textarea.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode, TextareaHTMLAttributes, useRef } from 'react'\nimport classNames from 'classnames'\nimport { AriaTextFieldOptions, useTextField } from 'react-aria'\n\nimport { useForkedRef, useFormField } from '../../hooks'\nimport { mergeUnhandledProps, TEXT_FIELD_PROPS } from '../../utils/unhandledProps'\nimport { validationClassName } from '../../utils/validationClassName'\nimport { renderFormField } from '../form-field/renderFormField'\n\nexport interface TextareaProps extends Omit<\n TextareaHTMLAttributes<HTMLTextAreaElement>,\n 'defaultValue' | 'onChange' | 'value'\n> {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * The value of the textarea, 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 textarea.\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 textarea when `invalid` is set.\n */\n invalidFeedback?: ReactNode\n /**\n * The field's caption, rendered as a `FormLabel` associated with this textarea.\n */\n label?: ReactNode\n /**\n * Handler that is called when the value changes.\n */\n onChange?: (value: string) => void\n /**\n * Render the component styled as plain text. Removes the default form field styling and preserve the correct margin and padding. Recommend to use only along side `readonly`.\n */\n plainText?: boolean\n /**\n * Toggle the readonly state for the component.\n */\n readOnly?: boolean\n /**\n * The number of visible text lines for the control.\n */\n rows?: number\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 textarea when `valid` is set.\n */\n validFeedback?: ReactNode\n /**\n * The value of the textarea, controlled.\n */\n value?: string\n}\n\nexport const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(\n (\n {\n className,\n disabled,\n help,\n id,\n invalid,\n invalidFeedback,\n label,\n plainText,\n readOnly,\n rows,\n size,\n valid,\n validFeedback,\n ...rest\n },\n ref\n ) => {\n const textareaRef = useRef<HTMLTextAreaElement>(null)\n const forkedRef = useForkedRef(ref, textareaRef)\n\n const { describedBy, feedbackId, helpId, inputId, labelId, labelledBy } = useFormField({\n ariaDescribedBy: rest['aria-describedby'],\n ariaLabelledBy: rest['aria-labelledby'],\n help,\n id,\n invalid,\n invalidFeedback,\n label,\n valid,\n validFeedback\n })\n\n const { inputProps } = useTextField<'textarea'>(\n {\n ...rest,\n 'aria-describedby': describedBy,\n 'aria-labelledby': labelledBy,\n id: inputId,\n inputElementType: 'textarea',\n isDisabled: disabled,\n isInvalid: invalid,\n isReadOnly: readOnly\n } as AriaTextFieldOptions<'textarea'>,\n textareaRef\n )\n\n const _className = classNames(\n 'form-input',\n plainText && 'plaintext',\n size,\n validationClassName(invalid, valid),\n className\n )\n\n return renderFormField({\n // `aria-describedby` after the spread: see `TextInput`.\n children: (\n <textarea\n {...mergeUnhandledProps(inputProps, rest, TEXT_FIELD_PROPS)}\n aria-describedby={describedBy}\n rows={rows}\n className={_className}\n ref={forkedRef}\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\nTextarea.displayName = 'Textarea'\n"],"mappings":"gZA2EA,MAAa,EAAW,GAEpB,CACE,YACA,WACA,OACA,KACA,UACA,kBACA,QACA,YACA,WACA,OACA,OACA,QACA,gBACA,GAAG,GAEL,IACG,CACH,IAAM,EAAc,EAA4B,IAAI,EAC9C,EAAY,EAAa,EAAK,CAAW,EAEzC,CAAE,cAAa,aAAY,SAAQ,UAAS,UAAS,cAAe,EAAa,CACrF,gBAAiB,EAAK,oBACtB,eAAgB,EAAK,mBACrB,OACA,KACA,UACA,kBACA,QACA,QACA,eACF,CAAC,EAEK,CAAE,cAAe,EACrB,CACE,GAAG,EACH,mBAAoB,EACpB,kBAAmB,EACnB,GAAI,EACJ,iBAAkB,WAClB,WAAY,EACZ,UAAW,EACX,WAAY,CACd,EACA,CACF,EAEM,EAAa,EACjB,aACA,GAAa,YACb,EACA,EAAoB,EAAS,CAAK,EAClC,CACF,EAEA,OAAO,EAAgB,CAErB,SACE,EAAA,cAAC,WAAD,CACE,GAAI,EAAoB,EAAY,EAAM,CAAgB,EAC1D,mBAAkB,EACZ,OACN,UAAW,EACX,IAAK,CACN,CAAA,EAEH,OACA,IAAK,CAAE,SAAU,EAAY,KAAM,EAAQ,MAAO,EAAS,MAAO,CAAQ,EAC1E,UACA,kBACA,QACA,QACA,eACF,CAAC,CACH,CACF,EAEA,EAAS,YAAc"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{l as e}from"./slot-CNhFZdHF.js";import{t}from"./useForkedRef-DVEfT-KI.js";import{t as n}from"./useFormField-BOqmBTC4.js";import{t as r}from"./renderFormField-Brkw1yA6.js";import{t as i}from"./validationClassName-gRGs4KBm.js";import{t as a}from"./DateSegment-2agXAd0f.js";import o,{forwardRef as s,useRef as c}from"react";import ee from"classnames";import{mergeProps as l,useLocale as te,useTimeField as u}from"react-aria";import{useTimeFieldState as ne}from"react-stately";const d=s(({autoFocus:s,className:d,defaultValue:f,disabled:p,form:m,granularity:h,help:g,hideTimeZone:_,hourCycle:re,id:ie,invalid:v,invalidFeedback:y,label:b,maxValue:x,minValue:S,name:C,onBlur:w,onChange:T,onFocus:E,onKeyDown:D,onKeyUp:O,placeholderValue:k,readOnly:A,required:j,shouldForceLeadingZeros:M,size:N,valid:P,validFeedback:F,value:I,...L},R)=>{let z=c(null),B=t(R,z),V=c(null),{locale:H}=te(),U={"aria-label":L[`aria-label`],autoFocus:s,defaultValue:f,form:m,granularity:h,hideTimeZone:_,hourCycle:re,inputRef:V,isDisabled:p,isInvalid:v||void 0,isReadOnly:A,isRequired:j,maxValue:x,minValue:S,name:C,onBlur:w,onChange:T,onFocus:E,onKeyDown:D,onKeyUp:O,placeholderValue:k,shouldForceLeadingZeros:M,value:I},W=ne({...U,locale:H}),G=v||W.displayValidation.isInvalid,K=P&&!G,{describedBy:q,feedbackId:J,helpId:Y,inputId:ae,labelId:oe,labelledBy:X}=n({ariaDescribedBy:L[`aria-describedby`],ariaLabelledBy:L[`aria-labelledby`],help:g,id:ie,invalid:G,invalidFeedback:y,label:b,valid:K,validFeedback:F}),{descriptionProps:Z,errorMessageProps:Q,fieldProps:se,inputProps:ce}=u({...U,"aria-describedby":q,"aria-labelledby":X,id:ae},W,z),$=e(se,Z,Q);return r({children:o.createElement(o.Fragment,null,o.createElement(`div`,{...l($,L),"aria-describedby":$[`aria-describedby`],"aria-labelledby":X,className:ee(`form-input`,`time-field`,N,{disabled:p},i(G,K),d),ref:B,style:{...$.style,...L.style}},o.createElement(`div`,{className:`datepicker-field`},W.segments.map((e,t)=>o.createElement(a,{fieldLabelledBy:X,key:t,segment:e,slots:[Z,Q],state:W})))),o.createElement(`input`,{...ce,ref:V})),help:g,ids:{feedback:J,help:Y,label:oe},invalid:G,invalidFeedback:y,label:b,valid:K,validFeedback:F})});d.displayName=`TimeField`;export{d as t};
|
|
2
|
-
//# sourceMappingURL=time-field-B3MA7ED_.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"time-field-B3MA7ED_.js","names":[],"sources":["../../src/components/time-field/TimeField.tsx"],"sourcesContent":["import React, { forwardRef, HTMLAttributes, ReactNode, useRef } from 'react'\nimport classNames from 'classnames'\nimport { AriaTimeFieldProps, mergeProps, TimeValue, useLocale, useTimeField } from 'react-aria'\nimport { useTimeFieldState } from 'react-stately'\n\nimport { useForkedRef, useFormField } from '../../hooks'\nimport { withoutSlotIds } from '../../utils/idRefs'\nimport { validationClassName } from '../../utils/validationClassName'\nimport { DateSegment } from '../datepicker/DateSegment'\nimport { renderFormField } from '../form-field/renderFormField'\n\nexport interface TimeFieldProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'defaultValue' | 'onChange'\n> {\n /**\n * An accessible label for the field, used when there's no visible `label`.\n */\n 'aria-label'?: string\n /**\n * Identifies a visible element that labels the field.\n */\n 'aria-labelledby'?: string\n /**\n * Focus the first segment when the field mounts.\n */\n autoFocus?: boolean\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * The value of the field, uncontrolled.\n */\n defaultValue?: TimeValue | null\n /**\n * Toggle the disabled state for the component.\n */\n disabled?: boolean\n /**\n * The id of a form elsewhere on the page that the field belongs to.\n */\n form?: string\n /**\n * The smallest unit shown and edited.\n *\n * @default 'minute'\n */\n granularity?: 'hour' | 'minute' | 'second'\n /**\n * A description for the field, rendered below it.\n */\n help?: ReactNode\n /**\n * Hide the time zone of a `ZonedDateTime` value.\n */\n hideTimeZone?: boolean\n /**\n * Show 12 or 24 hours. Defaults to the locale's.\n */\n hourCycle?: 12 | 24\n /**\n * Set component validation state to invalid.\n */\n invalid?: boolean\n /**\n * An error message for the field, rendered below it when `invalid` is set.\n */\n invalidFeedback?: ReactNode\n /**\n * The field's caption, rendered as a `FormLabel` that names the field.\n */\n label?: ReactNode\n /**\n * The latest time. A later one entered marks the field invalid.\n */\n maxValue?: TimeValue | null\n /**\n * The earliest time. An earlier one entered marks the field invalid.\n */\n minValue?: TimeValue | null\n /**\n * The name the value is submitted under with a form, as an ISO 8601 time (`09:30:00`).\n */\n name?: string\n /**\n * Handler that is called when the value changes: once every segment has a value, and with\n * `null` once every segment is empty. A partly emptied field keeps its last value.\n */\n onChange?: (value: TimeValue | null) => void\n /**\n * The time the segments start from when the field is empty, such as `new Time(9)`. It also\n * sets the type of value `onChange` receives.\n */\n placeholderValue?: TimeValue\n /**\n * Toggle the readonly state for the component.\n */\n readOnly?: boolean\n /**\n * Toggle the required state for the component.\n */\n required?: boolean\n /**\n * Show a leading zero on the hour, as `09:30` rather than `9:30`, whatever the locale does.\n */\n shouldForceLeadingZeros?: boolean\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 it when `valid` is set.\n */\n validFeedback?: ReactNode\n /**\n * The value of the field, controlled: a `Time`, or a `CalendarDateTime` or `ZonedDateTime`\n * whose date is kept. `null` for an empty field.\n */\n value?: TimeValue | null\n}\n\ntype FieldProps = AriaTimeFieldProps<TimeValue>\n\n// A time as `DateField` renders a date for the date pickers: a `.form-input` holding one editable\n// segment per unit, with the segments' styles shared (`DateSegment`). The `.form-input` is the\n// field's group, named by the label; each segment is a spin button named by its unit and the\n// label.\nexport const TimeField = forwardRef<HTMLDivElement, TimeFieldProps>(\n (\n {\n autoFocus,\n className,\n defaultValue,\n disabled,\n form,\n granularity,\n help,\n hideTimeZone,\n hourCycle,\n id,\n invalid,\n invalidFeedback,\n label,\n maxValue,\n minValue,\n name,\n onBlur,\n onChange,\n onFocus,\n onKeyDown,\n onKeyUp,\n placeholderValue,\n readOnly,\n required,\n shouldForceLeadingZeros,\n size,\n valid,\n validFeedback,\n value,\n ...rest\n },\n ref\n ) => {\n const fieldRef = useRef<HTMLDivElement>(null)\n const forkedRef = useForkedRef(ref, fieldRef)\n const inputRef = useRef<HTMLInputElement>(null)\n const { locale } = useLocale()\n\n // `label` stays out, as the other fields keep it: react-aria would name the field by a label\n // element of its own, which this component doesn't render.\n // `inputRef` is the hidden input's: react-aria resets the field with that input's form and\n // reports validity through it, as react-aria-components passes it, outside the public type.\n const baseProps: FieldProps & { inputRef: typeof inputRef } = {\n 'aria-label': rest['aria-label'],\n autoFocus,\n defaultValue,\n form,\n granularity,\n hideTimeZone,\n hourCycle,\n inputRef,\n isDisabled: disabled,\n // `false` would override react-aria's own range check: react-stately takes a defined\n // `isInvalid` as the whole validation state.\n isInvalid: invalid || undefined,\n isReadOnly: readOnly,\n isRequired: required,\n maxValue,\n minValue,\n name,\n onBlur: onBlur as FieldProps['onBlur'],\n onChange,\n onFocus: onFocus as FieldProps['onFocus'],\n onKeyDown: onKeyDown as FieldProps['onKeyDown'],\n onKeyUp: onKeyUp as FieldProps['onKeyUp'],\n placeholderValue,\n shouldForceLeadingZeros,\n value\n }\n const state = useTimeFieldState({ ...baseProps, locale })\n // A time outside `minValue`/`maxValue` is invalid too, shown as `invalid` is: the state\n // knows before the ids are built, so the feedback describes the field either way.\n const showInvalid = invalid || state.displayValidation.isInvalid\n // A time outside the range isn't valid, whatever `valid` says.\n const showValid = valid && !showInvalid\n\n const { describedBy, feedbackId, helpId, inputId, labelId, labelledBy } = useFormField({\n ariaDescribedBy: rest['aria-describedby'],\n ariaLabelledBy: rest['aria-labelledby'],\n help,\n id,\n invalid: showInvalid,\n invalidFeedback,\n label,\n valid: showValid,\n validFeedback\n })\n\n const {\n descriptionProps,\n errorMessageProps,\n fieldProps: groupProps,\n inputProps\n } = useTimeField(\n { ...baseProps, 'aria-describedby': describedBy, 'aria-labelledby': labelledBy, id: inputId },\n state,\n fieldRef\n )\n\n // The field's `aria-describedby` from react-aria holds its description of the value, added\n // once mounted, and the help and feedback given to it; the slot ids come out (FORMS.md, gotcha\n // 6). It's set again after the spread, where the caller's own value would replace it (gotcha\n // 4).\n const group = withoutSlotIds(groupProps, descriptionProps, errorMessageProps)\n\n return renderFormField({\n children: (\n <>\n <div\n {...mergeProps(group, rest)}\n aria-describedby={group['aria-describedby']}\n aria-labelledby={labelledBy}\n className={classNames(\n 'form-input',\n 'time-field',\n size,\n { disabled },\n validationClassName(showInvalid, showValid),\n className\n )}\n ref={forkedRef}\n style={{ ...group.style, ...rest.style }}\n >\n <div className=\"datepicker-field\">\n {state.segments.map((segment, index) => (\n <DateSegment\n fieldLabelledBy={labelledBy}\n // eslint-disable-next-line react/no-array-index-key\n key={index}\n segment={segment}\n slots={[descriptionProps, errorMessageProps]}\n state={state}\n />\n ))}\n </div>\n </div>\n <input {...inputProps} ref={inputRef} />\n </>\n ),\n help,\n ids: { feedback: feedbackId, help: helpId, label: labelId },\n invalid: showInvalid,\n invalidFeedback,\n label,\n valid: showValid,\n validFeedback\n })\n }\n)\n\nTimeField.displayName = 'TimeField'\n"],"mappings":"igBAoIA,MAAa,EAAY,GAErB,CACE,YACA,YACA,eACA,WACA,OACA,cACA,OACA,eACA,aACA,MACA,UACA,kBACA,QACA,WACA,WACA,OACA,SACA,WACA,UACA,YACA,UACA,mBACA,WACA,WACA,0BACA,OACA,QACA,gBACA,QACA,GAAG,GAEL,IACG,CACH,IAAM,EAAW,EAAuB,IAAI,EACtC,EAAY,EAAa,EAAK,CAAQ,EACtC,EAAW,EAAyB,IAAI,EACxC,CAAE,UAAW,GAAU,EAMvB,EAAwD,CAC5D,aAAc,EAAK,cACnB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ACP,eACF,CAAC,CACH,CACF,EAEA,EAAU,YAAc"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{t as e}from"./polymorphic-BhGNZQja.js";import{n as t,r as n,t as r}from"./useToastRegionQueue-CIV5SdiE.js";import{t as i}from"./Portal-CgeR1WXV.js";import{t as a}from"./Icon-DLB1f88W.js";import{n as o}from"./iconSlot-BNu2MrFI.js";import{t as s}from"./CloseButton-DPgQztE0.js";import c,{createContext as l,forwardRef as u,useContext as d}from"react";import f from"classnames";import{mergeProps as p}from"react-aria";import{ToastQueue as m}from"react-stately";const h=l({close:()=>{}}),g=()=>d(h);function _({children:e,className:t,closeButton:n,closeLabel:r,component:i,...a},o){let{close:l}=g(),u=i??`div`,d=f(`toast-body`,{"d-flex align-items-start justify-content-between gap-sm":n},t);return c.createElement(u,{className:d,...a,ref:o},n?c.createElement(`div`,null,e):e,n&&c.createElement(s,{label:r,onClick:l}))}const v=e(_,`ToastBody`);function y({children:e,className:t,component:n,...r},i){let a=n??`div`,o=f(`toast-footer`,t);return c.createElement(a,{className:o,...r,ref:i},e)}const b=e(y,`ToastFooter`);function x({children:e,className:t,closeButton:n,closeLabel:r,component:i,icon:a,time:l,titleId:u,...d},p){let{close:m}=g(),h=i??`div`,_=f(`toast-header`,t);return c.createElement(h,{className:_,...d,ref:p},a!=null&&(typeof a==`string`?c.createElement(`span`,{"aria-hidden":`true`,className:`me-sm`},c.createElement(o,{value:a,className:`toast-icon`})):c.createElement(`span`,{className:`me-sm`},a)),e!=null&&c.createElement(`strong`,{id:u,className:`me-auto`},e),l!=null&&c.createElement(`small`,null,l),n&&c.createElement(s,{label:r,onClick:m}))}const S=e(x,`ToastHeader`),C=u(({children:e,animation:r=!0,autohide:i=!0,className:a,closeButton:o,closeLabel:s,color:l,defaultVisible:u=!1,delay:d=5e3,footer:m,icon:g,message:_,role:y=`status`,solid:x,time:C,title:w,translucent:T,visible:E,onClose:D,onShow:O,onVisibleChange:k,...A},j)=>{let{close:M,entered:N,forkedRef:P,isMounted:F,textId:I,titleId:L,transitionClass:R,visible:z}=t({defaultVisible:u,displayName:`Toast`,onClose:D,onShow:O,onVisibleChange:k,ref:j,visible:E}),B=n({enabled:i,delay:d,visible:z&&N,onHide:M}),V={visible:z,close:M},H=f(`toast`,{fade:r,context:!!l,solid:!!(x&&l),translucent:T},l,a),U=g!=null||w!=null||C!=null,W=o&&(U||_==null),G=o&&!U&&_!=null,K=U||W;return F?c.createElement(h.Provider,{value:V},c.createElement(`div`,{className:f(H,R),role:y,"aria-labelledby":w==null?void 0:L,"aria-describedby":w!=null&&_!=null?I:void 0,...p(A,B),ref:P},K&&c.createElement(S,{icon:g,time:C,titleId:w==null?void 0:L,closeButton:W,closeLabel:s},w),_!=null&&c.createElement(v,{id:w!=null&&_!=null?I:void 0,closeButton:G,closeLabel:s},_),e,m!=null&&c.createElement(b,null,typeof m==`function`?m(M):m))):null});C.displayName=`Toast`;const w=u(({className:e,...t},n)=>{let r=f(`toast-icon`,e);return c.createElement(a,{className:r,...t,ref:n})});w.displayName=`ToastIcon`;const T=new m;function E(e,t={}){return T.add({children:e,...t})}function D(e){T.close(e)}const O=u(({children:e,className:t,placement:n,...a},o)=>{let{forkedRef:s,regionProps:l,state:u}=r(T,o),d=f(`toaster toast-container p-md`,{"position-fixed":n,"position-static":!n,"top-0":n&&n.includes(`top`),"top-50 translate-middle-y":n&&n.includes(`middle`),"bottom-0":n&&n.includes(`bottom`),"start-0":n&&n.includes(`start`),"start-50 translate-middle-x":n&&n.includes(`center`),"end-0":n&&n.includes(`end`)},t),p=t=>u.visibleToasts.length>0||e?c.createElement(`div`,{className:d,...l,...a,ref:t},e,u.visibleToasts.map(e=>{let{children:t,...n}=e.content;return c.createElement(C,{key:e.key,defaultVisible:!0,...n,onClose:()=>u.close(e.key)},t)})):null;return n?c.createElement(i,null,p(s)):p(s)});O.displayName=`Toaster`;export{w as a,b as c,T as i,v as l,E as n,C as o,D as r,S as s,O as t,g as u};
|
|
2
|
-
//# sourceMappingURL=toast-CGHl3-oU.js.map
|