@uni-design-system/uni-angular 2.0.4 → 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.
@@ -1,10 +1,279 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, signal, inject, DestroyRef, computed, InjectionToken, linkedSignal, 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';
6
6
  import { autoUpdate, computePosition, offset, shift, flip, arrow } from '@floating-ui/dom';
7
7
 
8
+ class UniBaseDatasource {
9
+ selections = signal([], ...(ngDevMode ? [{ debugName: "selections" }] : /* istanbul ignore next */ []));
10
+ sort = signal({
11
+ column: undefined,
12
+ direction: 'indet',
13
+ }, ...(ngDevMode ? [{ debugName: "sort" }] : /* istanbul ignore next */ []));
14
+ sortColumn = computed(() => this.sort().column, ...(ngDevMode ? [{ debugName: "sortColumn" }] : /* istanbul ignore next */ []));
15
+ sortDirection = computed(() => this.sort().direction, ...(ngDevMode ? [{ debugName: "sortDirection" }] : /* istanbul ignore next */ []));
16
+ pages = computed(() => Array.from({ length: this.pageCount() }, (_, index) => index + 1), ...(ngDevMode ? [{ debugName: "pages" }] : /* istanbul ignore next */ []));
17
+ startIndex = computed(() => {
18
+ const pageSize = this.pageSize();
19
+ const pageIndex = this.pageIndex();
20
+ return pageSize > 0 ? pageIndex * pageSize : 0;
21
+ }, ...(ngDevMode ? [{ debugName: "startIndex" }] : /* istanbul ignore next */ []));
22
+ endIndex = computed(() => {
23
+ const pageSize = this.pageSize();
24
+ const total = this.recordCount();
25
+ // If unpaginated (pageSize = 0), return total count
26
+ if (pageSize === 0) {
27
+ return total;
28
+ }
29
+ const start = this.startIndex();
30
+ return Math.min(start + pageSize, total);
31
+ }, ...(ngDevMode ? [{ debugName: "endIndex" }] : /* istanbul ignore next */ []));
32
+ disablePrevious = computed(() => {
33
+ const pageSize = this.pageSize();
34
+ return pageSize === 0 ? true : this.pageIndex() === 0;
35
+ }, ...(ngDevMode ? [{ debugName: "disablePrevious" }] : /* istanbul ignore next */ []));
36
+ disableNext = computed(() => {
37
+ const pageSize = this.pageSize();
38
+ return pageSize === 0 ? true : this.pageIndex() + 1 >= this.pageCount();
39
+ }, ...(ngDevMode ? [{ debugName: "disableNext" }] : /* istanbul ignore next */ []));
40
+ truncatedPages = computed(() => {
41
+ const currentPage = this.pageIndex() + 1;
42
+ const displayRange = 3;
43
+ const totalPages = this.pageCount();
44
+ const pages = [];
45
+ const startPage = Math.max(1, currentPage - displayRange);
46
+ const endPage = Math.min(totalPages, currentPage + displayRange);
47
+ if (startPage > 1) {
48
+ pages.push(1);
49
+ if (startPage > 2) {
50
+ pages.push('...');
51
+ }
52
+ }
53
+ for (let i = startPage; i <= endPage; i++) {
54
+ pages.push(i);
55
+ }
56
+ if (endPage < totalPages) {
57
+ if (endPage < totalPages - 1) {
58
+ pages.push('...');
59
+ }
60
+ pages.push(totalPages);
61
+ }
62
+ return pages;
63
+ }, ...(ngDevMode ? [{ debugName: "truncatedPages" }] : /* istanbul ignore next */ []));
64
+ isSelected(row) {
65
+ return this.selections().some((selection) => selection === row);
66
+ }
67
+ toggleSelection(row) {
68
+ this.selections.update((selections) => {
69
+ return selections.includes(row) ? selections.filter((i) => i !== row) : [...selections, row];
70
+ });
71
+ }
72
+ clearSelections() {
73
+ this.selections.set([]);
74
+ }
75
+ selectAll() {
76
+ this.selections.set([...this.records()]);
77
+ }
78
+ }
79
+
80
+ class UniRecordDatasource extends UniBaseDatasource {
81
+ _pageNumber = signal(1, ...(ngDevMode ? [{ debugName: "_pageNumber" }] : /* istanbul ignore next */ []));
82
+ _pageSize = signal(0, ...(ngDevMode ? [{ debugName: "_pageSize" }] : /* istanbul ignore next */ [])); // 0 = unpaginated (show all)
83
+ initialRecords = signal([], ...(ngDevMode ? [{ debugName: "initialRecords" }] : /* istanbul ignore next */ []));
84
+ recordCount = computed(() => this.initialRecords().filter(this.filter()).length, ...(ngDevMode ? [{ debugName: "recordCount" }] : /* istanbul ignore next */ []));
85
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
86
+ filter = signal((value) => true, ...(ngDevMode ? [{ debugName: "filter" }] : /* istanbul ignore next */ []));
87
+ pageIndex = signal(0, ...(ngDevMode ? [{ debugName: "pageIndex" }] : /* istanbul ignore next */ []));
88
+ pageSize = computed(() => this._pageSize(), ...(ngDevMode ? [{ debugName: "pageSize" }] : /* istanbul ignore next */ []));
89
+ pageCount = computed(() => {
90
+ const pageSize = this.pageSize();
91
+ return pageSize > 0 ? Math.ceil(this.recordCount() / pageSize) : 1;
92
+ }, ...(ngDevMode ? [{ debugName: "pageCount" }] : /* istanbul ignore next */ []));
93
+ records = computed(() => {
94
+ const { column, direction } = this.sort();
95
+ const filter = this.filter();
96
+ const pageSize = this.pageSize();
97
+ let filteredRecords = this.initialRecords().filter(filter);
98
+ // Apply sorting if specified
99
+ if (column && direction !== 'indet') {
100
+ filteredRecords = [...filteredRecords].sort((a, b) => {
101
+ const valueA = a[column];
102
+ const valueB = b[column];
103
+ const isString = typeof valueA === 'string';
104
+ const isAsc = direction === 'asc';
105
+ return isString
106
+ ? stringCompare(valueA, valueB, isAsc)
107
+ : numberCompare(valueA, valueB, isAsc);
108
+ });
109
+ }
110
+ // Apply pagination only if pageSize > 0
111
+ if (pageSize > 0) {
112
+ return filteredRecords.slice(this.startIndex(), this.endIndex());
113
+ }
114
+ // Return all records (unpaginated)
115
+ return filteredRecords;
116
+ }, ...(ngDevMode ? [{ debugName: "records" }] : /* istanbul ignore next */ []));
117
+ constructor(data) {
118
+ super();
119
+ this.initialRecords.set(data);
120
+ }
121
+ sortRecords(sort) {
122
+ this.sort.set(sort);
123
+ }
124
+ firstPage() {
125
+ this.pageIndex.set(0);
126
+ }
127
+ nextPage() {
128
+ if (this.pageIndex() < this.pageCount() - 1) {
129
+ this.pageIndex.update((i) => i + 1);
130
+ }
131
+ }
132
+ previousPage() {
133
+ this.pageIndex.update((i) => (i > 1 ? i - 1 : 0));
134
+ }
135
+ lastPage() {
136
+ this.pageIndex.set(this.pageCount() - 1);
137
+ }
138
+ jumpToPage(page) {
139
+ const i = page - 1;
140
+ if (i >= 0 && i < this.pageCount()) {
141
+ this.pageIndex.set(i);
142
+ }
143
+ }
144
+ setPageSize(size) {
145
+ this._pageSize.set(size);
146
+ if (size > 0) {
147
+ this._pageNumber.set(1);
148
+ this.pageIndex.set(0);
149
+ }
150
+ }
151
+ setFilter(filter) {
152
+ this.filter.set(filter);
153
+ }
154
+ clearFilter() {
155
+ this.filter.set(() => true);
156
+ }
157
+ }
158
+ function stringCompare(a = 'zzz', b = 'zzz', isAsc) {
159
+ a = a.toString();
160
+ b = b.toString();
161
+ return isAsc
162
+ ? a.localeCompare(b, undefined, { sensitivity: 'base' })
163
+ : b.localeCompare(a, undefined, { sensitivity: 'base' });
164
+ }
165
+ function numberCompare(a = 0, b = 0, isAsc) {
166
+ return isAsc ? a - b : b - a;
167
+ }
168
+
169
+ class UniServerSideDatasource extends UniBaseDatasource {
170
+ dataLoader;
171
+ _pageNumber = signal(1, ...(ngDevMode ? [{ debugName: "_pageNumber" }] : /* istanbul ignore next */ []));
172
+ _pageSize = signal(10, ...(ngDevMode ? [{ debugName: "_pageSize" }] : /* istanbul ignore next */ []));
173
+ _sortColumn = signal(undefined, ...(ngDevMode ? [{ debugName: "_sortColumn" }] : /* istanbul ignore next */ []));
174
+ _sortDirection = signal('indet', ...(ngDevMode ? [{ debugName: "_sortDirection" }] : /* istanbul ignore next */ []));
175
+ filter = signal({}, ...(ngDevMode ? [{ debugName: "filter" }] : /* istanbul ignore next */ []));
176
+ sortColumn = computed(() => this._sortColumn(), ...(ngDevMode ? [{ debugName: "sortColumn" }] : /* istanbul ignore next */ []));
177
+ sortDirection = computed(() => this._sortDirection(), ...(ngDevMode ? [{ debugName: "sortDirection" }] : /* istanbul ignore next */ []));
178
+ totalRecords = signal(0, ...(ngDevMode ? [{ debugName: "totalRecords" }] : /* istanbul ignore next */ []));
179
+ dataResource;
180
+ pageIndex = computed(() => this._pageNumber() - 1, ...(ngDevMode ? [{ debugName: "pageIndex" }] : /* istanbul ignore next */ []));
181
+ pageSize = computed(() => this._pageSize(), ...(ngDevMode ? [{ debugName: "pageSize" }] : /* istanbul ignore next */ []));
182
+ pageCount = computed(() => {
183
+ const total = this.totalRecords();
184
+ const size = this.pageSize();
185
+ return total > 0 ? Math.ceil(total / size) : 0;
186
+ }, ...(ngDevMode ? [{ debugName: "pageCount" }] : /* istanbul ignore next */ []));
187
+ _records = linkedSignal({ ...(ngDevMode ? { debugName: "_records" } : /* istanbul ignore next */ {}), source: () => ({
188
+ val: this.dataResource.value(),
189
+ status: this.dataResource.status(),
190
+ }),
191
+ computation: (source, previous) => {
192
+ if (source.status === 'loading' && previous) {
193
+ return previous.value;
194
+ }
195
+ return source.val?.data ?? [];
196
+ } });
197
+ records = this._records.asReadonly();
198
+ recordCount = computed(() => this.totalRecords(), ...(ngDevMode ? [{ debugName: "recordCount" }] : /* istanbul ignore next */ []));
199
+ isLoading = computed(() => this.dataResource.isLoading(), ...(ngDevMode ? [{ debugName: "isLoading" }] : /* istanbul ignore next */ []));
200
+ error = computed(() => this.dataResource.error(), ...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
201
+ hasError = computed(() => this.dataResource.hasValue() === false && this.error() !== undefined, ...(ngDevMode ? [{ debugName: "hasError" }] : /* istanbul ignore next */ []));
202
+ constructor(dataLoader, initialPageSize = 10) {
203
+ super();
204
+ this.dataLoader = dataLoader;
205
+ this._pageSize.set(initialPageSize);
206
+ this.dataResource = resource({ ...(ngDevMode ? { debugName: "dataResource" } : /* istanbul ignore next */ {}), params: () => ({
207
+ pageNumber: this._pageNumber(),
208
+ pageSize: this._pageSize(),
209
+ sortColumn: this._sortColumn(),
210
+ sortDirection: this._sortDirection(),
211
+ filter: this.filter(),
212
+ }),
213
+ loader: async (params) => {
214
+ const request = params.params;
215
+ const response = await this.dataLoader(request);
216
+ if (request.pageNumber === 1 || this.totalRecords() === 0) {
217
+ this.totalRecords.set(response.totalRecords);
218
+ }
219
+ return response;
220
+ } });
221
+ }
222
+ sortRecords(sort) {
223
+ this.sort.set(sort);
224
+ this._sortColumn.set(sort.column);
225
+ this._sortDirection.set(sort.direction);
226
+ this._pageNumber.set(1);
227
+ }
228
+ firstPage() {
229
+ this._pageNumber.set(1);
230
+ }
231
+ nextPage() {
232
+ if (this._pageNumber() < this.pageCount()) {
233
+ this._pageNumber.update((n) => n + 1);
234
+ }
235
+ }
236
+ previousPage() {
237
+ if (this._pageNumber() > 1) {
238
+ this._pageNumber.update((n) => n - 1);
239
+ }
240
+ }
241
+ lastPage() {
242
+ this._pageNumber.set(this.pageCount());
243
+ }
244
+ jumpToPage(page) {
245
+ if (page >= 1 && page <= this.pageCount()) {
246
+ this._pageNumber.set(page);
247
+ }
248
+ }
249
+ setPageSize(size) {
250
+ if (size > 0) {
251
+ this._pageSize.set(size);
252
+ this._pageNumber.set(1);
253
+ }
254
+ }
255
+ setFilter(filterValues) {
256
+ this.filter.set(filterValues);
257
+ this._pageNumber.set(1);
258
+ }
259
+ clearFilter() {
260
+ this.filter.set({});
261
+ this._pageNumber.set(1);
262
+ }
263
+ refresh() {
264
+ this.dataResource.reload();
265
+ }
266
+ getPageRequest() {
267
+ return {
268
+ pageNumber: this._pageNumber(),
269
+ pageSize: this._pageSize(),
270
+ sortColumn: this._sortColumn(),
271
+ sortDirection: this._sortDirection(),
272
+ filter: this.filter(),
273
+ };
274
+ }
275
+ }
276
+
8
277
  function memoize(fn) {
9
278
  const cache = new Map();
10
279
  return ((...args) => {
@@ -225,7 +494,7 @@ const UNI_THEMES = new InjectionToken('', {
225
494
  factory: () => UniThemes,
226
495
  });
227
496
 
228
- const safeParseInt = (n) => typeof n === 'number' ? n : parseInt(n);
497
+ const safeParseInt = (n) => (typeof n === 'number' ? n : parseInt(n));
229
498
 
230
499
  // noinspection JSUnusedGlobalSymbols
231
500
  class ThemeService {
@@ -298,7 +567,11 @@ class ThemeService {
298
567
  const token = (color + '-container');
299
568
  return this.colorPair(token, useVariant);
300
569
  };
301
- 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
+ };
302
575
  colorPalette = () => this.colors();
303
576
  color(color) {
304
577
  return !color ? undefined : { color: this.colors()[color] };
@@ -925,7 +1198,7 @@ class UniButtonComponent extends BaseComponent {
925
1198
  get className() {
926
1199
  return css([
927
1200
  this.style() && {
928
- ...this.style(),
1201
+ ...this.style(), // TODO: Set priority on theme-defined styles
929
1202
  },
930
1203
  {
931
1204
  display: 'flex',
@@ -935,7 +1208,6 @@ class UniButtonComponent extends BaseComponent {
935
1208
  outline: 0,
936
1209
  border: 0,
937
1210
  cursor: 'pointer',
938
- fontFamily: 'Euphemia, sans-serif',
939
1211
  transition: 'all 0.28s ease',
940
1212
  '&:disabled': {
941
1213
  cursor: 'not-allowed !important',
@@ -1669,11 +1941,11 @@ class UniMenuItemComponent extends UniBoxComponent {
1669
1941
  this._elementRef.nativeElement.focus();
1670
1942
  }
1671
1943
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniMenuItemComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1672
- 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"] }] });
1673
1945
  }
1674
1946
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniMenuItemComponent, decorators: [{
1675
1947
  type: Component,
1676
- 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"] }]
1677
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: [{
1678
1950
  type: HostBinding,
1679
1951
  args: ['class']
@@ -1760,6 +2032,274 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
1760
2032
  args: ['class']
1761
2033
  }] } });
1762
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
+
1763
2303
  class UniTooltipComponent extends BaseComponent {
1764
2304
  elRef = inject(ElementRef);
1765
2305
  renderer = inject(Renderer2);
@@ -1940,5 +2480,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
1940
2480
  * Generated bundle index. Do not edit.
1941
2481
  */
1942
2482
 
1943
- export { RippleDirective, UniBadgeComponent, UniBoxComponent, UniButtonComponent, UniCardComponent, UniCardContentComponent, UniCardHeaderComponent, UniCenterComponent, UniDialogButtonsComponent, UniDialogComponent, UniDialogHeaderComponent, UniDividerComponent, UniDropdownComponent, UniGridAreaComponent, UniGridComponent, UniIconComponent, UniMenuComponent, UniRowComponent, UniStackComponent, UniSymbolComponent, UniTextComponent, UniTooltipComponent, UniWrapComponent };
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 };
1944
2484
  //# sourceMappingURL=uni-design-system-uni-angular.mjs.map