@techzyapp/ui-library 1.0.23 → 1.0.27
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/dist/{AdminRoot-aDy6rNqI.js → AdminRoot-C4OyuOIr.js} +4 -4
- package/dist/{AdminRoot-aDy6rNqI.js.map → AdminRoot-C4OyuOIr.js.map} +1 -1
- package/dist/{AdminRoot-C7Idu7FQ.cjs → AdminRoot-bHywlbML.cjs} +2 -2
- package/dist/{AdminRoot-C7Idu7FQ.cjs.map → AdminRoot-bHywlbML.cjs.map} +1 -1
- package/dist/Alert-DeGgilkH.cjs +2 -0
- package/dist/{Alert-Cl1zxmX9.cjs.map → Alert-DeGgilkH.cjs.map} +1 -1
- package/dist/Alert-rNjfqj2Z.js +71 -0
- package/dist/{Alert-D6VL2C-E.js.map → Alert-rNjfqj2Z.js.map} +1 -1
- package/dist/{AuthLayout-BRUxDgzs.cjs → AuthLayout-ChILVWZ-.cjs} +2 -2
- package/dist/{AuthLayout-BRUxDgzs.cjs.map → AuthLayout-ChILVWZ-.cjs.map} +1 -1
- package/dist/{AuthLayout-CP9qu6Bv.js → AuthLayout-zAS3jlYc.js} +2 -2
- package/dist/{AuthLayout-CP9qu6Bv.js.map → AuthLayout-zAS3jlYc.js.map} +1 -1
- package/dist/{Avatar-Q50J8wdN.js → Avatar-BGPGxry2.js} +25 -25
- package/dist/{Avatar-Q50J8wdN.js.map → Avatar-BGPGxry2.js.map} +1 -1
- package/dist/Avatar-D_YivyqV.cjs +2 -0
- package/dist/{Avatar-Dgf04PBC.cjs.map → Avatar-D_YivyqV.cjs.map} +1 -1
- package/dist/{AvatarGroup-uW0SD5P4.cjs → AvatarGroup-Bnf_RSc9.cjs} +2 -2
- package/dist/{AvatarGroup-uW0SD5P4.cjs.map → AvatarGroup-Bnf_RSc9.cjs.map} +1 -1
- package/dist/{AvatarGroup-YaNasLMS.js → AvatarGroup-Difz4lLR.js} +2 -2
- package/dist/{AvatarGroup-YaNasLMS.js.map → AvatarGroup-Difz4lLR.js.map} +1 -1
- package/dist/Badge-BmFgusOa.js +50 -0
- package/dist/{Badge-DSWigoGC.js.map → Badge-BmFgusOa.js.map} +1 -1
- package/dist/Badge-DVbe1rAI.cjs +2 -0
- package/dist/{Badge-BQpr2Jee.cjs.map → Badge-DVbe1rAI.cjs.map} +1 -1
- package/dist/Blockquote-BWGxIL_V.cjs +2 -0
- package/dist/{Blockquote-CxHwOecc.cjs.map → Blockquote-BWGxIL_V.cjs.map} +1 -1
- package/dist/Blockquote-Ma-2naET.js +46 -0
- package/dist/{Blockquote-CNIuJFHq.js.map → Blockquote-Ma-2naET.js.map} +1 -1
- package/dist/{Breadcrumbs-CicfjfIu.js → Breadcrumbs-BJHKk0Sn.js} +3 -3
- package/dist/{Breadcrumbs-CicfjfIu.js.map → Breadcrumbs-BJHKk0Sn.js.map} +1 -1
- package/dist/{Breadcrumbs-BnFW4LgK.cjs → Breadcrumbs-CGcpMlxm.cjs} +2 -2
- package/dist/{Breadcrumbs-BnFW4LgK.cjs.map → Breadcrumbs-CGcpMlxm.cjs.map} +1 -1
- package/dist/Button-BZ_o-akc.cjs +2 -0
- package/dist/{Button-ZplrHYKw.cjs.map → Button-BZ_o-akc.cjs.map} +1 -1
- package/dist/Button-obe6rono.js +72 -0
- package/dist/{Button-Cfxd7qhd.js.map → Button-obe6rono.js.map} +1 -1
- package/dist/{Calendar-DTxCT-ki.js → Calendar-SCih0NtS.js} +4 -4
- package/dist/{Calendar-DTxCT-ki.js.map → Calendar-SCih0NtS.js.map} +1 -1
- package/dist/{Calendar-S9vyp-qv.cjs → Calendar-lfpNwivC.cjs} +2 -2
- package/dist/{Calendar-S9vyp-qv.cjs.map → Calendar-lfpNwivC.cjs.map} +1 -1
- package/dist/{Card-eXJfA4rU.js → Card-BRJV2JZE.js} +2 -2
- package/dist/{Card-eXJfA4rU.js.map → Card-BRJV2JZE.js.map} +1 -1
- package/dist/{Card-BeE2ohcn.cjs → Card-KvvNlchc.cjs} +2 -2
- package/dist/{Card-BeE2ohcn.cjs.map → Card-KvvNlchc.cjs.map} +1 -1
- package/dist/{Chip-BOXXdzap.js → Chip-CQ4cYVl_.js} +31 -31
- package/dist/{Chip-BOXXdzap.js.map → Chip-CQ4cYVl_.js.map} +1 -1
- package/dist/Chip-CYz4vxHm.cjs +2 -0
- package/dist/{Chip-B4XERWb_.cjs.map → Chip-CYz4vxHm.cjs.map} +1 -1
- package/dist/ChoiceCardGroup-D3HL7dHj.js +181 -0
- package/dist/{ChoiceCardGroup-DBohUnRj.js.map → ChoiceCardGroup-D3HL7dHj.js.map} +1 -1
- package/dist/ChoiceCardGroup-pIOKIUI0.cjs +2 -0
- package/dist/{ChoiceCardGroup-d0VVTUi5.cjs.map → ChoiceCardGroup-pIOKIUI0.cjs.map} +1 -1
- package/dist/{CodeBlock-D_PRiWMq.js → CodeBlock-DddGTLu1.js} +3 -3
- package/dist/{CodeBlock-D_PRiWMq.js.map → CodeBlock-DddGTLu1.js.map} +1 -1
- package/dist/{CodeBlock-C7_A6CTT.cjs → CodeBlock-H75dbOvg.cjs} +2 -2
- package/dist/{CodeBlock-C7_A6CTT.cjs.map → CodeBlock-H75dbOvg.cjs.map} +1 -1
- package/dist/ColorPicker-CKc8k-Dp.cjs +2 -0
- package/dist/ColorPicker-CKc8k-Dp.cjs.map +1 -0
- package/dist/{ColorPicker-DAjs7PmR.js → ColorPicker-Cw-2X6u9.js} +35 -26
- package/dist/ColorPicker-Cw-2X6u9.js.map +1 -0
- package/dist/ColorPickerPanel-DQ4CFnGa.cjs +2 -0
- package/dist/ColorPickerPanel-DQ4CFnGa.cjs.map +1 -0
- package/dist/ColorPickerPanel-PYaF5wPL.js +322 -0
- package/dist/ColorPickerPanel-PYaF5wPL.js.map +1 -0
- package/dist/ColorRamp-AkY9gq6Y.cjs +2 -0
- package/dist/ColorRamp-AkY9gq6Y.cjs.map +1 -0
- package/dist/ColorRamp-DnlJNKfy.js +126 -0
- package/dist/ColorRamp-DnlJNKfy.js.map +1 -0
- package/dist/ConfigProvider-BicoaBLj.cjs +2 -0
- package/dist/ConfigProvider-BicoaBLj.cjs.map +1 -0
- package/dist/ConfigProvider-DL9fylMo.js +320 -0
- package/dist/ConfigProvider-DL9fylMo.js.map +1 -0
- package/dist/CopyButton-BqFGC-Ca.cjs +2 -0
- package/dist/{CopyButton-COF3hIV-.cjs.map → CopyButton-BqFGC-Ca.cjs.map} +1 -1
- package/dist/CopyButton-D6-kcVCA.js +43 -0
- package/dist/{CopyButton-Bv7L4xJf.js.map → CopyButton-D6-kcVCA.js.map} +1 -1
- package/dist/DashedButton-B7xodc3N.cjs +2 -0
- package/dist/{DashedButton-3C4IZuo4.cjs.map → DashedButton-B7xodc3N.cjs.map} +1 -1
- package/dist/DashedButton-iM7kzopW.js +59 -0
- package/dist/{DashedButton-BXZAyMtw.js.map → DashedButton-iM7kzopW.js.map} +1 -1
- package/dist/{DatePicker-kA-xn5ET.cjs → DatePicker-BvGFP2AL.cjs} +2 -2
- package/dist/{DatePicker-kA-xn5ET.cjs.map → DatePicker-BvGFP2AL.cjs.map} +1 -1
- package/dist/{DatePicker-DZfOvxUR.js → DatePicker-DP7yASzq.js} +5 -5
- package/dist/{DatePicker-DZfOvxUR.js.map → DatePicker-DP7yASzq.js.map} +1 -1
- package/dist/DatePicker.module-BDtTsg8M.cjs +2 -0
- package/dist/{DatePicker.module-tE-tGNBd.cjs.map → DatePicker.module-BDtTsg8M.cjs.map} +1 -1
- package/dist/DatePicker.module-CMMQyEhG.js +138 -0
- package/dist/{DatePicker.module-BZDftL4g.js.map → DatePicker.module-CMMQyEhG.js.map} +1 -1
- package/dist/{DateTimePicker-BxBXhSN_.js → DateTimePicker-CzRduOFz.js} +8 -8
- package/dist/{DateTimePicker-BxBXhSN_.js.map → DateTimePicker-CzRduOFz.js.map} +1 -1
- package/dist/{DateTimePicker-DEGmn5UX.cjs → DateTimePicker-DOzft9kg.cjs} +2 -2
- package/dist/{DateTimePicker-DEGmn5UX.cjs.map → DateTimePicker-DOzft9kg.cjs.map} +1 -1
- package/dist/EmptyState-A5nPGnHA.js +38 -0
- package/dist/{EmptyState-Du4vA3bC.js.map → EmptyState-A5nPGnHA.js.map} +1 -1
- package/dist/EmptyState-CTTOy9aY.cjs +2 -0
- package/dist/{EmptyState-DlX-BLLI.cjs.map → EmptyState-CTTOy9aY.cjs.map} +1 -1
- package/dist/{FileCard-juQ1fWbG.js → FileCard-BmPEEcue.js} +4 -4
- package/dist/{FileCard-juQ1fWbG.js.map → FileCard-BmPEEcue.js.map} +1 -1
- package/dist/{FileCard-zyCpTrJ-.cjs → FileCard-C4BkGMtK.cjs} +2 -2
- package/dist/{FileCard-zyCpTrJ-.cjs.map → FileCard-C4BkGMtK.cjs.map} +1 -1
- package/dist/FileUploader-D_F64mob.cjs +2 -0
- package/dist/FileUploader-D_F64mob.cjs.map +1 -0
- package/dist/{FileUploader-DL9atihI.js → FileUploader-Dv_3bjZA.js} +217 -217
- package/dist/FileUploader-Dv_3bjZA.js.map +1 -0
- package/dist/{Flag-DFKHYnqk.cjs → Flag-BM_2VJ1v.cjs} +2 -2
- package/dist/{Flag-DFKHYnqk.cjs.map → Flag-BM_2VJ1v.cjs.map} +1 -1
- package/dist/{Flag-BxRrjCTB.js → Flag-CzCEpB8E.js} +2 -2
- package/dist/{Flag-BxRrjCTB.js.map → Flag-CzCEpB8E.js.map} +1 -1
- package/dist/{FullscreenToggle-BNK7RcRq.cjs → FullscreenToggle-BL0nBrsL.cjs} +2 -2
- package/dist/{FullscreenToggle-BNK7RcRq.cjs.map → FullscreenToggle-BL0nBrsL.cjs.map} +1 -1
- package/dist/{FullscreenToggle-BMCNsyzb.js → FullscreenToggle-HZQOIa21.js} +3 -3
- package/dist/{FullscreenToggle-BMCNsyzb.js.map → FullscreenToggle-HZQOIa21.js.map} +1 -1
- package/dist/IconButton-B87ipBK3.cjs +2 -0
- package/dist/{IconButton-B9eVM18U.cjs.map → IconButton-B87ipBK3.cjs.map} +1 -1
- package/dist/IconButton-CBp8QuTO.js +68 -0
- package/dist/{IconButton-CfvsE_p3.js.map → IconButton-CBp8QuTO.js.map} +1 -1
- package/dist/Loader-0Imnbael.cjs +2 -0
- package/dist/{Loader-CxLrhAz9.cjs.map → Loader-0Imnbael.cjs.map} +1 -1
- package/dist/Loader-fffFnQqS.js +28 -0
- package/dist/{Loader-DwmyJFwG.js.map → Loader-fffFnQqS.js.map} +1 -1
- package/dist/MobileFrame-8FSsYA_w.js +91 -0
- package/dist/MobileFrame-8FSsYA_w.js.map +1 -0
- package/dist/MobileFrame-Dsfgd_4k.cjs +2 -0
- package/dist/MobileFrame-Dsfgd_4k.cjs.map +1 -0
- package/dist/Modal--e2qGisF.cjs +2 -0
- package/dist/{Modal-DXZdMmJh.cjs.map → Modal--e2qGisF.cjs.map} +1 -1
- package/dist/Modal-DJljaPqV.js +195 -0
- package/dist/{Modal-Cx0JEQ-j.js.map → Modal-DJljaPqV.js.map} +1 -1
- package/dist/{MultiSelect-DfhyGxDU.cjs → MultiSelect-CvecZeMU.cjs} +2 -2
- package/dist/{MultiSelect-DfhyGxDU.cjs.map → MultiSelect-CvecZeMU.cjs.map} +1 -1
- package/dist/{MultiSelect-yGlvweEq.js → MultiSelect-DLoS04lZ.js} +4 -4
- package/dist/{MultiSelect-yGlvweEq.js.map → MultiSelect-DLoS04lZ.js.map} +1 -1
- package/dist/{NumberField-B7yPXIw_.cjs → NumberField-C_HZXBuw.cjs} +2 -2
- package/dist/{NumberField-B7yPXIw_.cjs.map → NumberField-C_HZXBuw.cjs.map} +1 -1
- package/dist/{NumberField-cAjPU1P5.js → NumberField-DYGVQdL5.js} +4 -4
- package/dist/{NumberField-cAjPU1P5.js.map → NumberField-DYGVQdL5.js.map} +1 -1
- package/dist/OtpField-CpQr_ZqL.js +174 -0
- package/dist/OtpField-CpQr_ZqL.js.map +1 -0
- package/dist/OtpField-DKbUP0F6.cjs +2 -0
- package/dist/OtpField-DKbUP0F6.cjs.map +1 -0
- package/dist/{PageLayout-C9Je7kfF.js → PageLayout-CCcPCfJF.js} +2 -2
- package/dist/{PageLayout-C9Je7kfF.js.map → PageLayout-CCcPCfJF.js.map} +1 -1
- package/dist/{PageLayout-BSHyKoQ4.cjs → PageLayout-CuWXukUv.cjs} +2 -2
- package/dist/{PageLayout-BSHyKoQ4.cjs.map → PageLayout-CuWXukUv.cjs.map} +1 -1
- package/dist/PageNotFound-JKOnpyHD.cjs +2 -0
- package/dist/{PageNotFound-voB9ylPF.cjs.map → PageNotFound-JKOnpyHD.cjs.map} +1 -1
- package/dist/{PageNotFound-CUN2OntP.js → PageNotFound-LWH2tU5E.js} +9 -9
- package/dist/{PageNotFound-CUN2OntP.js.map → PageNotFound-LWH2tU5E.js.map} +1 -1
- package/dist/Pagination-BwtbmITJ.js +139 -0
- package/dist/{Pagination-BaVHgIWT.js.map → Pagination-BwtbmITJ.js.map} +1 -1
- package/dist/Pagination-M7njqOUt.cjs +2 -0
- package/dist/{Pagination-BUGaylZa.cjs.map → Pagination-M7njqOUt.cjs.map} +1 -1
- package/dist/PaletteField-CUyzLrny.js +54 -0
- package/dist/PaletteField-CUyzLrny.js.map +1 -0
- package/dist/PaletteField-iBIvOvNi.cjs +2 -0
- package/dist/PaletteField-iBIvOvNi.cjs.map +1 -0
- package/dist/RadioGroup-Byy-eSY3.cjs +2 -0
- package/dist/{RadioGroup-C8u7eNBS.cjs.map → RadioGroup-Byy-eSY3.cjs.map} +1 -1
- package/dist/RadioGroup-D_1_Heta.js +141 -0
- package/dist/{RadioGroup-DbodUJW8.js.map → RadioGroup-D_1_Heta.js.map} +1 -1
- package/dist/RemoveDialog-DUrD2Em8.js +47 -0
- package/dist/{RemoveDialog-BpL2-gnz.js.map → RemoveDialog-DUrD2Em8.js.map} +1 -1
- package/dist/RemoveDialog-FZWYAxRy.cjs +2 -0
- package/dist/{RemoveDialog-DGt_72we.cjs.map → RemoveDialog-FZWYAxRy.cjs.map} +1 -1
- package/dist/{RichTextEditor-C_6pzqYY.js → RichTextEditor-CG6LoNiw.js} +9 -9
- package/dist/RichTextEditor-CG6LoNiw.js.map +1 -0
- package/dist/{RichTextEditor-BuoywqBu.cjs → RichTextEditor-mpMCG8jX.cjs} +2 -2
- package/dist/RichTextEditor-mpMCG8jX.cjs.map +1 -0
- package/dist/RootLayout-CPxDqfGb.cjs +2 -0
- package/dist/RootLayout-CPxDqfGb.cjs.map +1 -0
- package/dist/RootLayout-D3K-pAMO.js +515 -0
- package/dist/RootLayout-D3K-pAMO.js.map +1 -0
- package/dist/{Select-ChT-6_bM.js → Select-BB9oOoWZ.js} +3 -3
- package/dist/{Select-ChT-6_bM.js.map → Select-BB9oOoWZ.js.map} +1 -1
- package/dist/{Select-CVy5BnKe.cjs → Select-iP2p5jad.cjs} +2 -2
- package/dist/{Select-CVy5BnKe.cjs.map → Select-iP2p5jad.cjs.map} +1 -1
- package/dist/{Sidebar-D2MsR33k.cjs → Sidebar-Boi7UgHV.cjs} +2 -2
- package/dist/{Sidebar-D2MsR33k.cjs.map → Sidebar-Boi7UgHV.cjs.map} +1 -1
- package/dist/{Sidebar-ZA1wxCez.js → Sidebar-CsPnv4mu.js} +60 -60
- package/dist/{Sidebar-ZA1wxCez.js.map → Sidebar-CsPnv4mu.js.map} +1 -1
- package/dist/Slider-D3dbEOQY.cjs +2 -0
- package/dist/{Slider-dxYVXRev.cjs.map → Slider-D3dbEOQY.cjs.map} +1 -1
- package/dist/Slider-D7SvowmM.js +184 -0
- package/dist/{Slider-oGXd5e9X.js.map → Slider-D7SvowmM.js.map} +1 -1
- package/dist/{SpeedDial-DUYQMDCY.js → SpeedDial-B8XMUATN.js} +2 -2
- package/dist/{SpeedDial-DUYQMDCY.js.map → SpeedDial-B8XMUATN.js.map} +1 -1
- package/dist/{SpeedDial-B9JTNNUU.cjs → SpeedDial-CZ22T8GL.cjs} +2 -2
- package/dist/{SpeedDial-B9JTNNUU.cjs.map → SpeedDial-CZ22T8GL.cjs.map} +1 -1
- package/dist/{Stepper-D89I17pC.js → Stepper-B_e_PGZE.js} +70 -70
- package/dist/{Stepper-D89I17pC.js.map → Stepper-B_e_PGZE.js.map} +1 -1
- package/dist/Stepper-BjkkWawQ.cjs +2 -0
- package/dist/{Stepper-BaC934rb.cjs.map → Stepper-BjkkWawQ.cjs.map} +1 -1
- package/dist/{SwatchPicker-CCJltwHI.cjs → SwatchPicker-C8amdDnA.cjs} +2 -2
- package/dist/{SwatchPicker-CCJltwHI.cjs.map → SwatchPicker-C8amdDnA.cjs.map} +1 -1
- package/dist/{SwatchPicker-CqyWngFJ.js → SwatchPicker-DXEE9xqY.js} +2 -2
- package/dist/{SwatchPicker-CqyWngFJ.js.map → SwatchPicker-DXEE9xqY.js.map} +1 -1
- package/dist/Switch-CodRZD3y.cjs +2 -0
- package/dist/{Switch-DRkZ6kHJ.cjs.map → Switch-CodRZD3y.cjs.map} +1 -1
- package/dist/Switch-ESrhkpJC.js +85 -0
- package/dist/{Switch-DMPJ0fhB.js.map → Switch-ESrhkpJC.js.map} +1 -1
- package/dist/Table-Cr1zUtNQ.cjs +2 -0
- package/dist/Table-Cr1zUtNQ.cjs.map +1 -0
- package/dist/{Table-CdIQ5Wfh.js → Table-DdoUcZoN.js} +60 -51
- package/dist/Table-DdoUcZoN.js.map +1 -0
- package/dist/Tabs-CZDX7BN-.cjs +2 -0
- package/dist/{Tabs-CejCwV3O.cjs.map → Tabs-CZDX7BN-.cjs.map} +1 -1
- package/dist/Tabs-v1GEGUDQ.js +190 -0
- package/dist/{Tabs-8-klG-y-.js.map → Tabs-v1GEGUDQ.js.map} +1 -1
- package/dist/{TagsField-BQLqUckB.js → TagsField-B389eDp4.js} +4 -4
- package/dist/{TagsField-BQLqUckB.js.map → TagsField-B389eDp4.js.map} +1 -1
- package/dist/{TagsField-BSAd4eUr.cjs → TagsField-OfrpyHZO.cjs} +2 -2
- package/dist/{TagsField-BSAd4eUr.cjs.map → TagsField-OfrpyHZO.cjs.map} +1 -1
- package/dist/{TextField-B4YtjNUs.js → TextField-7MobCad5.js} +4 -4
- package/dist/{TextField-B4YtjNUs.js.map → TextField-7MobCad5.js.map} +1 -1
- package/dist/{TextField-DzYGA_St.cjs → TextField-B785pRgK.cjs} +2 -2
- package/dist/{TextField-DzYGA_St.cjs.map → TextField-B785pRgK.cjs.map} +1 -1
- package/dist/TextField.module-6gYcR9TL.js +27 -0
- package/dist/TextField.module-6gYcR9TL.js.map +1 -0
- package/dist/TextField.module-DsNCo8vN.cjs +2 -0
- package/dist/TextField.module-DsNCo8vN.cjs.map +1 -0
- package/dist/{ThemeToggle-B4_zRHJY.js → ThemeToggle-BGdvqXad.js} +3 -3
- package/dist/{ThemeToggle-B4_zRHJY.js.map → ThemeToggle-BGdvqXad.js.map} +1 -1
- package/dist/{ThemeToggle-BKk0eFiB.cjs → ThemeToggle-BkmZ7s_u.cjs} +2 -2
- package/dist/{ThemeToggle-BKk0eFiB.cjs.map → ThemeToggle-BkmZ7s_u.cjs.map} +1 -1
- package/dist/{TimeColumns-BAzRrkqY.cjs → TimeColumns-B-xm1DGM.cjs} +2 -2
- package/dist/{TimeColumns-BAzRrkqY.cjs.map → TimeColumns-B-xm1DGM.cjs.map} +1 -1
- package/dist/{TimeColumns-CAPyli9V.js → TimeColumns-BRlDKx_i.js} +3 -3
- package/dist/{TimeColumns-CAPyli9V.js.map → TimeColumns-BRlDKx_i.js.map} +1 -1
- package/dist/{TimePicker-BebBSlQF.js → TimePicker-B_3Ubip0.js} +6 -6
- package/dist/{TimePicker-BebBSlQF.js.map → TimePicker-B_3Ubip0.js.map} +1 -1
- package/dist/{TimePicker-BUnXYR5g.cjs → TimePicker-DvEIdE4v.cjs} +2 -2
- package/dist/{TimePicker-BUnXYR5g.cjs.map → TimePicker-DvEIdE4v.cjs.map} +1 -1
- package/dist/Timeline-CKEosWka.cjs +2 -0
- package/dist/{Timeline-ONU_3gi3.cjs.map → Timeline-CKEosWka.cjs.map} +1 -1
- package/dist/Timeline-ufVXmpMY.js +71 -0
- package/dist/{Timeline-D3kzt1dy.js.map → Timeline-ufVXmpMY.js.map} +1 -1
- package/dist/{Toaster-B2rO4BkG.cjs → Toaster-BIFRuqbC.cjs} +2 -2
- package/dist/{Toaster-B2rO4BkG.cjs.map → Toaster-BIFRuqbC.cjs.map} +1 -1
- package/dist/{Toaster-ywqAKP8s.js → Toaster-DuzcRbio.js} +2 -2
- package/dist/{Toaster-ywqAKP8s.js.map → Toaster-DuzcRbio.js.map} +1 -1
- package/dist/{TranslatedFields-DQQUb0RD.cjs → TranslatedFields-D_a0NVKI.cjs} +2 -2
- package/dist/{TranslatedFields-DQQUb0RD.cjs.map → TranslatedFields-D_a0NVKI.cjs.map} +1 -1
- package/dist/{TranslatedFields-C-wlh51E.js → TranslatedFields-HmP0Mg5t.js} +5 -5
- package/dist/{TranslatedFields-C-wlh51E.js.map → TranslatedFields-HmP0Mg5t.js.map} +1 -1
- package/dist/{UserCard-BqWt0S-c.js → UserCard-B1phOVKj.js} +4 -4
- package/dist/{UserCard-BqWt0S-c.js.map → UserCard-B1phOVKj.js.map} +1 -1
- package/dist/{UserCard-Be1kl0TZ.cjs → UserCard-BvOcDm5W.cjs} +2 -2
- package/dist/{UserCard-Be1kl0TZ.cjs.map → UserCard-BvOcDm5W.cjs.map} +1 -1
- package/dist/color-CgR8ybWZ.cjs +2 -0
- package/dist/color-CgR8ybWZ.cjs.map +1 -0
- package/dist/color-EQJ2DrcQ.js +24 -0
- package/dist/color-EQJ2DrcQ.js.map +1 -0
- package/dist/components/Alert/index.cjs +1 -1
- package/dist/components/Alert/index.js +1 -1
- package/dist/components/AuthLayout/index.cjs +1 -1
- package/dist/components/AuthLayout/index.js +1 -1
- package/dist/components/Avatar/index.cjs +1 -1
- package/dist/components/Avatar/index.js +2 -2
- package/dist/components/Badge/index.cjs +1 -1
- package/dist/components/Badge/index.js +1 -1
- package/dist/components/Blockquote/Blockquote.d.cts +1 -1
- package/dist/components/Blockquote/Blockquote.d.ts +1 -1
- package/dist/components/Blockquote/index.cjs +1 -1
- package/dist/components/Blockquote/index.js +1 -1
- package/dist/components/Breadcrumbs/index.cjs +1 -1
- package/dist/components/Breadcrumbs/index.js +1 -1
- package/dist/components/Button/index.cjs +1 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/Card/index.cjs +1 -1
- package/dist/components/Card/index.js +1 -1
- package/dist/components/Chip/index.cjs +1 -1
- package/dist/components/Chip/index.js +1 -1
- package/dist/components/ChoiceCard/index.cjs +1 -1
- package/dist/components/ChoiceCard/index.js +1 -1
- package/dist/components/CodeBlock/index.cjs +1 -1
- package/dist/components/CodeBlock/index.js +1 -1
- package/dist/components/ColorPicker/ColorPicker.d.cts +5 -0
- package/dist/components/ColorPicker/ColorPicker.d.ts +5 -0
- package/dist/components/ColorPicker/ColorPickerPanel.d.cts +6 -1
- package/dist/components/ColorPicker/ColorPickerPanel.d.ts +6 -1
- package/dist/components/ColorPicker/colorUtils.d.cts +3 -12
- package/dist/components/ColorPicker/colorUtils.d.ts +3 -12
- package/dist/components/ColorPicker/index.cjs +1 -1
- package/dist/components/ColorPicker/index.js +1 -1
- package/dist/components/ColorRamp/ColorRamp.d.cts +36 -0
- package/dist/components/ColorRamp/ColorRamp.d.ts +36 -0
- package/dist/components/ColorRamp/index.cjs +2 -0
- package/dist/components/ColorRamp/index.cjs.map +1 -0
- package/dist/components/ColorRamp/index.d.cts +3 -0
- package/dist/components/ColorRamp/index.d.ts +3 -0
- package/dist/components/ColorRamp/index.js +6 -0
- package/dist/components/ColorRamp/index.js.map +1 -0
- package/dist/components/CopyButton/index.cjs +1 -1
- package/dist/components/CopyButton/index.js +1 -1
- package/dist/components/DashedButton/index.cjs +1 -1
- package/dist/components/DashedButton/index.js +1 -1
- package/dist/components/DatePicker/index.cjs +1 -1
- package/dist/components/DatePicker/index.js +1 -1
- package/dist/components/DateTimePicker/index.cjs +1 -1
- package/dist/components/DateTimePicker/index.js +1 -1
- package/dist/components/EmptyState/index.cjs +1 -1
- package/dist/components/EmptyState/index.js +1 -1
- package/dist/components/FileCard/index.cjs +1 -1
- package/dist/components/FileCard/index.js +1 -1
- package/dist/components/FileUploader/index.cjs +1 -1
- package/dist/components/FileUploader/index.js +1 -1
- package/dist/components/Flag/index.cjs +1 -1
- package/dist/components/Flag/index.js +1 -1
- package/dist/components/FullscreenToggle/index.cjs +1 -1
- package/dist/components/FullscreenToggle/index.js +1 -1
- package/dist/components/IconButton/index.cjs +1 -1
- package/dist/components/IconButton/index.js +1 -1
- package/dist/components/Loader/index.cjs +1 -1
- package/dist/components/Loader/index.js +1 -1
- package/dist/components/MobileFrame/MobileFrame.d.cts +45 -0
- package/dist/components/MobileFrame/MobileFrame.d.ts +45 -0
- package/dist/components/MobileFrame/frames.d.cts +27 -0
- package/dist/components/MobileFrame/frames.d.ts +27 -0
- package/dist/components/MobileFrame/index.cjs +2 -0
- package/dist/components/MobileFrame/index.cjs.map +1 -0
- package/dist/components/MobileFrame/index.d.cts +4 -0
- package/dist/components/MobileFrame/index.d.ts +4 -0
- package/dist/components/MobileFrame/index.js +8 -0
- package/dist/components/MobileFrame/index.js.map +1 -0
- package/dist/components/Modal/index.cjs +1 -1
- package/dist/components/Modal/index.js +1 -1
- package/dist/components/MultiSelect/index.cjs +1 -1
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/NumberField/index.cjs +1 -1
- package/dist/components/NumberField/index.js +1 -1
- package/dist/components/OtpField/OtpField.d.cts +3 -0
- package/dist/components/OtpField/OtpField.d.ts +3 -0
- package/dist/components/OtpField/index.cjs +1 -1
- package/dist/components/OtpField/index.d.cts +1 -1
- package/dist/components/OtpField/index.d.ts +1 -1
- package/dist/components/OtpField/index.js +1 -1
- package/dist/components/PageLayout/index.cjs +1 -1
- package/dist/components/PageLayout/index.js +1 -1
- package/dist/components/PageNotFound/index.cjs +1 -1
- package/dist/components/PageNotFound/index.js +1 -1
- package/dist/components/Pagination/index.cjs +1 -1
- package/dist/components/Pagination/index.js +1 -1
- package/dist/components/PaletteField/PaletteField.d.cts +30 -0
- package/dist/components/PaletteField/PaletteField.d.ts +30 -0
- package/dist/components/PaletteField/index.cjs +2 -0
- package/dist/components/PaletteField/index.cjs.map +1 -0
- package/dist/components/PaletteField/index.d.cts +2 -0
- package/dist/components/PaletteField/index.d.ts +2 -0
- package/dist/components/PaletteField/index.js +6 -0
- package/dist/components/PaletteField/index.js.map +1 -0
- package/dist/components/Radio/index.cjs +1 -1
- package/dist/components/Radio/index.js +1 -1
- package/dist/components/RemoveDialog/index.cjs +1 -1
- package/dist/components/RemoveDialog/index.js +1 -1
- package/dist/components/RichTextEditor/index.cjs +1 -1
- package/dist/components/RichTextEditor/index.js +1 -1
- package/dist/components/RootLayout/SettingsDrawer.d.cts +3 -1
- package/dist/components/RootLayout/SettingsDrawer.d.ts +3 -1
- package/dist/components/RootLayout/index.cjs +1 -1
- package/dist/components/RootLayout/index.js +1 -1
- package/dist/components/Select/index.cjs +1 -1
- package/dist/components/Select/index.js +1 -1
- package/dist/components/Sidebar/index.cjs +1 -1
- package/dist/components/Sidebar/index.js +1 -1
- package/dist/components/Slider/index.cjs +1 -1
- package/dist/components/Slider/index.js +1 -1
- package/dist/components/SpeedDial/index.cjs +1 -1
- package/dist/components/SpeedDial/index.js +1 -1
- package/dist/components/Stepper/index.cjs +1 -1
- package/dist/components/Stepper/index.js +1 -1
- package/dist/components/SwatchPicker/index.cjs +1 -1
- package/dist/components/SwatchPicker/index.js +1 -1
- package/dist/components/Switch/index.cjs +1 -1
- package/dist/components/Switch/index.js +1 -1
- package/dist/components/Table/index.cjs +1 -1
- package/dist/components/Table/index.js +1 -1
- package/dist/components/Tabs/index.cjs +1 -1
- package/dist/components/Tabs/index.js +1 -1
- package/dist/components/TagsField/index.cjs +1 -1
- package/dist/components/TagsField/index.js +1 -1
- package/dist/components/TextField/index.cjs +1 -1
- package/dist/components/TextField/index.js +1 -1
- package/dist/components/ThemeToggle/index.cjs +1 -1
- package/dist/components/ThemeToggle/index.js +1 -1
- package/dist/components/TimePicker/index.cjs +1 -1
- package/dist/components/TimePicker/index.js +1 -1
- package/dist/components/Timeline/index.cjs +1 -1
- package/dist/components/Timeline/index.js +1 -1
- package/dist/components/Toast/index.cjs +1 -1
- package/dist/components/Toast/index.js +1 -1
- package/dist/components/TranslatedFields/index.cjs +1 -1
- package/dist/components/TranslatedFields/index.js +1 -1
- package/dist/components/UserCard/index.cjs +1 -1
- package/dist/components/UserCard/index.js +1 -1
- package/dist/components/index.d.cts +3 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/entries/app.cjs +1 -1
- package/dist/entries/app.js +1 -1
- package/dist/entries/components.cjs +1 -1
- package/dist/entries/components.js +149 -141
- package/dist/entries/components.js.map +1 -1
- package/dist/entries/helpers.cjs +1 -1
- package/dist/entries/helpers.d.cts +2 -0
- package/dist/entries/helpers.d.ts +2 -0
- package/dist/entries/helpers.js +18 -8
- package/dist/entries/helpers.js.map +1 -1
- package/dist/entries/i18n.cjs +1 -1
- package/dist/entries/i18n.js +2 -2
- package/dist/entries/theme.cjs +1 -1
- package/dist/entries/theme.d.cts +1 -1
- package/dist/entries/theme.d.ts +1 -1
- package/dist/entries/theme.js +1 -1
- package/dist/helpers/color.d.cts +17 -0
- package/dist/helpers/color.d.ts +17 -0
- package/dist/helpers/palette.d.cts +68 -0
- package/dist/helpers/palette.d.ts +68 -0
- package/dist/i18n/messages.d.cts +17 -0
- package/dist/i18n/messages.d.ts +17 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +29 -2
- package/dist/index.js +211 -193
- package/dist/index.js.map +1 -1
- package/dist/{messages-CL8uoIRj.js → messages-B06Kl5rI.js} +144 -25
- package/dist/messages-B06Kl5rI.js.map +1 -0
- package/dist/{messages-Dvn_tEp0.cjs → messages-CJqxqL3t.cjs} +9 -9
- package/dist/messages-CJqxqL3t.cjs.map +1 -0
- package/dist/palette-B031dM4E.js +70 -0
- package/dist/palette-B031dM4E.js.map +1 -0
- package/dist/palette-BycMHbED.cjs +2 -0
- package/dist/palette-BycMHbED.cjs.map +1 -0
- package/dist/theme/ConfigProvider.d.cts +19 -0
- package/dist/theme/ConfigProvider.d.ts +19 -0
- package/dist/theme/index.d.cts +1 -1
- package/dist/theme/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/Alert-Cl1zxmX9.cjs +0 -2
- package/dist/Alert-D6VL2C-E.js +0 -71
- package/dist/Avatar-Dgf04PBC.cjs +0 -2
- package/dist/Badge-BQpr2Jee.cjs +0 -2
- package/dist/Badge-DSWigoGC.js +0 -50
- package/dist/Blockquote-CNIuJFHq.js +0 -46
- package/dist/Blockquote-CxHwOecc.cjs +0 -2
- package/dist/Button-Cfxd7qhd.js +0 -72
- package/dist/Button-ZplrHYKw.cjs +0 -2
- package/dist/Chip-B4XERWb_.cjs +0 -2
- package/dist/ChoiceCardGroup-DBohUnRj.js +0 -181
- package/dist/ChoiceCardGroup-d0VVTUi5.cjs +0 -2
- package/dist/ColorPicker-ClVpWf77.cjs +0 -2
- package/dist/ColorPicker-ClVpWf77.cjs.map +0 -1
- package/dist/ColorPicker-DAjs7PmR.js.map +0 -1
- package/dist/ColorPickerPanel-BGzm2had.js +0 -336
- package/dist/ColorPickerPanel-BGzm2had.js.map +0 -1
- package/dist/ColorPickerPanel-Dk6bI0Xy.cjs +0 -2
- package/dist/ColorPickerPanel-Dk6bI0Xy.cjs.map +0 -1
- package/dist/ConfigProvider-Blhvj6UQ.js +0 -296
- package/dist/ConfigProvider-Blhvj6UQ.js.map +0 -1
- package/dist/ConfigProvider-CUG8Mfy2.cjs +0 -2
- package/dist/ConfigProvider-CUG8Mfy2.cjs.map +0 -1
- package/dist/CopyButton-Bv7L4xJf.js +0 -31
- package/dist/CopyButton-COF3hIV-.cjs +0 -2
- package/dist/DashedButton-3C4IZuo4.cjs +0 -2
- package/dist/DashedButton-BXZAyMtw.js +0 -59
- package/dist/DatePicker.module-BZDftL4g.js +0 -138
- package/dist/DatePicker.module-tE-tGNBd.cjs +0 -2
- package/dist/EmptyState-DlX-BLLI.cjs +0 -2
- package/dist/EmptyState-Du4vA3bC.js +0 -38
- package/dist/FileUploader-DL9atihI.js.map +0 -1
- package/dist/FileUploader-DOe3CyJB.cjs +0 -2
- package/dist/FileUploader-DOe3CyJB.cjs.map +0 -1
- package/dist/IconButton-B9eVM18U.cjs +0 -2
- package/dist/IconButton-CfvsE_p3.js +0 -68
- package/dist/Loader-CxLrhAz9.cjs +0 -2
- package/dist/Loader-DwmyJFwG.js +0 -28
- package/dist/Modal-Cx0JEQ-j.js +0 -195
- package/dist/Modal-DXZdMmJh.cjs +0 -2
- package/dist/OtpField-BujZAy2A.cjs +0 -2
- package/dist/OtpField-BujZAy2A.cjs.map +0 -1
- package/dist/OtpField-D0eTOLtg.js +0 -171
- package/dist/OtpField-D0eTOLtg.js.map +0 -1
- package/dist/PageNotFound-voB9ylPF.cjs +0 -2
- package/dist/Pagination-BUGaylZa.cjs +0 -2
- package/dist/Pagination-BaVHgIWT.js +0 -139
- package/dist/RadioGroup-C8u7eNBS.cjs +0 -2
- package/dist/RadioGroup-DbodUJW8.js +0 -141
- package/dist/RemoveDialog-BpL2-gnz.js +0 -47
- package/dist/RemoveDialog-DGt_72we.cjs +0 -2
- package/dist/RichTextEditor-BuoywqBu.cjs.map +0 -1
- package/dist/RichTextEditor-C_6pzqYY.js.map +0 -1
- package/dist/RootLayout-1am1CwPQ.cjs +0 -2
- package/dist/RootLayout-1am1CwPQ.cjs.map +0 -1
- package/dist/RootLayout-x7qWzXPc.js +0 -479
- package/dist/RootLayout-x7qWzXPc.js.map +0 -1
- package/dist/Slider-dxYVXRev.cjs +0 -2
- package/dist/Slider-oGXd5e9X.js +0 -184
- package/dist/Stepper-BaC934rb.cjs +0 -2
- package/dist/Switch-DMPJ0fhB.js +0 -85
- package/dist/Switch-DRkZ6kHJ.cjs +0 -2
- package/dist/Table-CdIQ5Wfh.js.map +0 -1
- package/dist/Table-DvgBWTLx.cjs +0 -2
- package/dist/Table-DvgBWTLx.cjs.map +0 -1
- package/dist/Tabs-8-klG-y-.js +0 -190
- package/dist/Tabs-CejCwV3O.cjs +0 -2
- package/dist/TextField.module-QePvGeJ3.js +0 -27
- package/dist/TextField.module-QePvGeJ3.js.map +0 -1
- package/dist/TextField.module-m-UllwzG.cjs +0 -2
- package/dist/TextField.module-m-UllwzG.cjs.map +0 -1
- package/dist/Timeline-D3kzt1dy.js +0 -71
- package/dist/Timeline-ONU_3gi3.cjs +0 -2
- package/dist/messages-CL8uoIRj.js.map +0 -1
- package/dist/messages-Dvn_tEp0.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slider-oGXd5e9X.js","sources":["../src/components/Slider/Slider.tsx"],"sourcesContent":["import {\n forwardRef,\n useId,\n useState,\n type CSSProperties,\n type ChangeEvent,\n type FocusEvent,\n type InputHTMLAttributes,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useFormContext } from '../../form/formContext'\nimport { Typography } from '../Typography'\nimport type { ThemeColor } from '../../theme'\n// shared field chrome (wrapper / label / helper / required / error / sizes)\nimport fieldStyles from '../TextField/TextField.module.css'\nimport styles from './Slider.module.css'\n\nexport type SliderSize = 'sm' | 'md' | 'lg'\n/** A single value, or a `[start, end]` tuple when `range`. */\nexport type SliderValue = number | [number, number]\n\n/** A labeled tick under the track. */\nexport interface SliderMark {\n value: number\n label?: ReactNode\n}\n\nexport interface SliderProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'size' | 'value' | 'defaultValue' | 'onChange' | 'type' | 'min' | 'max' | 'step' | 'color'\n> {\n /** Label rendered above the track. */\n label?: ReactNode\n /** Preset size — drives the track + thumb dimensions and the label/helper font. */\n size?: SliderSize\n /** Marks the field invalid: red focus ring + the `helperText` in the error color. */\n error?: boolean\n /** Helper / validation text under the track. Adopts the error color while `error`. */\n helperText?: ReactNode\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Stretches the slider to fill its container width. Defaults to `true`. */\n fullWidth?: boolean\n /** Two-thumb range mode — pick a `[start, end]` span (e.g. 5–10). The value becomes a tuple. */\n range?: boolean\n /** Controlled value — a `number`, or a `[start, end]` tuple when `range`. */\n value?: SliderValue\n /** Initial value for uncontrolled use. Defaults to `min` (or `[min, max]` when `range`). */\n defaultValue?: SliderValue\n /** Fires with the next value (a `number`, or a `[start, end]` tuple when `range`). */\n onChange?: (value: SliderValue) => void\n /** Minimum value. Defaults to `0`. */\n min?: number\n /** Maximum value. Defaults to `100`. */\n max?: number\n /** Increment the thumb snaps to (arrow keys + drag). Defaults to `1`. */\n step?: number\n /** Theme palette token that tints the fill + thumb. Defaults to `accent`. */\n color?: ThemeColor\n /** Disables the slider. */\n disabled?: boolean\n /**\n * Show the current value at the end of the label row. Defaults to `true`. Pass a function to format\n * it (receives the `number` or `[start, end]`), or `false` to hide it.\n */\n valueLabel?: boolean | ((value: SliderValue) => ReactNode)\n /** Optional labeled ticks under the track (e.g. `[{ value: 0, label: 'Min' }, …]`). */\n marks?: SliderMark[]\n}\n\nconst clamp = (n: number, lo: number, hi: number) => Math.min(Math.max(n, lo), hi)\nconst toPercent = (v: number, min: number, max: number) =>\n max > min ? ((v - min) / (max - min)) * 100 : 0\n\n/**\n * A range slider — drag (or arrow-key / Home / End) a thumb along the track to pick a number, snapping\n * to `step`. Built on a native `<input type=\"range\">`, so keyboard, dragging, step/min/max, and a11y\n * come for free; the track / fill / thumb are styled with `--tz-*` tokens and tinted by `color`. Pass\n * **`range`** for a two-thumb span (the value becomes a `[start, end]` tuple). Controlled (`value` +\n * `onChange`) or uncontrolled (`defaultValue`); a `name` binds it to a surrounding `<Form>` — the form\n * value is a real `number` (or `[start, end]`), validated with `z.number()` / `z.tuple([…])`.\n */\nexport const Slider = forwardRef<HTMLInputElement, SliderProps>(function Slider(\n {\n label,\n size = 'md',\n error,\n helperText,\n required = false,\n fullWidth = true,\n range = false,\n value,\n defaultValue,\n onChange,\n min = 0,\n max = 100,\n step = 1,\n color = 'accent',\n disabled = false,\n valueLabel = true,\n marks,\n name,\n onBlur,\n id: idProp,\n className,\n style,\n ...props\n },\n ref,\n) {\n const reactId = useId()\n const id = idProp ?? reactId\n const helperId = `${id}-helper`\n\n // Auto-bind to a surrounding <Form> by `name` — the form value is a real number (or tuple); the\n // touched/error state comes from field(), the raw value from values[name] (tuples must not be coerced).\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = form && name ? form.field(name) : undefined\n\n const fallback: SliderValue = range ? [min, max] : min\n const externalValue: SliderValue | undefined =\n value !== undefined\n ? value\n : isFormBound\n ? ((form!.values[name!] as SliderValue | undefined) ?? fallback)\n : undefined\n const isControlled = externalValue !== undefined\n const [internal, setInternal] = useState<SliderValue>(defaultValue ?? fallback)\n const raw = isControlled ? externalValue! : internal\n\n // Normalize to the active shape (clamped, and — for a range — ordered low ≤ high).\n const tuple = Array.isArray(raw) ? raw : [min, raw]\n const lo = clamp(Math.min(tuple[0], tuple[1]), min, max)\n const hi = clamp(Math.max(tuple[0], tuple[1]), min, max)\n const single = clamp(Array.isArray(raw) ? raw[0] : raw, min, max)\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const commit = (next: SliderValue) => {\n if (!isControlled) setInternal(next)\n if (isFormBound) form!.setValue(name!, next)\n onChange?.(next)\n }\n const commitRange = (nextLo: number, nextHi: number) => {\n const l = clamp(nextLo, min, max)\n const h = clamp(nextHi, min, max)\n commit([Math.min(l, h), Math.max(l, h)])\n }\n\n const handleBlur = (event: FocusEvent<HTMLInputElement>) => {\n bound?.onBlur(event)\n onBlur?.(event)\n }\n\n const showValue = valueLabel !== false\n const currentValue: SliderValue = range ? [lo, hi] : single\n const renderedValue =\n typeof valueLabel === 'function' ? valueLabel(currentValue) : range ? `${lo} – ${hi}` : single\n\n const loPct = toPercent(lo, min, max)\n const hiPct = toPercent(hi, min, max)\n\n return (\n <div\n className={clsx(\n fieldStyles.field,\n fieldStyles[size],\n styles[size],\n fullWidth && fieldStyles.fullWidth,\n resolvedError && fieldStyles.error,\n disabled && fieldStyles.disabled,\n className,\n )}\n style={\n {\n '--tz-btn-rgb': `var(--tz-color-${color}-rgb)`,\n '--tz-slider-fill': `${toPercent(single, min, max)}%`,\n ...style,\n } as CSSProperties\n }\n >\n {(label != null || showValue) && (\n <div className={styles.labelRow}>\n {label != null ? (\n <label htmlFor={id} className={fieldStyles.label}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={fieldStyles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n ) : (\n <span />\n )}\n {showValue && (\n <Typography as=\"span\" variant=\"bodySmall\" className={styles.value}>\n {renderedValue}\n </Typography>\n )}\n </div>\n )}\n\n {range ? (\n <div className={clsx(styles.track, styles.rangeTrack)}>\n <span className={styles.rail} aria-hidden />\n <span\n className={styles.rangeFill}\n aria-hidden\n style={{ left: `${loPct}%`, width: `${hiPct - loPct}%` }}\n />\n {/* start thumb — can't pass the end thumb */}\n <input\n ref={ref}\n id={id}\n name={name}\n type=\"range\"\n min={min}\n max={max}\n step={step}\n value={lo}\n onChange={(e: ChangeEvent<HTMLInputElement>) =>\n commitRange(Math.min(Number(e.target.value), hi), hi)\n }\n onBlur={handleBlur}\n disabled={disabled}\n className={clsx(styles.input, styles.rangeInput)}\n // end thumb sits on top by default (z 4); raise the start above it (z 5) only when both pile\n // at max, so whichever thumb needs grabbing is always reachable\n style={{ zIndex: lo >= max ? 5 : 3 }}\n aria-label={label != null ? `${String(label)} start` : 'Range start'}\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n {...props}\n />\n {/* end thumb — can't pass the start thumb */}\n <input\n type=\"range\"\n min={min}\n max={max}\n step={step}\n value={hi}\n onChange={(e: ChangeEvent<HTMLInputElement>) =>\n commitRange(lo, Math.max(Number(e.target.value), lo))\n }\n onBlur={handleBlur}\n disabled={disabled}\n className={clsx(styles.input, styles.rangeInput)}\n style={{ zIndex: 4 }}\n aria-label={label != null ? `${String(label)} end` : 'Range end'}\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n />\n </div>\n ) : (\n <div className={clsx(styles.track, marks != null && marks.length > 0 && styles.hasMarks)}>\n <input\n ref={ref}\n id={id}\n name={name}\n type=\"range\"\n min={min}\n max={max}\n step={step}\n value={single}\n onChange={(e: ChangeEvent<HTMLInputElement>) => commit(Number(e.target.value))}\n onBlur={handleBlur}\n disabled={disabled}\n className={styles.input}\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n {...props}\n />\n {marks != null && marks.length > 0 && (\n <div className={styles.marks} aria-hidden>\n {marks.map((mark) => (\n <span\n key={mark.value}\n className={styles.mark}\n style={{ left: `${toPercent(mark.value, min, max)}%` }}\n >\n <span className={styles.tick} />\n {mark.label != null && <span className={styles.markLabel}>{mark.label}</span>}\n </span>\n ))}\n </div>\n )}\n </div>\n )}\n\n {resolvedHelperText != null && (\n <Typography\n as=\"span\"\n id={helperId}\n variant=\"bodySmall\"\n color={resolvedError ? 'error' : 'muted'}\n className={fieldStyles.helper}\n >\n {resolvedHelperText}\n </Typography>\n )}\n </div>\n )\n})\n"],"names":["clamp","n","lo","hi","toPercent","v","min","max","Slider","forwardRef","label","size","error","helperText","required","fullWidth","range","value","defaultValue","onChange","step","color","disabled","valueLabel","marks","name","onBlur","idProp","className","style","props","ref","reactId","useId","id","helperId","form","useFormContext","isFormBound","bound","fallback","externalValue","isControlled","internal","setInternal","useState","raw","tuple","single","resolvedError","resolvedHelperText","commit","next","commitRange","nextLo","nextHi","l","h","handleBlur","event","showValue","renderedValue","loPct","hiPct","jsxs","clsx","fieldStyles","styles","jsx","Typography","e","mark"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;GAuEMA,IAAQ,CAACC,GAAWC,GAAYC,MAAe,KAAK,IAAI,KAAK,IAAIF,GAAGC,CAAE,GAAGC,CAAE,GAC3EC,IAAY,CAACC,GAAWC,GAAaC,MACzCA,I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AAAA,cACA,MAAAa;AAAA,cACA,OAAO4B;AAAA,cACP,UAAU,CAACsB,MAAqCnB,EAAO,OAAOmB,EAAE,OAAO,KAAK,CAAC;AAAA,cAC7E,QAAQZ;AAAA,cACR,UAAApC;AAAA,cACA,WAAW6C,EAAO;AAAA,cAClB,gBAAclB,KAAiB;AAAA,cAC/B,oBAAkBC,KAAsB,OAAOf,IAAW;AAAA,cACzD,GAAGL;AAAA,YAAA;AAAA,UAAA;AAAA,UAELN,KAAS,QAAQA,EAAM,SAAS,KAC/B,gBAAA4C,EAAC,OAAA,EAAI,WAAWD,EAAO,OAAO,eAAW,IACtC,UAAA3C,EAAM,IAAI,CAAC+C,MACV,gBAAAP;AAAA,YAAC;AAAA,YAAA;AAAA,cAEC,WAAWG,EAAO;AAAA,cAClB,OAAO,EAAE,MAAM,GAAG/D,EAAUmE,EAAK,OAAOjE,GAAKC,CAAG,CAAC,IAAA;AAAA,cAEjD,UAAA;AAAA,gBAAA,gBAAA6D,EAAC,QAAA,EAAK,WAAWD,EAAO,KAAA,CAAM;AAAA,gBAC7BI,EAAK,SAAS,QAAQ,gBAAAH,EAAC,UAAK,WAAWD,EAAO,WAAY,UAAAI,EAAK,MAAA,CAAM;AAAA,cAAA;AAAA,YAAA;AAAA,YALjEA,EAAK;AAAA,UAAA,CAOb,EAAA,CACH;AAAA,QAAA,GAEJ;AAAA,QAGDrB,KAAsB,QACrB,gBAAAkB;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,IAAG;AAAA,YACH,IAAIlC;AAAA,YACJ,SAAQ;AAAA,YACR,OAAOc,IAAgB,UAAU;AAAA,YACjC,WAAWiB,EAAY;AAAA,YAEtB,UAAAhB;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
|
|
1
|
+
{"version":3,"file":"Slider-D7SvowmM.js","sources":["../src/components/Slider/Slider.tsx"],"sourcesContent":["import {\n forwardRef,\n useId,\n useState,\n type CSSProperties,\n type ChangeEvent,\n type FocusEvent,\n type InputHTMLAttributes,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useFormContext } from '../../form/formContext'\nimport { Typography } from '../Typography'\nimport type { ThemeColor } from '../../theme'\n// shared field chrome (wrapper / label / helper / required / error / sizes)\nimport fieldStyles from '../TextField/TextField.module.css'\nimport styles from './Slider.module.css'\n\nexport type SliderSize = 'sm' | 'md' | 'lg'\n/** A single value, or a `[start, end]` tuple when `range`. */\nexport type SliderValue = number | [number, number]\n\n/** A labeled tick under the track. */\nexport interface SliderMark {\n value: number\n label?: ReactNode\n}\n\nexport interface SliderProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'size' | 'value' | 'defaultValue' | 'onChange' | 'type' | 'min' | 'max' | 'step' | 'color'\n> {\n /** Label rendered above the track. */\n label?: ReactNode\n /** Preset size — drives the track + thumb dimensions and the label/helper font. */\n size?: SliderSize\n /** Marks the field invalid: red focus ring + the `helperText` in the error color. */\n error?: boolean\n /** Helper / validation text under the track. Adopts the error color while `error`. */\n helperText?: ReactNode\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Stretches the slider to fill its container width. Defaults to `true`. */\n fullWidth?: boolean\n /** Two-thumb range mode — pick a `[start, end]` span (e.g. 5–10). The value becomes a tuple. */\n range?: boolean\n /** Controlled value — a `number`, or a `[start, end]` tuple when `range`. */\n value?: SliderValue\n /** Initial value for uncontrolled use. Defaults to `min` (or `[min, max]` when `range`). */\n defaultValue?: SliderValue\n /** Fires with the next value (a `number`, or a `[start, end]` tuple when `range`). */\n onChange?: (value: SliderValue) => void\n /** Minimum value. Defaults to `0`. */\n min?: number\n /** Maximum value. Defaults to `100`. */\n max?: number\n /** Increment the thumb snaps to (arrow keys + drag). Defaults to `1`. */\n step?: number\n /** Theme palette token that tints the fill + thumb. Defaults to `accent`. */\n color?: ThemeColor\n /** Disables the slider. */\n disabled?: boolean\n /**\n * Show the current value at the end of the label row. Defaults to `true`. Pass a function to format\n * it (receives the `number` or `[start, end]`), or `false` to hide it.\n */\n valueLabel?: boolean | ((value: SliderValue) => ReactNode)\n /** Optional labeled ticks under the track (e.g. `[{ value: 0, label: 'Min' }, …]`). */\n marks?: SliderMark[]\n}\n\nconst clamp = (n: number, lo: number, hi: number) => Math.min(Math.max(n, lo), hi)\nconst toPercent = (v: number, min: number, max: number) =>\n max > min ? ((v - min) / (max - min)) * 100 : 0\n\n/**\n * A range slider — drag (or arrow-key / Home / End) a thumb along the track to pick a number, snapping\n * to `step`. Built on a native `<input type=\"range\">`, so keyboard, dragging, step/min/max, and a11y\n * come for free; the track / fill / thumb are styled with `--tz-*` tokens and tinted by `color`. Pass\n * **`range`** for a two-thumb span (the value becomes a `[start, end]` tuple). Controlled (`value` +\n * `onChange`) or uncontrolled (`defaultValue`); a `name` binds it to a surrounding `<Form>` — the form\n * value is a real `number` (or `[start, end]`), validated with `z.number()` / `z.tuple([…])`.\n */\nexport const Slider = forwardRef<HTMLInputElement, SliderProps>(function Slider(\n {\n label,\n size = 'md',\n error,\n helperText,\n required = false,\n fullWidth = true,\n range = false,\n value,\n defaultValue,\n onChange,\n min = 0,\n max = 100,\n step = 1,\n color = 'accent',\n disabled = false,\n valueLabel = true,\n marks,\n name,\n onBlur,\n id: idProp,\n className,\n style,\n ...props\n },\n ref,\n) {\n const reactId = useId()\n const id = idProp ?? reactId\n const helperId = `${id}-helper`\n\n // Auto-bind to a surrounding <Form> by `name` — the form value is a real number (or tuple); the\n // touched/error state comes from field(), the raw value from values[name] (tuples must not be coerced).\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = form && name ? form.field(name) : undefined\n\n const fallback: SliderValue = range ? [min, max] : min\n const externalValue: SliderValue | undefined =\n value !== undefined\n ? value\n : isFormBound\n ? ((form!.values[name!] as SliderValue | undefined) ?? fallback)\n : undefined\n const isControlled = externalValue !== undefined\n const [internal, setInternal] = useState<SliderValue>(defaultValue ?? fallback)\n const raw = isControlled ? externalValue! : internal\n\n // Normalize to the active shape (clamped, and — for a range — ordered low ≤ high).\n const tuple = Array.isArray(raw) ? raw : [min, raw]\n const lo = clamp(Math.min(tuple[0], tuple[1]), min, max)\n const hi = clamp(Math.max(tuple[0], tuple[1]), min, max)\n const single = clamp(Array.isArray(raw) ? raw[0] : raw, min, max)\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const commit = (next: SliderValue) => {\n if (!isControlled) setInternal(next)\n if (isFormBound) form!.setValue(name!, next)\n onChange?.(next)\n }\n const commitRange = (nextLo: number, nextHi: number) => {\n const l = clamp(nextLo, min, max)\n const h = clamp(nextHi, min, max)\n commit([Math.min(l, h), Math.max(l, h)])\n }\n\n const handleBlur = (event: FocusEvent<HTMLInputElement>) => {\n bound?.onBlur(event)\n onBlur?.(event)\n }\n\n const showValue = valueLabel !== false\n const currentValue: SliderValue = range ? [lo, hi] : single\n const renderedValue =\n typeof valueLabel === 'function' ? valueLabel(currentValue) : range ? `${lo} – ${hi}` : single\n\n const loPct = toPercent(lo, min, max)\n const hiPct = toPercent(hi, min, max)\n\n return (\n <div\n className={clsx(\n fieldStyles.field,\n fieldStyles[size],\n styles[size],\n fullWidth && fieldStyles.fullWidth,\n resolvedError && fieldStyles.error,\n disabled && fieldStyles.disabled,\n className,\n )}\n style={\n {\n '--tz-btn-rgb': `var(--tz-color-${color}-rgb)`,\n '--tz-slider-fill': `${toPercent(single, min, max)}%`,\n ...style,\n } as CSSProperties\n }\n >\n {(label != null || showValue) && (\n <div className={styles.labelRow}>\n {label != null ? (\n <label htmlFor={id} className={fieldStyles.label}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={fieldStyles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n ) : (\n <span />\n )}\n {showValue && (\n <Typography as=\"span\" variant=\"bodySmall\" className={styles.value}>\n {renderedValue}\n </Typography>\n )}\n </div>\n )}\n\n {range ? (\n <div className={clsx(styles.track, styles.rangeTrack)}>\n <span className={styles.rail} aria-hidden />\n <span\n className={styles.rangeFill}\n aria-hidden\n style={{ left: `${loPct}%`, width: `${hiPct - loPct}%` }}\n />\n {/* start thumb — can't pass the end thumb */}\n <input\n ref={ref}\n id={id}\n name={name}\n type=\"range\"\n min={min}\n max={max}\n step={step}\n value={lo}\n onChange={(e: ChangeEvent<HTMLInputElement>) =>\n commitRange(Math.min(Number(e.target.value), hi), hi)\n }\n onBlur={handleBlur}\n disabled={disabled}\n className={clsx(styles.input, styles.rangeInput)}\n // end thumb sits on top by default (z 4); raise the start above it (z 5) only when both pile\n // at max, so whichever thumb needs grabbing is always reachable\n style={{ zIndex: lo >= max ? 5 : 3 }}\n aria-label={label != null ? `${String(label)} start` : 'Range start'}\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n {...props}\n />\n {/* end thumb — can't pass the start thumb */}\n <input\n type=\"range\"\n min={min}\n max={max}\n step={step}\n value={hi}\n onChange={(e: ChangeEvent<HTMLInputElement>) =>\n commitRange(lo, Math.max(Number(e.target.value), lo))\n }\n onBlur={handleBlur}\n disabled={disabled}\n className={clsx(styles.input, styles.rangeInput)}\n style={{ zIndex: 4 }}\n aria-label={label != null ? `${String(label)} end` : 'Range end'}\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n />\n </div>\n ) : (\n <div className={clsx(styles.track, marks != null && marks.length > 0 && styles.hasMarks)}>\n <input\n ref={ref}\n id={id}\n name={name}\n type=\"range\"\n min={min}\n max={max}\n step={step}\n value={single}\n onChange={(e: ChangeEvent<HTMLInputElement>) => commit(Number(e.target.value))}\n onBlur={handleBlur}\n disabled={disabled}\n className={styles.input}\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n {...props}\n />\n {marks != null && marks.length > 0 && (\n <div className={styles.marks} aria-hidden>\n {marks.map((mark) => (\n <span\n key={mark.value}\n className={styles.mark}\n style={{ left: `${toPercent(mark.value, min, max)}%` }}\n >\n <span className={styles.tick} />\n {mark.label != null && <span className={styles.markLabel}>{mark.label}</span>}\n </span>\n ))}\n </div>\n )}\n </div>\n )}\n\n {resolvedHelperText != null && (\n <Typography\n as=\"span\"\n id={helperId}\n variant=\"bodySmall\"\n color={resolvedError ? 'error' : 'muted'}\n className={fieldStyles.helper}\n >\n {resolvedHelperText}\n </Typography>\n )}\n </div>\n )\n})\n"],"names":["clamp","n","lo","hi","toPercent","v","min","max","Slider","forwardRef","label","size","error","helperText","required","fullWidth","range","value","defaultValue","onChange","step","color","disabled","valueLabel","marks","name","onBlur","idProp","className","style","props","ref","reactId","useId","id","helperId","form","useFormContext","isFormBound","bound","fallback","externalValue","isControlled","internal","setInternal","useState","raw","tuple","single","resolvedError","resolvedHelperText","commit","next","commitRange","nextLo","nextHi","l","h","handleBlur","event","showValue","renderedValue","loPct","hiPct","jsxs","clsx","fieldStyles","styles","jsx","Typography","e","mark"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;GAuEMA,IAAQ,CAACC,GAAWC,GAAYC,MAAe,KAAK,IAAI,KAAK,IAAIF,GAAGC,CAAE,GAAGC,CAAE,GAC3EC,IAAY,CAACC,GAAWC,GAAaC,MACzCA,IAAMD,KAAQD,IAAIC,MAAQC,IAAMD,KAAQ,MAAM,GAUnCE,KAASC,GAA0C,SAC9D;AAAA,EACE,OAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,WAAAC,IAAY;AAAA,EACZ,OAAAC,IAAQ;AAAA,EACR,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,KAAAb,IAAM;AAAA,EACN,KAAAC,IAAM;AAAA,EACN,MAAAa,IAAO;AAAA,EACP,OAAAC,IAAQ;AAAA,EACR,UAAAC,IAAW;AAAA,EACX,YAAAC,IAAa;AAAA,EACb,OAAAC;AAAA,EACA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;AAAA,cAEC,WAAWG,EAAO;AAAA,cAClB,OAAO,EAAE,MAAM,GAAG/D,EAAUmE,EAAK,OAAOjE,GAAKC,CAAG,CAAC,IAAA;AAAA,cAEjD,UAAA;AAAA,gBAAA,gBAAA6D,EAAC,QAAA,EAAK,WAAWD,EAAO,KAAA,CAAM;AAAA,gBAC7BI,EAAK,SAAS,QAAQ,gBAAAH,EAAC,UAAK,WAAWD,EAAO,WAAY,UAAAI,EAAK,MAAA,CAAM;AAAA,cAAA;AAAA,YAAA;AAAA,YALjEA,EAAK;AAAA,UAAA,CAOb,EAAA,CACH;AAAA,QAAA,GAEJ;AAAA,QAGDrB,KAAsB,QACrB,gBAAAkB;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,IAAG;AAAA,YACH,IAAIlC;AAAA,YACJ,SAAQ;AAAA,YACR,OAAOc,IAAgB,UAAU;AAAA,YACjC,WAAWiB,EAAY;AAAA,YAEtB,UAAAhB;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
|
|
@@ -3,7 +3,7 @@ import { createContext as H, useContext as J, forwardRef as k, useRef as D, useI
|
|
|
3
3
|
import { clsx as _ } from "clsx";
|
|
4
4
|
import { a as M } from "./names-r21QPjcU.js";
|
|
5
5
|
import { I as g } from "./Icon-DaTvzLBu.js";
|
|
6
|
-
import { I as P } from "./IconButton-
|
|
6
|
+
import { I as P } from "./IconButton-CBp8QuTO.js";
|
|
7
7
|
import { T as X } from "./Tooltip-Cb_FKxT9.js";
|
|
8
8
|
const R = H(null);
|
|
9
9
|
function Y() {
|
|
@@ -162,4 +162,4 @@ export {
|
|
|
162
162
|
De as S,
|
|
163
163
|
me as a
|
|
164
164
|
};
|
|
165
|
-
//# sourceMappingURL=SpeedDial-
|
|
165
|
+
//# sourceMappingURL=SpeedDial-B8XMUATN.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpeedDial-DUYQMDCY.js","sources":["../src/components/SpeedDial/speedDialContext.ts","../src/components/SpeedDial/SpeedDialAction.tsx","../src/components/SpeedDial/SpeedDial.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { TooltipPlacement } from '../Tooltip'\n\n/** Action button size — one step smaller than the dial's FAB. */\nexport type SpeedDialActionSize = 'sm' | 'md' | 'lg'\n\n/** Shared state a `<SpeedDial>` hands down to its `<SpeedDialAction>` children via context. */\nexport interface SpeedDialContextValue {\n /** Size for the action FABs. */\n size: SpeedDialActionSize\n /** Where each action's tooltip label sits (derived from the dial `direction`). */\n placement: TooltipPlacement\n /** Close the dial after an action is clicked. */\n closeOnClick: boolean\n /** Show every action's label persistently (no hover needed) while the dial is open. */\n persistentLabels: boolean\n /** Request the dial to close (called by an action on click). */\n requestClose: () => void\n}\n\nexport const SpeedDialContext = createContext<SpeedDialContextValue | null>(null)\n\n/** Read the surrounding `<SpeedDial>` (or `null` when an action is rendered standalone). */\nexport function useSpeedDial(): SpeedDialContextValue | null {\n return useContext(SpeedDialContext)\n}\n","import { forwardRef, type ButtonHTMLAttributes, type MouseEvent, type ReactNode } from 'react'\nimport { clsx } from 'clsx'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { Tooltip } from '../Tooltip'\nimport { useSpeedDial } from './speedDialContext'\nimport styles from './SpeedDial.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport interface SpeedDialActionProps extends Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n 'color'\n> {\n /** Action icon — a known `IconName` or any node. */\n icon: IconName | ReactNode\n /** Label shown as a tooltip beside the action (also its `aria-label` when a string). */\n label?: ReactNode\n /** Show the label persistently (no hover) while the dial is open — overrides the dial's `tooltipOpen`. */\n tooltipOpen?: boolean\n /** Hide the tooltip / persistent label (still used for `aria-label`). */\n hideTooltip?: boolean\n}\n\n/**\n * One action inside a `<SpeedDial>` — a small circular `IconButton` (surface-tinted) with a tooltip\n * `label`. It reads the dial via context for its size, tooltip placement and close-on-click; clicking\n * runs `onClick` then closes the dial. The ref points at the `<button>`.\n */\nexport const SpeedDialAction = forwardRef<HTMLButtonElement, SpeedDialActionProps>(\n function SpeedDialAction(\n { icon, label, tooltipOpen, hideTooltip = false, onClick, disabled, className, ...props },\n ref,\n ) {\n const dial = useSpeedDial()\n const iconNode =\n typeof icon === 'string' && ICON_NAME_SET.has(icon) ? <Icon name={icon as IconName} /> : icon\n\n const button = (\n <IconButton\n ref={ref}\n rounded\n variant=\"contained\"\n color=\"surface\"\n size={dial?.size ?? 'sm'}\n disabled={disabled}\n aria-label={typeof label === 'string' ? label : undefined}\n className={clsx(styles.action, className)}\n onClick={(event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event)\n if (dial?.closeOnClick) dial.requestClose()\n }}\n {...props}\n >\n {iconNode}\n </IconButton>\n )\n\n if (label == null || hideTooltip) return button\n\n const placement = dial?.placement ?? 'left'\n // persistent label: render a static label beside the button (no hover) — like MUI's tooltipOpen\n const persistent = tooltipOpen ?? dial?.persistentLabels ?? false\n if (persistent) {\n return (\n <span\n className={clsx(\n styles.actionWrap,\n placement === 'top' ? styles.labelTop : styles.labelLeft,\n )}\n >\n {button}\n <span className={styles.actionLabel}>{label}</span>\n </span>\n )\n }\n\n return (\n <Tooltip content={label} placement={placement}>\n {button}\n </Tooltip>\n )\n },\n)\n","import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type MouseEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport type { ThemeColor } from '../../theme'\nimport type { TooltipPlacement } from '../Tooltip'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { SpeedDialAction } from './SpeedDialAction'\nimport {\n SpeedDialContext,\n type SpeedDialActionSize,\n type SpeedDialContextValue,\n} from './speedDialContext'\nimport styles from './SpeedDial.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport type SpeedDialSize = 'sm' | 'md' | 'lg'\nexport type SpeedDialDirection = 'up' | 'down' | 'left' | 'right'\n\n/** The FAB size → the (smaller) action-button size. */\nconst ACTION_SIZE: Record<SpeedDialSize, SpeedDialActionSize> = { sm: 'sm', md: 'sm', lg: 'md' }\n/** Tooltip side per direction — labels sit left of a vertical dial, above a horizontal one. */\nconst TOOLTIP_PLACEMENT: Record<SpeedDialDirection, TooltipPlacement> = {\n up: 'left',\n down: 'left',\n left: 'top',\n right: 'top',\n}\n\n/** A data-driven action for the `actions` prop. */\nexport interface SpeedDialActionItem {\n /** Stable key (falls back to the index). */\n key?: string\n icon: IconName | ReactNode\n label?: ReactNode\n onClick?: (event: MouseEvent<HTMLButtonElement>) => void\n disabled?: boolean\n}\n\nexport interface SpeedDialProps extends Omit<HTMLAttributes<HTMLDivElement>, 'color' | 'onChange'> {\n /** Accessible label for the FAB (required — it's icon-only). */\n ariaLabel: string\n /** FAB icon. Defaults to `Add` (a `+`). */\n icon?: IconName | ReactNode\n /** Icon shown while open. Omit to rotate the `icon` 45° instead (a `+` becomes a `×`). */\n openIcon?: IconName | ReactNode\n /** Which way the actions fan out. Defaults to `up`. */\n direction?: SpeedDialDirection\n /** Theme palette token tinting the FAB. Defaults to `primary`. */\n color?: ThemeColor\n /** FAB size (actions render one step smaller). Defaults to `md`. */\n size?: SpeedDialSize\n /** Controlled open state. */\n open?: boolean\n /** Initial open state for uncontrolled use. Defaults to `false`. */\n defaultOpen?: boolean\n /** Fires with the next open state. */\n onOpenChange?: (open: boolean) => void\n /** Open on hover (also opens on click). Defaults to `true`. */\n openOnHover?: boolean\n /** Close the dial after an action is clicked. Defaults to `true`. */\n closeOnActionClick?: boolean\n /** Show every action's label persistently while open (no hover needed) — like MUI's `tooltipOpen`. */\n tooltipOpen?: boolean\n /** Data-driven actions — an alternative to `<SpeedDialAction>` children. */\n actions?: SpeedDialActionItem[]\n /** Disables the FAB (and hover-opening). */\n disabled?: boolean\n /** `<SpeedDialAction>` children (used when `actions` is not given). */\n children?: ReactNode\n}\n\n/**\n * A floating action button that reveals a set of related actions on hover / click — fanning out in\n * `direction` (`up` default). The FAB icon rotates 45° when open (a `+` → `×`) unless an `openIcon` is\n * given. Each `<SpeedDialAction>` is a small circular button with a tooltip label; supply them via the\n * data-driven `actions` prop or as children. Opens on hover (`openOnHover`) and click; closes on\n * outside-pointerdown, Escape (refocusing the FAB), or selecting an action. Controlled (`open` +\n * `onOpenChange`) or uncontrolled (`defaultOpen`). The ref points at the root; position it (e.g.\n * `fixed` bottom-right) via `style`/`className`. The FAB carries `aria-expanded`/`aria-controls`.\n */\nexport const SpeedDial = forwardRef<HTMLDivElement, SpeedDialProps>(function SpeedDial(\n {\n ariaLabel,\n icon = 'Add',\n openIcon,\n direction = 'up',\n color = 'primary',\n size = 'md',\n open,\n defaultOpen = false,\n onOpenChange,\n openOnHover = true,\n closeOnActionClick = true,\n tooltipOpen = false,\n actions,\n disabled = false,\n children,\n className,\n style,\n ...props\n },\n forwardedRef,\n) {\n const rootRef = useRef<HTMLDivElement | null>(null)\n const fabRef = useRef<HTMLButtonElement | null>(null)\n const actionsId = useId()\n\n const isControlled = open !== undefined\n const [internal, setInternal] = useState(defaultOpen)\n const isOpen = isControlled ? open : internal\n\n const setOpen = (next: boolean) => {\n if (!isControlled) setInternal(next)\n onOpenChange?.(next)\n }\n // keep a stable reference for the document listeners below\n const setOpenRef = useRef(setOpen)\n setOpenRef.current = setOpen\n\n // while open: close on outside pointerdown / Escape (Escape refocuses the FAB)\n useEffect(() => {\n if (!isOpen) return\n const onPointerDown = (event: PointerEvent) => {\n if (rootRef.current && !rootRef.current.contains(event.target as Node)) {\n setOpenRef.current(false)\n }\n }\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n setOpenRef.current(false)\n fabRef.current?.focus()\n }\n }\n document.addEventListener('pointerdown', onPointerDown)\n document.addEventListener('keydown', onKeyDown)\n return () => {\n document.removeEventListener('pointerdown', onPointerDown)\n document.removeEventListener('keydown', onKeyDown)\n }\n }, [isOpen])\n\n const setRootRef = (node: HTMLDivElement | null) => {\n rootRef.current = node\n if (typeof forwardedRef === 'function') forwardedRef(node)\n else if (forwardedRef) forwardedRef.current = node\n }\n\n const renderIcon = (value: IconName | ReactNode) =>\n typeof value === 'string' && ICON_NAME_SET.has(value) ? (\n <Icon name={value as IconName} />\n ) : (\n value\n )\n\n const ctx: SpeedDialContextValue = {\n size: ACTION_SIZE[size],\n placement: TOOLTIP_PLACEMENT[direction],\n closeOnClick: closeOnActionClick,\n persistentLabels: tooltipOpen,\n requestClose: () => setOpen(false),\n }\n\n const hoverProps =\n openOnHover && !disabled\n ? { onMouseEnter: () => setOpen(true), onMouseLeave: () => setOpen(false) }\n : {}\n\n return (\n <div\n ref={setRootRef}\n className={clsx(styles.speedDial, className)}\n style={style as CSSProperties}\n {...hoverProps}\n {...props}\n >\n <div\n id={actionsId}\n className={clsx(styles.actions, styles[direction])}\n data-open={isOpen ? 'true' : 'false'}\n >\n <SpeedDialContext.Provider value={ctx}>\n {actions\n ? actions.map((action, index) => (\n <SpeedDialAction\n key={action.key ?? index}\n icon={action.icon}\n label={action.label}\n onClick={action.onClick}\n disabled={action.disabled}\n />\n ))\n : children}\n </SpeedDialContext.Provider>\n </div>\n\n <IconButton\n ref={fabRef}\n rounded\n variant=\"contained\"\n color={color}\n size={size}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-haspopup=\"true\"\n aria-expanded={isOpen}\n aria-controls={actionsId}\n className={styles.fab}\n onClick={() => setOpen(!isOpen)}\n >\n <span className={clsx(styles.fabIcon, !openIcon && isOpen && styles.fabIconOpen)}>\n {isOpen && openIcon != null ? renderIcon(openIcon) : renderIcon(icon)}\n </span>\n </IconButton>\n </div>\n )\n})\n"],"names":["SpeedDialContext","createContext","useSpeedDial","useContext","ICON_NAME_SET","ICON_NAMES","SpeedDialAction","forwardRef","icon","label","tooltipOpen","hideTooltip","onClick","disabled","className","props","ref","dial","iconNode","jsx","Icon","button","IconButton","clsx","styles","event","placement","jsxs","Tooltip","ACTION_SIZE","TOOLTIP_PLACEMENT","SpeedDial","ariaLabel","openIcon","direction","color","size","open","defaultOpen","onOpenChange","openOnHover","closeOnActionClick","actions","children","style","forwardedRef","rootRef","useRef","fabRef","actionsId","useId","isControlled","internal","setInternal","useState","isOpen","setOpen","next","setOpenRef","useEffect","onPointerDown","onKeyDown","_a","setRootRef","node","renderIcon","value","ctx","hoverProps","action","index"],"mappings":";;;;;;;AAoBO,MAAMA,IAAmBC,EAA4C,IAAI;AAGzE,SAASC,IAA6C;AAC3D,SAAOC,EAAWH,CAAgB;AACpC;;;;;;;;;;;;;;;;GChBMI,KAAgB,IAAI,IAAYC,CAAU,GAqBnCC,KAAkBC;AAAA,EAC7B,SACE,EAAE,MAAAC,GAAM,OAAAC,GAAO,aAAAC,GAAa,aAAAC,IAAc,IAAO,SAAAC,GAAS,UAAAC,GAAU,WAAAC,GAAW,GAAGC,EAAA,GAClFC,GACA;AACA,UAAMC,IAAOf,EAAA,GACPgB,IACJ,OAAOV,KAAS,YAAYJ,GAAc,IAAII,CAAI,IAAI,gBAAAW,EAACC,GAAA,EAAK,MAAMZ,EAAA,CAAkB,IAAKA,GAErFa,IACJ,gBAAAF;AAAA,MAACG;AAAA,MAAA;AAAA,QACC,KAAAN;AAAA,QACA,SAAO;AAAA,QACP,SAAQ;AAAA,QACR,OAAM;AAAA,QACN,OAAMC,KAAA,gBAAAA,EAAM,SAAQ;AAAA,QACpB,UAAAJ;AAAA,QACA,cAAY,OAAOJ,KAAU,WAAWA,IAAQ;AAAA,QAChD,WAAWc,EAAKC,EAAO,QAAQV,CAAS;AAAA,QACxC,SAAS,CAACW,MAAyC;AACjD,UAAAb,KAAA,QAAAA,EAAUa,IACNR,KAAA,QAAAA,EAAM,gBAAcA,EAAK,aAAA;AAAA,QAC/B;AAAA,QACC,GAAGF;AAAA,QAEH,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,UAAA+B,KAAUtB,KAAY,OAAOgC,EAAWhC,CAAQ,IAAIgC,EAAWzD,CAAI,EAAA,CACtE;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;"}
|
|
1
|
+
{"version":3,"file":"SpeedDial-B8XMUATN.js","sources":["../src/components/SpeedDial/speedDialContext.ts","../src/components/SpeedDial/SpeedDialAction.tsx","../src/components/SpeedDial/SpeedDial.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { TooltipPlacement } from '../Tooltip'\n\n/** Action button size — one step smaller than the dial's FAB. */\nexport type SpeedDialActionSize = 'sm' | 'md' | 'lg'\n\n/** Shared state a `<SpeedDial>` hands down to its `<SpeedDialAction>` children via context. */\nexport interface SpeedDialContextValue {\n /** Size for the action FABs. */\n size: SpeedDialActionSize\n /** Where each action's tooltip label sits (derived from the dial `direction`). */\n placement: TooltipPlacement\n /** Close the dial after an action is clicked. */\n closeOnClick: boolean\n /** Show every action's label persistently (no hover needed) while the dial is open. */\n persistentLabels: boolean\n /** Request the dial to close (called by an action on click). */\n requestClose: () => void\n}\n\nexport const SpeedDialContext = createContext<SpeedDialContextValue | null>(null)\n\n/** Read the surrounding `<SpeedDial>` (or `null` when an action is rendered standalone). */\nexport function useSpeedDial(): SpeedDialContextValue | null {\n return useContext(SpeedDialContext)\n}\n","import { forwardRef, type ButtonHTMLAttributes, type MouseEvent, type ReactNode } from 'react'\nimport { clsx } from 'clsx'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { Tooltip } from '../Tooltip'\nimport { useSpeedDial } from './speedDialContext'\nimport styles from './SpeedDial.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport interface SpeedDialActionProps extends Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n 'color'\n> {\n /** Action icon — a known `IconName` or any node. */\n icon: IconName | ReactNode\n /** Label shown as a tooltip beside the action (also its `aria-label` when a string). */\n label?: ReactNode\n /** Show the label persistently (no hover) while the dial is open — overrides the dial's `tooltipOpen`. */\n tooltipOpen?: boolean\n /** Hide the tooltip / persistent label (still used for `aria-label`). */\n hideTooltip?: boolean\n}\n\n/**\n * One action inside a `<SpeedDial>` — a small circular `IconButton` (surface-tinted) with a tooltip\n * `label`. It reads the dial via context for its size, tooltip placement and close-on-click; clicking\n * runs `onClick` then closes the dial. The ref points at the `<button>`.\n */\nexport const SpeedDialAction = forwardRef<HTMLButtonElement, SpeedDialActionProps>(\n function SpeedDialAction(\n { icon, label, tooltipOpen, hideTooltip = false, onClick, disabled, className, ...props },\n ref,\n ) {\n const dial = useSpeedDial()\n const iconNode =\n typeof icon === 'string' && ICON_NAME_SET.has(icon) ? <Icon name={icon as IconName} /> : icon\n\n const button = (\n <IconButton\n ref={ref}\n rounded\n variant=\"contained\"\n color=\"surface\"\n size={dial?.size ?? 'sm'}\n disabled={disabled}\n aria-label={typeof label === 'string' ? label : undefined}\n className={clsx(styles.action, className)}\n onClick={(event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event)\n if (dial?.closeOnClick) dial.requestClose()\n }}\n {...props}\n >\n {iconNode}\n </IconButton>\n )\n\n if (label == null || hideTooltip) return button\n\n const placement = dial?.placement ?? 'left'\n // persistent label: render a static label beside the button (no hover) — like MUI's tooltipOpen\n const persistent = tooltipOpen ?? dial?.persistentLabels ?? false\n if (persistent) {\n return (\n <span\n className={clsx(\n styles.actionWrap,\n placement === 'top' ? styles.labelTop : styles.labelLeft,\n )}\n >\n {button}\n <span className={styles.actionLabel}>{label}</span>\n </span>\n )\n }\n\n return (\n <Tooltip content={label} placement={placement}>\n {button}\n </Tooltip>\n )\n },\n)\n","import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type MouseEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport type { ThemeColor } from '../../theme'\nimport type { TooltipPlacement } from '../Tooltip'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { SpeedDialAction } from './SpeedDialAction'\nimport {\n SpeedDialContext,\n type SpeedDialActionSize,\n type SpeedDialContextValue,\n} from './speedDialContext'\nimport styles from './SpeedDial.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport type SpeedDialSize = 'sm' | 'md' | 'lg'\nexport type SpeedDialDirection = 'up' | 'down' | 'left' | 'right'\n\n/** The FAB size → the (smaller) action-button size. */\nconst ACTION_SIZE: Record<SpeedDialSize, SpeedDialActionSize> = { sm: 'sm', md: 'sm', lg: 'md' }\n/** Tooltip side per direction — labels sit left of a vertical dial, above a horizontal one. */\nconst TOOLTIP_PLACEMENT: Record<SpeedDialDirection, TooltipPlacement> = {\n up: 'left',\n down: 'left',\n left: 'top',\n right: 'top',\n}\n\n/** A data-driven action for the `actions` prop. */\nexport interface SpeedDialActionItem {\n /** Stable key (falls back to the index). */\n key?: string\n icon: IconName | ReactNode\n label?: ReactNode\n onClick?: (event: MouseEvent<HTMLButtonElement>) => void\n disabled?: boolean\n}\n\nexport interface SpeedDialProps extends Omit<HTMLAttributes<HTMLDivElement>, 'color' | 'onChange'> {\n /** Accessible label for the FAB (required — it's icon-only). */\n ariaLabel: string\n /** FAB icon. Defaults to `Add` (a `+`). */\n icon?: IconName | ReactNode\n /** Icon shown while open. Omit to rotate the `icon` 45° instead (a `+` becomes a `×`). */\n openIcon?: IconName | ReactNode\n /** Which way the actions fan out. Defaults to `up`. */\n direction?: SpeedDialDirection\n /** Theme palette token tinting the FAB. Defaults to `primary`. */\n color?: ThemeColor\n /** FAB size (actions render one step smaller). Defaults to `md`. */\n size?: SpeedDialSize\n /** Controlled open state. */\n open?: boolean\n /** Initial open state for uncontrolled use. Defaults to `false`. */\n defaultOpen?: boolean\n /** Fires with the next open state. */\n onOpenChange?: (open: boolean) => void\n /** Open on hover (also opens on click). Defaults to `true`. */\n openOnHover?: boolean\n /** Close the dial after an action is clicked. Defaults to `true`. */\n closeOnActionClick?: boolean\n /** Show every action's label persistently while open (no hover needed) — like MUI's `tooltipOpen`. */\n tooltipOpen?: boolean\n /** Data-driven actions — an alternative to `<SpeedDialAction>` children. */\n actions?: SpeedDialActionItem[]\n /** Disables the FAB (and hover-opening). */\n disabled?: boolean\n /** `<SpeedDialAction>` children (used when `actions` is not given). */\n children?: ReactNode\n}\n\n/**\n * A floating action button that reveals a set of related actions on hover / click — fanning out in\n * `direction` (`up` default). The FAB icon rotates 45° when open (a `+` → `×`) unless an `openIcon` is\n * given. Each `<SpeedDialAction>` is a small circular button with a tooltip label; supply them via the\n * data-driven `actions` prop or as children. Opens on hover (`openOnHover`) and click; closes on\n * outside-pointerdown, Escape (refocusing the FAB), or selecting an action. Controlled (`open` +\n * `onOpenChange`) or uncontrolled (`defaultOpen`). The ref points at the root; position it (e.g.\n * `fixed` bottom-right) via `style`/`className`. The FAB carries `aria-expanded`/`aria-controls`.\n */\nexport const SpeedDial = forwardRef<HTMLDivElement, SpeedDialProps>(function SpeedDial(\n {\n ariaLabel,\n icon = 'Add',\n openIcon,\n direction = 'up',\n color = 'primary',\n size = 'md',\n open,\n defaultOpen = false,\n onOpenChange,\n openOnHover = true,\n closeOnActionClick = true,\n tooltipOpen = false,\n actions,\n disabled = false,\n children,\n className,\n style,\n ...props\n },\n forwardedRef,\n) {\n const rootRef = useRef<HTMLDivElement | null>(null)\n const fabRef = useRef<HTMLButtonElement | null>(null)\n const actionsId = useId()\n\n const isControlled = open !== undefined\n const [internal, setInternal] = useState(defaultOpen)\n const isOpen = isControlled ? open : internal\n\n const setOpen = (next: boolean) => {\n if (!isControlled) setInternal(next)\n onOpenChange?.(next)\n }\n // keep a stable reference for the document listeners below\n const setOpenRef = useRef(setOpen)\n setOpenRef.current = setOpen\n\n // while open: close on outside pointerdown / Escape (Escape refocuses the FAB)\n useEffect(() => {\n if (!isOpen) return\n const onPointerDown = (event: PointerEvent) => {\n if (rootRef.current && !rootRef.current.contains(event.target as Node)) {\n setOpenRef.current(false)\n }\n }\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n setOpenRef.current(false)\n fabRef.current?.focus()\n }\n }\n document.addEventListener('pointerdown', onPointerDown)\n document.addEventListener('keydown', onKeyDown)\n return () => {\n document.removeEventListener('pointerdown', onPointerDown)\n document.removeEventListener('keydown', onKeyDown)\n }\n }, [isOpen])\n\n const setRootRef = (node: HTMLDivElement | null) => {\n rootRef.current = node\n if (typeof forwardedRef === 'function') forwardedRef(node)\n else if (forwardedRef) forwardedRef.current = node\n }\n\n const renderIcon = (value: IconName | ReactNode) =>\n typeof value === 'string' && ICON_NAME_SET.has(value) ? (\n <Icon name={value as IconName} />\n ) : (\n value\n )\n\n const ctx: SpeedDialContextValue = {\n size: ACTION_SIZE[size],\n placement: TOOLTIP_PLACEMENT[direction],\n closeOnClick: closeOnActionClick,\n persistentLabels: tooltipOpen,\n requestClose: () => setOpen(false),\n }\n\n const hoverProps =\n openOnHover && !disabled\n ? { onMouseEnter: () => setOpen(true), onMouseLeave: () => setOpen(false) }\n : {}\n\n return (\n <div\n ref={setRootRef}\n className={clsx(styles.speedDial, className)}\n style={style as CSSProperties}\n {...hoverProps}\n {...props}\n >\n <div\n id={actionsId}\n className={clsx(styles.actions, styles[direction])}\n data-open={isOpen ? 'true' : 'false'}\n >\n <SpeedDialContext.Provider value={ctx}>\n {actions\n ? actions.map((action, index) => (\n <SpeedDialAction\n key={action.key ?? index}\n icon={action.icon}\n label={action.label}\n onClick={action.onClick}\n disabled={action.disabled}\n />\n ))\n : children}\n </SpeedDialContext.Provider>\n </div>\n\n <IconButton\n ref={fabRef}\n rounded\n variant=\"contained\"\n color={color}\n size={size}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-haspopup=\"true\"\n aria-expanded={isOpen}\n aria-controls={actionsId}\n className={styles.fab}\n onClick={() => setOpen(!isOpen)}\n >\n <span className={clsx(styles.fabIcon, !openIcon && isOpen && styles.fabIconOpen)}>\n {isOpen && openIcon != null ? renderIcon(openIcon) : renderIcon(icon)}\n </span>\n </IconButton>\n </div>\n )\n})\n"],"names":["SpeedDialContext","createContext","useSpeedDial","useContext","ICON_NAME_SET","ICON_NAMES","SpeedDialAction","forwardRef","icon","label","tooltipOpen","hideTooltip","onClick","disabled","className","props","ref","dial","iconNode","jsx","Icon","button","IconButton","clsx","styles","event","placement","jsxs","Tooltip","ACTION_SIZE","TOOLTIP_PLACEMENT","SpeedDial","ariaLabel","openIcon","direction","color","size","open","defaultOpen","onOpenChange","openOnHover","closeOnActionClick","actions","children","style","forwardedRef","rootRef","useRef","fabRef","actionsId","useId","isControlled","internal","setInternal","useState","isOpen","setOpen","next","setOpenRef","useEffect","onPointerDown","onKeyDown","_a","setRootRef","node","renderIcon","value","ctx","hoverProps","action","index"],"mappings":";;;;;;;AAoBO,MAAMA,IAAmBC,EAA4C,IAAI;AAGzE,SAASC,IAA6C;AAC3D,SAAOC,EAAWH,CAAgB;AACpC;;;;;;;;;;;;;;;;GChBMI,KAAgB,IAAI,IAAYC,CAAU,GAqBnCC,KAAkBC;AAAA,EAC7B,SACE,EAAE,MAAAC,GAAM,OAAAC,GAAO,aAAAC,GAAa,aAAAC,IAAc,IAAO,SAAAC,GAAS,UAAAC,GAAU,WAAAC,GAAW,GAAGC,EAAA,GAClFC,GACA;AACA,UAAMC,IAAOf,EAAA,GACPgB,IACJ,OAAOV,KAAS,YAAYJ,GAAc,IAAII,CAAI,IAAI,gBAAAW,EAACC,GAAA,EAAK,MAAMZ,EAAA,CAAkB,IAAKA,GAErFa,IACJ,gBAAAF;AAAA,MAACG;AAAA,MAAA;AAAA,QACC,KAAAN;AAAA,QACA,SAAO;AAAA,QACP,SAAQ;AAAA,QACR,OAAM;AAAA,QACN,OAAMC,KAAA,gBAAAA,EAAM,SAAQ;AAAA,QACpB,UAAAJ;AAAA,QACA,cAAY,OAAOJ,KAAU,WAAWA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,iBAAeuB;AAAA,YACf,iBAAeN;AAAA,YACf,WAAWzB,EAAO;AAAA,YAClB,SAAS,MAAMgC,EAAQ,CAACD,CAAM;AAAA,YAE9B,UAAA,gBAAApC,EAAC,UAAK,WAAWI,EAAKC,EAAO,SAAS,CAACS,KAAYsB,KAAU/B,EAAO,WAAW,GAC5E,UAAA+B,KAAUtB,KAAY,OAAOgC,EAAWhC,CAAQ,IAAIgC,EAAWzD,CAAI,EAAA,CACtE;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const n=require("react/jsx-runtime"),o=require("react"),_=require("clsx"),A=require("./names-BJnFU_5m.cjs"),C=require("./Icon-BVULqOJD.cjs"),R=require("./IconButton-
|
|
2
|
-
//# sourceMappingURL=SpeedDial-
|
|
1
|
+
"use strict";const n=require("react/jsx-runtime"),o=require("react"),_=require("clsx"),A=require("./names-BJnFU_5m.cjs"),C=require("./Icon-BVULqOJD.cjs"),R=require("./IconButton-B87ipBK3.cjs"),G=require("./Tooltip-Ao7az09p.cjs"),M=o.createContext(null);function H(){return o.useContext(M)}const J="_speedDial_1qwl9_4",Q="_fab_1qwl9_9",U="_fabIcon_1qwl9_17",V="_fabIconOpen_1qwl9_21",X="_actions_1qwl9_26",Y="_up_1qwl9_47",ee="_down_1qwl9_53",te="_left_1qwl9_59",ne="_right_1qwl9_65",se="_action_1qwl9_26",oe="_actionWrap_1qwl9_91",ce="_actionLabel_1qwl9_95",re="_labelLeft_1qwl9_110",ae="_labelTop_1qwl9_117",s={speedDial:J,fab:Q,fabIcon:U,fabIconOpen:V,actions:X,up:Y,down:ee,left:te,right:ne,action:se,actionWrap:oe,actionLabel:ce,labelLeft:re,labelTop:ae},le=new Set(A.ICON_NAMES),k=o.forwardRef(function({icon:a,label:c,tooltipOpen:i,hideTooltip:b=!1,onClick:u,disabled:m,className:w,...I},f){const t=H(),N=typeof a=="string"&&le.has(a)?n.jsx(C.Icon,{name:a}):a,p=n.jsx(R.IconButton,{ref:f,rounded:!0,variant:"contained",color:"surface",size:(t==null?void 0:t.size)??"sm",disabled:m,"aria-label":typeof c=="string"?c:void 0,className:_.clsx(s.action,w),onClick:E=>{u==null||u(E),t!=null&&t.closeOnClick&&t.requestClose()},...I,children:N});if(c==null||b)return p;const d=(t==null?void 0:t.placement)??"left";return i??(t==null?void 0:t.persistentLabels)??!1?n.jsxs("span",{className:_.clsx(s.actionWrap,d==="top"?s.labelTop:s.labelLeft),children:[p,n.jsx("span",{className:s.actionLabel,children:c})]}):n.jsx(G.Tooltip,{content:c,placement:d,children:p})}),ie=new Set(A.ICON_NAMES),ue={sm:"sm",md:"sm",lg:"md"},fe={up:"left",down:"left",left:"top",right:"top"},pe=o.forwardRef(function({ariaLabel:a,icon:c="Add",openIcon:i,direction:b="up",color:u="primary",size:m="md",open:w,defaultOpen:I=!1,onOpenChange:f,openOnHover:t=!0,closeOnActionClick:N=!0,tooltipOpen:p=!1,actions:d,disabled:L=!1,children:E,className:P,style:W,...B},q){const S=o.useRef(null),j=o.useRef(null),v=o.useId(),O=w!==void 0,[z,K]=o.useState(I),r=O?w:z,l=e=>{O||K(e),f==null||f(e)},D=o.useRef(l);D.current=l,o.useEffect(()=>{if(!r)return;const e=h=>{S.current&&!S.current.contains(h.target)&&D.current(!1)},x=h=>{var y;h.key==="Escape"&&(D.current(!1),(y=j.current)==null||y.focus())};return document.addEventListener("pointerdown",e),document.addEventListener("keydown",x),()=>{document.removeEventListener("pointerdown",e),document.removeEventListener("keydown",x)}},[r]);const Z=e=>{S.current=e,typeof q=="function"?q(e):q&&(q.current=e)},T=e=>typeof e=="string"&&ie.has(e)?n.jsx(C.Icon,{name:e}):e,$={size:ue[m],placement:fe[b],closeOnClick:N,persistentLabels:p,requestClose:()=>l(!1)},F=t&&!L?{onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1)}:{};return n.jsxs("div",{ref:Z,className:_.clsx(s.speedDial,P),style:W,...F,...B,children:[n.jsx("div",{id:v,className:_.clsx(s.actions,s[b]),"data-open":r?"true":"false",children:n.jsx(M.Provider,{value:$,children:d?d.map((e,x)=>n.jsx(k,{icon:e.icon,label:e.label,onClick:e.onClick,disabled:e.disabled},e.key??x)):E})}),n.jsx(R.IconButton,{ref:j,rounded:!0,variant:"contained",color:u,size:m,disabled:L,"aria-label":a,"aria-haspopup":"true","aria-expanded":r,"aria-controls":v,className:s.fab,onClick:()=>l(!r),children:n.jsx("span",{className:_.clsx(s.fabIcon,!i&&r&&s.fabIconOpen),children:r&&i!=null?T(i):T(c)})})]})});exports.SpeedDial=pe;exports.SpeedDialAction=k;
|
|
2
|
+
//# sourceMappingURL=SpeedDial-CZ22T8GL.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpeedDial-B9JTNNUU.cjs","sources":["../src/components/SpeedDial/speedDialContext.ts","../src/components/SpeedDial/SpeedDialAction.tsx","../src/components/SpeedDial/SpeedDial.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { TooltipPlacement } from '../Tooltip'\n\n/** Action button size — one step smaller than the dial's FAB. */\nexport type SpeedDialActionSize = 'sm' | 'md' | 'lg'\n\n/** Shared state a `<SpeedDial>` hands down to its `<SpeedDialAction>` children via context. */\nexport interface SpeedDialContextValue {\n /** Size for the action FABs. */\n size: SpeedDialActionSize\n /** Where each action's tooltip label sits (derived from the dial `direction`). */\n placement: TooltipPlacement\n /** Close the dial after an action is clicked. */\n closeOnClick: boolean\n /** Show every action's label persistently (no hover needed) while the dial is open. */\n persistentLabels: boolean\n /** Request the dial to close (called by an action on click). */\n requestClose: () => void\n}\n\nexport const SpeedDialContext = createContext<SpeedDialContextValue | null>(null)\n\n/** Read the surrounding `<SpeedDial>` (or `null` when an action is rendered standalone). */\nexport function useSpeedDial(): SpeedDialContextValue | null {\n return useContext(SpeedDialContext)\n}\n","import { forwardRef, type ButtonHTMLAttributes, type MouseEvent, type ReactNode } from 'react'\nimport { clsx } from 'clsx'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { Tooltip } from '../Tooltip'\nimport { useSpeedDial } from './speedDialContext'\nimport styles from './SpeedDial.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport interface SpeedDialActionProps extends Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n 'color'\n> {\n /** Action icon — a known `IconName` or any node. */\n icon: IconName | ReactNode\n /** Label shown as a tooltip beside the action (also its `aria-label` when a string). */\n label?: ReactNode\n /** Show the label persistently (no hover) while the dial is open — overrides the dial's `tooltipOpen`. */\n tooltipOpen?: boolean\n /** Hide the tooltip / persistent label (still used for `aria-label`). */\n hideTooltip?: boolean\n}\n\n/**\n * One action inside a `<SpeedDial>` — a small circular `IconButton` (surface-tinted) with a tooltip\n * `label`. It reads the dial via context for its size, tooltip placement and close-on-click; clicking\n * runs `onClick` then closes the dial. The ref points at the `<button>`.\n */\nexport const SpeedDialAction = forwardRef<HTMLButtonElement, SpeedDialActionProps>(\n function SpeedDialAction(\n { icon, label, tooltipOpen, hideTooltip = false, onClick, disabled, className, ...props },\n ref,\n ) {\n const dial = useSpeedDial()\n const iconNode =\n typeof icon === 'string' && ICON_NAME_SET.has(icon) ? <Icon name={icon as IconName} /> : icon\n\n const button = (\n <IconButton\n ref={ref}\n rounded\n variant=\"contained\"\n color=\"surface\"\n size={dial?.size ?? 'sm'}\n disabled={disabled}\n aria-label={typeof label === 'string' ? label : undefined}\n className={clsx(styles.action, className)}\n onClick={(event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event)\n if (dial?.closeOnClick) dial.requestClose()\n }}\n {...props}\n >\n {iconNode}\n </IconButton>\n )\n\n if (label == null || hideTooltip) return button\n\n const placement = dial?.placement ?? 'left'\n // persistent label: render a static label beside the button (no hover) — like MUI's tooltipOpen\n const persistent = tooltipOpen ?? dial?.persistentLabels ?? false\n if (persistent) {\n return (\n <span\n className={clsx(\n styles.actionWrap,\n placement === 'top' ? styles.labelTop : styles.labelLeft,\n )}\n >\n {button}\n <span className={styles.actionLabel}>{label}</span>\n </span>\n )\n }\n\n return (\n <Tooltip content={label} placement={placement}>\n {button}\n </Tooltip>\n )\n },\n)\n","import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type MouseEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport type { ThemeColor } from '../../theme'\nimport type { TooltipPlacement } from '../Tooltip'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { SpeedDialAction } from './SpeedDialAction'\nimport {\n SpeedDialContext,\n type SpeedDialActionSize,\n type SpeedDialContextValue,\n} from './speedDialContext'\nimport styles from './SpeedDial.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport type SpeedDialSize = 'sm' | 'md' | 'lg'\nexport type SpeedDialDirection = 'up' | 'down' | 'left' | 'right'\n\n/** The FAB size → the (smaller) action-button size. */\nconst ACTION_SIZE: Record<SpeedDialSize, SpeedDialActionSize> = { sm: 'sm', md: 'sm', lg: 'md' }\n/** Tooltip side per direction — labels sit left of a vertical dial, above a horizontal one. */\nconst TOOLTIP_PLACEMENT: Record<SpeedDialDirection, TooltipPlacement> = {\n up: 'left',\n down: 'left',\n left: 'top',\n right: 'top',\n}\n\n/** A data-driven action for the `actions` prop. */\nexport interface SpeedDialActionItem {\n /** Stable key (falls back to the index). */\n key?: string\n icon: IconName | ReactNode\n label?: ReactNode\n onClick?: (event: MouseEvent<HTMLButtonElement>) => void\n disabled?: boolean\n}\n\nexport interface SpeedDialProps extends Omit<HTMLAttributes<HTMLDivElement>, 'color' | 'onChange'> {\n /** Accessible label for the FAB (required — it's icon-only). */\n ariaLabel: string\n /** FAB icon. Defaults to `Add` (a `+`). */\n icon?: IconName | ReactNode\n /** Icon shown while open. Omit to rotate the `icon` 45° instead (a `+` becomes a `×`). */\n openIcon?: IconName | ReactNode\n /** Which way the actions fan out. Defaults to `up`. */\n direction?: SpeedDialDirection\n /** Theme palette token tinting the FAB. Defaults to `primary`. */\n color?: ThemeColor\n /** FAB size (actions render one step smaller). Defaults to `md`. */\n size?: SpeedDialSize\n /** Controlled open state. */\n open?: boolean\n /** Initial open state for uncontrolled use. Defaults to `false`. */\n defaultOpen?: boolean\n /** Fires with the next open state. */\n onOpenChange?: (open: boolean) => void\n /** Open on hover (also opens on click). Defaults to `true`. */\n openOnHover?: boolean\n /** Close the dial after an action is clicked. Defaults to `true`. */\n closeOnActionClick?: boolean\n /** Show every action's label persistently while open (no hover needed) — like MUI's `tooltipOpen`. */\n tooltipOpen?: boolean\n /** Data-driven actions — an alternative to `<SpeedDialAction>` children. */\n actions?: SpeedDialActionItem[]\n /** Disables the FAB (and hover-opening). */\n disabled?: boolean\n /** `<SpeedDialAction>` children (used when `actions` is not given). */\n children?: ReactNode\n}\n\n/**\n * A floating action button that reveals a set of related actions on hover / click — fanning out in\n * `direction` (`up` default). The FAB icon rotates 45° when open (a `+` → `×`) unless an `openIcon` is\n * given. Each `<SpeedDialAction>` is a small circular button with a tooltip label; supply them via the\n * data-driven `actions` prop or as children. Opens on hover (`openOnHover`) and click; closes on\n * outside-pointerdown, Escape (refocusing the FAB), or selecting an action. Controlled (`open` +\n * `onOpenChange`) or uncontrolled (`defaultOpen`). The ref points at the root; position it (e.g.\n * `fixed` bottom-right) via `style`/`className`. The FAB carries `aria-expanded`/`aria-controls`.\n */\nexport const SpeedDial = forwardRef<HTMLDivElement, SpeedDialProps>(function SpeedDial(\n {\n ariaLabel,\n icon = 'Add',\n openIcon,\n direction = 'up',\n color = 'primary',\n size = 'md',\n open,\n defaultOpen = false,\n onOpenChange,\n openOnHover = true,\n closeOnActionClick = true,\n tooltipOpen = false,\n actions,\n disabled = false,\n children,\n className,\n style,\n ...props\n },\n forwardedRef,\n) {\n const rootRef = useRef<HTMLDivElement | null>(null)\n const fabRef = useRef<HTMLButtonElement | null>(null)\n const actionsId = useId()\n\n const isControlled = open !== undefined\n const [internal, setInternal] = useState(defaultOpen)\n const isOpen = isControlled ? open : internal\n\n const setOpen = (next: boolean) => {\n if (!isControlled) setInternal(next)\n onOpenChange?.(next)\n }\n // keep a stable reference for the document listeners below\n const setOpenRef = useRef(setOpen)\n setOpenRef.current = setOpen\n\n // while open: close on outside pointerdown / Escape (Escape refocuses the FAB)\n useEffect(() => {\n if (!isOpen) return\n const onPointerDown = (event: PointerEvent) => {\n if (rootRef.current && !rootRef.current.contains(event.target as Node)) {\n setOpenRef.current(false)\n }\n }\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n setOpenRef.current(false)\n fabRef.current?.focus()\n }\n }\n document.addEventListener('pointerdown', onPointerDown)\n document.addEventListener('keydown', onKeyDown)\n return () => {\n document.removeEventListener('pointerdown', onPointerDown)\n document.removeEventListener('keydown', onKeyDown)\n }\n }, [isOpen])\n\n const setRootRef = (node: HTMLDivElement | null) => {\n rootRef.current = node\n if (typeof forwardedRef === 'function') forwardedRef(node)\n else if (forwardedRef) forwardedRef.current = node\n }\n\n const renderIcon = (value: IconName | ReactNode) =>\n typeof value === 'string' && ICON_NAME_SET.has(value) ? (\n <Icon name={value as IconName} />\n ) : (\n value\n )\n\n const ctx: SpeedDialContextValue = {\n size: ACTION_SIZE[size],\n placement: TOOLTIP_PLACEMENT[direction],\n closeOnClick: closeOnActionClick,\n persistentLabels: tooltipOpen,\n requestClose: () => setOpen(false),\n }\n\n const hoverProps =\n openOnHover && !disabled\n ? { onMouseEnter: () => setOpen(true), onMouseLeave: () => setOpen(false) }\n : {}\n\n return (\n <div\n ref={setRootRef}\n className={clsx(styles.speedDial, className)}\n style={style as CSSProperties}\n {...hoverProps}\n {...props}\n >\n <div\n id={actionsId}\n className={clsx(styles.actions, styles[direction])}\n data-open={isOpen ? 'true' : 'false'}\n >\n <SpeedDialContext.Provider value={ctx}>\n {actions\n ? actions.map((action, index) => (\n <SpeedDialAction\n key={action.key ?? index}\n icon={action.icon}\n label={action.label}\n onClick={action.onClick}\n disabled={action.disabled}\n />\n ))\n : children}\n </SpeedDialContext.Provider>\n </div>\n\n <IconButton\n ref={fabRef}\n rounded\n variant=\"contained\"\n color={color}\n size={size}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-haspopup=\"true\"\n aria-expanded={isOpen}\n aria-controls={actionsId}\n className={styles.fab}\n onClick={() => setOpen(!isOpen)}\n >\n <span className={clsx(styles.fabIcon, !openIcon && isOpen && styles.fabIconOpen)}>\n {isOpen && openIcon != null ? renderIcon(openIcon) : renderIcon(icon)}\n </span>\n </IconButton>\n </div>\n )\n})\n"],"names":["SpeedDialContext","createContext","useSpeedDial","useContext","ICON_NAME_SET","ICON_NAMES","SpeedDialAction","forwardRef","icon","label","tooltipOpen","hideTooltip","onClick","disabled","className","props","ref","dial","iconNode","jsx","Icon","button","IconButton","clsx","styles","event","placement","jsxs","Tooltip","ACTION_SIZE","TOOLTIP_PLACEMENT","SpeedDial","ariaLabel","openIcon","direction","color","size","open","defaultOpen","onOpenChange","openOnHover","closeOnActionClick","actions","children","style","forwardedRef","rootRef","useRef","fabRef","actionsId","useId","isControlled","internal","setInternal","useState","isOpen","setOpen","next","setOpenRef","useEffect","onPointerDown","onKeyDown","_a","setRootRef","node","renderIcon","value","ctx","hoverProps","action","index"],"mappings":"qOAoBaA,EAAmBC,EAAAA,cAA4C,IAAI,EAGzE,SAASC,GAA6C,CAC3D,OAAOC,EAAAA,WAAWH,CAAgB,CACpC,udChBMI,GAAgB,IAAI,IAAYC,YAAU,EAqBnCC,EAAkBC,EAAAA,WAC7B,SACE,CAAE,KAAAC,EAAM,MAAAC,EAAO,YAAAC,EAAa,YAAAC,EAAc,GAAO,QAAAC,EAAS,SAAAC,EAAU,UAAAC,EAAW,GAAGC,CAAA,EAClFC,EACA,CACA,MAAMC,EAAOf,EAAA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gC,EAAWzD,CAAI,CAAA,CACtE,CAAA,CAAA,CACF,CAAA,CAAA,CAGN,CAAC"}
|
|
1
|
+
{"version":3,"file":"SpeedDial-CZ22T8GL.cjs","sources":["../src/components/SpeedDial/speedDialContext.ts","../src/components/SpeedDial/SpeedDialAction.tsx","../src/components/SpeedDial/SpeedDial.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { TooltipPlacement } from '../Tooltip'\n\n/** Action button size — one step smaller than the dial's FAB. */\nexport type SpeedDialActionSize = 'sm' | 'md' | 'lg'\n\n/** Shared state a `<SpeedDial>` hands down to its `<SpeedDialAction>` children via context. */\nexport interface SpeedDialContextValue {\n /** Size for the action FABs. */\n size: SpeedDialActionSize\n /** Where each action's tooltip label sits (derived from the dial `direction`). */\n placement: TooltipPlacement\n /** Close the dial after an action is clicked. */\n closeOnClick: boolean\n /** Show every action's label persistently (no hover needed) while the dial is open. */\n persistentLabels: boolean\n /** Request the dial to close (called by an action on click). */\n requestClose: () => void\n}\n\nexport const SpeedDialContext = createContext<SpeedDialContextValue | null>(null)\n\n/** Read the surrounding `<SpeedDial>` (or `null` when an action is rendered standalone). */\nexport function useSpeedDial(): SpeedDialContextValue | null {\n return useContext(SpeedDialContext)\n}\n","import { forwardRef, type ButtonHTMLAttributes, type MouseEvent, type ReactNode } from 'react'\nimport { clsx } from 'clsx'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { Tooltip } from '../Tooltip'\nimport { useSpeedDial } from './speedDialContext'\nimport styles from './SpeedDial.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport interface SpeedDialActionProps extends Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n 'color'\n> {\n /** Action icon — a known `IconName` or any node. */\n icon: IconName | ReactNode\n /** Label shown as a tooltip beside the action (also its `aria-label` when a string). */\n label?: ReactNode\n /** Show the label persistently (no hover) while the dial is open — overrides the dial's `tooltipOpen`. */\n tooltipOpen?: boolean\n /** Hide the tooltip / persistent label (still used for `aria-label`). */\n hideTooltip?: boolean\n}\n\n/**\n * One action inside a `<SpeedDial>` — a small circular `IconButton` (surface-tinted) with a tooltip\n * `label`. It reads the dial via context for its size, tooltip placement and close-on-click; clicking\n * runs `onClick` then closes the dial. The ref points at the `<button>`.\n */\nexport const SpeedDialAction = forwardRef<HTMLButtonElement, SpeedDialActionProps>(\n function SpeedDialAction(\n { icon, label, tooltipOpen, hideTooltip = false, onClick, disabled, className, ...props },\n ref,\n ) {\n const dial = useSpeedDial()\n const iconNode =\n typeof icon === 'string' && ICON_NAME_SET.has(icon) ? <Icon name={icon as IconName} /> : icon\n\n const button = (\n <IconButton\n ref={ref}\n rounded\n variant=\"contained\"\n color=\"surface\"\n size={dial?.size ?? 'sm'}\n disabled={disabled}\n aria-label={typeof label === 'string' ? label : undefined}\n className={clsx(styles.action, className)}\n onClick={(event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event)\n if (dial?.closeOnClick) dial.requestClose()\n }}\n {...props}\n >\n {iconNode}\n </IconButton>\n )\n\n if (label == null || hideTooltip) return button\n\n const placement = dial?.placement ?? 'left'\n // persistent label: render a static label beside the button (no hover) — like MUI's tooltipOpen\n const persistent = tooltipOpen ?? dial?.persistentLabels ?? false\n if (persistent) {\n return (\n <span\n className={clsx(\n styles.actionWrap,\n placement === 'top' ? styles.labelTop : styles.labelLeft,\n )}\n >\n {button}\n <span className={styles.actionLabel}>{label}</span>\n </span>\n )\n }\n\n return (\n <Tooltip content={label} placement={placement}>\n {button}\n </Tooltip>\n )\n },\n)\n","import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type MouseEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport type { ThemeColor } from '../../theme'\nimport type { TooltipPlacement } from '../Tooltip'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { SpeedDialAction } from './SpeedDialAction'\nimport {\n SpeedDialContext,\n type SpeedDialActionSize,\n type SpeedDialContextValue,\n} from './speedDialContext'\nimport styles from './SpeedDial.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport type SpeedDialSize = 'sm' | 'md' | 'lg'\nexport type SpeedDialDirection = 'up' | 'down' | 'left' | 'right'\n\n/** The FAB size → the (smaller) action-button size. */\nconst ACTION_SIZE: Record<SpeedDialSize, SpeedDialActionSize> = { sm: 'sm', md: 'sm', lg: 'md' }\n/** Tooltip side per direction — labels sit left of a vertical dial, above a horizontal one. */\nconst TOOLTIP_PLACEMENT: Record<SpeedDialDirection, TooltipPlacement> = {\n up: 'left',\n down: 'left',\n left: 'top',\n right: 'top',\n}\n\n/** A data-driven action for the `actions` prop. */\nexport interface SpeedDialActionItem {\n /** Stable key (falls back to the index). */\n key?: string\n icon: IconName | ReactNode\n label?: ReactNode\n onClick?: (event: MouseEvent<HTMLButtonElement>) => void\n disabled?: boolean\n}\n\nexport interface SpeedDialProps extends Omit<HTMLAttributes<HTMLDivElement>, 'color' | 'onChange'> {\n /** Accessible label for the FAB (required — it's icon-only). */\n ariaLabel: string\n /** FAB icon. Defaults to `Add` (a `+`). */\n icon?: IconName | ReactNode\n /** Icon shown while open. Omit to rotate the `icon` 45° instead (a `+` becomes a `×`). */\n openIcon?: IconName | ReactNode\n /** Which way the actions fan out. Defaults to `up`. */\n direction?: SpeedDialDirection\n /** Theme palette token tinting the FAB. Defaults to `primary`. */\n color?: ThemeColor\n /** FAB size (actions render one step smaller). Defaults to `md`. */\n size?: SpeedDialSize\n /** Controlled open state. */\n open?: boolean\n /** Initial open state for uncontrolled use. Defaults to `false`. */\n defaultOpen?: boolean\n /** Fires with the next open state. */\n onOpenChange?: (open: boolean) => void\n /** Open on hover (also opens on click). Defaults to `true`. */\n openOnHover?: boolean\n /** Close the dial after an action is clicked. Defaults to `true`. */\n closeOnActionClick?: boolean\n /** Show every action's label persistently while open (no hover needed) — like MUI's `tooltipOpen`. */\n tooltipOpen?: boolean\n /** Data-driven actions — an alternative to `<SpeedDialAction>` children. */\n actions?: SpeedDialActionItem[]\n /** Disables the FAB (and hover-opening). */\n disabled?: boolean\n /** `<SpeedDialAction>` children (used when `actions` is not given). */\n children?: ReactNode\n}\n\n/**\n * A floating action button that reveals a set of related actions on hover / click — fanning out in\n * `direction` (`up` default). The FAB icon rotates 45° when open (a `+` → `×`) unless an `openIcon` is\n * given. Each `<SpeedDialAction>` is a small circular button with a tooltip label; supply them via the\n * data-driven `actions` prop or as children. Opens on hover (`openOnHover`) and click; closes on\n * outside-pointerdown, Escape (refocusing the FAB), or selecting an action. Controlled (`open` +\n * `onOpenChange`) or uncontrolled (`defaultOpen`). The ref points at the root; position it (e.g.\n * `fixed` bottom-right) via `style`/`className`. The FAB carries `aria-expanded`/`aria-controls`.\n */\nexport const SpeedDial = forwardRef<HTMLDivElement, SpeedDialProps>(function SpeedDial(\n {\n ariaLabel,\n icon = 'Add',\n openIcon,\n direction = 'up',\n color = 'primary',\n size = 'md',\n open,\n defaultOpen = false,\n onOpenChange,\n openOnHover = true,\n closeOnActionClick = true,\n tooltipOpen = false,\n actions,\n disabled = false,\n children,\n className,\n style,\n ...props\n },\n forwardedRef,\n) {\n const rootRef = useRef<HTMLDivElement | null>(null)\n const fabRef = useRef<HTMLButtonElement | null>(null)\n const actionsId = useId()\n\n const isControlled = open !== undefined\n const [internal, setInternal] = useState(defaultOpen)\n const isOpen = isControlled ? open : internal\n\n const setOpen = (next: boolean) => {\n if (!isControlled) setInternal(next)\n onOpenChange?.(next)\n }\n // keep a stable reference for the document listeners below\n const setOpenRef = useRef(setOpen)\n setOpenRef.current = setOpen\n\n // while open: close on outside pointerdown / Escape (Escape refocuses the FAB)\n useEffect(() => {\n if (!isOpen) return\n const onPointerDown = (event: PointerEvent) => {\n if (rootRef.current && !rootRef.current.contains(event.target as Node)) {\n setOpenRef.current(false)\n }\n }\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n setOpenRef.current(false)\n fabRef.current?.focus()\n }\n }\n document.addEventListener('pointerdown', onPointerDown)\n document.addEventListener('keydown', onKeyDown)\n return () => {\n document.removeEventListener('pointerdown', onPointerDown)\n document.removeEventListener('keydown', onKeyDown)\n }\n }, [isOpen])\n\n const setRootRef = (node: HTMLDivElement | null) => {\n rootRef.current = node\n if (typeof forwardedRef === 'function') forwardedRef(node)\n else if (forwardedRef) forwardedRef.current = node\n }\n\n const renderIcon = (value: IconName | ReactNode) =>\n typeof value === 'string' && ICON_NAME_SET.has(value) ? (\n <Icon name={value as IconName} />\n ) : (\n value\n )\n\n const ctx: SpeedDialContextValue = {\n size: ACTION_SIZE[size],\n placement: TOOLTIP_PLACEMENT[direction],\n closeOnClick: closeOnActionClick,\n persistentLabels: tooltipOpen,\n requestClose: () => setOpen(false),\n }\n\n const hoverProps =\n openOnHover && !disabled\n ? { onMouseEnter: () => setOpen(true), onMouseLeave: () => setOpen(false) }\n : {}\n\n return (\n <div\n ref={setRootRef}\n className={clsx(styles.speedDial, className)}\n style={style as CSSProperties}\n {...hoverProps}\n {...props}\n >\n <div\n id={actionsId}\n className={clsx(styles.actions, styles[direction])}\n data-open={isOpen ? 'true' : 'false'}\n >\n <SpeedDialContext.Provider value={ctx}>\n {actions\n ? actions.map((action, index) => (\n <SpeedDialAction\n key={action.key ?? index}\n icon={action.icon}\n label={action.label}\n onClick={action.onClick}\n disabled={action.disabled}\n />\n ))\n : children}\n </SpeedDialContext.Provider>\n </div>\n\n <IconButton\n ref={fabRef}\n rounded\n variant=\"contained\"\n color={color}\n size={size}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-haspopup=\"true\"\n aria-expanded={isOpen}\n aria-controls={actionsId}\n className={styles.fab}\n onClick={() => setOpen(!isOpen)}\n >\n <span className={clsx(styles.fabIcon, !openIcon && isOpen && styles.fabIconOpen)}>\n {isOpen && openIcon != null ? renderIcon(openIcon) : renderIcon(icon)}\n </span>\n </IconButton>\n </div>\n )\n})\n"],"names":["SpeedDialContext","createContext","useSpeedDial","useContext","ICON_NAME_SET","ICON_NAMES","SpeedDialAction","forwardRef","icon","label","tooltipOpen","hideTooltip","onClick","disabled","className","props","ref","dial","iconNode","jsx","Icon","button","IconButton","clsx","styles","event","placement","jsxs","Tooltip","ACTION_SIZE","TOOLTIP_PLACEMENT","SpeedDial","ariaLabel","openIcon","direction","color","size","open","defaultOpen","onOpenChange","openOnHover","closeOnActionClick","actions","children","style","forwardedRef","rootRef","useRef","fabRef","actionsId","useId","isControlled","internal","setInternal","useState","isOpen","setOpen","next","setOpenRef","useEffect","onPointerDown","onKeyDown","_a","setRootRef","node","renderIcon","value","ctx","hoverProps","action","index"],"mappings":"qOAoBaA,EAAmBC,EAAAA,cAA4C,IAAI,EAGzE,SAASC,GAA6C,CAC3D,OAAOC,EAAAA,WAAWH,CAAgB,CACpC,udChBMI,GAAgB,IAAI,IAAYC,YAAU,EAqBnCC,EAAkBC,EAAAA,WAC7B,SACE,CAAE,KAAAC,EAAM,MAAAC,EAAO,YAAAC,EAAa,YAAAC,EAAc,GAAO,QAAAC,EAAS,SAAAC,EAAU,UAAAC,EAAW,GAAGC,CAAA,EAClFC,EACA,CACA,MAAMC,EAAOf,EAAA,EACPgB,EACJ,OAAOV,GAAS,UAAYJ,GAAc,IAAII,CAAI,EAAIW,EAAAA,IAACC,EAAAA,KAAA,CAAK,KAAMZ,CAAA,CAAkB,EAAKA,EAErFa,EACJF,EAAAA,IAACG,EAAAA,WAAA,CACC,IAAAN,EACA,QAAO,GACP,QAAQ,YACR,MAAM,UACN,MAAMC,GAAA,YAAAA,EAAM,OAAQ,KACpB,SAAAJ,EACA,aAAY,OAAOJ,GAAU,SAAWA,EAAQ,OAChD,UAAWc,EAAAA,KAAKC,EAAO,OAAQV,CAAS,EACxC,QAAUW,GAAyC,CACjDb,GAAA,MAAAA,EAAUa,GACNR,GAAA,MAAAA,EAAM,cAAcA,E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AGrD,EAEJ,SAAA,CAAAI,EAAAA,IAAC,MAAA,CACC,GAAI8B,EACJ,UAAW1B,EAAAA,KAAKC,EAAO,QAASA,EAAOU,CAAS,CAAC,EACjD,YAAWqB,EAAS,OAAS,QAE7B,SAAApC,EAAAA,IAACnB,EAAiB,SAAjB,CAA0B,MAAOmE,EAC/B,SAAAzB,EACGA,EAAQ,IAAI,CAAC2B,EAAQC,IACnBnD,EAAAA,IAACb,EAAA,CAEC,KAAM+D,EAAO,KACb,MAAOA,EAAO,MACd,QAASA,EAAO,QAChB,SAAUA,EAAO,QAAA,EAJZA,EAAO,KAAOC,CAAA,CAMtB,EACD3B,CAAA,CACN,CAAA,CAAA,EAGFxB,EAAAA,IAACG,EAAAA,WAAA,CACC,IAAK0B,EACL,QAAO,GACP,QAAQ,YACR,MAAAb,EACA,KAAAC,EACA,SAAAvB,EACA,aAAYmB,EACZ,gBAAc,OACd,gBAAeuB,EACf,gBAAeN,EACf,UAAWzB,EAAO,IAClB,QAAS,IAAMgC,EAAQ,CAACD,CAAM,EAE9B,SAAApC,EAAAA,IAAC,QAAK,UAAWI,OAAKC,EAAO,QAAS,CAACS,GAAYsB,GAAU/B,EAAO,WAAW,EAC5E,SAAA+B,GAAUtB,GAAY,KAAOgC,EAAWhC,CAAQ,EAAIgC,EAAWzD,CAAI,CAAA,CACtE,CAAA,CAAA,CACF,CAAA,CAAA,CAGN,CAAC"}
|
|
@@ -1,119 +1,119 @@
|
|
|
1
1
|
import { jsxs as b, jsx as r, Fragment as H } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as tt, useCallback as
|
|
3
|
-
import { clsx as
|
|
2
|
+
import { forwardRef as tt, useCallback as I, useState as nt, useRef as w, useEffect as L } from "react";
|
|
3
|
+
import { clsx as x } from "clsx";
|
|
4
4
|
import { a as et } from "./names-r21QPjcU.js";
|
|
5
5
|
import { I as O } from "./Icon-DaTvzLBu.js";
|
|
6
|
-
import { j as ot } from "./ConfigProvider-
|
|
7
|
-
const rt = "
|
|
6
|
+
import { j as ot } from "./ConfigProvider-DL9fylMo.js";
|
|
7
|
+
const rt = "_root_p6koa_2", ct = "_list_p6koa_5", at = "_horizontal_p6koa_11", lt = "_vertical_p6koa_24", st = "_sm_p6koa_29", it = "_md_p6koa_34", dt = "_lg_p6koa_39", ut = "_step_p6koa_47", _t = "_disabled_p6koa_64", mt = "_main_p6koa_69", pt = "_indicator_p6koa_99", ft = "_number_p6koa_125", ht = "_completed_p6koa_130", bt = "_active_p6koa_136", wt = "_error_p6koa_144", vt = "_text_p6koa_151", kt = "_label_p6koa_167", Nt = "_description_p6koa_181", gt = "_optional_p6koa_186", yt = "_connector_p6koa_193", It = "_done_p6koa_198", Lt = "_panel_p6koa_224", xt = "_stepContent_p6koa_228", e = {
|
|
8
8
|
root: rt,
|
|
9
9
|
list: ct,
|
|
10
|
-
horizontal:
|
|
11
|
-
vertical:
|
|
12
|
-
sm:
|
|
10
|
+
horizontal: at,
|
|
11
|
+
vertical: lt,
|
|
12
|
+
sm: st,
|
|
13
13
|
md: it,
|
|
14
14
|
lg: dt,
|
|
15
|
-
step:
|
|
16
|
-
disabled:
|
|
17
|
-
main:
|
|
18
|
-
indicator:
|
|
19
|
-
number:
|
|
15
|
+
step: ut,
|
|
16
|
+
disabled: _t,
|
|
17
|
+
main: mt,
|
|
18
|
+
indicator: pt,
|
|
19
|
+
number: ft,
|
|
20
20
|
completed: ht,
|
|
21
21
|
active: bt,
|
|
22
|
-
error:
|
|
23
|
-
text:
|
|
24
|
-
label:
|
|
25
|
-
description:
|
|
26
|
-
optional:
|
|
27
|
-
connector:
|
|
28
|
-
done:
|
|
29
|
-
panel:
|
|
30
|
-
stepContent:
|
|
22
|
+
error: wt,
|
|
23
|
+
text: vt,
|
|
24
|
+
label: kt,
|
|
25
|
+
description: Nt,
|
|
26
|
+
optional: gt,
|
|
27
|
+
connector: yt,
|
|
28
|
+
done: It,
|
|
29
|
+
panel: Lt,
|
|
30
|
+
stepContent: xt
|
|
31
31
|
}, Rt = new Set(et), Pt = tt(function({
|
|
32
|
-
steps:
|
|
33
|
-
activeStep:
|
|
32
|
+
steps: s,
|
|
33
|
+
activeStep: u,
|
|
34
34
|
defaultStep: R,
|
|
35
35
|
onStepChange: d,
|
|
36
36
|
queryKey: E,
|
|
37
37
|
pushHistory: z = !1,
|
|
38
|
-
orientation:
|
|
39
|
-
size:
|
|
38
|
+
orientation: _ = "horizontal",
|
|
39
|
+
size: v = "md",
|
|
40
40
|
color: $ = "primary",
|
|
41
|
-
onStepClick:
|
|
41
|
+
onStepClick: m,
|
|
42
42
|
"aria-label": T,
|
|
43
43
|
className: U,
|
|
44
44
|
style: W
|
|
45
45
|
}, q) {
|
|
46
46
|
var C;
|
|
47
|
-
const Q =
|
|
48
|
-
(t) => t != null && Number.isInteger(t) && t >= 0 && t <
|
|
49
|
-
[
|
|
50
|
-
),
|
|
51
|
-
if (!
|
|
52
|
-
const t = new URLSearchParams(window.location.search).get(
|
|
47
|
+
const Q = _ === "vertical", F = m != null, D = ot(), a = E === !0 ? D : E || void 0, p = I(
|
|
48
|
+
(t) => t != null && Number.isInteger(t) && t >= 0 && t < s.length && !s[t].disabled,
|
|
49
|
+
[s]
|
|
50
|
+
), k = I(() => {
|
|
51
|
+
if (!a || typeof window > "u") return null;
|
|
52
|
+
const t = new URLSearchParams(window.location.search).get(a);
|
|
53
53
|
return t != null && /^\d+$/.test(t) ? Number(t) - 1 : null;
|
|
54
|
-
}, [
|
|
55
|
-
|
|
54
|
+
}, [a]), G = Math.max(
|
|
55
|
+
s.findIndex((t) => !t.disabled),
|
|
56
56
|
0
|
|
57
57
|
), [J, j] = nt(() => {
|
|
58
|
-
const t =
|
|
59
|
-
return
|
|
60
|
-
}), A =
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
const
|
|
58
|
+
const t = k();
|
|
59
|
+
return p(t) ? t : p(R) ? R : G;
|
|
60
|
+
}), A = u !== void 0, o = A ? u : J, N = w(o);
|
|
61
|
+
N.current = o;
|
|
62
|
+
const f = w(d);
|
|
63
|
+
f.current = d;
|
|
64
|
+
const g = w(!1), M = I(
|
|
65
65
|
(t, n) => {
|
|
66
|
-
if (!
|
|
67
|
-
const c = new URLSearchParams(window.location.search),
|
|
68
|
-
if (c.get(
|
|
69
|
-
c.set(
|
|
66
|
+
if (!a || typeof window > "u") return;
|
|
67
|
+
const c = new URLSearchParams(window.location.search), l = String(t + 1);
|
|
68
|
+
if (c.get(a) === l) return;
|
|
69
|
+
c.set(a, l);
|
|
70
70
|
const i = `${window.location.pathname}?${c.toString()}${window.location.hash}`;
|
|
71
71
|
window.history[n ? "pushState" : "replaceState"](window.history.state, "", i);
|
|
72
72
|
},
|
|
73
|
-
[
|
|
73
|
+
[a]
|
|
74
74
|
), S = (t) => {
|
|
75
|
-
t !==
|
|
75
|
+
t !== N.current && (g.current = !0, A || j(t), d == null || d(t));
|
|
76
76
|
};
|
|
77
|
-
|
|
78
|
-
if (!
|
|
79
|
-
const t =
|
|
80
|
-
|
|
81
|
-
}, [
|
|
82
|
-
if (!
|
|
77
|
+
L(() => {
|
|
78
|
+
if (!a || typeof window > "u" || !Number.isInteger(o) || o < 0 || o >= s.length) return;
|
|
79
|
+
const t = g.current && z;
|
|
80
|
+
g.current = !1, M(o, t);
|
|
81
|
+
}, [a, o, z, M, s.length]), L(() => {
|
|
82
|
+
if (!a || typeof window > "u") return;
|
|
83
83
|
const t = () => {
|
|
84
84
|
var c;
|
|
85
|
-
const n =
|
|
86
|
-
|
|
85
|
+
const n = k();
|
|
86
|
+
p(n) && n !== N.current && (u === void 0 && j(n), (c = f.current) == null || c.call(f, n));
|
|
87
87
|
};
|
|
88
88
|
return window.addEventListener("popstate", t), () => window.removeEventListener("popstate", t);
|
|
89
|
-
}, [
|
|
90
|
-
const P = (C =
|
|
91
|
-
|
|
92
|
-
if (
|
|
89
|
+
}, [a, k, p, u]);
|
|
90
|
+
const P = (C = s[o]) == null ? void 0 : C.content, B = w(null);
|
|
91
|
+
L(() => {
|
|
92
|
+
if (_ === "vertical") return;
|
|
93
93
|
const t = B.current, n = t == null ? void 0 : t.children[o];
|
|
94
94
|
if (!t || !n) return;
|
|
95
|
-
const c = t.getBoundingClientRect(),
|
|
95
|
+
const c = t.getBoundingClientRect(), l = n.getBoundingClientRect(), i = l.left - c.left + t.scrollLeft, h = i + l.width;
|
|
96
96
|
i < t.scrollLeft ? t.scrollLeft = i : h > t.scrollLeft + t.clientWidth && (t.scrollLeft = h - t.clientWidth);
|
|
97
|
-
}, [o,
|
|
98
|
-
const V = (t) => typeof t == "string" && Rt.has(t) ? /* @__PURE__ */ r(O, { name: t, size:
|
|
97
|
+
}, [o, _]);
|
|
98
|
+
const V = (t) => typeof t == "string" && Rt.has(t) ? /* @__PURE__ */ r(O, { name: t, size: v }) : t;
|
|
99
99
|
return /* @__PURE__ */ b(
|
|
100
100
|
"div",
|
|
101
101
|
{
|
|
102
102
|
ref: q,
|
|
103
|
-
className:
|
|
103
|
+
className: x(e.root, e[_], e[v], U),
|
|
104
104
|
style: {
|
|
105
105
|
"--tz-btn-rgb": `var(--tz-color-${$}-rgb)`,
|
|
106
106
|
"--tz-btn-on": `var(--tz-color-${$}-contrast, #fff)`,
|
|
107
107
|
...W
|
|
108
108
|
},
|
|
109
109
|
children: [
|
|
110
|
-
/* @__PURE__ */ r("ol", { ref: B, "aria-label": T, className: e.list, children:
|
|
111
|
-
const c = !!t.error,
|
|
110
|
+
/* @__PURE__ */ r("ol", { ref: B, "aria-label": T, className: e.list, children: s.map((t, n) => {
|
|
111
|
+
const c = !!t.error, l = !c && (t.completed || n < o), i = !c && !l && n === o, h = c ? "error" : l ? "completed" : i ? "active" : "upcoming", X = n === s.length - 1, y = V(t.icon), Y = y ?? (l ? /* @__PURE__ */ r(O, { name: "Check", size: v }) : /* @__PURE__ */ r("span", { className: e.number, children: n + 1 })), Z = t.label != null || t.description != null || t.optional != null, K = /* @__PURE__ */ b(H, { children: [
|
|
112
112
|
/* @__PURE__ */ r(
|
|
113
113
|
"span",
|
|
114
114
|
{
|
|
115
115
|
className: e.indicator,
|
|
116
|
-
"aria-hidden":
|
|
116
|
+
"aria-hidden": y == null && !l ? void 0 : !0,
|
|
117
117
|
children: Y
|
|
118
118
|
}
|
|
119
119
|
),
|
|
@@ -126,7 +126,7 @@ const rt = "_root_1xfvk_2", ct = "_list_1xfvk_5", lt = "_horizontal_1xfvk_11", s
|
|
|
126
126
|
return /* @__PURE__ */ b(
|
|
127
127
|
"li",
|
|
128
128
|
{
|
|
129
|
-
className:
|
|
129
|
+
className: x(e.step, e[h], t.disabled && e.disabled),
|
|
130
130
|
children: [
|
|
131
131
|
F ? /* @__PURE__ */ r(
|
|
132
132
|
"button",
|
|
@@ -136,7 +136,7 @@ const rt = "_root_1xfvk_2", ct = "_list_1xfvk_5", lt = "_horizontal_1xfvk_11", s
|
|
|
136
136
|
disabled: t.disabled,
|
|
137
137
|
"aria-current": i ? "step" : void 0,
|
|
138
138
|
onClick: () => {
|
|
139
|
-
|
|
139
|
+
m == null || m(n), S(n);
|
|
140
140
|
},
|
|
141
141
|
children: K
|
|
142
142
|
}
|
|
@@ -144,7 +144,7 @@ const rt = "_root_1xfvk_2", ct = "_list_1xfvk_5", lt = "_horizontal_1xfvk_11", s
|
|
|
144
144
|
!X && /* @__PURE__ */ r(
|
|
145
145
|
"span",
|
|
146
146
|
{
|
|
147
|
-
className:
|
|
147
|
+
className: x(e.connector, n < o && e.done),
|
|
148
148
|
"aria-hidden": "true"
|
|
149
149
|
}
|
|
150
150
|
),
|
|
@@ -162,4 +162,4 @@ const rt = "_root_1xfvk_2", ct = "_list_1xfvk_5", lt = "_horizontal_1xfvk_11", s
|
|
|
162
162
|
export {
|
|
163
163
|
Pt as S
|
|
164
164
|
};
|
|
165
|
-
//# sourceMappingURL=Stepper-
|
|
165
|
+
//# sourceMappingURL=Stepper-B_e_PGZE.js.map
|