@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.
Files changed (246) hide show
  1. package/README.md +35 -11
  2. package/dist/README.md +35 -11
  3. package/dist/design-tokens.css +300 -85
  4. package/dist/fesm2022/dataengineeringformachinelearning-viking-ui.mjs +100 -64
  5. package/dist/fesm2022/dataengineeringformachinelearning-viking-ui.mjs.map +1 -1
  6. package/dist/icons.js +306 -0
  7. package/dist/package.json +24 -5
  8. package/{src/lib/site-drakkar/site-drakkar.config.ts → dist/site-drakkar.js} +64 -130
  9. package/dist/src/tokens/viking-tokens.json +9 -7
  10. package/dist/types/dataengineeringformachinelearning-viking-ui.d.ts +97 -3
  11. package/dist/viking-components.css +161 -70
  12. package/dist/viking-tokens.json +9 -7
  13. package/dist/viking-ui-elements.js +44 -32
  14. package/dist/viking-ui.css +1 -1
  15. package/dist/web-components.js +44 -32
  16. package/package.json +30 -8
  17. package/dist/scripts/build-web-components.mjs +0 -37
  18. package/dist/src/web/badge/viking-badge-wc.ts +0 -116
  19. package/dist/src/web/button/viking-button-wc.ts +0 -165
  20. package/dist/src/web/callout/viking-callout-wc.ts +0 -105
  21. package/dist/src/web/card/viking-card-wc.ts +0 -67
  22. package/dist/src/web/core/base.ts +0 -56
  23. package/dist/src/web/core/dom.ts +0 -53
  24. package/dist/src/web/core/icons-inline.ts +0 -44
  25. package/dist/src/web/core/styles.ts +0 -1261
  26. package/dist/src/web/core/types.ts +0 -19
  27. package/dist/src/web/field/viking-field-wc.ts +0 -154
  28. package/dist/src/web/index.ts +0 -73
  29. package/dist/src/web/input/viking-input-wc.ts +0 -211
  30. package/dist/src/web/modal/viking-modal-wc.ts +0 -187
  31. package/dist/src/web/search-palette/viking-search-palette-wc.ts +0 -495
  32. package/dist/src/web/select/viking-select-wc.ts +0 -218
  33. package/dist/src/web/suite-header/viking-suite-header-wc.ts +0 -729
  34. package/dist/src/web/suite-search-palette/viking-suite-search-palette-wc.ts +0 -234
  35. package/dist/src/web/theme-toggle/viking-theme-toggle-wc.ts +0 -139
  36. package/dist/src/web/types.ts +0 -37
  37. package/dist/src/web/web-components.spec.ts +0 -297
  38. package/src/assets/drakkar-favicon.svg +0 -17
  39. package/src/assets/fonts/inter/InterVariable-Italic.woff2 +0 -0
  40. package/src/assets/fonts/inter/InterVariable.woff2 +0 -0
  41. package/src/core/brand/deml-lockup.svg +0 -5
  42. package/src/core/brand/deml-mark-compact.svg +0 -4
  43. package/src/core/brand/deml-mark-filled.svg +0 -3
  44. package/src/core/brand/deml-mark-outline.svg +0 -4
  45. package/src/core/brand-icons.ts +0 -62
  46. package/src/core/icons.spec.ts +0 -52
  47. package/src/core/icons.ts +0 -206
  48. package/src/core/integration-brand-icons.ts +0 -77
  49. package/src/core/lucide-paths.generated.ts +0 -130
  50. package/src/core/types.ts +0 -85
  51. package/src/core/uid.ts +0 -7
  52. package/src/elements/button/viking-button.ts +0 -201
  53. package/src/elements/card/viking-card.ts +0 -60
  54. package/src/elements/core/dom.ts +0 -33
  55. package/src/elements/core/styles.ts +0 -28
  56. package/src/elements/modal/viking-modal.ts +0 -154
  57. package/src/index.ts +0 -1
  58. package/src/lib/accordion/accordion.ts +0 -126
  59. package/src/lib/app-header/app-header.scss +0 -274
  60. package/src/lib/app-header/app-header.ts +0 -43
  61. package/src/lib/app-sidebar/app-sidebar.scss +0 -415
  62. package/src/lib/app-sidebar/app-sidebar.ts +0 -29
  63. package/src/lib/auth-panel/auth-panel.spec.ts +0 -132
  64. package/src/lib/auth-panel/auth-panel.ts +0 -228
  65. package/src/lib/autocomplete/autocomplete.ts +0 -223
  66. package/src/lib/avatar/avatar.ts +0 -126
  67. package/src/lib/badge/badge.ts +0 -182
  68. package/src/lib/bar/bar.ts +0 -31
  69. package/src/lib/brand/brand.ts +0 -60
  70. package/src/lib/breadcrumbs/breadcrumbs.ts +0 -81
  71. package/src/lib/button/button-group.ts +0 -40
  72. package/src/lib/button/button.scss +0 -119
  73. package/src/lib/button/button.ts +0 -98
  74. package/src/lib/calendar/calendar.ts +0 -253
  75. package/src/lib/callout/callout.ts +0 -211
  76. package/src/lib/card/card-title.spec.ts +0 -27
  77. package/src/lib/card/card-title.ts +0 -50
  78. package/src/lib/card/card.ts +0 -200
  79. package/src/lib/carousel/carousel.ts +0 -206
  80. package/src/lib/chart/chart-zoom.spec.ts +0 -65
  81. package/src/lib/chart/chart-zoom.ts +0 -71
  82. package/src/lib/chart/chart.ts +0 -1257
  83. package/src/lib/chart-card-header/chart-card-header.ts +0 -80
  84. package/src/lib/chart-empty-state/chart-empty-state.ts +0 -146
  85. package/src/lib/chart-panel/chart-panel.ts +0 -133
  86. package/src/lib/checkbox/checkbox.ts +0 -139
  87. package/src/lib/color-picker/color-picker.ts +0 -148
  88. package/src/lib/command/command.ts +0 -260
  89. package/src/lib/composer/composer.ts +0 -180
  90. package/src/lib/confirm-dialog/confirm-dialog.ts +0 -163
  91. package/src/lib/confirm-dialog/dialog.service.ts +0 -79
  92. package/src/lib/context/context.ts +0 -75
  93. package/src/lib/core/brand-icons.ts +0 -62
  94. package/src/lib/core/cva.ts +0 -33
  95. package/src/lib/core/icons.ts +0 -206
  96. package/src/lib/core/integration-brand-icons.ts +0 -77
  97. package/src/lib/core/lucide-paths.generated.ts +0 -130
  98. package/src/lib/date-picker/date-picker.ts +0 -139
  99. package/src/lib/dropdown/dropdown.ts +0 -188
  100. package/src/lib/editor/editor.ts +0 -170
  101. package/src/lib/empty-state/empty-state.ts +0 -100
  102. package/src/lib/fab/fab.ts +0 -76
  103. package/src/lib/field/field.ts +0 -111
  104. package/src/lib/file-upload/file-upload.ts +0 -208
  105. package/src/lib/footer/footer.scss +0 -162
  106. package/src/lib/footer/footer.ts +0 -28
  107. package/src/lib/form-section/form-section.ts +0 -200
  108. package/src/lib/forms.spec.ts +0 -92
  109. package/src/lib/gauge-arc/gauge-arc.ts +0 -85
  110. package/src/lib/hud-panel/hud-panel.ts +0 -27
  111. package/src/lib/icon/icon.ts +0 -284
  112. package/src/lib/icon-badge/icon-badge.ts +0 -87
  113. package/src/lib/icon-heading/icon-heading.spec.ts +0 -32
  114. package/src/lib/icon-heading/icon-heading.ts +0 -38
  115. package/src/lib/icon-text/icon-text.ts +0 -120
  116. package/src/lib/input/input.ts +0 -119
  117. package/src/lib/kanban/kanban.ts +0 -211
  118. package/src/lib/kbd/kbd.ts +0 -32
  119. package/src/lib/label/label.ts +0 -39
  120. package/src/lib/loading-overlay/loading-overlay.ts +0 -80
  121. package/src/lib/menubar/menubar.ts +0 -77
  122. package/src/lib/metric-card/metric-card.ts +0 -33
  123. package/src/lib/modal/modal.ts +0 -207
  124. package/src/lib/native-select/native-select.ts +0 -124
  125. package/src/lib/navbar/navbar.ts +0 -124
  126. package/src/lib/navigation-menu/navigation-menu.ts +0 -116
  127. package/src/lib/otp-input/otp-input.ts +0 -164
  128. package/src/lib/page-back-link/page-back-link.ts +0 -74
  129. package/src/lib/page-header/page-header.ts +0 -70
  130. package/src/lib/pagination/pagination.ts +0 -157
  131. package/src/lib/pillbox/pillbox.ts +0 -157
  132. package/src/lib/popover/popover.ts +0 -92
  133. package/src/lib/profile/profile.ts +0 -73
  134. package/src/lib/progress/progress.ts +0 -123
  135. package/src/lib/radio/radio.ts +0 -132
  136. package/src/lib/ring-gauge/ring-gauge.ts +0 -75
  137. package/src/lib/scroll-area/scroll-area.ts +0 -57
  138. package/src/lib/search-palette/search-palette.scss +0 -288
  139. package/src/lib/search-palette/search-palette.ts +0 -114
  140. package/src/lib/select/select.ts +0 -292
  141. package/src/lib/separator/separator.ts +0 -59
  142. package/src/lib/sheet/sheet.ts +0 -192
  143. package/src/lib/sidebar-nav/sidebar-nav.scss +0 -218
  144. package/src/lib/sidebar-nav/sidebar-nav.ts +0 -158
  145. package/src/lib/site-drakkar/site-footer.ts +0 -133
  146. package/src/lib/site-drakkar/site-navbar.scss +0 -2
  147. package/src/lib/site-drakkar/site-navbar.ts +0 -286
  148. package/src/lib/site-drakkar/suite-search-items.spec.ts +0 -61
  149. package/src/lib/site-drakkar/suite-search-items.ts +0 -246
  150. package/src/lib/skeleton/skeleton.ts +0 -51
  151. package/src/lib/slider/slider.ts +0 -133
  152. package/src/lib/spinner/spinner.ts +0 -75
  153. package/src/lib/status-metric-row/status-metric-row.ts +0 -74
  154. package/src/lib/suite-search-palette/suite-search-palette.ts +0 -95
  155. package/src/lib/switch/switch.ts +0 -131
  156. package/src/lib/table/table.ts +0 -137
  157. package/src/lib/tabs/tab-panel.ts +0 -61
  158. package/src/lib/tabs/tab.ts +0 -107
  159. package/src/lib/tabs/tabs.ts +0 -109
  160. package/src/lib/textarea/textarea.ts +0 -103
  161. package/src/lib/theme-toggle/theme-toggle.spec.ts +0 -40
  162. package/src/lib/theme-toggle/theme-toggle.ts +0 -40
  163. package/src/lib/time-picker/time-picker.ts +0 -197
  164. package/src/lib/timeline/timeline.ts +0 -152
  165. package/src/lib/toast/toast.ts +0 -196
  166. package/src/lib/toggle/toggle-group.ts +0 -60
  167. package/src/lib/toggle/toggle.ts +0 -101
  168. package/src/lib/tooltip/tooltip.ts +0 -119
  169. package/src/lib/typography/heading.ts +0 -52
  170. package/src/lib/typography/text.ts +0 -51
  171. package/src/lib/uptime-bar/uptime-bar.ts +0 -55
  172. package/src/lib/verification-code-field/verification-code-field.ts +0 -149
  173. package/src/lib/whitepaper-cta/whitepaper-cta.scss +0 -130
  174. package/src/lib/whitepaper-cta/whitepaper-cta.ts +0 -78
  175. package/src/lib/wizard/wizard.ts +0 -80
  176. package/src/public-api.ts +0 -172
  177. package/src/styles/_buttons.scss +0 -386
  178. package/src/styles/_component-primitives.scss +0 -183
  179. package/src/styles/_drakkar-buttons.scss +0 -85
  180. package/src/styles/_fonts.scss +0 -22
  181. package/src/styles/_forms.scss +0 -66
  182. package/src/styles/_input.scss +0 -106
  183. package/src/styles/_layout-enforcement.scss +0 -229
  184. package/src/styles/_layout-rhythm.scss +0 -158
  185. package/src/styles/_legacy-aliases.scss +0 -212
  186. package/src/styles/_series-colors.scss +0 -24
  187. package/src/styles/_static-primitives.scss +0 -857
  188. package/src/styles/_typography.scss +0 -87
  189. package/src/styles/_variables.scss +0 -527
  190. package/src/styles/components/a11y.scss +0 -90
  191. package/src/styles/components/badges.scss +0 -102
  192. package/src/styles/components/extracted-utilities.scss +0 -459
  193. package/src/styles/components/footer.scss +0 -168
  194. package/src/styles/components/icon-heading.scss +0 -47
  195. package/src/styles/components/icon-inline.scss +0 -101
  196. package/src/styles/components/layout.scss +0 -59
  197. package/src/styles/components/utilities.scss +0 -131
  198. package/src/styles/components/viking-inspired.scss +0 -204
  199. package/src/styles/components/whitepaper-cta.scss +0 -130
  200. package/src/styles/components-bundle.scss +0 -9
  201. package/src/styles/components.scss +0 -442
  202. package/src/styles/deml-components.scss +0 -10
  203. package/src/styles/index.scss +0 -8
  204. package/src/styles/layout-shell.scss +0 -111
  205. package/src/styles/page-shell.scss +0 -859
  206. package/src/styles/static-navbar.scss +0 -1250
  207. package/src/styles/surfaces/backend.scss +0 -154
  208. package/src/styles/surfaces/docs-global.scss +0 -73
  209. package/src/styles/surfaces/docs-shell.scss +0 -437
  210. package/src/styles/surfaces/docs-showcase.scss +0 -1153
  211. package/src/styles/surfaces/marketing-cta.scss +0 -62
  212. package/src/styles/surfaces/marketing-docs-bento.scss +0 -67
  213. package/src/styles/surfaces/marketing-global.scss +0 -748
  214. package/src/styles/surfaces/marketing-landing.scss +0 -1526
  215. package/src/styles/surfaces/marketing-publication.scss +0 -535
  216. package/src/styles/surfaces/marketing-theme.scss +0 -14
  217. package/src/styles/surfaces/swagger-ui.scss +0 -1013
  218. package/src/styles/tokens-export.scss +0 -18
  219. package/src/styles/tokens.scss +0 -5
  220. package/src/styles/viking-ui-bundle.scss +0 -23
  221. package/src/styles/viking-ui.scss +0 -272
  222. package/src/tokens/series-presets.ts +0 -15
  223. package/src/tokens/tailwind.preset.js +0 -209
  224. package/src/tokens/viking-tokens.json +0 -318
  225. package/src/viking-ui.spec.ts +0 -416
  226. package/src/web/badge/viking-badge-wc.ts +0 -116
  227. package/src/web/button/viking-button-wc.ts +0 -165
  228. package/src/web/callout/viking-callout-wc.ts +0 -105
  229. package/src/web/card/viking-card-wc.ts +0 -67
  230. package/src/web/core/base.ts +0 -56
  231. package/src/web/core/dom.ts +0 -53
  232. package/src/web/core/icons-inline.ts +0 -44
  233. package/src/web/core/styles.ts +0 -1261
  234. package/src/web/core/types.ts +0 -19
  235. package/src/web/field/viking-field-wc.ts +0 -154
  236. package/src/web/index.ts +0 -73
  237. package/src/web/input/viking-input-wc.ts +0 -211
  238. package/src/web/modal/viking-modal-wc.ts +0 -187
  239. package/src/web/search-palette/viking-search-palette-wc.ts +0 -495
  240. package/src/web/select/viking-select-wc.ts +0 -218
  241. package/src/web/suite-header/viking-suite-header-wc.ts +0 -729
  242. package/src/web/suite-search-palette/viking-suite-search-palette-wc.ts +0 -234
  243. package/src/web/theme-toggle/viking-theme-toggle-wc.ts +0 -139
  244. package/src/web/types.ts +0 -37
  245. package/src/web/web-components.spec.ts +0 -297
  246. package/src/web-components/index.ts +0 -1
