@dataengineeringformachinelearning/viking-ui 4.0.4 → 4.0.6
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/README.md +35 -11
- package/dist/README.md +35 -11
- package/dist/design-tokens.css +300 -85
- package/dist/fesm2022/dataengineeringformachinelearning-viking-ui.mjs +100 -64
- package/dist/fesm2022/dataengineeringformachinelearning-viking-ui.mjs.map +1 -1
- package/dist/icons.js +306 -0
- package/dist/package.json +24 -5
- package/{src/lib/site-drakkar/site-drakkar.config.ts → dist/site-drakkar.js} +64 -130
- package/dist/src/tokens/viking-tokens.json +9 -7
- package/dist/types/dataengineeringformachinelearning-viking-ui.d.ts +97 -3
- package/dist/viking-components.css +161 -70
- package/dist/viking-tokens.json +9 -7
- package/dist/viking-ui-elements.js +44 -32
- package/dist/viking-ui.css +1 -1
- package/dist/web-components.js +44 -32
- package/package.json +30 -8
- package/dist/scripts/build-web-components.mjs +0 -37
- package/dist/src/web/badge/viking-badge-wc.ts +0 -116
- package/dist/src/web/button/viking-button-wc.ts +0 -165
- package/dist/src/web/callout/viking-callout-wc.ts +0 -105
- package/dist/src/web/card/viking-card-wc.ts +0 -67
- package/dist/src/web/core/base.ts +0 -56
- package/dist/src/web/core/dom.ts +0 -53
- package/dist/src/web/core/icons-inline.ts +0 -44
- package/dist/src/web/core/styles.ts +0 -1261
- package/dist/src/web/core/types.ts +0 -19
- package/dist/src/web/field/viking-field-wc.ts +0 -154
- package/dist/src/web/index.ts +0 -73
- package/dist/src/web/input/viking-input-wc.ts +0 -211
- package/dist/src/web/modal/viking-modal-wc.ts +0 -187
- package/dist/src/web/search-palette/viking-search-palette-wc.ts +0 -495
- package/dist/src/web/select/viking-select-wc.ts +0 -218
- package/dist/src/web/suite-header/viking-suite-header-wc.ts +0 -729
- package/dist/src/web/suite-search-palette/viking-suite-search-palette-wc.ts +0 -234
- package/dist/src/web/theme-toggle/viking-theme-toggle-wc.ts +0 -139
- package/dist/src/web/types.ts +0 -37
- package/dist/src/web/web-components.spec.ts +0 -297
- package/src/assets/drakkar-favicon.svg +0 -17
- 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 +0 -5
- package/src/core/brand/deml-mark-compact.svg +0 -4
- package/src/core/brand/deml-mark-filled.svg +0 -3
- package/src/core/brand/deml-mark-outline.svg +0 -4
- package/src/core/brand-icons.ts +0 -62
- package/src/core/icons.spec.ts +0 -52
- package/src/core/icons.ts +0 -206
- package/src/core/integration-brand-icons.ts +0 -77
- package/src/core/lucide-paths.generated.ts +0 -130
- package/src/core/types.ts +0 -85
- package/src/core/uid.ts +0 -7
- package/src/elements/button/viking-button.ts +0 -201
- package/src/elements/card/viking-card.ts +0 -60
- package/src/elements/core/dom.ts +0 -33
- package/src/elements/core/styles.ts +0 -28
- package/src/elements/modal/viking-modal.ts +0 -154
- package/src/index.ts +0 -1
- package/src/lib/accordion/accordion.ts +0 -126
- package/src/lib/app-header/app-header.scss +0 -274
- package/src/lib/app-header/app-header.ts +0 -43
- package/src/lib/app-sidebar/app-sidebar.scss +0 -415
- package/src/lib/app-sidebar/app-sidebar.ts +0 -29
- package/src/lib/auth-panel/auth-panel.spec.ts +0 -132
- package/src/lib/auth-panel/auth-panel.ts +0 -228
- package/src/lib/autocomplete/autocomplete.ts +0 -223
- package/src/lib/avatar/avatar.ts +0 -126
- package/src/lib/badge/badge.ts +0 -182
- package/src/lib/bar/bar.ts +0 -31
- package/src/lib/brand/brand.ts +0 -60
- package/src/lib/breadcrumbs/breadcrumbs.ts +0 -81
- package/src/lib/button/button-group.ts +0 -40
- package/src/lib/button/button.scss +0 -119
- package/src/lib/button/button.ts +0 -98
- package/src/lib/calendar/calendar.ts +0 -253
- package/src/lib/callout/callout.ts +0 -211
- package/src/lib/card/card-title.spec.ts +0 -27
- package/src/lib/card/card-title.ts +0 -50
- package/src/lib/card/card.ts +0 -200
- package/src/lib/carousel/carousel.ts +0 -206
- package/src/lib/chart/chart-zoom.spec.ts +0 -65
- package/src/lib/chart/chart-zoom.ts +0 -71
- package/src/lib/chart/chart.ts +0 -1257
- package/src/lib/chart-card-header/chart-card-header.ts +0 -80
- package/src/lib/chart-empty-state/chart-empty-state.ts +0 -146
- package/src/lib/chart-panel/chart-panel.ts +0 -133
- package/src/lib/checkbox/checkbox.ts +0 -139
- package/src/lib/color-picker/color-picker.ts +0 -148
- package/src/lib/command/command.ts +0 -260
- package/src/lib/composer/composer.ts +0 -180
- package/src/lib/confirm-dialog/confirm-dialog.ts +0 -163
- package/src/lib/confirm-dialog/dialog.service.ts +0 -79
- package/src/lib/context/context.ts +0 -75
- package/src/lib/core/brand-icons.ts +0 -62
- package/src/lib/core/cva.ts +0 -33
- package/src/lib/core/icons.ts +0 -206
- package/src/lib/core/integration-brand-icons.ts +0 -77
- package/src/lib/core/lucide-paths.generated.ts +0 -130
- package/src/lib/date-picker/date-picker.ts +0 -139
- package/src/lib/dropdown/dropdown.ts +0 -188
- package/src/lib/editor/editor.ts +0 -170
- package/src/lib/empty-state/empty-state.ts +0 -100
- package/src/lib/fab/fab.ts +0 -76
- package/src/lib/field/field.ts +0 -111
- package/src/lib/file-upload/file-upload.ts +0 -208
- package/src/lib/footer/footer.scss +0 -162
- package/src/lib/footer/footer.ts +0 -28
- package/src/lib/form-section/form-section.ts +0 -200
- package/src/lib/forms.spec.ts +0 -92
- package/src/lib/gauge-arc/gauge-arc.ts +0 -85
- package/src/lib/hud-panel/hud-panel.ts +0 -27
- package/src/lib/icon/icon.ts +0 -284
- package/src/lib/icon-badge/icon-badge.ts +0 -87
- package/src/lib/icon-heading/icon-heading.spec.ts +0 -32
- package/src/lib/icon-heading/icon-heading.ts +0 -38
- package/src/lib/icon-text/icon-text.ts +0 -120
- package/src/lib/input/input.ts +0 -119
- package/src/lib/kanban/kanban.ts +0 -211
- package/src/lib/kbd/kbd.ts +0 -32
- package/src/lib/label/label.ts +0 -39
- package/src/lib/loading-overlay/loading-overlay.ts +0 -80
- package/src/lib/menubar/menubar.ts +0 -77
- package/src/lib/metric-card/metric-card.ts +0 -33
- package/src/lib/modal/modal.ts +0 -207
- package/src/lib/native-select/native-select.ts +0 -124
- package/src/lib/navbar/navbar.ts +0 -124
- package/src/lib/navigation-menu/navigation-menu.ts +0 -116
- package/src/lib/otp-input/otp-input.ts +0 -164
- package/src/lib/page-back-link/page-back-link.ts +0 -74
- package/src/lib/page-header/page-header.ts +0 -70
- package/src/lib/pagination/pagination.ts +0 -157
- package/src/lib/pillbox/pillbox.ts +0 -157
- package/src/lib/popover/popover.ts +0 -92
- package/src/lib/profile/profile.ts +0 -73
- package/src/lib/progress/progress.ts +0 -123
- package/src/lib/radio/radio.ts +0 -132
- package/src/lib/ring-gauge/ring-gauge.ts +0 -75
- package/src/lib/scroll-area/scroll-area.ts +0 -57
- package/src/lib/search-palette/search-palette.scss +0 -288
- package/src/lib/search-palette/search-palette.ts +0 -114
- package/src/lib/select/select.ts +0 -292
- package/src/lib/separator/separator.ts +0 -59
- package/src/lib/sheet/sheet.ts +0 -192
- package/src/lib/sidebar-nav/sidebar-nav.scss +0 -218
- package/src/lib/sidebar-nav/sidebar-nav.ts +0 -158
- package/src/lib/site-drakkar/site-footer.ts +0 -133
- package/src/lib/site-drakkar/site-navbar.scss +0 -2
- package/src/lib/site-drakkar/site-navbar.ts +0 -286
- package/src/lib/site-drakkar/suite-search-items.spec.ts +0 -61
- package/src/lib/site-drakkar/suite-search-items.ts +0 -246
- package/src/lib/skeleton/skeleton.ts +0 -51
- package/src/lib/slider/slider.ts +0 -133
- package/src/lib/spinner/spinner.ts +0 -75
- package/src/lib/status-metric-row/status-metric-row.ts +0 -74
- package/src/lib/suite-search-palette/suite-search-palette.ts +0 -95
- package/src/lib/switch/switch.ts +0 -131
- package/src/lib/table/table.ts +0 -137
- package/src/lib/tabs/tab-panel.ts +0 -61
- package/src/lib/tabs/tab.ts +0 -107
- package/src/lib/tabs/tabs.ts +0 -109
- package/src/lib/textarea/textarea.ts +0 -103
- package/src/lib/theme-toggle/theme-toggle.spec.ts +0 -40
- package/src/lib/theme-toggle/theme-toggle.ts +0 -40
- package/src/lib/time-picker/time-picker.ts +0 -197
- package/src/lib/timeline/timeline.ts +0 -152
- package/src/lib/toast/toast.ts +0 -196
- package/src/lib/toggle/toggle-group.ts +0 -60
- package/src/lib/toggle/toggle.ts +0 -101
- package/src/lib/tooltip/tooltip.ts +0 -119
- package/src/lib/typography/heading.ts +0 -52
- package/src/lib/typography/text.ts +0 -51
- package/src/lib/uptime-bar/uptime-bar.ts +0 -55
- package/src/lib/verification-code-field/verification-code-field.ts +0 -149
- package/src/lib/whitepaper-cta/whitepaper-cta.scss +0 -130
- package/src/lib/whitepaper-cta/whitepaper-cta.ts +0 -78
- package/src/lib/wizard/wizard.ts +0 -80
- package/src/public-api.ts +0 -172
- package/src/styles/_buttons.scss +0 -386
- package/src/styles/_component-primitives.scss +0 -183
- package/src/styles/_drakkar-buttons.scss +0 -85
- package/src/styles/_fonts.scss +0 -22
- package/src/styles/_forms.scss +0 -66
- package/src/styles/_input.scss +0 -106
- package/src/styles/_layout-enforcement.scss +0 -229
- package/src/styles/_layout-rhythm.scss +0 -158
- package/src/styles/_legacy-aliases.scss +0 -212
- package/src/styles/_series-colors.scss +0 -24
- package/src/styles/_static-primitives.scss +0 -857
- package/src/styles/_typography.scss +0 -87
- package/src/styles/_variables.scss +0 -527
- package/src/styles/components/a11y.scss +0 -90
- package/src/styles/components/badges.scss +0 -102
- package/src/styles/components/extracted-utilities.scss +0 -459
- package/src/styles/components/footer.scss +0 -168
- package/src/styles/components/icon-heading.scss +0 -47
- package/src/styles/components/icon-inline.scss +0 -101
- package/src/styles/components/layout.scss +0 -59
- package/src/styles/components/utilities.scss +0 -131
- package/src/styles/components/viking-inspired.scss +0 -204
- package/src/styles/components/whitepaper-cta.scss +0 -130
- package/src/styles/components-bundle.scss +0 -9
- package/src/styles/components.scss +0 -442
- package/src/styles/deml-components.scss +0 -10
- package/src/styles/index.scss +0 -8
- package/src/styles/layout-shell.scss +0 -111
- package/src/styles/page-shell.scss +0 -859
- package/src/styles/static-navbar.scss +0 -1250
- package/src/styles/surfaces/backend.scss +0 -154
- package/src/styles/surfaces/docs-global.scss +0 -73
- package/src/styles/surfaces/docs-shell.scss +0 -437
- package/src/styles/surfaces/docs-showcase.scss +0 -1153
- package/src/styles/surfaces/marketing-cta.scss +0 -62
- package/src/styles/surfaces/marketing-docs-bento.scss +0 -67
- package/src/styles/surfaces/marketing-global.scss +0 -748
- package/src/styles/surfaces/marketing-landing.scss +0 -1526
- package/src/styles/surfaces/marketing-publication.scss +0 -535
- package/src/styles/surfaces/marketing-theme.scss +0 -14
- package/src/styles/surfaces/swagger-ui.scss +0 -1013
- package/src/styles/tokens-export.scss +0 -18
- package/src/styles/tokens.scss +0 -5
- package/src/styles/viking-ui-bundle.scss +0 -23
- package/src/styles/viking-ui.scss +0 -272
- package/src/tokens/series-presets.ts +0 -15
- package/src/tokens/tailwind.preset.js +0 -209
- package/src/tokens/viking-tokens.json +0 -318
- package/src/viking-ui.spec.ts +0 -416
- package/src/web/badge/viking-badge-wc.ts +0 -116
- package/src/web/button/viking-button-wc.ts +0 -165
- package/src/web/callout/viking-callout-wc.ts +0 -105
- package/src/web/card/viking-card-wc.ts +0 -67
- package/src/web/core/base.ts +0 -56
- package/src/web/core/dom.ts +0 -53
- package/src/web/core/icons-inline.ts +0 -44
- package/src/web/core/styles.ts +0 -1261
- package/src/web/core/types.ts +0 -19
- package/src/web/field/viking-field-wc.ts +0 -154
- package/src/web/index.ts +0 -73
- package/src/web/input/viking-input-wc.ts +0 -211
- package/src/web/modal/viking-modal-wc.ts +0 -187
- package/src/web/search-palette/viking-search-palette-wc.ts +0 -495
- package/src/web/select/viking-select-wc.ts +0 -218
- package/src/web/suite-header/viking-suite-header-wc.ts +0 -729
- package/src/web/suite-search-palette/viking-suite-search-palette-wc.ts +0 -234
- package/src/web/theme-toggle/viking-theme-toggle-wc.ts +0 -139
- package/src/web/types.ts +0 -37
- package/src/web/web-components.spec.ts +0 -297
- package/src/web-components/index.ts +0 -1
package/src/lib/card/card.ts
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectionStrategy,
|
|
3
|
-
Component,
|
|
4
|
-
ElementRef,
|
|
5
|
-
input,
|
|
6
|
-
} from "@angular/core";
|
|
7
|
-
import { VikingSkeleton } from "../skeleton/skeleton";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* viking-card — surface container.
|
|
11
|
-
* Compose with viking-card-header / viking-card-footer for structured layouts.
|
|
12
|
-
*/
|
|
13
|
-
@Component({
|
|
14
|
-
selector: "viking-card",
|
|
15
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
16
|
-
host: {
|
|
17
|
-
"[class.viking-card-interactive]": "interactive()",
|
|
18
|
-
"[class.viking-card-loading]": "loading()",
|
|
19
|
-
"[class.viking-card-compact]": "compact()",
|
|
20
|
-
"[attr.aria-busy]": "loading() ? 'true' : null",
|
|
21
|
-
"[attr.tabindex]": "interactive() ? 0 : null",
|
|
22
|
-
"[attr.role]": "interactive() ? 'button' : null",
|
|
23
|
-
"(keydown.enter)": "onActivate($event)",
|
|
24
|
-
"(keydown.space)": "onActivate($event)",
|
|
25
|
-
},
|
|
26
|
-
template: `
|
|
27
|
-
@if (loading()) {
|
|
28
|
-
<div class="viking-card-skeleton" aria-hidden="true">
|
|
29
|
-
<viking-skeleton height="var(--viking-font-size-lg)" width="45%" />
|
|
30
|
-
<viking-skeleton height="var(--viking-font-size-sm)" width="80%" />
|
|
31
|
-
<viking-skeleton height="var(--viking-font-size-sm)" width="65%" />
|
|
32
|
-
</div>
|
|
33
|
-
} @else {
|
|
34
|
-
<ng-content />
|
|
35
|
-
}
|
|
36
|
-
`,
|
|
37
|
-
imports: [VikingSkeleton],
|
|
38
|
-
styles: [
|
|
39
|
-
`
|
|
40
|
-
:host {
|
|
41
|
-
display: block;
|
|
42
|
-
background: var(--viking-surface-recipe, var(--viking-surface));
|
|
43
|
-
border: 1px solid var(--viking-border);
|
|
44
|
-
border-radius: var(--viking-radius-lg);
|
|
45
|
-
box-shadow:
|
|
46
|
-
var(--viking-shadow-sm),
|
|
47
|
-
inset 0 1px 0
|
|
48
|
-
color-mix(in srgb, var(--viking-white-pure) 6%, transparent);
|
|
49
|
-
padding: var(--viking-card-padding, var(--viking-space-3));
|
|
50
|
-
color: var(--viking-text);
|
|
51
|
-
transition: var(--viking-transition-interactive);
|
|
52
|
-
position: relative;
|
|
53
|
-
isolation: isolate;
|
|
54
|
-
overflow: hidden;
|
|
55
|
-
min-width: 0;
|
|
56
|
-
background-clip: padding-box;
|
|
57
|
-
}
|
|
58
|
-
:host(.viking-card-headerless) .viking-card-header,
|
|
59
|
-
:host(.viking-card-headerless) viking-card-header {
|
|
60
|
-
display: none;
|
|
61
|
-
}
|
|
62
|
-
:host::before {
|
|
63
|
-
content: "";
|
|
64
|
-
position: absolute;
|
|
65
|
-
inset: 0 0 auto;
|
|
66
|
-
height: 1px;
|
|
67
|
-
background: linear-gradient(
|
|
68
|
-
90deg,
|
|
69
|
-
transparent,
|
|
70
|
-
color-mix(
|
|
71
|
-
in srgb,
|
|
72
|
-
var(--viking-metallic-200)
|
|
73
|
-
var(--viking-surface-hairline-strength, 22%),
|
|
74
|
-
transparent
|
|
75
|
-
),
|
|
76
|
-
transparent
|
|
77
|
-
);
|
|
78
|
-
pointer-events: none;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
:host::after {
|
|
82
|
-
content: "";
|
|
83
|
-
position: absolute;
|
|
84
|
-
inset: 0 auto auto 0;
|
|
85
|
-
right: 0;
|
|
86
|
-
width: 1px;
|
|
87
|
-
height: 28px;
|
|
88
|
-
background: linear-gradient(
|
|
89
|
-
180deg,
|
|
90
|
-
color-mix(in srgb, var(--viking-metallic-100) 22%, transparent),
|
|
91
|
-
transparent
|
|
92
|
-
);
|
|
93
|
-
pointer-events: none;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
:host(.viking-card-interactive) {
|
|
97
|
-
cursor: pointer;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
:host(.viking-card-interactive):focus-visible {
|
|
101
|
-
outline: var(--viking-ring-width) solid var(--viking-ring);
|
|
102
|
-
outline-offset: var(--viking-ring-offset);
|
|
103
|
-
}
|
|
104
|
-
:host(.viking-card-interactive):hover {
|
|
105
|
-
border-color: var(--viking-accent-strong);
|
|
106
|
-
box-shadow:
|
|
107
|
-
var(--viking-shadow-hover),
|
|
108
|
-
inset 0 1px 0
|
|
109
|
-
color-mix(in srgb, var(--viking-white-pure) 6%, transparent);
|
|
110
|
-
transform: translateY(var(--viking-state-hover-lift));
|
|
111
|
-
}
|
|
112
|
-
:host(.viking-card-interactive):active {
|
|
113
|
-
transform: translateY(0) scale(var(--viking-state-active-scale));
|
|
114
|
-
box-shadow:
|
|
115
|
-
inset 0 1px 2px
|
|
116
|
-
color-mix(in srgb, var(--viking-black) 24%, transparent),
|
|
117
|
-
var(--viking-shadow-sm);
|
|
118
|
-
}
|
|
119
|
-
:host(.viking-card-interactive):focus-visible {
|
|
120
|
-
outline: var(--viking-ring-width) solid var(--viking-ring);
|
|
121
|
-
outline-offset: var(--viking-ring-offset);
|
|
122
|
-
}
|
|
123
|
-
:host(.viking-card-loading) {
|
|
124
|
-
pointer-events: none;
|
|
125
|
-
}
|
|
126
|
-
:host(.viking-card-compact) {
|
|
127
|
-
padding: var(--viking-card-padding-compact, var(--viking-space-2));
|
|
128
|
-
}
|
|
129
|
-
.viking-card-skeleton {
|
|
130
|
-
display: flex;
|
|
131
|
-
flex-direction: column;
|
|
132
|
-
gap: var(--viking-space-1-5);
|
|
133
|
-
}
|
|
134
|
-
`,
|
|
135
|
-
],
|
|
136
|
-
})
|
|
137
|
-
export class VikingCard {
|
|
138
|
-
readonly interactive = input<boolean>(false);
|
|
139
|
-
readonly loading = input<boolean>(false);
|
|
140
|
-
readonly compact = input<boolean>(false);
|
|
141
|
-
|
|
142
|
-
constructor(private readonly host: ElementRef<HTMLElement>) {}
|
|
143
|
-
|
|
144
|
-
protected onActivate = (event: Event): void => {
|
|
145
|
-
if (!this.interactive() || this.loading()) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
event.preventDefault();
|
|
149
|
-
this.host.nativeElement.click();
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/** Header row for viking-card. */
|
|
154
|
-
@Component({
|
|
155
|
-
selector: "viking-card-header",
|
|
156
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
157
|
-
template: `<ng-content />`,
|
|
158
|
-
styles: [
|
|
159
|
-
`
|
|
160
|
-
:host {
|
|
161
|
-
display: flex;
|
|
162
|
-
align-items: center;
|
|
163
|
-
justify-content: space-between;
|
|
164
|
-
gap: var(--viking-space-2);
|
|
165
|
-
padding-bottom: var(--viking-space-2);
|
|
166
|
-
margin-bottom: var(--viking-space-2);
|
|
167
|
-
}
|
|
168
|
-
/* Support slotted left meta + right actions uniformly */
|
|
169
|
-
:host ::ng-deep > * {
|
|
170
|
-
display: inline-flex;
|
|
171
|
-
align-items: center;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
:host ::ng-deep viking-card-title {
|
|
175
|
-
flex: 1 1 auto;
|
|
176
|
-
min-width: 0;
|
|
177
|
-
}
|
|
178
|
-
`,
|
|
179
|
-
],
|
|
180
|
-
})
|
|
181
|
-
export class VikingCardHeader {}
|
|
182
|
-
|
|
183
|
-
/** Footer row for viking-card. */
|
|
184
|
-
@Component({
|
|
185
|
-
selector: "viking-card-footer",
|
|
186
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
187
|
-
template: `<ng-content />`,
|
|
188
|
-
styles: [
|
|
189
|
-
`
|
|
190
|
-
:host {
|
|
191
|
-
display: flex;
|
|
192
|
-
align-items: center;
|
|
193
|
-
gap: var(--viking-space-2);
|
|
194
|
-
padding-top: var(--viking-space-2);
|
|
195
|
-
margin-top: var(--viking-space-2);
|
|
196
|
-
}
|
|
197
|
-
`,
|
|
198
|
-
],
|
|
199
|
-
})
|
|
200
|
-
export class VikingCardFooter {}
|
|
@@ -1,206 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,71 +0,0 @@
|
|
|
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);
|