@dataengineeringformachinelearning/viking-ui 3.0.0-alpha.2 → 3.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +52 -12
- package/dist/core/brand-icons.d.ts +29 -0
- package/dist/core/icons.d.ts +132 -0
- package/dist/core/integration-brand-icons.d.ts +18 -0
- package/dist/core/lucide-paths.generated.d.ts +90 -0
- package/dist/core/types.d.ts +56 -0
- package/dist/core/uid.d.ts +2 -0
- package/dist/lib/accordion/accordion.d.ts +19 -0
- package/dist/lib/app-header/app-header.d.ts +8 -0
- package/dist/lib/app-sidebar/app-sidebar.d.ts +10 -0
- package/dist/lib/auth-panel/auth-panel.d.ts +13 -0
- package/dist/lib/autocomplete/autocomplete.d.ts +25 -0
- package/dist/lib/avatar/avatar.d.ts +14 -0
- package/dist/lib/badge/badge.d.ts +16 -0
- package/dist/lib/bar/bar.d.ts +4 -0
- package/dist/lib/brand/brand.d.ts +8 -0
- package/dist/lib/breadcrumbs/breadcrumbs.d.ts +10 -0
- package/dist/lib/button/button-group.d.ts +6 -0
- package/dist/lib/button/button.d.ts +25 -0
- package/dist/lib/calendar/calendar.d.ts +22 -0
- package/dist/lib/callout/callout.d.ts +14 -0
- package/dist/lib/card/card-title.d.ts +12 -0
- package/dist/lib/card/card.d.ts +19 -0
- package/dist/lib/carousel/carousel.d.ts +13 -0
- package/dist/lib/chart/chart-zoom.d.ts +14 -0
- package/dist/lib/chart/chart.d.ts +119 -0
- package/dist/lib/chart-card-header/chart-card-header.d.ts +10 -0
- package/dist/lib/chart-empty-state/chart-empty-state.d.ts +13 -0
- package/dist/lib/chart-panel/chart-panel.d.ts +10 -0
- package/dist/lib/checkbox/checkbox.d.ts +13 -0
- package/dist/lib/color-picker/color-picker.d.ts +16 -0
- package/dist/lib/command/command.d.ts +23 -0
- package/dist/lib/composer/composer.d.ts +15 -0
- package/dist/lib/confirm-dialog/confirm-dialog.d.ts +18 -0
- package/dist/lib/confirm-dialog/dialog.service.d.ts +28 -0
- package/dist/lib/context/context.d.ts +17 -0
- package/dist/lib/core/cva.d.ts +15 -0
- package/dist/lib/date-picker/date-picker.d.ts +18 -0
- package/dist/lib/dropdown/dropdown.d.ts +29 -0
- package/dist/lib/editor/editor.d.ts +26 -0
- package/dist/lib/empty-state/empty-state.d.ts +9 -0
- package/dist/lib/fab/fab.d.ts +9 -0
- package/dist/lib/field/field.d.ts +14 -0
- package/dist/lib/file-upload/file-upload.d.ts +19 -0
- package/dist/lib/footer/footer.d.ts +6 -0
- package/dist/lib/form-section/form-section.d.ts +15 -0
- package/dist/lib/gauge-arc/gauge-arc.d.ts +8 -0
- package/dist/lib/hud-panel/hud-panel.d.ts +5 -0
- package/dist/lib/icon/icon.d.ts +44 -0
- package/dist/lib/icon-badge/icon-badge.d.ts +14 -0
- package/dist/lib/icon-heading/icon-heading.d.ts +9 -0
- package/dist/lib/icon-text/icon-text.d.ts +12 -0
- package/dist/lib/input/input.d.ts +23 -0
- package/dist/lib/kanban/kanban.d.ts +16 -0
- package/dist/lib/kbd/kbd.d.ts +5 -0
- package/dist/lib/label/label.d.ts +7 -0
- package/dist/lib/loading-overlay/loading-overlay.d.ts +10 -0
- package/dist/lib/menubar/menubar.d.ts +10 -0
- package/dist/lib/metric-card/metric-card.d.ts +9 -0
- package/dist/lib/modal/modal.d.ts +13 -0
- package/dist/lib/native-select/native-select.d.ts +17 -0
- package/dist/lib/navbar/navbar.d.ts +13 -0
- package/dist/lib/navigation-menu/navigation-menu.d.ts +13 -0
- package/dist/lib/otp-input/otp-input.d.ts +23 -0
- package/dist/lib/page-back-link/page-back-link.d.ts +11 -0
- package/dist/lib/page-header/page-header.d.ts +15 -0
- package/dist/lib/pagination/pagination.d.ts +10 -0
- package/dist/lib/pillbox/pillbox.d.ts +15 -0
- package/dist/lib/popover/popover.d.ts +15 -0
- package/dist/lib/profile/profile.d.ts +11 -0
- package/dist/lib/progress/progress.d.ts +12 -0
- package/dist/lib/radio/radio.d.ts +16 -0
- package/dist/lib/ring-gauge/ring-gauge.d.ts +8 -0
- package/dist/lib/scroll-area/scroll-area.d.ts +7 -0
- package/dist/lib/search-palette/search-palette.d.ts +16 -0
- package/dist/lib/select/select.d.ts +26 -0
- package/dist/lib/separator/separator.d.ts +8 -0
- package/dist/lib/sheet/sheet.d.ts +13 -0
- package/dist/lib/sidebar-nav/sidebar-nav.d.ts +46 -0
- package/dist/lib/site-drakkar/site-footer.d.ts +18 -0
- package/dist/lib/site-drakkar/site-navbar.d.ts +25 -0
- package/dist/lib/skeleton/skeleton.d.ts +8 -0
- package/dist/lib/slider/slider.d.ts +17 -0
- package/dist/lib/spinner/spinner.d.ts +7 -0
- package/dist/lib/status-metric-row/status-metric-row.d.ts +9 -0
- package/dist/lib/suite-search-palette/suite-search-palette.d.ts +25 -0
- package/dist/lib/switch/switch.d.ts +12 -0
- package/dist/lib/table/table.d.ts +10 -0
- package/dist/lib/tabs/tab-panel.d.ts +12 -0
- package/dist/lib/tabs/tab.d.ts +14 -0
- package/dist/lib/tabs/tabs.d.ts +10 -0
- package/dist/lib/textarea/textarea.d.ts +16 -0
- package/dist/lib/theme-toggle/theme-toggle.d.ts +9 -0
- package/dist/lib/time-picker/time-picker.d.ts +21 -0
- package/dist/lib/timeline/timeline.d.ts +14 -0
- package/dist/lib/toast/toast.d.ts +21 -0
- package/dist/lib/toggle/toggle-group.d.ts +9 -0
- package/dist/lib/toggle/toggle.d.ts +15 -0
- package/dist/lib/tooltip/tooltip.d.ts +20 -0
- package/dist/lib/typography/heading.d.ts +9 -0
- package/dist/lib/typography/text.d.ts +11 -0
- package/dist/lib/uptime-bar/uptime-bar.d.ts +6 -0
- package/dist/lib/verification-code-field/verification-code-field.d.ts +19 -0
- package/dist/lib/whitepaper-cta/whitepaper-cta.d.ts +15 -0
- package/dist/lib/wizard/wizard.d.ts +13 -0
- package/dist/public-api.d.ts +109 -0
- package/dist/tokens/series-presets.d.ts +4 -0
- package/package.json +1 -1
- package/src/assets/drakkar-favicon.svg +17 -0
- package/src/core/brand/deml-lockup.svg +5 -0
- package/src/core/brand/deml-mark-compact.svg +4 -0
- package/src/core/brand/deml-mark-filled.svg +3 -0
- package/src/core/brand/deml-mark-outline.svg +4 -0
- package/src/core/brand-icons.ts +62 -0
- package/src/core/icons.spec.ts +52 -0
- package/src/core/icons.ts +206 -0
- package/src/core/integration-brand-icons.ts +77 -0
- package/src/core/lucide-paths.generated.ts +130 -0
- package/src/core/types.ts +85 -0
- package/src/core/uid.ts +7 -0
- package/src/lib/accordion/accordion.ts +126 -0
- package/src/lib/app-header/app-header.scss +274 -0
- package/src/lib/app-header/app-header.ts +43 -0
- package/src/lib/app-sidebar/app-sidebar.scss +415 -0
- package/src/lib/app-sidebar/app-sidebar.ts +29 -0
- package/src/lib/auth-panel/auth-panel.spec.ts +132 -0
- package/src/lib/auth-panel/auth-panel.ts +228 -0
- package/src/lib/autocomplete/autocomplete.ts +223 -0
- package/src/lib/avatar/avatar.ts +126 -0
- package/src/lib/badge/badge.ts +182 -0
- package/src/lib/bar/bar.ts +31 -0
- package/src/lib/brand/brand.ts +60 -0
- package/src/lib/breadcrumbs/breadcrumbs.ts +81 -0
- package/src/lib/button/button-group.ts +40 -0
- package/src/lib/button/button.scss +96 -0
- package/src/lib/button/button.ts +98 -0
- package/src/lib/calendar/calendar.ts +253 -0
- package/src/lib/callout/callout.ts +211 -0
- package/src/lib/card/card-title.spec.ts +27 -0
- package/src/lib/card/card-title.ts +50 -0
- package/src/lib/card/card.ts +170 -0
- package/src/lib/carousel/carousel.ts +206 -0
- package/src/lib/chart/chart-zoom.spec.ts +65 -0
- package/src/lib/chart/chart-zoom.ts +71 -0
- package/src/lib/chart/chart.ts +1257 -0
- package/src/lib/chart-card-header/chart-card-header.ts +80 -0
- package/src/lib/chart-empty-state/chart-empty-state.ts +146 -0
- package/src/lib/chart-panel/chart-panel.ts +133 -0
- package/src/lib/checkbox/checkbox.ts +139 -0
- package/src/lib/color-picker/color-picker.ts +148 -0
- package/src/lib/command/command.ts +260 -0
- package/src/lib/composer/composer.ts +180 -0
- package/src/lib/confirm-dialog/confirm-dialog.ts +163 -0
- package/src/lib/confirm-dialog/dialog.service.ts +79 -0
- package/src/lib/context/context.ts +75 -0
- package/src/lib/core/cva.ts +33 -0
- package/src/lib/date-picker/date-picker.ts +139 -0
- package/src/lib/dropdown/dropdown.ts +188 -0
- package/src/lib/editor/editor.ts +170 -0
- package/src/lib/empty-state/empty-state.ts +100 -0
- package/src/lib/fab/fab.ts +76 -0
- package/src/lib/field/field.ts +111 -0
- package/src/lib/file-upload/file-upload.ts +208 -0
- package/src/lib/footer/footer.scss +155 -0
- package/src/lib/footer/footer.ts +28 -0
- package/src/lib/form-section/form-section.ts +200 -0
- package/src/lib/forms.spec.ts +92 -0
- package/src/lib/gauge-arc/gauge-arc.ts +85 -0
- package/src/lib/hud-panel/hud-panel.ts +27 -0
- package/src/lib/icon/icon.ts +284 -0
- package/src/lib/icon-badge/icon-badge.ts +87 -0
- package/src/lib/icon-heading/icon-heading.spec.ts +32 -0
- package/src/lib/icon-heading/icon-heading.ts +38 -0
- package/src/lib/icon-text/icon-text.ts +120 -0
- package/src/lib/input/input.ts +119 -0
- package/src/lib/kanban/kanban.ts +211 -0
- package/src/lib/kbd/kbd.ts +32 -0
- package/src/lib/label/label.ts +39 -0
- package/src/lib/loading-overlay/loading-overlay.ts +80 -0
- package/src/lib/menubar/menubar.ts +77 -0
- package/src/lib/metric-card/metric-card.ts +33 -0
- package/src/lib/modal/modal.ts +207 -0
- package/src/lib/native-select/native-select.ts +124 -0
- package/src/lib/navbar/navbar.ts +124 -0
- package/src/lib/navigation-menu/navigation-menu.ts +116 -0
- package/src/lib/otp-input/otp-input.ts +164 -0
- package/src/lib/page-back-link/page-back-link.ts +74 -0
- package/src/lib/page-header/page-header.ts +70 -0
- package/src/lib/pagination/pagination.ts +157 -0
- package/src/lib/pillbox/pillbox.ts +157 -0
- package/src/lib/popover/popover.ts +92 -0
- package/src/lib/profile/profile.ts +73 -0
- package/src/lib/progress/progress.ts +123 -0
- package/src/lib/radio/radio.ts +132 -0
- package/src/lib/ring-gauge/ring-gauge.ts +75 -0
- package/src/lib/scroll-area/scroll-area.ts +57 -0
- package/src/lib/search-palette/search-palette.scss +288 -0
- package/src/lib/search-palette/search-palette.ts +114 -0
- package/src/lib/select/select.ts +292 -0
- package/src/lib/separator/separator.ts +59 -0
- package/src/lib/sheet/sheet.ts +192 -0
- package/src/lib/sidebar-nav/sidebar-nav.scss +218 -0
- package/src/lib/sidebar-nav/sidebar-nav.ts +158 -0
- package/src/lib/site-drakkar/site-footer.ts +129 -0
- package/src/lib/site-drakkar/site-navbar.scss +2 -0
- package/src/lib/site-drakkar/site-navbar.ts +267 -0
- package/src/lib/site-drakkar/suite-search-items.spec.ts +61 -0
- package/src/lib/skeleton/skeleton.ts +51 -0
- package/src/lib/slider/slider.ts +133 -0
- package/src/lib/spinner/spinner.ts +75 -0
- package/src/lib/status-metric-row/status-metric-row.ts +74 -0
- package/src/lib/suite-search-palette/suite-search-palette.ts +95 -0
- package/src/lib/switch/switch.ts +131 -0
- package/src/lib/table/table.ts +137 -0
- package/src/lib/tabs/tab-panel.ts +61 -0
- package/src/lib/tabs/tab.ts +107 -0
- package/src/lib/tabs/tabs.ts +109 -0
- package/src/lib/textarea/textarea.ts +103 -0
- package/src/lib/theme-toggle/theme-toggle.spec.ts +40 -0
- package/src/lib/theme-toggle/theme-toggle.ts +39 -0
- package/src/lib/time-picker/time-picker.ts +197 -0
- package/src/lib/timeline/timeline.ts +152 -0
- package/src/lib/toast/toast.ts +196 -0
- package/src/lib/toggle/toggle-group.ts +60 -0
- package/src/lib/toggle/toggle.ts +101 -0
- package/src/lib/tooltip/tooltip.ts +119 -0
- package/src/lib/typography/heading.ts +52 -0
- package/src/lib/typography/text.ts +51 -0
- package/src/lib/uptime-bar/uptime-bar.ts +55 -0
- package/src/lib/verification-code-field/verification-code-field.ts +149 -0
- package/src/lib/whitepaper-cta/whitepaper-cta.scss +130 -0
- package/src/lib/whitepaper-cta/whitepaper-cta.ts +78 -0
- package/src/lib/wizard/wizard.ts +80 -0
- package/src/public-api.ts +172 -0
- package/src/tokens/series-presets.ts +15 -0
- package/src/tokens/tailwind.preset.js +209 -0
- package/src/viking-ui.spec.ts +416 -0
- package/src/web/web-components.spec.ts +297 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, input } from "@angular/core";
|
|
2
|
+
import { VikingIcon } from "../icon/icon";
|
|
3
|
+
import { VikingIconName } from "../../core/icons";
|
|
4
|
+
|
|
5
|
+
export type VikingFormSectionLayout = "inline" | "stack" | "status";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* viking-form-panel — groups related form sections inside a card without nested outlines.
|
|
9
|
+
*/
|
|
10
|
+
@Component({
|
|
11
|
+
selector: "viking-form-panel",
|
|
12
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
13
|
+
host: { class: "viking-form-panel" },
|
|
14
|
+
template: `<ng-content />`,
|
|
15
|
+
styles: [
|
|
16
|
+
`
|
|
17
|
+
:host {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
gap: 0;
|
|
21
|
+
width: 100%;
|
|
22
|
+
min-width: 0;
|
|
23
|
+
}
|
|
24
|
+
:host ::ng-deep viking-form-section + viking-form-section {
|
|
25
|
+
border-top: 1px solid var(--viking-border-subtle);
|
|
26
|
+
margin-top: var(--viking-space-3);
|
|
27
|
+
padding-top: var(--viking-space-3);
|
|
28
|
+
}
|
|
29
|
+
`,
|
|
30
|
+
],
|
|
31
|
+
})
|
|
32
|
+
export class VikingFormPanel {}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* viking-form-section — standard dashboard form row: heading, fields, and actions.
|
|
36
|
+
* Use inside viking-form-panel (or a card body) to avoid nested bordered sub-forms.
|
|
37
|
+
*/
|
|
38
|
+
@Component({
|
|
39
|
+
selector: "viking-form-section",
|
|
40
|
+
imports: [VikingIcon],
|
|
41
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
42
|
+
host: {
|
|
43
|
+
class: "viking-form-section",
|
|
44
|
+
"[class.viking-form-section-inline]": "layout() === 'inline'",
|
|
45
|
+
"[class.viking-form-section-stack]": "layout() === 'stack'",
|
|
46
|
+
"[class.viking-form-section-status]": "layout() === 'status'",
|
|
47
|
+
},
|
|
48
|
+
template: `
|
|
49
|
+
<header class="viking-form-section-header">
|
|
50
|
+
@if (icon()) {
|
|
51
|
+
<viking-icon
|
|
52
|
+
[name]="icon()!"
|
|
53
|
+
[size]="16"
|
|
54
|
+
class="viking-form-section-icon"
|
|
55
|
+
/>
|
|
56
|
+
}
|
|
57
|
+
<h3 class="viking-form-section-title">{{ heading() }}</h3>
|
|
58
|
+
</header>
|
|
59
|
+
|
|
60
|
+
<div class="viking-form-section-body">
|
|
61
|
+
<div class="viking-form-section-fields">
|
|
62
|
+
<ng-content />
|
|
63
|
+
</div>
|
|
64
|
+
<div class="viking-form-section-actions">
|
|
65
|
+
<ng-content select="[vikingFormActions]" />
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
<div class="viking-form-section-footer">
|
|
70
|
+
<ng-content select="[vikingFormFooter]" />
|
|
71
|
+
</div>
|
|
72
|
+
`,
|
|
73
|
+
styles: [
|
|
74
|
+
`
|
|
75
|
+
:host {
|
|
76
|
+
display: flex;
|
|
77
|
+
flex-direction: column;
|
|
78
|
+
gap: var(--viking-space-2);
|
|
79
|
+
width: 100%;
|
|
80
|
+
min-width: 0;
|
|
81
|
+
font-family: var(--viking-font-family);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.viking-form-section-header {
|
|
85
|
+
display: flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
gap: var(--viking-space-1);
|
|
88
|
+
min-width: 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.viking-form-section-icon {
|
|
92
|
+
display: flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
justify-content: center;
|
|
95
|
+
width: 24px;
|
|
96
|
+
height: 24px;
|
|
97
|
+
border-radius: var(--viking-radius-sm);
|
|
98
|
+
background: var(--viking-accent-soft);
|
|
99
|
+
color: var(--viking-accent-strong);
|
|
100
|
+
flex-shrink: 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.viking-form-section-title {
|
|
104
|
+
margin: 0;
|
|
105
|
+
font-size: var(--viking-font-size-ui);
|
|
106
|
+
font-weight: var(--viking-font-weight-semibold);
|
|
107
|
+
letter-spacing: var(--viking-letter-spacing-caps);
|
|
108
|
+
text-transform: uppercase;
|
|
109
|
+
color: var(--viking-text);
|
|
110
|
+
line-height: var(--viking-line-height-tight);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.viking-form-section-body {
|
|
114
|
+
display: flex;
|
|
115
|
+
flex-direction: column;
|
|
116
|
+
align-items: stretch;
|
|
117
|
+
gap: var(--viking-space-2);
|
|
118
|
+
width: 100%;
|
|
119
|
+
min-width: 0;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.viking-form-section-fields {
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-direction: column;
|
|
125
|
+
gap: var(--viking-space-2);
|
|
126
|
+
min-width: 0;
|
|
127
|
+
flex: 1;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.viking-form-section-actions {
|
|
131
|
+
display: flex;
|
|
132
|
+
flex-direction: column;
|
|
133
|
+
align-items: stretch;
|
|
134
|
+
gap: var(--viking-space-1);
|
|
135
|
+
flex-shrink: 0;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.viking-form-section-actions:empty {
|
|
139
|
+
display: none;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.viking-form-section-footer:empty {
|
|
143
|
+
display: none;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.viking-form-section-footer:not(:empty) {
|
|
147
|
+
display: flex;
|
|
148
|
+
flex-direction: column;
|
|
149
|
+
gap: var(--viking-space-1);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
:host(.viking-form-section-inline) .viking-form-section-body {
|
|
153
|
+
@media (min-width: 601px) {
|
|
154
|
+
flex-direction: row;
|
|
155
|
+
align-items: flex-end;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
:host(.viking-form-section-inline) .viking-form-section-actions {
|
|
160
|
+
@media (min-width: 601px) {
|
|
161
|
+
align-items: center;
|
|
162
|
+
justify-content: flex-end;
|
|
163
|
+
width: auto;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
:host(.viking-form-section-status) .viking-form-section-body {
|
|
168
|
+
@media (min-width: 601px) {
|
|
169
|
+
flex-direction: row;
|
|
170
|
+
align-items: flex-start;
|
|
171
|
+
justify-content: space-between;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
:host(.viking-form-section-status) .viking-form-section-fields {
|
|
176
|
+
flex-direction: row;
|
|
177
|
+
align-items: flex-start;
|
|
178
|
+
gap: var(--viking-space-1, 8px);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
:host(.viking-form-section-status) .viking-form-section-actions {
|
|
182
|
+
@media (min-width: 601px) {
|
|
183
|
+
align-items: flex-start;
|
|
184
|
+
padding-top: 1px;
|
|
185
|
+
margin-left: auto;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
:host ::ng-deep viking-field {
|
|
190
|
+
width: 100%;
|
|
191
|
+
min-width: 0;
|
|
192
|
+
}
|
|
193
|
+
`,
|
|
194
|
+
],
|
|
195
|
+
})
|
|
196
|
+
export class VikingFormSection {
|
|
197
|
+
readonly heading = input.required<string>();
|
|
198
|
+
readonly icon = input<VikingIconName | null>(null);
|
|
199
|
+
readonly layout = input<VikingFormSectionLayout>("inline");
|
|
200
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Component } from "@angular/core";
|
|
2
|
+
import { TestBed, ComponentFixture } from "@angular/core/testing";
|
|
3
|
+
import { FormsModule } from "@angular/forms";
|
|
4
|
+
import { describe, it, expect } from "vitest";
|
|
5
|
+
import { VikingField } from "./field/field";
|
|
6
|
+
import { VikingInput } from "./input/input";
|
|
7
|
+
import { VikingFormSection } from "./form-section/form-section";
|
|
8
|
+
|
|
9
|
+
@Component({
|
|
10
|
+
imports: [VikingField, VikingInput, FormsModule],
|
|
11
|
+
template: `
|
|
12
|
+
<viking-field label="Email" [required]="true" [error]="error">
|
|
13
|
+
<viking-input [(ngModel)]="email" placeholder="you@example.com" />
|
|
14
|
+
</viking-field>
|
|
15
|
+
`,
|
|
16
|
+
})
|
|
17
|
+
class FieldInputHost {
|
|
18
|
+
email = "";
|
|
19
|
+
error = "";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@Component({
|
|
23
|
+
imports: [VikingFormSection, VikingField, VikingInput, FormsModule],
|
|
24
|
+
template: `
|
|
25
|
+
<viking-form-section heading="Profile" icon="user" layout="stack">
|
|
26
|
+
<viking-field label="Display name">
|
|
27
|
+
<viking-input [(ngModel)]="name" />
|
|
28
|
+
</viking-field>
|
|
29
|
+
</viking-form-section>
|
|
30
|
+
`,
|
|
31
|
+
})
|
|
32
|
+
class FormStackHost {
|
|
33
|
+
name = "";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
describe("viking forms", () => {
|
|
37
|
+
const render = async <T>(
|
|
38
|
+
component: new () => T,
|
|
39
|
+
): Promise<ComponentFixture<T>> => {
|
|
40
|
+
const fixture = TestBed.createComponent(component);
|
|
41
|
+
fixture.detectChanges();
|
|
42
|
+
await fixture.whenStable();
|
|
43
|
+
return fixture;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
it("renders required marker and associates label with input", async () => {
|
|
47
|
+
const fixture = await render(FieldInputHost);
|
|
48
|
+
const label = fixture.nativeElement.querySelector(".viking-field-label");
|
|
49
|
+
expect(label?.textContent).toContain("Email");
|
|
50
|
+
expect(label?.querySelector(".viking-field-required")).toBeTruthy();
|
|
51
|
+
expect(fixture.nativeElement.querySelector("viking-input-wc")).toBeTruthy();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("shows error alert and invalid host class", async () => {
|
|
55
|
+
const fixture = await render(FieldInputHost);
|
|
56
|
+
fixture.componentInstance.error = "Invalid email address";
|
|
57
|
+
fixture.detectChanges();
|
|
58
|
+
const field = fixture.nativeElement.querySelector(
|
|
59
|
+
"viking-field",
|
|
60
|
+
) as HTMLElement;
|
|
61
|
+
expect(field.classList.contains("viking-field-invalid")).toBe(true);
|
|
62
|
+
const alert = fixture.nativeElement.querySelector(
|
|
63
|
+
".viking-field-error",
|
|
64
|
+
) as HTMLElement;
|
|
65
|
+
expect(alert.getAttribute("role")).toBe("alert");
|
|
66
|
+
expect(alert.textContent).toContain("Invalid email address");
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("binds input value via ngModel (ControlValueAccessor)", async () => {
|
|
70
|
+
const fixture = await render(FieldInputHost);
|
|
71
|
+
const wc = fixture.nativeElement.querySelector(
|
|
72
|
+
"viking-input-wc",
|
|
73
|
+
) as HTMLElement;
|
|
74
|
+
const input = wc.shadowRoot?.querySelector("input") as HTMLInputElement;
|
|
75
|
+
input.value = "ops@deml.app";
|
|
76
|
+
input.dispatchEvent(new Event("input"));
|
|
77
|
+
fixture.detectChanges();
|
|
78
|
+
await fixture.whenStable();
|
|
79
|
+
expect(fixture.componentInstance.email).toBe("ops@deml.app");
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it("renders stacked form section with icon heading", async () => {
|
|
83
|
+
const fixture = await render(FormStackHost);
|
|
84
|
+
const section = fixture.nativeElement.querySelector(
|
|
85
|
+
"viking-form-section",
|
|
86
|
+
) as HTMLElement;
|
|
87
|
+
expect(section.classList.contains("viking-form-section-stack")).toBe(true);
|
|
88
|
+
expect(
|
|
89
|
+
section.querySelector(".viking-form-section-title")?.textContent,
|
|
90
|
+
).toContain("Profile");
|
|
91
|
+
});
|
|
92
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChangeDetectionStrategy,
|
|
3
|
+
Component,
|
|
4
|
+
computed,
|
|
5
|
+
input,
|
|
6
|
+
} from "@angular/core";
|
|
7
|
+
|
|
8
|
+
/** viking-gauge-arc — semicircle gauge fill driven by value / max. */
|
|
9
|
+
@Component({
|
|
10
|
+
selector: "viking-gauge-arc",
|
|
11
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
12
|
+
host: {
|
|
13
|
+
class: "viking-gauge-arc",
|
|
14
|
+
"aria-hidden": "true",
|
|
15
|
+
"[class.viking-gauge-arc-amber]": "tone() === 'amber'",
|
|
16
|
+
"[class.viking-gauge-arc-danger]": "tone() === 'danger'",
|
|
17
|
+
"[class.viking-gauge-arc-primary]": "tone() === 'primary'",
|
|
18
|
+
},
|
|
19
|
+
template: `
|
|
20
|
+
<svg class="viking-gauge-arc-svg" viewBox="0 0 100 60" fill="none">
|
|
21
|
+
<path class="viking-gauge-arc-bg" d="M10 50A40 40 0 0 1 90 50" />
|
|
22
|
+
<path
|
|
23
|
+
class="viking-gauge-arc-fill"
|
|
24
|
+
d="M10 50A40 40 0 0 1 90 50"
|
|
25
|
+
[attr.stroke-dasharray]="strokeDasharray()"
|
|
26
|
+
/>
|
|
27
|
+
</svg>
|
|
28
|
+
`,
|
|
29
|
+
styles: [
|
|
30
|
+
`
|
|
31
|
+
:host {
|
|
32
|
+
display: block;
|
|
33
|
+
width: 100%;
|
|
34
|
+
color: var(--viking-accent);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.viking-gauge-arc-svg {
|
|
38
|
+
width: 100%;
|
|
39
|
+
height: auto;
|
|
40
|
+
overflow: visible;
|
|
41
|
+
shape-rendering: geometricPrecision;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.viking-gauge-arc-bg,
|
|
45
|
+
.viking-gauge-arc-fill {
|
|
46
|
+
fill: none;
|
|
47
|
+
stroke-width: 8;
|
|
48
|
+
stroke-linecap: round;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.viking-gauge-arc-bg {
|
|
52
|
+
stroke: color-mix(in srgb, var(--viking-text-muted) 25%, transparent);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.viking-gauge-arc-fill {
|
|
56
|
+
stroke: currentColor;
|
|
57
|
+
transition: stroke-dasharray 0.4s var(--viking-ease-default);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
:host(.viking-gauge-arc-amber) {
|
|
61
|
+
color: var(--viking-warning);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
:host(.viking-gauge-arc-danger) {
|
|
65
|
+
color: var(--viking-danger);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
:host(.viking-gauge-arc-primary) {
|
|
69
|
+
color: var(--viking-accent);
|
|
70
|
+
}
|
|
71
|
+
`,
|
|
72
|
+
],
|
|
73
|
+
})
|
|
74
|
+
export class VikingGaugeArc {
|
|
75
|
+
readonly value = input.required<number>();
|
|
76
|
+
readonly max = input<number>(100);
|
|
77
|
+
readonly circumference = input<number>(125.66);
|
|
78
|
+
readonly tone = input<"accent" | "amber" | "danger" | "primary">("accent");
|
|
79
|
+
|
|
80
|
+
protected readonly strokeDasharray = computed(() => {
|
|
81
|
+
const pct = Math.max(0, Math.min(1, this.value() / this.max()));
|
|
82
|
+
const filled = pct * this.circumference();
|
|
83
|
+
return `${filled} ${this.circumference()}`;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, input } from "@angular/core";
|
|
2
|
+
import { VikingIcon } from "../icon/icon";
|
|
3
|
+
import { VikingIconName } from "../../core/icons";
|
|
4
|
+
|
|
5
|
+
/** viking-hud-panel — bordered dashboard panel with icon header. */
|
|
6
|
+
@Component({
|
|
7
|
+
selector: "viking-hud-panel",
|
|
8
|
+
imports: [VikingIcon],
|
|
9
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
10
|
+
host: {
|
|
11
|
+
class: "viking-hud-panel panel-section",
|
|
12
|
+
},
|
|
13
|
+
template: `
|
|
14
|
+
<div class="viking-hud-panel-header panel-header">
|
|
15
|
+
@if (icon()) {
|
|
16
|
+
<viking-icon [name]="icon()!" [size]="20" class="panel-icon" />
|
|
17
|
+
}
|
|
18
|
+
<h2 class="viking-hud-panel-title">{{ title() }}</h2>
|
|
19
|
+
<ng-content select="[vikingHudPanelBadge]" />
|
|
20
|
+
</div>
|
|
21
|
+
<ng-content />
|
|
22
|
+
`,
|
|
23
|
+
})
|
|
24
|
+
export class VikingHudPanel {
|
|
25
|
+
readonly title = input.required<string>();
|
|
26
|
+
readonly icon = input<VikingIconName | null>(null);
|
|
27
|
+
}
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChangeDetectionStrategy,
|
|
3
|
+
Component,
|
|
4
|
+
computed,
|
|
5
|
+
input,
|
|
6
|
+
} from "@angular/core";
|
|
7
|
+
import { DomSanitizer, SafeHtml } from "@angular/platform-browser";
|
|
8
|
+
import {
|
|
9
|
+
VIKING_FILLED_ICON_NAMES,
|
|
10
|
+
VIKING_ICON_FILLED_PATHS,
|
|
11
|
+
VIKING_ICON_PATHS,
|
|
12
|
+
resolveVikingIcon,
|
|
13
|
+
resolveVikingIconColor,
|
|
14
|
+
resolveVikingIconSize,
|
|
15
|
+
vikingIconViewBox,
|
|
16
|
+
VikingIconColorToken,
|
|
17
|
+
VikingIconName,
|
|
18
|
+
VikingIconSizePreset,
|
|
19
|
+
VikingIconVariant,
|
|
20
|
+
VIKING_DRAKKAR_ICON_NAMES_LIST,
|
|
21
|
+
} from "../../core/icons";
|
|
22
|
+
import {
|
|
23
|
+
isIntegrationBrandIcon,
|
|
24
|
+
VIKING_INTEGRATION_BRAND_SVGS,
|
|
25
|
+
type VikingIntegrationBrandName,
|
|
26
|
+
} from "../../core/integration-brand-icons";
|
|
27
|
+
|
|
28
|
+
const VIKING_FILLED_ICON_SET = new Set<string>(VIKING_FILLED_ICON_NAMES);
|
|
29
|
+
const VIKING_DRAKKAR_ICON_SET = new Set<string>(VIKING_DRAKKAR_ICON_NAMES_LIST);
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* viking-icon — themeable inline SVG icon (Lucide-sourced registry + DEML brand marks).
|
|
33
|
+
* Zero runtime dependencies; paths are inlined at build time from Lucide.
|
|
34
|
+
*
|
|
35
|
+
* @example Outline with semantic color
|
|
36
|
+
* ```html
|
|
37
|
+
* <viking-icon name="search" sizePreset="md" color="accent" />
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example Brand mark (outline)
|
|
41
|
+
* ```html
|
|
42
|
+
* <viking-icon name="drakkar" [size]="28" color="accent" />
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
@Component({
|
|
46
|
+
selector: "viking-icon",
|
|
47
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
48
|
+
host: {
|
|
49
|
+
"[class.viking-icon-spin]": "spin()",
|
|
50
|
+
"[class.viking-icon-filled]": "isFilled()",
|
|
51
|
+
"[class.viking-icon-outline]": "!isFilled()",
|
|
52
|
+
"[class.viking-icon-brand-drakkar]": "isDrakkarBrand()",
|
|
53
|
+
"[class.viking-icon-sm]": 'sizePreset() === "sm"',
|
|
54
|
+
"[class.viking-icon-md]": 'sizePreset() === "md"',
|
|
55
|
+
"[class.viking-icon-lg]":
|
|
56
|
+
'sizePreset() === "lg" || (!sizePreset() && !size())',
|
|
57
|
+
"[class.viking-icon-backdrop]": "backdrop()",
|
|
58
|
+
"[class.viking-icon-backdrop-success]":
|
|
59
|
+
"backdrop() && backdropTone() === 'success'",
|
|
60
|
+
"[class.viking-icon-backdrop-warning]":
|
|
61
|
+
"backdrop() && backdropTone() === 'warning'",
|
|
62
|
+
"[class.viking-icon-backdrop-danger]":
|
|
63
|
+
"backdrop() && backdropTone() === 'danger'",
|
|
64
|
+
"[class.viking-icon-backdrop-info]":
|
|
65
|
+
"backdrop() && backdropTone() === 'info'",
|
|
66
|
+
"[style.color]": "resolvedColor()",
|
|
67
|
+
"aria-hidden": "true",
|
|
68
|
+
},
|
|
69
|
+
template: `
|
|
70
|
+
@if (resolvedName() === "google") {
|
|
71
|
+
<svg
|
|
72
|
+
class="viking-icon-svg viking-icon-brand"
|
|
73
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
74
|
+
viewBox="0 0 48 48"
|
|
75
|
+
[style.width.px]="resolvedSize()"
|
|
76
|
+
[style.height.px]="resolvedSize()"
|
|
77
|
+
aria-hidden="true"
|
|
78
|
+
>
|
|
79
|
+
<path
|
|
80
|
+
fill="#EA4335"
|
|
81
|
+
d="M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z"
|
|
82
|
+
/>
|
|
83
|
+
<path
|
|
84
|
+
fill="#4285F4"
|
|
85
|
+
d="M46.5 24c0-1.55-.15-3.24-.47-4.77H24v9.03h12.75c-.55 2.83-2.13 5.23-4.53 6.82l7.02 5.44C43.35 36.56 46.5 30.82 46.5 24z"
|
|
86
|
+
/>
|
|
87
|
+
<path
|
|
88
|
+
fill="#FBBC05"
|
|
89
|
+
d="M10.54 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24s.92 7.54 2.56 10.78l7.98-6.19z"
|
|
90
|
+
/>
|
|
91
|
+
<path
|
|
92
|
+
fill="#34A853"
|
|
93
|
+
d="M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.02-5.44c-1.99 1.33-4.51 2.15-7.87 2.15-6.26 0-11.57-4.22-13.46-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z"
|
|
94
|
+
/>
|
|
95
|
+
</svg>
|
|
96
|
+
} @else if (resolvedName() === "apple") {
|
|
97
|
+
<svg
|
|
98
|
+
class="viking-icon-svg viking-icon-brand"
|
|
99
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
100
|
+
viewBox="0 0 24 24"
|
|
101
|
+
fill="currentColor"
|
|
102
|
+
[style.width.px]="resolvedSize()"
|
|
103
|
+
[style.height.px]="resolvedSize()"
|
|
104
|
+
aria-hidden="true"
|
|
105
|
+
>
|
|
106
|
+
<path
|
|
107
|
+
d="M16.365 12.14c.02 2.53 2.21 3.38 2.23 3.39-.02.07-.35 1.21-1.16 2.4-.7 1.02-1.43 2.03-2.58 2.05-1.13.02-1.49-.67-2.78-.67-1.29 0-1.69.65-2.75.69-1.11.04-1.95-1.12-2.66-2.13-1.44-2.08-2.54-5.87-1.07-8.43.73-1.27 2.04-2.08 3.46-2.1 1.08-.02 2.1.72 2.78.72.67 0 2.14-.89 3.61-.76.61.03 2.33.25 3.44 1.88-.09.06-2.05 1.2-2.03 3.55M13.75 3.64c.59-.71 1-1.7.89-2.68-.86.03-1.9.57-2.52 1.28-.55.63-1.03 1.65-.9 2.62.95.07 1.92-.49 2.53-1.22"
|
|
108
|
+
/>
|
|
109
|
+
</svg>
|
|
110
|
+
} @else if (isIntegrationBrand()) {
|
|
111
|
+
<svg
|
|
112
|
+
class="viking-icon-svg viking-icon-brand viking-icon-integration-brand"
|
|
113
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
114
|
+
viewBox="0 0 24 24"
|
|
115
|
+
[style.width.px]="resolvedSize()"
|
|
116
|
+
[style.height.px]="resolvedSize()"
|
|
117
|
+
aria-hidden="true"
|
|
118
|
+
>
|
|
119
|
+
<g [innerHTML]="integrationBrandSvg()"></g>
|
|
120
|
+
</svg>
|
|
121
|
+
} @else {
|
|
122
|
+
<svg
|
|
123
|
+
class="viking-icon-svg"
|
|
124
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
125
|
+
[attr.viewBox]="viewBox()"
|
|
126
|
+
[attr.fill]="isFilled() ? 'currentColor' : 'none'"
|
|
127
|
+
[attr.fill-rule]="isFilled() ? 'evenodd' : null"
|
|
128
|
+
[attr.stroke]="isFilled() ? 'none' : 'currentColor'"
|
|
129
|
+
stroke-linecap="round"
|
|
130
|
+
stroke-linejoin="round"
|
|
131
|
+
[style.width.px]="resolvedSize()"
|
|
132
|
+
[style.height.px]="resolvedSize()"
|
|
133
|
+
>
|
|
134
|
+
<!-- innerHTML on <g> — binding on <svg> throws NotYetImplemented under SSR (domino). -->
|
|
135
|
+
<g [innerHTML]="paths()"></g>
|
|
136
|
+
</svg>
|
|
137
|
+
}
|
|
138
|
+
`,
|
|
139
|
+
styles: [
|
|
140
|
+
`
|
|
141
|
+
:host {
|
|
142
|
+
display: inline-flex;
|
|
143
|
+
align-items: center;
|
|
144
|
+
justify-content: center;
|
|
145
|
+
flex-shrink: 0;
|
|
146
|
+
line-height: 0;
|
|
147
|
+
color: inherit;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
:host(.viking-icon-outline) .viking-icon-svg {
|
|
151
|
+
--viking-icon-stroke-width: 1.75;
|
|
152
|
+
stroke-width: var(--viking-icon-stroke-width);
|
|
153
|
+
shape-rendering: geometricPrecision;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
:host(.viking-icon-outline.viking-icon-brand-drakkar) .viking-icon-svg {
|
|
157
|
+
--viking-icon-stroke-width: 1.5;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
:host(.viking-icon-sm) .viking-icon-svg {
|
|
161
|
+
--viking-icon-stroke-width: 1.5;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
:host(.viking-icon-lg) .viking-icon-svg {
|
|
165
|
+
--viking-icon-stroke-width: 1.75;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
:host(.viking-icon-filled) .viking-icon-svg {
|
|
169
|
+
stroke: none;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
:host(.viking-icon-spin) svg {
|
|
173
|
+
animation: viking-icon-rotate 0.9s linear infinite;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
:host(.viking-icon-backdrop) {
|
|
177
|
+
padding: var(--viking-icon-backdrop-padding, var(--viking-space-half));
|
|
178
|
+
border-radius: var(--viking-radius-lg);
|
|
179
|
+
background: var(--viking-accent-soft);
|
|
180
|
+
color: var(--viking-accent-strong);
|
|
181
|
+
box-shadow: var(--viking-shadow-sm);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
:host(.viking-icon-backdrop-success) {
|
|
185
|
+
background: color-mix(in srgb, var(--viking-success) 14%, transparent);
|
|
186
|
+
color: var(--viking-success);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
:host(.viking-icon-backdrop-warning) {
|
|
190
|
+
background: color-mix(in srgb, var(--viking-warning) 14%, transparent);
|
|
191
|
+
color: var(--viking-warning);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
:host(.viking-icon-backdrop-danger) {
|
|
195
|
+
background: color-mix(in srgb, var(--viking-danger) 14%, transparent);
|
|
196
|
+
color: var(--viking-danger);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
:host(.viking-icon-backdrop-info) {
|
|
200
|
+
background: color-mix(in srgb, var(--viking-info) 14%, transparent);
|
|
201
|
+
color: var(--viking-info);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
@keyframes viking-icon-rotate {
|
|
205
|
+
to {
|
|
206
|
+
transform: rotate(360deg);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
`,
|
|
210
|
+
],
|
|
211
|
+
})
|
|
212
|
+
export class VikingIcon {
|
|
213
|
+
readonly name = input.required<VikingIconName | string>();
|
|
214
|
+
/** Explicit pixel size — overridden by sizePreset when set. */
|
|
215
|
+
readonly size = input<number | undefined>(undefined);
|
|
216
|
+
/** sm (16px) · md (20px) · lg (24px) */
|
|
217
|
+
readonly sizePreset = input<VikingIconSizePreset | null>(null);
|
|
218
|
+
/** outline (stroke) or filled (solid) */
|
|
219
|
+
readonly variant = input<VikingIconVariant>("outline");
|
|
220
|
+
/** Semantic token (accent, success, …) or any CSS color value. */
|
|
221
|
+
readonly color = input<VikingIconColorToken | string | undefined>(undefined);
|
|
222
|
+
/** Renders icon inside a padded tokenized backdrop (matches viking-icon-badge). */
|
|
223
|
+
readonly backdrop = input<boolean>(false);
|
|
224
|
+
readonly backdropTone = input<
|
|
225
|
+
"default" | "success" | "warning" | "danger" | "info"
|
|
226
|
+
>("default");
|
|
227
|
+
readonly spin = input<boolean>(false);
|
|
228
|
+
|
|
229
|
+
protected readonly resolvedName = computed(() =>
|
|
230
|
+
resolveVikingIcon(this.name()),
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
protected readonly resolvedSize = computed(() =>
|
|
234
|
+
resolveVikingIconSize(this.size(), this.sizePreset()),
|
|
235
|
+
);
|
|
236
|
+
|
|
237
|
+
protected readonly resolvedColor = computed(() =>
|
|
238
|
+
resolveVikingIconColor(this.color()),
|
|
239
|
+
);
|
|
240
|
+
|
|
241
|
+
protected readonly viewBox = computed(() =>
|
|
242
|
+
vikingIconViewBox(this.resolvedName()),
|
|
243
|
+
);
|
|
244
|
+
|
|
245
|
+
protected readonly isFilled = computed(() => {
|
|
246
|
+
const name = this.resolvedName();
|
|
247
|
+
if (name === "google" || name === "apple" || isIntegrationBrandIcon(name)) {
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
if (this.variant() === "filled") {
|
|
251
|
+
return true;
|
|
252
|
+
}
|
|
253
|
+
return VIKING_FILLED_ICON_SET.has(name);
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
protected readonly isDrakkarBrand = computed(() =>
|
|
257
|
+
VIKING_DRAKKAR_ICON_SET.has(this.resolvedName()),
|
|
258
|
+
);
|
|
259
|
+
|
|
260
|
+
protected readonly isIntegrationBrand = computed(() =>
|
|
261
|
+
isIntegrationBrandIcon(this.resolvedName()),
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
protected readonly integrationBrandSvg = computed<SafeHtml>(() => {
|
|
265
|
+
const name = this.resolvedName() as VikingIntegrationBrandName;
|
|
266
|
+
return this.sanitizer.bypassSecurityTrustHtml(
|
|
267
|
+
VIKING_INTEGRATION_BRAND_SVGS[name] ?? "",
|
|
268
|
+
);
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
protected readonly paths = computed<SafeHtml>(() => {
|
|
272
|
+
const name = this.resolvedName();
|
|
273
|
+
const html =
|
|
274
|
+
this.isFilled() && VIKING_ICON_FILLED_PATHS[name]
|
|
275
|
+
? VIKING_ICON_FILLED_PATHS[name]
|
|
276
|
+
: (VIKING_ICON_PATHS[name] ?? "");
|
|
277
|
+
return this.sanitizer.bypassSecurityTrustHtml(html);
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
constructor(private readonly sanitizer: DomSanitizer) {}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/** Alias for consumers expecting VikingIconComponent. */
|
|
284
|
+
export { VikingIcon as VikingIconComponent };
|