@dataengineeringformachinelearning/viking-ui 1.0.2 → 3.0.0-alpha.4
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/LICENSE +201 -0
- package/README.md +217 -38
- package/dist/core/brand-icons.d.ts +29 -0
- package/dist/core/icons.d.ts +132 -0
- package/dist/core/integration-brand-icons.d.ts +18 -0
- package/dist/core/lucide-paths.generated.d.ts +90 -0
- package/dist/core/types.d.ts +56 -0
- package/dist/core/uid.d.ts +2 -0
- package/dist/deml-components.css +1122 -0
- package/dist/design-tokens.css +688 -0
- package/dist/elements/button/viking-button.d.ts +14 -0
- package/dist/elements/card/viking-card.d.ts +8 -0
- package/dist/elements/core/dom.d.ts +4 -0
- package/dist/elements/core/styles.d.ts +2 -0
- package/dist/elements/modal/viking-modal.d.ts +15 -0
- package/dist/fonts/inter/InterVariable-Italic.woff2 +0 -0
- package/dist/fonts/inter/InterVariable.woff2 +0 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4051 -0
- package/dist/lib/accordion/accordion.d.ts +19 -0
- package/dist/lib/app-header/app-header.d.ts +8 -0
- package/dist/lib/app-sidebar/app-sidebar.d.ts +10 -0
- package/dist/lib/auth-panel/auth-panel.d.ts +13 -0
- package/dist/lib/autocomplete/autocomplete.d.ts +25 -0
- package/dist/lib/avatar/avatar.d.ts +14 -0
- package/dist/lib/badge/badge.d.ts +16 -0
- package/dist/lib/bar/bar.d.ts +4 -0
- package/dist/lib/brand/brand.d.ts +8 -0
- package/dist/lib/breadcrumbs/breadcrumbs.d.ts +10 -0
- package/dist/lib/button/button-group.d.ts +6 -0
- package/dist/lib/button/button.d.ts +25 -0
- package/dist/lib/calendar/calendar.d.ts +22 -0
- package/dist/lib/callout/callout.d.ts +14 -0
- package/dist/lib/card/card-title.d.ts +12 -0
- package/dist/lib/card/card.d.ts +19 -0
- package/dist/lib/carousel/carousel.d.ts +13 -0
- package/dist/lib/chart/chart-zoom.d.ts +14 -0
- package/dist/lib/chart/chart.d.ts +119 -0
- package/dist/lib/chart-card-header/chart-card-header.d.ts +10 -0
- package/dist/lib/chart-empty-state/chart-empty-state.d.ts +13 -0
- package/dist/lib/chart-panel/chart-panel.d.ts +10 -0
- package/dist/lib/checkbox/checkbox.d.ts +13 -0
- package/dist/lib/color-picker/color-picker.d.ts +16 -0
- package/dist/lib/command/command.d.ts +23 -0
- package/dist/lib/composer/composer.d.ts +15 -0
- package/dist/lib/confirm-dialog/confirm-dialog.d.ts +18 -0
- package/dist/lib/confirm-dialog/dialog.service.d.ts +28 -0
- package/dist/lib/context/context.d.ts +17 -0
- package/dist/lib/core/brand-icons.d.ts +29 -0
- package/dist/lib/core/cva.d.ts +15 -0
- package/dist/lib/core/icons.d.ts +132 -0
- package/dist/lib/core/integration-brand-icons.d.ts +18 -0
- package/dist/lib/core/lucide-paths.generated.d.ts +90 -0
- package/dist/lib/date-picker/date-picker.d.ts +18 -0
- package/dist/lib/dropdown/dropdown.d.ts +29 -0
- package/dist/lib/editor/editor.d.ts +26 -0
- package/dist/lib/empty-state/empty-state.d.ts +9 -0
- package/dist/lib/fab/fab.d.ts +9 -0
- package/dist/lib/field/field.d.ts +14 -0
- package/dist/lib/file-upload/file-upload.d.ts +19 -0
- package/dist/lib/footer/footer.d.ts +6 -0
- package/dist/lib/form-section/form-section.d.ts +15 -0
- package/dist/lib/gauge-arc/gauge-arc.d.ts +8 -0
- package/dist/lib/hud-panel/hud-panel.d.ts +5 -0
- package/dist/lib/icon/icon.d.ts +44 -0
- package/dist/lib/icon-badge/icon-badge.d.ts +14 -0
- package/dist/lib/icon-heading/icon-heading.d.ts +9 -0
- package/dist/lib/icon-text/icon-text.d.ts +12 -0
- package/dist/lib/input/input.d.ts +23 -0
- package/dist/lib/kanban/kanban.d.ts +16 -0
- package/dist/lib/kbd/kbd.d.ts +5 -0
- package/dist/lib/label/label.d.ts +7 -0
- package/dist/lib/loading-overlay/loading-overlay.d.ts +10 -0
- package/dist/lib/menubar/menubar.d.ts +10 -0
- package/dist/lib/metric-card/metric-card.d.ts +9 -0
- package/dist/lib/modal/modal.d.ts +13 -0
- package/dist/lib/native-select/native-select.d.ts +17 -0
- package/dist/lib/navbar/navbar.d.ts +13 -0
- package/dist/lib/navigation-menu/navigation-menu.d.ts +13 -0
- package/dist/lib/otp-input/otp-input.d.ts +23 -0
- package/dist/lib/page-back-link/page-back-link.d.ts +11 -0
- package/dist/lib/page-header/page-header.d.ts +15 -0
- package/dist/lib/pagination/pagination.d.ts +10 -0
- package/dist/lib/pillbox/pillbox.d.ts +15 -0
- package/dist/lib/popover/popover.d.ts +15 -0
- package/dist/lib/profile/profile.d.ts +11 -0
- package/dist/lib/progress/progress.d.ts +12 -0
- package/dist/lib/radio/radio.d.ts +16 -0
- package/dist/lib/ring-gauge/ring-gauge.d.ts +8 -0
- package/dist/lib/scroll-area/scroll-area.d.ts +7 -0
- package/dist/lib/search-palette/search-palette.d.ts +16 -0
- package/dist/lib/select/select.d.ts +26 -0
- package/dist/lib/separator/separator.d.ts +8 -0
- package/dist/lib/sheet/sheet.d.ts +13 -0
- package/dist/lib/sidebar-nav/sidebar-nav.d.ts +46 -0
- package/dist/lib/site-drakkar/site-drakkar.config.d.ts +50 -0
- package/dist/lib/site-drakkar/site-footer.d.ts +18 -0
- package/dist/lib/site-drakkar/site-navbar.d.ts +25 -0
- package/dist/lib/site-drakkar/suite-search-items.d.ts +17 -0
- package/dist/lib/skeleton/skeleton.d.ts +8 -0
- package/dist/lib/slider/slider.d.ts +17 -0
- package/dist/lib/spinner/spinner.d.ts +7 -0
- package/dist/lib/status-metric-row/status-metric-row.d.ts +9 -0
- package/dist/lib/suite-search-palette/suite-search-palette.d.ts +25 -0
- package/dist/lib/switch/switch.d.ts +12 -0
- package/dist/lib/table/table.d.ts +10 -0
- package/dist/lib/tabs/tab-panel.d.ts +12 -0
- package/dist/lib/tabs/tab.d.ts +14 -0
- package/dist/lib/tabs/tabs.d.ts +10 -0
- package/dist/lib/textarea/textarea.d.ts +16 -0
- package/dist/lib/theme-toggle/theme-toggle.d.ts +9 -0
- package/dist/lib/time-picker/time-picker.d.ts +21 -0
- package/dist/lib/timeline/timeline.d.ts +14 -0
- package/dist/lib/toast/toast.d.ts +21 -0
- package/dist/lib/toggle/toggle-group.d.ts +9 -0
- package/dist/lib/toggle/toggle.d.ts +15 -0
- package/dist/lib/tooltip/tooltip.d.ts +20 -0
- package/dist/lib/typography/heading.d.ts +9 -0
- package/dist/lib/typography/text.d.ts +11 -0
- package/dist/lib/uptime-bar/uptime-bar.d.ts +6 -0
- package/dist/lib/verification-code-field/verification-code-field.d.ts +19 -0
- package/dist/lib/whitepaper-cta/whitepaper-cta.d.ts +15 -0
- package/dist/lib/wizard/wizard.d.ts +13 -0
- package/dist/public-api.d.ts +109 -0
- package/dist/tokens/series-presets.d.ts +4 -0
- package/dist/viking-components.css +1837 -0
- package/dist/viking-tokens.json +318 -0
- package/dist/viking-ui-elements.js +1750 -0
- package/dist/viking-ui.css +1 -0
- package/dist/web/badge/viking-badge-wc.d.ts +28 -0
- package/dist/web/button/viking-button-wc.d.ts +28 -0
- package/dist/web/callout/viking-callout-wc.d.ts +27 -0
- package/dist/web/card/viking-card-wc.d.ts +29 -0
- package/dist/web/core/base.d.ts +12 -0
- package/dist/web/core/dom.d.ts +11 -0
- package/dist/web/core/icons-inline.d.ts +7 -0
- package/dist/web/core/styles.d.ts +12 -0
- package/dist/web/core/types.d.ts +10 -0
- package/dist/web/field/viking-field-wc.d.ts +32 -0
- package/dist/web/index.d.ts +15 -0
- package/dist/web/input/viking-input-wc.d.ts +32 -0
- package/dist/web/modal/viking-modal-wc.d.ts +50 -0
- package/dist/web/search-palette/viking-search-palette-wc.d.ts +64 -0
- package/dist/web/select/viking-select-wc.d.ts +48 -0
- package/dist/web/suite-header/viking-suite-header-wc.d.ts +36 -0
- package/dist/web/suite-search-palette/viking-suite-search-palette-wc.d.ts +39 -0
- package/dist/web/theme-toggle/viking-theme-toggle-wc.d.ts +19 -0
- package/dist/web/types.d.ts +40 -0
- package/dist/web-components/index.d.ts +1 -0
- package/dist/web-components.js +1750 -0
- package/dist/widget.js +1182 -0
- package/package.json +89 -30
- package/src/assets/drakkar-favicon.svg +17 -0
- package/src/assets/fonts/inter/InterVariable-Italic.woff2 +0 -0
- package/src/assets/fonts/inter/InterVariable.woff2 +0 -0
- package/src/core/brand/deml-lockup.svg +5 -0
- package/src/core/brand/deml-mark-compact.svg +4 -0
- package/src/core/brand/deml-mark-filled.svg +3 -0
- package/src/core/brand/deml-mark-outline.svg +4 -0
- package/src/core/brand-icons.ts +62 -0
- package/src/core/icons.spec.ts +52 -0
- package/src/core/icons.ts +206 -0
- package/src/core/integration-brand-icons.ts +77 -0
- package/src/core/lucide-paths.generated.ts +130 -0
- package/src/core/types.ts +85 -0
- package/src/core/uid.ts +7 -0
- package/src/elements/button/viking-button.ts +201 -0
- package/src/elements/card/viking-card.ts +60 -0
- package/src/elements/core/dom.ts +33 -0
- package/src/elements/core/styles.ts +28 -0
- package/src/elements/modal/viking-modal.ts +154 -0
- package/src/index.ts +1 -0
- package/src/lib/accordion/accordion.ts +126 -0
- package/src/lib/app-header/app-header.scss +274 -0
- package/src/lib/app-header/app-header.ts +43 -0
- package/src/lib/app-sidebar/app-sidebar.scss +415 -0
- package/src/lib/app-sidebar/app-sidebar.ts +29 -0
- package/src/lib/auth-panel/auth-panel.spec.ts +132 -0
- package/src/lib/auth-panel/auth-panel.ts +228 -0
- package/src/lib/autocomplete/autocomplete.ts +223 -0
- package/src/lib/avatar/avatar.ts +126 -0
- package/src/lib/badge/badge.ts +182 -0
- package/src/lib/bar/bar.ts +31 -0
- package/src/lib/brand/brand.ts +60 -0
- package/src/lib/breadcrumbs/breadcrumbs.ts +81 -0
- package/src/lib/button/button-group.ts +40 -0
- package/src/lib/button/button.scss +96 -0
- package/src/lib/button/button.ts +98 -0
- package/src/lib/calendar/calendar.ts +253 -0
- package/src/lib/callout/callout.ts +211 -0
- package/src/lib/card/card-title.spec.ts +27 -0
- package/src/lib/card/card-title.ts +50 -0
- package/src/lib/card/card.ts +170 -0
- package/src/lib/carousel/carousel.ts +206 -0
- package/src/lib/chart/chart-zoom.spec.ts +65 -0
- package/src/lib/chart/chart-zoom.ts +71 -0
- package/src/lib/chart/chart.ts +1257 -0
- package/src/lib/chart-card-header/chart-card-header.ts +80 -0
- package/src/lib/chart-empty-state/chart-empty-state.ts +146 -0
- package/src/lib/chart-panel/chart-panel.ts +133 -0
- package/src/lib/checkbox/checkbox.ts +139 -0
- package/src/lib/color-picker/color-picker.ts +148 -0
- package/src/lib/command/command.ts +260 -0
- package/src/lib/composer/composer.ts +180 -0
- package/src/lib/confirm-dialog/confirm-dialog.ts +163 -0
- package/src/lib/confirm-dialog/dialog.service.ts +79 -0
- package/src/lib/context/context.ts +75 -0
- package/src/lib/core/brand-icons.ts +62 -0
- package/src/lib/core/cva.ts +33 -0
- package/src/lib/core/icons.ts +206 -0
- package/src/lib/core/integration-brand-icons.ts +77 -0
- package/src/lib/core/lucide-paths.generated.ts +130 -0
- package/src/lib/date-picker/date-picker.ts +139 -0
- package/src/lib/dropdown/dropdown.ts +188 -0
- package/src/lib/editor/editor.ts +170 -0
- package/src/lib/empty-state/empty-state.ts +100 -0
- package/src/lib/fab/fab.ts +76 -0
- package/src/lib/field/field.ts +111 -0
- package/src/lib/file-upload/file-upload.ts +208 -0
- package/src/lib/footer/footer.scss +155 -0
- package/src/lib/footer/footer.ts +28 -0
- package/src/lib/form-section/form-section.ts +200 -0
- package/src/lib/forms.spec.ts +92 -0
- package/src/lib/gauge-arc/gauge-arc.ts +85 -0
- package/src/lib/hud-panel/hud-panel.ts +27 -0
- package/src/lib/icon/icon.ts +284 -0
- package/src/lib/icon-badge/icon-badge.ts +87 -0
- package/src/lib/icon-heading/icon-heading.spec.ts +32 -0
- package/src/lib/icon-heading/icon-heading.ts +38 -0
- package/src/lib/icon-text/icon-text.ts +120 -0
- package/src/lib/input/input.ts +119 -0
- package/src/lib/kanban/kanban.ts +211 -0
- package/src/lib/kbd/kbd.ts +32 -0
- package/src/lib/label/label.ts +39 -0
- package/src/lib/loading-overlay/loading-overlay.ts +80 -0
- package/src/lib/menubar/menubar.ts +77 -0
- package/src/lib/metric-card/metric-card.ts +33 -0
- package/src/lib/modal/modal.ts +207 -0
- package/src/lib/native-select/native-select.ts +124 -0
- package/src/lib/navbar/navbar.ts +124 -0
- package/src/lib/navigation-menu/navigation-menu.ts +116 -0
- package/src/lib/otp-input/otp-input.ts +164 -0
- package/src/lib/page-back-link/page-back-link.ts +74 -0
- package/src/lib/page-header/page-header.ts +70 -0
- package/src/lib/pagination/pagination.ts +157 -0
- package/src/lib/pillbox/pillbox.ts +157 -0
- package/src/lib/popover/popover.ts +92 -0
- package/src/lib/profile/profile.ts +73 -0
- package/src/lib/progress/progress.ts +123 -0
- package/src/lib/radio/radio.ts +132 -0
- package/src/lib/ring-gauge/ring-gauge.ts +75 -0
- package/src/lib/scroll-area/scroll-area.ts +57 -0
- package/src/lib/search-palette/search-palette.scss +288 -0
- package/src/lib/search-palette/search-palette.ts +114 -0
- package/src/lib/select/select.ts +292 -0
- package/src/lib/separator/separator.ts +59 -0
- package/src/lib/sheet/sheet.ts +192 -0
- package/src/lib/sidebar-nav/sidebar-nav.scss +218 -0
- package/src/lib/sidebar-nav/sidebar-nav.ts +158 -0
- package/src/lib/site-drakkar/site-drakkar.config.ts +295 -0
- package/src/lib/site-drakkar/site-footer.ts +129 -0
- package/src/lib/site-drakkar/site-navbar.scss +2 -0
- package/src/lib/site-drakkar/site-navbar.ts +267 -0
- package/src/lib/site-drakkar/suite-search-items.spec.ts +61 -0
- package/src/lib/site-drakkar/suite-search-items.ts +246 -0
- package/src/lib/skeleton/skeleton.ts +51 -0
- package/src/lib/slider/slider.ts +133 -0
- package/src/lib/spinner/spinner.ts +75 -0
- package/src/lib/status-metric-row/status-metric-row.ts +74 -0
- package/src/lib/suite-search-palette/suite-search-palette.ts +95 -0
- package/src/lib/switch/switch.ts +131 -0
- package/src/lib/table/table.ts +137 -0
- package/src/lib/tabs/tab-panel.ts +61 -0
- package/src/lib/tabs/tab.ts +107 -0
- package/src/lib/tabs/tabs.ts +109 -0
- package/src/lib/textarea/textarea.ts +103 -0
- package/src/lib/theme-toggle/theme-toggle.spec.ts +40 -0
- package/src/lib/theme-toggle/theme-toggle.ts +39 -0
- package/src/lib/time-picker/time-picker.ts +197 -0
- package/src/lib/timeline/timeline.ts +152 -0
- package/src/lib/toast/toast.ts +196 -0
- package/src/lib/toggle/toggle-group.ts +60 -0
- package/src/lib/toggle/toggle.ts +101 -0
- package/src/lib/tooltip/tooltip.ts +119 -0
- package/src/lib/typography/heading.ts +52 -0
- package/src/lib/typography/text.ts +51 -0
- package/src/lib/uptime-bar/uptime-bar.ts +55 -0
- package/src/lib/verification-code-field/verification-code-field.ts +149 -0
- package/src/lib/whitepaper-cta/whitepaper-cta.scss +130 -0
- package/src/lib/whitepaper-cta/whitepaper-cta.ts +78 -0
- package/src/lib/wizard/wizard.ts +80 -0
- package/src/public-api.ts +172 -0
- package/src/styles/_buttons.scss +301 -0
- package/src/styles/_component-primitives.scss +183 -0
- package/src/styles/_drakkar-buttons.scss +85 -0
- package/src/styles/_fonts.scss +22 -0
- package/src/styles/_forms.scss +66 -0
- package/src/styles/_input.scss +106 -0
- package/src/styles/_layout-enforcement.scss +166 -0
- package/src/styles/_layout-rhythm.scss +158 -0
- package/src/styles/_legacy-aliases.scss +212 -0
- package/src/styles/_series-colors.scss +24 -0
- package/src/styles/_static-primitives.scss +857 -0
- package/src/styles/_typography.scss +87 -0
- package/src/styles/_variables.scss +527 -0
- package/src/styles/components/a11y.scss +90 -0
- package/src/styles/components/badges.scss +102 -0
- package/src/styles/components/extracted-utilities.scss +459 -0
- package/src/styles/components/footer.scss +155 -0
- package/src/styles/components/icon-heading.scss +47 -0
- package/src/styles/components/icon-inline.scss +78 -0
- package/src/styles/components/layout.scss +59 -0
- package/src/styles/components/utilities.scss +131 -0
- package/src/styles/components/viking-inspired.scss +204 -0
- package/src/styles/components/whitepaper-cta.scss +130 -0
- package/src/styles/components-bundle.scss +9 -0
- package/src/styles/components.scss +175 -0
- package/src/styles/deml-components.scss +10 -0
- package/src/styles/index.scss +8 -0
- package/src/styles/layout-shell.scss +39 -11
- package/src/styles/page-shell.scss +663 -33
- package/src/styles/static-navbar.scss +862 -146
- package/src/styles/surfaces/backend.scss +142 -0
- package/src/styles/surfaces/docs-global.scss +73 -0
- package/src/styles/surfaces/docs-shell.scss +412 -0
- package/src/styles/surfaces/docs-showcase.scss +1051 -0
- package/src/styles/surfaces/marketing-cta.scss +62 -0
- package/src/styles/surfaces/marketing-docs-bento.scss +67 -0
- package/src/styles/surfaces/marketing-global.scss +748 -0
- package/src/styles/surfaces/marketing-landing.scss +1260 -0
- package/src/styles/surfaces/marketing-publication.scss +535 -0
- package/src/styles/surfaces/marketing-theme.scss +14 -0
- package/src/styles/surfaces/swagger-ui.scss +921 -0
- package/src/styles/tokens-export.scss +18 -0
- package/src/styles/tokens.scss +5 -0
- package/src/styles/viking-ui-bundle.scss +20 -2
- package/src/styles/viking-ui.scss +213 -51
- package/src/tokens/series-presets.ts +15 -0
- package/src/tokens/tailwind.preset.js +209 -0
- package/src/tokens/viking-tokens.json +318 -0
- package/src/viking-ui.spec.ts +416 -0
- package/src/web/badge/viking-badge-wc.ts +116 -0
- package/src/web/button/viking-button-wc.ts +165 -0
- package/src/web/callout/viking-callout-wc.ts +105 -0
- package/src/web/card/viking-card-wc.ts +66 -0
- package/src/web/core/base.ts +56 -0
- package/src/web/core/dom.ts +53 -0
- package/src/web/core/icons-inline.ts +44 -0
- package/src/web/core/styles.ts +1138 -0
- package/src/web/core/types.ts +19 -0
- package/src/web/field/viking-field-wc.ts +154 -0
- package/src/web/index.ts +73 -0
- package/src/web/input/viking-input-wc.ts +211 -0
- package/src/web/modal/viking-modal-wc.ts +187 -0
- package/src/web/search-palette/viking-search-palette-wc.ts +494 -0
- package/src/web/select/viking-select-wc.ts +218 -0
- package/src/web/suite-header/viking-suite-header-wc.ts +714 -0
- package/src/web/suite-search-palette/viking-suite-search-palette-wc.ts +234 -0
- package/src/web/theme-toggle/viking-theme-toggle-wc.ts +139 -0
- package/src/web/types.ts +37 -0
- package/src/web/web-components.spec.ts +297 -0
- package/src/web-components/index.ts +1 -0
- package/fesm2022/dataengineeringformachinelearning-viking-ui.mjs +0 -6114
- package/fesm2022/dataengineeringformachinelearning-viking-ui.mjs.map +0 -1
- package/types/dataengineeringformachinelearning-viking-ui.d.ts +0 -1397
- package/viking.manifest.json +0 -238
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChangeDetectionStrategy,
|
|
3
|
+
Component,
|
|
4
|
+
ElementRef,
|
|
5
|
+
contentChildren,
|
|
6
|
+
signal,
|
|
7
|
+
viewChild,
|
|
8
|
+
} from "@angular/core";
|
|
9
|
+
import { VikingIcon } from "../icon/icon";
|
|
10
|
+
|
|
11
|
+
/** A single slide inside viking-carousel. */
|
|
12
|
+
@Component({
|
|
13
|
+
selector: "viking-carousel-slide",
|
|
14
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
15
|
+
host: { role: "group", "aria-roledescription": "slide" },
|
|
16
|
+
template: `<ng-content />`,
|
|
17
|
+
styles: [
|
|
18
|
+
`
|
|
19
|
+
:host {
|
|
20
|
+
flex: 0 0 100%;
|
|
21
|
+
scroll-snap-align: start;
|
|
22
|
+
display: block;
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
}
|
|
25
|
+
`,
|
|
26
|
+
],
|
|
27
|
+
})
|
|
28
|
+
export class VikingCarouselSlide {}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* viking-carousel — scroll-snap slideshow.
|
|
32
|
+
*/
|
|
33
|
+
@Component({
|
|
34
|
+
selector: "viking-carousel",
|
|
35
|
+
imports: [VikingIcon],
|
|
36
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
37
|
+
host: { "aria-roledescription": "carousel" },
|
|
38
|
+
template: `
|
|
39
|
+
<div
|
|
40
|
+
class="viking-carousel-viewport"
|
|
41
|
+
#viewport
|
|
42
|
+
tabindex="0"
|
|
43
|
+
role="group"
|
|
44
|
+
aria-label="Carousel slides"
|
|
45
|
+
(scroll)="onScroll()"
|
|
46
|
+
>
|
|
47
|
+
<ng-content />
|
|
48
|
+
</div>
|
|
49
|
+
<div class="viking-carousel-controls">
|
|
50
|
+
<button
|
|
51
|
+
type="button"
|
|
52
|
+
class="viking-carousel-nav"
|
|
53
|
+
aria-label="Previous slide"
|
|
54
|
+
[disabled]="index() <= 0"
|
|
55
|
+
(click)="goTo(index() - 1)"
|
|
56
|
+
>
|
|
57
|
+
<viking-icon name="chevron-left" [size]="18" />
|
|
58
|
+
</button>
|
|
59
|
+
<div class="viking-carousel-dots">
|
|
60
|
+
@for (slide of slides(); track $index) {
|
|
61
|
+
<button
|
|
62
|
+
type="button"
|
|
63
|
+
class="viking-carousel-dot"
|
|
64
|
+
[class.viking-active]="$index === index()"
|
|
65
|
+
[attr.aria-label]="'Go to slide ' + ($index + 1)"
|
|
66
|
+
[attr.aria-current]="$index === index()"
|
|
67
|
+
(click)="goTo($index)"
|
|
68
|
+
></button>
|
|
69
|
+
}
|
|
70
|
+
</div>
|
|
71
|
+
<button
|
|
72
|
+
type="button"
|
|
73
|
+
class="viking-carousel-nav"
|
|
74
|
+
aria-label="Next slide"
|
|
75
|
+
[disabled]="index() >= slides().length - 1"
|
|
76
|
+
(click)="goTo(index() + 1)"
|
|
77
|
+
>
|
|
78
|
+
<viking-icon name="chevron-right" [size]="18" />
|
|
79
|
+
</button>
|
|
80
|
+
</div>
|
|
81
|
+
`,
|
|
82
|
+
styles: [
|
|
83
|
+
`
|
|
84
|
+
:host {
|
|
85
|
+
display: block;
|
|
86
|
+
}
|
|
87
|
+
.viking-carousel-viewport {
|
|
88
|
+
display: flex;
|
|
89
|
+
overflow-x: auto;
|
|
90
|
+
scroll-snap-type: x mandatory;
|
|
91
|
+
scroll-behavior: smooth;
|
|
92
|
+
border-radius: var(--viking-radius);
|
|
93
|
+
border: 1px solid var(--viking-border);
|
|
94
|
+
background: var(--viking-surface);
|
|
95
|
+
scrollbar-width: none;
|
|
96
|
+
}
|
|
97
|
+
.viking-carousel-viewport::-webkit-scrollbar {
|
|
98
|
+
display: none;
|
|
99
|
+
}
|
|
100
|
+
.viking-carousel-viewport:focus-visible {
|
|
101
|
+
outline: var(--viking-ring-width) solid var(--viking-ring);
|
|
102
|
+
outline-offset: var(--viking-ring-offset);
|
|
103
|
+
}
|
|
104
|
+
.viking-carousel-controls {
|
|
105
|
+
display: flex;
|
|
106
|
+
align-items: center;
|
|
107
|
+
justify-content: center;
|
|
108
|
+
gap: var(--viking-space-2);
|
|
109
|
+
margin-top: var(--viking-space-1);
|
|
110
|
+
}
|
|
111
|
+
.viking-carousel-nav {
|
|
112
|
+
display: inline-flex;
|
|
113
|
+
align-items: center;
|
|
114
|
+
justify-content: center;
|
|
115
|
+
min-width: var(--viking-touch-target-comfort);
|
|
116
|
+
min-height: var(--viking-touch-target-comfort);
|
|
117
|
+
border: 1px solid var(--viking-border-strong);
|
|
118
|
+
background: var(--viking-surface);
|
|
119
|
+
color: var(--viking-text);
|
|
120
|
+
border-radius: var(--viking-radius-pill);
|
|
121
|
+
padding: var(--viking-space-1);
|
|
122
|
+
cursor: pointer;
|
|
123
|
+
transition: var(--viking-transition-interactive);
|
|
124
|
+
-webkit-tap-highlight-color: transparent;
|
|
125
|
+
}
|
|
126
|
+
.viking-carousel-nav:hover:not(:disabled) {
|
|
127
|
+
border-color: var(--viking-accent-strong);
|
|
128
|
+
background: var(--viking-accent-soft);
|
|
129
|
+
box-shadow: var(--viking-shadow-sm);
|
|
130
|
+
transform: translateY(var(--viking-state-hover-lift));
|
|
131
|
+
}
|
|
132
|
+
.viking-carousel-nav:active:not(:disabled) {
|
|
133
|
+
transform: translateY(0) scale(var(--viking-state-active-scale));
|
|
134
|
+
}
|
|
135
|
+
.viking-carousel-nav:focus-visible {
|
|
136
|
+
outline: var(--viking-ring-width) solid var(--viking-ring);
|
|
137
|
+
outline-offset: var(--viking-ring-offset);
|
|
138
|
+
}
|
|
139
|
+
.viking-carousel-nav:disabled {
|
|
140
|
+
opacity: 0.45;
|
|
141
|
+
cursor: not-allowed;
|
|
142
|
+
}
|
|
143
|
+
.viking-carousel-dots {
|
|
144
|
+
display: flex;
|
|
145
|
+
gap: var(--viking-space-1);
|
|
146
|
+
}
|
|
147
|
+
.viking-carousel-dot {
|
|
148
|
+
position: relative;
|
|
149
|
+
width: var(--viking-space-1);
|
|
150
|
+
height: var(--viking-space-1);
|
|
151
|
+
border-radius: var(--viking-radius-pill);
|
|
152
|
+
border: 1px solid var(--viking-border-strong);
|
|
153
|
+
background: var(--viking-surface-alt);
|
|
154
|
+
cursor: pointer;
|
|
155
|
+
padding: 0;
|
|
156
|
+
transition: var(--viking-transition-interactive);
|
|
157
|
+
-webkit-tap-highlight-color: transparent;
|
|
158
|
+
}
|
|
159
|
+
.viking-carousel-dot::before {
|
|
160
|
+
content: "";
|
|
161
|
+
position: absolute;
|
|
162
|
+
inset: 50%;
|
|
163
|
+
width: var(--viking-touch-target-min);
|
|
164
|
+
height: var(--viking-touch-target-min);
|
|
165
|
+
transform: translate(-50%, -50%);
|
|
166
|
+
}
|
|
167
|
+
.viking-carousel-dot:hover:not(.viking-active) {
|
|
168
|
+
border-color: var(--viking-accent-strong);
|
|
169
|
+
background: var(--viking-accent-soft);
|
|
170
|
+
}
|
|
171
|
+
.viking-carousel-dot.viking-active {
|
|
172
|
+
background: var(--viking-accent);
|
|
173
|
+
border-color: var(--viking-accent);
|
|
174
|
+
box-shadow: 0 0 0 2px var(--viking-accent-soft);
|
|
175
|
+
}
|
|
176
|
+
.viking-carousel-dot:focus-visible {
|
|
177
|
+
outline: var(--viking-ring-width) solid var(--viking-ring);
|
|
178
|
+
outline-offset: var(--viking-ring-offset);
|
|
179
|
+
}
|
|
180
|
+
`,
|
|
181
|
+
],
|
|
182
|
+
})
|
|
183
|
+
export class VikingCarousel {
|
|
184
|
+
private readonly viewport =
|
|
185
|
+
viewChild.required<ElementRef<HTMLElement>>("viewport");
|
|
186
|
+
|
|
187
|
+
protected readonly slides = contentChildren(VikingCarouselSlide);
|
|
188
|
+
protected readonly index = signal(0);
|
|
189
|
+
|
|
190
|
+
protected goTo = (target: number): void => {
|
|
191
|
+
const clamped = Math.min(this.slides().length - 1, Math.max(0, target));
|
|
192
|
+
const element = this.viewport().nativeElement;
|
|
193
|
+
element.scrollTo({
|
|
194
|
+
left: clamped * element.clientWidth,
|
|
195
|
+
behavior: "smooth",
|
|
196
|
+
});
|
|
197
|
+
this.index.set(clamped);
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
protected onScroll = (): void => {
|
|
201
|
+
const element = this.viewport().nativeElement;
|
|
202
|
+
if (element.clientWidth > 0) {
|
|
203
|
+
this.index.set(Math.round(element.scrollLeft / element.clientWidth));
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import {
|
|
3
|
+
clampChartWindow,
|
|
4
|
+
fullChartWindow,
|
|
5
|
+
panChartWindow,
|
|
6
|
+
sliceChartData,
|
|
7
|
+
zoomChartWindow,
|
|
8
|
+
} from "./chart-zoom";
|
|
9
|
+
|
|
10
|
+
describe("chart-zoom", () => {
|
|
11
|
+
it("returns full window for positive counts", () => {
|
|
12
|
+
expect(fullChartWindow(10)).toEqual({ start: 0, end: 10 });
|
|
13
|
+
expect(fullChartWindow(0)).toEqual({ start: 0, end: 1 });
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("clamps window to valid bounds with minimum span", () => {
|
|
17
|
+
expect(clampChartWindow({ start: -5, end: 20 }, 10, 3)).toEqual({
|
|
18
|
+
start: 0,
|
|
19
|
+
end: 10,
|
|
20
|
+
});
|
|
21
|
+
expect(clampChartWindow({ start: 0, end: 1 }, 10, 3)).toEqual({
|
|
22
|
+
start: 0,
|
|
23
|
+
end: 3,
|
|
24
|
+
});
|
|
25
|
+
expect(clampChartWindow({ start: 0, end: 0 }, 0, 3)).toEqual({
|
|
26
|
+
start: 0,
|
|
27
|
+
end: 0,
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("zooms in on wheel up and out on wheel down", () => {
|
|
32
|
+
const current = { start: 0, end: 20 };
|
|
33
|
+
const zoomedIn = zoomChartWindow(current, 20, 0.5, -100, 3);
|
|
34
|
+
const zoomedOut = zoomChartWindow(current, 20, 0.5, 100, 3);
|
|
35
|
+
expect(zoomedIn.end - zoomedIn.start).toBeLessThan(20);
|
|
36
|
+
expect(zoomedOut.end - zoomedOut.start).toBeGreaterThanOrEqual(20);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("returns full window when count is at or below min span", () => {
|
|
40
|
+
expect(zoomChartWindow({ start: 0, end: 3 }, 3, 0.5, -100, 3)).toEqual({
|
|
41
|
+
start: 0,
|
|
42
|
+
end: 3,
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it("pans window by delta points", () => {
|
|
47
|
+
expect(panChartWindow({ start: 5, end: 15 }, 20, 3, 3)).toEqual({
|
|
48
|
+
start: 2,
|
|
49
|
+
end: 12,
|
|
50
|
+
});
|
|
51
|
+
expect(panChartWindow({ start: 0, end: 10 }, 20, -5, 3)).toEqual({
|
|
52
|
+
start: 5,
|
|
53
|
+
end: 15,
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("slices data for the active window", () => {
|
|
58
|
+
const values = ["a", "b", "c", "d", "e"];
|
|
59
|
+
expect(sliceChartData(values, { start: 1, end: 4 })).toEqual([
|
|
60
|
+
"b",
|
|
61
|
+
"c",
|
|
62
|
+
"d",
|
|
63
|
+
]);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/** Visible index window for chart zoom/pan (inclusive start, exclusive end). */
|
|
2
|
+
export interface ChartZoomWindow {
|
|
3
|
+
start: number;
|
|
4
|
+
end: number;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const fullChartWindow = (count: number): ChartZoomWindow => ({
|
|
8
|
+
start: 0,
|
|
9
|
+
end: Math.max(count, 1),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
/** Clamp zoom window to valid bounds with a minimum visible span. */
|
|
13
|
+
export const clampChartWindow = (
|
|
14
|
+
window: ChartZoomWindow,
|
|
15
|
+
count: number,
|
|
16
|
+
minSpan = 3,
|
|
17
|
+
): ChartZoomWindow => {
|
|
18
|
+
if (count <= 0) {
|
|
19
|
+
return { start: 0, end: 0 };
|
|
20
|
+
}
|
|
21
|
+
const span = Math.max(minSpan, Math.min(count, window.end - window.start));
|
|
22
|
+
let start = Math.max(0, Math.min(window.start, count - span));
|
|
23
|
+
let end = start + span;
|
|
24
|
+
if (end > count) {
|
|
25
|
+
end = count;
|
|
26
|
+
start = Math.max(0, end - span);
|
|
27
|
+
}
|
|
28
|
+
return { start, end };
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** Wheel delta → narrower/wider window centered on cursor fraction (0–1). */
|
|
32
|
+
export const zoomChartWindow = (
|
|
33
|
+
current: ChartZoomWindow,
|
|
34
|
+
count: number,
|
|
35
|
+
cursorFraction: number,
|
|
36
|
+
deltaY: number,
|
|
37
|
+
minSpan = 3,
|
|
38
|
+
): ChartZoomWindow => {
|
|
39
|
+
if (count <= minSpan) {
|
|
40
|
+
return fullChartWindow(count);
|
|
41
|
+
}
|
|
42
|
+
const span = current.end - current.start;
|
|
43
|
+
const factor = deltaY < 0 ? 0.85 : 1.15;
|
|
44
|
+
const nextSpan = Math.max(
|
|
45
|
+
minSpan,
|
|
46
|
+
Math.min(count, Math.round(span * factor)),
|
|
47
|
+
);
|
|
48
|
+
const anchor = current.start + span * cursorFraction;
|
|
49
|
+
const raw: ChartZoomWindow = {
|
|
50
|
+
start: Math.round(anchor - nextSpan * cursorFraction),
|
|
51
|
+
end: Math.round(anchor - nextSpan * cursorFraction) + nextSpan,
|
|
52
|
+
};
|
|
53
|
+
return clampChartWindow(raw, count, minSpan);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/** Drag delta in data points → pan window. */
|
|
57
|
+
export const panChartWindow = (
|
|
58
|
+
current: ChartZoomWindow,
|
|
59
|
+
count: number,
|
|
60
|
+
deltaPoints: number,
|
|
61
|
+
minSpan = 3,
|
|
62
|
+
): ChartZoomWindow =>
|
|
63
|
+
clampChartWindow(
|
|
64
|
+
{ start: current.start - deltaPoints, end: current.end - deltaPoints },
|
|
65
|
+
count,
|
|
66
|
+
minSpan,
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
/** Slice series rows and category labels for the active window. */
|
|
70
|
+
export const sliceChartData = <T>(values: T[], window: ChartZoomWindow): T[] =>
|
|
71
|
+
values.slice(window.start, window.end);
|