@ids-group-ltd/ids-design-system 1.1.2 → 1.2.0
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/CHANGELOG.md +755 -0
- package/agent/INDEX.md +8 -7
- package/agent/charts/ds-scatter-chart.md +1 -1
- package/agent/feedback/ds-badge.md +2 -2
- package/agent/feedback/ds-chat-message.md +1 -1
- package/agent/feedback/ds-chat-step.md +2 -2
- package/agent/feedback/ds-chat-thread.md +1 -1
- package/agent/feedback/ds-stat.md +1 -1
- package/agent/feedback/ds-toast.md +2 -2
- package/agent/feedback/ds-tree.md +1 -1
- package/agent/forms/ds-button.md +3 -3
- package/agent/forms/ds-dropzone.md +1 -1
- package/agent/forms/ds-icon-button.md +3 -3
- package/agent/forms/ds-number-stepper.md +3 -3
- package/agent/forms/ds-search.md +1 -1
- package/agent/forms/ds-split-button.md +1 -1
- package/agent/foundations/tokens.md +4 -3
- package/agent/navigation/ds-app-layout.md +1 -1
- package/agent/navigation/ds-nav-divider.md +6 -0
- package/agent/navigation/{ds-sidenav-footer.md → ds-nav-footer.md} +3 -3
- package/agent/navigation/{ds-sidenav-group.md → ds-nav-group.md} +2 -2
- package/agent/navigation/{ds-sidenav-item.md → ds-nav-item.md} +6 -6
- package/agent/navigation/ds-nav.md +15 -0
- package/agent/overlays/ds-drawer.md +1 -1
- package/agent/platform/toast-service.md +1 -1
- package/components/README.md +24 -24
- package/components.md +51 -45
- package/design-system.md +8 -7
- package/eslint/deprecated-api.json +108 -7
- package/fesm2022/ids-group-ltd-ids-design-system-components-accordion.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-accordion.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-alert.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-alert.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-app-layout.mjs +4 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-app-layout.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-auth-layout.mjs +4 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-auth-layout.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-badge-badge-count-roll.component-BDNXADJZ.mjs +182 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-badge-badge-count-roll.component-BDNXADJZ.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-badge.mjs +37 -8
- package/fesm2022/ids-group-ltd-ids-design-system-components-badge.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-banner.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-banner.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-breadcrumbs.mjs +5 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-button-group.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-button-group.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs +76 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-calendar-day.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-legend.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-legend.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-tooltip.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-tooltip.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chat.mjs +77 -18
- package/fesm2022/ids-group-ltd-ids-design-system-components-chat.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-checkbox.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-checkbox.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-definition-term.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-definition-term.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-description-list.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-description-list.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-drawer.mjs +65 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-drawer.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-dropzone.mjs +76 -9
- package/fesm2022/ids-group-ltd-ids-design-system-components-dropzone.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-field-group.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-field-group.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-funnel-chart.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-heatmap-chart.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-heatmap-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-icon-button.mjs +6 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-icon-button.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-info-hint.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-info-hint.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-inline-edit.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-inline-edit.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-list.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-menu.mjs +4 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-menu.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-nav-footer.mjs +113 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-nav-footer.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-nav.mjs +228 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-nav.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-number-stepper.mjs +61 -10
- package/fesm2022/ids-group-ltd-ids-design-system-components-number-stepper.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-pagination.mjs +36 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-pagination.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-pie-chart.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-radio-group.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-radio-group.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-reveal.mjs +56 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-reveal.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-scatter-chart.mjs +10 -39
- package/fesm2022/ids-group-ltd-ids-design-system-components-scatter-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-search.mjs +7 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-search.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-segmented.mjs +33 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-segmented.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav-footer.mjs +4 -98
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav-footer.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav.mjs +11 -179
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-skeleton.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-skeleton.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-slider.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-slider.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-split-button.mjs +3 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-split-button.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-stat.mjs +68 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components-stat.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-stepper.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-stepper.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-switch.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-switch.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-table-columns.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-table-columns.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tabs.mjs +41 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-tabs.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tag.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-tag.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs +6 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs +4 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-timeline.mjs +27 -7
- package/fesm2022/ids-group-ltd-ids-design-system-components-timeline.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-toast.mjs +54 -19
- package/fesm2022/ids-group-ltd-ids-design-system-components-toast.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-toggle-button.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-toggle-button.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs +8 -7
- package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tree.mjs +21 -11
- package/fesm2022/ids-group-ltd-ids-design-system-components-tree.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-w3w.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-w3w.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs +153 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs +11 -0
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system.mjs +4 -1
- package/fesm2022/ids-group-ltd-ids-design-system.mjs.map +1 -1
- package/migrations/1.1.1.json +14 -4
- package/migrations/1.1.2.json +11 -3
- package/migrations/1.2.0.json +1433 -0
- package/migrations/README.md +8 -1
- package/package.json +25 -1
- package/schematics/check-overrides/index.cjs +28 -3
- package/schematics/check-overrides/scan.cjs +151 -2
- package/schematics/check-overrides/schema.json +4 -0
- package/schematics/check-overrides/surface.json +389 -74
- package/schematics/collection.json +1 -1
- package/stylelint/deprecated-tokens.json +7 -0
- package/styles/_check-box.scss +4 -3
- package/styles/_dropdown-overlay.scss +6 -8
- package/styles/_ds-color.scss +7 -2
- package/styles/_field-state.scss +4 -2
- package/styles/_focus.scss +12 -5
- package/styles/_link.scss +4 -4
- package/styles/_optical-center.scss +29 -0
- package/styles/_reveal.scss +8 -0
- package/styles/_status.scss +17 -7
- package/styles/_step-marker.scss +192 -6
- package/styles/_surface-level.scss +16 -0
- package/styles/_text-shimmer.scss +21 -0
- package/styles/_theme-activation.scss +17 -4
- package/styles/_tokens.scss +26 -7
- package/styles/ds.scss +1 -0
- package/themes/README.md +16 -21
- package/themes/_semantic.scss +129 -64
- package/themes/dark/_theme.scss +17 -25
- package/types/ids-group-ltd-ids-design-system-components-app-layout.d.ts +3 -3
- package/types/ids-group-ltd-ids-design-system-components-auth-layout.d.ts +2 -2
- package/types/ids-group-ltd-ids-design-system-components-badge.d.ts +20 -1
- package/types/ids-group-ltd-ids-design-system-components-button.d.ts +14 -3
- package/types/ids-group-ltd-ids-design-system-components-chat.d.ts +49 -4
- package/types/ids-group-ltd-ids-design-system-components-drawer.d.ts +9 -1
- package/types/ids-group-ltd-ids-design-system-components-dropzone.d.ts +28 -2
- package/types/ids-group-ltd-ids-design-system-components-icon-button.d.ts +8 -5
- package/types/ids-group-ltd-ids-design-system-components-nav-footer.d.ts +88 -0
- package/types/ids-group-ltd-ids-design-system-components-nav.d.ts +152 -0
- package/types/ids-group-ltd-ids-design-system-components-number-stepper.d.ts +21 -3
- package/types/ids-group-ltd-ids-design-system-components-pagination.d.ts +1 -0
- package/types/ids-group-ltd-ids-design-system-components-reveal.d.ts +31 -0
- package/types/ids-group-ltd-ids-design-system-components-scatter-chart.d.ts +2 -8
- package/types/ids-group-ltd-ids-design-system-components-search.d.ts +4 -1
- package/types/ids-group-ltd-ids-design-system-components-segmented.d.ts +3 -0
- package/types/ids-group-ltd-ids-design-system-components-sidenav-footer.d.ts +12 -83
- package/types/ids-group-ltd-ids-design-system-components-sidenav.d.ts +21 -131
- package/types/ids-group-ltd-ids-design-system-components-split-button.d.ts +1 -1
- package/types/ids-group-ltd-ids-design-system-components-stat.d.ts +10 -1
- package/types/ids-group-ltd-ids-design-system-components-tabs.d.ts +1 -0
- package/types/ids-group-ltd-ids-design-system-components-textarea.d.ts +1 -1
- package/types/ids-group-ltd-ids-design-system-components-timeline.d.ts +3 -1
- package/types/ids-group-ltd-ids-design-system-components-toast.d.ts +27 -6
- package/types/ids-group-ltd-ids-design-system-components-tree.d.ts +9 -5
- package/types/ids-group-ltd-ids-design-system-components.d.ts +26 -1
- package/types/ids-group-ltd-ids-design-system-core.d.ts +19 -1
- package/types/ids-group-ltd-ids-design-system.d.ts +7 -4
- package/agent/navigation/ds-sidenav.md +0 -13
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, input, model, inject, computed, ViewEncapsulation, Component, contentChildren, forwardRef } from '@angular/core';
|
|
2
|
+
import { InjectionToken, input, model, inject, computed, signal, afterNextRender, ElementRef, afterRenderEffect, effect, untracked, ViewEncapsulation, Component, contentChildren, forwardRef } from '@angular/core';
|
|
3
3
|
import { IconComponent } from '@ids-group-ltd/ids-design-system/icons';
|
|
4
4
|
import { SpinnerComponent } from '@ids-group-ltd/ids-design-system/components/spinner';
|
|
5
|
+
import { prepareMarkerStrokes, centreMarkerGlyphs, startMarkerArc, holdMarkerArc } from '@ids-group-ltd/ids-design-system/components';
|
|
5
6
|
import { DS_INTL, DS_INTL_DEFAULTS } from '@ids-group-ltd/ids-design-system/core';
|
|
6
7
|
|
|
7
8
|
const TIMELINE = new InjectionToken('TIMELINE');
|
|
@@ -29,10 +30,28 @@ class TimelineItemComponent {
|
|
|
29
30
|
detailsId = `ds-timeline-item-${++nextId}-details`;
|
|
30
31
|
isFirst = computed(() => this.timeline?.firstItem() === this, ...(ngDevMode ? [{ debugName: "isFirst" }] : /* istanbul ignore next */ []));
|
|
31
32
|
isLast = computed(() => this.timeline?.lastItem() === this, ...(ngDevMode ? [{ debugName: "isLast" }] : /* istanbul ignore next */ []));
|
|
32
|
-
|
|
33
|
+
nodeIcons = computed(() => {
|
|
33
34
|
const status = this.status();
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
const icon = status ? STATUS_ICONS[status] : this.icon();
|
|
36
|
+
return icon ? [icon] : [];
|
|
37
|
+
}, ...(ngDevMode ? [{ debugName: "nodeIcons" }] : /* istanbul ignore next */ []));
|
|
38
|
+
// The marker animates only status changes, never its first paint.
|
|
39
|
+
settled = signal(false, ...(ngDevMode ? [{ debugName: "settled" }] : /* istanbul ignore next */ []));
|
|
40
|
+
constructor() {
|
|
41
|
+
afterNextRender(() => this.settled.set(true));
|
|
42
|
+
const host = inject(ElementRef).nativeElement;
|
|
43
|
+
afterRenderEffect(() => {
|
|
44
|
+
this.nodeIcons();
|
|
45
|
+
prepareMarkerStrokes(host);
|
|
46
|
+
centreMarkerGlyphs(host);
|
|
47
|
+
startMarkerArc(host);
|
|
48
|
+
});
|
|
49
|
+
// A component effect runs before its view refreshes, while the spinner is still there.
|
|
50
|
+
effect(() => {
|
|
51
|
+
this.status();
|
|
52
|
+
untracked(() => holdMarkerArc(host));
|
|
53
|
+
});
|
|
54
|
+
}
|
|
36
55
|
wording = computed(() => ({
|
|
37
56
|
...DS_INTL_DEFAULTS.timeline,
|
|
38
57
|
...this.intl().timeline,
|
|
@@ -46,7 +65,7 @@ class TimelineItemComponent {
|
|
|
46
65
|
this.expanded.set(!this.expanded());
|
|
47
66
|
}
|
|
48
67
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: TimelineItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
49
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: TimelineItemComponent, isStandalone: true, selector: "ds-timeline-item", inputs: { heading: { classPropertyName: "heading", publicName: "heading", isSignal: true, isRequired: false, transformFunction: null }, time: { classPropertyName: "time", publicName: "time", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, tone: { classPropertyName: "tone", publicName: "tone", isSignal: true, isRequired: false, transformFunction: null }, status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: false, transformFunction: null }, expanded: { classPropertyName: "expanded", publicName: "expanded", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { expanded: "expandedChange" }, host: { attributes: { "role": "listitem" }, properties: { "attr.data-tone": "tone()", "attr.data-status": "status()", "class.is-first": "isFirst()", "class.is-last": "isLast()", "class.is-expanded": "expanded()", "class.outside-timeline": "!timeline" } }, ngImport: i0, template: "<div\n class=\"node-col\"\n aria-hidden=\"true\">\n <span class=\"spine lead\"></span>\n\n <span class=\"node\">\n @if (status() === 'running') {\n <ds-spinner size=\"md\" />\n } @else if (nodeIcon(); as name) {\n <ds-icon\n [name]=\"name\"\n [size]=\"16\"\n [stroke]=\"3\" />\n }\n </span>\n\n <span class=\"spine\"></span>\n</div>\n\n<div class=\"text\">\n <div class=\"head\">\n @if (statusLabel()) {\n <span class=\"visually-hidden\">\n {{ statusLabel() }}:\n </span>\n }\n\n @if (heading()) {\n <span class=\"heading\">\n {{ heading() }}\n </span>\n }\n\n <span class=\"trailing\">\n <ng-content select=\"[trailing]\"></ng-content>\n\n <button\n type=\"button\"\n class=\"toggle\"\n [attr.aria-label]=\"detailsLabel()\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"detailsId\"\n (click)=\"toggle()\">\n <ds-icon\n class=\"chev\"\n name=\"chevronDown\"\n [size]=\"16\" />\n </button>\n </span>\n </div>\n\n <ng-content></ng-content>\n\n @if (time()) {\n <span class=\"time\">\n {{ time() }}\n </span>\n }\n</div>\n\n<span\n class=\"spine tail\"\n aria-hidden=\"true\">\n</span>\n\n<div class=\"rest\">\n <div\n class=\"details\"\n [id]=\"detailsId\"\n [attr.inert]=\"expanded() ? null : ''\">\n <div class=\"details-content\">\n <div class=\"details-body\">\n <ng-content select=\"[details]\"></ng-content>\n </div>\n </div>\n </div>\n</div>\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_timeline-node-size: var(--ds-timeline-node-size, var(--timeline-node-size));--_timeline-spine-width: var(--ds-timeline-spine-width, var(--timeline-spine-w));--_timeline-gap: var(--ds-timeline-gap, var(--timeline-gap));--_timeline-node-bg-color: var(--ds-timeline-node-bg-color, var(--surface-secondary));--_timeline-node-color: var(--ds-timeline-node-color, var(--text-tertiary));--_timeline-node-border-color: var(--ds-timeline-node-border-color, var(--text-tertiary));--_timeline-spine-color: var(--ds-timeline-spine-color, var(--border-divider));--_timeline-toggle-icon-color: var(--ds-timeline-toggle-icon-color, var(--icon-default));--_timeline-toggle-icon-color-hover: var(--ds-timeline-toggle-icon-color-hover, var(--icon-strong));--_timeline-open-bg-color: var(--ds-timeline-open-bg-color, var(--surface-secondary));display:grid;grid-template-columns:var(--_timeline-node-size) 1fr;column-gap:var(--space-4)}.node-col{grid-area:1/1;display:flex;flex-direction:column;align-items:center}.node{display:inline-flex;align-items:center;justify-content:center;flex:none;width:var(--_timeline-node-size);height:var(--_timeline-node-size);border-radius:var(--radius-pill);background-color:var(--_timeline-node-bg-color);color:var(--_timeline-node-color);border:var(--border-width-strong) solid var(--_timeline-node-border-color)}.spine{flex:1;width:var(--_timeline-spine-width);margin-top:var(--space-1);background-color:var(--_timeline-spine-color)}.lead{margin-top:0;margin-bottom:var(--space-1)}.tail{grid-area:2/1;justify-self:center;margin-top:0}.text{grid-area:1/2;display:flex;flex-direction:column;align-self:center;gap:var(--space-0-5);min-width:0}.rest{grid-area:2/2;padding-bottom:var(--_timeline-gap);min-width:0}:host(.is-last) .spine:not(.lead),:host(.outside-timeline:last-child) .spine:not(.lead){visibility:hidden}:host(.is-last) .rest,:host(.outside-timeline:last-child) .rest{padding-bottom:0}:host(.is-first) .lead,:host(.outside-timeline:first-child) .lead{visibility:hidden}.head{position:relative;display:flex;align-items:flex-start;gap:var(--space-2);min-width:0}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.trailing{display:inline-flex;align-items:center;gap:var(--space-2);margin-left:auto;flex:none;height:calc(var(--font-size-s) * var(--line-height-base))}.head:has(.trailing>:not(.toggle)){align-items:center;margin-bottom:var(--space-1-5);padding-top:var(--space-2)}.head:has(.trailing>:not(.toggle)) .trailing{height:auto}.toggle{display:inline-flex;align-items:center;justify-content:center;padding:var(--space-0-5);border:0;background:none;cursor:pointer}.toggle:active:not(:disabled,[disabled],.is-disabled,.disabled,[aria-disabled=true]){filter:brightness(var(--ds-press-brightness, .9));transform:scale(var(--ds-press-scale, .97))}.toggle{position:relative}.toggle:before{content:\"\";position:absolute;top:50%;left:50%;width:max(100%,var(--hit-xs));height:max(100%,var(--hit-xs));translate:-50% -50%;border-radius:inherit}.toggle:focus-visible{outline-style:none}.toggle:focus-visible:before{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:calc(var(--focus-ring-offset) - 2 * var(--focus-ring-width));animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.toggle{color:var(--_timeline-toggle-icon-color)}.toggle:hover{color:var(--_timeline-toggle-icon-color-hover)}.toggle .chev{transition:transform var(--duration-base) var(--ease-standard)}.toggle[aria-expanded=true] .chev{transform:rotate(180deg)}:host:not(:has(.details-body>*)) .toggle{display:none}:host(.is-expanded){isolation:isolate}:host(.is-expanded):before{content:\"\";grid-area:1/1/3/3;z-index:-1;margin:0 calc(-1 * var(--space-2)) var(--_timeline-gap);border-radius:var(--ds-radius-control);background-color:var(--_timeline-open-bg-color)}:host(.is-expanded.is-last):before,:host(.is-expanded.outside-timeline:last-child):before{margin-bottom:0}.details{display:grid;grid-template-rows:0fr;min-width:0;visibility:hidden;transition:grid-template-rows var(--duration-slow) var(--ease-decelerate),visibility var(--duration-slow) allow-discrete}.details:not(:has(.details-body>*)){display:none}:host(.is-expanded) .details{grid-template-rows:1fr;visibility:visible}.details-content{min-height:0;overflow:hidden}.details-body{padding-top:var(--space-1)}.heading{color:var(--text-primary);font:var(--font-weight-semibold) var(--font-size-s)/var(--line-height-base) var(--font-sans)}.time{color:var(--text-tertiary);font:var(--font-weight-regular) var(--font-size-xs)/var(--line-height-base) var(--font-sans)}:host([data-tone=primary]){--_timeline-node-bg-color: var(--accent);--_timeline-node-color: var(--text-on-primary);--_timeline-node-border-color: var(--accent)}:host([data-tone=success]){--_timeline-node-bg-color: var(--success);--_timeline-node-color: var(--text-on-success);--_timeline-node-border-color: var(--success)}:host([data-tone=warning]){--_timeline-node-bg-color: var(--warning);--_timeline-node-color: var(--text-on-warning);--_timeline-node-border-color: var(--warning)}:host([data-tone=error]){--_timeline-node-bg-color: var(--error);--_timeline-node-color: var(--text-on-error);--_timeline-node-border-color: var(--error)}:host([data-tone=muted]){--_timeline-node-bg-color: var(--surface-secondary);--_timeline-node-color: var(--text-tertiary);--_timeline-node-border-color: var(--text-tertiary)}:host([data-status=done]){--_timeline-node-bg-color: var(--success);--_timeline-node-color: var(--text-on-success);--_timeline-node-border-color: var(--success)}:host([data-status=running]){--_timeline-node-bg-color: var(--surface-default);--_timeline-node-color: var(--accent);--_timeline-node-border-color: var(--accent)}:host([data-status=pending]){--_timeline-node-bg-color: var(--surface-default);--_timeline-node-color: var(--text-tertiary);--_timeline-node-border-color: var(--text-tertiary)}:host([data-status=error]){--_timeline-node-bg-color: var(--error);--_timeline-node-color: var(--text-on-error);--_timeline-node-border-color: var(--error)}:host([data-status=pending]) .node{border-style:dashed}:host([data-status=pending]) .heading{color:var(--text-tertiary);font-weight:var(--font-weight-regular)}:host:has(>.text>.head~*){--_timeline-heading-centre: calc(var(--font-size-s) * var(--line-height-base) / 2)}:host:has(>.text>.head~*) .text{align-self:start;padding-top:max(0px,var(--_timeline-node-size) / 2 + var(--space-1) - var(--_timeline-heading-centre))}:host:has(>.text>.head~*) .lead{flex:none;height:max(0px,var(--_timeline-heading-centre) - var(--_timeline-node-size) / 2 - var(--space-1))}:host:has(>.text>.head>.trailing>:not(.toggle)){--_timeline-heading-centre: calc( var(--space-2) + max(var(--font-size-s) * var(--line-height-base), var(--field-h-sm)) / 2 )}\n"], dependencies: [{ kind: "component", type: IconComponent, selector: "ds-icon", inputs: ["name", "size", "stroke", "ariaLabel"] }, { kind: "component", type: SpinnerComponent, selector: "ds-spinner", inputs: ["size"] }] });
|
|
68
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: TimelineItemComponent, isStandalone: true, selector: "ds-timeline-item", inputs: { heading: { classPropertyName: "heading", publicName: "heading", isSignal: true, isRequired: false, transformFunction: null }, time: { classPropertyName: "time", publicName: "time", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, tone: { classPropertyName: "tone", publicName: "tone", isSignal: true, isRequired: false, transformFunction: null }, status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: false, transformFunction: null }, expanded: { classPropertyName: "expanded", publicName: "expanded", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { expanded: "expandedChange" }, host: { attributes: { "role": "listitem" }, properties: { "attr.data-tone": "tone()", "attr.data-status": "status()", "class.is-first": "isFirst()", "class.is-last": "isLast()", "class.is-expanded": "expanded()", "class.outside-timeline": "!timeline", "class.is-settled": "settled()" } }, ngImport: i0, template: "<div\n class=\"node-col\"\n aria-hidden=\"true\">\n <span class=\"spine lead\"></span>\n\n <span class=\"node\">\n @if (status() === 'running') {\n <span\n class=\"mark\"\n animate.enter=\"mark-in\"\n animate.leave=\"mark-out\">\n <ds-spinner size=\"md\" />\n </span>\n } @else {\n @for (name of nodeIcons(); track name) {\n <span\n class=\"mark\"\n animate.enter=\"mark-in\"\n animate.leave=\"mark-out\">\n <ds-icon\n [name]=\"name\"\n [size]=\"16\"\n [stroke]=\"3\" />\n </span>\n }\n }\n </span>\n\n <span class=\"spine\"></span>\n</div>\n\n<div class=\"text\">\n <div class=\"head\">\n @if (statusLabel()) {\n <span class=\"visually-hidden\">\n {{ statusLabel() }}:\n </span>\n }\n\n @if (heading()) {\n <span class=\"heading\">\n {{ heading() }}\n </span>\n }\n\n <span class=\"trailing\">\n <ng-content select=\"[trailing]\"></ng-content>\n\n <button\n type=\"button\"\n class=\"toggle\"\n [attr.aria-label]=\"detailsLabel()\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"detailsId\"\n (click)=\"toggle()\">\n <ds-icon\n class=\"chev\"\n name=\"chevronDown\"\n [size]=\"16\" />\n </button>\n </span>\n </div>\n\n <ng-content></ng-content>\n\n @if (time()) {\n <span class=\"time\">\n {{ time() }}\n </span>\n }\n</div>\n\n<span\n class=\"spine tail\"\n aria-hidden=\"true\">\n</span>\n\n<div class=\"rest\">\n <div\n class=\"details\"\n [id]=\"detailsId\"\n [attr.inert]=\"expanded() ? null : ''\">\n <div class=\"details-content\">\n <div class=\"details-body\">\n <ng-content select=\"[details]\"></ng-content>\n </div>\n </div>\n </div>\n</div>\n", styles: ["@property --_step-arc-sweep{syntax: \"<angle>\"; inherits: true; initial-value: 90deg;}:where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_timeline-node-size: var(--ds-timeline-node-size, var(--timeline-node-size));--_timeline-spine-width: var(--ds-timeline-spine-width, var(--timeline-spine-w));--_timeline-gap: var(--ds-timeline-gap, var(--timeline-gap));--_timeline-node-bg-color: var(--ds-timeline-node-bg-color, var(--surface-secondary));--_timeline-node-color: var(--ds-timeline-node-color, var(--text-tertiary));--_timeline-node-border-color: var(--ds-timeline-node-border-color, var(--text-tertiary));--_timeline-spine-color: var(--ds-timeline-spine-color, var(--border-divider));--_timeline-toggle-icon-color: var(--ds-timeline-toggle-icon-color, var(--icon-default));--_timeline-toggle-icon-color-hover: var(--ds-timeline-toggle-icon-color-hover, var(--icon-strong));--_timeline-open-bg-color: var(--ds-timeline-open-bg-color, var(--surface-secondary));display:grid;grid-template-columns:var(--_timeline-node-size) 1fr;column-gap:var(--space-4)}.node-col{grid-area:1/1;display:flex;flex-direction:column;align-items:center}.node{position:relative;display:inline-grid;place-items:center;flex:none;width:var(--_timeline-node-size);height:var(--_timeline-node-size);border-radius:var(--radius-pill);background-color:var(--_timeline-node-bg-color);color:var(--_timeline-node-color);border:var(--border-width-strong) solid var(--_timeline-node-border-color);transition-property:background-color,border-color,color;transition-duration:var(--duration-base);transition-timing-function:var(--ease-standard)}.node:before{content:\"\";position:absolute;inset:calc(-1 * var(--border-width-strong));box-sizing:border-box;border:var(--border-width-strong) dashed var(--_timeline-node-border-color);border-radius:inherit;opacity:0;transition:opacity var(--duration-base) var(--ease-standard)}.mark{grid-area:1/1;display:inline-flex}:host(.is-settled){--_step-arc-close: var(--duration-slow);--_step-fill-delay: calc(var(--duration-slow) * .75);--_step-draw-delay: calc(var(--_step-fill-delay) + var(--duration-base) * .6);--_step-draw-stagger: calc(var(--duration-fast) * .6)}:host(.is-settled) .mark-in:has(>ds-spinner){animation:ds-step-arc-grow var(--duration-slow) var(--ease-standard) both}:host(.is-settled) .mark-in:has(>ds-spinner) ds-spinner{-webkit-mask:conic-gradient(from -45deg,var(--surface-default) var(--_step-arc-sweep),transparent 0 90deg,var(--surface-default) 0);mask:conic-gradient(from -45deg,var(--surface-default) var(--_step-arc-sweep),transparent 0 90deg,var(--surface-default) 0)}:host(.is-settled) .mark-out{animation:ds-step-mark-out var(--ds-motion-check-exit-duration) var(--ds-motion-check-exit-easing) both}:host(.is-settled) .node:has(>.mark>ds-icon)>.mark-out:has(>ds-spinner){display:none}:host(.is-settled) .mark-in:has(>ds-icon){animation:ds-step-mark-hold calc(var(--_step-draw-delay) + var(--duration-base) + var(--_step-draw-stagger)) linear both}:host(.is-settled) .mark-in:has(>ds-icon):before{content:\"\";position:absolute;inset:calc(-1 * var(--border-width-strong));border-radius:var(--radius-pill);background-color:var(--_timeline-node-bg-color);animation:ds-step-fill var(--duration-base) var(--ease-decelerate) var(--_step-fill-delay) both;--_step-fill-from: calc((var(--_timeline-node-size) - var(--spinner-md)) / 2 - var(--border-width-strong))}:host(.is-settled) .mark-in:has(>ds-icon):after{content:\"\";position:absolute;top:50%;left:50%;width:var(--spinner-md);height:var(--spinner-md);box-sizing:border-box;translate:-50% -50%;border:var(--border-width-strong) solid var(--_timeline-node-border-color);border-radius:var(--radius-pill);-webkit-mask:conic-gradient(from -45deg,var(--surface-default) var(--_step-arc-sweep),transparent 0);mask:conic-gradient(from -45deg,var(--surface-default) var(--_step-arc-sweep),transparent 0);animation:ds-step-arc-close var(--_step-arc-close) var(--ease-standard) both,ds-step-arc-turn var(--duration-loop-fast) linear both}:host(.is-settled) .mark-in:has(>ds-icon) ds-icon{position:relative}:host(.is-settled) .mark-in:has(>ds-icon) ::ng-deep svg>*{stroke-dasharray:1 2;animation:ds-step-stroke var(--duration-base) var(--ease-standard) var(--_step-draw-delay) both}:host(.is-settled) .mark-in:has(>ds-icon) ::ng-deep svg>*+*{animation-delay:calc(var(--_step-draw-delay) + var(--_step-draw-stagger))}:host(.is-settled) .node:has(>.mark>ds-icon){transition-delay:calc(var(--_step-fill-delay) + var(--duration-base)),0s,0s}@keyframes ds-step-arc-grow{0%{opacity:0;--_step-arc-sweep: 0deg}}@keyframes ds-step-mark-out{to{opacity:0;scale:.4}}@keyframes ds-step-mark-hold{to{opacity:1}}@keyframes ds-step-arc-close{0%{--_step-arc-sweep: var(--_step-arc-length, 90deg)}to{--_step-arc-sweep: 360deg}}@keyframes ds-step-arc-turn{0%{rotate:var(--_step-arc-from, 0deg)}to{rotate:calc(var(--_step-arc-from, 0deg) + 1turn)}}@keyframes ds-step-fill{0%{opacity:0;inset:var(--_step-fill-from)}0.1%{opacity:1}}@keyframes ds-step-stroke{0%{opacity:0;stroke-dashoffset:1}0.1%{opacity:1}to{stroke-dashoffset:0}}.spine{flex:1;width:var(--_timeline-spine-width);margin-top:var(--space-1);background-color:var(--_timeline-spine-color)}.lead{margin-top:0;margin-bottom:var(--space-1)}.tail{grid-area:2/1;justify-self:center;margin-top:0}.text{grid-area:1/2;display:flex;flex-direction:column;align-self:center;gap:var(--space-0-5);min-width:0}.rest{grid-area:2/2;padding-bottom:var(--_timeline-gap);min-width:0}:host(.is-last) .spine:not(.lead),:host(.outside-timeline:last-child) .spine:not(.lead){visibility:hidden}:host(.is-last) .rest,:host(.outside-timeline:last-child) .rest{padding-bottom:0}:host(.is-first) .lead,:host(.outside-timeline:first-child) .lead{visibility:hidden}.head{position:relative;display:flex;align-items:flex-start;gap:var(--space-2);min-width:0}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.trailing{display:inline-flex;align-items:center;gap:var(--space-2);margin-left:auto;flex:none;height:calc(var(--font-size-s) * var(--line-height-base))}.head:has(.trailing>:not(.toggle)){align-items:center;margin-bottom:var(--space-1-5);padding-top:var(--space-2)}.head:has(.trailing>:not(.toggle)) .trailing{height:auto}.toggle{display:inline-flex;align-items:center;justify-content:center;padding:var(--space-0-5);border:0;background:none;cursor:pointer}.toggle:active:not(:disabled,[disabled],.is-disabled,.disabled,[aria-disabled=true]){filter:brightness(var(--ds-press-brightness, .9));transform:scale(var(--ds-press-scale, .97))}.toggle{position:relative}.toggle:before{content:\"\";position:absolute;top:50%;left:50%;width:max(100%,var(--hit-xs));height:max(100%,var(--hit-xs));translate:-50% -50%;border-radius:inherit}.toggle:focus-visible{outline-style:none}.toggle:focus-visible:before{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:calc(var(--focus-ring-offset) - 2 * var(--focus-ring-width));animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.toggle{color:var(--_timeline-toggle-icon-color)}.toggle:hover{color:var(--_timeline-toggle-icon-color-hover)}.toggle .chev{transition:transform var(--duration-base) var(--ease-standard)}.toggle[aria-expanded=true] .chev{transform:rotate(180deg)}:host:not(:has(.details-body>*)) .toggle{display:none}:host(.is-expanded){isolation:isolate}:host(.is-expanded):before{content:\"\";grid-area:1/1/3/3;z-index:-1;margin:0 calc(-1 * var(--space-2)) var(--_timeline-gap);border-radius:var(--ds-radius-control);background-color:var(--_timeline-open-bg-color)}:host(.is-expanded.is-last):before,:host(.is-expanded.outside-timeline:last-child):before{margin-bottom:0}.details{display:grid;grid-template-rows:0fr;min-width:0;visibility:hidden;transition:grid-template-rows var(--duration-slow) var(--ease-decelerate),visibility var(--duration-slow) allow-discrete}.details:not(:has(.details-body>*)){display:none}:host(.is-expanded) .details{grid-template-rows:1fr;visibility:visible}.details-content{min-height:0;overflow:hidden}.details-body{padding-top:var(--space-1)}.heading{color:var(--text-primary);font:var(--font-weight-semibold) var(--font-size-s)/var(--line-height-base) var(--font-sans)}.time{color:var(--text-tertiary);font:var(--font-weight-regular) var(--font-size-xs)/var(--line-height-base) var(--font-sans)}:host([data-tone=primary]){--_timeline-node-bg-color: oklab(from var(--accent) min(l, .55) a b);--_timeline-node-color: var(--text-on-primary);--_timeline-node-border-color: oklab(from var(--accent) min(l, .55) a b)}:host([data-tone=success]){--_timeline-node-bg-color: var(--success);--_timeline-node-color: var(--text-on-success);--_timeline-node-border-color: var(--success)}:host([data-tone=warning]){--_timeline-node-bg-color: var(--warning);--_timeline-node-color: var(--text-on-warning);--_timeline-node-border-color: var(--warning)}:host([data-tone=error]){--_timeline-node-bg-color: var(--error);--_timeline-node-color: var(--text-on-error);--_timeline-node-border-color: var(--error)}:host([data-tone=muted]){--_timeline-node-bg-color: var(--surface-secondary);--_timeline-node-color: var(--text-tertiary);--_timeline-node-border-color: var(--text-tertiary)}:host([data-status=done]){--_timeline-node-bg-color: var(--success);--_timeline-node-color: var(--text-on-success);--_timeline-node-border-color: var(--success)}:host([data-status=running]){--_timeline-node-bg-color: var(--surface-default);--_timeline-node-color: var(--accent);--_timeline-node-border-color: var(--accent)}:host([data-status=pending]){--_timeline-node-bg-color: var(--surface-default);--_timeline-node-color: var(--text-tertiary);--_timeline-node-border-color: var(--text-tertiary)}:host([data-status=error]){--_timeline-node-bg-color: var(--error);--_timeline-node-color: var(--text-on-error);--_timeline-node-border-color: var(--error)}:host([data-status=pending]) .node{border-color:transparent}:host([data-status=pending]) .node:before{opacity:1}:host([data-status=pending]) .heading{color:var(--text-tertiary);font-weight:var(--font-weight-regular)}:host:has(>.text>.head~*){--_timeline-heading-centre: calc(var(--font-size-s) * var(--line-height-base) / 2)}:host:has(>.text>.head~*) .text{align-self:start;padding-top:max(0px,var(--_timeline-node-size) / 2 + var(--space-1) - var(--_timeline-heading-centre))}:host:has(>.text>.head~*) .lead{flex:none;height:max(0px,var(--_timeline-heading-centre) - var(--_timeline-node-size) / 2 - var(--space-1))}:host:has(>.text>.head>.trailing>:not(.toggle)){--_timeline-heading-centre: calc( var(--space-2) + max(var(--font-size-s) * var(--line-height-base), var(--field-h-sm)) / 2 )}\n"], dependencies: [{ kind: "component", type: IconComponent, selector: "ds-icon", inputs: ["name", "size", "stroke", "ariaLabel"] }, { kind: "component", type: SpinnerComponent, selector: "ds-spinner", inputs: ["size"] }] });
|
|
50
69
|
}
|
|
51
70
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: TimelineItemComponent, decorators: [{
|
|
52
71
|
type: Component,
|
|
@@ -58,8 +77,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImpo
|
|
|
58
77
|
'[class.is-last]': 'isLast()',
|
|
59
78
|
'[class.is-expanded]': 'expanded()',
|
|
60
79
|
'[class.outside-timeline]': '!timeline',
|
|
61
|
-
|
|
62
|
-
}], propDecorators: { heading: [{ type: i0.Input, args: [{ isSignal: true, alias: "heading", required: false }] }], time: [{ type: i0.Input, args: [{ isSignal: true, alias: "time", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], tone: [{ type: i0.Input, args: [{ isSignal: true, alias: "tone", required: false }] }], status: [{ type: i0.Input, args: [{ isSignal: true, alias: "status", required: false }] }], expanded: [{ type: i0.Input, args: [{ isSignal: true, alias: "expanded", required: false }] }, { type: i0.Output, args: ["expandedChange"] }] } });
|
|
80
|
+
'[class.is-settled]': 'settled()',
|
|
81
|
+
}, template: "<div\n class=\"node-col\"\n aria-hidden=\"true\">\n <span class=\"spine lead\"></span>\n\n <span class=\"node\">\n @if (status() === 'running') {\n <span\n class=\"mark\"\n animate.enter=\"mark-in\"\n animate.leave=\"mark-out\">\n <ds-spinner size=\"md\" />\n </span>\n } @else {\n @for (name of nodeIcons(); track name) {\n <span\n class=\"mark\"\n animate.enter=\"mark-in\"\n animate.leave=\"mark-out\">\n <ds-icon\n [name]=\"name\"\n [size]=\"16\"\n [stroke]=\"3\" />\n </span>\n }\n }\n </span>\n\n <span class=\"spine\"></span>\n</div>\n\n<div class=\"text\">\n <div class=\"head\">\n @if (statusLabel()) {\n <span class=\"visually-hidden\">\n {{ statusLabel() }}:\n </span>\n }\n\n @if (heading()) {\n <span class=\"heading\">\n {{ heading() }}\n </span>\n }\n\n <span class=\"trailing\">\n <ng-content select=\"[trailing]\"></ng-content>\n\n <button\n type=\"button\"\n class=\"toggle\"\n [attr.aria-label]=\"detailsLabel()\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"detailsId\"\n (click)=\"toggle()\">\n <ds-icon\n class=\"chev\"\n name=\"chevronDown\"\n [size]=\"16\" />\n </button>\n </span>\n </div>\n\n <ng-content></ng-content>\n\n @if (time()) {\n <span class=\"time\">\n {{ time() }}\n </span>\n }\n</div>\n\n<span\n class=\"spine tail\"\n aria-hidden=\"true\">\n</span>\n\n<div class=\"rest\">\n <div\n class=\"details\"\n [id]=\"detailsId\"\n [attr.inert]=\"expanded() ? null : ''\">\n <div class=\"details-content\">\n <div class=\"details-body\">\n <ng-content select=\"[details]\"></ng-content>\n </div>\n </div>\n </div>\n</div>\n", styles: ["@property --_step-arc-sweep{syntax: \"<angle>\"; inherits: true; initial-value: 90deg;}:where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_timeline-node-size: var(--ds-timeline-node-size, var(--timeline-node-size));--_timeline-spine-width: var(--ds-timeline-spine-width, var(--timeline-spine-w));--_timeline-gap: var(--ds-timeline-gap, var(--timeline-gap));--_timeline-node-bg-color: var(--ds-timeline-node-bg-color, var(--surface-secondary));--_timeline-node-color: var(--ds-timeline-node-color, var(--text-tertiary));--_timeline-node-border-color: var(--ds-timeline-node-border-color, var(--text-tertiary));--_timeline-spine-color: var(--ds-timeline-spine-color, var(--border-divider));--_timeline-toggle-icon-color: var(--ds-timeline-toggle-icon-color, var(--icon-default));--_timeline-toggle-icon-color-hover: var(--ds-timeline-toggle-icon-color-hover, var(--icon-strong));--_timeline-open-bg-color: var(--ds-timeline-open-bg-color, var(--surface-secondary));display:grid;grid-template-columns:var(--_timeline-node-size) 1fr;column-gap:var(--space-4)}.node-col{grid-area:1/1;display:flex;flex-direction:column;align-items:center}.node{position:relative;display:inline-grid;place-items:center;flex:none;width:var(--_timeline-node-size);height:var(--_timeline-node-size);border-radius:var(--radius-pill);background-color:var(--_timeline-node-bg-color);color:var(--_timeline-node-color);border:var(--border-width-strong) solid var(--_timeline-node-border-color);transition-property:background-color,border-color,color;transition-duration:var(--duration-base);transition-timing-function:var(--ease-standard)}.node:before{content:\"\";position:absolute;inset:calc(-1 * var(--border-width-strong));box-sizing:border-box;border:var(--border-width-strong) dashed var(--_timeline-node-border-color);border-radius:inherit;opacity:0;transition:opacity var(--duration-base) var(--ease-standard)}.mark{grid-area:1/1;display:inline-flex}:host(.is-settled){--_step-arc-close: var(--duration-slow);--_step-fill-delay: calc(var(--duration-slow) * .75);--_step-draw-delay: calc(var(--_step-fill-delay) + var(--duration-base) * .6);--_step-draw-stagger: calc(var(--duration-fast) * .6)}:host(.is-settled) .mark-in:has(>ds-spinner){animation:ds-step-arc-grow var(--duration-slow) var(--ease-standard) both}:host(.is-settled) .mark-in:has(>ds-spinner) ds-spinner{-webkit-mask:conic-gradient(from -45deg,var(--surface-default) var(--_step-arc-sweep),transparent 0 90deg,var(--surface-default) 0);mask:conic-gradient(from -45deg,var(--surface-default) var(--_step-arc-sweep),transparent 0 90deg,var(--surface-default) 0)}:host(.is-settled) .mark-out{animation:ds-step-mark-out var(--ds-motion-check-exit-duration) var(--ds-motion-check-exit-easing) both}:host(.is-settled) .node:has(>.mark>ds-icon)>.mark-out:has(>ds-spinner){display:none}:host(.is-settled) .mark-in:has(>ds-icon){animation:ds-step-mark-hold calc(var(--_step-draw-delay) + var(--duration-base) + var(--_step-draw-stagger)) linear both}:host(.is-settled) .mark-in:has(>ds-icon):before{content:\"\";position:absolute;inset:calc(-1 * var(--border-width-strong));border-radius:var(--radius-pill);background-color:var(--_timeline-node-bg-color);animation:ds-step-fill var(--duration-base) var(--ease-decelerate) var(--_step-fill-delay) both;--_step-fill-from: calc((var(--_timeline-node-size) - var(--spinner-md)) / 2 - var(--border-width-strong))}:host(.is-settled) .mark-in:has(>ds-icon):after{content:\"\";position:absolute;top:50%;left:50%;width:var(--spinner-md);height:var(--spinner-md);box-sizing:border-box;translate:-50% -50%;border:var(--border-width-strong) solid var(--_timeline-node-border-color);border-radius:var(--radius-pill);-webkit-mask:conic-gradient(from -45deg,var(--surface-default) var(--_step-arc-sweep),transparent 0);mask:conic-gradient(from -45deg,var(--surface-default) var(--_step-arc-sweep),transparent 0);animation:ds-step-arc-close var(--_step-arc-close) var(--ease-standard) both,ds-step-arc-turn var(--duration-loop-fast) linear both}:host(.is-settled) .mark-in:has(>ds-icon) ds-icon{position:relative}:host(.is-settled) .mark-in:has(>ds-icon) ::ng-deep svg>*{stroke-dasharray:1 2;animation:ds-step-stroke var(--duration-base) var(--ease-standard) var(--_step-draw-delay) both}:host(.is-settled) .mark-in:has(>ds-icon) ::ng-deep svg>*+*{animation-delay:calc(var(--_step-draw-delay) + var(--_step-draw-stagger))}:host(.is-settled) .node:has(>.mark>ds-icon){transition-delay:calc(var(--_step-fill-delay) + var(--duration-base)),0s,0s}@keyframes ds-step-arc-grow{0%{opacity:0;--_step-arc-sweep: 0deg}}@keyframes ds-step-mark-out{to{opacity:0;scale:.4}}@keyframes ds-step-mark-hold{to{opacity:1}}@keyframes ds-step-arc-close{0%{--_step-arc-sweep: var(--_step-arc-length, 90deg)}to{--_step-arc-sweep: 360deg}}@keyframes ds-step-arc-turn{0%{rotate:var(--_step-arc-from, 0deg)}to{rotate:calc(var(--_step-arc-from, 0deg) + 1turn)}}@keyframes ds-step-fill{0%{opacity:0;inset:var(--_step-fill-from)}0.1%{opacity:1}}@keyframes ds-step-stroke{0%{opacity:0;stroke-dashoffset:1}0.1%{opacity:1}to{stroke-dashoffset:0}}.spine{flex:1;width:var(--_timeline-spine-width);margin-top:var(--space-1);background-color:var(--_timeline-spine-color)}.lead{margin-top:0;margin-bottom:var(--space-1)}.tail{grid-area:2/1;justify-self:center;margin-top:0}.text{grid-area:1/2;display:flex;flex-direction:column;align-self:center;gap:var(--space-0-5);min-width:0}.rest{grid-area:2/2;padding-bottom:var(--_timeline-gap);min-width:0}:host(.is-last) .spine:not(.lead),:host(.outside-timeline:last-child) .spine:not(.lead){visibility:hidden}:host(.is-last) .rest,:host(.outside-timeline:last-child) .rest{padding-bottom:0}:host(.is-first) .lead,:host(.outside-timeline:first-child) .lead{visibility:hidden}.head{position:relative;display:flex;align-items:flex-start;gap:var(--space-2);min-width:0}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.trailing{display:inline-flex;align-items:center;gap:var(--space-2);margin-left:auto;flex:none;height:calc(var(--font-size-s) * var(--line-height-base))}.head:has(.trailing>:not(.toggle)){align-items:center;margin-bottom:var(--space-1-5);padding-top:var(--space-2)}.head:has(.trailing>:not(.toggle)) .trailing{height:auto}.toggle{display:inline-flex;align-items:center;justify-content:center;padding:var(--space-0-5);border:0;background:none;cursor:pointer}.toggle:active:not(:disabled,[disabled],.is-disabled,.disabled,[aria-disabled=true]){filter:brightness(var(--ds-press-brightness, .9));transform:scale(var(--ds-press-scale, .97))}.toggle{position:relative}.toggle:before{content:\"\";position:absolute;top:50%;left:50%;width:max(100%,var(--hit-xs));height:max(100%,var(--hit-xs));translate:-50% -50%;border-radius:inherit}.toggle:focus-visible{outline-style:none}.toggle:focus-visible:before{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:calc(var(--focus-ring-offset) - 2 * var(--focus-ring-width));animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.toggle{color:var(--_timeline-toggle-icon-color)}.toggle:hover{color:var(--_timeline-toggle-icon-color-hover)}.toggle .chev{transition:transform var(--duration-base) var(--ease-standard)}.toggle[aria-expanded=true] .chev{transform:rotate(180deg)}:host:not(:has(.details-body>*)) .toggle{display:none}:host(.is-expanded){isolation:isolate}:host(.is-expanded):before{content:\"\";grid-area:1/1/3/3;z-index:-1;margin:0 calc(-1 * var(--space-2)) var(--_timeline-gap);border-radius:var(--ds-radius-control);background-color:var(--_timeline-open-bg-color)}:host(.is-expanded.is-last):before,:host(.is-expanded.outside-timeline:last-child):before{margin-bottom:0}.details{display:grid;grid-template-rows:0fr;min-width:0;visibility:hidden;transition:grid-template-rows var(--duration-slow) var(--ease-decelerate),visibility var(--duration-slow) allow-discrete}.details:not(:has(.details-body>*)){display:none}:host(.is-expanded) .details{grid-template-rows:1fr;visibility:visible}.details-content{min-height:0;overflow:hidden}.details-body{padding-top:var(--space-1)}.heading{color:var(--text-primary);font:var(--font-weight-semibold) var(--font-size-s)/var(--line-height-base) var(--font-sans)}.time{color:var(--text-tertiary);font:var(--font-weight-regular) var(--font-size-xs)/var(--line-height-base) var(--font-sans)}:host([data-tone=primary]){--_timeline-node-bg-color: oklab(from var(--accent) min(l, .55) a b);--_timeline-node-color: var(--text-on-primary);--_timeline-node-border-color: oklab(from var(--accent) min(l, .55) a b)}:host([data-tone=success]){--_timeline-node-bg-color: var(--success);--_timeline-node-color: var(--text-on-success);--_timeline-node-border-color: var(--success)}:host([data-tone=warning]){--_timeline-node-bg-color: var(--warning);--_timeline-node-color: var(--text-on-warning);--_timeline-node-border-color: var(--warning)}:host([data-tone=error]){--_timeline-node-bg-color: var(--error);--_timeline-node-color: var(--text-on-error);--_timeline-node-border-color: var(--error)}:host([data-tone=muted]){--_timeline-node-bg-color: var(--surface-secondary);--_timeline-node-color: var(--text-tertiary);--_timeline-node-border-color: var(--text-tertiary)}:host([data-status=done]){--_timeline-node-bg-color: var(--success);--_timeline-node-color: var(--text-on-success);--_timeline-node-border-color: var(--success)}:host([data-status=running]){--_timeline-node-bg-color: var(--surface-default);--_timeline-node-color: var(--accent);--_timeline-node-border-color: var(--accent)}:host([data-status=pending]){--_timeline-node-bg-color: var(--surface-default);--_timeline-node-color: var(--text-tertiary);--_timeline-node-border-color: var(--text-tertiary)}:host([data-status=error]){--_timeline-node-bg-color: var(--error);--_timeline-node-color: var(--text-on-error);--_timeline-node-border-color: var(--error)}:host([data-status=pending]) .node{border-color:transparent}:host([data-status=pending]) .node:before{opacity:1}:host([data-status=pending]) .heading{color:var(--text-tertiary);font-weight:var(--font-weight-regular)}:host:has(>.text>.head~*){--_timeline-heading-centre: calc(var(--font-size-s) * var(--line-height-base) / 2)}:host:has(>.text>.head~*) .text{align-self:start;padding-top:max(0px,var(--_timeline-node-size) / 2 + var(--space-1) - var(--_timeline-heading-centre))}:host:has(>.text>.head~*) .lead{flex:none;height:max(0px,var(--_timeline-heading-centre) - var(--_timeline-node-size) / 2 - var(--space-1))}:host:has(>.text>.head>.trailing>:not(.toggle)){--_timeline-heading-centre: calc( var(--space-2) + max(var(--font-size-s) * var(--line-height-base), var(--field-h-sm)) / 2 )}\n"] }]
|
|
82
|
+
}], ctorParameters: () => [], propDecorators: { heading: [{ type: i0.Input, args: [{ isSignal: true, alias: "heading", required: false }] }], time: [{ type: i0.Input, args: [{ isSignal: true, alias: "time", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], tone: [{ type: i0.Input, args: [{ isSignal: true, alias: "tone", required: false }] }], status: [{ type: i0.Input, args: [{ isSignal: true, alias: "status", required: false }] }], expanded: [{ type: i0.Input, args: [{ isSignal: true, alias: "expanded", required: false }] }, { type: i0.Output, args: ["expandedChange"] }] } });
|
|
63
83
|
|
|
64
84
|
class TimelineComponent {
|
|
65
85
|
// Descendants, so an item inside a wrapper element or an @for block still counts.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ids-group-ltd-ids-design-system-components-timeline.mjs","sources":["../../../src/lib/components/timeline/timeline.token.ts","../../../src/lib/components/timeline/timeline-item.component.ts","../../../src/lib/components/timeline/timeline-item.component.html","../../../src/lib/components/timeline/timeline.component.ts","../../../src/lib/components/timeline/ids-group-ltd-ids-design-system-components-timeline.ts"],"sourcesContent":["import { InjectionToken, type Signal } from '@angular/core';\n\n/** Contract that ds-timeline-item reads from its parent ds-timeline. */\nexport interface TimelineContract {\n /** The item that draws no connector above it. */\n readonly firstItem: Signal<object | undefined>;\n /** The item that draws no connector below it. */\n readonly lastItem: Signal<object | undefined>;\n}\n\nexport const TIMELINE = new InjectionToken<TimelineContract>('TIMELINE');\n","import {\n Component,\n ViewEncapsulation,\n computed,\n inject,\n input,\n model,\n} from '@angular/core';\nimport { IconComponent } from '@ids-group-ltd/ids-design-system/icons';\nimport { SpinnerComponent } from '@ids-group-ltd/ids-design-system/components/spinner';\nimport {\n DS_INTL,\n DS_INTL_DEFAULTS,\n type IconName,\n} from '@ids-group-ltd/ids-design-system/core';\nimport { TIMELINE } from './timeline.token';\n\nexport type TimelineTone =\n | 'default'\n | 'primary'\n | 'success'\n | 'warning'\n | 'error'\n | 'muted';\n\nexport type TimelineStatus = 'done' | 'running' | 'pending' | 'error';\n\nconst STATUS_ICONS: Partial<Record<TimelineStatus, IconName>> = {\n done: 'check',\n error: 'x',\n};\n\nlet nextId = 0;\n\n@Component({\n selector: 'ds-timeline-item',\n standalone: true,\n imports: [IconComponent, SpinnerComponent],\n templateUrl: './timeline-item.component.html',\n styleUrl: './timeline-item.component.scss',\n encapsulation: ViewEncapsulation.Emulated,\n host: {\n role: 'listitem',\n '[attr.data-tone]': 'tone()',\n '[attr.data-status]': 'status()',\n '[class.is-first]': 'isFirst()',\n '[class.is-last]': 'isLast()',\n '[class.is-expanded]': 'expanded()',\n '[class.outside-timeline]': '!timeline',\n },\n})\nexport class TimelineItemComponent {\n /** Primary text for the entry. */\n readonly heading = input<string>('');\n /** Timestamp or date label below the content. */\n readonly time = input<string>('');\n /** Marker icon; omit for a plain dot. Ignored while `status` is set. */\n readonly icon = input<IconName | null>(null);\n /** Semantic accent color for the marker. Ignored while `status` is set. */\n readonly tone = input<TimelineTone>('default');\n /** Step state: draws the marker and is spoken before the heading. `null` leaves `icon` and `tone` in charge. */\n readonly status = input<TimelineStatus | null>(null);\n /** Whether the `[details]` area is open, two-way bound. */\n readonly expanded = model<boolean>(false);\n\n private readonly intl = inject(DS_INTL);\n protected readonly timeline = inject(TIMELINE, { optional: true });\n\n protected readonly detailsId = `ds-timeline-item-${++nextId}-details`;\n\n protected readonly isFirst = computed(\n () => this.timeline?.firstItem() === this,\n );\n\n protected readonly isLast = computed(\n () => this.timeline?.lastItem() === this,\n );\n\n protected readonly nodeIcon = computed<IconName | null>(() => {\n const status = this.status();\n\n return status ? (STATUS_ICONS[status] ?? null) : this.icon();\n });\n\n private readonly wording = computed(() => ({\n ...DS_INTL_DEFAULTS.timeline,\n ...this.intl().timeline,\n }));\n\n protected readonly statusLabel = computed(() => {\n const status = this.status();\n\n return status ? this.wording()[status] : '';\n });\n\n protected readonly detailsLabel = computed(() =>\n this.wording().details(this.heading()),\n );\n\n protected toggle(): void {\n this.expanded.set(!this.expanded());\n }\n}\n","<div\n class=\"node-col\"\n aria-hidden=\"true\">\n <span class=\"spine lead\"></span>\n\n <span class=\"node\">\n @if (status() === 'running') {\n <ds-spinner size=\"md\" />\n } @else if (nodeIcon(); as name) {\n <ds-icon\n [name]=\"name\"\n [size]=\"16\"\n [stroke]=\"3\" />\n }\n </span>\n\n <span class=\"spine\"></span>\n</div>\n\n<div class=\"text\">\n <div class=\"head\">\n @if (statusLabel()) {\n <span class=\"visually-hidden\">\n {{ statusLabel() }}:\n </span>\n }\n\n @if (heading()) {\n <span class=\"heading\">\n {{ heading() }}\n </span>\n }\n\n <span class=\"trailing\">\n <ng-content select=\"[trailing]\"></ng-content>\n\n <button\n type=\"button\"\n class=\"toggle\"\n [attr.aria-label]=\"detailsLabel()\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"detailsId\"\n (click)=\"toggle()\">\n <ds-icon\n class=\"chev\"\n name=\"chevronDown\"\n [size]=\"16\" />\n </button>\n </span>\n </div>\n\n <ng-content></ng-content>\n\n @if (time()) {\n <span class=\"time\">\n {{ time() }}\n </span>\n }\n</div>\n\n<span\n class=\"spine tail\"\n aria-hidden=\"true\">\n</span>\n\n<div class=\"rest\">\n <div\n class=\"details\"\n [id]=\"detailsId\"\n [attr.inert]=\"expanded() ? null : ''\">\n <div class=\"details-content\">\n <div class=\"details-body\">\n <ng-content select=\"[details]\"></ng-content>\n </div>\n </div>\n </div>\n</div>\n","import {\n Component,\n ViewEncapsulation,\n computed,\n contentChildren,\n forwardRef,\n} from '@angular/core';\nimport { TIMELINE } from './timeline.token';\nimport { TimelineItemComponent } from './timeline-item.component';\n\n@Component({\n selector: 'ds-timeline',\n standalone: true,\n template: '<ng-content></ng-content>',\n styleUrl: './timeline.component.scss',\n encapsulation: ViewEncapsulation.Emulated,\n host: {\n role: 'list',\n },\n providers: [\n {\n provide: TIMELINE,\n useExisting: forwardRef(() => TimelineComponent),\n },\n ],\n})\nexport class TimelineComponent {\n // Descendants, so an item inside a wrapper element or an @for block still counts.\n private readonly items = contentChildren(TimelineItemComponent, {\n descendants: true,\n });\n\n /** The item that draws no connector above it. */\n readonly firstItem = computed<object | undefined>(() => this.items().at(0));\n\n /** The item that draws no connector below it. */\n readonly lastItem = computed<object | undefined>(() => this.items().at(-1));\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"ids-group-ltd-ids-design-system-components-timeline.mjs","sources":["../../../src/lib/components/timeline/timeline.token.ts","../../../src/lib/components/timeline/timeline-item.component.ts","../../../src/lib/components/timeline/timeline-item.component.html","../../../src/lib/components/timeline/timeline.component.ts","../../../src/lib/components/timeline/ids-group-ltd-ids-design-system-components-timeline.ts"],"sourcesContent":["import { InjectionToken, type Signal } from '@angular/core';\n\n/** Contract that ds-timeline-item reads from its parent ds-timeline. */\nexport interface TimelineContract {\n /** The item that draws no connector above it. */\n readonly firstItem: Signal<object | undefined>;\n /** The item that draws no connector below it. */\n readonly lastItem: Signal<object | undefined>;\n}\n\nexport const TIMELINE = new InjectionToken<TimelineContract>('TIMELINE');\n","import {\n Component,\n ViewEncapsulation,\n afterNextRender,\n afterRenderEffect,\n ElementRef,\n computed,\n effect,\n inject,\n input,\n model,\n signal,\n untracked,\n} from '@angular/core';\nimport { IconComponent } from '@ids-group-ltd/ids-design-system/icons';\nimport { SpinnerComponent } from '@ids-group-ltd/ids-design-system/components/spinner';\nimport {\n centreMarkerGlyphs,\n holdMarkerArc,\n prepareMarkerStrokes,\n startMarkerArc,\n} from '@ids-group-ltd/ids-design-system/components';\nimport {\n DS_INTL,\n DS_INTL_DEFAULTS,\n type IconName,\n} from '@ids-group-ltd/ids-design-system/core';\nimport { TIMELINE } from './timeline.token';\n\nexport type TimelineTone =\n | 'default'\n | 'primary'\n | 'success'\n | 'warning'\n | 'error'\n | 'muted';\n\nexport type TimelineStatus = 'done' | 'running' | 'pending' | 'error';\n\nconst STATUS_ICONS: Partial<Record<TimelineStatus, IconName>> = {\n done: 'check',\n error: 'x',\n};\n\nlet nextId = 0;\n\n@Component({\n selector: 'ds-timeline-item',\n standalone: true,\n imports: [IconComponent, SpinnerComponent],\n templateUrl: './timeline-item.component.html',\n styleUrl: './timeline-item.component.scss',\n encapsulation: ViewEncapsulation.Emulated,\n host: {\n role: 'listitem',\n '[attr.data-tone]': 'tone()',\n '[attr.data-status]': 'status()',\n '[class.is-first]': 'isFirst()',\n '[class.is-last]': 'isLast()',\n '[class.is-expanded]': 'expanded()',\n '[class.outside-timeline]': '!timeline',\n '[class.is-settled]': 'settled()',\n },\n})\nexport class TimelineItemComponent {\n /** Primary text for the entry. */\n readonly heading = input<string>('');\n /** Timestamp or date label below the content. */\n readonly time = input<string>('');\n /** Marker icon; omit for a plain dot. Ignored while `status` is set. */\n readonly icon = input<IconName | null>(null);\n /** Semantic accent color for the marker. Ignored while `status` is set. */\n readonly tone = input<TimelineTone>('default');\n /** Step state: draws the marker and is spoken before the heading. `null` leaves `icon` and `tone` in charge. */\n readonly status = input<TimelineStatus | null>(null);\n /** Whether the `[details]` area is open, two-way bound. */\n readonly expanded = model<boolean>(false);\n\n private readonly intl = inject(DS_INTL);\n protected readonly timeline = inject(TIMELINE, { optional: true });\n\n protected readonly detailsId = `ds-timeline-item-${++nextId}-details`;\n\n protected readonly isFirst = computed(\n () => this.timeline?.firstItem() === this,\n );\n\n protected readonly isLast = computed(\n () => this.timeline?.lastItem() === this,\n );\n\n protected readonly nodeIcons = computed<readonly IconName[]>(() => {\n const status = this.status();\n const icon = status ? STATUS_ICONS[status] : this.icon();\n\n return icon ? [icon] : [];\n });\n\n // The marker animates only status changes, never its first paint.\n protected readonly settled = signal(false);\n\n constructor() {\n afterNextRender(() => this.settled.set(true));\n const host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n afterRenderEffect(() => {\n this.nodeIcons();\n prepareMarkerStrokes(host);\n centreMarkerGlyphs(host);\n startMarkerArc(host);\n });\n // A component effect runs before its view refreshes, while the spinner is still there.\n effect(() => {\n this.status();\n untracked(() => holdMarkerArc(host));\n });\n }\n\n private readonly wording = computed(() => ({\n ...DS_INTL_DEFAULTS.timeline,\n ...this.intl().timeline,\n }));\n\n protected readonly statusLabel = computed(() => {\n const status = this.status();\n\n return status ? this.wording()[status] : '';\n });\n\n protected readonly detailsLabel = computed(() =>\n this.wording().details(this.heading()),\n );\n\n protected toggle(): void {\n this.expanded.set(!this.expanded());\n }\n}\n","<div\n class=\"node-col\"\n aria-hidden=\"true\">\n <span class=\"spine lead\"></span>\n\n <span class=\"node\">\n @if (status() === 'running') {\n <span\n class=\"mark\"\n animate.enter=\"mark-in\"\n animate.leave=\"mark-out\">\n <ds-spinner size=\"md\" />\n </span>\n } @else {\n @for (name of nodeIcons(); track name) {\n <span\n class=\"mark\"\n animate.enter=\"mark-in\"\n animate.leave=\"mark-out\">\n <ds-icon\n [name]=\"name\"\n [size]=\"16\"\n [stroke]=\"3\" />\n </span>\n }\n }\n </span>\n\n <span class=\"spine\"></span>\n</div>\n\n<div class=\"text\">\n <div class=\"head\">\n @if (statusLabel()) {\n <span class=\"visually-hidden\">\n {{ statusLabel() }}:\n </span>\n }\n\n @if (heading()) {\n <span class=\"heading\">\n {{ heading() }}\n </span>\n }\n\n <span class=\"trailing\">\n <ng-content select=\"[trailing]\"></ng-content>\n\n <button\n type=\"button\"\n class=\"toggle\"\n [attr.aria-label]=\"detailsLabel()\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"detailsId\"\n (click)=\"toggle()\">\n <ds-icon\n class=\"chev\"\n name=\"chevronDown\"\n [size]=\"16\" />\n </button>\n </span>\n </div>\n\n <ng-content></ng-content>\n\n @if (time()) {\n <span class=\"time\">\n {{ time() }}\n </span>\n }\n</div>\n\n<span\n class=\"spine tail\"\n aria-hidden=\"true\">\n</span>\n\n<div class=\"rest\">\n <div\n class=\"details\"\n [id]=\"detailsId\"\n [attr.inert]=\"expanded() ? null : ''\">\n <div class=\"details-content\">\n <div class=\"details-body\">\n <ng-content select=\"[details]\"></ng-content>\n </div>\n </div>\n </div>\n</div>\n","import {\n Component,\n ViewEncapsulation,\n computed,\n contentChildren,\n forwardRef,\n} from '@angular/core';\nimport { TIMELINE } from './timeline.token';\nimport { TimelineItemComponent } from './timeline-item.component';\n\n@Component({\n selector: 'ds-timeline',\n standalone: true,\n template: '<ng-content></ng-content>',\n styleUrl: './timeline.component.scss',\n encapsulation: ViewEncapsulation.Emulated,\n host: {\n role: 'list',\n },\n providers: [\n {\n provide: TIMELINE,\n useExisting: forwardRef(() => TimelineComponent),\n },\n ],\n})\nexport class TimelineComponent {\n // Descendants, so an item inside a wrapper element or an @for block still counts.\n private readonly items = contentChildren(TimelineItemComponent, {\n descendants: true,\n });\n\n /** The item that draws no connector above it. */\n readonly firstItem = computed<object | undefined>(() => this.items().at(0));\n\n /** The item that draws no connector below it. */\n readonly lastItem = computed<object | undefined>(() => this.items().at(-1));\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, input, booleanAttribute, output, computed, signal, ViewEncapsulation, Component, ElementRef, effect,
|
|
2
|
+
import { inject, input, booleanAttribute, output, computed, signal, DestroyRef, ViewEncapsulation, Component, ElementRef, effect, Injectable } from '@angular/core';
|
|
3
3
|
import { Overlay } from '@angular/cdk/overlay';
|
|
4
4
|
import { ComponentPortal } from '@angular/cdk/portal';
|
|
5
5
|
import { LiveAnnouncer } from '@angular/cdk/a11y';
|
|
@@ -7,6 +7,7 @@ import { DS_INTL, DS_INTL_DEFAULTS, injectDsLocale, retainStyles, DS_CONFIG, dev
|
|
|
7
7
|
import { moveFocusOutOf } from '@ids-group-ltd/ids-design-system/components';
|
|
8
8
|
import { IconComponent } from '@ids-group-ltd/ids-design-system/icons';
|
|
9
9
|
import { SpinnerComponent } from '@ids-group-ltd/ids-design-system/components/spinner';
|
|
10
|
+
import { TooltipDirective } from '@ids-group-ltd/ids-design-system/components/tooltip';
|
|
10
11
|
|
|
11
12
|
const DS_TOAST_POSITION_DEFAULT = {
|
|
12
13
|
horizontalPosition: 'right',
|
|
@@ -14,6 +15,7 @@ const DS_TOAST_POSITION_DEFAULT = {
|
|
|
14
15
|
offset: 'var(--space-6)',
|
|
15
16
|
};
|
|
16
17
|
|
|
18
|
+
const ICON_SUCCESS_MS = 1200;
|
|
17
19
|
/**
|
|
18
20
|
* Single toast pill, rendered by ToastRegion for service-driven toasts or placed inline as a specimen.
|
|
19
21
|
*/
|
|
@@ -31,15 +33,20 @@ class ToastComponent {
|
|
|
31
33
|
icon = input(null, ...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
32
34
|
/** Optional action button rendered before the dismiss control. */
|
|
33
35
|
action = input(null, ...(ngDevMode ? [{ debugName: "action" }] : /* istanbul ignore next */ []));
|
|
36
|
+
/** Optional icon button between the action and the dismiss control, named and tooltipped by its `label`. */
|
|
37
|
+
iconAction = input(null, ...(ngDevMode ? [{ debugName: "iconAction" }] : /* istanbul ignore next */ []));
|
|
34
38
|
/** Every call folded into this toast; two or more draw a `×N` stack that lists them. */
|
|
35
39
|
occurrences = input([], ...(ngDevMode ? [{ debugName: "occurrences" }] : /* istanbul ignore next */ []));
|
|
36
|
-
/** Fires when the toast is dismissed or its action is invoked
|
|
40
|
+
/** Fires when the toast is dismissed, its action is invoked, or its icon action is invoked without `keepOpen` or `successLabel`. */
|
|
37
41
|
closed = output();
|
|
38
42
|
/** Fires with an occurrence's `id` when its own close button in the list is pressed. */
|
|
39
43
|
occurrenceClosed = output();
|
|
40
44
|
count = computed(() => this.occurrences().length, ...(ngDevMode ? [{ debugName: "count" }] : /* istanbul ignore next */ []));
|
|
41
45
|
stacked = computed(() => this.count() > 1, ...(ngDevMode ? [{ debugName: "stacked" }] : /* istanbul ignore next */ []));
|
|
42
46
|
expanded = signal(false, ...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
47
|
+
iconSucceeded = signal(false, ...(ngDevMode ? [{ debugName: "iconSucceeded" }] : /* istanbul ignore next */ []));
|
|
48
|
+
announcer = inject(LiveAnnouncer);
|
|
49
|
+
iconSuccessTimer;
|
|
43
50
|
toastIntl = computed(() => ({
|
|
44
51
|
...DS_INTL_DEFAULTS.toast,
|
|
45
52
|
...this.intl().toast,
|
|
@@ -52,11 +59,31 @@ class ToastComponent {
|
|
|
52
59
|
isLoading = computed(() => this.variant() === 'loading', ...(ngDevMode ? [{ debugName: "isLoading" }] : /* istanbul ignore next */ []));
|
|
53
60
|
constructor() {
|
|
54
61
|
retainStyles(ToastComponent);
|
|
62
|
+
inject(DestroyRef).onDestroy(() => clearTimeout(this.iconSuccessTimer));
|
|
55
63
|
}
|
|
56
64
|
onAction(action) {
|
|
57
65
|
action.handler();
|
|
58
66
|
this.closed.emit();
|
|
59
67
|
}
|
|
68
|
+
async onIconAction(action) {
|
|
69
|
+
if (!action.successLabel) {
|
|
70
|
+
action.handler();
|
|
71
|
+
if (!action.keepOpen) {
|
|
72
|
+
this.closed.emit();
|
|
73
|
+
}
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
await action.handler();
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
this.iconSucceeded.set(true);
|
|
83
|
+
void this.announcer.announce(action.successLabel, 'polite');
|
|
84
|
+
clearTimeout(this.iconSuccessTimer);
|
|
85
|
+
this.iconSuccessTimer = setTimeout(() => this.iconSucceeded.set(false), ICON_SUCCESS_MS);
|
|
86
|
+
}
|
|
60
87
|
classes = computed(() => `toast ${this.variant()}`, ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
61
88
|
defaultIcon = computed(() => {
|
|
62
89
|
switch (this.variant()) {
|
|
@@ -77,12 +104,12 @@ class ToastComponent {
|
|
|
77
104
|
this.closed.emit();
|
|
78
105
|
}
|
|
79
106
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ToastComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
80
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: ToastComponent, isStandalone: true, selector: "ds-toast", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, body: { classPropertyName: "body", publicName: "body", isSignal: true, isRequired: false, transformFunction: null }, dismissible: { classPropertyName: "dismissible", publicName: "dismissible", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, action: { classPropertyName: "action", publicName: "action", isSignal: true, isRequired: false, transformFunction: null }, occurrences: { classPropertyName: "occurrences", publicName: "occurrences", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closed: "closed", occurrenceClosed: "occurrenceClosed" }, host: { properties: { "attr.title": "null", "class.piled": "stacked() && !expanded()" } }, ngImport: i0, template: "<!-- No role or aria-live: a region created with its text already in it announces nothing;\n ToastService speaks through the CDK LiveAnnouncer. A hand-placed <ds-toast> is silent. -->\n@if (stacked() && !expanded()) {\n <div\n class=\"ghost ghost-far\"\n aria-hidden=\"true\">\n </div>\n\n <div\n class=\"ghost ghost-near\"\n aria-hidden=\"true\">\n </div>\n}\n\n<div [class]=\"classes()\">\n @if (isLoading()) {\n <!-- aria-hidden because ds-spinner is a role=\"status\" of its own: the message is\n announced by ToastService, and a nested live region would speak twice. -->\n <ds-spinner\n class=\"icon\"\n size=\"sm\"\n aria-hidden=\"true\" />\n } @else {\n <ds-icon\n class=\"icon\"\n [name]=\"icon() ?? defaultIcon()\"\n [size]=\"16\" />\n }\n\n <div class=\"body\">\n @if (title()) {\n <div class=\"title\">\n {{ title() }}\n @if (stacked()) {\n <span class=\"count\">\n \u00D7{{ count() }}\n </span>\n }\n </div>\n }\n {{ body() }}\n @if (stacked() && !title()) {\n <span class=\"count\">\n \u00D7{{ count() }}\n </span>\n }\n\n <ng-content></ng-content>\n\n @if (stacked()) {\n <button\n type=\"button\"\n class=\"more\"\n [attr.aria-expanded]=\"expanded()\"\n (click)=\"expanded.set(!expanded())\">\n {{ expanded() ? toastIntl().hide : toastIntl().showAll }}\n </button>\n }\n </div>\n\n @if (action(); as act) {\n <button\n type=\"button\"\n class=\"action\"\n (click)=\"onAction(act)\">\n {{ act.label }}\n </button>\n }\n\n <span class=\"actions\">\n <ng-content select=\"[actions]\"></ng-content>\n </span>\n\n @if (dismissible()) {\n <button\n type=\"button\"\n class=\"close\"\n [attr.aria-label]=\"\n stacked() ? toastIntl().dismissAll : intl().dialog.dismiss\n \"\n (click)=\"onDismiss()\">\n <ds-icon\n name=\"x\"\n [size]=\"14\" />\n </button>\n }\n</div>\n\n@if (stacked() && expanded()) {\n <div class=\"occurrences\">\n @for (occurrence of occurrences(); track occurrence.id) {\n <div [class]=\"classes()\">\n <ds-icon\n class=\"icon\"\n [name]=\"icon() ?? defaultIcon()\"\n [size]=\"16\" />\n\n <div class=\"body\">\n {{ occurrence.body }}\n <span class=\"time\">\n {{ formatTime(occurrence.at) }}\n </span>\n </div>\n\n @if (dismissible()) {\n <button\n type=\"button\"\n class=\"close\"\n [attr.aria-label]=\"intl().dialog.dismiss\"\n (click)=\"occurrenceClosed.emit(occurrence.id)\">\n <ds-icon\n name=\"x\"\n [size]=\"14\" />\n </button>\n }\n </div>\n }\n </div>\n}\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_toast-leave-duration: var(--ds-toast-leave-duration, var(--duration-base));--_toast-leave-easing: var(--ds-toast-leave-easing, var(--ease-standard));--_toast-shift-duration: var(--ds-toast-shift-duration, var(--duration-fast));--_toast-shift-easing: var(--ds-toast-shift-easing, var(--ease-standard));display:block;transition:opacity var(--_toast-leave-duration) var(--_toast-leave-easing),transform var(--_toast-shift-duration) var(--_toast-shift-easing)}:host(.leaving){opacity:0;pointer-events:none}:host(.shifting){transform:translateY(var(--_toast-shift, 0));transition:none}:host(.piled){position:relative;margin-block-end:var(--space-3)}:host(.piled) .toast{position:relative}.ghost{position:absolute;inset-inline:0;height:100%;background-color:var(--surface-overlay-raised);border:var(--border-width-default) solid var(--border-overlay);border-radius:var(--radius-lg);box-shadow:var(--shadow-2)}.ghost-near{top:var(--space-1-5);transform:scale(.96)}.ghost-far{top:var(--space-3);transform:scale(.92)}.occurrences{display:flex;flex-direction:column;gap:var(--space-1-5);margin-block-start:var(--space-1-5)}.toast{--_toast-count-bg-color: var(--accent-muted);--_toast-count-text-color: var(--accent-strong);--_toast-bg-color: var(--ds-toast-bg-color, var(--surface-overlay-raised));--_toast-border: var(--ds-toast-border-color, var(--border-overlay));--surface-secondary: var(--surface-overlay-raised-secondary);--surface-muted: var(--surface-overlay-raised-muted);--_toast-bar-color: var(--ds-toast-bar-color, var(--accent));--_toast-icon-color: var(--ds-toast-icon-color, var(--accent));--_toast-enter-keyframes: var(--ds-toast-enter-keyframes, ds-fade-in);--_toast-enter-duration: var(--ds-toast-enter-duration, var(--ds-motion-enter-large-duration));--_toast-enter-easing: var(--ds-toast-enter-easing, var(--ds-motion-enter-large-easing));--_toast-enter-offset: var(--ds-toast-enter-offset, var(--space-2));--_toast-min-width: var(--ds-toast-min-width, var(--toast-minw));--_toast-max-width: var(--ds-toast-max-width, var(--toast-maxw));--_ds-enter-y: var(--_toast-enter-offset);--_ds-enter-scale: var(--ds-toast-enter-scale, .96);display:flex;align-items:flex-start;gap:var(--space-3);background-color:var(--_toast-bg-color);border:var(--border-width-default) solid var(--_toast-border);border-left:var(--toast-bar-w) solid var(--_toast-bar-color);border-radius:var(--radius-lg);padding:var(--space-3) var(--space-4);box-shadow:var(--shadow-toast);min-width:var(--_toast-min-width);max-width:var(--_toast-max-width);animation-name:var(--_toast-enter-keyframes);animation-duration:var(--_toast-enter-duration);animation-timing-function:var(--_toast-enter-easing)}@media(prefers-reduced-motion:reduce){.toast{--_toast-enter-duration: 0ms}}.toast .icon{color:var(--_toast-icon-color);flex-shrink:0;align-self:center}.toast .body{flex:1;min-width:0;overflow-wrap:anywhere;font:var(--font-weight-regular) var(--font-size-s)/var(--line-height-base) var(--font-sans);color:var(--text-secondary)}.toast .title{font-weight:var(--font-weight-bold);color:var(--text-primary);margin-bottom:var(--space-0-5)}.toast .count{display:inline-block;margin-inline-start:var(--space-1-5);padding:0 var(--space-1-5);border-radius:var(--radius-pill);background-color:var(--_toast-count-bg-color);color:var(--_toast-count-text-color);font:var(--font-weight-semibold) var(--font-size-xs)/var(--line-height-base) var(--font-sans)}.toast .time{margin-inline-start:var(--space-1);color:var(--text-tertiary-overlay);font-size:var(--font-size-xs)}.toast .more{display:block;margin-block-start:var(--space-1);padding:0;border:0;border-radius:var(--ds-radius-inner);background:transparent;color:var(--text-link);font:var(--font-weight-semibold) var(--font-size-xs)/var(--line-height-base) var(--font-sans);cursor:pointer}.toast .more:focus-visible{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.toast .close{display:inline-flex;align-items:center;justify-content:center;padding:var(--space-0-5);border:0;background:none;cursor:pointer}.toast .close:active:not(:disabled,[disabled],.is-disabled,.disabled,[aria-disabled=true]){filter:brightness(var(--ds-press-brightness, .9));transform:scale(var(--ds-press-scale, .97))}.toast .close{position:relative}.toast .close:before{content:\"\";position:absolute;top:50%;left:50%;width:max(100%,var(--hit-xs));height:max(100%,var(--hit-xs));translate:-50% -50%;border-radius:inherit}.toast .close:focus-visible{outline-style:none}.toast .close:focus-visible:before{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:calc(var(--focus-ring-offset) - 2 * var(--focus-ring-width));animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.toast .close{color:var(--icon-default)}.toast .action{flex-shrink:0;align-self:center;border:0;background:transparent;color:var(--accent-strong);font:var(--font-weight-bold) var(--font-size-s)/var(--line-height-flat) var(--font-sans);cursor:pointer;padding:var(--space-1) var(--space-2);border-radius:var(--ds-radius-inner)}.toast .action:hover{background:var(--surface-secondary)}.toast .action:active{background:var(--surface-muted)}.toast .action:focus-visible{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.toast .actions{display:inline-flex;align-items:center;gap:var(--space-2);flex-shrink:0}.toast .actions:empty{display:none}.toast.info{--_toast-bg-color: var(--ds-toast-bg-color-info, var(--ds-toast-bg-color, var(--surface-overlay-raised)));--_toast-border: var(--ds-toast-border-color-info, var(--ds-toast-border-color, var(--border-overlay)));--_toast-bar-color: var(--ds-toast-bar-color, var(--accent));--_toast-icon-color: var(--ds-toast-icon-color, var(--accent));border-left-color:var(--_toast-bar-color)}.toast.success{--_toast-bg-color: var(--ds-toast-bg-color-success, var(--ds-toast-bg-color, var(--surface-overlay-raised)));--_toast-border: var(--ds-toast-border-color-success, var(--ds-toast-border-color, var(--border-overlay)));--_toast-bar-color: var(--ds-toast-bar-color, var(--success));--_toast-icon-color: var(--ds-toast-icon-color, var(--success));--_toast-count-bg-color: var(--success-muted);--_toast-count-text-color: var(--success-text);border-left-color:var(--_toast-bar-color)}.toast.success .icon{color:var(--_toast-icon-color)}.toast.warning{--_toast-bg-color: var(--ds-toast-bg-color-warning, var(--ds-toast-bg-color, var(--surface-overlay-raised)));--_toast-border: var(--ds-toast-border-color-warning, var(--ds-toast-border-color, var(--border-overlay)));--_toast-bar-color: var(--ds-toast-bar-color, var(--warning-hover));--_toast-icon-color: var(--ds-toast-icon-color, var(--warning-hover));--_toast-count-bg-color: var(--warning-muted);--_toast-count-text-color: var(--warning-text);border-left-color:var(--_toast-bar-color)}.toast.warning .icon{color:var(--_toast-icon-color)}.toast.error{--_toast-bg-color: var(--ds-toast-bg-color-error, var(--ds-toast-bg-color, var(--surface-overlay-raised)));--_toast-border: var(--ds-toast-border-color-error, var(--ds-toast-border-color, var(--border-overlay)));--_toast-bar-color: var(--ds-toast-bar-color, var(--error));--_toast-icon-color: var(--ds-toast-icon-color, var(--error));--_toast-count-bg-color: var(--error-muted);--_toast-count-text-color: var(--error-text);border-left-color:var(--_toast-bar-color)}.toast.error .icon{color:var(--_toast-icon-color)}.toast.loading{border-left-color:var(--accent)}.toast.loading .icon{color:var(--accent)}\n"], dependencies: [{ kind: "component", type: IconComponent, selector: "ds-icon", inputs: ["name", "size", "stroke", "ariaLabel"] }, { kind: "component", type: SpinnerComponent, selector: "ds-spinner", inputs: ["size"] }] });
|
|
107
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: ToastComponent, isStandalone: true, selector: "ds-toast", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, body: { classPropertyName: "body", publicName: "body", isSignal: true, isRequired: false, transformFunction: null }, dismissible: { classPropertyName: "dismissible", publicName: "dismissible", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, action: { classPropertyName: "action", publicName: "action", isSignal: true, isRequired: false, transformFunction: null }, iconAction: { classPropertyName: "iconAction", publicName: "iconAction", isSignal: true, isRequired: false, transformFunction: null }, occurrences: { classPropertyName: "occurrences", publicName: "occurrences", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closed: "closed", occurrenceClosed: "occurrenceClosed" }, host: { properties: { "attr.title": "null", "class.piled": "stacked() && !expanded()" } }, ngImport: i0, template: "<!-- No role or aria-live: a region created with its text already in it announces nothing;\n ToastService speaks through the CDK LiveAnnouncer. A hand-placed <ds-toast> is silent. -->\n@if (stacked() && !expanded()) {\n <div\n class=\"ghost ghost-far\"\n aria-hidden=\"true\">\n </div>\n\n <div\n class=\"ghost ghost-near\"\n aria-hidden=\"true\">\n </div>\n}\n\n<div [class]=\"classes()\">\n @if (isLoading()) {\n <!-- aria-hidden because ds-spinner is a role=\"status\" of its own: the message is\n announced by ToastService, and a nested live region would speak twice. -->\n <ds-spinner\n class=\"icon\"\n size=\"sm\"\n aria-hidden=\"true\" />\n } @else {\n <ds-icon\n class=\"icon\"\n [name]=\"icon() ?? defaultIcon()\"\n [size]=\"16\" />\n }\n\n <div class=\"body\">\n @if (title()) {\n <div class=\"title\">\n {{ title() }}\n @if (stacked()) {\n <span class=\"count\">\n \u00D7{{ count() }}\n </span>\n }\n </div>\n }\n {{ body() }}\n @if (stacked() && !title()) {\n <span class=\"count\">\n \u00D7{{ count() }}\n </span>\n }\n\n <ng-content></ng-content>\n\n @if (stacked()) {\n <button\n type=\"button\"\n class=\"more\"\n [attr.aria-expanded]=\"expanded()\"\n (click)=\"expanded.set(!expanded())\">\n {{ expanded() ? toastIntl().hide : toastIntl().showAll }}\n </button>\n }\n </div>\n\n @if (action(); as act) {\n <button\n type=\"button\"\n class=\"action\"\n (click)=\"onAction(act)\">\n {{ act.label }}\n </button>\n }\n\n @if (iconAction(); as iconAct) {\n <button\n type=\"button\"\n class=\"icon-action\"\n [class.succeeded]=\"iconSucceeded()\"\n [attr.aria-label]=\"iconAct.label\"\n [dsTooltip]=\"iconAct.label\"\n (click)=\"onIconAction(iconAct)\">\n <ds-icon\n class=\"icon-action-icon\"\n [name]=\"iconAct.icon\"\n [size]=\"14\" />\n\n @if (iconAct.successLabel) {\n <ds-icon\n class=\"icon-action-check\"\n name=\"check\"\n [size]=\"14\" />\n }\n </button>\n }\n\n <span class=\"actions\">\n <ng-content select=\"[actions]\"></ng-content>\n </span>\n\n @if (dismissible()) {\n <button\n type=\"button\"\n class=\"close\"\n [attr.aria-label]=\"\n stacked() ? toastIntl().dismissAll : intl().dialog.dismiss\n \"\n (click)=\"onDismiss()\">\n <ds-icon\n name=\"x\"\n [size]=\"14\" />\n </button>\n }\n</div>\n\n@if (stacked() && expanded()) {\n <div class=\"occurrences\">\n @for (occurrence of occurrences(); track occurrence.id) {\n <div [class]=\"classes()\">\n <ds-icon\n class=\"icon\"\n [name]=\"icon() ?? defaultIcon()\"\n [size]=\"16\" />\n\n <div class=\"body\">\n {{ occurrence.body }}\n <span class=\"time\">\n {{ formatTime(occurrence.at) }}\n </span>\n </div>\n\n @if (dismissible()) {\n <button\n type=\"button\"\n class=\"close\"\n [attr.aria-label]=\"intl().dialog.dismiss\"\n (click)=\"occurrenceClosed.emit(occurrence.id)\">\n <ds-icon\n name=\"x\"\n [size]=\"14\" />\n </button>\n }\n </div>\n }\n </div>\n}\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_toast-leave-duration: var(--ds-toast-leave-duration, var(--duration-base));--_toast-leave-easing: var(--ds-toast-leave-easing, var(--ease-standard));--_toast-shift-duration: var(--ds-toast-shift-duration, var(--duration-fast));--_toast-shift-easing: var(--ds-toast-shift-easing, var(--ease-standard));isolation:isolate;display:block;transition:opacity var(--_toast-leave-duration) var(--_toast-leave-easing),transform var(--_toast-shift-duration) var(--_toast-shift-easing)}@media(prefers-reduced-motion:reduce){:host{--_toast-leave-duration: 0ms;--_toast-shift-duration: 0ms}}:host(.leaving){opacity:0;transform:translateY(calc(var(--_toast-leave-toward, -1) * var(--ds-toast-enter-offset, var(--space-2))));pointer-events:none;transition:opacity var(--_toast-leave-duration) var(--_toast-leave-easing),transform var(--_toast-leave-duration) var(--_toast-leave-easing)}:host(.shifting){transform:translateY(var(--_toast-shift, 0));transition:none}:host(.piled){position:relative;margin-block-end:var(--space-3)}:host(.piled) .toast{position:relative}.ghost{position:absolute;inset-inline:0;height:100%;background-color:var(--surface-overlay-raised);border:var(--border-width-default) solid var(--border-overlay);border-radius:var(--radius-lg);box-shadow:var(--shadow-2)}.ghost-near{top:var(--space-1-5);transform:scale(.96)}.ghost-far{top:var(--space-3);transform:scale(.92)}.occurrences{display:flex;flex-direction:column;gap:var(--space-1-5);margin-block-start:var(--space-1-5)}.toast{--_toast-count-bg-color: var(--accent-muted);--_toast-count-text-color: var(--accent-strong);--_toast-bg-color: var(--ds-toast-bg-color, var(--surface-overlay-raised));--_toast-border: var(--ds-toast-border-color, var(--border-overlay));--surface-secondary: var(--surface-overlay-raised-secondary);--surface-muted: var(--surface-overlay-raised-muted);--_toast-bar-color: var(--ds-toast-bar-color, var(--accent));--_toast-icon-color: var(--ds-toast-icon-color, var(--accent));--_toast-enter-keyframes: var(--ds-toast-enter-keyframes, ds-fade-in);--_toast-enter-duration: var(--ds-toast-enter-duration, var(--ds-motion-enter-large-duration));--_toast-enter-easing: var(--ds-toast-enter-easing, var(--ds-motion-enter-large-easing));--_toast-enter-offset: var(--ds-toast-enter-offset, var(--space-2));--_toast-min-width: var(--ds-toast-min-width, var(--toast-minw));--_toast-max-width: var(--ds-toast-max-width, var(--toast-maxw));--_ds-enter-y: var(--_toast-enter-offset);--_ds-enter-scale: var(--ds-toast-enter-scale, .96);display:flex;align-items:flex-start;gap:var(--space-3);background-color:var(--_toast-bg-color);border:var(--border-width-default) solid var(--_toast-border);border-left:var(--toast-bar-w) solid var(--_toast-bar-color);border-radius:var(--radius-lg);padding:var(--space-3) var(--space-4);box-shadow:var(--shadow-toast);min-width:var(--_toast-min-width);max-width:var(--_toast-max-width);animation-name:var(--_toast-enter-keyframes);animation-duration:var(--_toast-enter-duration);animation-timing-function:var(--_toast-enter-easing)}@media(prefers-reduced-motion:reduce){.toast{--_toast-enter-duration: 0ms}}.toast .icon{color:var(--_toast-icon-color);flex-shrink:0;align-self:center}.toast .body{flex:1;min-width:0;overflow-wrap:anywhere;font:var(--font-weight-regular) var(--font-size-s)/var(--line-height-base) var(--font-sans);color:var(--text-secondary)}.toast .title{font-weight:var(--font-weight-bold);color:var(--text-primary);margin-bottom:var(--space-0-5)}.toast .count{display:inline-block;margin-inline-start:var(--space-1-5);padding:0 var(--space-1-5);border-radius:var(--radius-pill);background-color:var(--_toast-count-bg-color);color:var(--_toast-count-text-color);font:var(--font-weight-semibold) var(--font-size-xs)/var(--line-height-base) var(--font-sans)}@supports (text-box: trim-both cap alphabetic){.toast .count{text-box:trim-both cap alphabetic;padding-block:calc((1lh - 1cap)/2)}}.toast .time{margin-inline-start:var(--space-1);color:var(--text-tertiary-overlay);font-size:var(--font-size-xs)}.toast .more{display:block;margin-block-start:var(--space-1);padding:0;border:0;border-radius:var(--ds-radius-inner);background:transparent;color:var(--text-link);font:var(--font-weight-semibold) var(--font-size-xs)/var(--line-height-base) var(--font-sans);cursor:pointer}.toast .more:focus-visible{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.toast .close,.toast .icon-action{display:inline-flex;align-items:center;justify-content:center;padding:var(--space-0-5);border:0;background:none;cursor:pointer}.toast .close:active:not(:disabled,[disabled],.is-disabled,.disabled,[aria-disabled=true]),.toast .icon-action:active:not(:disabled,[disabled],.is-disabled,.disabled,[aria-disabled=true]){filter:brightness(var(--ds-press-brightness, .9));transform:scale(var(--ds-press-scale, .97))}.toast .close,.toast .icon-action{position:relative}.toast .close:before,.toast .icon-action:before{content:\"\";position:absolute;top:50%;left:50%;width:max(100%,var(--hit-xs));height:max(100%,var(--hit-xs));translate:-50% -50%;border-radius:inherit}.toast .close:focus-visible,.toast .icon-action:focus-visible{outline-style:none}.toast .close:focus-visible:before,.toast .icon-action:focus-visible:before{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:calc(var(--focus-ring-offset) - 2 * var(--focus-ring-width));animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.toast .close,.toast .icon-action{color:var(--icon-default)}.toast .icon-action{align-self:center;display:inline-grid;place-items:center}.toast .icon-action-icon,.toast .icon-action-check{grid-area:1/1;transition:opacity var(--duration-fast) var(--ease-standard),scale var(--duration-fast) var(--ease-standard)}.toast .icon-action-check{color:var(--success-text);opacity:0;scale:.8}.toast .icon-action.succeeded .icon-action-icon{opacity:0}.toast .icon-action.succeeded .icon-action-check{opacity:1;scale:1;transition:opacity var(--duration-base) var(--ease-settle),scale var(--duration-base) var(--ease-settle)}.toast .action{flex-shrink:0;align-self:center;border:0;background:transparent;color:var(--accent-strong);font:var(--font-weight-bold) var(--font-size-s)/var(--line-height-flat) var(--font-sans);cursor:pointer;padding:var(--space-1) var(--space-2);border-radius:var(--ds-radius-inner)}.toast .action:hover{background:var(--state-layer-hover)}.toast .action:active{background:var(--state-layer-pressed)}.toast .action:focus-visible{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.toast .actions{display:inline-flex;align-self:center;align-items:center;gap:var(--space-2);flex-shrink:0}.toast .actions:empty{display:none}.toast.info{--_toast-bg-color: var(--ds-toast-bg-color-info, var(--ds-toast-bg-color, var(--surface-overlay-raised)));--_toast-border: var(--ds-toast-border-color-info, var(--ds-toast-border-color, var(--border-overlay)));--_toast-bar-color: var(--ds-toast-bar-color, var(--accent));--_toast-icon-color: var(--ds-toast-icon-color, var(--accent));border-left-color:var(--_toast-bar-color)}.toast.success{--_toast-bg-color: var(--ds-toast-bg-color-success, var(--ds-toast-bg-color, var(--surface-overlay-raised)));--_toast-border: var(--ds-toast-border-color-success, var(--ds-toast-border-color, var(--border-overlay)));--_toast-bar-color: var(--ds-toast-bar-color, var(--success));--_toast-icon-color: var(--ds-toast-icon-color, var(--success));--_toast-count-bg-color: var(--success-muted);--_toast-count-text-color: var(--success-text);border-left-color:var(--_toast-bar-color)}.toast.success .icon{color:var(--_toast-icon-color)}.toast.warning{--_toast-bg-color: var(--ds-toast-bg-color-warning, var(--ds-toast-bg-color, var(--surface-overlay-raised)));--_toast-border: var(--ds-toast-border-color-warning, var(--ds-toast-border-color, var(--border-overlay)));--_toast-bar-color: var(--ds-toast-bar-color, var(--warning-hover));--_toast-icon-color: var(--ds-toast-icon-color, var(--warning-hover));--_toast-count-bg-color: var(--warning-muted);--_toast-count-text-color: var(--warning-text);border-left-color:var(--_toast-bar-color)}.toast.warning .icon{color:var(--_toast-icon-color)}.toast.error{--_toast-bg-color: var(--ds-toast-bg-color-error, var(--ds-toast-bg-color, var(--surface-overlay-raised)));--_toast-border: var(--ds-toast-border-color-error, var(--ds-toast-border-color, var(--border-overlay)));--_toast-bar-color: var(--ds-toast-bar-color, var(--error));--_toast-icon-color: var(--ds-toast-icon-color, var(--error));--_toast-count-bg-color: var(--error-muted);--_toast-count-text-color: var(--error-text);border-left-color:var(--_toast-bar-color)}.toast.error .icon{color:var(--_toast-icon-color)}.toast.loading{border-left-color:var(--accent)}.toast.loading .icon{color:var(--accent)}\n"], dependencies: [{ kind: "component", type: IconComponent, selector: "ds-icon", inputs: ["name", "size", "stroke", "ariaLabel"] }, { kind: "component", type: SpinnerComponent, selector: "ds-spinner", inputs: ["size"] }, { kind: "directive", type: TooltipDirective, selector: "[dsTooltip], [dsTooltipWhenClipped]", inputs: ["dsTooltip", "dsTooltipConfig", "dsTooltipPlacement", "dsTooltipDelay", "dsTooltipArrow", "dsTooltipWhenClipped", "dsTooltipPinOnClick"] }] });
|
|
81
108
|
}
|
|
82
109
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ToastComponent, decorators: [{
|
|
83
110
|
type: Component,
|
|
84
|
-
args: [{ selector: 'ds-toast', standalone: true, imports: [IconComponent, SpinnerComponent], host: { '[attr.title]': 'null', '[class.piled]': 'stacked() && !expanded()' }, encapsulation: ViewEncapsulation.Emulated, template: "<!-- No role or aria-live: a region created with its text already in it announces nothing;\n ToastService speaks through the CDK LiveAnnouncer. A hand-placed <ds-toast> is silent. -->\n@if (stacked() && !expanded()) {\n <div\n class=\"ghost ghost-far\"\n aria-hidden=\"true\">\n </div>\n\n <div\n class=\"ghost ghost-near\"\n aria-hidden=\"true\">\n </div>\n}\n\n<div [class]=\"classes()\">\n @if (isLoading()) {\n <!-- aria-hidden because ds-spinner is a role=\"status\" of its own: the message is\n announced by ToastService, and a nested live region would speak twice. -->\n <ds-spinner\n class=\"icon\"\n size=\"sm\"\n aria-hidden=\"true\" />\n } @else {\n <ds-icon\n class=\"icon\"\n [name]=\"icon() ?? defaultIcon()\"\n [size]=\"16\" />\n }\n\n <div class=\"body\">\n @if (title()) {\n <div class=\"title\">\n {{ title() }}\n @if (stacked()) {\n <span class=\"count\">\n \u00D7{{ count() }}\n </span>\n }\n </div>\n }\n {{ body() }}\n @if (stacked() && !title()) {\n <span class=\"count\">\n \u00D7{{ count() }}\n </span>\n }\n\n <ng-content></ng-content>\n\n @if (stacked()) {\n <button\n type=\"button\"\n class=\"more\"\n [attr.aria-expanded]=\"expanded()\"\n (click)=\"expanded.set(!expanded())\">\n {{ expanded() ? toastIntl().hide : toastIntl().showAll }}\n </button>\n }\n </div>\n\n @if (action(); as act) {\n <button\n type=\"button\"\n class=\"action\"\n (click)=\"onAction(act)\">\n {{ act.label }}\n </button>\n }\n\n <span class=\"actions\">\n <ng-content select=\"[actions]\"></ng-content>\n </span>\n\n @if (dismissible()) {\n <button\n type=\"button\"\n class=\"close\"\n [attr.aria-label]=\"\n stacked() ? toastIntl().dismissAll : intl().dialog.dismiss\n \"\n (click)=\"onDismiss()\">\n <ds-icon\n name=\"x\"\n [size]=\"14\" />\n </button>\n }\n</div>\n\n@if (stacked() && expanded()) {\n <div class=\"occurrences\">\n @for (occurrence of occurrences(); track occurrence.id) {\n <div [class]=\"classes()\">\n <ds-icon\n class=\"icon\"\n [name]=\"icon() ?? defaultIcon()\"\n [size]=\"16\" />\n\n <div class=\"body\">\n {{ occurrence.body }}\n <span class=\"time\">\n {{ formatTime(occurrence.at) }}\n </span>\n </div>\n\n @if (dismissible()) {\n <button\n type=\"button\"\n class=\"close\"\n [attr.aria-label]=\"intl().dialog.dismiss\"\n (click)=\"occurrenceClosed.emit(occurrence.id)\">\n <ds-icon\n name=\"x\"\n [size]=\"14\" />\n </button>\n }\n </div>\n }\n </div>\n}\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_toast-leave-duration: var(--ds-toast-leave-duration, var(--duration-base));--_toast-leave-easing: var(--ds-toast-leave-easing, var(--ease-standard));--_toast-shift-duration: var(--ds-toast-shift-duration, var(--duration-fast));--_toast-shift-easing: var(--ds-toast-shift-easing, var(--ease-standard));display:block;transition:opacity var(--_toast-leave-duration) var(--_toast-leave-easing),transform var(--_toast-shift-duration) var(--_toast-shift-easing)}:host(.leaving){opacity:0;pointer-events:none}:host(.shifting){transform:translateY(var(--_toast-shift, 0));transition:none}:host(.piled){position:relative;margin-block-end:var(--space-3)}:host(.piled) .toast{position:relative}.ghost{position:absolute;inset-inline:0;height:100%;background-color:var(--surface-overlay-raised);border:var(--border-width-default) solid var(--border-overlay);border-radius:var(--radius-lg);box-shadow:var(--shadow-2)}.ghost-near{top:var(--space-1-5);transform:scale(.96)}.ghost-far{top:var(--space-3);transform:scale(.92)}.occurrences{display:flex;flex-direction:column;gap:var(--space-1-5);margin-block-start:var(--space-1-5)}.toast{--_toast-count-bg-color: var(--accent-muted);--_toast-count-text-color: var(--accent-strong);--_toast-bg-color: var(--ds-toast-bg-color, var(--surface-overlay-raised));--_toast-border: var(--ds-toast-border-color, var(--border-overlay));--surface-secondary: var(--surface-overlay-raised-secondary);--surface-muted: var(--surface-overlay-raised-muted);--_toast-bar-color: var(--ds-toast-bar-color, var(--accent));--_toast-icon-color: var(--ds-toast-icon-color, var(--accent));--_toast-enter-keyframes: var(--ds-toast-enter-keyframes, ds-fade-in);--_toast-enter-duration: var(--ds-toast-enter-duration, var(--ds-motion-enter-large-duration));--_toast-enter-easing: var(--ds-toast-enter-easing, var(--ds-motion-enter-large-easing));--_toast-enter-offset: var(--ds-toast-enter-offset, var(--space-2));--_toast-min-width: var(--ds-toast-min-width, var(--toast-minw));--_toast-max-width: var(--ds-toast-max-width, var(--toast-maxw));--_ds-enter-y: var(--_toast-enter-offset);--_ds-enter-scale: var(--ds-toast-enter-scale, .96);display:flex;align-items:flex-start;gap:var(--space-3);background-color:var(--_toast-bg-color);border:var(--border-width-default) solid var(--_toast-border);border-left:var(--toast-bar-w) solid var(--_toast-bar-color);border-radius:var(--radius-lg);padding:var(--space-3) var(--space-4);box-shadow:var(--shadow-toast);min-width:var(--_toast-min-width);max-width:var(--_toast-max-width);animation-name:var(--_toast-enter-keyframes);animation-duration:var(--_toast-enter-duration);animation-timing-function:var(--_toast-enter-easing)}@media(prefers-reduced-motion:reduce){.toast{--_toast-enter-duration: 0ms}}.toast .icon{color:var(--_toast-icon-color);flex-shrink:0;align-self:center}.toast .body{flex:1;min-width:0;overflow-wrap:anywhere;font:var(--font-weight-regular) var(--font-size-s)/var(--line-height-base) var(--font-sans);color:var(--text-secondary)}.toast .title{font-weight:var(--font-weight-bold);color:var(--text-primary);margin-bottom:var(--space-0-5)}.toast .count{display:inline-block;margin-inline-start:var(--space-1-5);padding:0 var(--space-1-5);border-radius:var(--radius-pill);background-color:var(--_toast-count-bg-color);color:var(--_toast-count-text-color);font:var(--font-weight-semibold) var(--font-size-xs)/var(--line-height-base) var(--font-sans)}.toast .time{margin-inline-start:var(--space-1);color:var(--text-tertiary-overlay);font-size:var(--font-size-xs)}.toast .more{display:block;margin-block-start:var(--space-1);padding:0;border:0;border-radius:var(--ds-radius-inner);background:transparent;color:var(--text-link);font:var(--font-weight-semibold) var(--font-size-xs)/var(--line-height-base) var(--font-sans);cursor:pointer}.toast .more:focus-visible{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.toast .close{display:inline-flex;align-items:center;justify-content:center;padding:var(--space-0-5);border:0;background:none;cursor:pointer}.toast .close:active:not(:disabled,[disabled],.is-disabled,.disabled,[aria-disabled=true]){filter:brightness(var(--ds-press-brightness, .9));transform:scale(var(--ds-press-scale, .97))}.toast .close{position:relative}.toast .close:before{content:\"\";position:absolute;top:50%;left:50%;width:max(100%,var(--hit-xs));height:max(100%,var(--hit-xs));translate:-50% -50%;border-radius:inherit}.toast .close:focus-visible{outline-style:none}.toast .close:focus-visible:before{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:calc(var(--focus-ring-offset) - 2 * var(--focus-ring-width));animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.toast .close{color:var(--icon-default)}.toast .action{flex-shrink:0;align-self:center;border:0;background:transparent;color:var(--accent-strong);font:var(--font-weight-bold) var(--font-size-s)/var(--line-height-flat) var(--font-sans);cursor:pointer;padding:var(--space-1) var(--space-2);border-radius:var(--ds-radius-inner)}.toast .action:hover{background:var(--surface-secondary)}.toast .action:active{background:var(--surface-muted)}.toast .action:focus-visible{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.toast .actions{display:inline-flex;align-items:center;gap:var(--space-2);flex-shrink:0}.toast .actions:empty{display:none}.toast.info{--_toast-bg-color: var(--ds-toast-bg-color-info, var(--ds-toast-bg-color, var(--surface-overlay-raised)));--_toast-border: var(--ds-toast-border-color-info, var(--ds-toast-border-color, var(--border-overlay)));--_toast-bar-color: var(--ds-toast-bar-color, var(--accent));--_toast-icon-color: var(--ds-toast-icon-color, var(--accent));border-left-color:var(--_toast-bar-color)}.toast.success{--_toast-bg-color: var(--ds-toast-bg-color-success, var(--ds-toast-bg-color, var(--surface-overlay-raised)));--_toast-border: var(--ds-toast-border-color-success, var(--ds-toast-border-color, var(--border-overlay)));--_toast-bar-color: var(--ds-toast-bar-color, var(--success));--_toast-icon-color: var(--ds-toast-icon-color, var(--success));--_toast-count-bg-color: var(--success-muted);--_toast-count-text-color: var(--success-text);border-left-color:var(--_toast-bar-color)}.toast.success .icon{color:var(--_toast-icon-color)}.toast.warning{--_toast-bg-color: var(--ds-toast-bg-color-warning, var(--ds-toast-bg-color, var(--surface-overlay-raised)));--_toast-border: var(--ds-toast-border-color-warning, var(--ds-toast-border-color, var(--border-overlay)));--_toast-bar-color: var(--ds-toast-bar-color, var(--warning-hover));--_toast-icon-color: var(--ds-toast-icon-color, var(--warning-hover));--_toast-count-bg-color: var(--warning-muted);--_toast-count-text-color: var(--warning-text);border-left-color:var(--_toast-bar-color)}.toast.warning .icon{color:var(--_toast-icon-color)}.toast.error{--_toast-bg-color: var(--ds-toast-bg-color-error, var(--ds-toast-bg-color, var(--surface-overlay-raised)));--_toast-border: var(--ds-toast-border-color-error, var(--ds-toast-border-color, var(--border-overlay)));--_toast-bar-color: var(--ds-toast-bar-color, var(--error));--_toast-icon-color: var(--ds-toast-icon-color, var(--error));--_toast-count-bg-color: var(--error-muted);--_toast-count-text-color: var(--error-text);border-left-color:var(--_toast-bar-color)}.toast.error .icon{color:var(--_toast-icon-color)}.toast.loading{border-left-color:var(--accent)}.toast.loading .icon{color:var(--accent)}\n"] }]
|
|
85
|
-
}], ctorParameters: () => [], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], body: [{ type: i0.Input, args: [{ isSignal: true, alias: "body", required: false }] }], dismissible: [{ type: i0.Input, args: [{ isSignal: true, alias: "dismissible", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], action: [{ type: i0.Input, args: [{ isSignal: true, alias: "action", required: false }] }], occurrences: [{ type: i0.Input, args: [{ isSignal: true, alias: "occurrences", required: false }] }], closed: [{ type: i0.Output, args: ["closed"] }], occurrenceClosed: [{ type: i0.Output, args: ["occurrenceClosed"] }] } });
|
|
111
|
+
args: [{ selector: 'ds-toast', standalone: true, imports: [IconComponent, SpinnerComponent, TooltipDirective], host: { '[attr.title]': 'null', '[class.piled]': 'stacked() && !expanded()' }, encapsulation: ViewEncapsulation.Emulated, template: "<!-- No role or aria-live: a region created with its text already in it announces nothing;\n ToastService speaks through the CDK LiveAnnouncer. A hand-placed <ds-toast> is silent. -->\n@if (stacked() && !expanded()) {\n <div\n class=\"ghost ghost-far\"\n aria-hidden=\"true\">\n </div>\n\n <div\n class=\"ghost ghost-near\"\n aria-hidden=\"true\">\n </div>\n}\n\n<div [class]=\"classes()\">\n @if (isLoading()) {\n <!-- aria-hidden because ds-spinner is a role=\"status\" of its own: the message is\n announced by ToastService, and a nested live region would speak twice. -->\n <ds-spinner\n class=\"icon\"\n size=\"sm\"\n aria-hidden=\"true\" />\n } @else {\n <ds-icon\n class=\"icon\"\n [name]=\"icon() ?? defaultIcon()\"\n [size]=\"16\" />\n }\n\n <div class=\"body\">\n @if (title()) {\n <div class=\"title\">\n {{ title() }}\n @if (stacked()) {\n <span class=\"count\">\n \u00D7{{ count() }}\n </span>\n }\n </div>\n }\n {{ body() }}\n @if (stacked() && !title()) {\n <span class=\"count\">\n \u00D7{{ count() }}\n </span>\n }\n\n <ng-content></ng-content>\n\n @if (stacked()) {\n <button\n type=\"button\"\n class=\"more\"\n [attr.aria-expanded]=\"expanded()\"\n (click)=\"expanded.set(!expanded())\">\n {{ expanded() ? toastIntl().hide : toastIntl().showAll }}\n </button>\n }\n </div>\n\n @if (action(); as act) {\n <button\n type=\"button\"\n class=\"action\"\n (click)=\"onAction(act)\">\n {{ act.label }}\n </button>\n }\n\n @if (iconAction(); as iconAct) {\n <button\n type=\"button\"\n class=\"icon-action\"\n [class.succeeded]=\"iconSucceeded()\"\n [attr.aria-label]=\"iconAct.label\"\n [dsTooltip]=\"iconAct.label\"\n (click)=\"onIconAction(iconAct)\">\n <ds-icon\n class=\"icon-action-icon\"\n [name]=\"iconAct.icon\"\n [size]=\"14\" />\n\n @if (iconAct.successLabel) {\n <ds-icon\n class=\"icon-action-check\"\n name=\"check\"\n [size]=\"14\" />\n }\n </button>\n }\n\n <span class=\"actions\">\n <ng-content select=\"[actions]\"></ng-content>\n </span>\n\n @if (dismissible()) {\n <button\n type=\"button\"\n class=\"close\"\n [attr.aria-label]=\"\n stacked() ? toastIntl().dismissAll : intl().dialog.dismiss\n \"\n (click)=\"onDismiss()\">\n <ds-icon\n name=\"x\"\n [size]=\"14\" />\n </button>\n }\n</div>\n\n@if (stacked() && expanded()) {\n <div class=\"occurrences\">\n @for (occurrence of occurrences(); track occurrence.id) {\n <div [class]=\"classes()\">\n <ds-icon\n class=\"icon\"\n [name]=\"icon() ?? defaultIcon()\"\n [size]=\"16\" />\n\n <div class=\"body\">\n {{ occurrence.body }}\n <span class=\"time\">\n {{ formatTime(occurrence.at) }}\n </span>\n </div>\n\n @if (dismissible()) {\n <button\n type=\"button\"\n class=\"close\"\n [attr.aria-label]=\"intl().dialog.dismiss\"\n (click)=\"occurrenceClosed.emit(occurrence.id)\">\n <ds-icon\n name=\"x\"\n [size]=\"14\" />\n </button>\n }\n </div>\n }\n </div>\n}\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_toast-leave-duration: var(--ds-toast-leave-duration, var(--duration-base));--_toast-leave-easing: var(--ds-toast-leave-easing, var(--ease-standard));--_toast-shift-duration: var(--ds-toast-shift-duration, var(--duration-fast));--_toast-shift-easing: var(--ds-toast-shift-easing, var(--ease-standard));isolation:isolate;display:block;transition:opacity var(--_toast-leave-duration) var(--_toast-leave-easing),transform var(--_toast-shift-duration) var(--_toast-shift-easing)}@media(prefers-reduced-motion:reduce){:host{--_toast-leave-duration: 0ms;--_toast-shift-duration: 0ms}}:host(.leaving){opacity:0;transform:translateY(calc(var(--_toast-leave-toward, -1) * var(--ds-toast-enter-offset, var(--space-2))));pointer-events:none;transition:opacity var(--_toast-leave-duration) var(--_toast-leave-easing),transform var(--_toast-leave-duration) var(--_toast-leave-easing)}:host(.shifting){transform:translateY(var(--_toast-shift, 0));transition:none}:host(.piled){position:relative;margin-block-end:var(--space-3)}:host(.piled) .toast{position:relative}.ghost{position:absolute;inset-inline:0;height:100%;background-color:var(--surface-overlay-raised);border:var(--border-width-default) solid var(--border-overlay);border-radius:var(--radius-lg);box-shadow:var(--shadow-2)}.ghost-near{top:var(--space-1-5);transform:scale(.96)}.ghost-far{top:var(--space-3);transform:scale(.92)}.occurrences{display:flex;flex-direction:column;gap:var(--space-1-5);margin-block-start:var(--space-1-5)}.toast{--_toast-count-bg-color: var(--accent-muted);--_toast-count-text-color: var(--accent-strong);--_toast-bg-color: var(--ds-toast-bg-color, var(--surface-overlay-raised));--_toast-border: var(--ds-toast-border-color, var(--border-overlay));--surface-secondary: var(--surface-overlay-raised-secondary);--surface-muted: var(--surface-overlay-raised-muted);--_toast-bar-color: var(--ds-toast-bar-color, var(--accent));--_toast-icon-color: var(--ds-toast-icon-color, var(--accent));--_toast-enter-keyframes: var(--ds-toast-enter-keyframes, ds-fade-in);--_toast-enter-duration: var(--ds-toast-enter-duration, var(--ds-motion-enter-large-duration));--_toast-enter-easing: var(--ds-toast-enter-easing, var(--ds-motion-enter-large-easing));--_toast-enter-offset: var(--ds-toast-enter-offset, var(--space-2));--_toast-min-width: var(--ds-toast-min-width, var(--toast-minw));--_toast-max-width: var(--ds-toast-max-width, var(--toast-maxw));--_ds-enter-y: var(--_toast-enter-offset);--_ds-enter-scale: var(--ds-toast-enter-scale, .96);display:flex;align-items:flex-start;gap:var(--space-3);background-color:var(--_toast-bg-color);border:var(--border-width-default) solid var(--_toast-border);border-left:var(--toast-bar-w) solid var(--_toast-bar-color);border-radius:var(--radius-lg);padding:var(--space-3) var(--space-4);box-shadow:var(--shadow-toast);min-width:var(--_toast-min-width);max-width:var(--_toast-max-width);animation-name:var(--_toast-enter-keyframes);animation-duration:var(--_toast-enter-duration);animation-timing-function:var(--_toast-enter-easing)}@media(prefers-reduced-motion:reduce){.toast{--_toast-enter-duration: 0ms}}.toast .icon{color:var(--_toast-icon-color);flex-shrink:0;align-self:center}.toast .body{flex:1;min-width:0;overflow-wrap:anywhere;font:var(--font-weight-regular) var(--font-size-s)/var(--line-height-base) var(--font-sans);color:var(--text-secondary)}.toast .title{font-weight:var(--font-weight-bold);color:var(--text-primary);margin-bottom:var(--space-0-5)}.toast .count{display:inline-block;margin-inline-start:var(--space-1-5);padding:0 var(--space-1-5);border-radius:var(--radius-pill);background-color:var(--_toast-count-bg-color);color:var(--_toast-count-text-color);font:var(--font-weight-semibold) var(--font-size-xs)/var(--line-height-base) var(--font-sans)}@supports (text-box: trim-both cap alphabetic){.toast .count{text-box:trim-both cap alphabetic;padding-block:calc((1lh - 1cap)/2)}}.toast .time{margin-inline-start:var(--space-1);color:var(--text-tertiary-overlay);font-size:var(--font-size-xs)}.toast .more{display:block;margin-block-start:var(--space-1);padding:0;border:0;border-radius:var(--ds-radius-inner);background:transparent;color:var(--text-link);font:var(--font-weight-semibold) var(--font-size-xs)/var(--line-height-base) var(--font-sans);cursor:pointer}.toast .more:focus-visible{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.toast .close,.toast .icon-action{display:inline-flex;align-items:center;justify-content:center;padding:var(--space-0-5);border:0;background:none;cursor:pointer}.toast .close:active:not(:disabled,[disabled],.is-disabled,.disabled,[aria-disabled=true]),.toast .icon-action:active:not(:disabled,[disabled],.is-disabled,.disabled,[aria-disabled=true]){filter:brightness(var(--ds-press-brightness, .9));transform:scale(var(--ds-press-scale, .97))}.toast .close,.toast .icon-action{position:relative}.toast .close:before,.toast .icon-action:before{content:\"\";position:absolute;top:50%;left:50%;width:max(100%,var(--hit-xs));height:max(100%,var(--hit-xs));translate:-50% -50%;border-radius:inherit}.toast .close:focus-visible,.toast .icon-action:focus-visible{outline-style:none}.toast .close:focus-visible:before,.toast .icon-action:focus-visible:before{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:calc(var(--focus-ring-offset) - 2 * var(--focus-ring-width));animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.toast .close,.toast .icon-action{color:var(--icon-default)}.toast .icon-action{align-self:center;display:inline-grid;place-items:center}.toast .icon-action-icon,.toast .icon-action-check{grid-area:1/1;transition:opacity var(--duration-fast) var(--ease-standard),scale var(--duration-fast) var(--ease-standard)}.toast .icon-action-check{color:var(--success-text);opacity:0;scale:.8}.toast .icon-action.succeeded .icon-action-icon{opacity:0}.toast .icon-action.succeeded .icon-action-check{opacity:1;scale:1;transition:opacity var(--duration-base) var(--ease-settle),scale var(--duration-base) var(--ease-settle)}.toast .action{flex-shrink:0;align-self:center;border:0;background:transparent;color:var(--accent-strong);font:var(--font-weight-bold) var(--font-size-s)/var(--line-height-flat) var(--font-sans);cursor:pointer;padding:var(--space-1) var(--space-2);border-radius:var(--ds-radius-inner)}.toast .action:hover{background:var(--state-layer-hover)}.toast .action:active{background:var(--state-layer-pressed)}.toast .action:focus-visible{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.toast .actions{display:inline-flex;align-self:center;align-items:center;gap:var(--space-2);flex-shrink:0}.toast .actions:empty{display:none}.toast.info{--_toast-bg-color: var(--ds-toast-bg-color-info, var(--ds-toast-bg-color, var(--surface-overlay-raised)));--_toast-border: var(--ds-toast-border-color-info, var(--ds-toast-border-color, var(--border-overlay)));--_toast-bar-color: var(--ds-toast-bar-color, var(--accent));--_toast-icon-color: var(--ds-toast-icon-color, var(--accent));border-left-color:var(--_toast-bar-color)}.toast.success{--_toast-bg-color: var(--ds-toast-bg-color-success, var(--ds-toast-bg-color, var(--surface-overlay-raised)));--_toast-border: var(--ds-toast-border-color-success, var(--ds-toast-border-color, var(--border-overlay)));--_toast-bar-color: var(--ds-toast-bar-color, var(--success));--_toast-icon-color: var(--ds-toast-icon-color, var(--success));--_toast-count-bg-color: var(--success-muted);--_toast-count-text-color: var(--success-text);border-left-color:var(--_toast-bar-color)}.toast.success .icon{color:var(--_toast-icon-color)}.toast.warning{--_toast-bg-color: var(--ds-toast-bg-color-warning, var(--ds-toast-bg-color, var(--surface-overlay-raised)));--_toast-border: var(--ds-toast-border-color-warning, var(--ds-toast-border-color, var(--border-overlay)));--_toast-bar-color: var(--ds-toast-bar-color, var(--warning-hover));--_toast-icon-color: var(--ds-toast-icon-color, var(--warning-hover));--_toast-count-bg-color: var(--warning-muted);--_toast-count-text-color: var(--warning-text);border-left-color:var(--_toast-bar-color)}.toast.warning .icon{color:var(--_toast-icon-color)}.toast.error{--_toast-bg-color: var(--ds-toast-bg-color-error, var(--ds-toast-bg-color, var(--surface-overlay-raised)));--_toast-border: var(--ds-toast-border-color-error, var(--ds-toast-border-color, var(--border-overlay)));--_toast-bar-color: var(--ds-toast-bar-color, var(--error));--_toast-icon-color: var(--ds-toast-icon-color, var(--error));--_toast-count-bg-color: var(--error-muted);--_toast-count-text-color: var(--error-text);border-left-color:var(--_toast-bar-color)}.toast.error .icon{color:var(--_toast-icon-color)}.toast.loading{border-left-color:var(--accent)}.toast.loading .icon{color:var(--accent)}\n"] }]
|
|
112
|
+
}], ctorParameters: () => [], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], body: [{ type: i0.Input, args: [{ isSignal: true, alias: "body", required: false }] }], dismissible: [{ type: i0.Input, args: [{ isSignal: true, alias: "dismissible", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], action: [{ type: i0.Input, args: [{ isSignal: true, alias: "action", required: false }] }], iconAction: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconAction", required: false }] }], occurrences: [{ type: i0.Input, args: [{ isSignal: true, alias: "occurrences", required: false }] }], closed: [{ type: i0.Output, args: ["closed"] }], occurrenceClosed: [{ type: i0.Output, args: ["occurrenceClosed"] }] } });
|
|
86
113
|
|
|
87
114
|
/** @internal */
|
|
88
115
|
const TOAST_DEFAULT_DURATION_MS = 5000;
|
|
@@ -104,7 +131,9 @@ function toastUpdatePatch(current, update) {
|
|
|
104
131
|
const variant = update.variant ?? current.variant;
|
|
105
132
|
const title = update.title ?? current.title;
|
|
106
133
|
const body = update.body ?? current.body;
|
|
107
|
-
const neverExpires = variant === 'loading' ||
|
|
134
|
+
const neverExpires = variant === 'loading' ||
|
|
135
|
+
current.action !== undefined ||
|
|
136
|
+
current.iconAction !== undefined;
|
|
108
137
|
const leavesLoading = current.variant === 'loading' && variant !== 'loading';
|
|
109
138
|
const durationMs = neverExpires
|
|
110
139
|
? 0
|
|
@@ -181,6 +210,7 @@ class ToastRegionComponent {
|
|
|
181
210
|
leaveTimers = new Map();
|
|
182
211
|
remaining = new Map();
|
|
183
212
|
startedAt = new Map();
|
|
213
|
+
slidePending = false;
|
|
184
214
|
hovered = false;
|
|
185
215
|
focusWithin = false;
|
|
186
216
|
focusOrigin = null;
|
|
@@ -223,15 +253,15 @@ class ToastRegionComponent {
|
|
|
223
253
|
}
|
|
224
254
|
/** FLIP, not an absolute stack: that collapses the region to zero height inside the content-sized CDK pane. */
|
|
225
255
|
slideNeighbours(before) {
|
|
226
|
-
if (!before
|
|
256
|
+
if (!before?.size) {
|
|
227
257
|
return;
|
|
228
258
|
}
|
|
259
|
+
this.slidePending = true;
|
|
229
260
|
requestAnimationFrame(() => {
|
|
230
|
-
|
|
261
|
+
this.slidePending = false;
|
|
231
262
|
const deltas = [];
|
|
232
|
-
for (const [
|
|
233
|
-
|
|
234
|
-
if (previousTop === undefined) {
|
|
263
|
+
for (const [node, previousTop] of before) {
|
|
264
|
+
if (!node.isConnected) {
|
|
235
265
|
continue;
|
|
236
266
|
}
|
|
237
267
|
const delta = previousTop - node.getBoundingClientRect().top;
|
|
@@ -262,12 +292,14 @@ class ToastRegionComponent {
|
|
|
262
292
|
});
|
|
263
293
|
return nodes;
|
|
264
294
|
}
|
|
295
|
+
// Keyed by node, not by entry: the entries change before the DOM does. While a slide is pending
|
|
296
|
+
// its snapshot already predates this change, and a second one would measure nodes mid-render.
|
|
265
297
|
measureTops() {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
tops.set(id, node.getBoundingClientRect().top);
|
|
298
|
+
if (this.slidePending) {
|
|
299
|
+
return null;
|
|
269
300
|
}
|
|
270
|
-
|
|
301
|
+
const nodes = this.host.nativeElement.querySelectorAll('ds-toast');
|
|
302
|
+
return new Map(Array.from(nodes, (node) => [node, node.getBoundingClientRect().top]));
|
|
271
303
|
}
|
|
272
304
|
arm(id, remaining) {
|
|
273
305
|
if (remaining <= 0) {
|
|
@@ -402,12 +434,14 @@ class ToastRegionComponent {
|
|
|
402
434
|
this.leaving.update((set) => new Set(set).add(id));
|
|
403
435
|
this.leaveTimers.set(id, window.setTimeout(() => {
|
|
404
436
|
this.leaveTimers.delete(id);
|
|
437
|
+
const before = this.measureTops();
|
|
405
438
|
this.visibleEntries.update((existing) => existing.filter((entry) => entry.id !== id));
|
|
406
439
|
this.leaving.update((set) => {
|
|
407
440
|
const next = new Set(set);
|
|
408
441
|
next.delete(id);
|
|
409
442
|
return next;
|
|
410
443
|
});
|
|
444
|
+
this.slideNeighbours(before);
|
|
411
445
|
this.drainQueue();
|
|
412
446
|
}, this.leaveDuration(id)));
|
|
413
447
|
}
|
|
@@ -450,7 +484,7 @@ class ToastRegionComponent {
|
|
|
450
484
|
}
|
|
451
485
|
}
|
|
452
486
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ToastRegionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
453
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: ToastRegionComponent, isStandalone: true, selector: "ds-toast-region", inputs: { maxVisible: { classPropertyName: "maxVisible", publicName: "maxVisible", isSignal: true, isRequired: false, transformFunction: null }, showQueueCount: { classPropertyName: "showQueueCount", publicName: "showQueueCount", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "region" }, listeners: { "mouseenter": "onHover(true)", "mouseleave": "onHover(false)", "focusin": "onFocusIn($event)", "focusout": "onFocusWithin($event)" }, properties: { "attr.aria-label": "intl().toast.region", "class.stack-newest-last": "!newestFirst" } }, ngImport: i0, template: "@if (queuedLabel(); as label) {\n <!-- aria-hidden: ToastService already announced every toast, queued ones included. -->\n <div\n class=\"queue-count\"\n aria-hidden=\"true\">\n {{ label }}\n </div>\n}\n\n@for (entry of visibleEntries(); track entry.id) {\n <ds-toast\n [variant]=\"entry.variant\"\n [title]=\"entry.title ?? ''\"\n [body]=\"entry.body\"\n [dismissible]=\"entry.dismissible\"\n [action]=\"entry.action ?? null\"\n [occurrences]=\"entry.occurrences ?? []\"\n [class.leaving]=\"isLeaving(entry.id)\"\n (closed)=\"remove(entry.id)\"\n (occurrenceClosed)=\"closeOccurrence(entry, $event)\" />\n}\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{display:flex;flex-direction:column;gap:var(--space-2)}.queue-count{--_toast-queue-bg-color: var(--ds-toast-queue-bg-color, var(--surface-overlay-raised));--_toast-queue-text-color: var(--ds-toast-queue-text-color, var(--text-secondary));align-self:center;padding:var(--space-0-5) var(--space-2);border:var(--border-width-default) solid var(--border-overlay);border-radius:var(--radius-pill);background-color:var(--_toast-queue-bg-color);box-shadow:var(--shadow-toast);color:var(--_toast-queue-text-color);font:var(--font-weight-semibold) var(--font-size-xs)/1 var(--font-sans)}:host(.stack-newest-last) .queue-count{order:1}\n"], dependencies: [{ kind: "component", type: ToastComponent, selector: "ds-toast", inputs: ["variant", "title", "body", "dismissible", "icon", "action", "occurrences"], outputs: ["closed", "occurrenceClosed"] }] });
|
|
487
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: ToastRegionComponent, isStandalone: true, selector: "ds-toast-region", inputs: { maxVisible: { classPropertyName: "maxVisible", publicName: "maxVisible", isSignal: true, isRequired: false, transformFunction: null }, showQueueCount: { classPropertyName: "showQueueCount", publicName: "showQueueCount", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "region" }, listeners: { "mouseenter": "onHover(true)", "mouseleave": "onHover(false)", "focusin": "onFocusIn($event)", "focusout": "onFocusWithin($event)" }, properties: { "attr.aria-label": "intl().toast.region", "class.stack-newest-last": "!newestFirst" } }, ngImport: i0, template: "@if (queuedLabel(); as label) {\n <!-- aria-hidden: ToastService already announced every toast, queued ones included. -->\n <div\n class=\"queue-count\"\n aria-hidden=\"true\">\n {{ label }}\n </div>\n}\n\n@for (entry of visibleEntries(); track entry.id) {\n <ds-toast\n [variant]=\"entry.variant\"\n [title]=\"entry.title ?? ''\"\n [body]=\"entry.body\"\n [dismissible]=\"entry.dismissible\"\n [action]=\"entry.action ?? null\"\n [iconAction]=\"entry.iconAction ?? null\"\n [occurrences]=\"entry.occurrences ?? []\"\n [class.leaving]=\"isLeaving(entry.id)\"\n (closed)=\"remove(entry.id)\"\n (occurrenceClosed)=\"closeOccurrence(entry, $event)\" />\n}\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_toast-leave-toward: -1;display:flex;flex-direction:column;gap:var(--space-2)}.queue-count{--_toast-queue-bg-color: var(--ds-toast-queue-bg-color, var(--surface-overlay-raised));--_toast-queue-text-color: var(--ds-toast-queue-text-color, var(--text-secondary));align-self:center;padding:var(--space-0-5) var(--space-2);border:var(--border-width-default) solid var(--border-overlay);border-radius:var(--radius-pill);background-color:var(--_toast-queue-bg-color);box-shadow:var(--shadow-toast);color:var(--_toast-queue-text-color);font:var(--font-weight-semibold) var(--font-size-xs)/1 var(--font-sans)}:host(.stack-newest-last){--_toast-leave-toward: 1}:host(.stack-newest-last) .queue-count{order:1}\n"], dependencies: [{ kind: "component", type: ToastComponent, selector: "ds-toast", inputs: ["variant", "title", "body", "dismissible", "icon", "action", "iconAction", "occurrences"], outputs: ["closed", "occurrenceClosed"] }] });
|
|
454
488
|
}
|
|
455
489
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ToastRegionComponent, decorators: [{
|
|
456
490
|
type: Component,
|
|
@@ -462,7 +496,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImpo
|
|
|
462
496
|
'(focusin)': 'onFocusIn($event)',
|
|
463
497
|
'(focusout)': 'onFocusWithin($event)',
|
|
464
498
|
'[class.stack-newest-last]': '!newestFirst',
|
|
465
|
-
}, template: "@if (queuedLabel(); as label) {\n <!-- aria-hidden: ToastService already announced every toast, queued ones included. -->\n <div\n class=\"queue-count\"\n aria-hidden=\"true\">\n {{ label }}\n </div>\n}\n\n@for (entry of visibleEntries(); track entry.id) {\n <ds-toast\n [variant]=\"entry.variant\"\n [title]=\"entry.title ?? ''\"\n [body]=\"entry.body\"\n [dismissible]=\"entry.dismissible\"\n [action]=\"entry.action ?? null\"\n [occurrences]=\"entry.occurrences ?? []\"\n [class.leaving]=\"isLeaving(entry.id)\"\n (closed)=\"remove(entry.id)\"\n (occurrenceClosed)=\"closeOccurrence(entry, $event)\" />\n}\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{display:flex;flex-direction:column;gap:var(--space-2)}.queue-count{--_toast-queue-bg-color: var(--ds-toast-queue-bg-color, var(--surface-overlay-raised));--_toast-queue-text-color: var(--ds-toast-queue-text-color, var(--text-secondary));align-self:center;padding:var(--space-0-5) var(--space-2);border:var(--border-width-default) solid var(--border-overlay);border-radius:var(--radius-pill);background-color:var(--_toast-queue-bg-color);box-shadow:var(--shadow-toast);color:var(--_toast-queue-text-color);font:var(--font-weight-semibold) var(--font-size-xs)/1 var(--font-sans)}:host(.stack-newest-last) .queue-count{order:1}\n"] }]
|
|
499
|
+
}, template: "@if (queuedLabel(); as label) {\n <!-- aria-hidden: ToastService already announced every toast, queued ones included. -->\n <div\n class=\"queue-count\"\n aria-hidden=\"true\">\n {{ label }}\n </div>\n}\n\n@for (entry of visibleEntries(); track entry.id) {\n <ds-toast\n [variant]=\"entry.variant\"\n [title]=\"entry.title ?? ''\"\n [body]=\"entry.body\"\n [dismissible]=\"entry.dismissible\"\n [action]=\"entry.action ?? null\"\n [iconAction]=\"entry.iconAction ?? null\"\n [occurrences]=\"entry.occurrences ?? []\"\n [class.leaving]=\"isLeaving(entry.id)\"\n (closed)=\"remove(entry.id)\"\n (occurrenceClosed)=\"closeOccurrence(entry, $event)\" />\n}\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_toast-leave-toward: -1;display:flex;flex-direction:column;gap:var(--space-2)}.queue-count{--_toast-queue-bg-color: var(--ds-toast-queue-bg-color, var(--surface-overlay-raised));--_toast-queue-text-color: var(--ds-toast-queue-text-color, var(--text-secondary));align-self:center;padding:var(--space-0-5) var(--space-2);border:var(--border-width-default) solid var(--border-overlay);border-radius:var(--radius-pill);background-color:var(--_toast-queue-bg-color);box-shadow:var(--shadow-toast);color:var(--_toast-queue-text-color);font:var(--font-weight-semibold) var(--font-size-xs)/1 var(--font-sans)}:host(.stack-newest-last){--_toast-leave-toward: 1}:host(.stack-newest-last) .queue-count{order:1}\n"] }]
|
|
466
500
|
}], ctorParameters: () => [], propDecorators: { maxVisible: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxVisible", required: false }] }], showQueueCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "showQueueCount", required: false }] }] } });
|
|
467
501
|
|
|
468
502
|
const SETTLED_SUCCESS_MS = 4000;
|
|
@@ -521,9 +555,9 @@ class ToastService {
|
|
|
521
555
|
this.announce(variant, repeated(message, patch.occurrences.length), undefined, groupKey);
|
|
522
556
|
return this.refFor(stack.id);
|
|
523
557
|
}
|
|
524
|
-
//
|
|
558
|
+
// A toast with an action cannot expire: the region is the last child of `body`, so a
|
|
525
559
|
// keyboard user cannot reach the button in time.
|
|
526
|
-
const durationMs = variant === 'loading' || opts.action
|
|
560
|
+
const durationMs = variant === 'loading' || opts.action || opts.iconAction
|
|
527
561
|
? 0
|
|
528
562
|
: (opts.durationMs ?? TOAST_DEFAULT_DURATION_MS);
|
|
529
563
|
const entry = {
|
|
@@ -534,6 +568,7 @@ class ToastService {
|
|
|
534
568
|
// Nothing that cannot expire may also be unclosable, or it holds a slot for the page's life.
|
|
535
569
|
dismissible: durationMs > 0 ? (opts.dismissible ?? true) : true,
|
|
536
570
|
action: opts.action,
|
|
571
|
+
iconAction: opts.iconAction,
|
|
537
572
|
durationMs,
|
|
538
573
|
...(groupKey === undefined
|
|
539
574
|
? {}
|