@vadem/ui 0.0.0-stage → 0.0.1
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-lucide.txt +43 -0
- package/README.md +19 -2
- package/fesm2022/vadem-ui-accordion.mjs +139 -0
- package/fesm2022/vadem-ui-accordion.mjs.map +1 -0
- package/fesm2022/vadem-ui-active-filters.mjs +355 -0
- package/fesm2022/vadem-ui-active-filters.mjs.map +1 -0
- package/fesm2022/vadem-ui-alert-dialog.mjs +433 -0
- package/fesm2022/vadem-ui-alert-dialog.mjs.map +1 -0
- package/fesm2022/vadem-ui-alert.mjs +266 -0
- package/fesm2022/vadem-ui-alert.mjs.map +1 -0
- package/fesm2022/vadem-ui-autocomplete.mjs +715 -0
- package/fesm2022/vadem-ui-autocomplete.mjs.map +1 -0
- package/fesm2022/vadem-ui-avatar.mjs +219 -0
- package/fesm2022/vadem-ui-avatar.mjs.map +1 -0
- package/fesm2022/vadem-ui-badge.mjs +86 -0
- package/fesm2022/vadem-ui-badge.mjs.map +1 -0
- package/fesm2022/vadem-ui-breadcrumbs.mjs +61 -0
- package/fesm2022/vadem-ui-breadcrumbs.mjs.map +1 -0
- package/fesm2022/vadem-ui-button.mjs +220 -0
- package/fesm2022/vadem-ui-button.mjs.map +1 -0
- package/fesm2022/vadem-ui-calendar.mjs +1314 -0
- package/fesm2022/vadem-ui-calendar.mjs.map +1 -0
- package/fesm2022/vadem-ui-card.mjs +271 -0
- package/fesm2022/vadem-ui-card.mjs.map +1 -0
- package/fesm2022/vadem-ui-character-count.mjs +269 -0
- package/fesm2022/vadem-ui-character-count.mjs.map +1 -0
- package/fesm2022/vadem-ui-chart.mjs +1984 -0
- package/fesm2022/vadem-ui-chart.mjs.map +1 -0
- package/fesm2022/vadem-ui-checkbox.mjs +67 -0
- package/fesm2022/vadem-ui-checkbox.mjs.map +1 -0
- package/fesm2022/vadem-ui-color-picker.mjs +815 -0
- package/fesm2022/vadem-ui-color-picker.mjs.map +1 -0
- package/fesm2022/vadem-ui-command.mjs +735 -0
- package/fesm2022/vadem-ui-command.mjs.map +1 -0
- package/fesm2022/vadem-ui-copy-button.mjs +375 -0
- package/fesm2022/vadem-ui-copy-button.mjs.map +1 -0
- package/fesm2022/vadem-ui-date-range-picker.mjs +1011 -0
- package/fesm2022/vadem-ui-date-range-picker.mjs.map +1 -0
- package/fesm2022/vadem-ui-description-list.mjs +59 -0
- package/fesm2022/vadem-ui-description-list.mjs.map +1 -0
- package/fesm2022/vadem-ui-dialog.mjs +587 -0
- package/fesm2022/vadem-ui-dialog.mjs.map +1 -0
- package/fesm2022/vadem-ui-dropzone.mjs +176 -0
- package/fesm2022/vadem-ui-dropzone.mjs.map +1 -0
- package/fesm2022/vadem-ui-editable-text.mjs +641 -0
- package/fesm2022/vadem-ui-editable-text.mjs.map +1 -0
- package/fesm2022/vadem-ui-empty-state.mjs +175 -0
- package/fesm2022/vadem-ui-empty-state.mjs.map +1 -0
- package/fesm2022/vadem-ui-expandable-text.mjs +244 -0
- package/fesm2022/vadem-ui-expandable-text.mjs.map +1 -0
- package/fesm2022/vadem-ui-field.mjs +583 -0
- package/fesm2022/vadem-ui-field.mjs.map +1 -0
- package/fesm2022/vadem-ui-file-preview.mjs +532 -0
- package/fesm2022/vadem-ui-file-preview.mjs.map +1 -0
- package/fesm2022/vadem-ui-file-size.mjs +83 -0
- package/fesm2022/vadem-ui-file-size.mjs.map +1 -0
- package/fesm2022/vadem-ui-form-error-summary.mjs +201 -0
- package/fesm2022/vadem-ui-form-error-summary.mjs.map +1 -0
- package/fesm2022/vadem-ui-icon.mjs +303 -0
- package/fesm2022/vadem-ui-icon.mjs.map +1 -0
- package/fesm2022/vadem-ui-input.mjs +120 -0
- package/fesm2022/vadem-ui-input.mjs.map +1 -0
- package/fesm2022/vadem-ui-kbd.mjs +286 -0
- package/fesm2022/vadem-ui-kbd.mjs.map +1 -0
- package/fesm2022/vadem-ui-keyboard.mjs +105 -0
- package/fesm2022/vadem-ui-keyboard.mjs.map +1 -0
- package/fesm2022/vadem-ui-locale.mjs +443 -0
- package/fesm2022/vadem-ui-locale.mjs.map +1 -0
- package/fesm2022/vadem-ui-menu.mjs +637 -0
- package/fesm2022/vadem-ui-menu.mjs.map +1 -0
- package/fesm2022/vadem-ui-navigation-list.mjs +130 -0
- package/fesm2022/vadem-ui-navigation-list.mjs.map +1 -0
- package/fesm2022/vadem-ui-number-input.mjs +264 -0
- package/fesm2022/vadem-ui-number-input.mjs.map +1 -0
- package/fesm2022/vadem-ui-otp-input.mjs +86 -0
- package/fesm2022/vadem-ui-otp-input.mjs.map +1 -0
- package/fesm2022/vadem-ui-pagination.mjs +353 -0
- package/fesm2022/vadem-ui-pagination.mjs.map +1 -0
- package/fesm2022/vadem-ui-password-input.mjs +213 -0
- package/fesm2022/vadem-ui-password-input.mjs.map +1 -0
- package/fesm2022/vadem-ui-popover.mjs +178 -0
- package/fesm2022/vadem-ui-popover.mjs.map +1 -0
- package/fesm2022/vadem-ui-progress.mjs +331 -0
- package/fesm2022/vadem-ui-progress.mjs.map +1 -0
- package/fesm2022/vadem-ui-radio.mjs +39 -0
- package/fesm2022/vadem-ui-radio.mjs.map +1 -0
- package/fesm2022/vadem-ui-range-slider.mjs +561 -0
- package/fesm2022/vadem-ui-range-slider.mjs.map +1 -0
- package/fesm2022/vadem-ui-rating.mjs +404 -0
- package/fesm2022/vadem-ui-rating.mjs.map +1 -0
- package/fesm2022/vadem-ui-relative-time.mjs +217 -0
- package/fesm2022/vadem-ui-relative-time.mjs.map +1 -0
- package/fesm2022/vadem-ui-reorder-list.mjs +601 -0
- package/fesm2022/vadem-ui-reorder-list.mjs.map +1 -0
- package/fesm2022/vadem-ui-scroll-area.mjs +65 -0
- package/fesm2022/vadem-ui-scroll-area.mjs.map +1 -0
- package/fesm2022/vadem-ui-search-input.mjs +307 -0
- package/fesm2022/vadem-ui-search-input.mjs.map +1 -0
- package/fesm2022/vadem-ui-segmented.mjs +297 -0
- package/fesm2022/vadem-ui-segmented.mjs.map +1 -0
- package/fesm2022/vadem-ui-select.mjs +1462 -0
- package/fesm2022/vadem-ui-select.mjs.map +1 -0
- package/fesm2022/vadem-ui-sidebar.mjs +493 -0
- package/fesm2022/vadem-ui-sidebar.mjs.map +1 -0
- package/fesm2022/vadem-ui-skeleton.mjs +106 -0
- package/fesm2022/vadem-ui-skeleton.mjs.map +1 -0
- package/fesm2022/vadem-ui-slider.mjs +60 -0
- package/fesm2022/vadem-ui-slider.mjs.map +1 -0
- package/fesm2022/vadem-ui-splitter.mjs +438 -0
- package/fesm2022/vadem-ui-splitter.mjs.map +1 -0
- package/fesm2022/vadem-ui-stat.mjs +369 -0
- package/fesm2022/vadem-ui-stat.mjs.map +1 -0
- package/fesm2022/vadem-ui-stepper.mjs +483 -0
- package/fesm2022/vadem-ui-stepper.mjs.map +1 -0
- package/fesm2022/vadem-ui-switch.mjs +45 -0
- package/fesm2022/vadem-ui-switch.mjs.map +1 -0
- package/fesm2022/vadem-ui-table.mjs +593 -0
- package/fesm2022/vadem-ui-table.mjs.map +1 -0
- package/fesm2022/vadem-ui-tabs.mjs +405 -0
- package/fesm2022/vadem-ui-tabs.mjs.map +1 -0
- package/fesm2022/vadem-ui-tag-input.mjs +685 -0
- package/fesm2022/vadem-ui-tag-input.mjs.map +1 -0
- package/fesm2022/vadem-ui-text-highlight.mjs +126 -0
- package/fesm2022/vadem-ui-text-highlight.mjs.map +1 -0
- package/fesm2022/vadem-ui-time-input.mjs +430 -0
- package/fesm2022/vadem-ui-time-input.mjs.map +1 -0
- package/fesm2022/vadem-ui-timeline.mjs +313 -0
- package/fesm2022/vadem-ui-timeline.mjs.map +1 -0
- package/fesm2022/vadem-ui-toast.mjs +397 -0
- package/fesm2022/vadem-ui-toast.mjs.map +1 -0
- package/fesm2022/vadem-ui-toolbar.mjs +396 -0
- package/fesm2022/vadem-ui-toolbar.mjs.map +1 -0
- package/fesm2022/vadem-ui-tooltip.mjs +218 -0
- package/fesm2022/vadem-ui-tooltip.mjs.map +1 -0
- package/fesm2022/vadem-ui-tree.mjs +551 -0
- package/fesm2022/vadem-ui-tree.mjs.map +1 -0
- package/fesm2022/vadem-ui-upload-list.mjs +408 -0
- package/fesm2022/vadem-ui-upload-list.mjs.map +1 -0
- package/fesm2022/vadem-ui.mjs +4 -0
- package/fesm2022/vadem-ui.mjs.map +1 -0
- package/fonts/jetbrains-mono/OFL.txt +93 -0
- package/fonts/jetbrains-mono/jetbrains-mono-cyrillic.woff2 +0 -0
- package/fonts/jetbrains-mono/jetbrains-mono-latin.woff2 +0 -0
- package/fonts/manrope/OFL.txt +93 -0
- package/fonts/manrope/manrope-cyrillic.woff2 +0 -0
- package/fonts/manrope/manrope-latin.woff2 +0 -0
- package/package.json +306 -3
- package/styles/base.css +160 -0
- package/styles/components/accordion.css +130 -0
- package/styles/components/active-filters.css +42 -0
- package/styles/components/alert-dialog.css +34 -0
- package/styles/components/alert.css +159 -0
- package/styles/components/autocomplete.css +97 -0
- package/styles/components/avatar.css +90 -0
- package/styles/components/badge.css +91 -0
- package/styles/components/breadcrumbs.css +94 -0
- package/styles/components/button.css +174 -0
- package/styles/components/calendar.css +186 -0
- package/styles/components/card.css +206 -0
- package/styles/components/character-count.css +41 -0
- package/styles/components/chart.css +308 -0
- package/styles/components/checkbox.css +115 -0
- package/styles/components/color-picker.css +158 -0
- package/styles/components/command.css +175 -0
- package/styles/components/copy-button.css +58 -0
- package/styles/components/date-range-picker.css +153 -0
- package/styles/components/description-list.css +69 -0
- package/styles/components/dialog.css +334 -0
- package/styles/components/dropzone.css +89 -0
- package/styles/components/editable-text.css +58 -0
- package/styles/components/empty-state.css +72 -0
- package/styles/components/expandable-text.css +24 -0
- package/styles/components/field.css +148 -0
- package/styles/components/file-preview.css +65 -0
- package/styles/components/form-error-summary.css +71 -0
- package/styles/components/icon.css +38 -0
- package/styles/components/index.css +80 -0
- package/styles/components/input.css +171 -0
- package/styles/components/kbd.css +42 -0
- package/styles/components/menu.css +168 -0
- package/styles/components/multi-select.css +156 -0
- package/styles/components/navigation-list.css +147 -0
- package/styles/components/number-input.css +33 -0
- package/styles/components/otp-input.css +26 -0
- package/styles/components/pagination.css +127 -0
- package/styles/components/password-input.css +20 -0
- package/styles/components/popover.css +93 -0
- package/styles/components/progress-ring.css +112 -0
- package/styles/components/progress.css +162 -0
- package/styles/components/radio.css +117 -0
- package/styles/components/range-slider.css +158 -0
- package/styles/components/rating.css +100 -0
- package/styles/components/reorder-list.css +143 -0
- package/styles/components/scroll-area.css +39 -0
- package/styles/components/search-input.css +25 -0
- package/styles/components/segmented.css +136 -0
- package/styles/components/select.css +257 -0
- package/styles/components/sidebar.css +105 -0
- package/styles/components/skeleton.css +83 -0
- package/styles/components/slider.css +132 -0
- package/styles/components/splitter.css +83 -0
- package/styles/components/stat.css +62 -0
- package/styles/components/stepper.css +236 -0
- package/styles/components/switch.css +107 -0
- package/styles/components/table.css +195 -0
- package/styles/components/tabs.css +198 -0
- package/styles/components/tag-input.css +138 -0
- package/styles/components/text-highlight.css +22 -0
- package/styles/components/time-input.css +96 -0
- package/styles/components/timeline.css +182 -0
- package/styles/components/toast.css +146 -0
- package/styles/components/toolbar.css +72 -0
- package/styles/components/tooltip.css +93 -0
- package/styles/components/tree.css +88 -0
- package/styles/components/upload-list.css +113 -0
- package/styles/fonts.css +67 -0
- package/styles/index.css +14 -0
- package/styles/reset.css +57 -0
- package/styles/tokens/primitives.css +364 -0
- package/styles/tokens/semantic.css +233 -0
- package/types/vadem-ui-accordion.d.ts +43 -0
- package/types/vadem-ui-active-filters.d.ts +73 -0
- package/types/vadem-ui-alert-dialog.d.ts +87 -0
- package/types/vadem-ui-alert.d.ts +64 -0
- package/types/vadem-ui-autocomplete.d.ts +156 -0
- package/types/vadem-ui-avatar.d.ts +59 -0
- package/types/vadem-ui-badge.d.ts +25 -0
- package/types/vadem-ui-breadcrumbs.d.ts +22 -0
- package/types/vadem-ui-button.d.ts +52 -0
- package/types/vadem-ui-calendar.d.ts +327 -0
- package/types/vadem-ui-card.d.ts +58 -0
- package/types/vadem-ui-character-count.d.ts +71 -0
- package/types/vadem-ui-chart.d.ts +452 -0
- package/types/vadem-ui-checkbox.d.ts +20 -0
- package/types/vadem-ui-color-picker.d.ts +171 -0
- package/types/vadem-ui-command.d.ts +145 -0
- package/types/vadem-ui-copy-button.d.ts +90 -0
- package/types/vadem-ui-date-range-picker.d.ts +216 -0
- package/types/vadem-ui-description-list.d.ts +15 -0
- package/types/vadem-ui-dialog.d.ts +174 -0
- package/types/vadem-ui-dropzone.d.ts +73 -0
- package/types/vadem-ui-editable-text.d.ts +141 -0
- package/types/vadem-ui-empty-state.d.ts +34 -0
- package/types/vadem-ui-expandable-text.d.ts +52 -0
- package/types/vadem-ui-field.d.ts +180 -0
- package/types/vadem-ui-file-preview.d.ts +108 -0
- package/types/vadem-ui-file-size.d.ts +18 -0
- package/types/vadem-ui-form-error-summary.d.ts +46 -0
- package/types/vadem-ui-icon.d.ts +152 -0
- package/types/vadem-ui-input.d.ts +31 -0
- package/types/vadem-ui-kbd.d.ts +66 -0
- package/types/vadem-ui-keyboard.d.ts +61 -0
- package/types/vadem-ui-locale.d.ts +241 -0
- package/types/vadem-ui-menu.d.ts +132 -0
- package/types/vadem-ui-navigation-list.d.ts +28 -0
- package/types/vadem-ui-number-input.d.ts +39 -0
- package/types/vadem-ui-otp-input.d.ts +15 -0
- package/types/vadem-ui-pagination.d.ts +96 -0
- package/types/vadem-ui-password-input.d.ts +36 -0
- package/types/vadem-ui-popover.d.ts +48 -0
- package/types/vadem-ui-progress.d.ts +95 -0
- package/types/vadem-ui-radio.d.ts +11 -0
- package/types/vadem-ui-range-slider.d.ts +136 -0
- package/types/vadem-ui-rating.d.ts +95 -0
- package/types/vadem-ui-relative-time.d.ts +58 -0
- package/types/vadem-ui-reorder-list.d.ts +120 -0
- package/types/vadem-ui-scroll-area.d.ts +13 -0
- package/types/vadem-ui-search-input.d.ts +58 -0
- package/types/vadem-ui-segmented.d.ts +76 -0
- package/types/vadem-ui-select.d.ts +303 -0
- package/types/vadem-ui-sidebar.d.ts +70 -0
- package/types/vadem-ui-skeleton.d.ts +28 -0
- package/types/vadem-ui-slider.d.ts +17 -0
- package/types/vadem-ui-splitter.d.ts +99 -0
- package/types/vadem-ui-stat.d.ts +101 -0
- package/types/vadem-ui-stepper.d.ts +108 -0
- package/types/vadem-ui-switch.d.ts +10 -0
- package/types/vadem-ui-table.d.ts +172 -0
- package/types/vadem-ui-tabs.d.ts +101 -0
- package/types/vadem-ui-tag-input.d.ts +170 -0
- package/types/vadem-ui-text-highlight.d.ts +27 -0
- package/types/vadem-ui-time-input.d.ts +47 -0
- package/types/vadem-ui-timeline.d.ts +54 -0
- package/types/vadem-ui-toast.d.ts +104 -0
- package/types/vadem-ui-toolbar.d.ts +80 -0
- package/types/vadem-ui-tooltip.d.ts +71 -0
- package/types/vadem-ui-tree.d.ts +123 -0
- package/types/vadem-ui-upload-list.d.ts +70 -0
- package/types/vadem-ui.d.ts +1 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, Directive, ElementRef, ViewEncapsulation, booleanAttribute, computed, inject, input, output } from "@angular/core";
|
|
3
|
+
import { VdButton } from "@vadem/ui/button";
|
|
4
|
+
import { VdIcon } from "@vadem/ui/icon";
|
|
5
|
+
import { vdTexts } from "@vadem/ui/locale";
|
|
6
|
+
const TABBABLE = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])";
|
|
7
|
+
function neighbourFocusTarget(host) {
|
|
8
|
+
const candidates = Array.from(host.ownerDocument.querySelectorAll(TABBABLE)).filter((el) => !host.contains(el) && el.getClientRects().length > 0 && !el.closest("[inert]"));
|
|
9
|
+
return candidates.find((el) => host.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_FOLLOWING) ?? candidates.reverse().find((el) => host.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_PRECEDING) ?? null;
|
|
10
|
+
}
|
|
11
|
+
const ICONS = {
|
|
12
|
+
neutral: "info",
|
|
13
|
+
info: "info",
|
|
14
|
+
success: "check-circle",
|
|
15
|
+
warning: "alert-triangle",
|
|
16
|
+
danger: "alert-circle"
|
|
17
|
+
};
|
|
18
|
+
var VdAlert = class VdAlert {
|
|
19
|
+
variant = input("neutral", ...ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []);
|
|
20
|
+
icon = input(void 0, ...ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []);
|
|
21
|
+
layout = input("inline", ...ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []);
|
|
22
|
+
dismissible = input(false, {
|
|
23
|
+
...ngDevMode ? { debugName: "dismissible" } : /* istanbul ignore next */ {},
|
|
24
|
+
transform: booleanAttribute
|
|
25
|
+
});
|
|
26
|
+
dismissLabel = input(...ngDevMode ? [void 0, { debugName: "dismissLabel" }] : /* istanbul ignore next */ []);
|
|
27
|
+
dismiss = output();
|
|
28
|
+
t = vdTexts("alert", { dismissLabel: this.dismissLabel });
|
|
29
|
+
el = inject(ElementRef).nativeElement;
|
|
30
|
+
onDismiss() {
|
|
31
|
+
if (this.el.contains(this.el.ownerDocument.activeElement)) neighbourFocusTarget(this.el)?.focus();
|
|
32
|
+
this.dismiss.emit();
|
|
33
|
+
}
|
|
34
|
+
iconName = computed(() => {
|
|
35
|
+
const icon = this.icon();
|
|
36
|
+
return icon === void 0 ? ICONS[this.variant()] : icon;
|
|
37
|
+
}, ...ngDevMode ? [{ debugName: "iconName" }] : /* istanbul ignore next */ []);
|
|
38
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
39
|
+
minVersion: "12.0.0",
|
|
40
|
+
version: "22.2.1",
|
|
41
|
+
ngImport: i0,
|
|
42
|
+
type: VdAlert,
|
|
43
|
+
deps: [],
|
|
44
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
45
|
+
});
|
|
46
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
47
|
+
minVersion: "17.0.0",
|
|
48
|
+
version: "22.2.1",
|
|
49
|
+
type: VdAlert,
|
|
50
|
+
isStandalone: true,
|
|
51
|
+
selector: "[vdAlert]",
|
|
52
|
+
inputs: {
|
|
53
|
+
variant: {
|
|
54
|
+
classPropertyName: "variant",
|
|
55
|
+
publicName: "variant",
|
|
56
|
+
isSignal: true,
|
|
57
|
+
isRequired: false,
|
|
58
|
+
transformFunction: null
|
|
59
|
+
},
|
|
60
|
+
icon: {
|
|
61
|
+
classPropertyName: "icon",
|
|
62
|
+
publicName: "icon",
|
|
63
|
+
isSignal: true,
|
|
64
|
+
isRequired: false,
|
|
65
|
+
transformFunction: null
|
|
66
|
+
},
|
|
67
|
+
layout: {
|
|
68
|
+
classPropertyName: "layout",
|
|
69
|
+
publicName: "layout",
|
|
70
|
+
isSignal: true,
|
|
71
|
+
isRequired: false,
|
|
72
|
+
transformFunction: null
|
|
73
|
+
},
|
|
74
|
+
dismissible: {
|
|
75
|
+
classPropertyName: "dismissible",
|
|
76
|
+
publicName: "dismissible",
|
|
77
|
+
isSignal: true,
|
|
78
|
+
isRequired: false,
|
|
79
|
+
transformFunction: null
|
|
80
|
+
},
|
|
81
|
+
dismissLabel: {
|
|
82
|
+
classPropertyName: "dismissLabel",
|
|
83
|
+
publicName: "dismissLabel",
|
|
84
|
+
isSignal: true,
|
|
85
|
+
isRequired: false,
|
|
86
|
+
transformFunction: null
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
outputs: { dismiss: "dismiss" },
|
|
90
|
+
host: {
|
|
91
|
+
properties: {
|
|
92
|
+
"attr.data-variant": "variant()",
|
|
93
|
+
"attr.data-layout": "layout() === \"banner\" ? \"banner\" : null"
|
|
94
|
+
},
|
|
95
|
+
classAttribute: "vd-alert"
|
|
96
|
+
},
|
|
97
|
+
ngImport: i0,
|
|
98
|
+
template: `
|
|
99
|
+
@if (iconName(); as name) {
|
|
100
|
+
<vd-icon [name]="name" class="vd-alert__icon" />
|
|
101
|
+
}
|
|
102
|
+
<div class="vd-alert__content"><ng-content /></div>
|
|
103
|
+
<ng-content select="[slot=end]" />
|
|
104
|
+
@if (dismissible()) {
|
|
105
|
+
<button
|
|
106
|
+
vdButton
|
|
107
|
+
type="button"
|
|
108
|
+
variant="ghost"
|
|
109
|
+
size="sm"
|
|
110
|
+
iconOnly
|
|
111
|
+
slot="end"
|
|
112
|
+
class="vd-alert__dismiss"
|
|
113
|
+
[attr.aria-label]="t().dismissLabel"
|
|
114
|
+
(click)="onDismiss()"
|
|
115
|
+
>
|
|
116
|
+
<vd-icon name="x" />
|
|
117
|
+
</button>
|
|
118
|
+
}
|
|
119
|
+
`,
|
|
120
|
+
isInline: true,
|
|
121
|
+
dependencies: [{
|
|
122
|
+
kind: "component",
|
|
123
|
+
type: VdButton,
|
|
124
|
+
selector: "button[vdButton], a[vdButton]",
|
|
125
|
+
inputs: [
|
|
126
|
+
"variant",
|
|
127
|
+
"size",
|
|
128
|
+
"disabled",
|
|
129
|
+
"loading",
|
|
130
|
+
"iconOnly",
|
|
131
|
+
"type"
|
|
132
|
+
]
|
|
133
|
+
}, {
|
|
134
|
+
kind: "component",
|
|
135
|
+
type: VdIcon,
|
|
136
|
+
selector: "vd-icon",
|
|
137
|
+
inputs: ["name", "label"]
|
|
138
|
+
}],
|
|
139
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
140
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
144
|
+
minVersion: "12.0.0",
|
|
145
|
+
version: "22.2.1",
|
|
146
|
+
ngImport: i0,
|
|
147
|
+
type: VdAlert,
|
|
148
|
+
decorators: [{
|
|
149
|
+
type: Component,
|
|
150
|
+
args: [{
|
|
151
|
+
selector: "[vdAlert]",
|
|
152
|
+
imports: [VdButton, VdIcon],
|
|
153
|
+
template: `
|
|
154
|
+
@if (iconName(); as name) {
|
|
155
|
+
<vd-icon [name]="name" class="vd-alert__icon" />
|
|
156
|
+
}
|
|
157
|
+
<div class="vd-alert__content"><ng-content /></div>
|
|
158
|
+
<ng-content select="[slot=end]" />
|
|
159
|
+
@if (dismissible()) {
|
|
160
|
+
<button
|
|
161
|
+
vdButton
|
|
162
|
+
type="button"
|
|
163
|
+
variant="ghost"
|
|
164
|
+
size="sm"
|
|
165
|
+
iconOnly
|
|
166
|
+
slot="end"
|
|
167
|
+
class="vd-alert__dismiss"
|
|
168
|
+
[attr.aria-label]="t().dismissLabel"
|
|
169
|
+
(click)="onDismiss()"
|
|
170
|
+
>
|
|
171
|
+
<vd-icon name="x" />
|
|
172
|
+
</button>
|
|
173
|
+
}
|
|
174
|
+
`,
|
|
175
|
+
host: {
|
|
176
|
+
class: "vd-alert",
|
|
177
|
+
"[attr.data-variant]": "variant()",
|
|
178
|
+
"[attr.data-layout]": "layout() === \"banner\" ? \"banner\" : null"
|
|
179
|
+
},
|
|
180
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
181
|
+
encapsulation: ViewEncapsulation.None
|
|
182
|
+
}]
|
|
183
|
+
}],
|
|
184
|
+
propDecorators: {
|
|
185
|
+
variant: [{
|
|
186
|
+
type: i0.Input,
|
|
187
|
+
args: [{
|
|
188
|
+
isSignal: true,
|
|
189
|
+
alias: "variant",
|
|
190
|
+
required: false
|
|
191
|
+
}]
|
|
192
|
+
}],
|
|
193
|
+
icon: [{
|
|
194
|
+
type: i0.Input,
|
|
195
|
+
args: [{
|
|
196
|
+
isSignal: true,
|
|
197
|
+
alias: "icon",
|
|
198
|
+
required: false
|
|
199
|
+
}]
|
|
200
|
+
}],
|
|
201
|
+
layout: [{
|
|
202
|
+
type: i0.Input,
|
|
203
|
+
args: [{
|
|
204
|
+
isSignal: true,
|
|
205
|
+
alias: "layout",
|
|
206
|
+
required: false
|
|
207
|
+
}]
|
|
208
|
+
}],
|
|
209
|
+
dismissible: [{
|
|
210
|
+
type: i0.Input,
|
|
211
|
+
args: [{
|
|
212
|
+
isSignal: true,
|
|
213
|
+
alias: "dismissible",
|
|
214
|
+
required: false
|
|
215
|
+
}]
|
|
216
|
+
}],
|
|
217
|
+
dismissLabel: [{
|
|
218
|
+
type: i0.Input,
|
|
219
|
+
args: [{
|
|
220
|
+
isSignal: true,
|
|
221
|
+
alias: "dismissLabel",
|
|
222
|
+
required: false
|
|
223
|
+
}]
|
|
224
|
+
}],
|
|
225
|
+
dismiss: [{
|
|
226
|
+
type: i0.Output,
|
|
227
|
+
args: ["dismiss"]
|
|
228
|
+
}]
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
var VdAlertTitle = class VdAlertTitle {
|
|
232
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
233
|
+
minVersion: "12.0.0",
|
|
234
|
+
version: "22.2.1",
|
|
235
|
+
ngImport: i0,
|
|
236
|
+
type: VdAlertTitle,
|
|
237
|
+
deps: [],
|
|
238
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
239
|
+
});
|
|
240
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
241
|
+
minVersion: "14.0.0",
|
|
242
|
+
version: "22.2.1",
|
|
243
|
+
type: VdAlertTitle,
|
|
244
|
+
isStandalone: true,
|
|
245
|
+
selector: "[vdAlertTitle]",
|
|
246
|
+
host: { classAttribute: "vd-alert__title" },
|
|
247
|
+
ngImport: i0
|
|
248
|
+
});
|
|
249
|
+
};
|
|
250
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
251
|
+
minVersion: "12.0.0",
|
|
252
|
+
version: "22.2.1",
|
|
253
|
+
ngImport: i0,
|
|
254
|
+
type: VdAlertTitle,
|
|
255
|
+
decorators: [{
|
|
256
|
+
type: Directive,
|
|
257
|
+
args: [{
|
|
258
|
+
selector: "[vdAlertTitle]",
|
|
259
|
+
host: { class: "vd-alert__title" }
|
|
260
|
+
}]
|
|
261
|
+
}]
|
|
262
|
+
});
|
|
263
|
+
const VD_ALERT = [VdAlert, VdAlertTitle];
|
|
264
|
+
export { VD_ALERT, VdAlert, VdAlertTitle };
|
|
265
|
+
|
|
266
|
+
//# sourceMappingURL=vadem-ui-alert.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vadem-ui-alert.mjs","names":[],"sources":["../../../projects/ui/alert/src/alert.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n Directive,\n ElementRef,\n ViewEncapsulation,\n booleanAttribute,\n computed,\n inject,\n input,\n output,\n} from '@angular/core';\nimport { VdButton } from '@vadem/ui/button';\nimport { VdIcon, VdIconName } from '@vadem/ui/icon';\nimport { vdTexts } from '@vadem/ui/locale';\n\nexport type VdAlertVariant = 'neutral' | 'info' | 'success' | 'warning' | 'danger';\n/** `banner`: full-width strip at the top of a page or region (maintenance, cookies, updates). */\nexport type VdAlertLayout = 'inline' | 'banner';\n\nconst TABBABLE =\n 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\n/** The next tabbable element after `host` in document order, else the previous one. */\nfunction neighbourFocusTarget(host: HTMLElement): HTMLElement | null {\n const candidates = Array.from(host.ownerDocument.querySelectorAll<HTMLElement>(TABBABLE)).filter(\n (el) => !host.contains(el) && el.getClientRects().length > 0 && !el.closest('[inert]'),\n );\n const after = candidates.find(\n (el) => host.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_FOLLOWING,\n );\n return (\n after ??\n candidates\n .reverse()\n .find((el) => host.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_PRECEDING) ??\n null\n );\n}\n\nconst ICONS: Record<VdAlertVariant, VdIconName> = {\n neutral: 'info',\n info: 'info',\n success: 'check-circle',\n warning: 'alert-triangle',\n danger: 'alert-circle',\n};\n\n/**\n * Inline message in the page flow (callout). Static by default; add `role=\"alert\"` (urgent) or\n * `role=\"status\"` when it appears in response to an action. Spec: specs/alert.md\n */\n@Component({\n // Attribute selector: the consumer picks the element (div, section, li...).\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: '[vdAlert]',\n imports: [VdButton, VdIcon],\n template: `\n @if (iconName(); as name) {\n <vd-icon [name]=\"name\" class=\"vd-alert__icon\" />\n }\n <div class=\"vd-alert__content\"><ng-content /></div>\n <ng-content select=\"[slot=end]\" />\n @if (dismissible()) {\n <button\n vdButton\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n iconOnly\n slot=\"end\"\n class=\"vd-alert__dismiss\"\n [attr.aria-label]=\"t().dismissLabel\"\n (click)=\"onDismiss()\"\n >\n <vd-icon name=\"x\" />\n </button>\n }\n `,\n host: {\n class: 'vd-alert',\n '[attr.data-variant]': 'variant()',\n '[attr.data-layout]': 'layout() === \"banner\" ? \"banner\" : null',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n})\nexport class VdAlert {\n readonly variant = input<VdAlertVariant>('neutral');\n /** Leading icon; defaults to the variant's icon. `null` hides it. */\n readonly icon = input<VdIconName | null | undefined>(undefined);\n readonly layout = input<VdAlertLayout>('inline');\n /** Adds a close button. The consumer removes the alert (and remembers the choice) on `dismiss`. */\n readonly dismissible = input(false, { transform: booleanAttribute });\n readonly dismissLabel = input<string>();\n /** Emitted when the close button is activated; focus has already moved to a neighbour. */\n readonly dismiss = output<void>();\n\n /** Text inputs resolved against the active VD_LOCALE. */\n protected readonly t = vdTexts('alert', { dismissLabel: this.dismissLabel });\n private readonly el: HTMLElement = inject(ElementRef).nativeElement;\n\n /** Removing a focused element drops focus to <body>; hand it to the next control first. */\n protected onDismiss(): void {\n if (this.el.contains(this.el.ownerDocument.activeElement))\n neighbourFocusTarget(this.el)?.focus();\n this.dismiss.emit();\n }\n\n protected readonly iconName = computed(() => {\n const icon = this.icon();\n return icon === undefined ? ICONS[this.variant()] : icon;\n });\n}\n\n/** Bold first line of an alert. */\n@Directive({ selector: '[vdAlertTitle]', host: { class: 'vd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