@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
|
@@ -7,6 +7,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { LitElement, html, css, nothing } from "lit";
|
|
8
8
|
import { customElement, property, query } from "lit/decorators.js";
|
|
9
9
|
import { resetStyles } from "../../styles/reset.js";
|
|
10
|
+
import { resetFormState } from "../form/form-reset.js";
|
|
11
|
+
/** Longest we wait for the close animation before closing anyway. */
|
|
12
|
+
const CLOSE_FALLBACK_MS = 400;
|
|
10
13
|
let StModal = class StModal extends LitElement {
|
|
11
14
|
constructor() {
|
|
12
15
|
super(...arguments);
|
|
@@ -14,6 +17,12 @@ let StModal = class StModal extends LitElement {
|
|
|
14
17
|
this.heading = "";
|
|
15
18
|
this.size = "md";
|
|
16
19
|
this.static = false;
|
|
20
|
+
/**
|
|
21
|
+
* By default closing the modal resets what is inside it: forms and fields go back to their
|
|
22
|
+
* starting values, errors clear and multi-step forms return to step one, so it opens fresh next
|
|
23
|
+
* time. Set this to keep what was entered between openings.
|
|
24
|
+
*/
|
|
25
|
+
this.preserveState = false;
|
|
17
26
|
this.isClosing = false;
|
|
18
27
|
}
|
|
19
28
|
// 🚀 FIX: Typed strictly and calls super
|
|
@@ -37,15 +46,34 @@ let StModal = class StModal extends LitElement {
|
|
|
37
46
|
return;
|
|
38
47
|
this.isClosing = true;
|
|
39
48
|
this.dialogEl.classList.add("closing");
|
|
40
|
-
|
|
49
|
+
let finished = false;
|
|
50
|
+
const finish = () => {
|
|
51
|
+
if (finished)
|
|
52
|
+
return;
|
|
53
|
+
finished = true;
|
|
54
|
+
window.clearTimeout(fallback);
|
|
41
55
|
this.dialogEl.classList.remove("closing");
|
|
42
56
|
this.isClosing = false;
|
|
43
57
|
if (!this.open) {
|
|
44
58
|
this.dialogEl.close();
|
|
59
|
+
// Reset once it has faded out, so nothing visibly changes as it closes.
|
|
60
|
+
if (!this.preserveState)
|
|
61
|
+
this.reset();
|
|
45
62
|
}
|
|
46
63
|
};
|
|
47
|
-
//
|
|
48
|
-
|
|
64
|
+
// The animation ending finishes the close; the timer covers it never firing (reduced motion).
|
|
65
|
+
const fallback = window.setTimeout(finish, CLOSE_FALLBACK_MS);
|
|
66
|
+
this.dialogEl.addEventListener("animationend", finish, { once: true });
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Returns the content to its starting state: forms and fields are reset, errors cleared and the
|
|
70
|
+
* body scrolled back to the top. Happens automatically on close unless `preserve-state` is set.
|
|
71
|
+
* Fires `st-reset` afterwards so your own state (in a framework, say) can be cleared too.
|
|
72
|
+
*/
|
|
73
|
+
reset() {
|
|
74
|
+
resetFormState(this);
|
|
75
|
+
this.renderRoot.querySelector(".modal-body")?.scrollTo({ top: 0 });
|
|
76
|
+
this.dispatchEvent(new CustomEvent("st-reset", { bubbles: true, composed: true }));
|
|
49
77
|
}
|
|
50
78
|
handleClose() {
|
|
51
79
|
this.open = false;
|
|
@@ -130,16 +158,14 @@ StModal.styles = [
|
|
|
130
158
|
dialog {
|
|
131
159
|
padding: 0;
|
|
132
160
|
border: 1px solid var(--st-color-border);
|
|
133
|
-
border-radius: var(--st-radius-lg
|
|
161
|
+
border-radius: var(--st-radius-lg);
|
|
134
162
|
background-color: var(--st-color-surface);
|
|
135
163
|
color: var(--st-color-text);
|
|
136
164
|
|
|
137
165
|
width: calc(100% - 2rem);
|
|
138
166
|
margin: auto;
|
|
139
167
|
|
|
140
|
-
box-shadow:
|
|
141
|
-
0 20px 25px -5px rgb(0 0 0 / 0.1),
|
|
142
|
-
0 8px 10px -6px rgb(0 0 0 / 0.1);
|
|
168
|
+
box-shadow: var(--st-shadow-xl);
|
|
143
169
|
font-family: var(--st-font-family, inherit);
|
|
144
170
|
}
|
|
145
171
|
|
|
@@ -160,7 +186,7 @@ StModal.styles = [
|
|
|
160
186
|
}
|
|
161
187
|
|
|
162
188
|
dialog::backdrop {
|
|
163
|
-
background-color:
|
|
189
|
+
background-color: var(--st-color-overlay);
|
|
164
190
|
backdrop-filter: blur(2px);
|
|
165
191
|
}
|
|
166
192
|
|
|
@@ -246,12 +272,12 @@ StModal.styles = [
|
|
|
246
272
|
|
|
247
273
|
.close-btn:hover {
|
|
248
274
|
color: var(--st-color-text);
|
|
249
|
-
background-color: var(--st-color-surface-muted
|
|
275
|
+
background-color: var(--st-color-surface-muted);
|
|
250
276
|
}
|
|
251
277
|
|
|
252
278
|
.modal-body {
|
|
253
279
|
padding: var(--st-spacing-lg);
|
|
254
|
-
font-size: var(--st-font-size-sm
|
|
280
|
+
font-size: var(--st-font-size-sm);
|
|
255
281
|
line-height: 1.5;
|
|
256
282
|
}
|
|
257
283
|
|
|
@@ -262,7 +288,7 @@ StModal.styles = [
|
|
|
262
288
|
gap: var(--st-spacing-sm);
|
|
263
289
|
padding: var(--st-spacing-md) var(--st-spacing-lg);
|
|
264
290
|
border-top: 1px solid var(--st-color-border);
|
|
265
|
-
background-color: var(--st-color-surface-muted
|
|
291
|
+
background-color: var(--st-color-surface-muted);
|
|
266
292
|
}
|
|
267
293
|
`,
|
|
268
294
|
];
|
|
@@ -278,6 +304,9 @@ __decorate([
|
|
|
278
304
|
__decorate([
|
|
279
305
|
property({ type: Boolean })
|
|
280
306
|
], StModal.prototype, "static", void 0);
|
|
307
|
+
__decorate([
|
|
308
|
+
property({ type: Boolean, attribute: "preserve-state" })
|
|
309
|
+
], StModal.prototype, "preserveState", void 0);
|
|
281
310
|
__decorate([
|
|
282
311
|
query("dialog")
|
|
283
312
|
], StModal.prototype, "dialogEl", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.js","sourceRoot":"","sources":["../../../src/components/modal/modal.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,UAAU,EAAE,IAAI,EAAE,GAAG,EAAkB,OAAO,EAAC,MAAM,KAAK,CAAC;AACnE,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAC,WAAW,EAAC,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"modal.js","sourceRoot":"","sources":["../../../src/components/modal/modal.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,UAAU,EAAE,IAAI,EAAE,GAAG,EAAkB,OAAO,EAAC,MAAM,KAAK,CAAC;AACnE,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAC,WAAW,EAAC,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAC;AAErD,qEAAqE;AACrE,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAGvB,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,UAAU;IAAhC;;QACqC,SAAI,GAAG,KAAK,CAAC;QAC7B,YAAO,GAAG,EAAE,CAAC;QACb,SAAI,GAAsC,IAAI,CAAC;QAC9C,WAAM,GAAG,KAAK,CAAC;QAC1C;;;;WAIG;QACqD,kBAAa,GAAG,KAAK,CAAC;QAItE,cAAS,GAAG,KAAK,CAAC;IAqR5B,CAAC;IAlIC,y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AAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;wCAAc;AACb;IAAzB,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;qCAAgD;AAC9C;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;uCAAgB;AAMc;IAAvD,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAC,CAAC;8CAAuB;AAErD;IAAxB,KAAK,CAAC,QAAQ,CAAC;yCAAsC;AAZ3C,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAmSnB"}
|
|
@@ -289,9 +289,9 @@ StPageLayout.styles = [
|
|
|
289
289
|
:host {
|
|
290
290
|
display: block;
|
|
291
291
|
box-sizing: border-box;
|
|
292
|
-
--layout-bg-color: var(--st-color-bg
|
|
293
|
-
--layout-surface-color: var(--st-color-surface
|
|
294
|
-
--layout-border-color: var(--st-color-border
|
|
292
|
+
--layout-bg-color: var(--st-color-bg);
|
|
293
|
+
--layout-surface-color: var(--st-color-surface);
|
|
294
|
+
--layout-border-color: var(--st-color-border);
|
|
295
295
|
--layout-sidebar-width: 16rem;
|
|
296
296
|
--layout-right-sidebar-width: 16rem;
|
|
297
297
|
--layout-main-max-width: none;
|
|
@@ -313,7 +313,7 @@ StPageLayout.styles = [
|
|
|
313
313
|
justify-content: center;
|
|
314
314
|
background: transparent;
|
|
315
315
|
border: 1px solid var(--layout-border-color);
|
|
316
|
-
border-radius: var(--st-radius-sm
|
|
316
|
+
border-radius: var(--st-radius-sm);
|
|
317
317
|
width: 2.25rem;
|
|
318
318
|
height: 2.25rem;
|
|
319
319
|
cursor: pointer;
|
|
@@ -347,7 +347,7 @@ StPageLayout.styles = [
|
|
|
347
347
|
left: 0;
|
|
348
348
|
width: 100vw;
|
|
349
349
|
height: 100vh;
|
|
350
|
-
background-color:
|
|
350
|
+
background-color: var(--st-color-overlay);
|
|
351
351
|
backdrop-filter: blur(2px);
|
|
352
352
|
z-index: 1000;
|
|
353
353
|
display: none;
|
|
@@ -392,12 +392,12 @@ StPageLayout.styles = [
|
|
|
392
392
|
display: flex;
|
|
393
393
|
align-items: center;
|
|
394
394
|
justify-content: center;
|
|
395
|
-
border-radius: var(--st-radius-sm
|
|
395
|
+
border-radius: var(--st-radius-sm);
|
|
396
396
|
}
|
|
397
397
|
|
|
398
398
|
.mobile-close-btn:hover {
|
|
399
399
|
color: var(--st-color-text);
|
|
400
|
-
background-color: var(--st-color-surface-muted
|
|
400
|
+
background-color: var(--st-color-surface-muted);
|
|
401
401
|
}
|
|
402
402
|
|
|
403
403
|
.mobile-close-btn svg {
|
|
@@ -674,7 +674,7 @@ StPageLayout.styles = [
|
|
|
674
674
|
height: 100vh;
|
|
675
675
|
background: var(--layout-bg-color);
|
|
676
676
|
z-index: 1001;
|
|
677
|
-
box-shadow:
|
|
677
|
+
box-shadow: var(--st-shadow-drawer);
|
|
678
678
|
transform: translateX(-100%);
|
|
679
679
|
transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
|
680
680
|
display: flex !important;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import "../icon/icon.js";
|
|
3
|
+
export declare class StPagination extends LitElement {
|
|
4
|
+
page: number;
|
|
5
|
+
totalPages: number;
|
|
6
|
+
static styles: import("lit").CSSResult[];
|
|
7
|
+
private _go;
|
|
8
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
9
|
+
}
|
|
10
|
+
declare global {
|
|
11
|
+
interface HTMLElementTagNameMap {
|
|
12
|
+
"st-pagination": StPagination;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=pagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../src/components/pagination/pagination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAY,MAAM,KAAK,CAAC;AAI1C,OAAO,iBAAiB,CAAC;AAEzB,qBACa,YAAa,SAAQ,UAAU;IACD,IAAI,SAAK;IACE,UAAU,SAAK;IAEnE,MAAM,CAAC,MAAM,4BAgDX;IAEF,OAAO,CAAC,GAAG;IASX,MAAM,yCA0CL;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,eAAe,EAAE,YAAY,CAAC;KAC/B;CACF"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement, html, css } from "lit";
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
import { resetStyles } from "../../styles/reset.js";
|
|
10
|
+
import { buildPages } from "./pagination.utils.js";
|
|
11
|
+
import "../icon/icon.js";
|
|
12
|
+
let StPagination = class StPagination extends LitElement {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.page = 1;
|
|
16
|
+
this.totalPages = 1;
|
|
17
|
+
}
|
|
18
|
+
_go(page) {
|
|
19
|
+
const next = Math.min(Math.max(page, 1), this.totalPages);
|
|
20
|
+
if (next === this.page)
|
|
21
|
+
return;
|
|
22
|
+
this.page = next;
|
|
23
|
+
this.dispatchEvent(new CustomEvent("st-page-change", { detail: { page: next }, bubbles: true, composed: true }));
|
|
24
|
+
}
|
|
25
|
+
render() {
|
|
26
|
+
const pages = buildPages(this.page, this.totalPages);
|
|
27
|
+
return html `
|
|
28
|
+
<nav aria-label="Pagination">
|
|
29
|
+
<ul>
|
|
30
|
+
<li>
|
|
31
|
+
<button
|
|
32
|
+
type="button"
|
|
33
|
+
aria-label="Previous page"
|
|
34
|
+
?disabled=${this.page <= 1}
|
|
35
|
+
@click=${() => this._go(this.page - 1)}
|
|
36
|
+
>
|
|
37
|
+
<st-icon name="angle-left" size="sm" aria-hidden="true"></st-icon>
|
|
38
|
+
</button>
|
|
39
|
+
</li>
|
|
40
|
+
${pages.map((p) => p === "…"
|
|
41
|
+
? html `<li class="gap" aria-hidden="true">…</li>`
|
|
42
|
+
: html `<li>
|
|
43
|
+
<button
|
|
44
|
+
type="button"
|
|
45
|
+
aria-label="Page ${p}"
|
|
46
|
+
aria-current=${p === this.page ? "page" : "false"}
|
|
47
|
+
@click=${() => this._go(p)}
|
|
48
|
+
>
|
|
49
|
+
${p}
|
|
50
|
+
</button>
|
|
51
|
+
</li>`)}
|
|
52
|
+
<li>
|
|
53
|
+
<button
|
|
54
|
+
type="button"
|
|
55
|
+
aria-label="Next page"
|
|
56
|
+
?disabled=${this.page >= this.totalPages}
|
|
57
|
+
@click=${() => this._go(this.page + 1)}
|
|
58
|
+
>
|
|
59
|
+
<st-icon name="angle-right" size="sm" aria-hidden="true"></st-icon>
|
|
60
|
+
</button>
|
|
61
|
+
</li>
|
|
62
|
+
</ul>
|
|
63
|
+
</nav>
|
|
64
|
+
`;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
StPagination.styles = [
|
|
68
|
+
resetStyles,
|
|
69
|
+
css `
|
|
70
|
+
:host {
|
|
71
|
+
display: block;
|
|
72
|
+
}
|
|
73
|
+
ul {
|
|
74
|
+
display: flex;
|
|
75
|
+
flex-wrap: wrap;
|
|
76
|
+
gap: 0.25rem;
|
|
77
|
+
list-style: none;
|
|
78
|
+
align-items: center;
|
|
79
|
+
}
|
|
80
|
+
button {
|
|
81
|
+
min-width: 2.25rem;
|
|
82
|
+
height: 2.25rem;
|
|
83
|
+
padding: 0 0.5rem;
|
|
84
|
+
display: inline-flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
justify-content: center;
|
|
87
|
+
border: 1px solid var(--st-color-border);
|
|
88
|
+
border-radius: 0.5rem;
|
|
89
|
+
background: var(--st-color-surface);
|
|
90
|
+
color: var(--st-color-text);
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
}
|
|
93
|
+
button:hover:not(:disabled):not([aria-current="page"]) {
|
|
94
|
+
background: var(--st-color-surface-hover);
|
|
95
|
+
}
|
|
96
|
+
button:focus-visible {
|
|
97
|
+
outline: 2px solid var(--st-color-primary);
|
|
98
|
+
outline-offset: 2px;
|
|
99
|
+
}
|
|
100
|
+
button[aria-current="page"] {
|
|
101
|
+
background: var(--st-color-primary);
|
|
102
|
+
border-color: var(--st-color-primary);
|
|
103
|
+
color: var(--st-color-on-primary);
|
|
104
|
+
cursor: default;
|
|
105
|
+
}
|
|
106
|
+
button:disabled {
|
|
107
|
+
opacity: 0.5;
|
|
108
|
+
cursor: not-allowed;
|
|
109
|
+
}
|
|
110
|
+
.gap {
|
|
111
|
+
padding: 0 0.25rem;
|
|
112
|
+
color: var(--st-color-text-muted);
|
|
113
|
+
}
|
|
114
|
+
`,
|
|
115
|
+
];
|
|
116
|
+
__decorate([
|
|
117
|
+
property({ type: Number, reflect: true })
|
|
118
|
+
], StPagination.prototype, "page", void 0);
|
|
119
|
+
__decorate([
|
|
120
|
+
property({ type: Number, attribute: "total-pages" })
|
|
121
|
+
], StPagination.prototype, "totalPages", void 0);
|
|
122
|
+
StPagination = __decorate([
|
|
123
|
+
customElement("st-pagination")
|
|
124
|
+
], StPagination);
|
|
125
|
+
export { StPagination };
|
|
126
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../../src/components/pagination/pagination.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,E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AAI,CAAA;;;uCAGmB,CAAC;mCACL,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;6BACxC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;;sBAExB,CAAC;;sBAED,CACX;;;;;0BAKe,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU;uBAC/B,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;;;;;;;KAO/C,CAAC;IACJ,CAAC;CACF,CAAA;AAtGQ,mBAAM,GAAG;IACd,WAAW;IACX,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6CF;CACF,AAhDY,CAgDX;AAnDuC;IAAxC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;0CAAU;AACE;IAAnD,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAC,CAAC;gDAAgB;AAFxD,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CA0GxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.utils.d.ts","sourceRoot":"","sources":["../../../src/components/pagination/pagination.utils.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,SAAI,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,EAAE,CAYzF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Builds the visible page list, e.g. [1, "…", 4, 5, 6, "…", 12]. */
|
|
2
|
+
export function buildPages(current, total, siblings = 1) {
|
|
3
|
+
if (total <= 0)
|
|
4
|
+
return [];
|
|
5
|
+
const range = (a, b) => Array.from({ length: b - a + 1 }, (_, i) => a + i);
|
|
6
|
+
if (total <= siblings * 2 + 5)
|
|
7
|
+
return range(1, total);
|
|
8
|
+
const left = Math.max(current - siblings, 2);
|
|
9
|
+
const right = Math.min(current + siblings, total - 1);
|
|
10
|
+
const pages = [1];
|
|
11
|
+
if (left > 2)
|
|
12
|
+
pages.push("…");
|
|
13
|
+
pages.push(...range(left, right));
|
|
14
|
+
if (right < total - 1)
|
|
15
|
+
pages.push("…");
|
|
16
|
+
pages.push(total);
|
|
17
|
+
return pages;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=pagination.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.utils.js","sourceRoot":"","sources":["../../../src/components/pagination/pagination.utils.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,MAAM,UAAU,UAAU,CAAC,OAAe,EAAE,KAAa,EAAE,QAAQ,GAAG,CAAC;IACrE,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IAC1B,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACzF,IAAI,KAAK,IAAI,QAAQ,GAAG,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACtD,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,QAAQ,EAAE,CAAC,CAAC,CAAC;IAC7C,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,QAAQ,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;IACtD,MAAM,KAAK,GAAqB,CAAC,CAAC,CAAC,CAAC;IACpC,IAAI,IAAI,GAAG,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC9B,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;IAClC,IAAI,KAAK,GAAG,KAAK,GAAG,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClB,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { StChartBase } from "../chart/chart-base.js";
|
|
2
|
+
export interface PieDatum {
|
|
3
|
+
label: string;
|
|
4
|
+
value: number;
|
|
5
|
+
color?: string;
|
|
6
|
+
}
|
|
7
|
+
/** Pie chart, or donut with `donut`. Slices are hoverable, selectable and keyboard navigable. */
|
|
8
|
+
export declare class StPieChart extends StChartBase {
|
|
9
|
+
data: PieDatum[];
|
|
10
|
+
donut: boolean;
|
|
11
|
+
/** Donut label shown above the total, e.g. "Total". */
|
|
12
|
+
centerLabel: string;
|
|
13
|
+
/** Index of the selected slice, or null. */
|
|
14
|
+
selected: number | null;
|
|
15
|
+
private _active;
|
|
16
|
+
private _hidden;
|
|
17
|
+
static styles: import("lit").CSSResult[];
|
|
18
|
+
private get _slices();
|
|
19
|
+
private _describe;
|
|
20
|
+
private _setActive;
|
|
21
|
+
private _select;
|
|
22
|
+
private _radius;
|
|
23
|
+
private _onKeydown;
|
|
24
|
+
private _toggleSlice;
|
|
25
|
+
private _renderPlot;
|
|
26
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
27
|
+
}
|
|
28
|
+
declare global {
|
|
29
|
+
interface HTMLElementTagNameMap {
|
|
30
|
+
"st-pie-chart": StPieChart;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=pie-chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pie-chart.d.ts","sourceRoot":"","sources":["../../../src/components/pie-chart/pie-chart.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,WAAW,EAAC,MAAM,wBAAwB,CAAC;AAGnD,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,iGAAiG;AACjG,qBACa,UAAW,SAAQ,WAAW;IAChB,IAAI,EAAE,QAAQ,EAAE,CAAM;IACpB,KAAK,UAAS;IACzC,uDAAuD;IACF,WAAW,SAAW;IAC3E,4CAA4C;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAE/D,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,OAAO,CAAqB;IAE7C,MAAM,CAAC,MAAM,4BAyBX;IAEF,OAAO,KAAK,OAAO,GAclB;IAED,OAAO,CAAC,SAAS;IAWjB,OAAO,CAAC,UAAU;IAyBlB,OAAO,CAAC,OAAO;IAMf,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,UAAU;IAelB,OAAO,CAAC,YAAY;IAcpB,OAAO,CAAC,WAAW;IAqCnB,MAAM,yCA0CL;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,UAAU,CAAC;KAC5B;CACF"}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, css, svg, nothing } from "lit";
|
|
8
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
9
|
+
import { resetStyles } from "../../styles/reset.js";
|
|
10
|
+
import { StChartBase } from "../chart/chart-base.js";
|
|
11
|
+
import { arcPath, chartColor, polar, stepIndex } from "../chart/chart.utils.js";
|
|
12
|
+
/** Pie chart, or donut with `donut`. Slices are hoverable, selectable and keyboard navigable. */
|
|
13
|
+
let StPieChart = class StPieChart extends StChartBase {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.data = [];
|
|
17
|
+
this.donut = false;
|
|
18
|
+
/** Donut label shown above the total, e.g. "Total". */
|
|
19
|
+
this.centerLabel = "Total";
|
|
20
|
+
/** Index of the selected slice, or null. */
|
|
21
|
+
this.selected = null;
|
|
22
|
+
this._active = null;
|
|
23
|
+
this._hidden = new Set();
|
|
24
|
+
}
|
|
25
|
+
get _slices() {
|
|
26
|
+
const visible = this.data
|
|
27
|
+
.map((d, i) => ({ d, i }))
|
|
28
|
+
.filter(({ d, i }) => !this._hidden.has(i) && d.value > 0);
|
|
29
|
+
const total = visible.reduce((sum, { d }) => sum + d.value, 0);
|
|
30
|
+
let angle = 0;
|
|
31
|
+
return {
|
|
32
|
+
total,
|
|
33
|
+
slices: visible.map(({ d, i }) => {
|
|
34
|
+
const start = angle;
|
|
35
|
+
angle += total ? (d.value / total) * Math.PI * 2 : 0;
|
|
36
|
+
return { ...d, index: i, start, end: angle, percent: total ? (d.value / total) * 100 : 0 };
|
|
37
|
+
}),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
_describe(index) {
|
|
41
|
+
const { total } = this._slices;
|
|
42
|
+
const d = this.data[index];
|
|
43
|
+
return {
|
|
44
|
+
index,
|
|
45
|
+
label: d.label,
|
|
46
|
+
value: d.value,
|
|
47
|
+
percent: total ? (d.value / total) * 100 : 0,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
_setActive(index) {
|
|
51
|
+
if (index === this._active)
|
|
52
|
+
return;
|
|
53
|
+
this._active = index;
|
|
54
|
+
if (index === null) {
|
|
55
|
+
this.hideTooltip();
|
|
56
|
+
this.emit("st-chart-leave", {});
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const d = this._describe(index);
|
|
60
|
+
const slice = this._slices.slices.find((s) => s.index === index);
|
|
61
|
+
const r = this._radius();
|
|
62
|
+
const [x, y] = polar(this._width / 2, this.height / 2, r, (slice.start + slice.end) / 2);
|
|
63
|
+
const percent = `${d.percent.toFixed(1)}%`;
|
|
64
|
+
this.showTooltip({
|
|
65
|
+
x,
|
|
66
|
+
y,
|
|
67
|
+
title: d.label,
|
|
68
|
+
rows: [{ label: percent, value: this.fmt(d.value), color: chartColor(index, this.data[index].color) }],
|
|
69
|
+
}, `${d.label}: ${this.fmt(d.value)}, ${percent}`);
|
|
70
|
+
this.emit("st-chart-hover", d);
|
|
71
|
+
}
|
|
72
|
+
_select(index) {
|
|
73
|
+
if (!this.selectable)
|
|
74
|
+
return;
|
|
75
|
+
this.selected = this.selected === index ? null : index;
|
|
76
|
+
this.emit("st-chart-select", { ...this._describe(index), selected: this.selected === index });
|
|
77
|
+
}
|
|
78
|
+
_radius() {
|
|
79
|
+
return Math.max(Math.min(this._width, this.height) / 2 - 12, 10);
|
|
80
|
+
}
|
|
81
|
+
_onKeydown(e) {
|
|
82
|
+
if (e.key === "Escape")
|
|
83
|
+
return this._setActive(null);
|
|
84
|
+
if ((e.key === "Enter" || e.key === " ") && this._active !== null) {
|
|
85
|
+
e.preventDefault();
|
|
86
|
+
return this._select(this._active);
|
|
87
|
+
}
|
|
88
|
+
const order = this._slices.slices.map((s) => s.index);
|
|
89
|
+
const pos = this._active === null ? null : order.indexOf(this._active);
|
|
90
|
+
const next = stepIndex(e.key, pos === -1 ? null : pos, order.length);
|
|
91
|
+
if (next !== null) {
|
|
92
|
+
e.preventDefault();
|
|
93
|
+
this._setActive(order[next]);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
_toggleSlice(index) {
|
|
97
|
+
const hidden = new Set(this._hidden);
|
|
98
|
+
if (hidden.has(index))
|
|
99
|
+
hidden.delete(index);
|
|
100
|
+
else
|
|
101
|
+
hidden.add(index);
|
|
102
|
+
this._hidden = hidden;
|
|
103
|
+
this._active = null;
|
|
104
|
+
this.hideTooltip();
|
|
105
|
+
this.emit("st-chart-legend-toggle", {
|
|
106
|
+
name: this.data[index].label,
|
|
107
|
+
index,
|
|
108
|
+
hidden: hidden.has(index),
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
_renderPlot() {
|
|
112
|
+
const { total, slices } = this._slices;
|
|
113
|
+
const cx = this._width / 2;
|
|
114
|
+
const cy = this.height / 2;
|
|
115
|
+
const r = this._radius();
|
|
116
|
+
const inner = this.donut ? r * 0.6 : 0;
|
|
117
|
+
const emphasis = this._active ?? this.selected;
|
|
118
|
+
return svg `
|
|
119
|
+
<svg width=${this._width} height=${this.height} aria-hidden="true">
|
|
120
|
+
${slices.map((s) => {
|
|
121
|
+
const [dx, dy] = s.index === this.selected
|
|
122
|
+
? polar(0, 0, 6, (s.start + s.end) / 2)
|
|
123
|
+
: [0, 0];
|
|
124
|
+
const dim = emphasis !== null && emphasis !== s.index ? "dim" : "";
|
|
125
|
+
return svg `
|
|
126
|
+
<path
|
|
127
|
+
class="slice animate ${dim}"
|
|
128
|
+
d=${arcPath(cx, cy, r, inner, s.start, s.end)}
|
|
129
|
+
transform="translate(${dx} ${dy})"
|
|
130
|
+
style="fill:${chartColor(s.index, s.color)}"
|
|
131
|
+
@pointerenter=${() => this._setActive(s.index)}
|
|
132
|
+
@pointerleave=${() => this._setActive(null)}
|
|
133
|
+
@click=${() => this._select(s.index)}
|
|
134
|
+
></path>
|
|
135
|
+
`;
|
|
136
|
+
})}
|
|
137
|
+
${this.donut
|
|
138
|
+
? svg `
|
|
139
|
+
<text class="center-value" x=${cx} y=${cy + 4} text-anchor="middle">${this.fmtAxis(total)}</text>
|
|
140
|
+
<text class="center-label" x=${cx} y=${cy + 22} text-anchor="middle">${this.centerLabel}</text>
|
|
141
|
+
`
|
|
142
|
+
: nothing}
|
|
143
|
+
</svg>
|
|
144
|
+
`;
|
|
145
|
+
}
|
|
146
|
+
render() {
|
|
147
|
+
const total = this.data.reduce((sum, d) => sum + d.value, 0);
|
|
148
|
+
return html `
|
|
149
|
+
<div class="chart">
|
|
150
|
+
${this._width > 0
|
|
151
|
+
? html `
|
|
152
|
+
<div
|
|
153
|
+
class="plot"
|
|
154
|
+
tabindex="0"
|
|
155
|
+
role="group"
|
|
156
|
+
aria-roledescription=${this.donut ? "donut chart" : "pie chart"}
|
|
157
|
+
aria-label=${this.label || (this.donut ? "Donut chart" : "Pie chart")}
|
|
158
|
+
@keydown=${this._onKeydown}
|
|
159
|
+
@focus=${() => {
|
|
160
|
+
const first = this._slices.slices[0];
|
|
161
|
+
if (this._active === null && first)
|
|
162
|
+
this._setActive(first.index);
|
|
163
|
+
}}
|
|
164
|
+
@blur=${() => this._setActive(null)}
|
|
165
|
+
>
|
|
166
|
+
${this._renderPlot()} ${this.renderTooltip()}
|
|
167
|
+
</div>
|
|
168
|
+
`
|
|
169
|
+
: nothing}
|
|
170
|
+
${this.renderLegend(this.data.map((d, i) => ({
|
|
171
|
+
name: d.label,
|
|
172
|
+
color: chartColor(i, d.color),
|
|
173
|
+
hidden: this._hidden.has(i),
|
|
174
|
+
})), (i) => this._toggleSlice(i))}
|
|
175
|
+
${this.renderLiveRegion()}
|
|
176
|
+
${this.renderDataTable(["Category", "Value", "Share"], this.data.map((d) => [
|
|
177
|
+
d.label,
|
|
178
|
+
this.fmt(d.value),
|
|
179
|
+
total ? `${((d.value / total) * 100).toFixed(1)}%` : "0%",
|
|
180
|
+
]))}
|
|
181
|
+
</div>
|
|
182
|
+
`;
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
StPieChart.styles = [
|
|
186
|
+
resetStyles,
|
|
187
|
+
StChartBase.baseStyles,
|
|
188
|
+
css `
|
|
189
|
+
.slice {
|
|
190
|
+
stroke: var(--st-color-bg);
|
|
191
|
+
stroke-width: 2;
|
|
192
|
+
cursor: default;
|
|
193
|
+
}
|
|
194
|
+
:host([selectable]) .slice {
|
|
195
|
+
cursor: pointer;
|
|
196
|
+
}
|
|
197
|
+
.slice.dim {
|
|
198
|
+
opacity: 0.5;
|
|
199
|
+
}
|
|
200
|
+
.center-value {
|
|
201
|
+
fill: var(--st-color-text);
|
|
202
|
+
font-size: var(--st-font-size-2xl);
|
|
203
|
+
font-weight: var(--st-font-weight-bold);
|
|
204
|
+
}
|
|
205
|
+
.center-label {
|
|
206
|
+
fill: var(--st-color-text-muted);
|
|
207
|
+
font-size: var(--st-font-size-xs);
|
|
208
|
+
}
|
|
209
|
+
`,
|
|
210
|
+
];
|
|
211
|
+
__decorate([
|
|
212
|
+
property({ type: Array })
|
|
213
|
+
], StPieChart.prototype, "data", void 0);
|
|
214
|
+
__decorate([
|
|
215
|
+
property({ type: Boolean })
|
|
216
|
+
], StPieChart.prototype, "donut", void 0);
|
|
217
|
+
__decorate([
|
|
218
|
+
property({ type: String, attribute: "center-label" })
|
|
219
|
+
], StPieChart.prototype, "centerLabel", void 0);
|
|
220
|
+
__decorate([
|
|
221
|
+
property({ type: Number, reflect: true })
|
|
222
|
+
], StPieChart.prototype, "selected", void 0);
|
|
223
|
+
__decorate([
|
|
224
|
+
state()
|
|
225
|
+
], StPieChart.prototype, "_active", void 0);
|
|
226
|
+
__decorate([
|
|
227
|
+
state()
|
|
228
|
+
], StPieChart.prototype, "_hidden", void 0);
|
|
229
|
+
StPieChart = __decorate([
|
|
230
|
+
customElement("st-pie-chart")
|
|
231
|
+
], StPieChart);
|
|
232
|
+
export { StPieChart };
|
|
233
|
+
//# sourceMappingURL=pie-chart.js.map
|