@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,342 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FormSelect
|
|
3
|
+
} from "./chunk-EVCVFEV3.mjs";
|
|
4
|
+
import {
|
|
5
|
+
Utils
|
|
6
|
+
} from "./chunk-ZVLOUDIJ.mjs";
|
|
7
|
+
|
|
8
|
+
// src/ts/components/treeSelect.ts
|
|
9
|
+
function optionTree(options) {
|
|
10
|
+
const byValue = /* @__PURE__ */ new Map();
|
|
11
|
+
options.forEach((option) => {
|
|
12
|
+
if (!byValue.has(option.value)) byValue.set(option.value, option);
|
|
13
|
+
});
|
|
14
|
+
const parentOf = (option) => byValue.get(option.dataset.parent || void 0);
|
|
15
|
+
const loops = (option) => {
|
|
16
|
+
let parent = parentOf(option);
|
|
17
|
+
for (let steps = 0; parent && parent !== option && steps < options.length; steps++) parent = parentOf(parent);
|
|
18
|
+
return parent === option;
|
|
19
|
+
};
|
|
20
|
+
const nodes = new Map(options.map((option) => [option, { option, children: [] }]));
|
|
21
|
+
const roots = [];
|
|
22
|
+
options.forEach((option) => {
|
|
23
|
+
const parent = loops(option) ? void 0 : parentOf(option);
|
|
24
|
+
(parent ? nodes.get(parent).children : roots).push(nodes.get(option));
|
|
25
|
+
});
|
|
26
|
+
return roots;
|
|
27
|
+
}
|
|
28
|
+
var STEPS = { ArrowUp: -1, ArrowDown: 1 };
|
|
29
|
+
var move = (tree, _row, e) => tree._focusRow(Utils.focusTarget(tree._visibleRows(), e, STEPS));
|
|
30
|
+
var activate = (tree, row) => tree._activate(row);
|
|
31
|
+
var TREE_KEYS = {
|
|
32
|
+
ArrowDown: move,
|
|
33
|
+
ArrowUp: move,
|
|
34
|
+
Home: move,
|
|
35
|
+
End: move,
|
|
36
|
+
ArrowRight: (tree, row) => tree._openOrEnter(row),
|
|
37
|
+
ArrowLeft: (tree, row) => tree._closeOrLeave(row),
|
|
38
|
+
"*": (tree, row) => tree._openSiblings(row),
|
|
39
|
+
Enter: activate,
|
|
40
|
+
" ": activate
|
|
41
|
+
};
|
|
42
|
+
var typeahead = (tree, row, e) => tree._typeahead(row, e.key);
|
|
43
|
+
var MIRRORED = { ArrowLeft: "ArrowRight", ArrowRight: "ArrowLeft" };
|
|
44
|
+
var TreeSelect = class extends FormSelect {
|
|
45
|
+
constructor(el, options) {
|
|
46
|
+
super(el, options);
|
|
47
|
+
/** What typeahead has read so far, and the timer that clears it. */
|
|
48
|
+
this._typed = "";
|
|
49
|
+
this._handleTreeKeydown = Utils.ignoringComposition((e) => {
|
|
50
|
+
const row = Utils.eventTarget(e)?.closest('li[role="treeitem"]');
|
|
51
|
+
const action = row && this._keyFor(e);
|
|
52
|
+
if (!action) return;
|
|
53
|
+
e.preventDefault();
|
|
54
|
+
e.stopPropagation();
|
|
55
|
+
action(this, row, e);
|
|
56
|
+
});
|
|
57
|
+
// Only a row's label acts. A disabled row passes clicks through to its
|
|
58
|
+
// group, which must not toggle the branch around it.
|
|
59
|
+
this._handleTreeClick = (e) => {
|
|
60
|
+
const target = Utils.eventTarget(e);
|
|
61
|
+
if (!this.tree.contains(target)) return;
|
|
62
|
+
const label = target.closest('li[role="treeitem"] > span');
|
|
63
|
+
e.preventDefault();
|
|
64
|
+
e.stopPropagation();
|
|
65
|
+
if (label) this._activate(label.parentElement);
|
|
66
|
+
};
|
|
67
|
+
if (!this.menuEl) return;
|
|
68
|
+
const { signal } = this._events;
|
|
69
|
+
if (!this._searchInput) {
|
|
70
|
+
this.menuEl.setAttribute("role", "presentation");
|
|
71
|
+
this.input.setAttribute("aria-haspopup", "tree");
|
|
72
|
+
this.input.setAttribute("aria-controls", this.tree.id);
|
|
73
|
+
}
|
|
74
|
+
this.menuEl.removeAttribute("aria-multiselectable");
|
|
75
|
+
this._nameTree();
|
|
76
|
+
this._leaveImplicitBranch();
|
|
77
|
+
this._handleSelectChange();
|
|
78
|
+
if (!this._searchInput) this.menuEl.addEventListener("keydown", this._handleTreeKeydown, { signal, capture: true });
|
|
79
|
+
this.menuEl.addEventListener("click", this._handleTreeClick, { signal, capture: true });
|
|
80
|
+
}
|
|
81
|
+
_setValueToInput() {
|
|
82
|
+
if (this.isMultiple) this._branches.forEach((option) => {
|
|
83
|
+
option.selected = false;
|
|
84
|
+
});
|
|
85
|
+
super._setValueToInput();
|
|
86
|
+
}
|
|
87
|
+
_canSearch() {
|
|
88
|
+
return this.options.searchable;
|
|
89
|
+
}
|
|
90
|
+
_searchList() {
|
|
91
|
+
return this.tree;
|
|
92
|
+
}
|
|
93
|
+
_searchRows() {
|
|
94
|
+
return this._enabledRows();
|
|
95
|
+
}
|
|
96
|
+
_filterSearch(query) {
|
|
97
|
+
const matches = this._matchingRows(query);
|
|
98
|
+
this.tree.querySelectorAll('li[role="treeitem"]').forEach((row) => {
|
|
99
|
+
row.hidden = !matches.has(row);
|
|
100
|
+
});
|
|
101
|
+
this._searchExpansion(query);
|
|
102
|
+
}
|
|
103
|
+
_matchingRows(query) {
|
|
104
|
+
const matches = /* @__PURE__ */ new Set();
|
|
105
|
+
this._values.filter(({ el }) => el.textContent.trim().toLowerCase().includes(query)).forEach(({ optionEl }) => {
|
|
106
|
+
for (let row = optionEl; row; row = this._parentRow(row)) matches.add(row);
|
|
107
|
+
});
|
|
108
|
+
return matches;
|
|
109
|
+
}
|
|
110
|
+
_searchExpansion(query) {
|
|
111
|
+
if (query) {
|
|
112
|
+
this._searchOpen ?? (this._searchOpen = this._openValues());
|
|
113
|
+
this._branches.forEach((_option, row) => {
|
|
114
|
+
if (!row.hidden) this._setExpanded(row, true);
|
|
115
|
+
});
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const saved = this._searchOpen;
|
|
119
|
+
this._searchOpen = void 0;
|
|
120
|
+
if (saved) this._branches.forEach((option, row) => this._setExpanded(row, saved.has(option.value)));
|
|
121
|
+
}
|
|
122
|
+
_searchNavigate(e) {
|
|
123
|
+
if (e.target === this._searchInput) super._searchNavigate(e);
|
|
124
|
+
else this._handleTreeKeydown(e);
|
|
125
|
+
}
|
|
126
|
+
destroy() {
|
|
127
|
+
clearTimeout(this._typedTimer);
|
|
128
|
+
this._restoreBranches();
|
|
129
|
+
super.destroy();
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Rebuilds the tree from the native options, keeping open each branch whose
|
|
133
|
+
* value is still there and, while the popup is open, focus on the same row.
|
|
134
|
+
*/
|
|
135
|
+
refresh() {
|
|
136
|
+
const focused = this._focusedOption();
|
|
137
|
+
this._keepOpen = this._searchOpen ?? this._openValues();
|
|
138
|
+
super.refresh();
|
|
139
|
+
this._keepOpen = void 0;
|
|
140
|
+
this._restoreOpenFocus(focused);
|
|
141
|
+
}
|
|
142
|
+
_restoreOpenFocus(option) {
|
|
143
|
+
if (option && this.menu?.isOpen) this._restoreFocus(option);
|
|
144
|
+
}
|
|
145
|
+
/** The option whose row has focus, if one does. */
|
|
146
|
+
_focusedOption() {
|
|
147
|
+
const root = this.menuEl?.getRootNode();
|
|
148
|
+
return this._optionOf(root?.activeElement?.closest('li[role="treeitem"]'));
|
|
149
|
+
}
|
|
150
|
+
/** The values of the open branches. */
|
|
151
|
+
_openValues() {
|
|
152
|
+
return new Set(Array.from(this._branches ?? [], ([li, option]) => li.ariaExpanded === "true" ? option.value : null));
|
|
153
|
+
}
|
|
154
|
+
/** Focuses the row for `option` again, or the first enabled row once it is gone or disabled, or the field. */
|
|
155
|
+
_restoreFocus(option) {
|
|
156
|
+
const row = this._rowOf(option);
|
|
157
|
+
this._expandTo(row);
|
|
158
|
+
const rows = this._enabledRows();
|
|
159
|
+
const target = rows.includes(row) ? row : rows[0];
|
|
160
|
+
if (target) this._focusRow(target);
|
|
161
|
+
else (this._searchInput ?? this.input).focus();
|
|
162
|
+
}
|
|
163
|
+
/** Names the tree as the field is named: aria-labelledby, then aria-label, then its labels. */
|
|
164
|
+
_nameTree() {
|
|
165
|
+
const { input } = this;
|
|
166
|
+
if (input.hasAttribute("aria-labelledby")) this.tree.setAttribute("aria-labelledby", input.getAttribute("aria-labelledby"));
|
|
167
|
+
else if (input.ariaLabel) this.tree.ariaLabel = input.ariaLabel;
|
|
168
|
+
else this._labelTree();
|
|
169
|
+
}
|
|
170
|
+
_labelTree() {
|
|
171
|
+
const ids = Array.from(this.input.labels ?? [], (label, index) => label.id || (label.id = `${this.input.id}-label-${index}`));
|
|
172
|
+
if (ids.length) this.tree.setAttribute("aria-labelledby", ids.join(" "));
|
|
173
|
+
}
|
|
174
|
+
// The tree takes its keys and clicks on the menu itself.
|
|
175
|
+
_setupOptionHandlers() {
|
|
176
|
+
}
|
|
177
|
+
_buildOptions() {
|
|
178
|
+
this._restoreBranches();
|
|
179
|
+
this._branches = /* @__PURE__ */ new Map();
|
|
180
|
+
this.selectOptions = this._nativeOptions();
|
|
181
|
+
this._values = [];
|
|
182
|
+
const options = this.selectOptions.filter((option) => option.tagName === "OPTION");
|
|
183
|
+
if (!this.tree) {
|
|
184
|
+
this.tree = document.createElement("ul");
|
|
185
|
+
this.tree.id = "select-tree-" + Utils.guid();
|
|
186
|
+
this.tree.setAttribute("role", "tree");
|
|
187
|
+
}
|
|
188
|
+
this.tree.ariaMultiSelectable = String(this.isMultiple);
|
|
189
|
+
this.tree.replaceChildren(...optionTree(options).map((node) => this._row(node)));
|
|
190
|
+
this.menuEl.append(this.tree);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* A select with no selected option picks its first one, which is often a
|
|
194
|
+
* branch, and disabling the branch does not move the selection. Unless the
|
|
195
|
+
* markup selected it, move to the option a form reset would pick now that
|
|
196
|
+
* branches are disabled: the first enabled leaf, or none. Only on start:
|
|
197
|
+
* after that a selected branch is one a script chose.
|
|
198
|
+
*/
|
|
199
|
+
_leaveImplicitBranch() {
|
|
200
|
+
if (this.isMultiple || !this._browserPickedBranch()) return;
|
|
201
|
+
const leaf = Array.from(this.el.options).find((option) => !option.disabled);
|
|
202
|
+
if (leaf) leaf.selected = true;
|
|
203
|
+
else this.el.selectedIndex = -1;
|
|
204
|
+
}
|
|
205
|
+
/** Whether the selection is a branch this disabled, which the markup did not select. */
|
|
206
|
+
_browserPickedBranch() {
|
|
207
|
+
const chosen = this.el.selectedOptions[0];
|
|
208
|
+
return !!chosen && !chosen.defaultSelected && this._disabledBranches.has(chosen);
|
|
209
|
+
}
|
|
210
|
+
_row(node) {
|
|
211
|
+
const li = document.createElement("li");
|
|
212
|
+
li.id = "select-option-" + Utils.guid();
|
|
213
|
+
li.setAttribute("role", "treeitem");
|
|
214
|
+
li.tabIndex = -1;
|
|
215
|
+
const label = document.createElement("span");
|
|
216
|
+
label.textContent = node.option.textContent;
|
|
217
|
+
li.append(label);
|
|
218
|
+
if (node.children.length) this._branch(li, node);
|
|
219
|
+
else this._leaf(li, node.option);
|
|
220
|
+
return li;
|
|
221
|
+
}
|
|
222
|
+
_branch(li, node) {
|
|
223
|
+
const group = document.createElement("ul");
|
|
224
|
+
group.setAttribute("role", "group");
|
|
225
|
+
group.append(...node.children.map((child) => this._row(child)));
|
|
226
|
+
li.append(group);
|
|
227
|
+
this._setExpanded(li, !!this._keepOpen?.has(node.option.value));
|
|
228
|
+
this._branches.set(li, node.option);
|
|
229
|
+
if (node.option.disabled) return;
|
|
230
|
+
node.option.disabled = true;
|
|
231
|
+
this._disabledBranches.add(node.option);
|
|
232
|
+
}
|
|
233
|
+
_leaf(li, option) {
|
|
234
|
+
if (this.el.matches(":disabled") || option.disabled) {
|
|
235
|
+
li.classList.add("disabled");
|
|
236
|
+
li.ariaDisabled = "true";
|
|
237
|
+
}
|
|
238
|
+
this._values.push({ el: option, optionEl: li });
|
|
239
|
+
}
|
|
240
|
+
_restoreBranches() {
|
|
241
|
+
this._disabledBranches?.forEach((option) => {
|
|
242
|
+
option.disabled = false;
|
|
243
|
+
});
|
|
244
|
+
this._disabledBranches = /* @__PURE__ */ new Set();
|
|
245
|
+
}
|
|
246
|
+
_setExpanded(li, open) {
|
|
247
|
+
li.ariaExpanded = String(open);
|
|
248
|
+
li.querySelector(":scope > ul").hidden = !open;
|
|
249
|
+
}
|
|
250
|
+
/** The rows not inside a closed branch, in document order. */
|
|
251
|
+
_visibleRows() {
|
|
252
|
+
return Array.from(this.tree.querySelectorAll('li[role="treeitem"]')).filter((li) => !li.closest("[hidden]"));
|
|
253
|
+
}
|
|
254
|
+
_enabledRows() {
|
|
255
|
+
return this._visibleRows().filter((row) => !row.matches(".disabled"));
|
|
256
|
+
}
|
|
257
|
+
_focusRow(row) {
|
|
258
|
+
row?.focus({ preventScroll: true });
|
|
259
|
+
row?.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
260
|
+
}
|
|
261
|
+
/** Opens the chosen leaf's branches and focuses it, or the first row a person can choose or open. */
|
|
262
|
+
_focusSelected() {
|
|
263
|
+
if (!this.menu.options.autoFocus || Utils.focusIsIn(this.menuEl)) return;
|
|
264
|
+
const chosen = this._values.find(({ el, optionEl }) => el.selected && !optionEl.matches(".disabled"));
|
|
265
|
+
this._restoreFocus(chosen?.el);
|
|
266
|
+
}
|
|
267
|
+
/** Opens every branch around `row`. */
|
|
268
|
+
_expandTo(row) {
|
|
269
|
+
for (let branch = this._parentRow(row); branch; branch = this._parentRow(branch)) this._setExpanded(branch, true);
|
|
270
|
+
}
|
|
271
|
+
/** The branch row holding `row`, never an element outside the tree. */
|
|
272
|
+
_parentRow(row) {
|
|
273
|
+
const parent = row?.parentElement.closest('li[role="treeitem"]');
|
|
274
|
+
return this._branches.has(parent) ? parent : null;
|
|
275
|
+
}
|
|
276
|
+
_optionOf(row) {
|
|
277
|
+
return this._branches?.get(row) ?? this._values?.find(({ optionEl }) => optionEl === row)?.el;
|
|
278
|
+
}
|
|
279
|
+
_rowOf(option) {
|
|
280
|
+
const branch = Array.from(this._branches).find(([, branchOption]) => branchOption === option)?.[0];
|
|
281
|
+
return branch ?? this._values.find(({ el }) => el === option)?.optionEl;
|
|
282
|
+
}
|
|
283
|
+
/** Chooses a leaf, or opens or closes a branch. */
|
|
284
|
+
_activate(row) {
|
|
285
|
+
if (row.closest("[hidden]")) return;
|
|
286
|
+
if (this._branches.has(row)) this._toggle(row, row.ariaExpanded !== "true");
|
|
287
|
+
else this._selectOptionElement(row);
|
|
288
|
+
}
|
|
289
|
+
/** Opens a closed branch, or moves into an open one. */
|
|
290
|
+
_openOrEnter(row) {
|
|
291
|
+
if (!this._branches.has(row)) return;
|
|
292
|
+
if (row.ariaExpanded !== "true") this._toggle(row, true);
|
|
293
|
+
else this._focusRow(row.querySelector(":scope > ul > li:not(.disabled, [hidden])"));
|
|
294
|
+
}
|
|
295
|
+
/** Closes an open branch, or moves to the parent row. */
|
|
296
|
+
_closeOrLeave(row) {
|
|
297
|
+
if (row.ariaExpanded === "true") this._toggle(row, false);
|
|
298
|
+
else this._focusRow(this._parentRow(row));
|
|
299
|
+
}
|
|
300
|
+
/** Opens every branch beside `row`. */
|
|
301
|
+
_openSiblings(row) {
|
|
302
|
+
Array.from(row.parentElement.children).forEach((sibling) => {
|
|
303
|
+
if (this._branches.has(sibling) && !sibling.hasAttribute("hidden")) this._toggle(sibling, true);
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Moves to the next row whose text starts with the characters typed in the
|
|
308
|
+
* last second, as Menu's typeahead does. A repeated search starts on the
|
|
309
|
+
* focused row, so typing more of its text keeps it.
|
|
310
|
+
*/
|
|
311
|
+
_typeahead(row, key) {
|
|
312
|
+
clearTimeout(this._typedTimer);
|
|
313
|
+
this._typed += key.toLowerCase();
|
|
314
|
+
this._typedTimer = setTimeout(() => {
|
|
315
|
+
this._typed = "";
|
|
316
|
+
}, 1e3);
|
|
317
|
+
const rows = this._enabledRows();
|
|
318
|
+
const from = rows.indexOf(row) + (this._typed.length === 1 ? 1 : 0);
|
|
319
|
+
const match = [...rows.slice(from), ...rows.slice(0, from)].find((candidate) => candidate.firstChild.textContent.trim().toLowerCase().startsWith(this._typed));
|
|
320
|
+
this._focusRow(match);
|
|
321
|
+
}
|
|
322
|
+
_toggle(row, open) {
|
|
323
|
+
this._setExpanded(row, open);
|
|
324
|
+
if (this.menu?.isOpen) this.menu.recalculateDimensions();
|
|
325
|
+
}
|
|
326
|
+
_keyFor(e) {
|
|
327
|
+
if (!Utils.plainKey(e)) return void 0;
|
|
328
|
+
return TREE_KEYS[this._logicalKey(e.key)] ?? (e.key.length === 1 ? typeahead : void 0);
|
|
329
|
+
}
|
|
330
|
+
/** The key as in a left-to-right tree. */
|
|
331
|
+
_logicalKey(key) {
|
|
332
|
+
const rtl = getComputedStyle(this.tree).direction === "rtl";
|
|
333
|
+
return rtl && MIRRORED[key] || key;
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
TreeSelect.key = "Expressive_TreeSelect";
|
|
337
|
+
|
|
338
|
+
export {
|
|
339
|
+
optionTree,
|
|
340
|
+
TreeSelect
|
|
341
|
+
};
|
|
342
|
+
//# sourceMappingURL=chunk-GCWWEZKO.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/ts/components/treeSelect.ts"],
|
|
4
|
+
"sourcesContent": ["import { Utils } from '../core/utils';\nimport { FormSelect, FormSelectOptions } from './select';\n\n// Tree select. A native <select data-tree> whose options name their parent's\n// value in data-parent. The native select still owns the form value, reset,\n// validity and disabled state; this builds a role=\"tree\" popup over it, where\n// only a leaf can be chosen.\n\n/** An option and the options that name it as their parent. */\nexport interface OptionNode {\n option: HTMLOptionElement;\n children: OptionNode[];\n}\n\n/**\n * Turns flat options into a tree. An option sits under the first option whose\n * value its `data-parent` names. It is a root when that is empty, names no\n * option, or starts a chain of parents that comes back to the option itself;\n * its own children stay under it. Siblings keep document order.\n */\nexport function optionTree(options: HTMLOptionElement[]): OptionNode[] {\n const byValue = new Map<string, HTMLOptionElement>();\n options.forEach((option) => { if (!byValue.has(option.value)) byValue.set(option.value, option); });\n const parentOf = (option: HTMLOptionElement) => byValue.get(option.dataset.parent || undefined);\n // ponytail: walks each option's whole chain, fine for a select's few hundred options.\n const loops = (option: HTMLOptionElement) => {\n let parent = parentOf(option);\n for (let steps = 0; parent && parent !== option && steps < options.length; steps++) parent = parentOf(parent);\n return parent === option;\n };\n const nodes = new Map(options.map((option) => [option, { option, children: [] as OptionNode[] }]));\n const roots: OptionNode[] = [];\n options.forEach((option) => {\n const parent = loops(option) ? undefined : parentOf(option);\n (parent ? nodes.get(parent).children : roots).push(nodes.get(option));\n });\n return roots;\n}\n\ntype TreeKey = (tree: TreeSelect, row: HTMLElement, e: KeyboardEvent) => void;\n\n/** Up and Down move a visible row; Home and End go to the ends. */\nconst STEPS = { ArrowUp: -1, ArrowDown: 1 };\nconst move: TreeKey = (tree, _row, e) => tree._focusRow(Utils.focusTarget(tree._visibleRows(), e, STEPS));\nconst activate: TreeKey = (tree, row) => tree._activate(row);\n\n/** What each key does to the focused row, with the arrows as in a left-to-right tree. */\nconst TREE_KEYS: Record<string, TreeKey> = {\n ArrowDown: move,\n ArrowUp: move,\n Home: move,\n End: move,\n ArrowRight: (tree, row) => tree._openOrEnter(row),\n ArrowLeft: (tree, row) => tree._closeOrLeave(row),\n '*': (tree, row) => tree._openSiblings(row),\n Enter: activate,\n ' ': activate\n};\n\n/** Any other single character searches the rows' text. */\nconst typeahead: TreeKey = (tree, row, e) => tree._typeahead(row, e.key);\n\n/** In a right-to-left tree the arrows that open and close swap. */\nconst MIRRORED: Record<string, string> = { ArrowLeft: 'ArrowRight', ArrowRight: 'ArrowLeft' };\n\nexport class TreeSelect extends FormSelect {\n /**\n * The role=\"tree\" list inside the Menu surface. Menu styles the rows of its\n * <menu> directly, so the tree keeps its rows one list further down.\n */\n tree: HTMLUListElement;\n /** Each branch row and the option it stands for. */\n private _branches: Map<HTMLElement, HTMLOptionElement>;\n /** Branch options this disabled, so the form never submits one. */\n private _disabledBranches: Set<HTMLOptionElement>;\n /** While refresh() rebuilds the rows, the values of the branches left open. */\n private _keepOpen: Set<string> | undefined;\n /** Expansion before the first nonempty query, retained across query edits. */\n private _searchOpen: Set<string> | undefined;\n /** What typeahead has read so far, and the timer that clears it. */\n private _typed = '';\n private _typedTimer: ReturnType<typeof setTimeout>;\n\n constructor(el: HTMLSelectElement, options: Partial<FormSelectOptions>) {\n super(el, options as FormSelectOptions);\n // A browser-default select stays native.\n if (!this.menuEl) return;\n const { signal } = this._events;\n if (!this._searchInput) {\n this.menuEl.setAttribute('role', 'presentation');\n this.input.setAttribute('aria-haspopup', 'tree');\n this.input.setAttribute('aria-controls', this.tree.id);\n }\n this.menuEl.removeAttribute('aria-multiselectable');\n this._nameTree();\n this._leaveImplicitBranch();\n this._handleSelectChange();\n // Capture, so the tree's keys and clicks are handled before Menu's own\n // listeners on the same element.\n if (!this._searchInput) this.menuEl.addEventListener('keydown', this._handleTreeKeydown, { signal, capture: true });\n this.menuEl.addEventListener('click', this._handleTreeClick, { signal, capture: true });\n }\n\n static key = 'Expressive_TreeSelect';\n\n _setValueToInput() {\n // Branches are navigation controls, not multiple-select values.\n if (this.isMultiple) this._branches.forEach(option => { option.selected = false; });\n super._setValueToInput();\n }\n\n protected _canSearch() {\n return this.options.searchable;\n }\n\n protected _searchList() { return this.tree; }\n\n protected _searchRows() { return this._enabledRows(); }\n\n protected _filterSearch(query: string) {\n const matches = this._matchingRows(query);\n this.tree.querySelectorAll<HTMLElement>('li[role=\"treeitem\"]').forEach(row => { row.hidden = !matches.has(row); });\n this._searchExpansion(query);\n }\n\n private _matchingRows(query: string) {\n const matches = new Set<HTMLElement>();\n this._values.filter(({ el }) => el.textContent.trim().toLowerCase().includes(query)).forEach(({ optionEl }) => {\n for (let row = optionEl; row; row = this._parentRow(row)) matches.add(row);\n });\n return matches;\n }\n\n private _searchExpansion(query: string) {\n if (query) {\n this._searchOpen ??= this._openValues();\n this._branches.forEach((_option, row) => { if (!row.hidden) this._setExpanded(row, true); });\n return;\n }\n const saved = this._searchOpen;\n this._searchOpen = undefined;\n if (saved) this._branches.forEach((option, row) => this._setExpanded(row, saved.has(option.value)));\n }\n\n protected _searchNavigate(e: KeyboardEvent) {\n if (e.target === this._searchInput) super._searchNavigate(e);\n else this._handleTreeKeydown(e);\n }\n\n destroy() {\n clearTimeout(this._typedTimer);\n this._restoreBranches();\n super.destroy();\n }\n\n /**\n * Rebuilds the tree from the native options, keeping open each branch whose\n * value is still there and, while the popup is open, focus on the same row.\n */\n refresh() {\n const focused = this._focusedOption();\n this._keepOpen = this._searchOpen ?? this._openValues();\n super.refresh();\n this._keepOpen = undefined;\n this._restoreOpenFocus(focused);\n }\n\n private _restoreOpenFocus(option: HTMLOptionElement) {\n if (option && this.menu?.isOpen) this._restoreFocus(option);\n }\n\n /** The option whose row has focus, if one does. */\n private _focusedOption() {\n const root = this.menuEl?.getRootNode() as Document | ShadowRoot | undefined;\n return this._optionOf(root?.activeElement?.closest<HTMLElement>('li[role=\"treeitem\"]'));\n }\n\n /** The values of the open branches. */\n private _openValues() {\n return new Set(Array.from(this._branches ?? [], ([li, option]) => (li.ariaExpanded === 'true' ? option.value : null)));\n }\n\n /** Focuses the row for `option` again, or the first enabled row once it is gone or disabled, or the field. */\n private _restoreFocus(option: HTMLOptionElement) {\n const row = this._rowOf(option);\n this._expandTo(row);\n const rows = this._enabledRows();\n const target = rows.includes(row) ? row : rows[0];\n if (target) this._focusRow(target);\n else (this._searchInput ?? this.input).focus();\n }\n\n /** Names the tree as the field is named: aria-labelledby, then aria-label, then its labels. */\n private _nameTree() {\n const { input } = this;\n if (input.hasAttribute('aria-labelledby')) this.tree.setAttribute('aria-labelledby', input.getAttribute('aria-labelledby'));\n else if (input.ariaLabel) this.tree.ariaLabel = input.ariaLabel;\n else this._labelTree();\n }\n\n private _labelTree() {\n const ids = Array.from(this.input.labels ?? [], (label, index) => (label.id ||= `${this.input.id}-label-${index}`));\n if (ids.length) this.tree.setAttribute('aria-labelledby', ids.join(' '));\n }\n\n // The tree takes its keys and clicks on the menu itself.\n protected _setupOptionHandlers() {}\n\n protected _buildOptions() {\n this._restoreBranches();\n this._branches = new Map();\n this.selectOptions = this._nativeOptions();\n this._values = [];\n const options = this.selectOptions.filter((option): option is HTMLOptionElement => option.tagName === 'OPTION');\n // One list for the instance's life, so its name survives refresh().\n if (!this.tree) {\n this.tree = document.createElement('ul');\n this.tree.id = 'select-tree-' + Utils.guid();\n this.tree.setAttribute('role', 'tree');\n }\n this.tree.ariaMultiSelectable = String(this.isMultiple);\n this.tree.replaceChildren(...optionTree(options).map((node) => this._row(node)));\n this.menuEl.append(this.tree);\n }\n\n /**\n * A select with no selected option picks its first one, which is often a\n * branch, and disabling the branch does not move the selection. Unless the\n * markup selected it, move to the option a form reset would pick now that\n * branches are disabled: the first enabled leaf, or none. Only on start:\n * after that a selected branch is one a script chose.\n */\n private _leaveImplicitBranch() {\n if (this.isMultiple || !this._browserPickedBranch()) return;\n const leaf = Array.from(this.el.options).find((option) => !option.disabled);\n if (leaf) leaf.selected = true;\n else this.el.selectedIndex = -1;\n }\n\n /** Whether the selection is a branch this disabled, which the markup did not select. */\n private _browserPickedBranch() {\n const chosen = this.el.selectedOptions[0];\n return !!chosen && !chosen.defaultSelected && this._disabledBranches.has(chosen);\n }\n\n private _row(node: OptionNode): HTMLLIElement {\n const li = document.createElement('li');\n li.id = 'select-option-' + Utils.guid();\n li.setAttribute('role', 'treeitem');\n li.tabIndex = -1;\n const label = document.createElement('span');\n label.textContent = node.option.textContent;\n li.append(label);\n if (node.children.length) this._branch(li, node);\n else this._leaf(li, node.option);\n return li;\n }\n\n private _branch(li: HTMLLIElement, node: OptionNode) {\n const group = document.createElement('ul');\n group.setAttribute('role', 'group');\n group.append(...node.children.map((child) => this._row(child)));\n li.append(group);\n this._setExpanded(li, !!this._keepOpen?.has(node.option.value));\n this._branches.set(li, node.option);\n if (node.option.disabled) return;\n node.option.disabled = true;\n this._disabledBranches.add(node.option);\n }\n\n private _leaf(li: HTMLLIElement, option: HTMLOptionElement) {\n if (this.el.matches(':disabled') || option.disabled) {\n li.classList.add('disabled');\n li.ariaDisabled = 'true';\n }\n this._values.push({ el: option, optionEl: li });\n }\n\n private _restoreBranches() {\n this._disabledBranches?.forEach((option) => { option.disabled = false; });\n this._disabledBranches = new Set();\n }\n\n private _setExpanded(li: HTMLElement, open: boolean) {\n li.ariaExpanded = String(open);\n li.querySelector<HTMLElement>(':scope > ul').hidden = !open;\n }\n\n /** The rows not inside a closed branch, in document order. */\n _visibleRows(): HTMLElement[] {\n return Array.from(this.tree.querySelectorAll<HTMLElement>('li[role=\"treeitem\"]')).filter((li) => !li.closest('[hidden]'));\n }\n\n private _enabledRows() {\n return this._visibleRows().filter((row) => !row.matches('.disabled'));\n }\n\n _focusRow(row: HTMLElement | null | undefined) {\n row?.focus({ preventScroll: true });\n row?.scrollIntoView({ block: 'nearest', inline: 'nearest' });\n }\n\n /** Opens the chosen leaf's branches and focuses it, or the first row a person can choose or open. */\n protected _focusSelected() {\n // Opening may finish after the user has already focused a tree row.\n if (!this.menu.options.autoFocus || Utils.focusIsIn(this.menuEl)) return;\n const chosen = this._values.find(({ el, optionEl }) => el.selected && !optionEl.matches('.disabled'));\n this._restoreFocus(chosen?.el);\n }\n\n /** Opens every branch around `row`. */\n private _expandTo(row: HTMLElement | undefined) {\n for (let branch = this._parentRow(row); branch; branch = this._parentRow(branch)) this._setExpanded(branch, true);\n }\n\n /** The branch row holding `row`, never an element outside the tree. */\n private _parentRow(row: HTMLElement | null | undefined) {\n const parent = row?.parentElement.closest<HTMLElement>('li[role=\"treeitem\"]');\n return this._branches.has(parent) ? parent : null;\n }\n\n private _optionOf(row: HTMLElement | null | undefined) {\n return this._branches?.get(row) ?? this._values?.find(({ optionEl }) => optionEl === row)?.el;\n }\n\n private _rowOf(option: HTMLOptionElement | undefined) {\n const branch = Array.from(this._branches).find(([, branchOption]) => branchOption === option)?.[0];\n return branch ?? this._values.find(({ el }) => el === option)?.optionEl;\n }\n\n /** Chooses a leaf, or opens or closes a branch. */\n _activate(row: HTMLElement) {\n if (row.closest('[hidden]')) return;\n if (this._branches.has(row)) this._toggle(row, row.ariaExpanded !== 'true');\n else this._selectOptionElement(row);\n }\n\n /** Opens a closed branch, or moves into an open one. */\n _openOrEnter(row: HTMLElement) {\n if (!this._branches.has(row)) return;\n if (row.ariaExpanded !== 'true') this._toggle(row, true);\n else this._focusRow(row.querySelector<HTMLElement>(':scope > ul > li:not(.disabled, [hidden])'));\n }\n\n /** Closes an open branch, or moves to the parent row. */\n _closeOrLeave(row: HTMLElement) {\n if (row.ariaExpanded === 'true') this._toggle(row, false);\n else this._focusRow(this._parentRow(row));\n }\n\n /** Opens every branch beside `row`. */\n _openSiblings(row: HTMLElement) {\n Array.from(row.parentElement.children).forEach((sibling) => {\n if (this._branches.has(sibling as HTMLElement) && !sibling.hasAttribute('hidden')) this._toggle(sibling as HTMLElement, true);\n });\n }\n\n /**\n * Moves to the next row whose text starts with the characters typed in the\n * last second, as Menu's typeahead does. A repeated search starts on the\n * focused row, so typing more of its text keeps it.\n */\n _typeahead(row: HTMLElement, key: string) {\n clearTimeout(this._typedTimer);\n this._typed += key.toLowerCase();\n this._typedTimer = setTimeout(() => { this._typed = ''; }, 1000);\n const rows = this._enabledRows();\n const from = rows.indexOf(row) + (this._typed.length === 1 ? 1 : 0);\n const match = [...rows.slice(from), ...rows.slice(0, from)]\n .find((candidate) => candidate.firstChild.textContent.trim().toLowerCase().startsWith(this._typed));\n this._focusRow(match);\n }\n\n private _toggle(row: HTMLElement, open: boolean) {\n this._setExpanded(row, open);\n if (this.menu?.isOpen) this.menu.recalculateDimensions();\n }\n\n private _keyFor(e: KeyboardEvent): TreeKey | undefined {\n if (!Utils.plainKey(e)) return undefined;\n return TREE_KEYS[this._logicalKey(e.key)] ?? (e.key.length === 1 ? typeahead : undefined);\n }\n\n /** The key as in a left-to-right tree. */\n private _logicalKey(key: string) {\n const rtl = getComputedStyle(this.tree).direction === 'rtl';\n return (rtl && MIRRORED[key]) || key;\n }\n\n private _handleTreeKeydown = Utils.ignoringComposition((e: KeyboardEvent) => {\n const row = Utils.eventTarget(e)?.closest<HTMLElement>('li[role=\"treeitem\"]');\n const action = row && this._keyFor(e);\n if (!action) return;\n e.preventDefault();\n e.stopPropagation();\n action(this, row, e);\n });\n\n // Only a row's label acts. A disabled row passes clicks through to its\n // group, which must not toggle the branch around it.\n private _handleTreeClick = (e: MouseEvent) => {\n const target = Utils.eventTarget(e);\n if (!this.tree.contains(target)) return;\n const label = target.closest('li[role=\"treeitem\"] > span');\n e.preventDefault();\n e.stopPropagation();\n if (label) this._activate(label.parentElement);\n };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;AAoBO,SAAS,WAAW,SAA4C;AACrE,QAAM,UAAU,oBAAI,IAA+B;AACnD,UAAQ,QAAQ,CAAC,WAAW;AAAE,QAAI,CAAC,QAAQ,IAAI,OAAO,KAAK,EAAG,SAAQ,IAAI,OAAO,OAAO,MAAM;AAAA,EAAG,CAAC;AAClG,QAAM,WAAW,CAAC,WAA8B,QAAQ,IAAI,OAAO,QAAQ,UAAU,MAAS;AAE9F,QAAM,QAAQ,CAAC,WAA8B;AAC3C,QAAI,SAAS,SAAS,MAAM;AAC5B,aAAS,QAAQ,GAAG,UAAU,WAAW,UAAU,QAAQ,QAAQ,QAAQ,QAAS,UAAS,SAAS,MAAM;AAC5G,WAAO,WAAW;AAAA,EACpB;AACA,QAAM,QAAQ,IAAI,IAAI,QAAQ,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,QAAQ,UAAU,CAAC,EAAkB,CAAC,CAAC,CAAC;AACjG,QAAM,QAAsB,CAAC;AAC7B,UAAQ,QAAQ,CAAC,WAAW;AAC1B,UAAM,SAAS,MAAM,MAAM,IAAI,SAAY,SAAS,MAAM;AAC1D,KAAC,SAAS,MAAM,IAAI,MAAM,EAAE,WAAW,OAAO,KAAK,MAAM,IAAI,MAAM,CAAC;AAAA,EACtE,CAAC;AACD,SAAO;AACT;AAKA,IAAM,QAAQ,EAAE,SAAS,IAAI,WAAW,EAAE;AAC1C,IAAM,OAAgB,CAAC,MAA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AI,EAAE,cAAc;AACtD,WAAQ,OAAO,SAAS,GAAG,KAAM;AAAA,EACnC;AAqBF;AAvVa,WAsCJ,MAAM;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-GNRSYMVH.mjs.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Utils
|
|
3
|
+
} from "./chunk-ZVLOUDIJ.mjs";
|
|
4
|
+
|
|
5
|
+
// src/ts/behaviors/theme.ts
|
|
6
|
+
var themes = ["light", "dark", "auto"];
|
|
7
|
+
var storageKey = "theme";
|
|
8
|
+
var _Theme = class _Theme {
|
|
9
|
+
static Init() {
|
|
10
|
+
if (_Theme._initialized || typeof document === "undefined") return;
|
|
11
|
+
_Theme._initialized = true;
|
|
12
|
+
document.addEventListener("click", _Theme._onClick);
|
|
13
|
+
Utils.onDocumentReady(() => _Theme.sync());
|
|
14
|
+
}
|
|
15
|
+
/** The current theme: the root's `theme` attribute, or `auto` without one. */
|
|
16
|
+
static get() {
|
|
17
|
+
const value = document.documentElement.getAttribute("theme");
|
|
18
|
+
return themes.includes(value) ? value : "auto";
|
|
19
|
+
}
|
|
20
|
+
/** Applies and saves a theme, then marks the controls. Unknown values are ignored. */
|
|
21
|
+
static set(theme) {
|
|
22
|
+
if (!themes.includes(theme)) return;
|
|
23
|
+
document.documentElement.setAttribute("theme", theme);
|
|
24
|
+
try {
|
|
25
|
+
localStorage.setItem(storageKey, theme);
|
|
26
|
+
} catch {
|
|
27
|
+
}
|
|
28
|
+
_Theme.sync();
|
|
29
|
+
}
|
|
30
|
+
/** Marks every theme control in `root` as current or not. Call it after rendering new controls. */
|
|
31
|
+
static sync(root = document) {
|
|
32
|
+
const current = _Theme.get();
|
|
33
|
+
root.querySelectorAll("[data-theme-set]").forEach((control) => {
|
|
34
|
+
const state = String(control.getAttribute("data-theme-set") === current);
|
|
35
|
+
const role = control.getAttribute("role");
|
|
36
|
+
const checked = role === "menuitemradio" || role === "radio";
|
|
37
|
+
control.setAttribute(checked ? "aria-checked" : "aria-pressed", state);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
static _onClick(e) {
|
|
41
|
+
const control = Utils.closestInPath(e, "[data-theme-set]");
|
|
42
|
+
if (!control || control.matches(':disabled, [aria-disabled="true"]')) return;
|
|
43
|
+
_Theme.set(control.getAttribute("data-theme-set"));
|
|
44
|
+
const root = control.getRootNode();
|
|
45
|
+
if (root !== document) _Theme.sync(root);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
_Theme._initialized = false;
|
|
49
|
+
var Theme = _Theme;
|
|
50
|
+
|
|
51
|
+
export {
|
|
52
|
+
Theme
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=chunk-GVZQH2H5.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/ts/behaviors/theme.ts"],
|
|
4
|
+
"sourcesContent": ["import { Utils } from '../core/utils';\n\nconst themes = ['light', 'dark', 'auto'];\nconst storageKey = 'theme';\n\n/**\n * Theme switch. A click on `[data-theme-set=\"light|dark|auto\"]` writes the\n * `theme` attribute on the root element and saves the choice in\n * `localStorage` under `theme`. Every theme control then reports whether its\n * value is current: `aria-checked` on menu item and radio roles,\n * `aria-pressed` on anything else.\n *\n * Restoring the saved choice is still the page's inline `<head>` script: the\n * bundle loads after first paint, so restoring here would flash the wrong\n * scheme. Init only marks the controls already in the page.\n */\nexport class Theme {\n private static _initialized = false;\n\n static Init() {\n if (Theme._initialized || typeof document === 'undefined') return;\n Theme._initialized = true;\n document.addEventListener('click', Theme._onClick);\n Utils.onDocumentReady(() => Theme.sync());\n }\n\n /** The current theme: the root's `theme` attribute, or `auto` without one. */\n static get(): string {\n const value = document.documentElement.getAttribute('theme');\n return themes.includes(value) ? value : 'auto';\n }\n\n /** Applies and saves a theme, then marks the controls. Unknown values are ignored. */\n static set(theme: string) {\n if (!themes.includes(theme)) return;\n document.documentElement.setAttribute('theme', theme);\n try {\n localStorage.setItem(storageKey, theme);\n } catch {\n // Storage can be disabled or full; the theme still applies to this page.\n }\n Theme.sync();\n }\n\n /** Marks every theme control in `root` as current or not. Call it after rendering new controls. */\n static sync(root: ParentNode = document) {\n const current = Theme.get();\n root.querySelectorAll('[data-theme-set]').forEach((control) => {\n const state = String(control.getAttribute('data-theme-set') === current);\n const role = control.getAttribute('role');\n const checked = role === 'menuitemradio' || role === 'radio';\n control.setAttribute(checked ? 'aria-checked' : 'aria-pressed', state);\n });\n }\n\n private static _onClick(e: MouseEvent) {\n const control = Utils.closestInPath(e, '[data-theme-set]');\n if (!control || control.matches(':disabled, [aria-disabled=\"true\"]')) return;\n Theme.set(control.getAttribute('data-theme-set'));\n // set() marks the document's controls; a shadow root's need their own pass.\n const root = control.getRootNode();\n if (root !== document) Theme.sync(root as ParentNode);\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;AAEA,IAAM,SAAS,CAAC,SAAS,QAAQ,MAAM;AACvC,IAAM,aAAa;AAaZ,IAAM,SAAN,MAAM,OAAM;AAAA,EAGjB,OAAO,OAAO;AACZ,QAAI,OAAM,gBAAgB,OAAO,aAAa,YAAa;AAC3D,WAAM,eAAe;AACrB,aAAS,iBAAiB,SAAS,OAAM,QAAQ;AACjD,UAAM,gBAAgB,MAAM,OAAM,KAAK,CAAC;AAAA,EAC1C;AAAA;AAAA,EAGA,OAAO,MAAc;AACnB,UAAM,QAAQ,SAAS,gBAAgB,aAAa,OAAO;AAC3D,WAAO,OAAO,SAAS,KAAK,IAAI,QAAQ;AAAA,EAC1C;AAAA;AAAA,EAGA,OAAO,IAAI,OAAe;AACxB,QAAI,CAAC,OAAO,SAAS,KAAK,EAAG;AAC7B,aAAS,gBAAgB,aAAa,SAAS,KAAK;AACpD,QAAI;AACF,mBAAa,QAAQ,YAAY,KAAK;AAAA,IACxC,QAAQ;AAAA,IAER;AACA,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