@expressivecss/expressive 0.15.0 → 0.17.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 +1807 -1
- package/README.md +9 -8
- package/dist/css/expressive.css +19176 -11958
- 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-26VUH75M.mjs +102 -0
- package/dist/js/chunks/chunk-26VUH75M.mjs.map +7 -0
- package/dist/js/chunks/chunk-2LFCOGC3.mjs +233 -0
- package/dist/js/chunks/chunk-2LFCOGC3.mjs.map +7 -0
- package/dist/js/chunks/{chunk-DXGRXYYL.mjs → chunk-36GELQGX.mjs} +29 -46
- package/dist/js/chunks/chunk-36GELQGX.mjs.map +7 -0
- package/dist/js/chunks/{chunk-74MXKKLN.mjs → chunk-3FKWIRHW.mjs} +15 -29
- package/dist/js/chunks/chunk-3FKWIRHW.mjs.map +7 -0
- package/dist/js/chunks/chunk-3KF65KGL.mjs +209 -0
- package/dist/js/chunks/chunk-3KF65KGL.mjs.map +7 -0
- package/dist/js/chunks/{chunk-KVJAVDBC.mjs → chunk-3KLZRQZI.mjs} +88 -116
- package/dist/js/chunks/chunk-3KLZRQZI.mjs.map +7 -0
- package/dist/js/chunks/{chunk-CK2XCICY.mjs → chunk-3XORNED5.mjs} +3 -11
- package/dist/js/chunks/chunk-3XORNED5.mjs.map +7 -0
- package/dist/js/chunks/chunk-4WBGAQN3.mjs +113 -0
- package/dist/js/chunks/chunk-4WBGAQN3.mjs.map +7 -0
- package/dist/js/chunks/{chunk-FM5CZOUB.mjs → chunk-5F4URJHL.mjs} +19 -30
- package/dist/js/chunks/chunk-5F4URJHL.mjs.map +7 -0
- package/dist/js/chunks/chunk-67UNY7RH.mjs +299 -0
- package/dist/js/chunks/chunk-67UNY7RH.mjs.map +7 -0
- package/dist/js/chunks/chunk-7CXNATJS.mjs +97 -0
- package/dist/js/chunks/chunk-7CXNATJS.mjs.map +7 -0
- package/dist/js/chunks/{chunk-UETTGDLI.mjs → chunk-7X44MKEQ.mjs} +43 -48
- package/dist/js/chunks/chunk-7X44MKEQ.mjs.map +7 -0
- package/dist/js/chunks/chunk-7ZAMOMGY.mjs +440 -0
- package/dist/js/chunks/chunk-7ZAMOMGY.mjs.map +7 -0
- package/dist/js/chunks/chunk-AEG6LOAJ.mjs +54 -0
- package/dist/js/chunks/chunk-AEG6LOAJ.mjs.map +7 -0
- package/dist/js/chunks/chunk-AQNFCJJ5.mjs +135 -0
- package/dist/js/chunks/chunk-AQNFCJJ5.mjs.map +7 -0
- package/dist/js/chunks/chunk-B55LWKBM.mjs +75 -0
- package/dist/js/chunks/chunk-B55LWKBM.mjs.map +7 -0
- package/dist/js/chunks/chunk-BB5VXYXT.mjs +28 -0
- package/dist/js/chunks/chunk-BB5VXYXT.mjs.map +7 -0
- package/dist/js/chunks/chunk-BDATLH3H.mjs +108 -0
- package/dist/js/chunks/chunk-BDATLH3H.mjs.map +7 -0
- package/dist/js/chunks/chunk-CWMQOT4O.mjs +232 -0
- package/dist/js/chunks/chunk-CWMQOT4O.mjs.map +7 -0
- package/dist/js/chunks/chunk-CY2CTOVM.mjs +81 -0
- package/dist/js/chunks/chunk-CY2CTOVM.mjs.map +7 -0
- package/dist/js/chunks/{chunk-NUHMOAOY.mjs → chunk-DWA5UYLJ.mjs} +363 -218
- package/dist/js/chunks/chunk-DWA5UYLJ.mjs.map +7 -0
- package/dist/js/chunks/chunk-EB2V4OKL.mjs +79 -0
- package/dist/js/chunks/chunk-EB2V4OKL.mjs.map +7 -0
- package/dist/js/chunks/chunk-EWO662ZC.mjs +188 -0
- package/dist/js/chunks/chunk-EWO662ZC.mjs.map +7 -0
- package/dist/js/chunks/{chunk-ZX6M7SWO.mjs → chunk-F7LAKFMX.mjs} +320 -141
- package/dist/js/chunks/chunk-F7LAKFMX.mjs.map +7 -0
- package/dist/js/chunks/{chunk-L27Q6ZMI.mjs → chunk-FNIIH2LU.mjs} +20 -33
- package/dist/js/chunks/chunk-FNIIH2LU.mjs.map +7 -0
- package/dist/js/chunks/chunk-GE3YMFS6.mjs +15 -0
- package/dist/js/chunks/chunk-GE3YMFS6.mjs.map +7 -0
- package/dist/js/chunks/chunk-GFWYMWYN.mjs +125 -0
- package/dist/js/chunks/chunk-GFWYMWYN.mjs.map +7 -0
- package/dist/js/chunks/chunk-GNRSYMVH.mjs +1 -0
- package/dist/js/chunks/chunk-H5ISU45X.mjs +87 -0
- package/dist/js/chunks/chunk-H5ISU45X.mjs.map +7 -0
- package/dist/js/chunks/{chunk-GJL6GCIU.mjs → chunk-H6YIKFAQ.mjs} +311 -186
- package/dist/js/chunks/chunk-H6YIKFAQ.mjs.map +7 -0
- package/dist/js/chunks/{chunk-BGZLF6JZ.mjs → chunk-HEH7E3KO.mjs} +155 -35
- package/dist/js/chunks/chunk-HEH7E3KO.mjs.map +7 -0
- package/dist/js/chunks/chunk-HQRLBTNM.mjs +152 -0
- package/dist/js/chunks/chunk-HQRLBTNM.mjs.map +7 -0
- package/dist/js/chunks/chunk-I2F7MLUU.mjs +137 -0
- package/dist/js/chunks/chunk-I2F7MLUU.mjs.map +7 -0
- package/dist/js/chunks/chunk-IQOTGGHX.mjs +797 -0
- package/dist/js/chunks/chunk-IQOTGGHX.mjs.map +7 -0
- package/dist/js/chunks/chunk-JH3YWKA6.mjs +225 -0
- package/dist/js/chunks/chunk-JH3YWKA6.mjs.map +7 -0
- package/dist/js/chunks/chunk-JOLJAYIJ.mjs +7 -0
- package/dist/js/chunks/chunk-JOLJAYIJ.mjs.map +7 -0
- package/dist/js/chunks/{chunk-VGNYF6FB.mjs → chunk-KOTGMCMI.mjs} +116 -24
- package/dist/js/chunks/chunk-KOTGMCMI.mjs.map +7 -0
- package/dist/js/chunks/{chunk-LQWUDNHZ.mjs → chunk-LC4O5LFS.mjs} +21 -45
- package/dist/js/chunks/chunk-LC4O5LFS.mjs.map +7 -0
- package/dist/js/chunks/chunk-LEF33SCP.mjs +127 -0
- package/dist/js/chunks/chunk-LEF33SCP.mjs.map +7 -0
- package/dist/js/chunks/{chunk-PDG64UHF.mjs → chunk-LFORZRPH.mjs} +21 -23
- package/dist/js/chunks/chunk-LFORZRPH.mjs.map +7 -0
- package/dist/js/chunks/chunk-LWLNV5EC.mjs +451 -0
- package/dist/js/chunks/chunk-LWLNV5EC.mjs.map +7 -0
- package/dist/js/chunks/chunk-LXRHUQAX.mjs +491 -0
- package/dist/js/chunks/chunk-LXRHUQAX.mjs.map +7 -0
- package/dist/js/chunks/{chunk-SFI2U4YW.mjs → chunk-MA2SZZFB.mjs} +82 -111
- package/dist/js/chunks/chunk-MA2SZZFB.mjs.map +7 -0
- package/dist/js/chunks/chunk-MDBZAMIV.mjs +121 -0
- package/dist/js/chunks/chunk-MDBZAMIV.mjs.map +7 -0
- package/dist/js/chunks/chunk-NODZ5VAD.mjs +75 -0
- package/dist/js/chunks/chunk-NODZ5VAD.mjs.map +7 -0
- package/dist/js/chunks/chunk-O2WJB6TH.mjs +365 -0
- package/dist/js/chunks/chunk-O2WJB6TH.mjs.map +7 -0
- package/dist/js/chunks/chunk-PCABY5BN.mjs +35 -0
- package/dist/js/chunks/chunk-PCABY5BN.mjs.map +7 -0
- package/dist/js/chunks/chunk-PWKYVMND.mjs +120 -0
- package/dist/js/chunks/chunk-PWKYVMND.mjs.map +7 -0
- package/dist/js/chunks/{chunk-SMY7GJSS.mjs → chunk-QHZZT7YO.mjs} +66 -38
- package/dist/js/chunks/chunk-QHZZT7YO.mjs.map +7 -0
- package/dist/js/chunks/chunk-QND56EW2.mjs +439 -0
- package/dist/js/chunks/chunk-QND56EW2.mjs.map +7 -0
- package/dist/js/chunks/chunk-QNODAANY.mjs +376 -0
- package/dist/js/chunks/chunk-QNODAANY.mjs.map +7 -0
- package/dist/js/chunks/{chunk-KHXZ2A4K.mjs → chunk-QRO5FV3I.mjs} +156 -73
- package/dist/js/chunks/chunk-QRO5FV3I.mjs.map +7 -0
- package/dist/js/chunks/chunk-R7A7JRC5.mjs +440 -0
- package/dist/js/chunks/chunk-R7A7JRC5.mjs.map +7 -0
- package/dist/js/chunks/chunk-RKG2CBFE.mjs +74 -0
- package/dist/js/chunks/chunk-RKG2CBFE.mjs.map +7 -0
- package/dist/js/chunks/{chunk-XAEAEHIX.mjs → chunk-RSNS5OYS.mjs} +38 -25
- package/dist/js/chunks/chunk-RSNS5OYS.mjs.map +7 -0
- package/dist/js/chunks/{chunk-X4ISMKE2.mjs → chunk-RUDYMEJ3.mjs} +7 -6
- package/dist/js/chunks/chunk-RUDYMEJ3.mjs.map +7 -0
- package/dist/js/chunks/chunk-STJR62SU.mjs +161 -0
- package/dist/js/chunks/chunk-STJR62SU.mjs.map +7 -0
- package/dist/js/chunks/chunk-SUSD4UTN.mjs +220 -0
- package/dist/js/chunks/chunk-SUSD4UTN.mjs.map +7 -0
- package/dist/js/chunks/{chunk-5CEAOLUA.mjs → chunk-SYBOA5HC.mjs} +26 -48
- package/dist/js/chunks/chunk-SYBOA5HC.mjs.map +7 -0
- package/dist/js/chunks/chunk-T4MOBP3J.mjs +108 -0
- package/dist/js/chunks/chunk-T4MOBP3J.mjs.map +7 -0
- package/dist/js/chunks/chunk-TM7HPGTV.mjs +342 -0
- package/dist/js/chunks/chunk-TM7HPGTV.mjs.map +7 -0
- package/dist/js/chunks/{chunk-C6CHEWYP.mjs → chunk-TMQDZSDC.mjs} +71 -35
- package/dist/js/chunks/chunk-TMQDZSDC.mjs.map +7 -0
- package/dist/js/chunks/chunk-TVSX5YA2.mjs +48 -0
- package/dist/js/chunks/chunk-TVSX5YA2.mjs.map +7 -0
- package/dist/js/chunks/chunk-UHO5CV6K.mjs +80 -0
- package/dist/js/chunks/chunk-UHO5CV6K.mjs.map +7 -0
- package/dist/js/chunks/chunk-UKCNELUN.mjs +223 -0
- package/dist/js/chunks/chunk-UKCNELUN.mjs.map +7 -0
- package/dist/js/chunks/chunk-UKQK5GWR.mjs +167 -0
- package/dist/js/chunks/chunk-UKQK5GWR.mjs.map +7 -0
- package/dist/js/chunks/{chunk-TSZYSW7F.mjs → chunk-UTSLYQ65.mjs} +21 -48
- package/dist/js/chunks/chunk-UTSLYQ65.mjs.map +7 -0
- package/dist/js/chunks/chunk-VS5OJBOD.mjs +108 -0
- package/dist/js/chunks/chunk-VS5OJBOD.mjs.map +7 -0
- package/dist/js/chunks/chunk-VZMROW5A.mjs +759 -0
- package/dist/js/chunks/chunk-VZMROW5A.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-XB6Y7P5W.mjs +69 -0
- package/dist/js/chunks/chunk-XB6Y7P5W.mjs.map +7 -0
- package/dist/js/chunks/chunk-XDAMOMVD.mjs +226 -0
- package/dist/js/chunks/chunk-XDAMOMVD.mjs.map +7 -0
- package/dist/js/chunks/{chunk-WDK4T63U.mjs → chunk-XJPMW5SP.mjs} +247 -172
- package/dist/js/chunks/chunk-XJPMW5SP.mjs.map +7 -0
- package/dist/js/chunks/{chunk-KUFHW3DS.mjs → chunk-YKANQILZ.mjs} +16 -21
- package/dist/js/chunks/chunk-YKANQILZ.mjs.map +7 -0
- package/dist/js/chunks/chunk-YLZOJLDI.mjs +175 -0
- package/dist/js/chunks/chunk-YLZOJLDI.mjs.map +7 -0
- package/dist/js/chunks/chunk-ZK7YY322.mjs +514 -0
- package/dist/js/chunks/chunk-ZK7YY322.mjs.map +7 -0
- package/dist/js/expressive.cjs +10266 -3628
- package/dist/js/expressive.cjs.map +4 -4
- package/dist/js/expressive.js +10266 -3628
- 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 +181 -69
- 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 +8 -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 +5 -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 +7 -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 +12 -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 -65
- 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 +41 -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 +60 -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 +5 -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 +14 -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 +6 -3
- package/dist/js/internal/core/formControl.mjs +12 -0
- package/dist/js/internal/core/formControl.mjs.map +7 -0
- package/dist/js/internal/core/imageURL.mjs +7 -0
- package/dist/js/internal/core/imageURL.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 +21 -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 +172 -69
- package/dist/types/behaviors/bottomSheets.d.ts +23 -5
- package/dist/types/behaviors/copy.d.ts +18 -0
- package/dist/types/behaviors/dataTables.d.ts +125 -0
- package/dist/types/behaviors/dialogs.d.ts +27 -1
- package/dist/types/behaviors/forms.d.ts +70 -4
- package/dist/types/behaviors/imageCompare.d.ts +13 -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 +53 -0
- package/dist/types/components/appBar.d.ts +5 -6
- package/dist/types/components/autocomplete.d.ts +105 -20
- 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 +16 -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 +80 -19
- package/dist/types/components/colorPicker.d.ts +56 -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 +60 -0
- package/dist/types/components/datepicker.d.ts +107 -56
- package/dist/types/components/expandingCard.d.ts +4 -6
- package/dist/types/components/funnelChart.d.ts +35 -0
- package/dist/types/components/heatmapChart.d.ts +42 -8
- package/dist/types/components/hoverCard.d.ts +59 -0
- package/dist/types/components/index.d.ts +16 -1
- package/dist/types/components/inputMask.d.ts +28 -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 +212 -12
- package/dist/types/components/loadingOverlay.d.ts +42 -0
- package/dist/types/components/mapView.d.ts +138 -27
- package/dist/types/components/menu.d.ts +74 -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 +22 -5
- package/dist/types/components/pieChart.d.ts +33 -9
- 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 +45 -22
- 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 +44 -33
- package/dist/types/components/showMore.d.ts +53 -0
- package/dist/types/components/slider.d.ts +2 -15
- package/dist/types/components/snackbar.d.ts +68 -1
- package/dist/types/components/swipeActions.d.ts +81 -0
- package/dist/types/components/tabs.d.ts +92 -30
- package/dist/types/components/timepicker.d.ts +128 -27
- package/dist/types/components/tooltip.d.ts +57 -21
- 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 +49 -25
- package/dist/types/core/formControl.d.ts +21 -0
- package/dist/types/core/imageURL.d.ts +2 -0
- package/dist/types/core/spring.d.ts +20 -0
- package/dist/types/core/utils.d.ts +123 -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 +39 -0
- package/package.json +17 -13
- 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 +864 -78
- package/src/sass/abstracts/_spring.scss +63 -0
- package/src/sass/abstracts/_variables.scss +64 -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 +10 -19
- package/src/sass/components/_alert.scss +102 -0
- package/src/sass/components/_aura.scss +9 -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 +31 -90
- package/src/sass/components/_bottom-sheet.scss +51 -16
- package/src/sass/components/_breadcrumb.scss +8 -7
- package/src/sass/components/_button-groups.scss +30 -63
- package/src/sass/components/_buttons.scss +137 -94
- package/src/sass/components/_calendar.scss +244 -0
- package/src/sass/components/_cards.scss +36 -44
- package/src/sass/components/_carousel.scss +37 -113
- package/src/sass/components/_cascader.scss +131 -0
- package/src/sass/components/_chips.scss +36 -46
- package/src/sass/components/_column-chart.scss +15 -26
- package/src/sass/components/_command-palette.scss +4 -7
- package/src/sass/components/_confetti.scss +1 -4
- package/src/sass/components/_countdown.scss +1 -1
- package/src/sass/components/_data-table.scss +172 -25
- package/src/sass/components/_datepicker.scss +54 -40
- package/src/sass/components/_description-list.scss +85 -0
- package/src/sass/components/_dialog.scss +48 -55
- 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 +21 -14
- package/src/sass/components/_fab-menu.scss +43 -39
- package/src/sass/components/_funnel-chart.scss +63 -0
- package/src/sass/components/_heatmap-chart.scss +114 -29
- package/src/sass/components/_icon-buttons.scss +8 -11
- 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 +9 -63
- 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 +37 -11
- package/src/sass/components/_marquee.scss +4 -3
- package/src/sass/components/_mega-menu.scss +128 -0
- package/src/sass/components/_menu.scss +146 -127
- package/src/sass/components/_menubar.scss +47 -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 +27 -35
- package/src/sass/components/_modal-display.scss +21 -0
- package/src/sass/components/_navbar.scss +45 -36
- package/src/sass/components/_navigation-bar.scss +12 -77
- package/src/sass/components/_navigation-rail.scss +161 -92
- package/src/sass/components/_org-chart.scss +192 -0
- package/src/sass/components/_page-footer.scss +2 -4
- package/src/sass/components/_pagination.scss +9 -27
- package/src/sass/components/_panes.scss +35 -42
- package/src/sass/components/_particles.scss +1 -4
- package/src/sass/components/_pie-chart.scss +86 -68
- package/src/sass/components/_popover.scss +18 -5
- package/src/sass/components/_progress.scss +183 -44
- 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 +40 -42
- package/src/sass/components/_radial-chart.scss +108 -46
- package/src/sass/components/_rich-text-editor.scss +2 -2
- package/src/sass/components/_sankey-chart.scss +91 -0
- package/src/sass/components/_scatter-chart.scss +144 -0
- package/src/sass/components/_scrim.scss +0 -2
- package/src/sass/components/_scrollspy.scss +0 -2
- package/src/sass/components/_search.scss +27 -26
- package/src/sass/components/_show-more.scss +8 -0
- package/src/sass/components/_side-sheet.scss +32 -51
- package/src/sass/components/_skeleton.scss +26 -19
- package/src/sass/components/_snackbar.scss +25 -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/_table_of_contents.scss +1 -3
- package/src/sass/components/_tabs.scss +49 -46
- package/src/sass/components/_timeline.scss +12 -12
- package/src/sass/components/_timepicker.scss +111 -79
- package/src/sass/components/_toolbar.scss +36 -47
- package/src/sass/components/_tooltip.scss +25 -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 +7 -32
- package/src/sass/components/_treemap-chart.scss +98 -0
- package/src/sass/components/forms/_checkboxes.scss +107 -44
- 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 +16 -13
- package/src/sass/components/forms/_fieldset.scss +4 -7
- package/src/sass/components/forms/_file-input.scss +12 -8
- package/src/sass/components/forms/_index.scss +3 -1
- package/src/sass/components/forms/_input-fields.scss +271 -90
- package/src/sass/components/forms/_radio-buttons.scss +34 -117
- package/src/sass/components/forms/_rating.scss +2 -32
- package/src/sass/components/forms/_select.scss +198 -20
- package/src/sass/components/forms/_slider.scss +92 -98
- package/src/sass/components/forms/_switches.scss +62 -180
- 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 +184 -27
- 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 +46 -77
- 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 +0 -90
- 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,440 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component
|
|
3
|
+
} from "./chunk-EB2V4OKL.mjs";
|
|
4
|
+
import {
|
|
5
|
+
Utils,
|
|
6
|
+
restoreAttribute
|
|
7
|
+
} from "./chunk-67UNY7RH.mjs";
|
|
8
|
+
|
|
9
|
+
// src/ts/components/tooltip.ts
|
|
10
|
+
var anchorSupported = typeof CSS !== "undefined" && !!CSS.supports?.("anchor-name: --a");
|
|
11
|
+
var ANCHOR_PLACEMENT = {
|
|
12
|
+
top: ["top", "justify-self"],
|
|
13
|
+
right: ["right", "align-self"],
|
|
14
|
+
left: ["left", "align-self"],
|
|
15
|
+
bottom: ["bottom", "justify-self"]
|
|
16
|
+
};
|
|
17
|
+
var LONG_PRESS = 500;
|
|
18
|
+
var TOUCH_LINGER = 1500;
|
|
19
|
+
var TOUCH_ECHO = 800;
|
|
20
|
+
var PRESS_CLICK = 400;
|
|
21
|
+
var SKIP_DELAY_WINDOW = 300;
|
|
22
|
+
var skipDelayFrom = -Infinity;
|
|
23
|
+
var skipDelayUntil = -Infinity;
|
|
24
|
+
var skippingDelay = (now) => now >= skipDelayFrom && now < skipDelayUntil;
|
|
25
|
+
function startSkipDelay(exitDelay) {
|
|
26
|
+
const now = Date.now();
|
|
27
|
+
const end = now + exitDelay + SKIP_DELAY_WINDOW;
|
|
28
|
+
skipDelayUntil = skippingDelay(now) ? Math.max(skipDelayUntil, end) : end;
|
|
29
|
+
skipDelayFrom = now;
|
|
30
|
+
}
|
|
31
|
+
var _defaults = {
|
|
32
|
+
exitDelay: 200,
|
|
33
|
+
enterDelay: 0,
|
|
34
|
+
text: "",
|
|
35
|
+
margin: 4,
|
|
36
|
+
inDuration: 250,
|
|
37
|
+
outDuration: 200,
|
|
38
|
+
position: "bottom",
|
|
39
|
+
transitionMovement: 10,
|
|
40
|
+
opacity: 1,
|
|
41
|
+
openOnClick: false
|
|
42
|
+
};
|
|
43
|
+
var Tooltip = class extends Component {
|
|
44
|
+
constructor(el, options) {
|
|
45
|
+
super(el, options);
|
|
46
|
+
/** The last click on the trigger or inside the tooltip, which the document listener leaves alone. */
|
|
47
|
+
this._insideClick = null;
|
|
48
|
+
/** When the last touch began or ended, to tell its mouse events from a mouse. */
|
|
49
|
+
this._lastTouch = -Infinity;
|
|
50
|
+
/** Whether a long press showed the tooltip, until it closes or a mouse hovers. */
|
|
51
|
+
this._touchShown = false;
|
|
52
|
+
/** Until when a click is the release of a long press, not a tap. */
|
|
53
|
+
this._swallowClickUntil = -Infinity;
|
|
54
|
+
// Whether the last animation showed the tooltip, so each change is reported once.
|
|
55
|
+
this._shown = false;
|
|
56
|
+
/**
|
|
57
|
+
* Show tooltip.
|
|
58
|
+
*/
|
|
59
|
+
this.open = (isManual = true) => {
|
|
60
|
+
if (this.isOpen) return;
|
|
61
|
+
clearTimeout(this._exitDelayTimeout);
|
|
62
|
+
clearTimeout(this._animationTimeout);
|
|
63
|
+
this.isOpen = true;
|
|
64
|
+
const { signal } = this._events;
|
|
65
|
+
this.el.ownerDocument.addEventListener("keydown", this._handleKeydown, { capture: true, signal });
|
|
66
|
+
if (this.options.openOnClick) {
|
|
67
|
+
this._outsideTimeout = setTimeout(() => this.el.ownerDocument.addEventListener("click", this._handleDocumentClick, { signal }));
|
|
68
|
+
}
|
|
69
|
+
this.options = { ...this.options, ...this._getAttributeOptions() };
|
|
70
|
+
this._updateTooltipContent();
|
|
71
|
+
this._setEnterDelayTimeout(isManual);
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Hide tooltip.
|
|
75
|
+
*/
|
|
76
|
+
this.close = () => {
|
|
77
|
+
clearTimeout(this._pressTimeout);
|
|
78
|
+
clearTimeout(this._lingerTimeout);
|
|
79
|
+
this._touchShown = false;
|
|
80
|
+
if (!this.isOpen) return;
|
|
81
|
+
if (this._shown) startSkipDelay(this.options.exitDelay);
|
|
82
|
+
this.isHovered = false;
|
|
83
|
+
this.isFocused = false;
|
|
84
|
+
this.isOpen = false;
|
|
85
|
+
this.el.ownerDocument.removeEventListener("keydown", this._handleKeydown, true);
|
|
86
|
+
clearTimeout(this._outsideTimeout);
|
|
87
|
+
this.el.ownerDocument.removeEventListener("click", this._handleDocumentClick);
|
|
88
|
+
clearTimeout(this._enterDelayTimeout);
|
|
89
|
+
this._setExitDelayTimeout();
|
|
90
|
+
};
|
|
91
|
+
this._handleMouseEnter = () => {
|
|
92
|
+
if (this.options.openOnClick || performance.now() - this._lastTouch < TOUCH_ECHO) return;
|
|
93
|
+
this._touchShown = false;
|
|
94
|
+
this.isHovered = true;
|
|
95
|
+
this.open(false);
|
|
96
|
+
};
|
|
97
|
+
// pointerenter comes before any compatibility mouseenter, in whatever order
|
|
98
|
+
// a browser sends those, so the touch is known before its mouse events.
|
|
99
|
+
this._handlePointerEnter = (e) => {
|
|
100
|
+
this._touched(e);
|
|
101
|
+
};
|
|
102
|
+
/** A touch held for LONG_PRESS shows the tooltip, unless it turns into a scroll first. */
|
|
103
|
+
this._handlePointerDown = (e) => {
|
|
104
|
+
if (!this._longPress(e)) return;
|
|
105
|
+
clearTimeout(this._lingerTimeout);
|
|
106
|
+
clearTimeout(this._pressTimeout);
|
|
107
|
+
this._pressTimeout = setTimeout(() => {
|
|
108
|
+
this.isHovered = true;
|
|
109
|
+
this._showNow();
|
|
110
|
+
this._touchShown = true;
|
|
111
|
+
}, LONG_PRESS);
|
|
112
|
+
};
|
|
113
|
+
/** The finger lifted: a press too short stays a tap, and a tooltip it showed lingers for TOUCH_LINGER. */
|
|
114
|
+
this._handlePointerEnd = (e) => {
|
|
115
|
+
if (!this._longPress(e)) return;
|
|
116
|
+
clearTimeout(this._pressTimeout);
|
|
117
|
+
if (this._touchShown) this._swallowClickUntil = performance.now() + PRESS_CLICK;
|
|
118
|
+
if (!this.isOpen) return;
|
|
119
|
+
this.isHovered = false;
|
|
120
|
+
this._lingerTimeout = setTimeout(() => this.isHovered || this.isFocused || this.close(), TOUCH_LINGER);
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* A click tooltip toggles. Otherwise the click a long press's release sends
|
|
124
|
+
* would press the button or follow the link, so it is consumed.
|
|
125
|
+
*/
|
|
126
|
+
this._handleClick = (e) => {
|
|
127
|
+
if (this.options.openOnClick) return this._toggle(e);
|
|
128
|
+
if (performance.now() > this._swallowClickUntil) return;
|
|
129
|
+
this._swallowClickUntil = -Infinity;
|
|
130
|
+
e.preventDefault();
|
|
131
|
+
e.stopImmediatePropagation();
|
|
132
|
+
};
|
|
133
|
+
// Marked rather than found on the composed path, which a document listener
|
|
134
|
+
// cannot see into when the tooltip sits in a closed shadow root.
|
|
135
|
+
this._handleTooltipClick = (e) => {
|
|
136
|
+
this._insideClick = e;
|
|
137
|
+
};
|
|
138
|
+
this._handleDocumentClick = (e) => {
|
|
139
|
+
if (e !== this._insideClick) this._hideNow();
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* The browser took the touch to scroll: no tooltip opens, not even one
|
|
143
|
+
* waiting out enterDelay, and one the touch showed closes at once.
|
|
144
|
+
*/
|
|
145
|
+
this._handlePointerCancel = (e) => {
|
|
146
|
+
if (!this._longPress(e)) return;
|
|
147
|
+
clearTimeout(this._pressTimeout);
|
|
148
|
+
if (!this._touchShown) return;
|
|
149
|
+
this.isHovered = false;
|
|
150
|
+
if (!this.isFocused) this.close();
|
|
151
|
+
};
|
|
152
|
+
this._handleMouseLeave = (event) => {
|
|
153
|
+
if (this.options.openOnClick || this._holds(event.relatedTarget)) return;
|
|
154
|
+
this.isHovered = false;
|
|
155
|
+
if (!this.isFocused) this.close();
|
|
156
|
+
};
|
|
157
|
+
this._handleKeydown = (event) => {
|
|
158
|
+
if (event.key !== "Escape" || !this.isOpen) return;
|
|
159
|
+
if (Utils.focusIsIn(this.el, this.tooltipEl)) {
|
|
160
|
+
event.preventDefault();
|
|
161
|
+
event.stopPropagation();
|
|
162
|
+
}
|
|
163
|
+
this._hideNow();
|
|
164
|
+
};
|
|
165
|
+
// Focus opens the tooltip only when it arrived by keyboard: a pointer press
|
|
166
|
+
// on the trigger also focuses it, and _handleMouseEnter already covers that.
|
|
167
|
+
this._handleFocus = (event) => {
|
|
168
|
+
if (!this.options.openOnClick && event.target.matches(":focus-visible")) {
|
|
169
|
+
this.isFocused = true;
|
|
170
|
+
this.open(false);
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
this._handleBlur = (event) => {
|
|
174
|
+
const next = event.relatedTarget;
|
|
175
|
+
if (this._holds(next)) return;
|
|
176
|
+
if (this.options.openOnClick) return this._blurClickTooltip(next);
|
|
177
|
+
this.isFocused = false;
|
|
178
|
+
if (!this.isHovered) this.close();
|
|
179
|
+
};
|
|
180
|
+
this.options = { ...this.options, ...this._getAttributeOptions() };
|
|
181
|
+
this.isOpen = false;
|
|
182
|
+
this.isHovered = false;
|
|
183
|
+
this.isFocused = false;
|
|
184
|
+
this._appendTooltipEl();
|
|
185
|
+
this._setupEventHandlers();
|
|
186
|
+
}
|
|
187
|
+
static get defaults() {
|
|
188
|
+
return _defaults;
|
|
189
|
+
}
|
|
190
|
+
destroy() {
|
|
191
|
+
clearTimeout(this._enterDelayTimeout);
|
|
192
|
+
clearTimeout(this._exitDelayTimeout);
|
|
193
|
+
clearTimeout(this._animationTimeout);
|
|
194
|
+
clearTimeout(this._pressTimeout);
|
|
195
|
+
clearTimeout(this._lingerTimeout);
|
|
196
|
+
clearTimeout(this._outsideTimeout);
|
|
197
|
+
this.isOpen = false;
|
|
198
|
+
this.isHovered = false;
|
|
199
|
+
this.isFocused = false;
|
|
200
|
+
const descriptions = this.el.getAttribute("aria-describedby")?.split(/\s+/);
|
|
201
|
+
if (descriptions?.includes(this.tooltipEl.id)) {
|
|
202
|
+
const remaining = descriptions.filter((id) => id && id !== this.tooltipEl.id).join(" ");
|
|
203
|
+
if (remaining) this.el.setAttribute("aria-describedby", remaining);
|
|
204
|
+
else this.el.removeAttribute("aria-describedby");
|
|
205
|
+
}
|
|
206
|
+
if (this._originalContent) {
|
|
207
|
+
const { el, marker, display, priority, hidden, contentClass } = this._originalContent;
|
|
208
|
+
el.style.setProperty("display", display, priority);
|
|
209
|
+
restoreAttribute(el, "hidden", hidden);
|
|
210
|
+
el.classList.toggle("tooltip-content", contentClass);
|
|
211
|
+
if (!el.className) el.removeAttribute("class");
|
|
212
|
+
marker.replaceWith(el);
|
|
213
|
+
this._originalContent = null;
|
|
214
|
+
}
|
|
215
|
+
this.tooltipEl.remove();
|
|
216
|
+
Utils.setAnchorName(this.el, `--${this.tooltipEl.id}`, false);
|
|
217
|
+
super.destroy();
|
|
218
|
+
}
|
|
219
|
+
_appendTooltipEl() {
|
|
220
|
+
this.tooltipEl = document.createElement("div");
|
|
221
|
+
this.tooltipEl.classList.add("tooltip");
|
|
222
|
+
this.tooltipEl.id = `tooltip-${Utils.guid()}`;
|
|
223
|
+
this.tooltipEl.setAttribute("role", "tooltip");
|
|
224
|
+
this.el.setAttribute("aria-describedby", [this.el.getAttribute("aria-describedby"), this.tooltipEl.id].filter(Boolean).join(" "));
|
|
225
|
+
const richContentEl = this.options.tooltipId ? Utils.getElementById(this.el, this.options.tooltipId) : null;
|
|
226
|
+
if (this.options.tooltipId && !richContentEl) {
|
|
227
|
+
console.error(`Tooltip: no element with id "${this.options.tooltipId}"; showing the text tooltip instead.`);
|
|
228
|
+
}
|
|
229
|
+
const tooltipContentEl = richContentEl ?? document.createElement("div");
|
|
230
|
+
if (richContentEl) {
|
|
231
|
+
this.tooltipEl.classList.add("rich");
|
|
232
|
+
const marker = document.createComment("");
|
|
233
|
+
tooltipContentEl.before(marker);
|
|
234
|
+
this._originalContent = {
|
|
235
|
+
el: tooltipContentEl,
|
|
236
|
+
marker,
|
|
237
|
+
display: tooltipContentEl.style.display,
|
|
238
|
+
priority: tooltipContentEl.style.getPropertyPriority("display"),
|
|
239
|
+
hidden: tooltipContentEl.getAttribute("hidden"),
|
|
240
|
+
contentClass: tooltipContentEl.classList.contains("tooltip-content")
|
|
241
|
+
};
|
|
242
|
+
tooltipContentEl.removeAttribute("hidden");
|
|
243
|
+
}
|
|
244
|
+
tooltipContentEl.style.display = "";
|
|
245
|
+
tooltipContentEl.classList.add("tooltip-content");
|
|
246
|
+
this._setTooltipContent(tooltipContentEl);
|
|
247
|
+
this.tooltipEl.appendChild(tooltipContentEl);
|
|
248
|
+
Utils.portalRoot(this.el).appendChild(this.tooltipEl);
|
|
249
|
+
}
|
|
250
|
+
_setTooltipContent(tooltipContentEl) {
|
|
251
|
+
if (this._originalContent) return;
|
|
252
|
+
tooltipContentEl.innerText = this.options.text;
|
|
253
|
+
}
|
|
254
|
+
_updateTooltipContent() {
|
|
255
|
+
this._setTooltipContent(this.tooltipEl.querySelector(".tooltip-content"));
|
|
256
|
+
}
|
|
257
|
+
_setupEventHandlers() {
|
|
258
|
+
const { signal } = this._events;
|
|
259
|
+
const capture = { capture: true, signal };
|
|
260
|
+
for (const el of [this.el, this.tooltipEl]) {
|
|
261
|
+
el.addEventListener("mouseenter", this._handleMouseEnter, { signal });
|
|
262
|
+
el.addEventListener("mouseleave", this._handleMouseLeave, { signal });
|
|
263
|
+
el.addEventListener("focus", this._handleFocus, capture);
|
|
264
|
+
el.addEventListener("blur", this._handleBlur, capture);
|
|
265
|
+
}
|
|
266
|
+
this.el.addEventListener("pointerenter", this._handlePointerEnter, { signal });
|
|
267
|
+
this.el.addEventListener("pointerdown", this._handlePointerDown, { signal });
|
|
268
|
+
this.el.addEventListener("pointerup", this._handlePointerEnd, { signal });
|
|
269
|
+
this.el.addEventListener("pointercancel", this._handlePointerCancel, { signal });
|
|
270
|
+
this.el.addEventListener("click", this._handleClick, capture);
|
|
271
|
+
this.tooltipEl.addEventListener("click", this._handleTooltipClick, capture);
|
|
272
|
+
}
|
|
273
|
+
/** Show at once, without enterDelay, for a request that is its own delay: a long press or a click. */
|
|
274
|
+
_showNow() {
|
|
275
|
+
this.open();
|
|
276
|
+
clearTimeout(this._enterDelayTimeout);
|
|
277
|
+
this._animateIn();
|
|
278
|
+
}
|
|
279
|
+
/** Hide at once, without exitDelay, for an explicit dismissal. */
|
|
280
|
+
_hideNow() {
|
|
281
|
+
this.close();
|
|
282
|
+
clearTimeout(this._exitDelayTimeout);
|
|
283
|
+
this._animateOut();
|
|
284
|
+
}
|
|
285
|
+
_setExitDelayTimeout() {
|
|
286
|
+
clearTimeout(this._exitDelayTimeout);
|
|
287
|
+
this._exitDelayTimeout = setTimeout(() => {
|
|
288
|
+
if (this.isHovered || this.isFocused) return;
|
|
289
|
+
this._animateOut();
|
|
290
|
+
}, this.options.exitDelay);
|
|
291
|
+
}
|
|
292
|
+
_setEnterDelayTimeout(isManual) {
|
|
293
|
+
clearTimeout(this._enterDelayTimeout);
|
|
294
|
+
const skipDelay = skippingDelay(Date.now());
|
|
295
|
+
this._enterDelayTimeout = setTimeout(() => {
|
|
296
|
+
if (!this.isHovered && !this.isFocused && !isManual) return;
|
|
297
|
+
this._animateIn();
|
|
298
|
+
}, skipDelay ? 0 : this.options.enterDelay);
|
|
299
|
+
}
|
|
300
|
+
_positionTooltip() {
|
|
301
|
+
const tooltip = this.tooltipEl;
|
|
302
|
+
const origin = this.el, originHeight = origin.offsetHeight, originWidth = origin.offsetWidth, tooltipHeight = tooltip.offsetHeight, tooltipWidth = tooltip.offsetWidth, margin = this.options.margin;
|
|
303
|
+
this.xMovement = 0;
|
|
304
|
+
this.yMovement = 0;
|
|
305
|
+
const originRect = origin.getBoundingClientRect();
|
|
306
|
+
let targetTop = originRect.top + window.scrollY;
|
|
307
|
+
let targetLeft = originRect.left + window.scrollX;
|
|
308
|
+
if (this.options.position === "top") {
|
|
309
|
+
targetTop += -tooltipHeight - margin;
|
|
310
|
+
targetLeft += originWidth / 2 - tooltipWidth / 2;
|
|
311
|
+
this.yMovement = -this.options.transitionMovement;
|
|
312
|
+
} else if (this.options.position === "right") {
|
|
313
|
+
targetTop += originHeight / 2 - tooltipHeight / 2;
|
|
314
|
+
targetLeft += originWidth + margin;
|
|
315
|
+
this.xMovement = this.options.transitionMovement;
|
|
316
|
+
} else if (this.options.position === "left") {
|
|
317
|
+
targetTop += originHeight / 2 - tooltipHeight / 2;
|
|
318
|
+
targetLeft += -tooltipWidth - margin;
|
|
319
|
+
this.xMovement = -this.options.transitionMovement;
|
|
320
|
+
} else {
|
|
321
|
+
targetTop += originHeight + margin;
|
|
322
|
+
targetLeft += originWidth / 2 - tooltipWidth / 2;
|
|
323
|
+
this.yMovement = this.options.transitionMovement;
|
|
324
|
+
}
|
|
325
|
+
const newCoordinates = Utils._repositionWithinScreen(
|
|
326
|
+
targetLeft,
|
|
327
|
+
targetTop,
|
|
328
|
+
tooltipWidth,
|
|
329
|
+
tooltipHeight,
|
|
330
|
+
margin,
|
|
331
|
+
this.options.transitionMovement,
|
|
332
|
+
"center"
|
|
333
|
+
);
|
|
334
|
+
tooltip.style.setProperty("--md-comp-tooltip-anchor-gap", `${Math.max(0, margin) + Math.abs(this.options.transitionMovement)}px`);
|
|
335
|
+
Utils._placeInOffsetParent(tooltip, newCoordinates);
|
|
336
|
+
}
|
|
337
|
+
_place() {
|
|
338
|
+
if (anchorSupported) this._anchorTooltip();
|
|
339
|
+
else this._positionTooltip();
|
|
340
|
+
}
|
|
341
|
+
// Anchored to the trigger in CSS: position-area places the tooltip on the
|
|
342
|
+
// chosen side, centered, and position-try-fallbacks flips it to the other
|
|
343
|
+
// side when that one would leave the viewport. Script cannot tell which
|
|
344
|
+
// side won, so an anchored tooltip fades in without sliding, and the
|
|
345
|
+
// slide's distance joins the gap instead.
|
|
346
|
+
_anchorTooltip() {
|
|
347
|
+
const [area, alignment] = ANCHOR_PLACEMENT[this.options.position] ?? ANCHOR_PLACEMENT.bottom;
|
|
348
|
+
const name = `--${this.tooltipEl.id}`;
|
|
349
|
+
this.xMovement = 0;
|
|
350
|
+
this.yMovement = 0;
|
|
351
|
+
Utils.setAnchorName(this.el, name, true);
|
|
352
|
+
const style = this.tooltipEl.style;
|
|
353
|
+
style.position = "fixed";
|
|
354
|
+
style.inset = "auto";
|
|
355
|
+
style.margin = `${Math.max(0, this.options.margin) + Math.abs(this.options.transitionMovement)}px`;
|
|
356
|
+
style.setProperty("position-anchor", name);
|
|
357
|
+
style.setProperty("position-area", area);
|
|
358
|
+
style.setProperty(alignment, "anchor-center");
|
|
359
|
+
style.setProperty("position-try-fallbacks", "flip-block, flip-inline");
|
|
360
|
+
}
|
|
361
|
+
_animateIn() {
|
|
362
|
+
this._animate(true);
|
|
363
|
+
}
|
|
364
|
+
_animateOut() {
|
|
365
|
+
this._animate(false);
|
|
366
|
+
}
|
|
367
|
+
_animate(show) {
|
|
368
|
+
const style = this.tooltipEl.style;
|
|
369
|
+
const reduce = this.el.ownerDocument.defaultView.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
370
|
+
const duration = reduce ? 0 : show ? this.options.inDuration : this.options.outDuration;
|
|
371
|
+
if (show) {
|
|
372
|
+
this._place();
|
|
373
|
+
style.visibility = "visible";
|
|
374
|
+
style.overflow = "visible";
|
|
375
|
+
}
|
|
376
|
+
style.transition = `transform ${duration}ms ease-out, opacity ${duration}ms ease-out`;
|
|
377
|
+
clearTimeout(this._animationTimeout);
|
|
378
|
+
this._animationTimeout = setTimeout(() => {
|
|
379
|
+
style.transform = show && !reduce ? `translateX(${this.xMovement}px) translateY(${this.yMovement}px)` : "none";
|
|
380
|
+
style.opacity = show ? (this.options.opacity || 1).toString() : "0";
|
|
381
|
+
if (!show) this._animationTimeout = setTimeout(() => {
|
|
382
|
+
style.visibility = "hidden";
|
|
383
|
+
style.overflow = "";
|
|
384
|
+
}, duration);
|
|
385
|
+
}, 1);
|
|
386
|
+
this._reportShown(show);
|
|
387
|
+
}
|
|
388
|
+
_reportShown(show) {
|
|
389
|
+
if (show === this._shown) return;
|
|
390
|
+
this._shown = show;
|
|
391
|
+
this._notify(show ? "open" : "close");
|
|
392
|
+
}
|
|
393
|
+
/** Whether an event is a touch, noting when, so the mouse events that echo it are ignored. */
|
|
394
|
+
_touched(e) {
|
|
395
|
+
if (e.pointerType !== "touch") return false;
|
|
396
|
+
this._lastTouch = performance.now();
|
|
397
|
+
return true;
|
|
398
|
+
}
|
|
399
|
+
/** Whether an event is a touch for the long press, which a click tooltip does without. */
|
|
400
|
+
_longPress(e) {
|
|
401
|
+
return !this.options.openOnClick && this._touched(e);
|
|
402
|
+
}
|
|
403
|
+
/** A click tooltip toggles on what shows: one open() still holds back for enterDelay shows at once. */
|
|
404
|
+
_toggle(e) {
|
|
405
|
+
this._insideClick = e;
|
|
406
|
+
if (this._shown) this._hideNow();
|
|
407
|
+
else this._showNow();
|
|
408
|
+
}
|
|
409
|
+
/** Whether a node is the trigger or the tooltip, or inside either. */
|
|
410
|
+
_holds(node) {
|
|
411
|
+
return !!node && (this.el.contains(node) || this.tooltipEl.contains(node));
|
|
412
|
+
}
|
|
413
|
+
// A press on a rich tooltip's text blurs to nothing, so only focus that
|
|
414
|
+
// lands on another element closes a click tooltip.
|
|
415
|
+
_blurClickTooltip(next) {
|
|
416
|
+
if (next && (this.isOpen || this._shown)) this._hideNow();
|
|
417
|
+
}
|
|
418
|
+
_getAttributeOptions() {
|
|
419
|
+
const attributeOptions = {};
|
|
420
|
+
const tooltipTextOption = this.el.getAttribute("data-tooltip");
|
|
421
|
+
const tooltipId = this.el.getAttribute("data-tooltip-id");
|
|
422
|
+
const positionOption = this.el.getAttribute("data-position");
|
|
423
|
+
if (tooltipTextOption) {
|
|
424
|
+
attributeOptions.text = tooltipTextOption;
|
|
425
|
+
}
|
|
426
|
+
if (positionOption) {
|
|
427
|
+
attributeOptions.position = positionOption;
|
|
428
|
+
}
|
|
429
|
+
if (tooltipId) {
|
|
430
|
+
attributeOptions.tooltipId = tooltipId;
|
|
431
|
+
}
|
|
432
|
+
return attributeOptions;
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
Tooltip.key = "Expressive_Tooltip";
|
|
436
|
+
|
|
437
|
+
export {
|
|
438
|
+
Tooltip
|
|
439
|
+
};
|
|
440
|
+
//# sourceMappingURL=chunk-R7A7JRC5.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/ts/components/tooltip.ts"],
|
|
4
|
+
"sourcesContent": ["import { Utils, restoreAttribute } from '../core/utils';\nimport { Component, BaseOptions } from '../core/component';\n\nexport type TooltipPosition = 'top' | 'right' | 'bottom' | 'left';\n\n\n// CSS anchor positioning, where the browser has it: the tooltip follows its\n// trigger through scrolling and flips at the viewport edge without script\n// measuring anything. Elsewhere the coordinate path below still runs.\nconst anchorSupported = typeof CSS !== 'undefined' && !!CSS.supports?.('anchor-name: --a');\n\n// Per position: the position-area and the self-alignment that centers the\n// tooltip on its trigger.\nconst ANCHOR_PLACEMENT: Record<string, [string, string]> = {\n top: ['top', 'justify-self'],\n right: ['right', 'align-self'],\n left: ['left', 'align-self'],\n bottom: ['bottom', 'justify-self'],\n};\n\n/**\n * On touch, a press held this long shows the tooltip, as Android's long\n * press does, and the tooltip stays this long after the finger lifts.\n */\nconst LONG_PRESS = 500;\nconst TOUCH_LINGER = 1500;\n// After a touch the browser fires mouse events for compatibility; within\n// this long of one they are the touch again, not a mouse.\nconst TOUCH_ECHO = 800;\n// A long press that showed the tooltip was asking about the control, so the\n// click its release sends, within this long, does not activate it.\nconst PRESS_CLICK = 400;\n// A tooltip that opens while a tooltip is closing, or this long after that\n// one's exitDelay ends, shows without enterDelay, as tooltips along a toolbar\n// do. The window is shared by every tooltip; a clock earlier than its start,\n// after the system clock went back, is outside it.\nconst SKIP_DELAY_WINDOW = 300;\nlet skipDelayFrom = -Infinity;\nlet skipDelayUntil = -Infinity;\n\nconst skippingDelay = (now: number) => now >= skipDelayFrom && now < skipDelayUntil;\n\n/** A showing tooltip is closing: open the window, or extend it while an earlier one is still closing. */\nfunction startSkipDelay(exitDelay: number) {\n const now = Date.now();\n const end = now + exitDelay + SKIP_DELAY_WINDOW;\n skipDelayUntil = skippingDelay(now) ? Math.max(skipDelayUntil, end) : end;\n skipDelayFrom = now;\n}\n\nexport interface TooltipOptions extends BaseOptions {\n /**\n * Delay time before tooltip disappears.\n * @default 200\n */\n exitDelay: number;\n /**\n * Delay time before tooltip appears. Skipped while a tooltip is closing\n * and for 300ms after its exitDelay ends.\n * @default 0\n */\n enterDelay: number;\n /**\n * Element Id for the tooltip.\n * @default \"\"\n */\n tooltipId?: string;\n /**\n * Text string for the tooltip.\n * @default \"\"\n */\n text: string;\n /**\n * Set distance tooltip appears away from its activator\n * excluding transitionMovement.\n * @default 4\n */\n margin: number;\n /**\n * Enter transition duration.\n * @default 300\n */\n inDuration: number;\n /**\n * Opacity of the tooltip.\n * @default 1\n */\n opacity: number;\n /**\n * Exit transition duration.\n * @default 250\n */\n outDuration: number;\n /**\n * Set the direction of the tooltip.\n * @default 'bottom'\n */\n position: TooltipPosition;\n /**\n * Amount in px that the tooltip moves during its transition.\n * @default 10\n */\n transitionMovement: number;\n /**\n * Open on a click instead of hover and focus. A second click, Escape, a\n * click elsewhere or focus on another element closes it. On touch a tap\n * is the click, so the long press is off.\n * @default false\n */\n openOnClick: boolean;\n}\n\nconst _defaults: TooltipOptions = {\n exitDelay: 200,\n enterDelay: 0,\n text: '',\n margin: 4,\n inDuration: 250,\n outDuration: 200,\n position: 'bottom',\n transitionMovement: 10,\n opacity: 1,\n openOnClick: false\n};\n\nexport class Tooltip extends Component<TooltipOptions> {\n /**\n * If tooltip is open.\n */\n isOpen: boolean;\n /**\n * If tooltip is hovered.\n */\n isHovered: boolean;\n /**\n * If tooltip is focused.\n */\n isFocused: boolean;\n tooltipEl: HTMLElement;\n private _exitDelayTimeout: ReturnType<typeof setTimeout>;\n private _enterDelayTimeout: ReturnType<typeof setTimeout>;\n private _animationTimeout: ReturnType<typeof setTimeout>;\n private _pressTimeout: ReturnType<typeof setTimeout>;\n private _lingerTimeout: ReturnType<typeof setTimeout>;\n private _outsideTimeout: ReturnType<typeof setTimeout>;\n /** The last click on the trigger or inside the tooltip, which the document listener leaves alone. */\n private _insideClick: Event | null = null;\n /** When the last touch began or ended, to tell its mouse events from a mouse. */\n private _lastTouch = -Infinity;\n /** Whether a long press showed the tooltip, until it closes or a mouse hovers. */\n private _touchShown = false;\n /** Until when a click is the release of a long press, not a tap. */\n private _swallowClickUntil = -Infinity;\n // Whether the last animation showed the tooltip, so each change is reported once.\n private _shown = false;\n private _originalContent: {\n el: HTMLElement;\n marker: Comment;\n display: string;\n priority: string;\n hidden: string | null;\n contentClass: boolean;\n };\n xMovement: number;\n yMovement: number;\n\n constructor(el: HTMLElement, options: Partial<TooltipOptions>) {\n super(el, options);\n\n // The data-* options win over the defaults and the options, as open()\n // has them win each time it reads them again. Init used to put the\n // options last, so a tooltip changed side or text on its first open.\n this.options = { ...this.options, ...this._getAttributeOptions() };\n\n this.isOpen = false;\n this.isHovered = false;\n this.isFocused = false;\n this._appendTooltipEl();\n this._setupEventHandlers();\n }\n\n static get defaults(): TooltipOptions {\n return _defaults;\n }\n\n static key = 'Expressive_Tooltip';\n\n destroy() {\n clearTimeout(this._enterDelayTimeout);\n clearTimeout(this._exitDelayTimeout);\n clearTimeout(this._animationTimeout);\n clearTimeout(this._pressTimeout);\n clearTimeout(this._lingerTimeout);\n clearTimeout(this._outsideTimeout);\n this.isOpen = false;\n this.isHovered = false;\n this.isFocused = false;\n const descriptions = this.el.getAttribute('aria-describedby')?.split(/\\s+/);\n if (descriptions?.includes(this.tooltipEl.id)) {\n const remaining = descriptions.filter(id => id && id !== this.tooltipEl.id).join(' ');\n if (remaining) this.el.setAttribute('aria-describedby', remaining);\n else this.el.removeAttribute('aria-describedby');\n }\n if (this._originalContent) {\n const { el, marker, display, priority, hidden, contentClass } = this._originalContent;\n el.style.setProperty('display', display, priority);\n restoreAttribute(el, 'hidden', hidden);\n el.classList.toggle('tooltip-content', contentClass);\n if (!el.className) el.removeAttribute('class');\n marker.replaceWith(el);\n this._originalContent = null;\n }\n this.tooltipEl.remove();\n Utils.setAnchorName(this.el, `--${this.tooltipEl.id}`, false);\n super.destroy();\n }\n\n _appendTooltipEl() {\n this.tooltipEl = document.createElement('div');\n this.tooltipEl.classList.add('tooltip');\n this.tooltipEl.id = `tooltip-${Utils.guid()}`;\n this.tooltipEl.setAttribute('role', 'tooltip');\n this.el.setAttribute('aria-describedby', [this.el.getAttribute('aria-describedby'), this.tooltipEl.id].filter(Boolean).join(' '));\n\n const richContentEl = this.options.tooltipId\n ? Utils.getElementById(this.el, this.options.tooltipId)\n : null;\n if (this.options.tooltipId && !richContentEl) {\n console.error(`Tooltip: no element with id \"${this.options.tooltipId}\"; showing the text tooltip instead.`);\n }\n const tooltipContentEl = richContentEl ?? document.createElement('div');\n if (richContentEl) {\n this.tooltipEl.classList.add('rich');\n const marker = document.createComment('');\n tooltipContentEl.before(marker);\n this._originalContent = {\n el: tooltipContentEl, marker,\n display: tooltipContentEl.style.display,\n priority: tooltipContentEl.style.getPropertyPriority('display'),\n hidden: tooltipContentEl.getAttribute('hidden'),\n contentClass: tooltipContentEl.classList.contains('tooltip-content')\n };\n tooltipContentEl.removeAttribute('hidden');\n }\n tooltipContentEl.style.display = '';\n tooltipContentEl.classList.add('tooltip-content');\n this._setTooltipContent(tooltipContentEl);\n this.tooltipEl.appendChild(tooltipContentEl);\n Utils.portalRoot(this.el).appendChild(this.tooltipEl);\n }\n\n _setTooltipContent(tooltipContentEl: HTMLElement) {\n if (this._originalContent) return;\n tooltipContentEl.innerText = this.options.text;\n }\n\n _updateTooltipContent() {\n this._setTooltipContent(this.tooltipEl.querySelector('.tooltip-content'));\n }\n\n _setupEventHandlers() {\n const { signal } = this._events;\n const capture = { capture: true, signal };\n for (const el of [this.el, this.tooltipEl]) {\n el.addEventListener('mouseenter', this._handleMouseEnter, { signal });\n el.addEventListener('mouseleave', this._handleMouseLeave, { signal });\n el.addEventListener('focus', this._handleFocus, capture);\n el.addEventListener('blur', this._handleBlur, capture);\n }\n this.el.addEventListener('pointerenter', this._handlePointerEnter, { signal });\n this.el.addEventListener('pointerdown', this._handlePointerDown, { signal });\n this.el.addEventListener('pointerup', this._handlePointerEnd, { signal });\n this.el.addEventListener('pointercancel', this._handlePointerCancel, { signal });\n this.el.addEventListener('click', this._handleClick, capture);\n this.tooltipEl.addEventListener('click', this._handleTooltipClick, capture);\n }\n\n /**\n * Show tooltip.\n */\n open = (isManual: boolean = true) => {\n if (this.isOpen) return;\n clearTimeout(this._exitDelayTimeout);\n clearTimeout(this._animationTimeout);\n this.isOpen = true;\n // Escape and outside clicks are only listened for while open. close()\n // removes them, and destroy() through the signal.\n const { signal } = this._events;\n this.el.ownerDocument.addEventListener('keydown', this._handleKeydown, { capture: true, signal });\n // A task later, so the click that opened it, on the trigger or on a page\n // button that called open(), does not reach the listener and close it.\n if (this.options.openOnClick) {\n this._outsideTimeout = setTimeout(() => this.el.ownerDocument.addEventListener('click', this._handleDocumentClick, { signal }));\n }\n // Update tooltip content with HTML attribute options\n this.options = { ...this.options, ...this._getAttributeOptions() };\n this._updateTooltipContent();\n this._setEnterDelayTimeout(isManual);\n };\n\n /**\n * Hide tooltip.\n */\n close = () => {\n // A press or linger from an earlier touch has no say over a later opening.\n clearTimeout(this._pressTimeout);\n clearTimeout(this._lingerTimeout);\n this._touchShown = false;\n if (!this.isOpen) return;\n if (this._shown) startSkipDelay(this.options.exitDelay);\n this.isHovered = false;\n this.isFocused = false;\n this.isOpen = false;\n this.el.ownerDocument.removeEventListener('keydown', this._handleKeydown, true);\n clearTimeout(this._outsideTimeout);\n this.el.ownerDocument.removeEventListener('click', this._handleDocumentClick);\n clearTimeout(this._enterDelayTimeout);\n this._setExitDelayTimeout();\n };\n\n /** Show at once, without enterDelay, for a request that is its own delay: a long press or a click. */\n private _showNow() {\n this.open();\n clearTimeout(this._enterDelayTimeout);\n this._animateIn();\n }\n\n /** Hide at once, without exitDelay, for an explicit dismissal. */\n private _hideNow() {\n this.close();\n clearTimeout(this._exitDelayTimeout);\n this._animateOut();\n }\n\n _setExitDelayTimeout() {\n clearTimeout(this._exitDelayTimeout);\n this._exitDelayTimeout = setTimeout(() => {\n if (this.isHovered || this.isFocused) return;\n this._animateOut();\n }, this.options.exitDelay);\n }\n\n _setEnterDelayTimeout(isManual: boolean): void {\n clearTimeout(this._enterDelayTimeout);\n const skipDelay = skippingDelay(Date.now());\n this._enterDelayTimeout = setTimeout(() => {\n if (!this.isHovered && !this.isFocused && !isManual) return;\n this._animateIn();\n }, skipDelay ? 0 : this.options.enterDelay);\n }\n\n _positionTooltip() {\n const tooltip: HTMLElement = this.tooltipEl;\n const origin = this.el,\n originHeight = origin.offsetHeight,\n originWidth = origin.offsetWidth,\n tooltipHeight = tooltip.offsetHeight,\n tooltipWidth = tooltip.offsetWidth,\n margin = this.options.margin;\n\n this.xMovement = 0;\n this.yMovement = 0;\n\n const originRect = origin.getBoundingClientRect();\n let targetTop = originRect.top + window.scrollY;\n let targetLeft = originRect.left + window.scrollX;\n if (this.options.position === 'top') {\n targetTop += -tooltipHeight - margin;\n targetLeft += originWidth / 2 - tooltipWidth / 2;\n this.yMovement = -this.options.transitionMovement;\n } else if (this.options.position === 'right') {\n targetTop += originHeight / 2 - tooltipHeight / 2;\n targetLeft += originWidth + margin;\n this.xMovement = this.options.transitionMovement;\n } else if (this.options.position === 'left') {\n targetTop += originHeight / 2 - tooltipHeight / 2;\n targetLeft += -tooltipWidth - margin;\n this.xMovement = -this.options.transitionMovement;\n } else {\n targetTop += originHeight + margin;\n targetLeft += originWidth / 2 - tooltipWidth / 2;\n this.yMovement = this.options.transitionMovement;\n }\n\n const newCoordinates = Utils._repositionWithinScreen(\n targetLeft, targetTop, tooltipWidth, tooltipHeight, margin, this.options.transitionMovement, 'center'\n );\n\n tooltip.style.setProperty('--md-comp-tooltip-anchor-gap', `${Math.max(0, margin) + Math.abs(this.options.transitionMovement)}px`);\n Utils._placeInOffsetParent(tooltip, newCoordinates);\n }\n\n _place() {\n if (anchorSupported) this._anchorTooltip();\n else this._positionTooltip();\n }\n\n // Anchored to the trigger in CSS: position-area places the tooltip on the\n // chosen side, centered, and position-try-fallbacks flips it to the other\n // side when that one would leave the viewport. Script cannot tell which\n // side won, so an anchored tooltip fades in without sliding, and the\n // slide's distance joins the gap instead.\n _anchorTooltip() {\n const [area, alignment] = ANCHOR_PLACEMENT[this.options.position] ?? ANCHOR_PLACEMENT.bottom;\n const name = `--${this.tooltipEl.id}`;\n this.xMovement = 0;\n this.yMovement = 0;\n Utils.setAnchorName(this.el, name, true);\n const style = this.tooltipEl.style;\n style.position = 'fixed';\n style.inset = 'auto';\n style.margin = `${Math.max(0, this.options.margin) + Math.abs(this.options.transitionMovement)}px`;\n style.setProperty('position-anchor', name);\n style.setProperty('position-area', area);\n style.setProperty(alignment, 'anchor-center');\n style.setProperty('position-try-fallbacks', 'flip-block, flip-inline');\n }\n\n _animateIn() { this._animate(true); }\n\n _animateOut() { this._animate(false); }\n\n _animate(show: boolean) {\n const style = this.tooltipEl.style;\n const reduce = this.el.ownerDocument.defaultView.matchMedia('(prefers-reduced-motion: reduce)').matches;\n const duration = reduce ? 0 : show ? this.options.inDuration : this.options.outDuration;\n if (show) {\n this._place();\n style.visibility = 'visible';\n style.overflow = 'visible';\n }\n style.transition = `transform ${duration}ms ease-out, opacity ${duration}ms ease-out`;\n clearTimeout(this._animationTimeout);\n this._animationTimeout = setTimeout(() => {\n style.transform = show && !reduce ? `translateX(${this.xMovement}px) translateY(${this.yMovement}px)` : 'none';\n style.opacity = show ? (this.options.opacity || 1).toString() : '0';\n if (!show) this._animationTimeout = setTimeout(() => {\n style.visibility = 'hidden';\n style.overflow = '';\n }, duration);\n }, 1);\n this._reportShown(show);\n }\n\n private _reportShown(show: boolean) {\n if (show === this._shown) return;\n this._shown = show;\n this._notify(show ? 'open' : 'close');\n }\n\n _handleMouseEnter = () => {\n // A tap's mouse events are not a hover; touch shows the tooltip on a long press.\n if (this.options.openOnClick || performance.now() - this._lastTouch < TOUCH_ECHO) return;\n this._touchShown = false;\n this.isHovered = true;\n this.open(false);\n };\n\n /** Whether an event is a touch, noting when, so the mouse events that echo it are ignored. */\n private _touched(e: PointerEvent) {\n if (e.pointerType !== 'touch') return false;\n this._lastTouch = performance.now();\n return true;\n }\n\n /** Whether an event is a touch for the long press, which a click tooltip does without. */\n private _longPress(e: PointerEvent) {\n return !this.options.openOnClick && this._touched(e);\n }\n\n // pointerenter comes before any compatibility mouseenter, in whatever order\n // a browser sends those, so the touch is known before its mouse events.\n _handlePointerEnter = (e: PointerEvent) => {\n this._touched(e);\n };\n\n /** A touch held for LONG_PRESS shows the tooltip, unless it turns into a scroll first. */\n _handlePointerDown = (e: PointerEvent) => {\n if (!this._longPress(e)) return;\n clearTimeout(this._lingerTimeout);\n clearTimeout(this._pressTimeout);\n // The long press is the delay, so it shows at once rather than after\n // enterDelay, and the linger after the finger lifts always follows a\n // tooltip that is showing.\n this._pressTimeout = setTimeout(() => {\n this.isHovered = true;\n this._showNow();\n this._touchShown = true;\n }, LONG_PRESS);\n };\n\n /** The finger lifted: a press too short stays a tap, and a tooltip it showed lingers for TOUCH_LINGER. */\n _handlePointerEnd = (e: PointerEvent) => {\n if (!this._longPress(e)) return;\n clearTimeout(this._pressTimeout);\n if (this._touchShown) this._swallowClickUntil = performance.now() + PRESS_CLICK;\n // Any release while it shows, even a second tap during the linger, starts the linger again.\n if (!this.isOpen) return;\n this.isHovered = false;\n // A mouse that hovers in the meantime keeps it, as focus does.\n this._lingerTimeout = setTimeout(() => this.isHovered || this.isFocused || this.close(), TOUCH_LINGER);\n };\n\n /**\n * A click tooltip toggles. Otherwise the click a long press's release sends\n * would press the button or follow the link, so it is consumed.\n */\n _handleClick = (e: MouseEvent) => {\n if (this.options.openOnClick) return this._toggle(e);\n if (performance.now() > this._swallowClickUntil) return;\n this._swallowClickUntil = -Infinity;\n e.preventDefault();\n e.stopImmediatePropagation();\n };\n\n /** A click tooltip toggles on what shows: one open() still holds back for enterDelay shows at once. */\n private _toggle(e: MouseEvent) {\n this._insideClick = e;\n if (this._shown) this._hideNow();\n else this._showNow();\n }\n\n // Marked rather than found on the composed path, which a document listener\n // cannot see into when the tooltip sits in a closed shadow root.\n _handleTooltipClick = (e: MouseEvent) => {\n this._insideClick = e;\n };\n\n _handleDocumentClick = (e: MouseEvent) => {\n if (e !== this._insideClick) this._hideNow();\n };\n\n /**\n * The browser took the touch to scroll: no tooltip opens, not even one\n * waiting out enterDelay, and one the touch showed closes at once.\n */\n _handlePointerCancel = (e: PointerEvent) => {\n if (!this._longPress(e)) return;\n clearTimeout(this._pressTimeout);\n // Lingering after an earlier press too; a mouse hover or focus keeps it.\n if (!this._touchShown) return;\n this.isHovered = false;\n if (!this.isFocused) this.close();\n };\n\n /** Whether a node is the trigger or the tooltip, or inside either. */\n private _holds(node: Node | null) {\n return !!node && (this.el.contains(node) || this.tooltipEl.contains(node));\n }\n\n _handleMouseLeave = (event: MouseEvent) => {\n if (this.options.openOnClick || this._holds(event.relatedTarget as Node | null)) return;\n this.isHovered = false;\n if (!this.isFocused) this.close();\n };\n\n _handleKeydown = (event: KeyboardEvent) => {\n if (event.key !== 'Escape' || !this.isOpen) return;\n // Escape always dismisses the tooltip, but it is only the tooltip's key\n // when focus is on its trigger. A tooltip left open by hover must not\n // swallow the Escape meant for the dialog or menu that has focus.\n if (Utils.focusIsIn(this.el, this.tooltipEl)) {\n event.preventDefault();\n event.stopPropagation();\n }\n this._hideNow();\n };\n\n // Focus opens the tooltip only when it arrived by keyboard: a pointer press\n // on the trigger also focuses it, and _handleMouseEnter already covers that.\n _handleFocus = (event: FocusEvent) => {\n // A click tooltip opens on the click that Enter or Space sends instead.\n if (!this.options.openOnClick && (event.target as HTMLElement).matches(':focus-visible')) {\n this.isFocused = true;\n this.open(false);\n }\n };\n\n _handleBlur = (event: FocusEvent) => {\n const next = event.relatedTarget as Node | null;\n if (this._holds(next)) return;\n if (this.options.openOnClick) return this._blurClickTooltip(next);\n this.isFocused = false;\n if (!this.isHovered) this.close();\n };\n\n // A press on a rich tooltip's text blurs to nothing, so only focus that\n // lands on another element closes a click tooltip.\n private _blurClickTooltip(next: Node | null) {\n if (next && (this.isOpen || this._shown)) this._hideNow();\n }\n\n _getAttributeOptions(): Partial<TooltipOptions> {\n const attributeOptions: Partial<TooltipOptions> = {};\n const tooltipTextOption = this.el.getAttribute('data-tooltip');\n const tooltipId = this.el.getAttribute('data-tooltip-id');\n const positionOption = this.el.getAttribute('data-position');\n if (tooltipTextOption) {\n attributeOptions.text = tooltipTextOption;\n }\n if (positionOption) {\n attributeOptions.position = positionOption as TooltipPosition;\n }\n if (tooltipId) {\n attributeOptions.tooltipId = tooltipId;\n }\n\n return attributeOptions;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AASA,IAAM,kBAAkB,OAAO,QAAQ,eAAe,CAAC,CAAC,IAAI,WAAW,kBAAkB;AAIzF,IAAM,mBAAqD;AAAA,EACzD,KAAK,CAAC,OAAO,cAAc;AAAA,EAC3B,OAAO,CAAC,SAAS,YAAY;AAAA,EAC7B,MAAM,CAAC,QAAQ,YAAY;AAAA,EAC3B,QAAQ,CAAC,UAAU,cAAc;AACnC;AAMA,IAAM,aAAa;AACnB,IAAM,eAAe;AAGrB,IAAM,aAAa;AAGnB,IAAM,cAAc;AAKpB,IAAM,oBAAoB;AAC1B,IAAI,gBAAgB;AACpB,IAAI,iBAAiB;AAErB,IAAM,gBAAgB,CAAC,QAAgB,OAAO,iBAAiB,MAAM;AAGrE,SAAS,eAAe,WAAmB;AACzC,QAAM,MAAM,KAAK,IAAI;AACrB,QAAM,MAAM,MAAM,YAAY;AAC9B,mBAAiB,cAAc,GAAG,IAAI,KAAK,IAAI,gBAAgB,GAAG,IAAI;AACtE,kBA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AAO;AAAA,IAC1B;AACA,QAAI,gBAAgB;AAClB,uBAAiB,WAAW;AAAA,IAC9B;AACA,QAAI,WAAW;AACb,uBAAiB,YAAY;AAAA,IAC/B;AAEA,WAAO;AAAA,EACT;AACF;AApea,QA4DJ,MAAM;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LineChart,
|
|
3
|
+
percentLabel
|
|
4
|
+
} from "./chunk-IQOTGGHX.mjs";
|
|
5
|
+
|
|
6
|
+
// src/ts/components/funnelChart.ts
|
|
7
|
+
function widths(values) {
|
|
8
|
+
const largest = values.reduce((max, value) => Math.max(max, value ?? 0), 0);
|
|
9
|
+
return values.map((value) => value > 0 ? value / largest * 100 : null);
|
|
10
|
+
}
|
|
11
|
+
function stage(width, from) {
|
|
12
|
+
const span = document.createElement("span");
|
|
13
|
+
span.dataset.series = "1";
|
|
14
|
+
span.style.setProperty("--width", String(width));
|
|
15
|
+
if (from != null) span.style.setProperty("--from-width", String(from));
|
|
16
|
+
return span;
|
|
17
|
+
}
|
|
18
|
+
var FunnelChart = class extends LineChart {
|
|
19
|
+
get _type() {
|
|
20
|
+
return "funnel-chart";
|
|
21
|
+
}
|
|
22
|
+
get _horizontal() {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
/** A funnel has no value axis. */
|
|
26
|
+
get _axis() {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
get _points() {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
/** Every stage is the first series' color, so the tooltip's swatches all match it. */
|
|
33
|
+
_read() {
|
|
34
|
+
super._read();
|
|
35
|
+
for (const series of this.series) series.color = "1";
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A row's value as a percentage of the first row's, in whole percentages
|
|
39
|
+
* with a tenth below 10%, or '' when either row has no stage.
|
|
40
|
+
*/
|
|
41
|
+
_share(index) {
|
|
42
|
+
const values = this.series[0].values;
|
|
43
|
+
const [first, value] = [values[0], values[index]];
|
|
44
|
+
if (!(first > 0 && value > 0)) return "";
|
|
45
|
+
return percentLabel(this.el, value / first);
|
|
46
|
+
}
|
|
47
|
+
/** A funnel has one series of stages, so it has no legend. */
|
|
48
|
+
_legend() {
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A row per table row, holding its stage. After update(), each stage
|
|
53
|
+
* starts from its old width, which CSS reads as --from-width.
|
|
54
|
+
*/
|
|
55
|
+
_draw() {
|
|
56
|
+
const stages = document.createElement("div");
|
|
57
|
+
stages.className = "funnel-chart-stages";
|
|
58
|
+
stages.setAttribute("aria-hidden", "true");
|
|
59
|
+
this._plot.style.setProperty("--rows", String(this.labels.length));
|
|
60
|
+
const was = widths(this._before[0]?.values ?? []);
|
|
61
|
+
widths(this.series[0].values).forEach((width, i) => {
|
|
62
|
+
const row = document.createElement("div");
|
|
63
|
+
if (width !== null) row.append(stage(width, was[i]));
|
|
64
|
+
stages.append(row);
|
|
65
|
+
});
|
|
66
|
+
return stages;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
FunnelChart.key = "Expressive_FunnelChart";
|
|
70
|
+
|
|
71
|
+
export {
|
|
72
|
+
FunnelChart
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=chunk-RKG2CBFE.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/ts/components/funnelChart.ts"],
|
|
4
|
+
"sourcesContent": ["import { LineChart, LineChartOptions, percentLabel } from './lineChart';\n\nexport type FunnelChartOptions = LineChartOptions;\n\n/**\n * Each value's stage width as a percentage of the largest value, or null\n * for a row with no stage: a gap, zero or a negative value.\n */\nfunction widths(values: (number | null)[]): (number | null)[] {\n const largest = values.reduce<number>((max, value) => Math.max(max, value ?? 0), 0);\n return values.map((value) => (value! > 0 ? (value! / largest) * 100 : null));\n}\n\n/** A stage `width` percent of the plot wide, which grows from `from` percent. */\nfunction stage(width: number, from: number | null | undefined) {\n const span = document.createElement('span');\n span.dataset.series = '1';\n span.style.setProperty('--width', String(width));\n if (from != null) span.style.setProperty('--from-width', String(from));\n return span;\n}\n\n/**\n * Funnel chart. It reads its <table> like LineChart, but draws each row of\n * the first value column as a stage, top to bottom in table order, as wide\n * as its value against the largest one and centered on the plot. Further\n * columns show in the tooltip, which also gives each stage's value as a\n * percentage of the first row's. The up and down arrows move the tooltip\n * between rows.\n *\n * Call `update()` after changing the table, or start it with `watch` or\n * `data-watch`.\n */\nexport class FunnelChart extends LineChart {\n protected get _type() {\n return 'funnel-chart';\n }\n\n protected get _horizontal() {\n return true;\n }\n\n /** A funnel has no value axis. */\n protected get _axis() {\n return false;\n }\n\n protected get _points() {\n return false;\n }\n\n static key = 'Expressive_FunnelChart';\n\n /** Every stage is the first series' color, so the tooltip's swatches all match it. */\n protected _read() {\n super._read();\n for (const series of this.series) series.color = '1';\n }\n\n /**\n * A row's value as a percentage of the first row's, in whole percentages\n * with a tenth below 10%, or '' when either row has no stage.\n */\n protected _share(index: number) {\n const values = this.series[0].values;\n const [first, value] = [values[0], values[index]];\n if (!(first! > 0 && value! > 0)) return '';\n return percentLabel(this.el, value! / first!);\n }\n\n /** A funnel has one series of stages, so it has no legend. */\n protected _legend(): Element[] {\n return [];\n }\n\n /**\n * A row per table row, holding its stage. After update(), each stage\n * starts from its old width, which CSS reads as --from-width.\n */\n protected _draw(): Element {\n const stages = document.createElement('div');\n stages.className = 'funnel-chart-stages';\n stages.setAttribute('aria-hidden', 'true');\n this._plot.style.setProperty('--rows', String(this.labels.length));\n const was = widths(this._before[0]?.values ?? []);\n widths(this.series[0].values).forEach((width, i) => {\n const row = document.createElement('div');\n if (width !== null) row.append(stage(width, was[i]));\n stages.append(row);\n });\n return stages;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;AAQA,SAAS,OAAO,QAA8C;AAC5D,QAAM,UAA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