@uni-design-system/uni-angular 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,13 +21,15 @@ The official **Angular** implementation of the Uni Design System. Built from the
21
21
  ```bash
22
22
  npm install @uni-design-system/uni-angular @uni-design-system/uni-core @emotion/css
23
23
  ```
24
- *Note: This package requires `@emotion/css` to be present in the host application as a peer dependency.*
24
+
25
+ _Note: This package requires `@emotion/css` to be present in the host application as a peer dependency._
25
26
 
26
27
  ## 🏁 Getting Started
27
28
 
28
29
  This library utilizes fully standalone components compliant with modern Angular architectures. Simply import the component into your Standalone Component or Angular Module:
29
30
 
30
31
  ### 1. Import Component
32
+
31
33
  ```typescript
32
34
  import { Component } from '@angular/core';
33
35
  import { ButtonComponent } from '@uni-design-system/uni-angular';
@@ -36,12 +38,7 @@ import { ButtonComponent } from '@uni-design-system/uni-angular';
36
38
  selector: 'app-root',
37
39
  standalone: true,
38
40
  imports: [ButtonComponent], // 🟢 Inject here
39
- template: `
40
- <uni-button
41
- text="Hello Uni!"
42
- (click)="handleOnClick()">
43
- </uni-button>
44
- `
41
+ template: ` <uni-button text="Hello Uni!" (click)="handleOnClick()"> </uni-button> `,
45
42
  })
46
43
  export class AppComponent {
47
44
  handleOnClick() {
@@ -51,7 +48,7 @@ export class AppComponent {
51
48
  ```
52
49
 
53
50
  ## 🛠️ Architecture Profile
51
+
54
52
  - **Framework Support:** Angular `^21.2.0`
55
53
  - **Package Format:** Compiled strictly under the **Angular Package Format (APF)** using `ng-packagr` into flat, optimized `fesm2022` modules.
56
54
  - **CSS Architecture:** Leverages native CSS properties and token maps for high-performance hardware rendering, avoiding heavy deprecated runtime framework animation libraries.
57
-
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { signal, computed, linkedSignal, resource, Injectable, inject, DestroyRef, InjectionToken, input, Component, HostBinding, Input, Renderer2, ElementRef, HostListener, Directive, EventEmitter, effect, Output, output, ViewChild, ChangeDetectorRef, ChangeDetectionStrategy } from '@angular/core';
2
+ import { signal, computed, linkedSignal, resource, Injectable, inject, DestroyRef, InjectionToken, input, Component, HostBinding, Input, Renderer2, ElementRef, HostListener, Directive, EventEmitter, effect, Output, output, ViewChild, ChangeDetectorRef, ChangeDetectionStrategy, model } from '@angular/core';
3
3
  import { css, keyframes } from '@emotion/css';
4
4
  import { UniThemes, LightTheme, Z_INDEX, fadeIn, fadeOut } from '@uni-design-system/uni-core';
5
5
  import { NgClass, CommonModule, NgTemplateOutlet } from '@angular/common';
@@ -494,7 +494,7 @@ const UNI_THEMES = new InjectionToken('', {
494
494
  factory: () => UniThemes,
495
495
  });
496
496
 
497
- const safeParseInt = (n) => typeof n === 'number' ? n : parseInt(n);
497
+ const safeParseInt = (n) => (typeof n === 'number' ? n : parseInt(n));
498
498
 
499
499
  // noinspection JSUnusedGlobalSymbols
