@dataengineeringformachinelearning/viking-ui 4.0.4 → 4.0.5

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,253 +0,0 @@
1
- import {
2
- ChangeDetectionStrategy,
3
- Component,
4
- computed,
5
- model,
6
- signal,
7
- } from "@angular/core";
8
- import { VikingControl, provideVikingCva } from "../core/cva";
9
- import { VikingIcon } from "../icon/icon";
10
-
11
- interface CalendarDay {
12
- iso: string;
13
- day: number;
14
- inMonth: boolean;
15
- isToday: boolean;
16
- }
17
-
18
- const MONTHS = [
19
- "January",
20
- "February",
21
- "March",
22
- "April",
23
- "May",
24
- "June",
25
- "July",
26
- "August",
27
- "September",
28
- "October",
29
- "November",
30
- "December",
31
- ];
32
-
33
- const WEEKDAYS = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
34
-
35
- const toIso = (date: Date): string =>
36
- `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
37
-
38
- /**
39
- * viking-calendar — month-grid date selection.
40
- * Value is an ISO date string (YYYY-MM-DD). ControlValueAccessor-compatible.
41
- */
42
- @Component({
43
- selector: "viking-calendar",
44
- imports: [VikingIcon],
45
- providers: [provideVikingCva(VikingCalendar)],
46
- changeDetection: ChangeDetectionStrategy.OnPush,
47
- template: `
48
- <div class="viking-calendar">
49
- <div class="viking-calendar-header">
50
- <button
51
- type="button"
52
- class="viking-calendar-nav"
53
- aria-label="Previous month"
54
- (click)="move(-1)"
55
- >
56
- <viking-icon name="chevron-left" [size]="18" />
57
- </button>
58
- <span class="viking-calendar-title" aria-live="polite">{{
59
- title()
60
- }}</span>
61
- <button
62
- type="button"
63
- class="viking-calendar-nav"
64
- aria-label="Next month"
65
- (click)="move(1)"
66
- >
67
- <viking-icon name="chevron-right" [size]="18" />
68
- </button>
69
- </div>
70
- <div
71
- class="viking-calendar-grid"
72
- role="group"
73
- [attr.aria-label]="title()"
74
- >
75
- @for (weekday of weekdays; track weekday) {
76
- <span class="viking-calendar-weekday" aria-hidden="true">{{
77
- weekday
78
- }}</span>
79
- }
80
- @for (day of days(); track day.iso) {
81
- <button
82
- type="button"
83
- class="viking-calendar-day"
84
- [class.viking-outside]="!day.inMonth"
85
- [class.viking-today]="day.isToday"
86
- [class.viking-selected]="day.iso === value()"
87
- [attr.aria-label]="day.iso"
88
- [attr.aria-pressed]="day.iso === value()"
89
- (click)="pick(day)"
90
- >
91
- {{ day.day }}
92
- </button>
93
- }
94
- </div>
95
- </div>
96
- `,
97
- styles: [
98
- `
99
- .viking-calendar {
100
- display: inline-block;
101
- padding: var(--viking-space-2);
102
- background: var(--viking-surface);
103
- border: 1px solid var(--viking-border);
104
- border-radius: var(--viking-radius);
105
- font-family: var(--viking-font-family);
106
- }
107
- .viking-calendar-header {
108
- display: flex;
109
- align-items: center;
110
- justify-content: space-between;
111
- gap: var(--viking-space-1);
112
- margin-bottom: var(--viking-space-1);
113
- }
114
- .viking-calendar-title {
115
- font-size: var(--viking-font-size);
116
- font-weight: 600;
117
- color: var(--viking-text);
118
- }
119
- .viking-calendar-nav {
120
- display: inline-flex;
121
- align-items: center;
122
- justify-content: center;
123
- min-width: var(--viking-touch-target-comfort);
124
- min-height: var(--viking-touch-target-comfort);
125
- border: 1px solid var(--viking-border);
126
- background: transparent;
127
- color: var(--viking-text-muted);
128
- border-radius: var(--viking-radius-sm);
129
- padding: var(--viking-space-half);
130
- cursor: pointer;
131
- transition: var(--viking-transition-interactive);
132
- -webkit-tap-highlight-color: transparent;
133
- }
134
- .viking-calendar-nav:hover {
135
- color: var(--viking-text);
136
- border-color: var(--viking-accent-strong);
137
- background: var(--viking-accent-soft);
138
- }
139
- .viking-calendar-nav:active {
140
- transform: scale(var(--viking-state-active-scale));
141
- }
142
- .viking-calendar-nav:focus-visible {
143
- outline: var(--viking-ring-width) solid var(--viking-ring);
144
- outline-offset: var(--viking-ring-offset);
145
- }
146
- .viking-calendar-grid {
147
- display: grid;
148
- grid-template-columns: repeat(7, 1fr);
149
- gap: var(--viking-space-half);
150
- }
151
- .viking-calendar-weekday {
152
- text-align: center;
153
- font-size: var(--viking-font-size);
154
- color: var(--viking-text-muted);
155
- padding: calc(var(--viking-space-1) / 2);
156
- }
157
- .viking-calendar-day {
158
- width: 100%;
159
- aspect-ratio: 1;
160
- min-width: var(--viking-control-height-sm);
161
- min-height: var(--viking-control-height-sm);
162
- display: inline-flex;
163
- align-items: center;
164
- justify-content: center;
165
- border: 1px solid transparent;
166
- background: transparent;
167
- color: var(--viking-text);
168
- border-radius: var(--viking-radius-sm);
169
- font-family: var(--viking-font-family);
170
- font-size: var(--viking-font-size-sm);
171
- cursor: pointer;
172
- transition: var(--viking-transition-interactive);
173
- font-variant-numeric: tabular-nums;
174
- -webkit-tap-highlight-color: transparent;
175
- }
176
- .viking-calendar-day:hover:not(.viking-selected) {
177
- background: var(--viking-accent-soft);
178
- }
179
- .viking-calendar-day:active:not(.viking-selected) {
180
- transform: scale(var(--viking-state-active-scale));
181
- }
182
- .viking-calendar-day:focus-visible {
183
- outline: var(--viking-ring-width) solid var(--viking-ring);
184
- outline-offset: var(--viking-ring-offset);
185
- }
186
- .viking-outside {
187
- color: var(--viking-text-muted);
188
- }
189
- .viking-today {
190
- border-color: var(--viking-accent-strong);
191
- }
192
- .viking-selected {
193
- background: var(--viking-accent);
194
- color: var(--viking-accent-content);
195
- font-weight: 600;
196
- }
197
- `,
198
- ],
199
- })
200
- export class VikingCalendar extends VikingControl<string | null> {
201
- readonly value = model<string | null>(null);
202
-
203
- protected readonly weekdays = WEEKDAYS;
204
- protected readonly viewDate = signal(new Date());
205
-
206
- protected readonly title = computed(() => {
207
- const view = this.viewDate();
208
- return `${MONTHS[view.getMonth()]} ${view.getFullYear()}`;
209
- });
210
-
211
- protected readonly days = computed<CalendarDay[]>(() => {
212
- const view = this.viewDate();
213
- const year = view.getFullYear();
214
- const month = view.getMonth();
215
- const firstOfMonth = new Date(year, month, 1);
216
- const start = new Date(year, month, 1 - firstOfMonth.getDay());
217
- const todayIso = toIso(new Date());
218
- return Array.from({ length: 42 }, (_, index) => {
219
- const date = new Date(
220
- start.getFullYear(),
221
- start.getMonth(),
222
- start.getDate() + index,
223
- );
224
- const iso = toIso(date);
225
- return {
226
- iso,
227
- day: date.getDate(),
228
- inMonth: date.getMonth() === month,
229
- isToday: iso === todayIso,
230
- };
231
- });
232
- });
233
-
234
- writeValue(value: string | null): void {
235
- this.value.set(value);
236
- if (value) {
237
- const [year, month] = value.split("-").map(Number);
238
- this.viewDate.set(new Date(year, month - 1, 1));
239
- }
240
- }
241
-
242
- protected move = (delta: number): void => {
243
- this.viewDate.update(
244
- (view) => new Date(view.getFullYear(), view.getMonth() + delta, 1),
245
- );
246
- };
247
-
248
- protected pick = (day: CalendarDay): void => {
249
- this.value.set(day.iso);
250
- this.onChange(day.iso);
251
- this.onTouched();
252
- };
253
- }
@@ -1,211 +0,0 @@
1
- import {
2
- ChangeDetectionStrategy,
3
- Component,
4
- computed,
5
- input,
6
- output,
7
- signal,
8
- } from "@angular/core";
9
- import { VikingIcon } from "../icon/icon";
10
- import { VikingIconName } from "../../core/icons";
11
- import { VikingTone } from "../../core/types";
12
-
13
- const TONE_ICONS: Record<string, VikingIconName> = {
14
- accent: "info",
15
- secondary: "info",
16
- success: "check-circle",
17
- warning: "alert-triangle",
18
- danger: "alert-circle",
19
- info: "info",
20
- muted: "info",
21
- };
22
-
23
- /**
24
- * viking-callout — highlighted message block.
25
- */
26
- @Component({
27
- selector: "viking-callout",
28
- imports: [VikingIcon],
29
- changeDetection: ChangeDetectionStrategy.OnPush,
30
- host: {
31
- role: "note",
32
- "[class]": "'viking-callout-' + tone()",
33
- "[style.display]": "dismissed() ? 'none' : null",
34
- },
35
- template: `
36
- <viking-icon
37
- class="viking-callout-icon"
38
- [name]="resolvedIcon()"
39
- [size]="22"
40
- />
41
- <div class="viking-callout-body">
42
- @if (heading()) {
43
- <p class="viking-callout-heading">{{ heading() }}</p>
44
- }
45
- <div class="viking-callout-text"><ng-content /></div>
46
- </div>
47
- @if (dismissible()) {
48
- <button
49
- type="button"
50
- class="viking-callout-close"
51
- aria-label="Dismiss"
52
- (click)="dismiss()"
53
- >
54
- <viking-icon name="x" [size]="18" />
55
- </button>
56
- }
57
- `,
58
- styles: [
59
- `
60
- :host {
61
- display: flex;
62
- align-items: flex-start;
63
- gap: var(--viking-space-2);
64
- padding: var(--viking-space-2);
65
- border-radius: var(--viking-radius-lg);
66
- border: 1px solid var(--viking-border);
67
- border-left-width: 3px;
68
- background: var(--viking-surface-alt);
69
- color: var(--viking-text);
70
- font-family: var(--viking-font-family);
71
- font-size: var(--viking-font-size-sm);
72
- box-shadow: var(--viking-shadow-sm);
73
- animation: viking-fade-in var(--viking-duration)
74
- var(--viking-ease-default);
75
- }
76
- .viking-callout-icon {
77
- margin-top: 2px;
78
- color: var(--viking-text-muted);
79
- }
80
- :host(.viking-callout-accent) {
81
- border-color: var(--viking-accent);
82
- border-left-color: var(--viking-accent);
83
- background: var(--viking-accent-soft);
84
- }
85
- :host(.viking-callout-accent) .viking-callout-icon {
86
- color: var(--viking-accent);
87
- }
88
- :host(.viking-callout-secondary) {
89
- border-color: color-mix(
90
- in srgb,
91
- var(--viking-accent-secondary) 45%,
92
- transparent
93
- );
94
- border-left-color: var(--viking-accent-secondary);
95
- background: var(--viking-accent-secondary-soft);
96
- }
97
- :host(.viking-callout-secondary) .viking-callout-icon {
98
- color: var(--viking-accent-secondary);
99
- }
100
- :host(.viking-callout-info) {
101
- border-color: color-mix(in srgb, var(--viking-info) 45%, transparent);
102
- border-left-color: var(--viking-info);
103
- background: color-mix(
104
- in srgb,
105
- var(--viking-info) 10%,
106
- var(--viking-surface)
107
- );
108
- }
109
- :host(.viking-callout-info) .viking-callout-icon {
110
- color: var(--viking-info);
111
- }
112
- :host(.viking-callout-success) {
113
- border-color: color-mix(
114
- in srgb,
115
- var(--viking-success) 45%,
116
- transparent
117
- );
118
- border-left-color: var(--viking-success);
119
- background: color-mix(
120
- in srgb,
121
- var(--viking-success) 10%,
122
- var(--viking-surface)
123
- );
124
- }
125
- :host(.viking-callout-success) .viking-callout-icon {
126
- color: var(--viking-success);
127
- }
128
- :host(.viking-callout-warning) {
129
- border-color: color-mix(
130
- in srgb,
131
- var(--viking-warning) 45%,
132
- transparent
133
- );
134
- border-left-color: var(--viking-warning);
135
- background: color-mix(
136
- in srgb,
137
- var(--viking-warning) 12%,
138
- var(--viking-surface)
139
- );
140
- }
141
- :host(.viking-callout-warning) .viking-callout-icon {
142
- color: var(--viking-warning);
143
- }
144
- :host(.viking-callout-danger) {
145
- border-color: var(--viking-danger);
146
- border-left-color: var(--viking-danger);
147
- background: color-mix(
148
- in srgb,
149
- var(--viking-crimson-600) 22%,
150
- var(--viking-surface)
151
- );
152
- color: var(--viking-white);
153
- }
154
- :host(.viking-callout-danger) .viking-callout-icon {
155
- color: var(--viking-crimson-400);
156
- }
157
- :host(.viking-callout-danger) .viking-callout-text {
158
- color: var(--viking-white);
159
- }
160
- .viking-callout-body {
161
- flex: 1;
162
- min-width: 0;
163
- }
164
- .viking-callout-heading {
165
- margin: 0 0 calc(var(--viking-space-1) / 2);
166
- font-size: var(--viking-font-size-ui);
167
- font-weight: 700;
168
- }
169
- .viking-callout-text {
170
- color: var(--viking-text);
171
- line-height: 1.55;
172
- }
173
- .viking-callout-close {
174
- border: none;
175
- background: transparent;
176
- color: var(--viking-text-muted);
177
- cursor: pointer;
178
- padding: var(--viking-space-half);
179
- border-radius: var(--viking-radius);
180
- display: inline-flex;
181
- transition: var(--viking-transition-interactive);
182
- }
183
- .viking-callout-close:hover {
184
- color: var(--viking-text);
185
- background: color-mix(in srgb, currentColor 8%, transparent);
186
- }
187
- .viking-callout-close:focus-visible {
188
- outline: var(--viking-ring-width) solid var(--viking-ring);
189
- outline-offset: 1px;
190
- }
191
- `,
192
- ],
193
- })
194
- export class VikingCallout {
195
- readonly tone = input<VikingTone>("accent");
196
- readonly heading = input<string>("");
197
- readonly icon = input<VikingIconName | null>(null);
198
- readonly dismissible = input<boolean>(false);
199
-
200
- readonly closed = output<void>();
201
-
202
- protected readonly dismissed = signal(false);
203
- protected readonly resolvedIcon = computed<VikingIconName>(
204
- () => this.icon() ?? TONE_ICONS[this.tone()] ?? "info",
205
- );
206
-
207
- protected dismiss = (): void => {
208
- this.dismissed.set(true);
209
- this.closed.emit();
210
- };
211
- }
@@ -1,27 +0,0 @@
1
- import { Component } from "@angular/core";
2
- import { TestBed } from "@angular/core/testing";
3
- import { VikingCardTitle } from "./card-title";
4
-
5
- @Component({
6
- imports: [VikingCardTitle],
7
- template: `<viking-card-title icon="shield">Security</viking-card-title>`,
8
- })
9
- class HostComponent {}
10
-
11
- describe("VikingCardTitle", () => {
12
- beforeEach(async () => {
13
- await TestBed.configureTestingModule({
14
- imports: [HostComponent],
15
- }).compileComponents();
16
- });
17
-
18
- it("renders icon badge and heading text", () => {
19
- const fixture = TestBed.createComponent(HostComponent);
20
- fixture.detectChanges();
21
- const host = fixture.nativeElement.querySelector(
22
- "viking-card-title",
23
- ) as HTMLElement;
24
- expect(host.querySelector("viking-icon-badge")).toBeTruthy();
25
- expect(host.textContent).toContain("Security");
26
- });
27
- });
@@ -1,50 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, input } from "@angular/core";
2
- import { VikingIconBadge, VikingIconBadgeTone } from "../icon-badge/icon-badge";
3
- import { VikingIconName } from "../../core/icons";
4
- import { VikingHeading } from "../typography/heading";
5
-
6
- /**
7
- * viking-card-title — card header title row with tokenized icon badge + heading.
8
- * Compose inside viking-card-header for premium, consistent section titles.
9
- */
10
- @Component({
11
- selector: "viking-card-title",
12
- imports: [VikingIconBadge, VikingHeading],
13
- changeDetection: ChangeDetectionStrategy.OnPush,
14
- host: { class: "viking-card-title" },
15
- template: `
16
- <viking-icon-badge [icon]="icon()" [tone]="tone()" [size]="iconSize()" />
17
- <viking-heading [level]="level()" [size]="size()">
18
- <ng-content />
19
- </viking-heading>
20
- `,
21
- styles: [
22
- `
23
- :host {
24
- display: flex;
25
- align-items: center;
26
- gap: var(--viking-space-1);
27
- flex: 1 1 auto;
28
- min-width: 0;
29
- margin: 0;
30
- }
31
-
32
- :host ::ng-deep viking-heading {
33
- display: block;
34
- flex: 1 1 auto;
35
- min-width: 0;
36
- overflow: hidden;
37
- text-overflow: ellipsis;
38
- white-space: nowrap;
39
- margin: 0;
40
- }
41
- `,
42
- ],
43
- })
44
- export class VikingCardTitle {
45
- readonly icon = input.required<VikingIconName>();
46
- readonly tone = input<VikingIconBadgeTone>("default");
47
- readonly level = input<1 | 2 | 3 | 4>(2);
48
- readonly size = input<"sm" | "base" | "lg" | "xl">("xl");
49
- readonly iconSize = input<number>(20);
50
- }