@sondor-technology/sondor-components 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion/accordion.constants.d.ts +5 -0
- package/dist/components/accordion/accordion.constants.d.ts.map +1 -0
- package/dist/components/accordion/accordion.constants.js +3 -0
- package/dist/components/accordion/accordion.constants.js.map +1 -0
- package/dist/components/accordion/accordion.d.ts +29 -0
- package/dist/components/accordion/accordion.d.ts.map +1 -0
- package/dist/components/accordion/accordion.js +226 -0
- package/dist/components/accordion/accordion.js.map +1 -0
- package/dist/components/alert/alert.constants.d.ts +2 -0
- package/dist/components/alert/alert.constants.d.ts.map +1 -1
- package/dist/components/alert/alert.d.ts +50 -2
- package/dist/components/alert/alert.d.ts.map +1 -1
- package/dist/components/alert/alert.js +285 -16
- package/dist/components/alert/alert.js.map +1 -1
- package/dist/components/avatar/avatar.d.ts +20 -0
- package/dist/components/avatar/avatar.d.ts.map +1 -0
- package/dist/components/avatar/avatar.js +100 -0
- package/dist/components/avatar/avatar.js.map +1 -0
- package/dist/components/back-to-top/back-to-top.d.ts +29 -0
- package/dist/components/back-to-top/back-to-top.d.ts.map +1 -0
- package/dist/components/back-to-top/back-to-top.js +149 -0
- package/dist/components/back-to-top/back-to-top.js.map +1 -0
- package/dist/components/bar-chart/bar-chart.d.ts +42 -0
- package/dist/components/bar-chart/bar-chart.d.ts.map +1 -0
- package/dist/components/bar-chart/bar-chart.js +298 -0
- package/dist/components/bar-chart/bar-chart.js.map +1 -0
- package/dist/components/breadcrumb/breadcrumb.js +2 -2
- package/dist/components/button/button.d.ts +1 -0
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/button.js +8 -8
- package/dist/components/button/button.js.map +1 -1
- package/dist/components/button-group/button-group.js +4 -4
- package/dist/components/calendar/calendar.d.ts.map +1 -1
- package/dist/components/calendar/calendar.js +11 -9
- package/dist/components/calendar/calendar.js.map +1 -1
- package/dist/components/chart/chart-base.d.ts +59 -0
- package/dist/components/chart/chart-base.d.ts.map +1 -0
- package/dist/components/chart/chart-base.js +261 -0
- package/dist/components/chart/chart-base.js.map +1 -0
- package/dist/components/chart/chart.utils.d.ts +27 -0
- package/dist/components/chart/chart.utils.d.ts.map +1 -0
- package/dist/components/chart/chart.utils.js +117 -0
- package/dist/components/chart/chart.utils.js.map +1 -0
- package/dist/components/code-block/code-block.d.ts +5 -0
- package/dist/components/code-block/code-block.d.ts.map +1 -1
- package/dist/components/code-block/code-block.js +34 -24
- package/dist/components/code-block/code-block.js.map +1 -1
- package/dist/components/consent/consent.d.ts +63 -0
- package/dist/components/consent/consent.d.ts.map +1 -0
- package/dist/components/consent/consent.js +327 -0
- package/dist/components/consent/consent.js.map +1 -0
- package/dist/components/consent/consent.utils.d.ts +36 -0
- package/dist/components/consent/consent.utils.d.ts.map +1 -0
- package/dist/components/consent/consent.utils.js +82 -0
- package/dist/components/consent/consent.utils.js.map +1 -0
- package/dist/components/contact/contact.d.ts +22 -0
- package/dist/components/contact/contact.d.ts.map +1 -0
- package/dist/components/contact/contact.js +83 -0
- package/dist/components/contact/contact.js.map +1 -0
- package/dist/components/container/container.d.ts +20 -0
- package/dist/components/container/container.d.ts.map +1 -0
- package/dist/components/container/container.js +68 -0
- package/dist/components/container/container.js.map +1 -0
- package/dist/components/content-card/content-card.js +4 -4
- package/dist/components/context-menu/context-menu.d.ts +89 -0
- package/dist/components/context-menu/context-menu.d.ts.map +1 -0
- package/dist/components/context-menu/context-menu.js +414 -0
- package/dist/components/context-menu/context-menu.js.map +1 -0
- package/dist/components/cron-builder/cron-builder.d.ts.map +1 -1
- package/dist/components/cron-builder/cron-builder.js +13 -11
- package/dist/components/cron-builder/cron-builder.js.map +1 -1
- package/dist/components/cta/cta.d.ts +20 -0
- package/dist/components/cta/cta.d.ts.map +1 -0
- package/dist/components/cta/cta.js +64 -0
- package/dist/components/cta/cta.js.map +1 -0
- package/dist/components/drawer/drawer.js +6 -6
- package/dist/components/faq/faq-item.d.ts +22 -0
- package/dist/components/faq/faq-item.d.ts.map +1 -0
- package/dist/components/faq/faq-item.js +117 -0
- package/dist/components/faq/faq-item.js.map +1 -0
- package/dist/components/faq/faq.d.ts +18 -0
- package/dist/components/faq/faq.d.ts.map +1 -0
- package/dist/components/faq/faq.js +38 -0
- package/dist/components/faq/faq.js.map +1 -0
- package/dist/components/feature-grid/feature-grid.d.ts +22 -0
- package/dist/components/feature-grid/feature-grid.d.ts.map +1 -0
- package/dist/components/feature-grid/feature-grid.js +55 -0
- package/dist/components/feature-grid/feature-grid.js.map +1 -0
- package/dist/components/feature-grid/feature.d.ts +18 -0
- package/dist/components/feature-grid/feature.d.ts.map +1 -0
- package/dist/components/feature-grid/feature.js +91 -0
- package/dist/components/feature-grid/feature.js.map +1 -0
- package/dist/components/field/field.js +2 -2
- package/dist/components/footer/footer.js +4 -4
- package/dist/components/form/form-reset.d.ts +7 -0
- package/dist/components/form/form-reset.d.ts.map +1 -0
- package/dist/components/form/form-reset.js +47 -0
- package/dist/components/form/form-reset.js.map +1 -0
- package/dist/components/form/form.d.ts +5 -0
- package/dist/components/form/form.d.ts.map +1 -1
- package/dist/components/form/form.js +17 -3
- package/dist/components/form/form.js.map +1 -1
- package/dist/components/grid/grid.d.ts +5 -0
- package/dist/components/grid/grid.d.ts.map +1 -1
- package/dist/components/grid/grid.js +86 -4
- package/dist/components/grid/grid.js.map +1 -1
- package/dist/components/heat-map/heat-map.d.ts +39 -0
- package/dist/components/heat-map/heat-map.d.ts.map +1 -0
- package/dist/components/heat-map/heat-map.js +306 -0
- package/dist/components/heat-map/heat-map.js.map +1 -0
- package/dist/components/hero/hero.d.ts +26 -0
- package/dist/components/hero/hero.d.ts.map +1 -0
- package/dist/components/hero/hero.js +132 -0
- package/dist/components/hero/hero.js.map +1 -0
- package/dist/components/icon/icon-paths.d.ts +84 -0
- package/dist/components/icon/icon-paths.d.ts.map +1 -1
- package/dist/components/icon/icon-paths.js +89 -0
- package/dist/components/icon/icon-paths.js.map +1 -1
- package/dist/components/icon/icon.d.ts +2 -0
- package/dist/components/icon/icon.d.ts.map +1 -1
- package/dist/components/icon/icon.js +10 -1
- package/dist/components/icon/icon.js.map +1 -1
- package/dist/components/image/image.d.ts +31 -0
- package/dist/components/image/image.d.ts.map +1 -0
- package/dist/components/image/image.js +179 -0
- package/dist/components/image/image.js.map +1 -0
- package/dist/components/input/input.js +4 -4
- package/dist/components/lazy/lazy.d.ts +34 -0
- package/dist/components/lazy/lazy.d.ts.map +1 -0
- package/dist/components/lazy/lazy.js +104 -0
- package/dist/components/lazy/lazy.js.map +1 -0
- package/dist/components/line-chart/line-chart.d.ts +37 -0
- package/dist/components/line-chart/line-chart.d.ts.map +1 -0
- package/dist/components/line-chart/line-chart.js +271 -0
- package/dist/components/line-chart/line-chart.js.map +1 -0
- package/dist/components/list/list-item.d.ts +45 -0
- package/dist/components/list/list-item.d.ts.map +1 -0
- package/dist/components/list/list-item.js +263 -0
- package/dist/components/list/list-item.js.map +1 -0
- package/dist/components/list/list.d.ts +50 -0
- package/dist/components/list/list.d.ts.map +1 -0
- package/dist/components/list/list.js +161 -0
- package/dist/components/list/list.js.map +1 -0
- package/dist/components/logo-cloud/logo-cloud.d.ts +19 -0
- package/dist/components/logo-cloud/logo-cloud.d.ts.map +1 -0
- package/dist/components/logo-cloud/logo-cloud.js +66 -0
- package/dist/components/logo-cloud/logo-cloud.js.map +1 -0
- package/dist/components/modal/modal.d.ts +12 -0
- package/dist/components/modal/modal.d.ts.map +1 -1
- package/dist/components/modal/modal.js +40 -11
- package/dist/components/modal/modal.js.map +1 -1
- package/dist/components/page-layout/page-layout.js +8 -8
- package/dist/components/pagination/pagination.d.ts +15 -0
- package/dist/components/pagination/pagination.d.ts.map +1 -0
- package/dist/components/pagination/pagination.js +126 -0
- package/dist/components/pagination/pagination.js.map +1 -0
- package/dist/components/pagination/pagination.utils.d.ts +3 -0
- package/dist/components/pagination/pagination.utils.d.ts.map +1 -0
- package/dist/components/pagination/pagination.utils.js +19 -0
- package/dist/components/pagination/pagination.utils.js.map +1 -0
- package/dist/components/pie-chart/pie-chart.d.ts +33 -0
- package/dist/components/pie-chart/pie-chart.d.ts.map +1 -0
- package/dist/components/pie-chart/pie-chart.js +233 -0
- package/dist/components/pie-chart/pie-chart.js.map +1 -0
- package/dist/components/pin-input/pin-input.js +4 -4
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/popover/popover.js +1 -3
- package/dist/components/popover/popover.js.map +1 -1
- package/dist/components/post-list/post-card.d.ts +16 -0
- package/dist/components/post-list/post-card.d.ts.map +1 -0
- package/dist/components/post-list/post-card.js +22 -0
- package/dist/components/post-list/post-card.js.map +1 -0
- package/dist/components/post-list/post-list.d.ts +17 -0
- package/dist/components/post-list/post-list.d.ts.map +1 -0
- package/dist/components/post-list/post-list.js +23 -0
- package/dist/components/post-list/post-list.js.map +1 -0
- package/dist/components/pricing/pricing-tier.d.ts +23 -0
- package/dist/components/pricing/pricing-tier.d.ts.map +1 -0
- package/dist/components/pricing/pricing-tier.js +144 -0
- package/dist/components/pricing/pricing-tier.js.map +1 -0
- package/dist/components/pricing/pricing.d.ts +18 -0
- package/dist/components/pricing/pricing.d.ts.map +1 -0
- package/dist/components/pricing/pricing.js +38 -0
- package/dist/components/pricing/pricing.js.map +1 -0
- package/dist/components/progress/progress.d.ts +17 -0
- package/dist/components/progress/progress.d.ts.map +1 -0
- package/dist/components/progress/progress.js +109 -0
- package/dist/components/progress/progress.js.map +1 -0
- package/dist/components/project-grid/project-card.d.ts +17 -0
- package/dist/components/project-grid/project-card.d.ts.map +1 -0
- package/dist/components/project-grid/project-card.js +23 -0
- package/dist/components/project-grid/project-card.js.map +1 -0
- package/dist/components/project-grid/project-grid.d.ts +17 -0
- package/dist/components/project-grid/project-grid.d.ts.map +1 -0
- package/dist/components/project-grid/project-grid.js +23 -0
- package/dist/components/project-grid/project-grid.js.map +1 -0
- package/dist/components/radio/radio.js +1 -1
- package/dist/components/reveal/reveal.constants.d.ts +10 -0
- package/dist/components/reveal/reveal.constants.d.ts.map +1 -0
- package/dist/components/reveal/reveal.constants.js +11 -0
- package/dist/components/reveal/reveal.constants.js.map +1 -0
- package/dist/components/reveal/reveal.d.ts +64 -0
- package/dist/components/reveal/reveal.d.ts.map +1 -0
- package/dist/components/reveal/reveal.js +352 -0
- package/dist/components/reveal/reveal.js.map +1 -0
- package/dist/components/scroll-progress/scroll-progress.d.ts +32 -0
- package/dist/components/scroll-progress/scroll-progress.d.ts.map +1 -0
- package/dist/components/scroll-progress/scroll-progress.js +120 -0
- package/dist/components/scroll-progress/scroll-progress.js.map +1 -0
- package/dist/components/section/card-row.d.ts +30 -0
- package/dist/components/section/card-row.d.ts.map +1 -0
- package/dist/components/section/card-row.js +174 -0
- package/dist/components/section/card-row.js.map +1 -0
- package/dist/components/section/card.d.ts +27 -0
- package/dist/components/section/card.d.ts.map +1 -0
- package/dist/components/section/card.js +205 -0
- package/dist/components/section/card.js.map +1 -0
- package/dist/components/section/row-item.d.ts +22 -0
- package/dist/components/section/row-item.d.ts.map +1 -0
- package/dist/components/section/row-item.js +53 -0
- package/dist/components/section/row-item.js.map +1 -0
- package/dist/components/section/section.d.ts +70 -0
- package/dist/components/section/section.d.ts.map +1 -0
- package/dist/components/section/section.js +240 -0
- package/dist/components/section/section.js.map +1 -0
- package/dist/components/select/select.js +3 -3
- package/dist/components/series-nav/series-nav.d.ts +29 -0
- package/dist/components/series-nav/series-nav.d.ts.map +1 -0
- package/dist/components/series-nav/series-nav.js +178 -0
- package/dist/components/series-nav/series-nav.js.map +1 -0
- package/dist/components/site-header/site-header.d.ts +51 -0
- package/dist/components/site-header/site-header.d.ts.map +1 -0
- package/dist/components/site-header/site-header.js +296 -0
- package/dist/components/site-header/site-header.js.map +1 -0
- package/dist/components/skeleton/skeleton.js +7 -7
- package/dist/components/sparkline/sparkline.d.ts +19 -0
- package/dist/components/sparkline/sparkline.d.ts.map +1 -0
- package/dist/components/sparkline/sparkline.js +99 -0
- package/dist/components/sparkline/sparkline.js.map +1 -0
- package/dist/components/spinner/spinner.d.ts +13 -0
- package/dist/components/spinner/spinner.d.ts.map +1 -0
- package/dist/components/spinner/spinner.js +65 -0
- package/dist/components/spinner/spinner.js.map +1 -0
- package/dist/components/split/split.d.ts +23 -0
- package/dist/components/split/split.d.ts.map +1 -0
- package/dist/components/split/split.js +104 -0
- package/dist/components/split/split.js.map +1 -0
- package/dist/components/stack/stack.d.ts +21 -0
- package/dist/components/stack/stack.d.ts.map +1 -0
- package/dist/components/stack/stack.js +102 -0
- package/dist/components/stack/stack.js.map +1 -0
- package/dist/components/stat-card/stat-card.d.ts +35 -0
- package/dist/components/stat-card/stat-card.d.ts.map +1 -0
- package/dist/components/stat-card/stat-card.js +199 -0
- package/dist/components/stat-card/stat-card.js.map +1 -0
- package/dist/components/stats/stat.d.ts +16 -0
- package/dist/components/stats/stat.d.ts.map +1 -0
- package/dist/components/stats/stat.js +51 -0
- package/dist/components/stats/stat.js.map +1 -0
- package/dist/components/stats/stats.d.ts +19 -0
- package/dist/components/stats/stats.d.ts.map +1 -0
- package/dist/components/stats/stats.js +45 -0
- package/dist/components/stats/stats.js.map +1 -0
- package/dist/components/switch/switch.js +2 -2
- package/dist/components/table/data-table.d.ts +115 -27
- package/dist/components/table/data-table.d.ts.map +1 -1
- package/dist/components/table/data-table.js +1012 -411
- package/dist/components/table/data-table.js.map +1 -1
- package/dist/components/table/data-table.utils.d.ts +81 -0
- package/dist/components/table/data-table.utils.d.ts.map +1 -0
- package/dist/components/table/data-table.utils.js +208 -0
- package/dist/components/table/data-table.utils.js.map +1 -0
- package/dist/components/table/table.d.ts +28 -0
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/table/table.js +161 -33
- package/dist/components/table/table.js.map +1 -1
- package/dist/components/team/person.d.ts +19 -0
- package/dist/components/team/person.d.ts.map +1 -0
- package/dist/components/team/person.js +123 -0
- package/dist/components/team/person.js.map +1 -0
- package/dist/components/team/team.d.ts +18 -0
- package/dist/components/team/team.d.ts.map +1 -0
- package/dist/components/team/team.js +36 -0
- package/dist/components/team/team.js.map +1 -0
- package/dist/components/testimonials/testimonial.d.ts +18 -0
- package/dist/components/testimonials/testimonial.d.ts.map +1 -0
- package/dist/components/testimonials/testimonial.js +115 -0
- package/dist/components/testimonials/testimonial.js.map +1 -0
- package/dist/components/testimonials/testimonials.d.ts +18 -0
- package/dist/components/testimonials/testimonials.d.ts.map +1 -0
- package/dist/components/testimonials/testimonials.js +36 -0
- package/dist/components/testimonials/testimonials.js.map +1 -0
- package/dist/components/textarea/textarea.js +3 -3
- package/dist/components/theme-toggle/theme-toggle.js +1 -1
- package/dist/components/time-picker/time-picker.js +3 -3
- package/dist/components/timeline/timeline-item.d.ts +18 -0
- package/dist/components/timeline/timeline-item.d.ts.map +1 -0
- package/dist/components/timeline/timeline-item.js +102 -0
- package/dist/components/timeline/timeline-item.js.map +1 -0
- package/dist/components/timeline/timeline.d.ts +18 -0
- package/dist/components/timeline/timeline.d.ts.map +1 -0
- package/dist/components/timeline/timeline.js +30 -0
- package/dist/components/timeline/timeline.js.map +1 -0
- package/dist/components/toast/toast.d.ts +33 -0
- package/dist/components/toast/toast.d.ts.map +1 -0
- package/dist/components/toast/toast.js +147 -0
- package/dist/components/toast/toast.js.map +1 -0
- package/dist/components/toggle-group/toggle-button.d.ts +2 -0
- package/dist/components/toggle-group/toggle-button.d.ts.map +1 -1
- package/dist/components/toggle-group/toggle-button.js +12 -4
- package/dist/components/toggle-group/toggle-button.js.map +1 -1
- package/dist/components/toggle-group/toggle-group.js +4 -4
- package/dist/components/tooltip/tooltip.js +21 -21
- package/dist/components/vertical-nav/vertical-nav-group.js +3 -3
- package/dist/components/vertical-nav/vertical-nav-item.js +4 -4
- package/dist/components/video-embed/video-embed.d.ts +37 -0
- package/dist/components/video-embed/video-embed.d.ts.map +1 -0
- package/dist/components/video-embed/video-embed.js +183 -0
- package/dist/components/video-embed/video-embed.js.map +1 -0
- package/dist/index.d.ts +107 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +104 -0
- package/dist/index.js.map +1 -0
- package/dist/styles/index.css +205 -2
- package/dist/styles/reset.d.ts.map +1 -1
- package/dist/styles/reset.js +5 -0
- package/dist/styles/reset.js.map +1 -1
- package/package.json +210 -7
- package/src/components/accordion/accordion.constants.ts +5 -0
- package/src/components/accordion/accordion.ts +209 -0
- package/src/components/alert/alert.constants.ts +3 -0
- package/src/components/alert/alert.ts +284 -17
- package/src/components/avatar/avatar.ts +84 -0
- package/src/components/back-to-top/back-to-top.ts +140 -0
- package/src/components/bar-chart/bar-chart.ts +295 -0
- package/src/components/breadcrumb/breadcrumb.ts +2 -2
- package/src/components/button/button.ts +9 -8
- package/src/components/button-group/button-group.ts +4 -4
- package/src/components/calendar/calendar.ts +12 -9
- package/src/components/chart/chart-base.ts +275 -0
- package/src/components/chart/chart.utils.ts +140 -0
- package/src/components/code-block/code-block.ts +35 -24
- package/src/components/consent/consent.ts +312 -0
- package/src/components/consent/consent.utils.ts +110 -0
- package/src/components/contact/contact.ts +83 -0
- package/src/components/container/container.ts +60 -0
- package/src/components/content-card/content-card.ts +4 -4
- package/src/components/context-menu/context-menu.ts +426 -0
- package/src/components/cron-builder/cron-builder.ts +21 -18
- package/src/components/cta/cta.ts +64 -0
- package/src/components/drawer/drawer.ts +6 -6
- package/src/components/faq/faq-item.ts +110 -0
- package/src/components/faq/faq.ts +40 -0
- package/src/components/feature-grid/feature-grid.ts +52 -0
- package/src/components/feature-grid/feature.ts +84 -0
- package/src/components/field/field.ts +2 -2
- package/src/components/footer/footer.ts +4 -4
- package/src/components/form/form-reset.ts +45 -0
- package/src/components/form/form.ts +17 -3
- package/src/components/grid/grid.ts +73 -4
- package/src/components/heat-map/heat-map.ts +292 -0
- package/src/components/hero/hero.ts +132 -0
- package/src/components/icon/icon-paths.ts +92 -1
- package/src/components/icon/icon.ts +8 -1
- package/src/components/image/image.ts +165 -0
- package/src/components/input/input.ts +4 -4
- package/src/components/lazy/lazy.ts +94 -0
- package/src/components/line-chart/line-chart.ts +271 -0
- package/src/components/list/list-item.ts +225 -0
- package/src/components/list/list.ts +157 -0
- package/src/components/logo-cloud/logo-cloud.ts +65 -0
- package/src/components/modal/modal.ts +37 -11
- package/src/components/page-layout/page-layout.ts +8 -8
- package/src/components/pagination/pagination.ts +120 -0
- package/src/components/pagination/pagination.utils.ts +14 -0
- package/src/components/pie-chart/pie-chart.ts +230 -0
- package/src/components/pin-input/pin-input.ts +4 -4
- package/src/components/popover/popover.ts +1 -3
- package/src/components/post-list/post-card.ts +18 -0
- package/src/components/post-list/post-list.ts +19 -0
- package/src/components/pricing/pricing-tier.ts +132 -0
- package/src/components/pricing/pricing.ts +39 -0
- package/src/components/progress/progress.ts +95 -0
- package/src/components/project-grid/project-card.ts +19 -0
- package/src/components/project-grid/project-grid.ts +19 -0
- package/src/components/radio/radio.ts +1 -1
- package/src/components/reveal/reveal.constants.ts +20 -0
- package/src/components/reveal/reveal.ts +344 -0
- package/src/components/scroll-progress/scroll-progress.ts +119 -0
- package/src/components/section/card-row.ts +152 -0
- package/src/components/section/card.ts +197 -0
- package/src/components/section/row-item.ts +38 -0
- package/src/components/section/section.ts +232 -0
- package/src/components/select/select.ts +3 -3
- package/src/components/series-nav/series-nav.ts +164 -0
- package/src/components/site-header/site-header.ts +276 -0
- package/src/components/skeleton/skeleton.ts +7 -7
- package/src/components/sparkline/sparkline.ts +83 -0
- package/src/components/spinner/spinner.ts +55 -0
- package/src/components/split/split.ts +106 -0
- package/src/components/stack/stack.ts +88 -0
- package/src/components/stat-card/stat-card.ts +179 -0
- package/src/components/stats/stat.ts +49 -0
- package/src/components/stats/stats.ts +47 -0
- package/src/components/switch/switch.ts +2 -2
- package/src/components/table/data-table.ts +1015 -425
- package/src/components/table/data-table.utils.ts +276 -0
- package/src/components/table/table.ts +168 -38
- package/src/components/team/person.ts +113 -0
- package/src/components/team/team.ts +37 -0
- package/src/components/testimonials/testimonial.ts +108 -0
- package/src/components/testimonials/testimonials.ts +37 -0
- package/src/components/textarea/textarea.ts +3 -3
- package/src/components/theme-toggle/theme-toggle.ts +1 -1
- package/src/components/time-picker/time-picker.ts +3 -3
- package/src/components/timeline/timeline-item.ts +100 -0
- package/src/components/timeline/timeline.ts +31 -0
- package/src/components/toast/toast.ts +153 -0
- package/src/components/toggle-group/toggle-button.ts +9 -4
- package/src/components/toggle-group/toggle-group.ts +4 -4
- package/src/components/tooltip/tooltip.ts +21 -21
- package/src/components/vertical-nav/vertical-nav-group.ts +3 -3
- package/src/components/vertical-nav/vertical-nav-item.ts +4 -4
- package/src/components/video-embed/video-embed.ts +162 -0
- package/src/index.ts +108 -0
- package/src/styles/globals.css +63 -0
- package/src/styles/index.css +3 -1
- package/src/styles/prose.css +154 -0
- package/src/styles/reset.ts +5 -0
- package/src/styles/theme.css +53 -1
- package/src/styles/typography.css +1 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import {LitElement, html, css, nothing} from "lit";
|
|
2
|
+
import {customElement, property, state} from "lit/decorators.js";
|
|
3
|
+
import {styleMap} from "lit/directives/style-map.js";
|
|
4
|
+
import {resetStyles} from "../../styles/reset.js";
|
|
5
|
+
|
|
6
|
+
/** Anything that looks like a URL is drawn as a blurred image, anything else as a plain colour. */
|
|
7
|
+
const isUrl = (value: string) => /^(data:|https?:|\/|\.)/.test(value);
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A responsive image frame. Slot a normal `<img>` (or `<picture>`) so the alt text, `srcset`
|
|
11
|
+
* and `sizes` stay in your markup for search engines and screen readers. The frame reserves the
|
|
12
|
+
* space with `ratio` so the page never jumps, lazy loads the image, and fades it in.
|
|
13
|
+
*
|
|
14
|
+
* Slots: default (the `<img>` or `<picture>`) and `caption`.
|
|
15
|
+
* Mark the first image on the page (the one visitors see immediately) with `priority`.
|
|
16
|
+
*/
|
|
17
|
+
@customElement("st-image")
|
|
18
|
+
export class StImage extends LitElement {
|
|
19
|
+
/** Width / height of the frame, such as "16/9" or "1". Leave empty to use the image's own shape. */
|
|
20
|
+
@property({type: String}) ratio = "";
|
|
21
|
+
@property({type: String, reflect: true}) fit: "cover" | "contain" = "cover";
|
|
22
|
+
/** Shown while the image loads: a CSS colour, or a tiny image URL that is drawn blurred. */
|
|
23
|
+
@property({type: String}) placeholder = "";
|
|
24
|
+
/** Loads straight away at high priority. Use it for the main image above the fold. */
|
|
25
|
+
@property({type: Boolean}) priority = false;
|
|
26
|
+
|
|
27
|
+
@state() private _hasCaption = false;
|
|
28
|
+
|
|
29
|
+
private _image?: HTMLImageElement;
|
|
30
|
+
|
|
31
|
+
static styles = [
|
|
32
|
+
resetStyles,
|
|
33
|
+
css`
|
|
34
|
+
:host {
|
|
35
|
+
display: block;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
figure {
|
|
39
|
+
display: grid;
|
|
40
|
+
gap: var(--st-spacing-sm);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.frame {
|
|
44
|
+
position: relative;
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
aspect-ratio: var(--_ratio, auto);
|
|
47
|
+
background-color: var(--_placeholder-color, var(--st-color-surface));
|
|
48
|
+
border-radius: var(--st-image-radius, var(--st-radius-md));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.blur {
|
|
52
|
+
position: absolute;
|
|
53
|
+
inset: 0;
|
|
54
|
+
background-size: cover;
|
|
55
|
+
background-position: center;
|
|
56
|
+
filter: blur(1.25rem);
|
|
57
|
+
transform: scale(1.15);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
slot:not([name]) {
|
|
61
|
+
display: block;
|
|
62
|
+
height: 100%;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
::slotted(picture) {
|
|
66
|
+
display: block;
|
|
67
|
+
height: 100%;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
::slotted(img),
|
|
71
|
+
::slotted(picture) {
|
|
72
|
+
position: relative;
|
|
73
|
+
width: 100%;
|
|
74
|
+
transition: opacity 0.4s ease;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
:host([data-pending]) ::slotted(img),
|
|
78
|
+
:host([data-pending]) ::slotted(picture) {
|
|
79
|
+
opacity: 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
figcaption {
|
|
83
|
+
color: var(--st-color-text-muted);
|
|
84
|
+
font-size: var(--st-font-size-sm);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@media (prefers-reduced-motion: reduce) {
|
|
88
|
+
::slotted(img),
|
|
89
|
+
::slotted(picture) {
|
|
90
|
+
transition: none;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
`,
|
|
94
|
+
];
|
|
95
|
+
|
|
96
|
+
protected updated() {
|
|
97
|
+
if (this.ratio) this.style.setProperty("--_ratio", this.ratio);
|
|
98
|
+
else this.style.removeProperty("--_ratio");
|
|
99
|
+
|
|
100
|
+
const colour = this.placeholder && !isUrl(this.placeholder) ? this.placeholder : "";
|
|
101
|
+
if (colour) this.style.setProperty("--_placeholder-color", colour);
|
|
102
|
+
else this.style.removeProperty("--_placeholder-color");
|
|
103
|
+
|
|
104
|
+
this._applyToImage();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
private _onSlotChange(e: Event) {
|
|
108
|
+
const slotted = (e.target as HTMLSlotElement).assignedElements();
|
|
109
|
+
const wrapper = slotted.find((el) => el.tagName === "IMG" || el.tagName === "PICTURE");
|
|
110
|
+
const img = wrapper instanceof HTMLImageElement ? wrapper : wrapper?.querySelector("img");
|
|
111
|
+
this._image = img ?? undefined;
|
|
112
|
+
this._applyToImage();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
private _applyToImage() {
|
|
116
|
+
const img = this._image;
|
|
117
|
+
if (!img) return;
|
|
118
|
+
|
|
119
|
+
// Authors can still override either attribute on their own <img>.
|
|
120
|
+
if (!img.hasAttribute("decoding")) img.decoding = "async";
|
|
121
|
+
if (!img.hasAttribute("loading")) img.loading = this.priority ? "eager" : "lazy";
|
|
122
|
+
if (this.priority && !img.hasAttribute("fetchpriority")) img.setAttribute("fetchpriority", "high");
|
|
123
|
+
|
|
124
|
+
// Fill the frame whatever the image's own dimensions are (only when a ratio is set).
|
|
125
|
+
img.style.objectFit = this.fit;
|
|
126
|
+
if (this.ratio) {
|
|
127
|
+
img.style.height = "100%";
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (img.complete) {
|
|
131
|
+
this.removeAttribute("data-pending");
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
this.setAttribute("data-pending", "");
|
|
135
|
+
const done = () => this.removeAttribute("data-pending");
|
|
136
|
+
img.addEventListener("load", done, {once: true});
|
|
137
|
+
img.addEventListener("error", done, {once: true});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
render() {
|
|
141
|
+
return html`
|
|
142
|
+
<figure>
|
|
143
|
+
<div class="frame">
|
|
144
|
+
${this.placeholder && isUrl(this.placeholder)
|
|
145
|
+
? html`<div class="blur" style=${styleMap({backgroundImage: `url(${JSON.stringify(this.placeholder)})`})}></div>`
|
|
146
|
+
: nothing}
|
|
147
|
+
<slot @slotchange=${this._onSlotChange}></slot>
|
|
148
|
+
</div>
|
|
149
|
+
<figcaption ?hidden=${!this._hasCaption}>
|
|
150
|
+
<slot
|
|
151
|
+
name="caption"
|
|
152
|
+
@slotchange=${(e: Event) =>
|
|
153
|
+
(this._hasCaption = (e.target as HTMLSlotElement).assignedNodes().length > 0)}
|
|
154
|
+
></slot>
|
|
155
|
+
</figcaption>
|
|
156
|
+
</figure>
|
|
157
|
+
`;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
declare global {
|
|
162
|
+
interface HTMLElementTagNameMap {
|
|
163
|
+
"st-image": StImage;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -119,21 +119,21 @@ export class StInput extends LitElement {
|
|
|
119
119
|
/* 🚀 NEW: Explicit error text styling */
|
|
120
120
|
.error-text {
|
|
121
121
|
font-size: var(--st-font-size-xs);
|
|
122
|
-
color: var(--st-color-error
|
|
122
|
+
color: var(--st-color-error);
|
|
123
123
|
margin: 0;
|
|
124
124
|
font-weight: 500;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
:host([invalid]) .input-wrapper {
|
|
128
|
-
border-color: var(--st-color-error
|
|
128
|
+
border-color: var(--st-color-error);
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
:host([invalid]) .input-wrapper:focus-within {
|
|
132
|
-
box-shadow: 0 0 0 1px var(--st-color-error
|
|
132
|
+
box-shadow: 0 0 0 1px var(--st-color-error);
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
:host([invalid]) .help-text {
|
|
136
|
-
color: var(--st-color-error
|
|
136
|
+
color: var(--st-color-error);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
:host([disabled]) .input-wrapper {
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import {LitElement, html, css} from "lit";
|
|
2
|
+
import {customElement, property} from "lit/decorators.js";
|
|
3
|
+
import {resetStyles} from "../../styles/reset.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Holds back heavy, non-essential markup (embeds, maps, widgets, comment threads) until it is
|
|
7
|
+
* about to scroll into view. Put the markup inside a `<template>`: it stays inert, so nothing
|
|
8
|
+
* downloads or runs, until `st-lazy` copies it into the page.
|
|
9
|
+
*
|
|
10
|
+
* Keep important text outside it. Content inside a template is not part of the page until it
|
|
11
|
+
* loads, so search engines may not index it.
|
|
12
|
+
*
|
|
13
|
+
* Slots: default (the `<template>`) and `placeholder` (shown until loaded).
|
|
14
|
+
* Events: `st-lazy-load` (bubbles, composed) once the content has been added.
|
|
15
|
+
*/
|
|
16
|
+
@customElement("st-lazy")
|
|
17
|
+
export class StLazy extends LitElement {
|
|
18
|
+
/** How far (in pixels) before entering the viewport loading starts. */
|
|
19
|
+
@property({type: Number}) margin = 200;
|
|
20
|
+
/** Space reserved until loaded, to stop the page jumping (any CSS length). */
|
|
21
|
+
@property({type: String, attribute: "min-height"}) minHeight = "";
|
|
22
|
+
/** True once the content has been added. Setting it to true loads immediately. */
|
|
23
|
+
@property({type: Boolean, reflect: true}) loaded = false;
|
|
24
|
+
|
|
25
|
+
private _observer?: IntersectionObserver;
|
|
26
|
+
|
|
27
|
+
static styles = [
|
|
28
|
+
resetStyles,
|
|
29
|
+
css`
|
|
30
|
+
:host {
|
|
31
|
+
display: block;
|
|
32
|
+
min-height: var(--_min-height, 0);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:host([loaded]) {
|
|
36
|
+
min-height: 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:host([loaded]) slot[name="placeholder"] {
|
|
40
|
+
display: none;
|
|
41
|
+
}
|
|
42
|
+
`,
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
connectedCallback() {
|
|
46
|
+
super.connectedCallback();
|
|
47
|
+
if (this.loaded) {
|
|
48
|
+
this.load();
|
|
49
|
+
} else if (typeof IntersectionObserver === "undefined") {
|
|
50
|
+
this.load();
|
|
51
|
+
} else {
|
|
52
|
+
this._observer = new IntersectionObserver(
|
|
53
|
+
(entries) => entries.some((entry) => entry.isIntersecting) && this.load(),
|
|
54
|
+
{rootMargin: `${this.margin}px 0px`},
|
|
55
|
+
);
|
|
56
|
+
this._observer.observe(this);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
disconnectedCallback() {
|
|
61
|
+
this._observer?.disconnect();
|
|
62
|
+
this._observer = undefined;
|
|
63
|
+
super.disconnectedCallback();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
protected updated() {
|
|
67
|
+
if (this.minHeight) this.style.setProperty("--_min-height", this.minHeight);
|
|
68
|
+
else this.style.removeProperty("--_min-height");
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Adds the template content now instead of waiting for the scroll. */
|
|
72
|
+
load() {
|
|
73
|
+
this._observer?.disconnect();
|
|
74
|
+
this._observer = undefined;
|
|
75
|
+
const template = this.querySelector<HTMLTemplateElement>(":scope > template");
|
|
76
|
+
const first = !this.hasAttribute("data-lazy-done");
|
|
77
|
+
if (template && first) {
|
|
78
|
+
this.setAttribute("data-lazy-done", "");
|
|
79
|
+
this.append(template.content.cloneNode(true));
|
|
80
|
+
}
|
|
81
|
+
if (!this.loaded) this.loaded = true;
|
|
82
|
+
if (first) this.dispatchEvent(new CustomEvent("st-lazy-load", {bubbles: true, composed: true}));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
render() {
|
|
86
|
+
return html`<slot name="placeholder"></slot><slot></slot>`;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
declare global {
|
|
91
|
+
interface HTMLElementTagNameMap {
|
|
92
|
+
"st-lazy": StLazy;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import {html, css, svg, nothing} from "lit";
|
|
2
|
+
import {customElement, property, state} from "lit/decorators.js";
|
|
3
|
+
import {resetStyles} from "../../styles/reset.js";
|
|
4
|
+
import {StChartBase, type ChartSeries} from "../chart/chart-base.js";
|
|
5
|
+
import {areaPaths, chartColor, clamp, linePath, niceScale, stepIndex} from "../chart/chart.utils.js";
|
|
6
|
+
|
|
7
|
+
const MARGIN = {top: 12, right: 16, bottom: 28, left: 48};
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Line (and optional area) chart with a shared crosshair tooltip.
|
|
11
|
+
* Hover/focus a position to read every series; click or press Enter/Space to select it.
|
|
12
|
+
*/
|
|
13
|
+
@customElement("st-line-chart")
|
|
14
|
+
export class StLineChart extends StChartBase {
|
|
15
|
+
/** X axis category labels, one per data point. */
|
|
16
|
+
@property({type: Array}) labels: string[] = [];
|
|
17
|
+
@property({type: Array}) series: ChartSeries[] = [];
|
|
18
|
+
/** Fills the area under each line. */
|
|
19
|
+
@property({type: Boolean}) area = false;
|
|
20
|
+
@property({type: Number, attribute: "y-min"}) yMin?: number;
|
|
21
|
+
@property({type: Number, attribute: "y-max"}) yMax?: number;
|
|
22
|
+
/** Index of the selected position, or null. */
|
|
23
|
+
@property({type: Number, reflect: true}) selected: number | null = null;
|
|
24
|
+
|
|
25
|
+
@state() private _active: number | null = null;
|
|
26
|
+
@state() private _hidden = new Set<number>();
|
|
27
|
+
|
|
28
|
+
static styles = [
|
|
29
|
+
resetStyles,
|
|
30
|
+
StChartBase.baseStyles,
|
|
31
|
+
css`
|
|
32
|
+
.line {
|
|
33
|
+
fill: none;
|
|
34
|
+
stroke-width: 2;
|
|
35
|
+
stroke-linejoin: round;
|
|
36
|
+
stroke-linecap: round;
|
|
37
|
+
}
|
|
38
|
+
.area {
|
|
39
|
+
opacity: 0.15;
|
|
40
|
+
}
|
|
41
|
+
.crosshair {
|
|
42
|
+
stroke: var(--st-color-text-muted);
|
|
43
|
+
stroke-width: 1;
|
|
44
|
+
stroke-dasharray: 4 3;
|
|
45
|
+
}
|
|
46
|
+
.selected-band {
|
|
47
|
+
fill: var(--st-color-primary-muted);
|
|
48
|
+
}
|
|
49
|
+
.point {
|
|
50
|
+
stroke: var(--st-color-bg);
|
|
51
|
+
stroke-width: 2;
|
|
52
|
+
}
|
|
53
|
+
`,
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
private get _visible() {
|
|
57
|
+
return this.series
|
|
58
|
+
.map((s, i) => ({s, i, color: chartColor(i, s.color)}))
|
|
59
|
+
.filter(({i}) => !this._hidden.has(i));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private get _count() {
|
|
63
|
+
return Math.max(this.labels.length, ...this.series.map((s) => s.data.length), 0);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
private _geometry() {
|
|
67
|
+
const innerW = Math.max(this._width - MARGIN.left - MARGIN.right, 1);
|
|
68
|
+
const innerH = Math.max(this.height - MARGIN.top - MARGIN.bottom, 1);
|
|
69
|
+
const values = this._visible.flatMap(({s}) => s.data.filter((v): v is number => v != null));
|
|
70
|
+
const lo = this.yMin ?? Math.min(0, ...values);
|
|
71
|
+
const hi = this.yMax ?? Math.max(0, ...values);
|
|
72
|
+
const scale = niceScale(lo, hi);
|
|
73
|
+
const n = this._count;
|
|
74
|
+
const x = (i: number) => MARGIN.left + (n <= 1 ? innerW / 2 : (i * innerW) / (n - 1));
|
|
75
|
+
const y = (v: number) =>
|
|
76
|
+
MARGIN.top + innerH * (1 - (clamp(v, scale.min, scale.max) - scale.min) / (scale.max - scale.min));
|
|
77
|
+
return {innerW, innerH, scale, n, x, y};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
private _valuesAt(index: number) {
|
|
81
|
+
return this.series.map((s, i) => ({
|
|
82
|
+
series: s.name,
|
|
83
|
+
value: s.data[index] ?? null,
|
|
84
|
+
color: chartColor(i, s.color),
|
|
85
|
+
hidden: this._hidden.has(i),
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
private _label(index: number) {
|
|
90
|
+
return this.labels[index] ?? String(index + 1);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
private _setActive(index: number | null) {
|
|
94
|
+
if (index === this._active) return;
|
|
95
|
+
this._active = index;
|
|
96
|
+
if (index === null) {
|
|
97
|
+
this.hideTooltip();
|
|
98
|
+
this.emit("st-chart-leave", {});
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const {x, y, scale} = this._geometry();
|
|
102
|
+
const visibleValues = this._valuesAt(index).filter((v) => !v.hidden && v.value !== null);
|
|
103
|
+
const top = visibleValues.length
|
|
104
|
+
? Math.min(...visibleValues.map((v) => y(v.value as number)))
|
|
105
|
+
: y(scale.max);
|
|
106
|
+
const title = this._label(index);
|
|
107
|
+
this.showTooltip(
|
|
108
|
+
{
|
|
109
|
+
x: x(index),
|
|
110
|
+
y: top,
|
|
111
|
+
title,
|
|
112
|
+
rows: visibleValues.map((v) => ({
|
|
113
|
+
label: v.series,
|
|
114
|
+
value: this.fmt(v.value as number),
|
|
115
|
+
color: v.color,
|
|
116
|
+
})),
|
|
117
|
+
},
|
|
118
|
+
`${title}: ${visibleValues.map((v) => `${v.series} ${this.fmt(v.value as number)}`).join(", ")}`,
|
|
119
|
+
);
|
|
120
|
+
this.emit("st-chart-hover", {index, label: title, values: visibleValues});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
private _select(index: number) {
|
|
124
|
+
if (!this.selectable) return;
|
|
125
|
+
this.selected = this.selected === index ? null : index;
|
|
126
|
+
this.emit("st-chart-select", {
|
|
127
|
+
index,
|
|
128
|
+
label: this._label(index),
|
|
129
|
+
values: this._valuesAt(index),
|
|
130
|
+
selected: this.selected === index,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
private _indexFromPointer(e: PointerEvent) {
|
|
135
|
+
const {innerW, n} = this._geometry();
|
|
136
|
+
const rect = (e.currentTarget as SVGElement).ownerSVGElement!.getBoundingClientRect();
|
|
137
|
+
const ratio = clamp((e.clientX - rect.left - MARGIN.left) / innerW, 0, 1);
|
|
138
|
+
return n <= 1 ? 0 : Math.round(ratio * (n - 1));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
private _onKeydown(e: KeyboardEvent) {
|
|
142
|
+
if (e.key === "Escape") return this._setActive(null);
|
|
143
|
+
if ((e.key === "Enter" || e.key === " ") && this._active !== null) {
|
|
144
|
+
e.preventDefault();
|
|
145
|
+
return this._select(this._active);
|
|
146
|
+
}
|
|
147
|
+
const next = stepIndex(e.key, this._active, this._count);
|
|
148
|
+
if (next !== null) {
|
|
149
|
+
e.preventDefault();
|
|
150
|
+
this._setActive(next);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
private _toggleSeries(index: number) {
|
|
155
|
+
const hidden = new Set(this._hidden);
|
|
156
|
+
if (hidden.has(index)) hidden.delete(index);
|
|
157
|
+
else hidden.add(index);
|
|
158
|
+
this._hidden = hidden;
|
|
159
|
+
this._active = null;
|
|
160
|
+
this.hideTooltip();
|
|
161
|
+
this.emit("st-chart-legend-toggle", {
|
|
162
|
+
name: this.series[index].name,
|
|
163
|
+
index,
|
|
164
|
+
hidden: hidden.has(index),
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
private _renderPlot() {
|
|
169
|
+
const {innerW, innerH, scale, n, x, y} = this._geometry();
|
|
170
|
+
const baseline = y(clamp(0, scale.min, scale.max));
|
|
171
|
+
const stride = Math.max(1, Math.ceil((n * 56) / innerW));
|
|
172
|
+
return svg`
|
|
173
|
+
<svg width=${this._width} height=${this.height} aria-hidden="true">
|
|
174
|
+
${scale.ticks.map(
|
|
175
|
+
(t) => svg`
|
|
176
|
+
<line class="grid" x1=${MARGIN.left} x2=${MARGIN.left + innerW} y1=${y(t)} y2=${y(t)}></line>
|
|
177
|
+
<text class="tick" x=${MARGIN.left - 8} y=${y(t)} text-anchor="end" dominant-baseline="middle">${this.fmtAxis(t)}</text>
|
|
178
|
+
`,
|
|
179
|
+
)}
|
|
180
|
+
${Array.from({length: n}, (_, i) =>
|
|
181
|
+
i % stride === 0
|
|
182
|
+
? svg`<text class="tick" x=${x(i)} y=${MARGIN.top + innerH + 18} text-anchor="middle">${this._label(i)}</text>`
|
|
183
|
+
: nothing,
|
|
184
|
+
)}
|
|
185
|
+
${this.selected !== null && this.selected < n
|
|
186
|
+
? svg`<rect class="selected-band" x=${x(this.selected) - 12} y=${MARGIN.top} width="24" height=${innerH}></rect>`
|
|
187
|
+
: nothing}
|
|
188
|
+
${this._visible.map(({s, color}) => {
|
|
189
|
+
const points = Array.from({length: n}, (_, i) => {
|
|
190
|
+
const v = s.data[i];
|
|
191
|
+
return v == null ? null : ([x(i), y(v)] as [number, number]);
|
|
192
|
+
});
|
|
193
|
+
return svg`
|
|
194
|
+
${this.area
|
|
195
|
+
? areaPaths(points, baseline).map(
|
|
196
|
+
(d) => svg`<path class="area" d=${d} style="fill:${color}"></path>`,
|
|
197
|
+
)
|
|
198
|
+
: nothing}
|
|
199
|
+
<path class="line" d=${linePath(points)} style="stroke:${color}"></path>
|
|
200
|
+
${points.map((p, i) =>
|
|
201
|
+
p
|
|
202
|
+
? svg`<circle class="point animate" cx=${p[0]} cy=${p[1]} style="fill:${color}"
|
|
203
|
+
r=${i === this._active || i === this.selected ? 5 : 3}></circle>`
|
|
204
|
+
: nothing,
|
|
205
|
+
)}
|
|
206
|
+
`;
|
|
207
|
+
})}
|
|
208
|
+
${this._active !== null
|
|
209
|
+
? svg`<line class="crosshair" x1=${x(this._active)} x2=${x(this._active)} y1=${MARGIN.top} y2=${MARGIN.top + innerH}></line>`
|
|
210
|
+
: nothing}
|
|
211
|
+
<rect
|
|
212
|
+
x=${MARGIN.left}
|
|
213
|
+
y=${MARGIN.top}
|
|
214
|
+
width=${innerW}
|
|
215
|
+
height=${innerH}
|
|
216
|
+
class="hit"
|
|
217
|
+
fill="transparent"
|
|
218
|
+
@pointermove=${(e: PointerEvent) => this._setActive(this._indexFromPointer(e))}
|
|
219
|
+
@pointerleave=${() => this._setActive(null)}
|
|
220
|
+
@click=${(e: PointerEvent) => this._select(this._indexFromPointer(e))}
|
|
221
|
+
></rect>
|
|
222
|
+
</svg>
|
|
223
|
+
`;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
render() {
|
|
227
|
+
const n = this._count;
|
|
228
|
+
return html`
|
|
229
|
+
<div class="chart">
|
|
230
|
+
${this._width > 0
|
|
231
|
+
? html`
|
|
232
|
+
<div
|
|
233
|
+
class="plot"
|
|
234
|
+
tabindex="0"
|
|
235
|
+
role="group"
|
|
236
|
+
aria-roledescription="line chart"
|
|
237
|
+
aria-label=${this.label || "Line chart"}
|
|
238
|
+
@keydown=${this._onKeydown}
|
|
239
|
+
@focus=${() => this._active === null && n && this._setActive(0)}
|
|
240
|
+
@blur=${() => this._setActive(null)}
|
|
241
|
+
>
|
|
242
|
+
${this._renderPlot()} ${this.renderTooltip()}
|
|
243
|
+
</div>
|
|
244
|
+
`
|
|
245
|
+
: nothing}
|
|
246
|
+
${this.renderLegend(
|
|
247
|
+
this.series.map((s, i) => ({
|
|
248
|
+
name: s.name,
|
|
249
|
+
color: chartColor(i, s.color),
|
|
250
|
+
hidden: this._hidden.has(i),
|
|
251
|
+
})),
|
|
252
|
+
(i) => this._toggleSeries(i),
|
|
253
|
+
)}
|
|
254
|
+
${this.renderLiveRegion()}
|
|
255
|
+
${this.renderDataTable(
|
|
256
|
+
["Category", ...this.series.map((s) => s.name)],
|
|
257
|
+
Array.from({length: n}, (_, i) => [
|
|
258
|
+
this._label(i),
|
|
259
|
+
...this.series.map((s) => (s.data[i] == null ? "–" : this.fmt(s.data[i] as number))),
|
|
260
|
+
]),
|
|
261
|
+
)}
|
|
262
|
+
</div>
|
|
263
|
+
`;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
declare global {
|
|
268
|
+
interface HTMLElementTagNameMap {
|
|
269
|
+
"st-line-chart": StLineChart;
|
|
270
|
+
}
|
|
271
|
+
}
|