500
500
  class ThemeService {
@@ -567,7 +567,11 @@ class ThemeService {
567
567
  const token = (color + '-container');
568
568
  return this.colorPair(token, useVariant);
569
569
  };
570
- typeface = (typeface) => typeface && this.typeFaces()[typeface];
570
+ typeface = (typeface) => {
571
+ const typefaces = this.typeFaces();
572
+ console.log('typefaces:', typefaces);
573
+ return typeface && typefaces[typeface];
574
+ };
571
575
  colorPalette = () => this.colors();
572
576
  color(color) {
573
577
  return !color ? undefined : { color: this.colors()[color] };
@@ -1194,7 +1198,7 @@ class UniButtonComponent extends BaseComponent {
1194
1198
  get className() {
1195
1199
  return css([
1196
1200
  this.style() && {
1197
- ...this.style(),
1201
+ ...this.style(), // TODO: Set priority on theme-defined styles
1198
1202
  },
1199
1203
  {
1200
1204
  display: 'flex',
@@ -1204,7 +1208,6 @@ class UniButtonComponent extends BaseComponent {
1204
1208
  outline: 0,
1205
1209
  border: 0,
1206
1210
  cursor: 'pointer',
1207
- fontFamily: 'Euphemia, sans-serif',
1208
1211
  transition: 'all 0.28s ease',
1209
1212
  '&:disabled': {
1210
1213
  cursor: 'not-allowed !important',
@@ -1938,11 +1941,11 @@ class UniMenuItemComponent extends UniBoxComponent {
1938
1941
  this._elementRef.nativeElement.focus();
1939
1942
  }
1940
1943
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniMenuItemComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1941
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: UniMenuItemComponent, isStandalone: true, selector: "div[uni-menu-item], div[menu-item]", inputs: { display: { classPropertyName: "display", publicName: "display", isSignal: true, isRequired: false, transformFunction: null }, flexDirection: { classPropertyName: "flexDirection", publicName: "flexDirection", isSignal: true, isRequired: false, transformFunction: null }, alignItems: { classPropertyName: "alignItems", publicName: "alignItems", isSignal: true, isRequired: false, transformFunction: null }, paddingHorizontal: { classPropertyName: "paddingHorizontal", publicName: "paddingHorizontal", isSignal: true, isRequired: false, transformFunction: null }, gap: { classPropertyName: "gap", publicName: "gap", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, template: { classPropertyName: "template", publicName: "template", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null }, symbolName: { classPropertyName: "symbolName", publicName: "symbolName", isSignal: true, isRequired: false, transformFunction: null }, active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: false, transformFunction: null }, hoverColor: { classPropertyName: "hoverColor", publicName: "hoverColor", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.className" } }, usesInheritance: true, ngImport: i0, template: "@let tpl = template();\n@let symbol = symbolName();\n@if (symbol) {\n <Symbol [name]=\"symbol\"></Symbol>\n}\n<div box-layout [grow]=\"1\">\n @if (tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"context()\"\n ></ng-container>\n } @else {\n <Text role=\"label\" display=\"block\" [nowrap]=\"true\">\n {{ label() }}\n </Text>\n }\n</div>\n@if (active()) {\n <Symbol name=\"check\"></Symbol>\n}\n", styles: [":host:focus{background:#ccc;color:#fff}:host.disabled{color:#ddd;pointer-events:none}\n"], dependencies: [{ kind: "component", type: UniTextComponent, selector: "uni-text, Text", inputs: ["typeface", "color", "display", "align", "nowrap", "maxWidth", "ellipsis"] }, { kind: "component", type: UniSymbolComponent, selector: "uni-symbol, Symbol", inputs: ["name", "fill", "weight", "grade", "opticalSize"] }, { kind: "component", type: UniBoxComponent, selector: "div[uni-box-layout], Box, div[box-layout]", inputs: ["color", "backgroundColor", "borderRadius", "borderRadiusLeft", "borderRadiusRight", "borderRadiusTop", "borderRadiusBottom", "padding", "paddingHorizontal", "paddingVertical", "paddingLeft", "paddingRight", "paddingTop", "paddingBottom", "border", "borderTop", "borderBottom", "borderLeft", "borderRight", "dashBorder", "alignSelf", "alignItems", "alignContent", "justifyContent", "grow", "display", "position", "inset", "height", "minHeight", "maxHeight", "width", "minWidth", "maxWidth", "ignoreDir", "gridArea", "gridColumn", "gridRow", "overflow", "elevation", "shadow", "gap", "fullWidth", "fullHeight", "flexDirection", "textAlign", "wrapItems", "zIndex"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
1944
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: UniMenuItemComponent, isStandalone: true, selector: "div[uni-menu-item], div[menu-item]", inputs: { display: { classPropertyName: "display", publicName: "display", isSignal: true, isRequired: false, transformFunction: null }, flexDirection: { classPropertyName: "flexDirection", publicName: "flexDirection", isSignal: true, isRequired: false, transformFunction: null }, alignItems: { classPropertyName: "alignItems", publicName: "alignItems", isSignal: true, isRequired: false, transformFunction: null }, paddingHorizontal: { classPropertyName: "paddingHorizontal", publicName: "paddingHorizontal", isSignal: true, isRequired: false, transformFunction: null }, gap: { classPropertyName: "gap", publicName: "gap", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, template: { classPropertyName: "template", publicName: "template", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null }, symbolName: { classPropertyName: "symbolName", publicName: "symbolName", isSignal: true, isRequired: false, transformFunction: null }, active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: false, transformFunction: null }, hoverColor: { classPropertyName: "hoverColor", publicName: "hoverColor", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.className" } }, usesInheritance: true, ngImport: i0, template: "@let tpl = template();\n@let symbol = symbolName();\n@if (symbol) {\n <Symbol [name]=\"symbol\"></Symbol>\n}\n<div box-layout [grow]=\"1\">\n @if (tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"context()\"></ng-container>\n } @else {\n <Text role=\"label\" display=\"block\" [nowrap]=\"true\">\n {{ label() }}\n </Text>\n }\n</div>\n@if (active()) {\n <Symbol name=\"check\"></Symbol>\n}\n", styles: [":host:focus{background:#ccc;color:#fff}:host.disabled{color:#ddd;pointer-events:none}\n"], dependencies: [{ kind: "component", type: UniTextComponent, selector: "uni-text, Text", inputs: ["typeface", "color", "display", "align", "nowrap", "maxWidth", "ellipsis"] }, { kind: "component", type: UniSymbolComponent, selector: "uni-symbol, Symbol", inputs: ["name", "fill", "weight", "grade", "opticalSize"] }, { kind: "component", type: UniBoxComponent, selector: "div[uni-box-layout], Box, div[box-layout]", inputs: ["color", "backgroundColor", "borderRadius", "borderRadiusLeft", "borderRadiusRight", "borderRadiusTop", "borderRadiusBottom", "padding", "paddingHorizontal", "paddingVertical", "paddingLeft", "paddingRight", "paddingTop", "paddingBottom", "border", "borderTop", "borderBottom", "borderLeft", "borderRight", "dashBorder", "alignSelf", "alignItems", "alignContent", "justifyContent", "grow", "display", "position", "inset", "height", "minHeight", "maxHeight", "width", "minWidth", "maxWidth", "ignoreDir", "gridArea", "gridColumn", "gridRow", "overflow", "elevation", "shadow", "gap", "fullWidth", "fullHeight", "flexDirection", "textAlign", "wrapItems", "zIndex"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
1942
1945
  }
1943
1946
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniMenuItemComponent, decorators: [{
1944
1947
  type: Component,
1945
- args: [{ selector: 'div[uni-menu-item], div[menu-item]', standalone: true, imports: [UniTextComponent, UniSymbolComponent, UniBoxComponent, NgTemplateOutlet], template: "@let tpl = template();\n@let symbol = symbolName();\n@if (symbol) {\n <Symbol [name]=\"symbol\"></Symbol>\n}\n<div box-layout [grow]=\"1\">\n @if (tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"context()\"\n ></ng-container>\n } @else {\n <Text role=\"label\" display=\"block\" [nowrap]=\"true\">\n {{ label() }}\n </Text>\n }\n</div>\n@if (active()) {\n <Symbol name=\"check\"></Symbol>\n}\n", styles: [":host:focus{background:#ccc;color:#fff}:host.disabled{color:#ddd;pointer-events:none}\n"] }]
1948
+ args: [{ selector: 'div[uni-menu-item], div[menu-item]', standalone: true, imports: [UniTextComponent, UniSymbolComponent, UniBoxComponent, NgTemplateOutlet], template: "@let tpl = template();\n@let symbol = symbolName();\n@if (symbol) {\n <Symbol [name]=\"symbol\"></Symbol>\n}\n<div box-layout [grow]=\"1\">\n @if (tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"context()\"></ng-container>\n } @else {\n <Text role=\"label\" display=\"block\" [nowrap]=\"true\">\n {{ label() }}\n </Text>\n }\n</div>\n@if (active()) {\n <Symbol name=\"check\"></Symbol>\n}\n", styles: [":host:focus{background:#ccc;color:#fff}:host.disabled{color:#ddd;pointer-events:none}\n"] }]
1946
1949
  }], propDecorators: { display: [{ type: i0.Input, args: [{ isSignal: true, alias: "display", required: false }] }], flexDirection: [{ type: i0.Input, args: [{ isSignal: true, alias: "flexDirection", required: false }] }], alignItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "alignItems", required: false }] }], paddingHorizontal: [{ type: i0.Input, args: [{ isSignal: true, alias: "paddingHorizontal", required: false }] }], gap: [{ type: i0.Input, args: [{ isSignal: true, alias: "gap", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], template: [{ type: i0.Input, args: [{ isSignal: true, alias: "template", required: false }] }], context: [{ type: i0.Input, args: [{ isSignal: true, alias: "context", required: false }] }], symbolName: [{ type: i0.Input, args: [{ isSignal: true, alias: "symbolName", required: false }] }], active: [{ type: i0.Input, args: [{ isSignal: true, alias: "active", required: false }] }], hoverColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "hoverColor", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], className: [{
1947
1950
  type: HostBinding,
1948
1951
  args: ['class']
@@ -2029,6 +2032,274 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
2029
2032
  args: ['class']
2030
2033
  }] } });
2031
2034
 
2035
+ class UniAlertComponent extends BaseComponent {
2036
+ show = model(...(ngDevMode ? [undefined, { debugName: "show" }] : /* istanbul ignore next */ []));
2037
+ iconName = input(undefined, ...(ngDevMode ? [{ debugName: "iconName" }] : /* istanbul ignore next */ []));
2038
+ symbolName = input(undefined, ...(ngDevMode ? [{ debugName: "symbolName" }] : /* istanbul ignore next */ []));
2039
+ useVariant = input(false, ...(ngDevMode ? [{ debugName: "useVariant" }] : /* istanbul ignore next */ []));
2040
+ showing = new EventEmitter();
2041
+ alertRef;
2042
+ alertState = signal('closed', ...(ngDevMode ? [{ debugName: "alertState" }] : /* istanbul ignore next */ []));
2043
+ effectiveVariant = computed(() => this.variant() || this.componentOptions().defaultVariant, ...(ngDevMode ? [{ debugName: "effectiveVariant" }] : /* istanbul ignore next */ []));
2044
+ alertClass = computed(() => css({
2045
+ ...this.theme.getContainerColors(this.effectiveVariant(), this.useVariant()),
2046
+ ...this.theme.radius(this.componentOptions().borderRadius),
2047
+ ...this.theme.border(this.effectiveVariant()),
2048
+ ...this.theme.boxShadow(this.componentOptions().elevation),
2049
+ transition: `all ${this.componentOptions().transitionSpeed}s ease-in-out`,
2050
+ transitionBehavior: 'allow-discrete',
2051
+ opacity: 1,
2052
+ top: this.componentOptions().topPosition,
2053
+ '&[open]': {
2054
+ '@starting-style': {
2055
+ top: 0,
2056
+ opacity: 0,
2057
+ },
2058
+ },
2059
+ '&[closing]': {
2060
+ animation: `${this.fadeOut} 0.3s forwards`,
2061
+ },
2062
+ }), ...(ngDevMode ? [{ debugName: "alertClass" }] : /* istanbul ignore next */ []));
2063
+ fadeOut = keyframes({ ...fadeOut });
2064
+ constructor() {
2065
+ super();
2066
+ effect(() => {
2067
+ if (this.show() === true) {
2068
+ this.open();
2069
+ }
2070
+ else if (this.show() === false) {
2071
+ this.close();
2072
+ }
2073
+ });
2074
+ }
2075
+ ngAfterViewInit() {
2076
+ this.alertRef?.nativeElement.addEventListener('animationend', (e) => {
2077
+ if (e.animationName === this.fadeOut.toString()) {
2078
+ this.alertRef?.nativeElement.close();
2079
+ this.showing.emit(false);
2080
+ this.alertState.set('closed');
2081
+ }
2082
+ });
2083
+ }
2084
+ open() {
2085
+ if (!this.alertRef?.nativeElement)
2086
+ return;
2087
+ this.alertRef.nativeElement.removeAttribute('closing');
2088
+ this.alertRef.nativeElement.show();
2089
+ this.alertState.set('open');
2090
+ this.showing.emit(true);
2091
+ }
2092
+ close() {
2093
+ if (!this.alertRef?.nativeElement)
2094
+ return;
2095
+ this.alertRef.nativeElement.setAttribute('closing', 'true');
2096
+ this.alertState.set('closing');
2097
+ this.show.set(false);
2098
+ }
2099
+ effectiveIconName = computed(() => this.iconName(), ...(ngDevMode ? [{ debugName: "effectiveIconName" }] : /* istanbul ignore next */ []));
2100
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniAlertComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2101
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: UniAlertComponent, isStandalone: true, selector: "uni-alert, Alert", inputs: { show: { classPropertyName: "show", publicName: "show", isSignal: true, isRequired: false, transformFunction: null }, iconName: { classPropertyName: "iconName", publicName: "iconName", isSignal: true, isRequired: false, transformFunction: null }, symbolName: { classPropertyName: "symbolName", publicName: "symbolName", isSignal: true, isRequired: false, transformFunction: null }, useVariant: { classPropertyName: "useVariant", publicName: "useVariant", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { show: "showChange", showing: "showing" }, providers: [{ provide: COMPONENT_NAME, useValue: 'alert' }], viewQueries: [{ propertyName: "alertRef", first: true, predicate: ["alert"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<dialog #alert [class]=\"alertClass()\">\n <div row-layout gap=\"md\">\n @if (iconName() || symbolName()) {\n <div box-layout [height]=\"26\" [width]=\"26\">\n @if (effectiveIconName()) {\n <Icon [name]=\"effectiveIconName()!\" />\n } @else {\n <Symbol [name]=\"symbolName()!\" [opticalSize]=\"26\" />\n }\n </div>\n }\n <Text>\n <ng-content></ng-content>\n </Text>\n <button icon-button (click)=\"close()\" iconName=\"close\" size=\"md\">close</button>\n </div>\n</dialog>\n", dependencies: [{ kind: "component", type: UniRowComponent, selector: "div[uni-row-layout], Row, div[row-layout]", inputs: ["display", "flexDirection", "minWidth"] }, { kind: "component", type: UniIconButtonComponent, selector: "button[uni-icon-button], button[icon-button]", inputs: ["iconName", "symbolName", "variant", "size", "disable", "loading", "opticalSize"] }, { kind: "component", type: UniTextComponent, selector: "uni-text, Text", inputs: ["typeface", "color", "display", "align", "nowrap", "maxWidth", "ellipsis"] }, { kind: "component", type: UniBoxComponent, selector: "div[uni-box-layout], Box, div[box-layout]", inputs: ["color", "backgroundColor", "borderRadius", "borderRadiusLeft", "borderRadiusRight", "borderRadiusTop", "borderRadiusBottom", "padding", "paddingHorizontal", "paddingVertical", "paddingLeft", "paddingRight", "paddingTop", "paddingBottom", "border", "borderTop", "borderBottom", "borderLeft", "borderRight", "dashBorder", "alignSelf", "alignItems", "alignContent", "justifyContent", "grow", "display", "position", "inset", "height", "minHeight", "maxHeight", "width", "minWidth", "maxWidth", "ignoreDir", "gridArea", "gridColumn", "gridRow", "overflow", "elevation", "shadow", "gap", "fullWidth", "fullHeight", "flexDirection", "textAlign", "wrapItems", "zIndex"] }, { kind: "component", type: UniIconComponent, selector: "uni-icon, Icon", inputs: ["color", "name"] }, { kind: "component", type: UniSymbolComponent, selector: "uni-symbol, Symbol", inputs: ["name", "fill", "weight", "grade", "opticalSize"] }] });
2102
+ }
2103
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniAlertComponent, decorators: [{
2104
+ type: Component,
2105
+ args: [{ selector: 'uni-alert, Alert', standalone: true, imports: [
2106
+ UniRowComponent,
2107
+ UniIconButtonComponent,
2108
+ UniTextComponent,
2109
+ UniBoxComponent,
2110
+ UniIconComponent,
2111
+ UniSymbolComponent,
2112
+ ], providers: [{ provide: COMPONENT_NAME, useValue: 'alert' }], template: "<dialog #alert [class]=\"alertClass()\">\n <div row-layout gap=\"md\">\n @if (iconName() || symbolName()) {\n <div box-layout [height]=\"26\" [width]=\"26\">\n @if (effectiveIconName()) {\n <Icon [name]=\"effectiveIconName()!\" />\n } @else {\n <Symbol [name]=\"symbolName()!\" [opticalSize]=\"26\" />\n }\n </div>\n }\n <Text>\n <ng-content></ng-content>\n </Text>\n <button icon-button (click)=\"close()\" iconName=\"close\" size=\"md\">close</button>\n </div>\n</dialog>\n" }]
2113
+ }], ctorParameters: () => [], propDecorators: { show: [{ type: i0.Input, args: [{ isSignal: true, alias: "show", required: false }] }, { type: i0.Output, args: ["showChange"] }], iconName: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconName", required: false }] }], symbolName: [{ type: i0.Input, args: [{ isSignal: true, alias: "symbolName", required: false }] }], useVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "useVariant", required: false }] }], showing: [{
2114
+ type: Output
2115
+ }], alertRef: [{
2116
+ type: ViewChild,
2117
+ args: ['alert']
2118
+ }] } });
2119
+
2120
+ class ConfirmationDialogComponent {
2121
+ show = input(false, ...(ngDevMode ? [{ debugName: "show" }] : /* istanbul ignore next */ []));
2122
+ confirmation;
2123
+ showing = new EventEmitter();
2124
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: ConfirmationDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2125
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.12", type: ConfirmationDialogComponent, isStandalone: true, selector: "uni-confirmation-dialog, Confirmation", inputs: { show: { classPropertyName: "show", publicName: "show", isSignal: true, isRequired: false, transformFunction: null }, confirmation: { classPropertyName: "confirmation", publicName: "confirmation", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { showing: "showing" }, ngImport: i0, template: "<dialog uni-dialog [show]=\"show()\" (showing)=\"showing.emit($event)\">\n <div uni-dialog-header>\n {{ confirmation?.title }}\n </div>\n <div box-layout padding=\"md\">\n <Text>\n {{ confirmation?.message }}\n </Text>\n </div>\n <div\n dialog-buttons\n [confirmButtonText]=\"confirmation?.actionLabel\"\n (confirmed)=\"confirmation?.action()\"\n [cancelButtonText]=\"confirmation?.dismissLabel\"\n ></div>\n</dialog>\n", dependencies: [{ kind: "component", type: UniDialogComponent, selector: "dialog[uni-dialog], Dialog", inputs: ["show", "defaultCloseButton"], outputs: ["showing"] }, { kind: "component", type: UniDialogHeaderComponent, selector: "div[uni-dialog-header], DialogHeader" }, { kind: "component", type: UniBoxComponent, selector: "div[uni-box-layout], Box, div[box-layout]", inputs: ["color", "backgroundColor", "borderRadius", "borderRadiusLeft", "borderRadiusRight", "borderRadiusTop", "borderRadiusBottom", "padding", "paddingHorizontal", "paddingVertical", "paddingLeft", "paddingRight", "paddingTop", "paddingBottom", "border", "borderTop", "borderBottom", "borderLeft", "borderRight", "dashBorder", "alignSelf", "alignItems", "alignContent", "justifyContent", "grow", "display", "position", "inset", "height", "minHeight", "maxHeight", "width", "minWidth", "maxWidth", "ignoreDir", "gridArea", "gridColumn", "gridRow", "overflow", "elevation", "shadow", "gap", "fullWidth", "fullHeight", "flexDirection", "textAlign", "wrapItems", "zIndex"] }, { kind: "component", type: UniTextComponent, selector: "uni-text, Text", inputs: ["typeface", "color", "display", "align", "nowrap", "maxWidth", "ellipsis"] }, { kind: "component", type: UniDialogButtonsComponent, selector: "uni-dialog-buttons, DialogButtons, div[dialog-buttons]", inputs: ["confirmButtonText", "confirmButtonVariant", "cancelButtonText", "disableConfirm", "padding", "paddingBottom", "justifyContent"], outputs: ["confirmed"] }] });
2126
+ }
2127
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: ConfirmationDialogComponent, decorators: [{
2128
+ type: Component,
2129
+ args: [{ selector: 'uni-confirmation-dialog, Confirmation', standalone: true, imports: [
2130
+ UniDialogComponent,
2131
+ UniDialogHeaderComponent,
2132
+ UniBoxComponent,
2133
+ UniTextComponent,
2134
+ UniDialogButtonsComponent,
2135
+ ], template: "<dialog uni-dialog [show]=\"show()\" (showing)=\"showing.emit($event)\">\n <div uni-dialog-header>\n {{ confirmation?.title }}\n </div>\n <div box-layout padding=\"md\">\n <Text>\n {{ confirmation?.message }}\n </Text>\n </div>\n <div\n dialog-buttons\n [confirmButtonText]=\"confirmation?.actionLabel\"\n (confirmed)=\"confirmation?.action()\"\n [cancelButtonText]=\"confirmation?.dismissLabel\"\n ></div>\n</dialog>\n" }]
2136
+ }], propDecorators: { show: [{ type: i0.Input, args: [{ isSignal: true, alias: "show", required: false }] }], confirmation: [{
2137
+ type: Input
2138
+ }], showing: [{
2139
+ type: Output
2140
+ }] } });
2141
+
2142
+ class UniSnackbarComponent extends BaseComponent {
2143
+ timer = useTimer();
2144
+ snackbarClass;
2145
+ show;
2146
+ iconName = input(...(ngDevMode ? [undefined, { debugName: "iconName" }] : /* istanbul ignore next */ []));
2147
+ symbolName = input(...(ngDevMode ? [undefined, { debugName: "symbolName" }] : /* istanbul ignore next */ []));
2148
+ timeout = input(...(ngDevMode ? [undefined, { debugName: "timeout" }] : /* istanbul ignore next */ []));
2149
+ actionLabel = input(...(ngDevMode ? [undefined, { debugName: "actionLabel" }] : /* istanbul ignore next */ []));
2150
+ useVariant = input(false, ...(ngDevMode ? [{ debugName: "useVariant" }] : /* istanbul ignore next */ []));
2151
+ action = new EventEmitter();
2152
+ showing = new EventEmitter();
2153
+ snackbarRef;
2154
+ get _snackbar() {
2155
+ return this.snackbarRef?.nativeElement;
2156
+ }
2157
+ constructor() {
2158
+ super();
2159
+ effect(() => {
2160
+ this.snackbarClass = css({
2161
+ ...this.theme.getContainerColors(this.variant() || 'primary', this.useVariant()),
2162
+ ...this.theme.radius('sm'),
2163
+ ...this.theme.border(this.variant() || 'primary'),
2164
+ ...this.theme.boxShadow('dialog'),
2165
+ padding: 0,
2166
+ transition: `all ${this.componentOptions().transitionDelay} ease-in-out`,
2167
+ transitionBehavior: 'allow-discrete',
2168
+ opacity: 1,
2169
+ bottom: this.componentOptions().bottomPosition,
2170
+ zIndex: Z_INDEX.dialog,
2171
+ position: 'fixed',
2172
+ '&[open]': {
2173
+ '@starting-style': {
2174
+ bottom: 0,
2175
+ opacity: 0,
2176
+ },
2177
+ },
2178
+ '&[closing]': {
2179
+ animation: `${this.fadeOut} 0.3s forwards`,
2180
+ },
2181
+ });
2182
+ });
2183
+ }
2184
+ fadeOut = keyframes({
2185
+ '0% ': {
2186
+ opacity: 1,
2187
+ },
2188
+ '100%': {
2189
+ opacity: 0,
2190
+ },
2191
+ });
2192
+ ngOnChanges(changes) {
2193
+ if (changes['show'] && changes['show'].currentValue) {
2194
+ this.open();
2195
+ }
2196
+ else {
2197
+ this.close();
2198
+ }
2199
+ }
2200
+ ngAfterViewInit() {
2201
+ this._snackbar?.addEventListener('animationend', (e) => {
2202
+ if (e.animationName == this.fadeOut) {
2203
+ this._snackbar?.close();
2204
+ this.showing.emit(false);
2205
+ }
2206
+ });
2207
+ }
2208
+ get _timeout() {
2209
+ const timeout = this.timeout();
2210
+ if (timeout === 'disabled')
2211
+ return undefined;
2212
+ return typeof timeout === 'string'
2213
+ ? parseFloat(timeout)
2214
+ : timeout || this.componentOptions().autoCloseDelay;
2215
+ }
2216
+ open() {
2217
+ this._snackbar?.removeAttribute('closing');
2218
+ this._snackbar?.show();
2219
+ this.show = true;
2220
+ this.showing.emit(true);
2221
+ if (this._timeout)
2222
+ this.timer.start(this._timeout, () => this.close());
2223
+ }
2224
+ close() {
2225
+ this._snackbar?.setAttribute('closing', 'true');
2226
+ this.show = false;
2227
+ }
2228
+ pauseTimer() {
2229
+ this.timer.pause();
2230
+ }
2231
+ resumeTimer() {
2232
+ this.timer.resume();
2233
+ }
2234
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniSnackbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2235
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: UniSnackbarComponent, isStandalone: true, selector: "uni-snackbar, Snackbar", inputs: { show: { classPropertyName: "show", publicName: "show", isSignal: false, isRequired: false, transformFunction: null }, iconName: { classPropertyName: "iconName", publicName: "iconName", isSignal: true, isRequired: false, transformFunction: null }, symbolName: { classPropertyName: "symbolName", publicName: "symbolName", isSignal: true, isRequired: false, transformFunction: null }, timeout: { classPropertyName: "timeout", publicName: "timeout", isSignal: true, isRequired: false, transformFunction: null }, actionLabel: { classPropertyName: "actionLabel", publicName: "actionLabel", isSignal: true, isRequired: false, transformFunction: null }, useVariant: { classPropertyName: "useVariant", publicName: "useVariant", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { action: "action", showing: "showing" }, providers: [{ provide: COMPONENT_NAME, useValue: 'snackbar' }], viewQueries: [{ propertyName: "snackbarRef", first: true, predicate: ["snackbar"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "@let icon = iconName();\n@let symbol = symbolName();\n<dialog\n #snackbar\n [class]=\"snackbarClass\"\n (mouseenter)=\"pauseTimer()\"\n (mouseleave)=\"resumeTimer()\"\n (focusin)=\"pauseTimer()\"\n (focusout)=\"resumeTimer()\"\n>\n <Row alignItems=\"center\">\n @if (icon || symbol) {\n <Box [height]=\"26\" [width]=\"26\" paddingLeft=\"sm\">\n @if (icon) {\n <Icon [name]=\"icon\"></Icon>\n } @else if (symbol) {\n <Symbol [name]=\"symbol\" [opticalSize]=\"26\"></Symbol>\n }\n </Box>\n }\n <Box padding=\"sm\">\n <Text>\n <ng-content></ng-content>\n </Text>\n </Box>\n <Box paddingRight=\"sm\">\n @if (!actionLabel()) {\n <button icon-button (click)=\"close()\" iconName=\"close\" size=\"md\">Close</button>\n } @else {\n <button text-button variant=\"ghost\" (click)=\"this.action.emit(); close()\">\n {{ actionLabel() }}\n </button>\n }\n </Box>\n </Row>\n</dialog>\n", dependencies: [{ kind: "component", type: UniRowComponent, selector: "div[uni-row-layout], Row, div[row-layout]", inputs: ["display", "flexDirection", "minWidth"] }, { kind: "component", type: UniBoxComponent, selector: "div[uni-box-layout], Box, div[box-layout]", inputs: ["color", "backgroundColor", "borderRadius", "borderRadiusLeft", "borderRadiusRight", "borderRadiusTop", "borderRadiusBottom", "padding", "paddingHorizontal", "paddingVertical", "paddingLeft", "paddingRight", "paddingTop", "paddingBottom", "border", "borderTop", "borderBottom", "borderLeft", "borderRight", "dashBorder", "alignSelf", "alignItems", "alignContent", "justifyContent", "grow", "display", "position", "inset", "height", "minHeight", "maxHeight", "width", "minWidth", "maxWidth", "ignoreDir", "gridArea", "gridColumn", "gridRow", "overflow", "elevation", "shadow", "gap", "fullWidth", "fullHeight", "flexDirection", "textAlign", "wrapItems", "zIndex"] }, { kind: "component", type: UniTextComponent, selector: "uni-text, Text", inputs: ["typeface", "color", "display", "align", "nowrap", "maxWidth", "ellipsis"] }, { kind: "component", type: UniIconButtonComponent, selector: "button[uni-icon-button], button[icon-button]", inputs: ["iconName", "symbolName", "variant", "size", "disable", "loading", "opticalSize"] }, { kind: "component", type: UniSymbolComponent, selector: "uni-symbol, Symbol", inputs: ["name", "fill", "weight", "grade", "opticalSize"] }, { kind: "component", type: UniIconComponent, selector: "uni-icon, Icon", inputs: ["color", "name"] }, { kind: "component", type: UniButtonComponent, selector: "button[uni-text-button], Button, button[text-button]", inputs: ["disable", "loading", "fullWidth", "symbolLeft", "symbolRight"] }] });
2236
+ }
2237
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniSnackbarComponent, decorators: [{
2238
+ type: Component,
2239
+ args: [{ selector: 'uni-snackbar, Snackbar', standalone: true, imports: [
2240
+ UniRowComponent,
2241
+ UniBoxComponent,
2242
+ UniTextComponent,
2243
+ UniIconButtonComponent,
2244
+ UniSymbolComponent,
2245
+ UniIconComponent,
2246
+ UniButtonComponent,
2247
+ ], providers: [{ provide: COMPONENT_NAME, useValue: 'snackbar' }], template: "@let icon = iconName();\n@let symbol = symbolName();\n<dialog\n #snackbar\n [class]=\"snackbarClass\"\n (mouseenter)=\"pauseTimer()\"\n (mouseleave)=\"resumeTimer()\"\n (focusin)=\"pauseTimer()\"\n (focusout)=\"resumeTimer()\"\n>\n <Row alignItems=\"center\">\n @if (icon || symbol) {\n <Box [height]=\"26\" [width]=\"26\" paddingLeft=\"sm\">\n @if (icon) {\n <Icon [name]=\"icon\"></Icon>\n } @else if (symbol) {\n <Symbol [name]=\"symbol\" [opticalSize]=\"26\"></Symbol>\n }\n </Box>\n }\n <Box padding=\"sm\">\n <Text>\n <ng-content></ng-content>\n </Text>\n </Box>\n <Box paddingRight=\"sm\">\n @if (!actionLabel()) {\n <button icon-button (click)=\"close()\" iconName=\"close\" size=\"md\">Close</button>\n } @else {\n <button text-button variant=\"ghost\" (click)=\"this.action.emit(); close()\">\n {{ actionLabel() }}\n </button>\n }\n </Box>\n </Row>\n</dialog>\n" }]
2248
+ }], ctorParameters: () => [], propDecorators: { show: [{
2249
+ type: Input
2250
+ }], iconName: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconName", required: false }] }], symbolName: [{ type: i0.Input, args: [{ isSignal: true, alias: "symbolName", required: false }] }], timeout: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeout", required: false }] }], actionLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "actionLabel", required: false }] }], useVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "useVariant", required: false }] }], action: [{
2251
+ type: Output
2252
+ }], showing: [{
2253
+ type: Output
2254
+ }], snackbarRef: [{
2255
+ type: ViewChild,
2256
+ args: ['snackbar']
2257
+ }] } });
2258
+
2259
+ class NotificationsComponent {
2260
+ notifications = inject(NotificationService);
2261
+ alertState = signal(undefined, ...(ngDevMode ? [{ debugName: "alertState" }] : /* istanbul ignore next */ []));
2262
+ snackbarState = signal(undefined, ...(ngDevMode ? [{ debugName: "snackbarState" }] : /* istanbul ignore next */ []));
2263
+ confirmationState = signal(undefined, ...(ngDevMode ? [{ debugName: "confirmationState" }] : /* istanbul ignore next */ []));
2264
+ // Computed values for the show states
2265
+ showAlert = computed(() => !!this.alertState(), ...(ngDevMode ? [{ debugName: "showAlert" }] : /* istanbul ignore next */ []));
2266
+ showSnackbar = computed(() => !!this.snackbarState(), ...(ngDevMode ? [{ debugName: "showSnackbar" }] : /* istanbul ignore next */ []));
2267
+ showConfirmation = computed(() => !!this.confirmationState(), ...(ngDevMode ? [{ debugName: "showConfirmation" }] : /* istanbul ignore next */ []));
2268
+ // Expose the alert state
2269
+ alert = computed(() => this.alertState(), ...(ngDevMode ? [{ debugName: "alert" }] : /* istanbul ignore next */ []));
2270
+ snackbar = computed(() => this.snackbarState(), ...(ngDevMode ? [{ debugName: "snackbar" }] : /* istanbul ignore next */ []));
2271
+ confirmation = computed(() => this.confirmationState(), ...(ngDevMode ? [{ debugName: "confirmation" }] : /* istanbul ignore next */ []));
2272
+ constructor() {
2273
+ effect(() => {
2274
+ this.alertState.set(this.notifications.alert());
2275
+ });
2276
+ effect(() => {
2277
+ this.snackbarState.set(this.notifications.snackbar());
2278
+ });
2279
+ effect(() => {
2280
+ this.confirmationState.set(this.notifications.confirmation());
2281
+ });
2282
+ }
2283
+ handleConfirmationShowingEvent(showing) {
2284
+ if (!showing)
2285
+ this.notifications.hideConfirmation();
2286
+ }
2287
+ handleSnackbarShowingEvent(showing) {
2288
+ if (!showing)
2289
+ this.notifications.hideSnackbar();
2290
+ }
2291
+ handleAlertShowingEvent(showing) {
2292
+ if (!showing)
2293
+ this.notifications.hideAlert();
2294
+ }
2295
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: NotificationsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2296
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.12", type: NotificationsComponent, isStandalone: true, selector: "uni-notifications, Notifications", ngImport: i0, template: "<Alert\n [show]=\"showAlert()\"\n (showing)=\"handleAlertShowingEvent($event)\"\n [variant]=\"alert()?.variant || 'primary'\"\n [iconName]=\"alert()?.iconName\"\n [symbolName]=\"alert()?.symbolName\"\n >{{ alert()?.message }}</Alert\n>\n\n<Snackbar\n [show]=\"showSnackbar()\"\n (showing)=\"handleSnackbarShowingEvent($event)\"\n [variant]=\"snackbar()?.variant || 'primary'\"\n [actionLabel]=\"snackbar()?.actionLabel\"\n (action)=\"snackbar()?.action?.()\"\n [timeout]=\"snackbar()?.timeout\"\n [iconName]=\"snackbar()?.iconName\"\n [symbolName]=\"snackbar()?.symbolName\"\n >{{ snackbar()?.message }}</Snackbar\n>\n\n<Confirmation\n [show]=\"showConfirmation()\"\n (showing)=\"handleConfirmationShowingEvent($event)\"\n [confirmation]=\"confirmation()\"\n></Confirmation>\n", dependencies: [{ kind: "component", type: UniAlertComponent, selector: "uni-alert, Alert", inputs: ["show", "iconName", "symbolName", "useVariant"], outputs: ["showChange", "showing"] }, { kind: "component", type: UniSnackbarComponent, selector: "uni-snackbar, Snackbar", inputs: ["show", "iconName", "symbolName", "timeout", "actionLabel", "useVariant"], outputs: ["action", "showing"] }, { kind: "component", type: ConfirmationDialogComponent, selector: "uni-confirmation-dialog, Confirmation", inputs: ["show", "confirmation"], outputs: ["showing"] }] });
2297
+ }
2298
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: NotificationsComponent, decorators: [{
2299
+ type: Component,
2300
+ args: [{ selector: 'uni-notifications, Notifications', standalone: true, imports: [UniAlertComponent, UniSnackbarComponent, ConfirmationDialogComponent], template: "<Alert\n [show]=\"showAlert()\"\n (showing)=\"handleAlertShowingEvent($event)\"\n [variant]=\"alert()?.variant || 'primary'\"\n [iconName]=\"alert()?.iconName\"\n [symbolName]=\"alert()?.symbolName\"\n >{{ alert()?.message }}</Alert\n>\n\n<Snackbar\n [show]=\"showSnackbar()\"\n (showing)=\"handleSnackbarShowingEvent($event)\"\n [variant]=\"snackbar()?.variant || 'primary'\"\n [actionLabel]=\"snackbar()?.actionLabel\"\n (action)=\"snackbar()?.action?.()\"\n [timeout]=\"snackbar()?.timeout\"\n [iconName]=\"snackbar()?.iconName\"\n [symbolName]=\"snackbar()?.symbolName\"\n >{{ snackbar()?.message }}</Snackbar\n>\n\n<Confirmation\n [show]=\"showConfirmation()\"\n (showing)=\"handleConfirmationShowingEvent($event)\"\n [confirmation]=\"confirmation()\"\n></Confirmation>\n" }]
2301
+ }], ctorParameters: () => [] });
2302
+
2032
2303
  class UniTooltipComponent extends BaseComponent {
2033
2304
  elRef = inject(ElementRef);
2034
2305
  renderer = inject(Renderer2);
@@ -2209,5 +2480,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
2209
2480
  * Generated bundle index. Do not edit.
2210
2481
  */
2211
2482
 
2212
- export { LocalStorageService, NotificationService, RippleDirective, ThemeService, UNI_THEMES, UniBadgeComponent, UniBaseDatasource, UniBoxComponent, UniButtonComponent, UniCardComponent, UniCardContentComponent, UniCardHeaderComponent, UniCenterComponent, UniDialogButtonsComponent, UniDialogComponent, UniDialogHeaderComponent, UniDividerComponent, UniDropdownComponent, UniGridAreaComponent, UniGridComponent, UniIconComponent, UniMenuComponent, UniRecordDatasource, UniRowComponent, UniServerSideDatasource, UniStackComponent, UniSymbolComponent, UniTextComponent, UniTooltipComponent, UniWrapComponent, useTimer };
2483
+ export { ConfirmationDialogComponent, LocalStorageService, NotificationService, NotificationsComponent, RippleDirective, ThemeService, UNI_THEMES, UniAlertComponent, UniBadgeComponent, UniBaseDatasource, UniBoxComponent, UniButtonComponent, UniCardComponent, UniCardContentComponent, UniCardHeaderComponent, UniCenterComponent, UniDialogButtonsComponent, UniDialogComponent, UniDialogHeaderComponent, UniDividerComponent, UniDropdownComponent, UniGridAreaComponent, UniGridComponent, UniIconButtonComponent, UniIconComponent, UniMenuComponent, UniRecordDatasource, UniRowComponent, UniServerSideDatasource, UniSnackbarComponent, UniStackComponent, UniSymbolComponent, UniTextComponent, UniTooltipComponent, UniWrapComponent, useTimer };
2213
2484
  //# sourceMappingURL=uni-design-system-uni-angular.mjs.map