@@ -1,164 +0,0 @@
1
- import {
2
- ChangeDetectionStrategy,
3
- Component,
4
- ElementRef,
5
- computed,
6
- input,
7
- model,
8
- output,
9
- } from "@angular/core";
10
- import { VikingControl, provideVikingCva } from "../core/cva";
11
-
12
- /**
13
- * viking-otp-input — one-time-passcode input.
14
- * Auto-advances between cells and supports paste. ControlValueAccessor-compatible.
15
- */
16
- @Component({
17
- selector: "viking-otp-input",
18
- providers: [provideVikingCva(VikingOtpInput)],
19
- changeDetection: ChangeDetectionStrategy.OnPush,
20
- host: {
21
- "[class.viking-otp-centered]": "centered()",
22
- },
23
- template: `
24
- <div
25
- class="viking-otp"
26
- role="group"
27
- [attr.aria-label]="label() || 'One-time passcode'"
28
- >
29
- @for (index of indexes(); track index) {
30
- <input
31
- class="viking-otp-cell"
32
- type="text"
33
- inputmode="numeric"
34
- autocomplete="one-time-code"
35
- maxlength="1"
36
- [value]="value().charAt(index) || ''"
37
- [disabled]="disabled() || formDisabled()"
38
- [attr.aria-label]="'Digit ' + (index + 1)"
39
- (input)="onCellInput($event, index)"
40
- (keydown)="onKeydown($event, index)"
41
- (paste)="onPaste($event)"
42
- (blur)="onTouched()"
43
- />
44
- }
45
- </div>
46
- `,
47
- styles: [
48
- `
49
- .viking-otp {
50
- display: flex;
51
- gap: var(--viking-space-1);
52
- }
53
- :host(.viking-otp-centered) .viking-otp {
54
- justify-content: center;
55
- width: 100%;
56
- gap: var(--viking-space-2);
57
- }
58
- .viking-otp-cell {
59
- width: var(--viking-control-height);
60
- height: var(--viking-control-height);
61
- text-align: center;
62
- font-family: var(--viking-font-family);
63
- font-size: var(--viking-font-size-lg);
64
- font-weight: var(--viking-font-weight-semibold);
65
- color: var(--viking-text);
66
- background: var(--viking-surface-alt);
67
- border: 1px solid var(--viking-border);
68
- border-radius: var(--viking-radius-sm);
69
- box-shadow: var(--viking-shadow-xs);
70
- transition: var(--viking-transition-interactive);
71
- font-variant-numeric: tabular-nums;
72
- }
73
- .viking-otp-cell:hover:not(:disabled) {
74
- border-color: color-mix(
75
- in srgb,
76
- var(--viking-accent) 35%,
77
- var(--viking-border-strong)
78
- );
79
- box-shadow: var(--viking-shadow-sm);
80
- }
81
- .viking-otp-cell:focus-visible {
82
- outline: var(--viking-ring-width) solid var(--viking-ring);
83
- outline-offset: var(--viking-ring-offset);
84
- border-color: var(--viking-accent);
85
- }
86
- .viking-otp-cell:disabled {
87
- opacity: var(--viking-state-disabled-opacity);
88
- }
89
- `,
90
- ],
91
- })
92
- export class VikingOtpInput extends VikingControl<string> {
93
- readonly length = input<number>(6);
94
- readonly value = model<string>("");
95
- readonly label = input<string>("");
96
- readonly disabled = input<boolean>(false);
97
- readonly centered = input<boolean>(false);
98
-
99
- readonly completed = output<string>();
100
-
101
- constructor(private readonly host: ElementRef<HTMLElement>) {
102
- super();
103
- }
104
-
105
- protected readonly indexes = computed(() =>
106
- Array.from({ length: this.length() }, (_, index) => index),
107
- );
108
-
109
- writeValue(value: string): void {
110
- this.value.set(value ?? "");
111
- }
112
-
113
- private commit(next: string): void {
114
- this.value.set(next);
115
- this.onChange(next);
116
- if (next.length === this.length()) {
117
- this.completed.emit(next);
118
- }
119
- }
120
-
121
- private focusCell(index: number): void {
122
- const cells =
123
- this.host.nativeElement.querySelectorAll<HTMLInputElement>(
124
- ".viking-otp-cell",
125
- );
126
- cells[Math.min(this.length() - 1, Math.max(0, index))]?.focus();
127
- }
128
-
129
- protected onCellInput = (event: Event, index: number): void => {
130
- const char = (event.target as HTMLInputElement).value
131
- .replace(/\D/g, "")
132
- .slice(-1);
133
- const chars = this.value().padEnd(this.length(), " ").split("");
134
- chars[index] = char || " ";
135
- this.commit(chars.join("").trimEnd().replace(/ /g, ""));
136
- if (char) {
137
- this.focusCell(index + 1);
138
- }
139
- };
140
-
141
- protected onKeydown = (event: KeyboardEvent, index: number): void => {
142
- if (
143
- event.key === "Backspace" &&
144
- !(event.target as HTMLInputElement).value
145
- ) {
146
- this.focusCell(index - 1);
147
- } else if (event.key === "ArrowLeft") {
148
- this.focusCell(index - 1);
149
- } else if (event.key === "ArrowRight") {
150
- this.focusCell(index + 1);
151
- }
152
- };
153
-
154
- protected onPaste = (event: ClipboardEvent): void => {
155
- event.preventDefault();
156
- const digits = (event.clipboardData?.getData("text") ?? "")
157
- .replace(/\D/g, "")
158
- .slice(0, this.length());
159
- if (digits) {
160
- this.commit(digits);
161
- this.focusCell(digits.length - 1);
162
- }
163
- };
164
- }
@@ -1,74 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, input } from "@angular/core";
2
- import { Params, RouterLink } from "@angular/router";
3
- import { VikingIcon } from "../icon/icon";
4
-
5
- /**
6
- * viking-page-back-link — consistent dashboard back navigation with fixed spacing
7
- * below the control so page titles never sit flush against the link.
8
- */
9
- @Component({
10
- selector: "viking-page-back-link",
11
- imports: [RouterLink, VikingIcon],
12
- changeDetection: ChangeDetectionStrategy.OnPush,
13
- host: {
14
- class: "viking-page-back-link-host",
15
- },
16
- template: `
17
- <nav
18
- class="viking-page-back-nav page-back-nav"
19
- [attr.aria-label]="navLabel()"
20
- >
21
- <a
22
- class="viking-page-back-link back-link"
23
- [routerLink]="route()"
24
- [queryParams]="queryParams()"
25
- [attr.aria-label]="label()"
26
- >
27
- <viking-icon name="arrow-left" [size]="18" color="accent" />
28
- <span>{{ label() }}</span>
29
- </a>
30
- </nav>
31
- `,
32
- styles: [
33
- `
34
- :host {
35
- display: block;
36
- width: 100%;
37
- }
38
-
39
- .viking-page-back-nav {
40
- margin: 0;
41
- padding: 0;
42
- }
43
-
44
- .viking-page-back-link {
45
- display: inline-flex;
46
- align-items: center;
47
- gap: var(--viking-space-1);
48
- padding: var(--viking-space-half) 0;
49
- font-family: var(--viking-font-family);
50
- font-size: var(--viking-font-size-sm);
51
- font-weight: var(--viking-font-weight-semibold);
52
- color: var(--viking-accent-strong);
53
- text-decoration: none;
54
- border-radius: var(--viking-radius-xs);
55
- transition: var(--viking-transition-interactive);
56
- }
57
-
58
- .viking-page-back-link:hover {
59
- color: var(--viking-accent);
60
- }
61
-
62
- .viking-page-back-link:focus-visible {
63
- outline: var(--viking-ring-width) solid var(--viking-ring);
64
- outline-offset: var(--viking-ring-offset);
65
- }
66
- `,
67
- ],
68
- })
69
- export class VikingPageBackLink {
70
- readonly route = input<string | readonly string[]>("/dashboard");
71
- readonly queryParams = input<Params | null>(null);
72
- readonly label = input<string>("Back to Dashboard");
73
- readonly navLabel = input<string>("Return to dashboard");
74
- }
@@ -1,70 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, input } from "@angular/core";
2
- import { Params } from "@angular/router";
3
- import { VikingPageBackLink } from "../page-back-link/page-back-link";
4
-
5
- /**
6
- * viking-page-header — unified HUD page title block (tag, title, subtitle) with
7
- * optional back navigation and action slots.
8
- */
9
- @Component({
10
- selector: "viking-page-header",
11
- imports: [VikingPageBackLink],
12
- changeDetection: ChangeDetectionStrategy.OnPush,
13
- host: {
14
- "[class.viking-page-header-sidebar]": "layout() === 'sidebar'",
15
- },
16
- template: `
17
- <header
18
- class="viking-page-header"
19
- [class.dashboard-topbar]="layout() === 'sidebar'"
20
- [class.hud-header]="layout() === 'hud'"
21
- >
22
- <div class="viking-page-header-main title-group topbar-left">
23
- @if (backTo()) {
24
- <viking-page-back-link
25
- [route]="backTo()!"
26
- [queryParams]="backQueryParams()"
27
- [label]="backLabel()"
28
- [navLabel]="backNavLabel()"
29
- />
30
- } @else {
31
- <ng-content select="[vikingPageHeaderBack]" />
32
- }
33
-
34
- <div class="viking-page-header-title-block">
35
- @if (tag()) {
36
- <div class="section-tag-row">
37
- <span class="section-tag viking-page-header-tag">{{
38
- tag()
39
- }}</span>
40
- </div>
41
- }
42
- <h1 class="viking-page-header-title hud-title page-title">
43
- {{ title() }}
44
- </h1>
45
- @if (subtitle()) {
46
- <p
47
- class="viking-page-header-subtitle hud-subtitle page-description"
48
- >
49
- {{ subtitle() }}
50
- </p>
51
- }
52
- <ng-content select="[vikingPageHeaderExtra]" />
53
- </div>
54
- </div>
55
- <div class="viking-page-header-actions topbar-right">
56
- <ng-content select="[vikingPageHeaderActions]" />
57
- </div>
58
- </header>
59
- `,
60
- })
61
- export class VikingPageHeader {
62
- readonly tag = input<string>("");
63
- readonly title = input.required<string>();
64
- readonly subtitle = input<string>("");
65
- readonly layout = input<"hud" | "sidebar">("hud");
66
- readonly backTo = input<string | readonly string[] | null>(null);
67
- readonly backQueryParams = input<Params | null>(null);
68
- readonly backLabel = input<string>("Back to Dashboard");
69
- readonly backNavLabel = input<string>("Return to dashboard");
70
- }
@@ -1,157 +0,0 @@
1
- import {
2
- ChangeDetectionStrategy,
3
- Component,
4
- computed,
5
- input,
6
- model,
7
- } from "@angular/core";
8
- import { VikingIcon } from "../icon/icon";
9
-
10
- /**
11
- * viking-pagination — page navigation.
12
- */
13
- @Component({
14
- selector: "viking-pagination",
15
- imports: [VikingIcon],
16
- changeDetection: ChangeDetectionStrategy.OnPush,
17
- template: `
18
- <nav class="viking-pagination" aria-label="Pagination">
19
- <button
20
- type="button"
21
- class="viking-page-btn"
22
- aria-label="Previous page"
23
- [disabled]="page() <= 1"
24
- (click)="goTo(page() - 1)"
25
- >
26
- <viking-icon name="chevron-left" [size]="18" />
27
- </button>
28
- @for (item of pageItems(); track $index) {
29
- @if (item === null) {
30
- <span class="viking-page-ellipsis" aria-hidden="true">…</span>
31
- } @else {
32
- <button
33
- type="button"
34
- class="viking-page-btn"
35
- [class.viking-page-current]="item === page()"
36
- [attr.aria-current]="item === page() ? 'page' : null"
37
- [attr.aria-label]="'Page ' + item"
38
- (click)="goTo(item)"
39
- >
40
- {{ item }}
41
- </button>
42
- }
43
- }
44
- <button
45
- type="button"
46
- class="viking-page-btn"
47
- aria-label="Next page"
48
- [disabled]="page() >= totalPages()"
49
- (click)="goTo(page() + 1)"
50
- >
51
- <viking-icon name="chevron-right" [size]="18" />
52
- </button>
53
- </nav>
54
- `,
55
- styles: [
56
- `
57
- .viking-pagination {
58
- display: flex;
59
- align-items: center;
60
- gap: calc(var(--viking-space-1) / 2);
61
- flex-wrap: wrap;
62
- }
63
- .viking-page-btn {
64
- display: inline-flex;
65
- align-items: center;
66
- justify-content: center;
67
- min-width: var(--viking-control-height-sm);
68
- height: var(--viking-control-height-sm);
69
- padding: 0 var(--viking-space-1);
70
- border: 1px solid var(--viking-border-subtle);
71
- border-radius: var(--viking-radius);
72
- background: var(--viking-surface);
73
- color: var(--viking-text);
74
- font-family: var(--viking-font-family);
75
- font-size: var(--viking-font-size-sm);
76
- font-weight: var(--viking-font-weight-medium);
77
- cursor: pointer;
78
- transition: var(--viking-transition-interactive);
79
- font-variant-numeric: tabular-nums;
80
- box-shadow: var(--viking-shadow-xs);
81
- }
82
- .viking-page-btn:hover:not(:disabled):not(.viking-page-current) {
83
- background: var(--viking-accent-soft);
84
- border-color: var(--viking-accent-strong);
85
- transform: translateY(var(--viking-state-hover-lift));
86
- }
87
- .viking-page-btn:active:not(:disabled):not(.viking-page-current) {
88
- transform: translateY(0) scale(var(--viking-state-active-scale));
89
- }
90
- .viking-page-btn:focus-visible {
91
- outline: var(--viking-ring-width) solid var(--viking-ring);
92
- outline-offset: var(--viking-ring-offset);
93
- }
94
- .viking-page-btn:disabled {
95
- opacity: var(--viking-state-disabled-opacity);
96
- cursor: not-allowed;
97
- }
98
- .viking-page-current {
99
- background: var(--viking-accent);
100
- border-color: color-mix(
101
- in srgb,
102
- var(--viking-accent) 80%,
103
- var(--viking-black)
104
- );
105
- color: var(--viking-accent-content);
106
- font-size: var(--viking-font-size-sm);
107
- font-weight: var(--viking-font-weight-bold);
108
- box-shadow: var(--viking-shadow-sm);
109
- }
110
- .viking-page-ellipsis {
111
- color: var(--viking-text-muted);
112
- padding: 0 var(--viking-space-1);
113
- font-size: var(--viking-font-size);
114
- }
115
- `,
116
- ],
117
- })
118
- export class VikingPagination {
119
- readonly page = model<number>(1);
120
- readonly totalPages = input.required<number>();
121
-
122
- /** Windowed page list with null entries marking ellipses. */
123
- protected readonly pageItems = computed<(number | null)[]>(() => {
124
- const total = this.totalPages();
125
- const current = this.page();
126
- if (total <= 7) {
127
- return Array.from({ length: total }, (_, index) => index + 1);
128
- }
129
- const pages = new Set<number>([
130
- 1,
131
- 2,
132
- total - 1,
133
- total,
134
- current - 1,
135
- current,
136
- current + 1,
137
- ]);
138
- const sorted = [...pages]
139
- .filter((value) => value >= 1 && value <= total)
140
- .sort((a, b) => a - b);
141
- const items: (number | null)[] = [];
142
- let previous = 0;
143
- for (const value of sorted) {
144
- if (value - previous > 1) {
145
- items.push(null);
146
- }
147
- items.push(value);
148
- previous = value;
149
- }
150
- return items;
151
- });
152
-
153
- protected goTo = (target: number): void => {
154
- const clamped = Math.min(this.totalPages(), Math.max(1, target));
155
- this.page.set(clamped);
156
- };
157
- }
@@ -1,157 +0,0 @@
1
- import {
2
- ChangeDetectionStrategy,
3
- Component,
4
- input,
5
- model,
6
- signal,
7
- } from "@angular/core";
8
- import { VikingControl, provideVikingCva } from "../core/cva";
9
- import { VikingIcon } from "../icon/icon";
10
-
11
- /**
12
- * viking-pillbox — multi-value tag input.
13
- * Type and press Enter (or comma) to add pills. ControlValueAccessor-compatible.
14
- */
15
- @Component({
16
- selector: "viking-pillbox",
17
- imports: [VikingIcon],
18
- providers: [provideVikingCva(VikingPillbox)],
19
- changeDetection: ChangeDetectionStrategy.OnPush,
20
- template: `
21
- <div
22
- class="viking-control viking-pillbox"
23
- [class.viking-disabled]="disabled() || formDisabled()"
24
- role="group"
25
- [attr.aria-label]="label() || 'Tags'"
26
- >
27
- @for (pill of values(); track pill) {
28
- <span class="viking-pill">
29
- {{ pill }}
30
- <button
31
- type="button"
32
- class="viking-pill-remove"
33
- [attr.aria-label]="'Remove ' + pill"
34
- [disabled]="disabled() || formDisabled()"
35
- (click)="remove(pill)"
36
- >
37
- <viking-icon name="x" [size]="13" />
38
- </button>
39
- </span>
40
- }
41
- <input
42
- type="text"
43
- [placeholder]="values().length === 0 ? placeholder() : ''"
44
- [value]="draft()"
45
- [disabled]="disabled() || formDisabled()"
46
- [attr.aria-label]="label() || placeholder() || 'Add tag'"
47
- (input)="draft.set($any($event.target).value)"
48
- (keydown)="onKeydown($event)"
49
- (blur)="onTouched()"
50
- />
51
- </div>
52
- `,
53
- styles: [
54
- `
55
- .viking-pillbox {
56
- display: flex;
57
- align-items: center;
58
- flex-wrap: wrap;
59
- gap: calc(var(--viking-space-1) / 1.5);
60
- min-height: var(--viking-control-height);
61
- padding: calc(var(--viking-space-1) / 1.5) var(--viking-space-1);
62
- background: var(--viking-surface);
63
- border: 1px solid var(--viking-border-strong);
64
- border-radius: var(--viking-radius);
65
- box-shadow: var(--viking-shadow-sm);
66
- transition: var(--viking-transition);
67
- cursor: text;
68
- }
69
- .viking-pillbox:focus-within {
70
- outline: var(--viking-ring-width) solid var(--viking-ring);
71
- outline-offset: var(--viking-ring-offset);
72
- }
73
- .viking-disabled {
74
- opacity: var(--viking-state-disabled-opacity);
75
- }
76
- .viking-pill {
77
- display: inline-flex;
78
- align-items: center;
79
- gap: 5px;
80
- font-family: var(--viking-font-family);
81
- font-size: var(--viking-font-size);
82
- font-weight: 500;
83
- color: var(--viking-text);
84
- background: var(--viking-accent-soft);
85
- border: 1px solid var(--viking-accent-strong);
86
- border-radius: var(--viking-radius-pill);
87
- padding: 2px var(--viking-space-1);
88
- line-height: 1.35;
89
- }
90
- .viking-pill-remove {
91
- display: inline-flex;
92
- border: none;
93
- background: transparent;
94
- color: var(--viking-text-muted);
95
- cursor: pointer;
96
- padding: 2px;
97
- border-radius: var(--viking-radius-pill);
98
- }
99
- .viking-pill-remove:hover {
100
- color: var(--viking-danger);
101
- }
102
- .viking-pill-remove:focus-visible {
103
- outline: var(--viking-ring-width) solid var(--viking-ring);
104
- outline-offset: 1px;
105
- }
106
- input {
107
- flex: 1;
108
- min-width: 108px;
109
- border: none;
110
- outline: none;
111
- background: transparent;
112
- color: var(--viking-text);
113
- font-family: var(--viking-font-family);
114
- font-size: var(--viking-font-size);
115
- padding: calc(var(--viking-space-1) / 2);
116
- }
117
- input::placeholder {
118
- color: var(--viking-text-muted);
119
- }
120
- `,
121
- ],
122
- })
123
- export class VikingPillbox extends VikingControl<string[]> {
124
- readonly values = model<string[]>([]);
125
- readonly placeholder = input<string>("Add a tag…");
126
- readonly label = input<string>("");
127
- readonly disabled = input<boolean>(false);
128
-
129
- protected readonly draft = signal("");
130
-
131
- writeValue(value: string[]): void {
132
- this.values.set(value ?? []);
133
- }
134
-
135
- protected onKeydown = (event: KeyboardEvent): void => {
136
- if (event.key === "Enter" || event.key === ",") {
137
- event.preventDefault();
138
- const next = this.draft().trim().replace(/,$/, "");
139
- if (next && !this.values().includes(next)) {
140
- this.values.update((list) => [...list, next]);
141
- this.onChange(this.values());
142
- }
143
- this.draft.set("");
144
- } else if (
145
- event.key === "Backspace" &&
146
- !this.draft() &&
147
- this.values().length > 0
148
- ) {
149
- this.remove(this.values()[this.values().length - 1]);
150
- }
151
- };
152
-
153
- protected remove = (pill: string): void => {
154
- this.values.update((list) => list.filter((item) => item !== pill));
155
- this.onChange(this.values());
156
- };
157
- }