@expressivecss/expressive 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1502 -1
- package/README.md +9 -8
- package/dist/css/expressive.css +19247 -11923
- package/dist/css/expressive.css.map +1 -1
- package/dist/css/expressive.min.css +1 -1
- package/dist/css/expressive.min.css.map +1 -1
- package/dist/fonts/LICENSE-noto-sans-arabic +93 -0
- package/dist/fonts/LICENSE-noto-sans-hebrew +93 -0
- package/dist/fonts/LICENSE-noto-sans-thai +93 -0
- package/dist/fonts/material-symbols-outlined.woff2 +0 -0
- package/dist/fonts/material-symbols-rounded.woff2 +0 -0
- package/dist/fonts/material-symbols-sharp.woff2 +0 -0
- package/dist/fonts/noto-sans-arabic-arabic-400.woff2 +0 -0
- package/dist/fonts/noto-sans-arabic-arabic-500.woff2 +0 -0
- package/dist/fonts/noto-sans-arabic-arabic-700.woff2 +0 -0
- package/dist/fonts/noto-sans-cyrillic-400.woff2 +0 -0
- package/dist/fonts/noto-sans-cyrillic-500.woff2 +0 -0
- package/dist/fonts/noto-sans-cyrillic-700.woff2 +0 -0
- package/dist/fonts/noto-sans-cyrillic-ext-400.woff2 +0 -0
- package/dist/fonts/noto-sans-cyrillic-ext-500.woff2 +0 -0
- package/dist/fonts/noto-sans-cyrillic-ext-700.woff2 +0 -0
- package/dist/fonts/noto-sans-devanagari-400.woff2 +0 -0
- package/dist/fonts/noto-sans-devanagari-500.woff2 +0 -0
- package/dist/fonts/noto-sans-devanagari-700.woff2 +0 -0
- package/dist/fonts/noto-sans-greek-400.woff2 +0 -0
- package/dist/fonts/noto-sans-greek-500.woff2 +0 -0
- package/dist/fonts/noto-sans-greek-700.woff2 +0 -0
- package/dist/fonts/noto-sans-greek-ext-400.woff2 +0 -0
- package/dist/fonts/noto-sans-greek-ext-500.woff2 +0 -0
- package/dist/fonts/noto-sans-greek-ext-700.woff2 +0 -0
- package/dist/fonts/noto-sans-hebrew-hebrew-400.woff2 +0 -0
- package/dist/fonts/noto-sans-hebrew-hebrew-500.woff2 +0 -0
- package/dist/fonts/noto-sans-hebrew-hebrew-700.woff2 +0 -0
- package/dist/fonts/noto-sans-latin-700.woff2 +0 -0
- package/dist/fonts/noto-sans-latin-ext-400.woff2 +0 -0
- package/dist/fonts/noto-sans-latin-ext-500.woff2 +0 -0
- package/dist/fonts/noto-sans-latin-ext-700.woff2 +0 -0
- package/dist/fonts/noto-sans-thai-thai-400.woff2 +0 -0
- package/dist/fonts/noto-sans-thai-thai-500.woff2 +0 -0
- package/dist/fonts/noto-sans-thai-thai-700.woff2 +0 -0
- package/dist/fonts/noto-sans-vietnamese-400.woff2 +0 -0
- package/dist/fonts/noto-sans-vietnamese-500.woff2 +0 -0
- package/dist/fonts/noto-sans-vietnamese-700.woff2 +0 -0
- package/dist/fonts/roboto-cyrillic-400.woff2 +0 -0
- package/dist/fonts/roboto-cyrillic-500.woff2 +0 -0
- package/dist/fonts/roboto-cyrillic-700.woff2 +0 -0
- package/dist/fonts/roboto-cyrillic-ext-400.woff2 +0 -0
- package/dist/fonts/roboto-cyrillic-ext-500.woff2 +0 -0
- package/dist/fonts/roboto-cyrillic-ext-700.woff2 +0 -0
- package/dist/fonts/roboto-greek-400.woff2 +0 -0
- package/dist/fonts/roboto-greek-500.woff2 +0 -0
- package/dist/fonts/roboto-greek-700.woff2 +0 -0
- package/dist/fonts/roboto-greek-ext-400.woff2 +0 -0
- package/dist/fonts/roboto-greek-ext-500.woff2 +0 -0
- package/dist/fonts/roboto-greek-ext-700.woff2 +0 -0
- package/dist/fonts/roboto-latin-700.woff2 +0 -0
- package/dist/fonts/roboto-latin-ext-400.woff2 +0 -0
- package/dist/fonts/roboto-latin-ext-500.woff2 +0 -0
- package/dist/fonts/roboto-latin-ext-700.woff2 +0 -0
- package/dist/fonts/roboto-vietnamese-400.woff2 +0 -0
- package/dist/fonts/roboto-vietnamese-500.woff2 +0 -0
- package/dist/fonts/roboto-vietnamese-700.woff2 +0 -0
- package/dist/js/chunks/chunk-2CS6TITK.mjs +219 -0
- package/dist/js/chunks/chunk-2CS6TITK.mjs.map +7 -0
- package/dist/js/chunks/chunk-2RLBDFH4.mjs +108 -0
- package/dist/js/chunks/chunk-2RLBDFH4.mjs.map +7 -0
- package/dist/js/chunks/chunk-3L3QIYLC.mjs +85 -0
- package/dist/js/chunks/chunk-3L3QIYLC.mjs.map +7 -0
- package/dist/js/chunks/chunk-4EWGD4V2.mjs +75 -0
- package/dist/js/chunks/chunk-4EWGD4V2.mjs.map +7 -0
- package/dist/js/chunks/chunk-4IKVPCSU.mjs +7 -0
- package/dist/js/chunks/chunk-4IKVPCSU.mjs.map +7 -0
- package/dist/js/chunks/chunk-4PIXLDNJ.mjs +127 -0
- package/dist/js/chunks/chunk-4PIXLDNJ.mjs.map +7 -0
- package/dist/js/chunks/{chunk-KVJAVDBC.mjs → chunk-4QUCNFSD.mjs} +64 -113
- package/dist/js/chunks/chunk-4QUCNFSD.mjs.map +7 -0
- package/dist/js/chunks/{chunk-UETTGDLI.mjs → chunk-4TRZ2AER.mjs} +35 -41
- package/dist/js/chunks/chunk-4TRZ2AER.mjs.map +7 -0
- package/dist/js/chunks/{chunk-C6CHEWYP.mjs → chunk-5KIHWJI2.mjs} +40 -26
- package/dist/js/chunks/chunk-5KIHWJI2.mjs.map +7 -0
- package/dist/js/chunks/{chunk-L27Q6ZMI.mjs → chunk-67ZPPKXS.mjs} +20 -33
- package/dist/js/chunks/chunk-67ZPPKXS.mjs.map +7 -0
- package/dist/js/chunks/{chunk-XAEAEHIX.mjs → chunk-6FSEUFVW.mjs} +39 -26
- package/dist/js/chunks/chunk-6FSEUFVW.mjs.map +7 -0
- package/dist/js/chunks/chunk-752ADW4M.mjs +225 -0
- package/dist/js/chunks/chunk-752ADW4M.mjs.map +7 -0
- package/dist/js/chunks/{chunk-CK2XCICY.mjs → chunk-75E5EDJF.mjs} +3 -11
- package/dist/js/chunks/chunk-75E5EDJF.mjs.map +7 -0
- package/dist/js/chunks/{chunk-KHXZ2A4K.mjs → chunk-7NLUI3RR.mjs} +139 -66
- package/dist/js/chunks/chunk-7NLUI3RR.mjs.map +7 -0
- package/dist/js/chunks/chunk-7W7TV6NY.mjs +108 -0
- package/dist/js/chunks/chunk-7W7TV6NY.mjs.map +7 -0
- package/dist/js/chunks/chunk-7YQBHTK3.mjs +225 -0
- package/dist/js/chunks/chunk-7YQBHTK3.mjs.map +7 -0
- package/dist/js/chunks/chunk-7YZ5CN3V.mjs +33 -0
- package/dist/js/chunks/chunk-7YZ5CN3V.mjs.map +7 -0
- package/dist/js/chunks/chunk-AI73GJKG.mjs +28 -0
- package/dist/js/chunks/chunk-AI73GJKG.mjs.map +7 -0
- package/dist/js/chunks/{chunk-LQWUDNHZ.mjs → chunk-ANKFWNWT.mjs} +21 -45
- package/dist/js/chunks/chunk-ANKFWNWT.mjs.map +7 -0
- package/dist/js/chunks/{chunk-5CEAOLUA.mjs → chunk-B7DQFHA5.mjs} +30 -47
- package/dist/js/chunks/chunk-B7DQFHA5.mjs.map +7 -0
- package/dist/js/chunks/chunk-BIGU5RCJ.mjs +153 -0
- package/dist/js/chunks/chunk-BIGU5RCJ.mjs.map +7 -0
- package/dist/js/chunks/{chunk-VGNYF6FB.mjs → chunk-BPF3I2MN.mjs} +109 -24
- package/dist/js/chunks/chunk-BPF3I2MN.mjs.map +7 -0
- package/dist/js/chunks/chunk-CMGXGYUC.mjs +74 -0
- package/dist/js/chunks/chunk-CMGXGYUC.mjs.map +7 -0
- package/dist/js/chunks/{chunk-NUHMOAOY.mjs → chunk-CSYWKEK3.mjs} +310 -196
- package/dist/js/chunks/chunk-CSYWKEK3.mjs.map +7 -0
- package/dist/js/chunks/chunk-CZSQHXEV.mjs +227 -0
- package/dist/js/chunks/chunk-CZSQHXEV.mjs.map +7 -0
- package/dist/js/chunks/chunk-DZYVU75J.mjs +121 -0
- package/dist/js/chunks/chunk-DZYVU75J.mjs.map +7 -0
- package/dist/js/chunks/{chunk-74MXKKLN.mjs → chunk-EC26RU2D.mjs} +11 -29
- package/dist/js/chunks/chunk-EC26RU2D.mjs.map +7 -0
- package/dist/js/chunks/{chunk-WDK4T63U.mjs → chunk-EVCVFEV3.mjs} +235 -146
- package/dist/js/chunks/chunk-EVCVFEV3.mjs.map +7 -0
- package/dist/js/chunks/chunk-FCNF4GRJ.mjs +445 -0
- package/dist/js/chunks/chunk-FCNF4GRJ.mjs.map +7 -0
- package/dist/js/chunks/chunk-GCWWEZKO.mjs +342 -0
- package/dist/js/chunks/chunk-GCWWEZKO.mjs.map +7 -0
- package/dist/js/chunks/chunk-GNRSYMVH.mjs +1 -0
- package/dist/js/chunks/chunk-GVZQH2H5.mjs +54 -0
- package/dist/js/chunks/chunk-GVZQH2H5.mjs.map +7 -0
- package/dist/js/chunks/chunk-GWZ76SR4.mjs +435 -0
- package/dist/js/chunks/chunk-GWZ76SR4.mjs.map +7 -0
- package/dist/js/chunks/{chunk-PDG64UHF.mjs → chunk-ILDRRG7T.mjs} +21 -23
- package/dist/js/chunks/chunk-ILDRRG7T.mjs.map +7 -0
- package/dist/js/chunks/chunk-INLZWHLY.mjs +80 -0
- package/dist/js/chunks/chunk-INLZWHLY.mjs.map +7 -0
- package/dist/js/chunks/chunk-JUKBBN6P.mjs +175 -0
- package/dist/js/chunks/chunk-JUKBBN6P.mjs.map +7 -0
- package/dist/js/chunks/chunk-KYIEG4U3.mjs +730 -0
- package/dist/js/chunks/chunk-KYIEG4U3.mjs.map +7 -0
- package/dist/js/chunks/{chunk-BGZLF6JZ.mjs → chunk-KZPSAXIU.mjs} +142 -32
- package/dist/js/chunks/chunk-KZPSAXIU.mjs.map +7 -0
- package/dist/js/chunks/chunk-LDXCC2L3.mjs +438 -0
- package/dist/js/chunks/chunk-LDXCC2L3.mjs.map +7 -0
- package/dist/js/chunks/chunk-NAC72P7R.mjs +137 -0
- package/dist/js/chunks/chunk-NAC72P7R.mjs.map +7 -0
- package/dist/js/chunks/chunk-NBJAUGPP.mjs +244 -0
- package/dist/js/chunks/chunk-NBJAUGPP.mjs.map +7 -0
- package/dist/js/chunks/chunk-NNHVANQA.mjs +113 -0
- package/dist/js/chunks/chunk-NNHVANQA.mjs.map +7 -0
- package/dist/js/chunks/chunk-NVQ5EHCU.mjs +376 -0
- package/dist/js/chunks/chunk-NVQ5EHCU.mjs.map +7 -0
- package/dist/js/chunks/{chunk-DXGRXYYL.mjs → chunk-OP43LLIC.mjs} +28 -45
- package/dist/js/chunks/chunk-OP43LLIC.mjs.map +7 -0
- package/dist/js/chunks/chunk-OUCHKSAW.mjs +63 -0
- package/dist/js/chunks/chunk-OUCHKSAW.mjs.map +7 -0
- package/dist/js/chunks/{chunk-TSZYSW7F.mjs → chunk-OYNUDOHR.mjs} +19 -47
- package/dist/js/chunks/chunk-OYNUDOHR.mjs.map +7 -0
- package/dist/js/chunks/{chunk-UAZSDUVP.mjs → chunk-P6DRQ6KS.mjs} +36 -30
- package/dist/js/chunks/chunk-P6DRQ6KS.mjs.map +7 -0
- package/dist/js/chunks/chunk-PA7NU5AK.mjs +99 -0
- package/dist/js/chunks/chunk-PA7NU5AK.mjs.map +7 -0
- package/dist/js/chunks/chunk-QACZ6TUP.mjs +224 -0
- package/dist/js/chunks/chunk-QACZ6TUP.mjs.map +7 -0
- package/dist/js/chunks/{chunk-GJL6GCIU.mjs → chunk-QXKWVHBD.mjs} +265 -161
- package/dist/js/chunks/chunk-QXKWVHBD.mjs.map +7 -0
- package/dist/js/chunks/{chunk-X4ISMKE2.mjs → chunk-ROH2HDB4.mjs} +7 -6
- package/dist/js/chunks/chunk-ROH2HDB4.mjs.map +7 -0
- package/dist/js/chunks/chunk-S23RJ3XY.mjs +86 -0
- package/dist/js/chunks/chunk-S23RJ3XY.mjs.map +7 -0
- package/dist/js/chunks/{chunk-SMY7GJSS.mjs → chunk-SPPHF7YZ.mjs} +36 -29
- package/dist/js/chunks/chunk-SPPHF7YZ.mjs.map +7 -0
- package/dist/js/chunks/chunk-T3BNSRP3.mjs +152 -0
- package/dist/js/chunks/chunk-T3BNSRP3.mjs.map +7 -0
- package/dist/js/chunks/chunk-TFABTUAZ.mjs +108 -0
- package/dist/js/chunks/chunk-TFABTUAZ.mjs.map +7 -0
- package/dist/js/chunks/chunk-U4B3VHFS.mjs +507 -0
- package/dist/js/chunks/chunk-U4B3VHFS.mjs.map +7 -0
- package/dist/js/chunks/chunk-UGJHCHXG.mjs +341 -0
- package/dist/js/chunks/chunk-UGJHCHXG.mjs.map +7 -0
- package/dist/js/chunks/chunk-VFV75DHF.mjs +70 -0
- package/dist/js/chunks/chunk-VFV75DHF.mjs.map +7 -0
- package/dist/js/chunks/{chunk-ZX6M7SWO.mjs → chunk-VGY4M57S.mjs} +266 -120
- package/dist/js/chunks/chunk-VGY4M57S.mjs.map +7 -0
- package/dist/js/chunks/chunk-VH4BMAZS.mjs +167 -0
- package/dist/js/chunks/chunk-VH4BMAZS.mjs.map +7 -0
- package/dist/js/chunks/chunk-VJVQIXHC.mjs +123 -0
- package/dist/js/chunks/chunk-VJVQIXHC.mjs.map +7 -0
- package/dist/js/chunks/{chunk-SFI2U4YW.mjs → chunk-VMY55K2X.mjs} +76 -109
- package/dist/js/chunks/chunk-VMY55K2X.mjs.map +7 -0
- package/dist/js/chunks/{chunk-KUFHW3DS.mjs → chunk-VR3L2WN5.mjs} +11 -17
- package/dist/js/chunks/chunk-VR3L2WN5.mjs.map +7 -0
- package/dist/js/chunks/chunk-W6FAL3TI.mjs +38 -0
- package/dist/js/chunks/chunk-W6FAL3TI.mjs.map +7 -0
- package/dist/js/chunks/chunk-WU7XJ4RR.mjs +450 -0
- package/dist/js/chunks/chunk-WU7XJ4RR.mjs.map +7 -0
- package/dist/js/chunks/chunk-X7SDA2J5.mjs +116 -0
- package/dist/js/chunks/chunk-X7SDA2J5.mjs.map +7 -0
- package/dist/js/chunks/chunk-Y6H2X7ZC.mjs +209 -0
- package/dist/js/chunks/chunk-Y6H2X7ZC.mjs.map +7 -0
- package/dist/js/chunks/chunk-Y6TLRA3U.mjs +129 -0
- package/dist/js/chunks/chunk-Y6TLRA3U.mjs.map +7 -0
- package/dist/js/chunks/chunk-Z4GICXR2.mjs +190 -0
- package/dist/js/chunks/chunk-Z4GICXR2.mjs.map +7 -0
- package/dist/js/chunks/chunk-Z4OARDZ7.mjs +442 -0
- package/dist/js/chunks/chunk-Z4OARDZ7.mjs.map +7 -0
- package/dist/js/chunks/{chunk-FM5CZOUB.mjs → chunk-ZJNLAGY5.mjs} +19 -30
- package/dist/js/chunks/chunk-ZJNLAGY5.mjs.map +7 -0
- package/dist/js/chunks/chunk-ZKWUWBUB.mjs +81 -0
- package/dist/js/chunks/chunk-ZKWUWBUB.mjs.map +7 -0
- package/dist/js/chunks/chunk-ZM3XBHWV.mjs +746 -0
- package/dist/js/chunks/chunk-ZM3XBHWV.mjs.map +7 -0
- package/dist/js/chunks/chunk-ZO6ZLHFF.mjs +48 -0
- package/dist/js/chunks/chunk-ZO6ZLHFF.mjs.map +7 -0
- package/dist/js/chunks/chunk-ZVLOUDIJ.mjs +251 -0
- package/dist/js/chunks/chunk-ZVLOUDIJ.mjs.map +7 -0
- package/dist/js/expressive.cjs +10613 -4327
- package/dist/js/expressive.cjs.map +4 -4
- package/dist/js/expressive.js +10613 -4327
- package/dist/js/expressive.js.map +4 -4
- package/dist/js/expressive.min.js +23 -22
- package/dist/js/expressive.min.js.map +4 -4
- package/dist/js/expressive.mjs +182 -71
- package/dist/js/expressive.mjs.map +2 -2
- package/dist/js/internal/behaviors/bottomSheets.mjs +4 -3
- package/dist/js/internal/behaviors/copy.mjs +9 -0
- package/dist/js/internal/behaviors/copy.mjs.map +7 -0
- package/dist/js/internal/behaviors/dataTables.mjs +10 -0
- package/dist/js/internal/behaviors/dataTables.mjs.map +7 -0
- package/dist/js/internal/behaviors/dialogs.mjs +2 -2
- package/dist/js/internal/behaviors/forms.mjs +2 -2
- package/dist/js/internal/behaviors/imageCompare.mjs +8 -0
- package/dist/js/internal/behaviors/imageCompare.mjs.map +7 -0
- package/dist/js/internal/behaviors/lists.mjs +8 -0
- package/dist/js/internal/behaviors/lists.mjs.map +7 -0
- package/dist/js/internal/behaviors/paneResize.mjs +8 -0
- package/dist/js/internal/behaviors/paneResize.mjs.map +7 -0
- package/dist/js/internal/behaviors/sheetDrag.mjs +7 -2
- package/dist/js/internal/behaviors/sideSheets.mjs +4 -3
- package/dist/js/internal/behaviors/sortable.mjs +8 -0
- package/dist/js/internal/behaviors/sortable.mjs.map +7 -0
- package/dist/js/internal/behaviors/theme.mjs +8 -0
- package/dist/js/internal/behaviors/theme.mjs.map +7 -0
- package/dist/js/internal/behaviors/tour.mjs +8 -0
- package/dist/js/internal/behaviors/tour.mjs.map +7 -0
- package/dist/js/internal/behaviors/transferList.mjs +8 -0
- package/dist/js/internal/behaviors/transferList.mjs.map +7 -0
- package/dist/js/internal/components/appBar.mjs +3 -2
- package/dist/js/internal/components/autocomplete.mjs +4 -4
- package/dist/js/internal/components/backToTop.mjs +9 -0
- package/dist/js/internal/components/backToTop.mjs.map +7 -0
- package/dist/js/internal/components/barChart.mjs +5 -4
- package/dist/js/internal/components/buttonGroup.mjs +3 -2
- package/dist/js/internal/components/buttons.mjs +3 -3
- package/dist/js/internal/components/cards.mjs +3 -3
- package/dist/js/internal/components/carousel.mjs +3 -3
- package/dist/js/internal/components/cascader.mjs +10 -0
- package/dist/js/internal/components/cascader.mjs.map +7 -0
- package/dist/js/internal/components/characterCounter.mjs +3 -2
- package/dist/js/internal/components/chips.mjs +6 -5
- package/dist/js/internal/components/colorPicker.mjs +9 -0
- package/dist/js/internal/components/colorPicker.mjs.map +7 -0
- package/dist/js/internal/components/columnChart.mjs +4 -3
- package/dist/js/internal/components/commandPalette.mjs +3 -3
- package/dist/js/internal/components/confetti.mjs +3 -2
- package/dist/js/internal/components/currencyInput.mjs +9 -0
- package/dist/js/internal/components/currencyInput.mjs.map +7 -0
- package/dist/js/internal/components/datepicker.mjs +11 -8
- package/dist/js/internal/components/expandingCard.mjs +3 -3
- package/dist/js/internal/components/funnelChart.mjs +10 -0
- package/dist/js/internal/components/funnelChart.mjs.map +7 -0
- package/dist/js/internal/components/heatmapChart.mjs +4 -3
- package/dist/js/internal/components/hoverCard.mjs +9 -0
- package/dist/js/internal/components/hoverCard.mjs.map +7 -0
- package/dist/js/internal/components/index.mjs +131 -66
- package/dist/js/internal/components/inputMask.mjs +9 -0
- package/dist/js/internal/components/inputMask.mjs.map +7 -0
- package/dist/js/internal/components/keypad.mjs +3 -3
- package/dist/js/internal/components/lightbox.mjs +3 -3
- package/dist/js/internal/components/lineChart.mjs +25 -4
- package/dist/js/internal/components/loadingOverlay.mjs +9 -0
- package/dist/js/internal/components/loadingOverlay.mjs.map +7 -0
- package/dist/js/internal/components/mapView.mjs +3 -3
- package/dist/js/internal/components/menu.mjs +3 -3
- package/dist/js/internal/components/menubar.mjs +10 -0
- package/dist/js/internal/components/menubar.mjs.map +7 -0
- package/dist/js/internal/components/messageScroller.mjs +3 -3
- package/dist/js/internal/components/mixedChart.mjs +5 -4
- package/dist/js/internal/components/navigationRail.mjs +3 -2
- package/dist/js/internal/components/particles.mjs +3 -2
- package/dist/js/internal/components/pieChart.mjs +4 -3
- package/dist/js/internal/components/pullToRefresh.mjs +9 -0
- package/dist/js/internal/components/pullToRefresh.mjs.map +7 -0
- package/dist/js/internal/components/questionnaire.mjs +3 -3
- package/dist/js/internal/components/radarChart.mjs +4 -3
- package/dist/js/internal/components/radialChart.mjs +4 -3
- package/dist/js/internal/components/registry.mjs +59 -41
- package/dist/js/internal/components/richTextEditor.mjs +3 -3
- package/dist/js/internal/components/sankeyChart.mjs +10 -0
- package/dist/js/internal/components/sankeyChart.mjs.map +7 -0
- package/dist/js/internal/components/scatterChart.mjs +10 -0
- package/dist/js/internal/components/scatterChart.mjs.map +7 -0
- package/dist/js/internal/components/scrollspy.mjs +3 -2
- package/dist/js/internal/components/select.mjs +4 -4
- package/dist/js/internal/components/showMore.mjs +9 -0
- package/dist/js/internal/components/showMore.mjs.map +7 -0
- package/dist/js/internal/components/slider.mjs +3 -3
- package/dist/js/internal/components/snackbar.mjs +2 -2
- package/dist/js/internal/components/swipeActions.mjs +9 -0
- package/dist/js/internal/components/swipeActions.mjs.map +7 -0
- package/dist/js/internal/components/tabs.mjs +3 -4
- package/dist/js/internal/components/timepicker.mjs +5 -4
- package/dist/js/internal/components/tooltip.mjs +3 -3
- package/dist/js/internal/components/treeSelect.mjs +13 -0
- package/dist/js/internal/components/treeSelect.mjs.map +7 -0
- package/dist/js/internal/components/treemapChart.mjs +10 -0
- package/dist/js/internal/components/treemapChart.mjs.map +7 -0
- package/dist/js/internal/core/component.mjs +2 -1
- package/dist/js/internal/core/formControl.mjs +12 -0
- package/dist/js/internal/core/formControl.mjs.map +7 -0
- package/dist/js/internal/core/spring.mjs +11 -0
- package/dist/js/internal/core/spring.mjs.map +7 -0
- package/dist/js/internal/core/utils.mjs +11 -3
- package/dist/js/internal/plugins/dockedDisplayPlugin.mjs +2 -2
- package/dist/js/internal/plugins/modalDisplayPlugin.mjs +13 -0
- package/dist/js/internal/plugins/modalDisplayPlugin.mjs.map +7 -0
- package/dist/js/modular.mjs +173 -71
- package/dist/types/behaviors/bottomSheets.d.ts +19 -3
- package/dist/types/behaviors/copy.d.ts +18 -0
- package/dist/types/behaviors/dataTables.d.ts +129 -0
- package/dist/types/behaviors/dialogs.d.ts +27 -1
- package/dist/types/behaviors/forms.d.ts +68 -2
- package/dist/types/behaviors/imageCompare.d.ts +12 -0
- package/dist/types/behaviors/lists.d.ts +12 -0
- package/dist/types/behaviors/paneResize.d.ts +29 -0
- package/dist/types/behaviors/sheetDrag.d.ts +18 -0
- package/dist/types/behaviors/sideSheets.d.ts +1 -1
- package/dist/types/behaviors/sortable.d.ts +28 -0
- package/dist/types/behaviors/theme.d.ts +22 -0
- package/dist/types/behaviors/tour.d.ts +36 -0
- package/dist/types/behaviors/transferList.d.ts +51 -0
- package/dist/types/components/appBar.d.ts +5 -6
- package/dist/types/components/autocomplete.d.ts +91 -17
- package/dist/types/components/backToTop.d.ts +36 -0
- package/dist/types/components/barChart.d.ts +3 -6
- package/dist/types/components/buttonGroup.d.ts +2 -4
- package/dist/types/components/buttons.d.ts +5 -5
- package/dist/types/components/cards.d.ts +3 -16
- package/dist/types/components/carousel.d.ts +9 -15
- package/dist/types/components/cascader.d.ts +130 -0
- package/dist/types/components/characterCounter.d.ts +2 -15
- package/dist/types/components/chips.d.ts +65 -19
- package/dist/types/components/colorPicker.d.ts +42 -0
- package/dist/types/components/columnChart.d.ts +23 -10
- package/dist/types/components/commandPalette.d.ts +11 -16
- package/dist/types/components/confetti.d.ts +2 -4
- package/dist/types/components/currencyInput.d.ts +59 -0
- package/dist/types/components/datepicker.d.ts +56 -32
- package/dist/types/components/expandingCard.d.ts +4 -6
- package/dist/types/components/funnelChart.d.ts +38 -0
- package/dist/types/components/heatmapChart.d.ts +39 -8
- package/dist/types/components/hoverCard.d.ts +58 -0
- package/dist/types/components/index.d.ts +16 -1
- package/dist/types/components/inputMask.d.ts +30 -0
- package/dist/types/components/keypad.d.ts +38 -6
- package/dist/types/components/lightbox.d.ts +14 -20
- package/dist/types/components/lineChart.d.ts +172 -10
- package/dist/types/components/loadingOverlay.d.ts +42 -0
- package/dist/types/components/mapView.d.ts +26 -17
- package/dist/types/components/menu.d.ts +60 -22
- package/dist/types/components/menubar.d.ts +37 -0
- package/dist/types/components/messageScroller.d.ts +2 -14
- package/dist/types/components/mixedChart.d.ts +15 -6
- package/dist/types/components/navigationRail.d.ts +16 -5
- package/dist/types/components/particles.d.ts +8 -4
- package/dist/types/components/pieChart.d.ts +32 -7
- package/dist/types/components/pullToRefresh.d.ts +80 -0
- package/dist/types/components/questionnaire.d.ts +58 -16
- package/dist/types/components/radarChart.d.ts +10 -6
- package/dist/types/components/radialChart.d.ts +58 -7
- package/dist/types/components/registry.d.ts +73 -3
- package/dist/types/components/richTextEditor.d.ts +6 -14
- package/dist/types/components/sankeyChart.d.ts +72 -0
- package/dist/types/components/scatterChart.d.ts +102 -0
- package/dist/types/components/scrollspy.d.ts +3 -5
- package/dist/types/components/select.d.ts +43 -30
- package/dist/types/components/showMore.d.ts +51 -0
- package/dist/types/components/slider.d.ts +3 -15
- package/dist/types/components/snackbar.d.ts +61 -0
- package/dist/types/components/swipeActions.d.ts +81 -0
- package/dist/types/components/tabs.d.ts +89 -27
- package/dist/types/components/timepicker.d.ts +113 -21
- package/dist/types/components/tooltip.d.ts +56 -20
- package/dist/types/components/treeSelect.d.ts +106 -0
- package/dist/types/components/treemapChart.d.ts +56 -0
- package/dist/types/core/component.d.ts +43 -25
- package/dist/types/core/formControl.d.ts +21 -0
- package/dist/types/core/spring.d.ts +20 -0
- package/dist/types/core/utils.d.ts +85 -72
- package/dist/types/modular.d.ts +33 -1
- package/dist/types/plugins/dockedDisplayPlugin.d.ts +10 -8
- package/dist/types/plugins/modalDisplayPlugin.d.ts +32 -0
- package/package.json +10 -8
- package/src/sass/README.md +27 -18
- package/src/sass/abstracts/_elevation.scss +13 -7
- package/src/sass/abstracts/_index.scss +1 -0
- package/src/sass/abstracts/_mixins.scss +422 -36
- package/src/sass/abstracts/_spring.scss +63 -0
- package/src/sass/abstracts/_variables.scss +39 -21
- package/src/sass/base/_fonts.scss +61 -48
- package/src/sass/base/_global.scss +104 -24
- package/src/sass/base/_index.scss +2 -0
- package/src/sass/base/_normalize.scss +59 -114
- package/src/sass/base/_print.scss +21 -0
- package/src/sass/base/_prose.scss +68 -0
- package/src/sass/base/_typography.scss +9 -5
- package/src/sass/components/_accordion.scss +9 -16
- package/src/sass/components/_alert.scss +102 -0
- package/src/sass/components/_aura.scss +8 -3
- package/src/sass/components/_avatar.scss +3 -3
- package/src/sass/components/_back-to-top.scss +38 -0
- package/src/sass/components/_badges.scss +6 -5
- package/src/sass/components/_bar-chart.scss +41 -19
- package/src/sass/components/_bottom-sheet.scss +44 -16
- package/src/sass/components/_breadcrumb.scss +8 -1
- package/src/sass/components/_button-groups.scss +15 -25
- package/src/sass/components/_buttons.scss +156 -63
- package/src/sass/components/_calendar.scss +246 -0
- package/src/sass/components/_cards.scss +36 -44
- package/src/sass/components/_carousel.scss +27 -103
- package/src/sass/components/_cascader.scss +142 -0
- package/src/sass/components/_chips.scss +36 -46
- package/src/sass/components/_column-chart.scss +19 -12
- package/src/sass/components/_command-palette.scss +4 -7
- package/src/sass/components/_confetti.scss +0 -2
- package/src/sass/components/_countdown.scss +1 -1
- package/src/sass/components/_data-table.scss +162 -25
- package/src/sass/components/_datepicker.scss +54 -40
- package/src/sass/components/_description-list.scss +85 -0
- package/src/sass/components/_dialog.scss +42 -41
- package/src/sass/components/_docked-display.scss +1 -3
- package/src/sass/components/_drag-handle.scss +16 -20
- package/src/sass/components/_expanding-card.scss +20 -9
- package/src/sass/components/_fab-menu.scss +44 -32
- package/src/sass/components/_funnel-chart.scss +124 -0
- package/src/sass/components/_heatmap-chart.scss +111 -22
- package/src/sass/components/_icon-buttons.scss +7 -7
- package/src/sass/components/_icons-material-design.scss +2 -2
- package/src/sass/components/_image-compare.scss +108 -0
- package/src/sass/components/_index.scss +20 -0
- package/src/sass/components/_keypad.scss +39 -19
- package/src/sass/components/_kpi.scss +6 -11
- package/src/sass/components/_lightbox.scss +24 -13
- package/src/sass/components/_line-chart.scss +16 -2
- package/src/sass/components/_list.scss +59 -14
- package/src/sass/components/_loading-indicator.scss +1 -0
- package/src/sass/components/_loading-overlay.scss +105 -0
- package/src/sass/components/_map.scss +33 -11
- package/src/sass/components/_marquee.scss +3 -2
- package/src/sass/components/_mega-menu.scss +137 -0
- package/src/sass/components/_menu.scss +143 -123
- package/src/sass/components/_menubar.scss +59 -0
- package/src/sass/components/_message-scroller.scss +2 -2
- package/src/sass/components/_message.scss +3 -3
- package/src/sass/components/_mixed-chart.scss +37 -9
- package/src/sass/components/_modal-display.scss +21 -0
- package/src/sass/components/_navbar.scss +34 -20
- package/src/sass/components/_navigation-bar.scss +15 -77
- package/src/sass/components/_navigation-rail.scss +151 -92
- package/src/sass/components/_org-chart.scss +192 -0
- package/src/sass/components/_page-footer.scss +1 -1
- package/src/sass/components/_pagination.scss +6 -13
- package/src/sass/components/_panes.scss +32 -26
- package/src/sass/components/_particles.scss +0 -2
- package/src/sass/components/_pie-chart.scss +91 -11
- package/src/sass/components/_popover.scss +18 -5
- package/src/sass/components/_progress.scss +152 -31
- package/src/sass/components/_pull-to-refresh.scss +90 -0
- package/src/sass/components/_questionnaire.scss +74 -3
- package/src/sass/components/_radar-chart.scss +38 -10
- package/src/sass/components/_radial-chart.scss +113 -5
- package/src/sass/components/_rich-text-editor.scss +2 -2
- package/src/sass/components/_sankey-chart.scss +114 -0
- package/src/sass/components/_scatter-chart.scss +153 -0
- package/src/sass/components/_scrim.scss +0 -2
- package/src/sass/components/_scrollspy.scss +0 -2
- package/src/sass/components/_search.scss +26 -22
- package/src/sass/components/_show-more.scss +8 -0
- package/src/sass/components/_side-sheet.scss +23 -37
- package/src/sass/components/_skeleton.scss +2 -4
- package/src/sass/components/_snackbar.scss +27 -21
- package/src/sass/components/_split-button.scss +5 -5
- package/src/sass/components/_stat.scss +3 -8
- package/src/sass/components/_stepper.scss +1 -1
- package/src/sass/components/_swipe-actions.scss +71 -0
- package/src/sass/components/_tabs.scss +51 -32
- package/src/sass/components/_timeline.scss +12 -12
- package/src/sass/components/_timepicker.scss +109 -78
- package/src/sass/components/_toolbar.scss +35 -43
- package/src/sass/components/_tooltip.scss +21 -12
- package/src/sass/components/_tour.scss +89 -0
- package/src/sass/components/_transfer-list.scss +73 -0
- package/src/sass/components/_transitions.scss +4 -4
- package/src/sass/components/_tree.scss +3 -16
- package/src/sass/components/_treemap-chart.scss +122 -0
- package/src/sass/components/forms/_checkboxes.scss +106 -24
- package/src/sass/components/forms/_color-picker.scss +135 -0
- package/src/sass/components/forms/_color-swatches.scss +85 -0
- package/src/sass/components/forms/_drop-zone.scss +15 -9
- package/src/sass/components/forms/_fieldset.scss +7 -7
- package/src/sass/components/forms/_file-input.scss +6 -8
- package/src/sass/components/forms/_index.scss +3 -1
- package/src/sass/components/forms/_input-fields.scss +254 -90
- package/src/sass/components/forms/_radio-buttons.scss +33 -94
- package/src/sass/components/forms/_rating.scss +2 -32
- package/src/sass/components/forms/_select.scss +199 -20
- package/src/sass/components/forms/_slider.scss +91 -94
- package/src/sass/components/forms/_switches.scss +53 -164
- package/src/sass/custom.scss +10 -1
- package/src/sass/expressive.scss +3 -63
- package/src/sass/tokens/_contrast.scss +94 -0
- package/src/sass/tokens/_elevation.scss +16 -0
- package/src/sass/tokens/_index.scss +5 -0
- package/src/sass/tokens/_motion.scss +109 -0
- package/src/sass/tokens/_reference.scss +72 -141
- package/src/sass/tokens/_shape.scss +38 -0
- package/src/sass/tokens/_stacking.scss +27 -0
- package/src/sass/tokens/_state.scss +0 -2
- package/src/sass/tokens/_theme.scss +10 -1
- package/src/sass/tokens/_vibrant.scss +2 -5
- package/src/sass/utilities/_defer-render.scss +17 -0
- package/src/sass/utilities/_helpers.scss +183 -26
- package/src/sass/utilities/_index.scss +1 -0
- package/src/sass/utilities/_scroll-area.scss +0 -2
- package/src/sass/utilities/_spacing.scss +52 -34
- package/src/sass/utilities/_typescale.scss +8 -1
- package/src/sass/utilities/_visibility.scss +47 -76
- package/src/sass/utilities/_z-depth.scss +7 -4
- package/dist/js/chunks/chunk-33QVDDGR.mjs +0 -270
- package/dist/js/chunks/chunk-33QVDDGR.mjs.map +0 -7
- package/dist/js/chunks/chunk-45FER6RI.mjs +0 -59
- package/dist/js/chunks/chunk-45FER6RI.mjs.map +0 -7
- package/dist/js/chunks/chunk-5CEAOLUA.mjs.map +0 -7
- package/dist/js/chunks/chunk-6VATUZC6.mjs +0 -295
- package/dist/js/chunks/chunk-6VATUZC6.mjs.map +0 -7
- package/dist/js/chunks/chunk-74MXKKLN.mjs.map +0 -7
- package/dist/js/chunks/chunk-AIURVCG6.mjs +0 -55
- package/dist/js/chunks/chunk-AIURVCG6.mjs.map +0 -7
- package/dist/js/chunks/chunk-BGZLF6JZ.mjs.map +0 -7
- package/dist/js/chunks/chunk-C6CHEWYP.mjs.map +0 -7
- package/dist/js/chunks/chunk-CK2XCICY.mjs.map +0 -7
- package/dist/js/chunks/chunk-CXXM2L4F.mjs +0 -344
- package/dist/js/chunks/chunk-CXXM2L4F.mjs.map +0 -7
- package/dist/js/chunks/chunk-DXGRXYYL.mjs.map +0 -7
- package/dist/js/chunks/chunk-FM5CZOUB.mjs.map +0 -7
- package/dist/js/chunks/chunk-GJL6GCIU.mjs.map +0 -7
- package/dist/js/chunks/chunk-K3HZMFMD.mjs +0 -135
- package/dist/js/chunks/chunk-K3HZMFMD.mjs.map +0 -7
- package/dist/js/chunks/chunk-KHXZ2A4K.mjs.map +0 -7
- package/dist/js/chunks/chunk-KQACNQ22.mjs +0 -7
- package/dist/js/chunks/chunk-KQACNQ22.mjs.map +0 -7
- package/dist/js/chunks/chunk-KUFHW3DS.mjs.map +0 -7
- package/dist/js/chunks/chunk-KVJAVDBC.mjs.map +0 -7
- package/dist/js/chunks/chunk-L27Q6ZMI.mjs.map +0 -7
- package/dist/js/chunks/chunk-LQWUDNHZ.mjs.map +0 -7
- package/dist/js/chunks/chunk-M372EDXD.mjs +0 -322
- package/dist/js/chunks/chunk-M372EDXD.mjs.map +0 -7
- package/dist/js/chunks/chunk-M3MURWMB.mjs +0 -82
- package/dist/js/chunks/chunk-M3MURWMB.mjs.map +0 -7
- package/dist/js/chunks/chunk-NUHMOAOY.mjs.map +0 -7
- package/dist/js/chunks/chunk-OWG3LMUL.mjs +0 -169
- package/dist/js/chunks/chunk-OWG3LMUL.mjs.map +0 -7
- package/dist/js/chunks/chunk-PD6HYHAE.mjs +0 -48
- package/dist/js/chunks/chunk-PD6HYHAE.mjs.map +0 -7
- package/dist/js/chunks/chunk-PDG64UHF.mjs.map +0 -7
- package/dist/js/chunks/chunk-PO3AXVR3.mjs +0 -546
- package/dist/js/chunks/chunk-PO3AXVR3.mjs.map +0 -7
- package/dist/js/chunks/chunk-QYGK36OG.mjs +0 -181
- package/dist/js/chunks/chunk-QYGK36OG.mjs.map +0 -7
- package/dist/js/chunks/chunk-SFI2U4YW.mjs.map +0 -7
- package/dist/js/chunks/chunk-SMY7GJSS.mjs.map +0 -7
- package/dist/js/chunks/chunk-TCCA2HDG.mjs +0 -414
- package/dist/js/chunks/chunk-TCCA2HDG.mjs.map +0 -7
- package/dist/js/chunks/chunk-TSZYSW7F.mjs.map +0 -7
- package/dist/js/chunks/chunk-UAZSDUVP.mjs.map +0 -7
- package/dist/js/chunks/chunk-UBRZZWRA.mjs +0 -127
- package/dist/js/chunks/chunk-UBRZZWRA.mjs.map +0 -7
- package/dist/js/chunks/chunk-UCOE7ZDL.mjs +0 -287
- package/dist/js/chunks/chunk-UCOE7ZDL.mjs.map +0 -7
- package/dist/js/chunks/chunk-UETTGDLI.mjs.map +0 -7
- package/dist/js/chunks/chunk-UNCRDLP6.mjs +0 -136
- package/dist/js/chunks/chunk-UNCRDLP6.mjs.map +0 -7
- package/dist/js/chunks/chunk-VGNYF6FB.mjs.map +0 -7
- package/dist/js/chunks/chunk-VGPGBNGL.mjs +0 -68
- package/dist/js/chunks/chunk-VGPGBNGL.mjs.map +0 -7
- package/dist/js/chunks/chunk-VKAUVTQY.mjs +0 -1
- package/dist/js/chunks/chunk-VM4FTS7L.mjs +0 -48
- package/dist/js/chunks/chunk-VM4FTS7L.mjs.map +0 -7
- package/dist/js/chunks/chunk-WDK4T63U.mjs.map +0 -7
- package/dist/js/chunks/chunk-WOCCTVUF.mjs +0 -185
- package/dist/js/chunks/chunk-WOCCTVUF.mjs.map +0 -7
- package/dist/js/chunks/chunk-WQYN5L4E.mjs +0 -107
- package/dist/js/chunks/chunk-WQYN5L4E.mjs.map +0 -7
- package/dist/js/chunks/chunk-X4ISMKE2.mjs.map +0 -7
- package/dist/js/chunks/chunk-XAEAEHIX.mjs.map +0 -7
- package/dist/js/chunks/chunk-ZX6M7SWO.mjs.map +0 -7
- /package/dist/js/chunks/{chunk-VKAUVTQY.mjs.map → chunk-GNRSYMVH.mjs.map} +0 -0
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component
|
|
3
|
+
} from "./chunk-CMGXGYUC.mjs";
|
|
4
|
+
import {
|
|
5
|
+
Utils,
|
|
6
|
+
restoreAttribute
|
|
7
|
+
} from "./chunk-ZVLOUDIJ.mjs";
|
|
8
|
+
|
|
9
|
+
// src/ts/components/tabs.ts
|
|
10
|
+
var STEPS = { ltr: { ArrowLeft: -1, ArrowRight: 1 }, rtl: { ArrowLeft: 1, ArrowRight: -1 } };
|
|
11
|
+
var _defaults = {
|
|
12
|
+
duration: null,
|
|
13
|
+
onShow: null,
|
|
14
|
+
swipeable: false,
|
|
15
|
+
responsiveThreshold: Infinity
|
|
16
|
+
// breakpoint for swipeable
|
|
17
|
+
};
|
|
18
|
+
var scrollBehavior = () => window.matchMedia("(prefers-reduced-motion: reduce)").matches ? "instant" : "smooth";
|
|
19
|
+
var isDisabled = (a) => a.matches('.disabled, [aria-disabled="true"]');
|
|
20
|
+
var isShown = (a) => a.checkVisibility?.() ?? true;
|
|
21
|
+
var isUsable = (a) => !isDisabled(a) && isShown(a);
|
|
22
|
+
var _Tabs = class _Tabs extends Component {
|
|
23
|
+
constructor(el, options) {
|
|
24
|
+
var _a;
|
|
25
|
+
super(el, options);
|
|
26
|
+
this._panels = [];
|
|
27
|
+
// The panel a programmatic scroll is heading for. Scroll events on the way
|
|
28
|
+
// there pass over other panels and must not select them.
|
|
29
|
+
this._scrollTarget = null;
|
|
30
|
+
this._trackObserver = null;
|
|
31
|
+
this._trackWidth = -1;
|
|
32
|
+
this._originalPanels = /* @__PURE__ */ new Map();
|
|
33
|
+
this._originalLinks = /* @__PURE__ */ new Map();
|
|
34
|
+
/**
|
|
35
|
+
* Whether the page made the strip a tablist. The roles are the author's;
|
|
36
|
+
* in that mode the component keeps aria-selected and a roving tabindex, and
|
|
37
|
+
* the arrow keys select as they move, as the ARIA tabs pattern asks.
|
|
38
|
+
*/
|
|
39
|
+
this._tablist = false;
|
|
40
|
+
/** The bar's own tabindex as the page wrote it, put back on destroy. */
|
|
41
|
+
this._barTabindex = null;
|
|
42
|
+
/** Re-chooses a tablist's Tab stop when the strip is shown, hidden or resized. */
|
|
43
|
+
this._stripObserver = null;
|
|
44
|
+
/**
|
|
45
|
+
* Left and Right move focus to the next tab, wrapping at the ends, and
|
|
46
|
+
* Home and End to the first and last; disabled tabs are skipped. In link
|
|
47
|
+
* tabs focus moves without choosing, and Enter follows the link. In a
|
|
48
|
+
* tablist the tab that takes focus is selected too, the ARIA pattern's
|
|
49
|
+
* automatic activation, since a panel here shows at once.
|
|
50
|
+
*/
|
|
51
|
+
this._handleKeydown = (e) => {
|
|
52
|
+
const steps = STEPS[getComputedStyle(this.el).direction === "rtl" ? "rtl" : "ltr"];
|
|
53
|
+
const target = Utils.focusTarget(Array.from(this._tabLinks).filter(isShown), e, steps, true);
|
|
54
|
+
if (!target) return;
|
|
55
|
+
e.preventDefault();
|
|
56
|
+
target.focus();
|
|
57
|
+
this._followFocus(target);
|
|
58
|
+
};
|
|
59
|
+
this._handleTabClick = (e) => {
|
|
60
|
+
const target = e.target;
|
|
61
|
+
if (!target) return;
|
|
62
|
+
const tabLink = target.closest("a");
|
|
63
|
+
if (!tabLink || !Array.from(this._tabLinks).includes(tabLink)) return;
|
|
64
|
+
const disabled = tabLink.classList.contains("disabled") || tabLink.getAttribute("aria-disabled") === "true";
|
|
65
|
+
if (disabled) {
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (tabLink.hasAttribute("target")) return;
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
this._select(tabLink);
|
|
72
|
+
};
|
|
73
|
+
this._releaseScrollTarget = () => {
|
|
74
|
+
clearTimeout(this._scrollTimer);
|
|
75
|
+
this._scrollTarget = null;
|
|
76
|
+
};
|
|
77
|
+
this._handleTrackScroll = () => {
|
|
78
|
+
if (this._scrollTarget !== null) {
|
|
79
|
+
if (this._trackAt(this._scrollTarget)) this._releaseScrollTarget();
|
|
80
|
+
else this._waitForScroll();
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const panel = this._panels[this._trackIndex()];
|
|
84
|
+
if (!panel || panel === this._content) return;
|
|
85
|
+
this._showPanel(Array.from(this._tabLinks).find((a) => this._panelFor(a) === panel));
|
|
86
|
+
};
|
|
87
|
+
this._tabLinks = this._queryTabLinks();
|
|
88
|
+
if (!this._tabLinks.length) {
|
|
89
|
+
console.error("Tabs: no tab links (an <a> child) to show");
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
this._setupTablist();
|
|
93
|
+
this._tabLinks.forEach((link) => {
|
|
94
|
+
this._originalLinks.set(link, {
|
|
95
|
+
active: link.classList.contains("active"),
|
|
96
|
+
current: link.getAttribute("aria-current"),
|
|
97
|
+
selected: link.getAttribute("aria-selected"),
|
|
98
|
+
tabindex: link.getAttribute("tabindex")
|
|
99
|
+
});
|
|
100
|
+
const panel = this._panelFor(link);
|
|
101
|
+
if (panel) this._originalPanels.set(panel, {
|
|
102
|
+
display: panel.style.display,
|
|
103
|
+
priority: panel.style.getPropertyPriority("display"),
|
|
104
|
+
active: panel.classList.contains("active"),
|
|
105
|
+
inert: panel.inert
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
(_a = this.options).swipeable && (_a.swipeable = window.innerWidth <= this.options.responsiveThreshold && this._originalPanels.size > 0);
|
|
109
|
+
this._index = 0;
|
|
110
|
+
this._setupActiveTabLink();
|
|
111
|
+
if (this.options.swipeable) {
|
|
112
|
+
this._setupSwipeableTabs();
|
|
113
|
+
} else {
|
|
114
|
+
this._setupNormalTabs();
|
|
115
|
+
}
|
|
116
|
+
this._setTabsAndTabWidth();
|
|
117
|
+
this._createIndicator();
|
|
118
|
+
this._setupEventHandlers();
|
|
119
|
+
document.fonts?.ready.then(() => {
|
|
120
|
+
if (this.el["Expressive_Tabs"] === this) this._remeasure();
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
_setupTablist() {
|
|
124
|
+
this._tablist = this.el.getAttribute("role") === "tablist";
|
|
125
|
+
this._barTabindex = this.el.getAttribute("tabindex");
|
|
126
|
+
if (this._tablist) this.el.tabIndex = -1;
|
|
127
|
+
this._stripObserver = new ResizeObserver(() => {
|
|
128
|
+
if (this._tablist) this._refreshTabStop();
|
|
129
|
+
this._remeasure();
|
|
130
|
+
});
|
|
131
|
+
this._stripObserver.observe(this.el);
|
|
132
|
+
this._tabLinks.forEach((a) => this._stripObserver.observe(a));
|
|
133
|
+
}
|
|
134
|
+
static get defaults() {
|
|
135
|
+
return _defaults;
|
|
136
|
+
}
|
|
137
|
+
destroy() {
|
|
138
|
+
this._stripObserver?.disconnect();
|
|
139
|
+
this._stripObserver = null;
|
|
140
|
+
this._indicator?.remove();
|
|
141
|
+
if (this._track) {
|
|
142
|
+
this._teardownSwipeableTabs();
|
|
143
|
+
}
|
|
144
|
+
this._originalPanels.forEach((original, panel) => {
|
|
145
|
+
panel.style.setProperty("display", original.display, original.priority);
|
|
146
|
+
panel.classList.toggle("active", original.active);
|
|
147
|
+
panel.inert = original.inert;
|
|
148
|
+
if (!panel.className) panel.removeAttribute("class");
|
|
149
|
+
});
|
|
150
|
+
this._originalLinks.forEach((original, link) => {
|
|
151
|
+
link.classList.toggle("active", original.active);
|
|
152
|
+
restoreAttribute(link, "aria-current", original.current);
|
|
153
|
+
restoreAttribute(link, "aria-selected", original.selected);
|
|
154
|
+
restoreAttribute(link, "tabindex", original.tabindex);
|
|
155
|
+
});
|
|
156
|
+
restoreAttribute(this.el, "tabindex", this._barTabindex);
|
|
157
|
+
super.destroy();
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* The index of tab that is currently shown.
|
|
161
|
+
*/
|
|
162
|
+
get index() {
|
|
163
|
+
return this._index;
|
|
164
|
+
}
|
|
165
|
+
_setupEventHandlers() {
|
|
166
|
+
this.el.addEventListener("click", this._handleTabClick, { signal: this._events.signal });
|
|
167
|
+
this.el.addEventListener("keydown", this._handleKeydown, { signal: this._events.signal });
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* In a tablist the tab that takes focus is selected; link tabs wait for
|
|
171
|
+
* Enter. The page's focus handlers run inside focus(), and one may have
|
|
172
|
+
* destroyed or replaced the tabs, which then are no longer this instance's.
|
|
173
|
+
*/
|
|
174
|
+
_followFocus(tab) {
|
|
175
|
+
if (this._tablist && tab !== this._activeTabLink && _Tabs.getInstance(this.el) === this) this._select(tab);
|
|
176
|
+
}
|
|
177
|
+
_remeasure() {
|
|
178
|
+
this._setTabsAndTabWidth();
|
|
179
|
+
if (this._tabWidth !== 0 && this._tabsWidth !== 0) this._positionIndicator();
|
|
180
|
+
}
|
|
181
|
+
_queryTabLinks() {
|
|
182
|
+
return this.el.querySelectorAll(":scope > a");
|
|
183
|
+
}
|
|
184
|
+
_select(tabLink) {
|
|
185
|
+
if (this.options.swipeable) this._clickSwipeable(tabLink);
|
|
186
|
+
else this._clickTab(tabLink);
|
|
187
|
+
}
|
|
188
|
+
_clickSwipeable(tabLink) {
|
|
189
|
+
if (!this._panels.includes(this._panelFor(tabLink))) return;
|
|
190
|
+
if (tabLink !== this._activeTabLink && !this._showPanel(tabLink)) return;
|
|
191
|
+
this._scrollToActivePanel(scrollBehavior());
|
|
192
|
+
}
|
|
193
|
+
_clickTab(tabLink) {
|
|
194
|
+
const oldContent = this._content;
|
|
195
|
+
this._tabLinks = this._queryTabLinks();
|
|
196
|
+
const prevIndex = this._index;
|
|
197
|
+
this._setActiveTabLink(tabLink);
|
|
198
|
+
if (this._content && !this._swapPanels(oldContent)) return;
|
|
199
|
+
this._setTabsAndTabWidth();
|
|
200
|
+
this._animateIndicator(prevIndex);
|
|
201
|
+
}
|
|
202
|
+
/** Shows the active panel, hides the old one, then reports the change. */
|
|
203
|
+
_swapPanels(oldContent) {
|
|
204
|
+
this._content.style.display = "";
|
|
205
|
+
this._content.classList.add("active");
|
|
206
|
+
if (oldContent && oldContent !== this._content) {
|
|
207
|
+
oldContent.style.display = "none";
|
|
208
|
+
oldContent.classList.remove("active");
|
|
209
|
+
}
|
|
210
|
+
return this._notifyShow();
|
|
211
|
+
}
|
|
212
|
+
_createIndicator() {
|
|
213
|
+
const indicator = document.createElement("span");
|
|
214
|
+
indicator.classList.add("indicator");
|
|
215
|
+
this.el.appendChild(indicator);
|
|
216
|
+
this._indicator = indicator;
|
|
217
|
+
this._positionIndicator();
|
|
218
|
+
}
|
|
219
|
+
/** Reads both positions before writing either. */
|
|
220
|
+
_positionIndicator() {
|
|
221
|
+
const left = this._calcLeftPos(this._activeTabLink);
|
|
222
|
+
const right = this._calcRightPos(this._activeTabLink);
|
|
223
|
+
this._indicator.style.left = left + "px";
|
|
224
|
+
this._indicator.style.right = right + "px";
|
|
225
|
+
}
|
|
226
|
+
/** The panel a link shows, or null for a `target` link or one without a hash. */
|
|
227
|
+
_panelFor(a) {
|
|
228
|
+
if (!a.hash || a.hasAttribute("target")) return null;
|
|
229
|
+
return Utils.getElementById(this.el, _Tabs._decodeHash(a.hash));
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* The id a hash names. `a.hash` and `location.hash` come back
|
|
233
|
+
* percent-encoded, so a non-ASCII id would never match without this. A
|
|
234
|
+
* malformed escape throws, and is then taken as written.
|
|
235
|
+
*/
|
|
236
|
+
static _decodeHash(hash) {
|
|
237
|
+
try {
|
|
238
|
+
return decodeURIComponent(hash.slice(1));
|
|
239
|
+
} catch {
|
|
240
|
+
return hash.slice(1);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Which tab is current, for the eye and for assistive technology.
|
|
245
|
+
*
|
|
246
|
+
* The class alone is a colour. Link tabs are navigation, so `aria-current`
|
|
247
|
+
* is the part a screen reader reads. A strip the page made a tablist reads
|
|
248
|
+
* `aria-selected` instead, with the keyboard model rule 2 asks of a
|
|
249
|
+
* composite role. Either value changes as the user picks, which makes
|
|
250
|
+
* keeping it the component's job, not the author's - see CONTEXT.md on
|
|
251
|
+
* static semantics versus dynamic state. Writing it once in the markup and
|
|
252
|
+
* never moving it left the old tab announcing itself as current.
|
|
253
|
+
*/
|
|
254
|
+
_setActiveTabLink(tabLink, behavior = scrollBehavior()) {
|
|
255
|
+
const stop = this._tabStop(tabLink);
|
|
256
|
+
Array.from(this._tabLinks).forEach((a) => this._mark(a, a === tabLink, a === stop));
|
|
257
|
+
this._activeTabLink = tabLink;
|
|
258
|
+
this._index = Array.from(this._tabLinks).indexOf(tabLink);
|
|
259
|
+
this._content = this._panelFor(tabLink);
|
|
260
|
+
this._reveal(tabLink, behavior);
|
|
261
|
+
}
|
|
262
|
+
/** A tablist says selected and keeps one Tab stop; link tabs say current. */
|
|
263
|
+
_mark(a, on, stop) {
|
|
264
|
+
a.classList.toggle("active", on);
|
|
265
|
+
if (this._tablist) {
|
|
266
|
+
a.setAttribute("aria-selected", String(on));
|
|
267
|
+
a.tabIndex = stop ? 0 : -1;
|
|
268
|
+
} else if (on) a.setAttribute("aria-current", "page");
|
|
269
|
+
else a.removeAttribute("aria-current");
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* The tablist's one Tab stop: the selected tab, or the first usable one
|
|
273
|
+
* when the selected tab is disabled or hidden. The arrow keys skip both,
|
|
274
|
+
* so a Tab stop on one would leave every other panel out of reach.
|
|
275
|
+
*/
|
|
276
|
+
_tabStop(selected) {
|
|
277
|
+
if (isUsable(selected)) return selected;
|
|
278
|
+
const links = Array.from(this._tabLinks);
|
|
279
|
+
return links.find(isUsable) ?? links.find((a) => !isDisabled(a)) ?? selected;
|
|
280
|
+
}
|
|
281
|
+
/** Showing or hiding the strip or a tab moves the Tab stop to a usable tab. */
|
|
282
|
+
_refreshTabStop() {
|
|
283
|
+
const stop = this._tabStop(this._activeTabLink);
|
|
284
|
+
this._tabLinks.forEach((a) => a.tabIndex = a === stop ? 0 : -1);
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Scrolls an overflowing bar, and only the bar, so the tab is in view.
|
|
288
|
+
* Measured as a visual offset, so it holds in a right-to-left bar too.
|
|
289
|
+
*/
|
|
290
|
+
_reveal(tab, behavior) {
|
|
291
|
+
const bar = this.el.getBoundingClientRect();
|
|
292
|
+
const box = tab.getBoundingClientRect();
|
|
293
|
+
const left = Math.min(0, box.left - bar.left) || Math.max(0, box.right - bar.right);
|
|
294
|
+
if (left) this.el.scrollBy({ left, behavior });
|
|
295
|
+
}
|
|
296
|
+
_setupActiveTabLink() {
|
|
297
|
+
const hash = location.hash && _Tabs._decodeHash(location.hash);
|
|
298
|
+
this._activeTabLink = Array.from(this._tabLinks).find((a) => hash && _Tabs._decodeHash(a.getAttribute("href") ?? "") === hash) ?? this.el.querySelector("a.active") ?? this._tabStop(this._tabLinks[0]);
|
|
299
|
+
this._setActiveTabLink(this._activeTabLink, "instant");
|
|
300
|
+
this._originalPanels.forEach((_, panel) => panel.classList.toggle("active", panel === this._content));
|
|
301
|
+
}
|
|
302
|
+
_setupSwipeableTabs() {
|
|
303
|
+
this._panels = [...new Set(Array.from(this._tabLinks, (a) => this._panelFor(a)).filter(Boolean))];
|
|
304
|
+
const track = document.createElement("div");
|
|
305
|
+
track.classList.add("tabs-content");
|
|
306
|
+
this._panels[0].before(track);
|
|
307
|
+
this._panels.forEach((panel) => {
|
|
308
|
+
const marker = document.createComment("");
|
|
309
|
+
panel.before(marker);
|
|
310
|
+
this._originalPanels.get(panel).marker = marker;
|
|
311
|
+
track.appendChild(panel);
|
|
312
|
+
panel.style.display = "";
|
|
313
|
+
});
|
|
314
|
+
this._track = track;
|
|
315
|
+
this._syncPanels();
|
|
316
|
+
const options = { passive: true, signal: this._events.signal };
|
|
317
|
+
track.addEventListener("scroll", this._handleTrackScroll, options);
|
|
318
|
+
track.addEventListener("pointerdown", this._releaseScrollTarget, options);
|
|
319
|
+
track.addEventListener("wheel", this._releaseScrollTarget, options);
|
|
320
|
+
this._trackObserver = new ResizeObserver(() => {
|
|
321
|
+
if (track.clientWidth === this._trackWidth) return;
|
|
322
|
+
this._trackWidth = track.clientWidth;
|
|
323
|
+
this._scrollToActivePanel("instant");
|
|
324
|
+
});
|
|
325
|
+
this._trackObserver.observe(track);
|
|
326
|
+
this._scrollToActivePanel("instant");
|
|
327
|
+
}
|
|
328
|
+
_teardownSwipeableTabs() {
|
|
329
|
+
const track = this._track;
|
|
330
|
+
this._trackObserver?.disconnect();
|
|
331
|
+
this._trackObserver = null;
|
|
332
|
+
this._releaseScrollTarget();
|
|
333
|
+
this._originalPanels.forEach((original, panel) => original.marker?.replaceWith(panel));
|
|
334
|
+
track.remove();
|
|
335
|
+
this._track = void 0;
|
|
336
|
+
}
|
|
337
|
+
/** Only the shown panel is reachable; the others are off to the side. */
|
|
338
|
+
_syncPanels() {
|
|
339
|
+
this._panels.forEach((panel) => {
|
|
340
|
+
panel.classList.toggle("active", panel === this._content);
|
|
341
|
+
panel.inert = panel !== this._content;
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
/** The panel the track is mostly showing. Panels are exactly one track wide. */
|
|
345
|
+
_trackIndex() {
|
|
346
|
+
return Math.round(Math.abs(this._track.scrollLeft) / (this._track.clientWidth || 1));
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Whether panel `index` fills the track. Compare positions, not rounded
|
|
350
|
+
* indexes: a scroll still on its way to another panel can already round to
|
|
351
|
+
* this one. Measured rather than computed from clientWidth, which rounds a
|
|
352
|
+
* fractional track width, while the mandatory snap lands on the real edge.
|
|
353
|
+
*/
|
|
354
|
+
_trackAt(index) {
|
|
355
|
+
return Math.abs(this._panels[index].getBoundingClientRect().left - this._track.getBoundingClientRect().left) < 1;
|
|
356
|
+
}
|
|
357
|
+
_scrollToActivePanel(behavior) {
|
|
358
|
+
const index = this._panels.indexOf(this._content);
|
|
359
|
+
if (index < 0 || this._trackAt(index)) return;
|
|
360
|
+
const sign = getComputedStyle(this._track).direction === "rtl" ? -1 : 1;
|
|
361
|
+
const left = sign * index * this._track.clientWidth;
|
|
362
|
+
this._scrollTarget = index;
|
|
363
|
+
this._waitForScroll();
|
|
364
|
+
this._track.scrollTo({ left, behavior });
|
|
365
|
+
}
|
|
366
|
+
// A smooth scroll that something cut short never arrives, and on a busy page
|
|
367
|
+
// one can also take a while to start. Once the track has been still for half
|
|
368
|
+
// a second, jump to the selected panel. The selection stands: a swipe or
|
|
369
|
+
// wheel that took over has already released the target, so the scroll
|
|
370
|
+
// events that follow choose the panel. Every scroll event restarts the wait.
|
|
371
|
+
_waitForScroll() {
|
|
372
|
+
clearTimeout(this._scrollTimer);
|
|
373
|
+
this._scrollTimer = setTimeout(() => {
|
|
374
|
+
this._releaseScrollTarget();
|
|
375
|
+
this._scrollToActivePanel("instant");
|
|
376
|
+
}, 500);
|
|
377
|
+
}
|
|
378
|
+
_showPanel(tabLink) {
|
|
379
|
+
const prevIndex = this._index;
|
|
380
|
+
this._setActiveTabLink(tabLink);
|
|
381
|
+
this._syncPanels();
|
|
382
|
+
this._setTabsAndTabWidth();
|
|
383
|
+
this._animateIndicator(prevIndex);
|
|
384
|
+
return this._notifyShow();
|
|
385
|
+
}
|
|
386
|
+
// After the old panel is hidden, so a listener sees one active panel.
|
|
387
|
+
_notifyShow() {
|
|
388
|
+
const panel = this._content;
|
|
389
|
+
return this._notify("change", this.options.onShow, { args: [panel], detail: { panel }, current: () => this._content === panel });
|
|
390
|
+
}
|
|
391
|
+
_setupNormalTabs() {
|
|
392
|
+
Array.from(this._tabLinks).forEach((a) => {
|
|
393
|
+
if (a === this._activeTabLink) return;
|
|
394
|
+
const currContent = this._panelFor(a);
|
|
395
|
+
if (currContent) currContent.style.display = "none";
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
_setTabsAndTabWidth() {
|
|
399
|
+
this._tabsWidth = this.el.getBoundingClientRect().width;
|
|
400
|
+
this._tabWidth = Math.max(this._tabsWidth, this.el.scrollWidth) / this._tabLinks.length;
|
|
401
|
+
}
|
|
402
|
+
_calcRightPos(el) {
|
|
403
|
+
return Math.ceil(this._tabsWidth - el.offsetLeft - el.getBoundingClientRect().width);
|
|
404
|
+
}
|
|
405
|
+
_calcLeftPos(el) {
|
|
406
|
+
return Math.floor(el.offsetLeft);
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Recalculate tab indicator position. This is useful when
|
|
410
|
+
* the indicator position is not correct.
|
|
411
|
+
*/
|
|
412
|
+
updateTabIndicator() {
|
|
413
|
+
this._setTabsAndTabWidth();
|
|
414
|
+
this._animateIndicator(this._index);
|
|
415
|
+
}
|
|
416
|
+
_animateIndicator(prevIndex) {
|
|
417
|
+
const ms = this.options.duration;
|
|
418
|
+
const timing = ms == null ? ["var(--md-comp-tabs-indicator-duration) var(--md-comp-tabs-indicator-easing)", "calc(var(--md-comp-tabs-indicator-duration) * 0.3)"] : [`${ms}ms ease-out`, `${ms * 0.3}ms`];
|
|
419
|
+
const [leftDelay, rightDelay] = this._index - prevIndex >= 0 ? [timing[1], "0s"] : ["0s", timing[1]];
|
|
420
|
+
this._indicator.style.transition = `left ${timing[0]} ${leftDelay}, right ${timing[0]} ${rightDelay}`;
|
|
421
|
+
this._positionIndicator();
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Show tab content that corresponds to the tab with the id.
|
|
425
|
+
* @param tabId The id of the tab that you want to switch to.
|
|
426
|
+
*/
|
|
427
|
+
select(tabId) {
|
|
428
|
+
const tab = Array.from(this._tabLinks).find((a) => a.getAttribute("href") === "#" + tabId);
|
|
429
|
+
if (tab) tab.click();
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
_Tabs.key = "Expressive_Tabs";
|
|
433
|
+
var Tabs = _Tabs;
|
|
434
|
+
|
|
435
|
+
export {
|
|
436
|
+
Tabs
|
|
437
|
+
};
|
|
438
|
+
//# sourceMappingURL=chunk-LDXCC2L3.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/ts/components/tabs.ts"],
|
|
4
|
+
"sourcesContent": ["import { Component, BaseOptions } from '../core/component';\nimport { Utils, restoreAttribute } from '../core/utils';\n\nexport interface TabsOptions extends BaseOptions {\n /**\n * Indicator transition duration in milliseconds, on an ease-out curve. The\n * default, null, follows the --md-comp-tabs-indicator-duration and\n * --md-comp-tabs-indicator-easing spring tokens instead.\n * @default null\n */\n duration: number | null;\n /**\n * Callback for when a new tab content is shown.\n * @default null\n */\n onShow: (newContent: Element) => void;\n /**\n * Set to true to swipe between panels. The panels move into a full-width\n * scroll-snap track, so touch and trackpad swipes are native scrolling.\n * This also uses the responsiveThreshold option.\n * @default false\n */\n swipeable: boolean;\n /**\n * The maximum width of the screen, in pixels,\n * where the swipeable functionality initializes.\n * @default infinity\n */\n responsiveThreshold: number;\n}\n\n/** Left and Right move between tabs the way they point, so they swap in RTL. */\nconst STEPS = { ltr: { ArrowLeft: -1, ArrowRight: 1 }, rtl: { ArrowLeft: 1, ArrowRight: -1 } };\n\nconst _defaults: TabsOptions = {\n duration: null,\n onShow: null,\n swipeable: false,\n responsiveThreshold: Infinity // breakpoint for swipeable\n};\n\nconst scrollBehavior = (): ScrollBehavior =>\n window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 'instant' : 'smooth';\n\n/** Links cannot be :disabled; a tab is turned off with a class or aria-disabled. */\nconst isDisabled = (a: Element) => a.matches('.disabled, [aria-disabled=\"true\"]');\n\n/** Shown, as far as the browser can say; a responsive utility may hide a tab. */\nconst isShown = (a: Element) => a.checkVisibility?.() ?? true;\n\n/** A tab the keyboard can reach: enabled and shown. */\nconst isUsable = (a: Element) => !isDisabled(a) && isShown(a);\n\nexport class Tabs extends Component<TabsOptions> {\n _tabLinks: NodeListOf<HTMLAnchorElement>;\n _index: number;\n _indicator: HTMLElement;\n _tabWidth: number;\n _tabsWidth: number;\n _track: HTMLElement;\n private _panels: HTMLElement[] = [];\n // The panel a programmatic scroll is heading for. Scroll events on the way\n // there pass over other panels and must not select them.\n private _scrollTarget: number | null = null;\n private _scrollTimer: ReturnType<typeof setTimeout>;\n private _trackObserver: ResizeObserver | null = null;\n private _trackWidth = -1;\n _activeTabLink: HTMLAnchorElement;\n _content: HTMLElement;\n private _originalPanels = new Map<HTMLElement, { display: string; priority: string; active: boolean; inert: boolean; marker?: Comment }>();\n private _originalLinks = new Map<HTMLAnchorElement, { active: boolean; current: string | null; selected: string | null; tabindex: string | null }>();\n /**\n * Whether the page made the strip a tablist. The roles are the author's;\n * in that mode the component keeps aria-selected and a roving tabindex, and\n * the arrow keys select as they move, as the ARIA tabs pattern asks.\n */\n private _tablist = false;\n /** The bar's own tabindex as the page wrote it, put back on destroy. */\n private _barTabindex: string | null = null;\n /** Re-chooses a tablist's Tab stop when the strip is shown, hidden or resized. */\n private _stripObserver: ResizeObserver | null = null;\n\n constructor(el: HTMLElement, options: Partial<TabsOptions>) {\n super(el, options);\n\n this._tabLinks = this._queryTabLinks();\n if (!this._tabLinks.length) {\n console.error('Tabs: no tab links (an <a> child) to show');\n return;\n }\n this._setupTablist();\n this._tabLinks.forEach(link => {\n this._originalLinks.set(link, {\n active: link.classList.contains('active'), current: link.getAttribute('aria-current'),\n selected: link.getAttribute('aria-selected'), tabindex: link.getAttribute('tabindex')\n });\n const panel = this._panelFor(link);\n if (panel) this._originalPanels.set(panel, {\n display: panel.style.display, priority: panel.style.getPropertyPriority('display'),\n active: panel.classList.contains('active'), inert: panel.inert\n });\n });\n // Swiping needs at least one panel the links resolve to.\n this.options.swipeable &&= window.innerWidth <= this.options.responsiveThreshold && this._originalPanels.size > 0;\n this._index = 0;\n this._setupActiveTabLink();\n if (this.options.swipeable) {\n this._setupSwipeableTabs();\n } else {\n this._setupNormalTabs();\n }\n // Setup tabs indicator after content to ensure accurate widths\n this._setTabsAndTabWidth();\n this._createIndicator();\n this._setupEventHandlers();\n // Labels measured before a web font arrives have the fallback's width,\n // and the strip's size need not change when the font arrives.\n document.fonts?.ready.then(() => {\n if (this.el['Expressive_Tabs'] === this) this._remeasure();\n });\n }\n\n private _setupTablist() {\n this._tablist = this.el.getAttribute('role') === 'tablist';\n // Firefox makes an overflowing bar a Tab stop of its own, ahead of the\n // tabs; a tablist is one Tab stop, so the bar steps aside.\n this._barTabindex = this.el.getAttribute('tabindex');\n if (this._tablist) this.el.tabIndex = -1;\n // A strip set up inside a closed dialog has no visible tabs yet; opening\n // it changes the strip's size, and so does a window resize or a utility\n // that shows or hides a tab. The tabs are watched too: at the 840px\n // breakpoint they switch between equal and intrinsic widths inside a\n // strip that may keep its size. Each change re-measures the indicator,\n // and a tablist chooses its Tab stop again.\n this._stripObserver = new ResizeObserver(() => {\n if (this._tablist) this._refreshTabStop();\n this._remeasure();\n });\n this._stripObserver.observe(this.el);\n this._tabLinks.forEach((a) => this._stripObserver.observe(a));\n }\n\n static get defaults(): TabsOptions {\n return _defaults;\n }\n\n static key = 'Expressive_Tabs';\n\n destroy() {\n this._stripObserver?.disconnect();\n this._stripObserver = null;\n this._indicator?.remove();\n if (this._track) {\n this._teardownSwipeableTabs();\n }\n this._originalPanels.forEach((original, panel) => {\n panel.style.setProperty('display', original.display, original.priority);\n panel.classList.toggle('active', original.active);\n panel.inert = original.inert;\n if (!panel.className) panel.removeAttribute('class');\n });\n this._originalLinks.forEach((original, link) => {\n link.classList.toggle('active', original.active);\n restoreAttribute(link, 'aria-current', original.current);\n restoreAttribute(link, 'aria-selected', original.selected);\n restoreAttribute(link, 'tabindex', original.tabindex);\n });\n restoreAttribute(this.el, 'tabindex', this._barTabindex);\n super.destroy();\n }\n\n /**\n * The index of tab that is currently shown.\n */\n get index() {\n return this._index;\n }\n\n _setupEventHandlers() {\n this.el.addEventListener('click', this._handleTabClick, { signal: this._events.signal });\n this.el.addEventListener('keydown', this._handleKeydown, { signal: this._events.signal });\n }\n\n /**\n * Left and Right move focus to the next tab, wrapping at the ends, and\n * Home and End to the first and last; disabled tabs are skipped. In link\n * tabs focus moves without choosing, and Enter follows the link. In a\n * tablist the tab that takes focus is selected too, the ARIA pattern's\n * automatic activation, since a panel here shows at once.\n */\n _handleKeydown = (e: KeyboardEvent) => {\n const steps = STEPS[getComputedStyle(this.el).direction === 'rtl' ? 'rtl' : 'ltr'];\n const target = Utils.focusTarget(Array.from(this._tabLinks).filter(isShown), e, steps, true) as HTMLAnchorElement | undefined;\n if (!target) return;\n e.preventDefault();\n target.focus();\n this._followFocus(target);\n };\n\n /**\n * In a tablist the tab that takes focus is selected; link tabs wait for\n * Enter. The page's focus handlers run inside focus(), and one may have\n * destroyed or replaced the tabs, which then are no longer this instance's.\n */\n private _followFocus(tab: HTMLAnchorElement) {\n if (this._tablist && tab !== this._activeTabLink && Tabs.getInstance(this.el) === this) this._select(tab);\n }\n\n private _remeasure() {\n this._setTabsAndTabWidth();\n if (this._tabWidth !== 0 && this._tabsWidth !== 0) this._positionIndicator();\n }\n\n _queryTabLinks() {\n return this.el.querySelectorAll<HTMLAnchorElement>(':scope > a');\n }\n\n _handleTabClick = (e: MouseEvent) => {\n const target = e.target as Element | null;\n if (!target) return;\n const tabLink = target.closest('a');\n if (!tabLink || !Array.from(this._tabLinks).includes(tabLink)) return;\n\n const disabled =\n tabLink.classList.contains('disabled') ||\n tabLink.getAttribute('aria-disabled') === 'true';\n if (disabled) {\n e.preventDefault();\n return;\n }\n // Act as regular link if target attribute is specified.\n if (tabLink.hasAttribute('target')) return;\n e.preventDefault();\n this._select(tabLink);\n };\n\n private _select(tabLink: HTMLAnchorElement) {\n if (this.options.swipeable) this._clickSwipeable(tabLink);\n else this._clickTab(tabLink);\n }\n\n private _clickSwipeable(tabLink: HTMLAnchorElement) {\n if (!this._panels.includes(this._panelFor(tabLink))) return;\n // A listener may destroy the tabs or pick another one.\n if (tabLink !== this._activeTabLink && !this._showPanel(tabLink)) return;\n this._scrollToActivePanel(scrollBehavior());\n }\n\n private _clickTab(tabLink: HTMLAnchorElement) {\n const oldContent = this._content;\n this._tabLinks = this._queryTabLinks();\n // Moves the class and aria-current together, off the old tab and onto this\n // one - they used to be able to disagree.\n const prevIndex = this._index;\n this._setActiveTabLink(tabLink);\n // A listener may destroy the tabs or pick another one.\n if (this._content && !this._swapPanels(oldContent)) return;\n // Update widths after content is swapped (scrollbar bugfix)\n this._setTabsAndTabWidth();\n this._animateIndicator(prevIndex);\n }\n\n /** Shows the active panel, hides the old one, then reports the change. */\n private _swapPanels(oldContent: HTMLElement | null): boolean {\n // Clear the hide rather than force 'block', so a flex or grid panel\n // keeps the display its stylesheet gives it.\n this._content.style.display = '';\n this._content.classList.add('active');\n if (oldContent && oldContent !== this._content) {\n oldContent.style.display = 'none';\n oldContent.classList.remove('active');\n }\n return this._notifyShow();\n }\n\n _createIndicator() {\n const indicator = document.createElement('span');\n indicator.classList.add('indicator');\n this.el.appendChild(indicator);\n this._indicator = indicator;\n this._positionIndicator();\n }\n\n /** Reads both positions before writing either. */\n private _positionIndicator() {\n const left = this._calcLeftPos(this._activeTabLink);\n const right = this._calcRightPos(this._activeTabLink);\n this._indicator.style.left = left + 'px';\n this._indicator.style.right = right + 'px';\n }\n\n /** The panel a link shows, or null for a `target` link or one without a hash. */\n private _panelFor(a: HTMLAnchorElement): HTMLElement | null {\n if (!a.hash || a.hasAttribute('target')) return null;\n // Looked up in the tabs' own root, so panels inside a shadow root resolve.\n return Utils.getElementById(this.el, Tabs._decodeHash(a.hash));\n }\n\n /**\n * The id a hash names. `a.hash` and `location.hash` come back\n * percent-encoded, so a non-ASCII id would never match without this. A\n * malformed escape throws, and is then taken as written.\n */\n private static _decodeHash(hash: string): string {\n try {\n return decodeURIComponent(hash.slice(1));\n } catch {\n return hash.slice(1);\n }\n }\n\n /**\n * Which tab is current, for the eye and for assistive technology.\n *\n * The class alone is a colour. Link tabs are navigation, so `aria-current`\n * is the part a screen reader reads. A strip the page made a tablist reads\n * `aria-selected` instead, with the keyboard model rule 2 asks of a\n * composite role. Either value changes as the user picks, which makes\n * keeping it the component's job, not the author's - see CONTEXT.md on\n * static semantics versus dynamic state. Writing it once in the markup and\n * never moving it left the old tab announcing itself as current.\n */\n private _setActiveTabLink(tabLink: HTMLAnchorElement, behavior: ScrollBehavior = scrollBehavior()) {\n const stop = this._tabStop(tabLink);\n Array.from(this._tabLinks).forEach(a => this._mark(a, a === tabLink, a === stop));\n this._activeTabLink = tabLink;\n this._index = Array.from(this._tabLinks).indexOf(tabLink);\n this._content = this._panelFor(tabLink);\n this._reveal(tabLink, behavior);\n }\n\n /** A tablist says selected and keeps one Tab stop; link tabs say current. */\n private _mark(a: HTMLAnchorElement, on: boolean, stop: boolean) {\n a.classList.toggle('active', on);\n if (this._tablist) {\n a.setAttribute('aria-selected', String(on));\n a.tabIndex = stop ? 0 : -1;\n } else if (on) a.setAttribute('aria-current', 'page');\n else a.removeAttribute('aria-current');\n }\n\n /**\n * The tablist's one Tab stop: the selected tab, or the first usable one\n * when the selected tab is disabled or hidden. The arrow keys skip both,\n * so a Tab stop on one would leave every other panel out of reach.\n */\n private _tabStop(selected: HTMLAnchorElement): HTMLAnchorElement {\n if (isUsable(selected)) return selected;\n // With nothing shown, as in a closed dialog, at least skip disabled tabs.\n const links = Array.from(this._tabLinks);\n return links.find(isUsable) ?? links.find((a) => !isDisabled(a)) ?? selected;\n }\n\n /** Showing or hiding the strip or a tab moves the Tab stop to a usable tab. */\n private _refreshTabStop() {\n const stop = this._tabStop(this._activeTabLink);\n this._tabLinks.forEach((a) => (a.tabIndex = a === stop ? 0 : -1));\n }\n\n /**\n * Scrolls an overflowing bar, and only the bar, so the tab is in view.\n * Measured as a visual offset, so it holds in a right-to-left bar too.\n */\n private _reveal(tab: HTMLElement, behavior: ScrollBehavior) {\n const bar = this.el.getBoundingClientRect();\n const box = tab.getBoundingClientRect();\n const left = Math.min(0, box.left - bar.left) || Math.max(0, box.right - bar.right);\n if (left) this.el.scrollBy({ left, behavior });\n }\n\n _setupActiveTabLink() {\n // If the location.hash matches one of the links, use that as the active tab.\n // If no match is found, use any with class 'active', then the first link.\n // Both sides decoded: an href may be written with or without escapes.\n const hash = location.hash && Tabs._decodeHash(location.hash);\n this._activeTabLink =\n Array.from(this._tabLinks).find(a => hash && Tabs._decodeHash(a.getAttribute('href') ?? '') === hash) ??\n this.el.querySelector<HTMLAnchorElement>('a.active') ??\n this._tabStop(this._tabLinks[0]);\n this._setActiveTabLink(this._activeTabLink, 'instant');\n\n this._originalPanels.forEach((_, panel) => panel.classList.toggle('active', panel === this._content));\n }\n\n _setupSwipeableTabs() {\n this._panels = [...new Set(Array.from(this._tabLinks, (a) => this._panelFor(a)).filter(Boolean))];\n const track = document.createElement('div');\n track.classList.add('tabs-content');\n this._panels[0].before(track);\n this._panels.forEach((panel) => {\n const marker = document.createComment('');\n panel.before(marker);\n this._originalPanels.get(panel).marker = marker;\n track.appendChild(panel);\n panel.style.display = '';\n });\n this._track = track;\n this._syncPanels();\n const options = { passive: true, signal: this._events.signal };\n track.addEventListener('scroll', this._handleTrackScroll, options);\n // A swipe or wheel that interrupts a programmatic scroll takes over from it.\n track.addEventListener('pointerdown', this._releaseScrollTarget, options);\n track.addEventListener('wheel', this._releaseScrollTarget, options);\n // A track that starts hidden (in a closed dialog or sheet) is 0px wide, so\n // the scroll below cannot reach the active panel. Re-align whenever the\n // track's width changes, which also covers window resizes. Only the width:\n // a panel growing taller mid-swipe must not pull the track back.\n this._trackObserver = new ResizeObserver(() => {\n if (track.clientWidth === this._trackWidth) return;\n this._trackWidth = track.clientWidth;\n this._scrollToActivePanel('instant');\n });\n this._trackObserver.observe(track);\n this._scrollToActivePanel('instant');\n }\n\n _teardownSwipeableTabs() {\n const track = this._track;\n this._trackObserver?.disconnect();\n this._trackObserver = null;\n this._releaseScrollTarget();\n this._originalPanels.forEach((original, panel) => original.marker?.replaceWith(panel));\n track.remove();\n this._track = undefined;\n }\n\n /** Only the shown panel is reachable; the others are off to the side. */\n private _syncPanels() {\n this._panels.forEach((panel) => {\n panel.classList.toggle('active', panel === this._content);\n panel.inert = panel !== this._content;\n });\n }\n\n /** The panel the track is mostly showing. Panels are exactly one track wide. */\n private _trackIndex() {\n return Math.round(Math.abs(this._track.scrollLeft) / (this._track.clientWidth || 1));\n }\n\n /**\n * Whether panel `index` fills the track. Compare positions, not rounded\n * indexes: a scroll still on its way to another panel can already round to\n * this one. Measured rather than computed from clientWidth, which rounds a\n * fractional track width, while the mandatory snap lands on the real edge.\n */\n private _trackAt(index: number) {\n return Math.abs(this._panels[index].getBoundingClientRect().left - this._track.getBoundingClientRect().left) < 1;\n }\n\n private _scrollToActivePanel(behavior: ScrollBehavior) {\n const index = this._panels.indexOf(this._content);\n if (index < 0 || this._trackAt(index)) return;\n // scrollLeft runs negative in a right-to-left track.\n const sign = getComputedStyle(this._track).direction === 'rtl' ? -1 : 1;\n const left = sign * index * this._track.clientWidth;\n this._scrollTarget = index;\n this._waitForScroll();\n this._track.scrollTo({ left, behavior });\n }\n\n // A smooth scroll that something cut short never arrives, and on a busy page\n // one can also take a while to start. Once the track has been still for half\n // a second, jump to the selected panel. The selection stands: a swipe or\n // wheel that took over has already released the target, so the scroll\n // events that follow choose the panel. Every scroll event restarts the wait.\n private _waitForScroll() {\n clearTimeout(this._scrollTimer);\n this._scrollTimer = setTimeout(() => {\n this._releaseScrollTarget();\n this._scrollToActivePanel('instant');\n }, 500);\n }\n\n _releaseScrollTarget = () => {\n clearTimeout(this._scrollTimer);\n this._scrollTarget = null;\n };\n\n _handleTrackScroll = () => {\n if (this._scrollTarget !== null) {\n // Release on arrival. A smooth scroll still heading to the previous\n // selection rounds to the new target on its way past, and releasing\n // there let the rest of that scroll select the panel it was heading to.\n if (this._trackAt(this._scrollTarget)) this._releaseScrollTarget();\n else this._waitForScroll();\n return;\n }\n const panel = this._panels[this._trackIndex()];\n if (!panel || panel === this._content) return;\n this._showPanel(Array.from(this._tabLinks).find((a) => this._panelFor(a) === panel));\n };\n\n private _showPanel(tabLink: HTMLAnchorElement): boolean {\n const prevIndex = this._index;\n this._setActiveTabLink(tabLink);\n this._syncPanels();\n this._setTabsAndTabWidth();\n this._animateIndicator(prevIndex);\n return this._notifyShow();\n }\n\n // After the old panel is hidden, so a listener sees one active panel.\n private _notifyShow(): boolean {\n const panel = this._content;\n return this._notify('change', this.options.onShow, { args: [panel], detail: { panel }, current: () => this._content === panel });\n }\n\n _setupNormalTabs() {\n // Hide Tabs Content\n Array.from(this._tabLinks).forEach((a) => {\n if (a === this._activeTabLink) return;\n const currContent = this._panelFor(a);\n if (currContent) currContent.style.display = 'none';\n });\n }\n\n _setTabsAndTabWidth() {\n this._tabsWidth = this.el.getBoundingClientRect().width;\n this._tabWidth = Math.max(this._tabsWidth, this.el.scrollWidth) / this._tabLinks.length;\n }\n\n _calcRightPos(el) {\n return Math.ceil(this._tabsWidth - el.offsetLeft - el.getBoundingClientRect().width);\n }\n\n _calcLeftPos(el) {\n return Math.floor(el.offsetLeft);\n }\n\n /**\n * Recalculate tab indicator position. This is useful when\n * the indicator position is not correct.\n */\n updateTabIndicator() {\n this._setTabsAndTabWidth();\n this._animateIndicator(this._index);\n }\n\n _animateIndicator(prevIndex) {\n // The trailing edge waits 30% of the move, so the bar stretches toward\n // the new tab before it shrinks. On the spring tokens that delay scales\n // with the spring and drops to 0 with it under reduced motion.\n const ms = this.options.duration;\n const timing = ms == null\n ? ['var(--md-comp-tabs-indicator-duration) var(--md-comp-tabs-indicator-easing)', 'calc(var(--md-comp-tabs-indicator-duration) * 0.3)']\n : [`${ms}ms ease-out`, `${ms * 0.3}ms`];\n const [leftDelay, rightDelay] = this._index - prevIndex >= 0 ? [timing[1], '0s'] : ['0s', timing[1]];\n this._indicator.style.transition = `left ${timing[0]} ${leftDelay}, right ${timing[0]} ${rightDelay}`;\n\n this._positionIndicator();\n }\n\n /**\n * Show tab content that corresponds to the tab with the id.\n * @param tabId The id of the tab that you want to switch to.\n */\n select(tabId: string) {\n const tab = Array.from(this._tabLinks).find(a => a.getAttribute('href') === '#' + tabId);\n if (tab) tab.click();\n }\n}\n"],
|
|
5
|
+
"mappings": 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
|
6
|
+
var states = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
var anchor = "--tour-target";
|
|
8
|
+
var _Tour = class _Tour {
|
|
9
|
+
static Init() {
|
|
10
|
+
if (_Tour._initialized || typeof document === "undefined") return;
|
|
11
|
+
_Tour._initialized = true;
|
|
12
|
+
document.addEventListener("click", _Tour._onClick);
|
|
13
|
+
document.addEventListener("keydown", (e) => {
|
|
14
|
+
const tour = Utils.closestInPath(e, ".tour");
|
|
15
|
+
if (e.key === "Escape" && tour instanceof HTMLElement && states.has(tour)) _Tour.end(tour);
|
|
16
|
+
});
|
|
17
|
+
document.addEventListener(
|
|
18
|
+
"toggle",
|
|
19
|
+
(e) => {
|
|
20
|
+
const tour = e.target;
|
|
21
|
+
if (e.newState === "closed" && states.has(tour)) _Tour.end(tour);
|
|
22
|
+
},
|
|
23
|
+
true
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
/** Opens the tour at a step. Does nothing when no step has a visible target. */
|
|
27
|
+
static start(tour, index = 0) {
|
|
28
|
+
const steps = [...tour.querySelectorAll(":scope > section[data-tour-target]")].filter(
|
|
29
|
+
(step) => _Tour._target(step)?.checkVisibility()
|
|
30
|
+
);
|
|
31
|
+
if (!steps.length) return;
|
|
32
|
+
const previous = states.get(tour);
|
|
33
|
+
if (previous) _Tour._release(previous.steps[previous.index]);
|
|
34
|
+
const state = { steps, index: 0, opener: _Tour._opener(tour, previous) };
|
|
35
|
+
states.set(tour, state);
|
|
36
|
+
_Tour._show(tour, !previous);
|
|
37
|
+
if (states.get(tour) === state) _Tour.go(tour, index);
|
|
38
|
+
}
|
|
39
|
+
/** Where focus returns at the end: the first start's focus, kept across restarts. */
|
|
40
|
+
static _opener(tour, previous) {
|
|
41
|
+
if (previous?.opener) return previous.opener;
|
|
42
|
+
const active = tour.getRootNode().activeElement;
|
|
43
|
+
return active instanceof HTMLElement ? active : null;
|
|
44
|
+
}
|
|
45
|
+
/** Shows the card, and reports the start of a tour that was not running. */
|
|
46
|
+
static _show(tour, opening) {
|
|
47
|
+
if (!tour.matches(":popover-open")) tour.showPopover();
|
|
48
|
+
if (opening) Utils.emit(tour, "open");
|
|
49
|
+
}
|
|
50
|
+
/** Shows step `index` of a running tour. */
|
|
51
|
+
static go(tour, index) {
|
|
52
|
+
const state = states.get(tour);
|
|
53
|
+
if (!state) return;
|
|
54
|
+
_Tour._release(state.steps[state.index]);
|
|
55
|
+
index = Math.min(Math.max(index, 0), state.steps.length - 1);
|
|
56
|
+
const travel = index < state.index ? -1 : 1;
|
|
57
|
+
while (state.steps[index] && !_Tour._target(state.steps[index])) index += travel;
|
|
58
|
+
const step = state.steps[index];
|
|
59
|
+
if (!step) {
|
|
60
|
+
_Tour.end(tour);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
state.index = index;
|
|
64
|
+
const last = state.index === state.steps.length - 1;
|
|
65
|
+
tour.querySelectorAll(":scope > section[data-tour-target]").forEach((section) => {
|
|
66
|
+
section.hidden = section !== step;
|
|
67
|
+
});
|
|
68
|
+
const heading = step.querySelector("h1, h2, h3, h4, h5, h6");
|
|
69
|
+
if (heading) {
|
|
70
|
+
if (!heading.id) heading.id = `tour-${Utils.guid()}`;
|
|
71
|
+
tour.setAttribute("aria-labelledby", heading.id);
|
|
72
|
+
}
|
|
73
|
+
const progress = tour.querySelector(".tour-progress");
|
|
74
|
+
if (progress) {
|
|
75
|
+
progress.textContent = _Tour.i18n.progress.replace("{current}", String(state.index + 1)).replace("{total}", String(state.steps.length));
|
|
76
|
+
}
|
|
77
|
+
const toggle = (selector, show) => tour.querySelectorAll(selector).forEach((button) => button.hidden = !show);
|
|
78
|
+
toggle("[data-tour-back]", state.index > 0);
|
|
79
|
+
toggle("[data-tour-next]", !last);
|
|
80
|
+
toggle("[data-tour-done]", last);
|
|
81
|
+
const target = _Tour._target(step);
|
|
82
|
+
target.classList.add("tour-target");
|
|
83
|
+
Utils.setAnchorName(target, anchor, true);
|
|
84
|
+
const smooth = !matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
85
|
+
target.scrollIntoView({ block: "center", behavior: smooth ? "smooth" : "auto" });
|
|
86
|
+
if (!tour.hasAttribute("tabindex")) tour.tabIndex = -1;
|
|
87
|
+
tour.focus({ preventScroll: true });
|
|
88
|
+
Utils.emit(tour, "change", { step, index: state.index });
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Ends a running tour and returns focus to where it was. `completed` says
|
|
92
|
+
* the user finished it, as the done button does, rather than dismissed it.
|
|
93
|
+
*/
|
|
94
|
+
static end(tour, completed = false) {
|
|
95
|
+
const state = states.get(tour);
|
|
96
|
+
if (!state) return;
|
|
97
|
+
_Tour._release(state.steps[state.index]);
|
|
98
|
+
states.delete(tour);
|
|
99
|
+
if (tour.matches(":popover-open")) tour.hidePopover();
|
|
100
|
+
state.opener?.focus();
|
|
101
|
+
Utils.emit(tour, "close", { completed });
|
|
102
|
+
}
|
|
103
|
+
static _target(step) {
|
|
104
|
+
return Utils.getElementById(step, step.getAttribute("data-tour-target") ?? "");
|
|
105
|
+
}
|
|
106
|
+
static _release(step) {
|
|
107
|
+
const target = step && _Tour._target(step);
|
|
108
|
+
target?.classList.remove("tour-target");
|
|
109
|
+
if (target) Utils.setAnchorName(target, anchor, false);
|
|
110
|
+
}
|
|
111
|
+
static _onClick(e) {
|
|
112
|
+
const control = Utils.closestInPath(
|
|
113
|
+
e,
|
|
114
|
+
"[data-tour-start], [data-tour-back], [data-tour-next], [data-tour-done], [data-tour-close]"
|
|
115
|
+
);
|
|
116
|
+
if (!control) return;
|
|
117
|
+
if (control.hasAttribute("data-tour-start")) {
|
|
118
|
+
const tour2 = Utils.getElementById(control, control.getAttribute("data-tour-start"));
|
|
119
|
+
if (tour2?.matches(".tour")) _Tour.start(tour2);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const tour = control.closest(".tour");
|
|
123
|
+
const state = tour && states.get(tour);
|
|
124
|
+
if (!state) return;
|
|
125
|
+
if (control.hasAttribute("data-tour-back")) _Tour.go(tour, state.index - 1);
|
|
126
|
+
else if (control.hasAttribute("data-tour-next")) _Tour.go(tour, state.index + 1);
|
|
127
|
+
else _Tour.end(tour, control.hasAttribute("data-tour-done"));
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
_Tour.i18n = { progress: "Step {current} of {total}" };
|
|
131
|
+
_Tour._initialized = false;
|
|
132
|
+
var Tour = _Tour;
|
|
133
|
+
|
|
134
|
+
export {
|
|
135
|
+
Tour
|
|
136
|
+
};
|
|
137
|
+
//# sourceMappingURL=chunk-NAC72P7R.mjs.map
|