@nanahoshi/mona-ui 0.24.11 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +11 -10
- package/fesm2022/nanahoshi-mona-ui-avatar.mjs +37 -20
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +239 -47
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +184 -31
- package/fesm2022/nanahoshi-mona-ui-button.mjs +47 -11
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +17 -13
- package/fesm2022/nanahoshi-mona-ui-card.mjs +54 -30
- package/fesm2022/nanahoshi-mona-ui-chart.mjs +27 -22
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +112 -31
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +131 -89
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +59 -19
- package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +118 -41
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +243 -212
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +155 -86
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +161 -131
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +12 -11
- package/fesm2022/nanahoshi-mona-ui-common.mjs +18 -1
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +10 -9
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +10 -9
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +10 -9
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +25 -24
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +202 -33
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +31 -10
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +1 -1
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-DhKLnW06.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-2tVhD2hK.mjs} +2 -2
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-voGbKOiB.mjs → nanahoshi-mona-ui-grid-grid-list.component-BAN70Wcn.mjs} +4 -4
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-HQ1Kv6R9.mjs → nanahoshi-mona-ui-grid-grid-row.component-C_kCaA5b.mjs} +7 -7
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-PNLJFcuH.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-BsNfrAHz.mjs} +4 -4
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BO19AVwC.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CEfVa7eo.mjs} +27 -29
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +39 -4
- package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +5 -5
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +7 -7
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +183 -47
- package/fesm2022/nanahoshi-mona-ui-label.mjs +111 -15
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +14 -13
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +13 -12
- package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +192 -56
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +3 -1
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +60 -29
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +334 -37
- package/fesm2022/nanahoshi-mona-ui-rating.mjs +84 -30
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +274 -108
- package/fesm2022/nanahoshi-mona-ui-segmented.mjs +127 -37
- package/fesm2022/nanahoshi-mona-ui-sheet.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +595 -170
- package/fesm2022/nanahoshi-mona-ui-skeleton.mjs +3 -2
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +323 -166
- package/fesm2022/nanahoshi-mona-ui-spinner.mjs +167 -82
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +3 -3
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +273 -165
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +219 -132
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +84 -32
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +337 -116
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +10 -12
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +21 -8
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +444 -88
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +10 -9
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +15 -14
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +17 -3
- package/fesm2022/nanahoshi-mona-ui-window.mjs +1 -1
- package/i18n/catalogs/en-US.messages.json +33 -4
- package/locales/ar-sa/ar-sa.messages.json +33 -4
- package/locales/de-de/de-de.messages.json +33 -4
- package/locales/es-es/es-es.messages.json +33 -4
- package/locales/fr-fr/fr-fr.messages.json +33 -4
- package/locales/id-id/id-id.messages.json +33 -4
- package/locales/it-it/it-it.messages.json +33 -4
- package/locales/ja-jp/ja-jp.messages.json +33 -4
- package/locales/ko-kr/ko-kr.messages.json +33 -4
- package/locales/pt-br/pt-br.messages.json +33 -4
- package/locales/ru-ru/ru-ru.messages.json +33 -4
- package/locales/tr-tr/tr-tr.messages.json +33 -4
- package/locales/zh-cn/zh-cn.messages.json +33 -4
- package/locales/zh-tw/zh-tw.messages.json +33 -4
- package/package.json +2 -1
- package/styles.css +156 -0
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +1 -0
- package/types/nanahoshi-mona-ui-avatar.d.ts +18 -11
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +62 -14
- package/types/nanahoshi-mona-ui-button-group.d.ts +86 -16
- package/types/nanahoshi-mona-ui-button.d.ts +26 -3
- package/types/nanahoshi-mona-ui-calendar.d.ts +1 -0
- package/types/nanahoshi-mona-ui-card.d.ts +22 -6
- package/types/nanahoshi-mona-ui-check-box.d.ts +54 -13
- package/types/nanahoshi-mona-ui-chip.d.ts +31 -18
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +21 -5
- package/types/nanahoshi-mona-ui-collapsible.d.ts +20 -11
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +62 -36
- package/types/nanahoshi-mona-ui-color-palette.d.ts +65 -27
- package/types/nanahoshi-mona-ui-color-picker.d.ts +64 -23
- package/types/nanahoshi-mona-ui-combo-box.d.ts +1 -0
- package/types/nanahoshi-mona-ui-common.d.ts +28 -2
- package/types/nanahoshi-mona-ui-date-picker.d.ts +1 -0
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +1 -0
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +1 -0
- package/types/nanahoshi-mona-ui-editor.d.ts +1 -0
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +51 -7
- package/types/nanahoshi-mona-ui-fieldset.d.ts +18 -4
- package/types/nanahoshi-mona-ui-grid.d.ts +0 -1
- package/types/nanahoshi-mona-ui-i18n.d.ts +38 -3
- package/types/nanahoshi-mona-ui-internal.d.ts +95 -14
- package/types/nanahoshi-mona-ui-label.d.ts +17 -2
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +29 -0
- package/types/nanahoshi-mona-ui-multi-select.d.ts +1 -0
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +1 -0
- package/types/nanahoshi-mona-ui-otp-input.d.ts +49 -12
- package/types/nanahoshi-mona-ui-placeholder.d.ts +2 -1
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +21 -9
- package/types/nanahoshi-mona-ui-radio-button.d.ts +165 -20
- package/types/nanahoshi-mona-ui-rating.d.ts +21 -6
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +59 -27
- package/types/nanahoshi-mona-ui-segmented.d.ts +52 -24
- package/types/nanahoshi-mona-ui-sidebar.d.ts +104 -41
- package/types/nanahoshi-mona-ui-skeleton.d.ts +1 -1
- package/types/nanahoshi-mona-ui-slider.d.ts +99 -35
- package/types/nanahoshi-mona-ui-spinner.d.ts +9 -5
- package/types/nanahoshi-mona-ui-splitter.d.ts +31 -10
- package/types/nanahoshi-mona-ui-stepper.d.ts +58 -12
- package/types/nanahoshi-mona-ui-switch.d.ts +32 -10
- package/types/nanahoshi-mona-ui-tabs.d.ts +75 -20
- package/types/nanahoshi-mona-ui-text-area.d.ts +7 -7
- package/types/nanahoshi-mona-ui-text-box.d.ts +2 -0
- package/types/nanahoshi-mona-ui-theme.d.ts +392 -15
- package/types/nanahoshi-mona-ui-time-picker.d.ts +1 -0
- package/types/nanahoshi-mona-ui-time-selector.d.ts +1 -0
- package/types/nanahoshi-mona-ui-tooltip.d.ts +7 -1
package/README.md
CHANGED
|
@@ -17,6 +17,8 @@ A modern, high-performance, accessible UI component library built for Angular an
|
|
|
17
17
|
|
|
18
18
|
## Documentation
|
|
19
19
|
|
|
20
|
+
- [Theming](docs/theming.md)
|
|
21
|
+
- [Forms](docs/forms.md)
|
|
20
22
|
- [Internationalization (i18n) & RTL Guide](docs/i18n.md)
|
|
21
23
|
- [Buttons](docs/button.md)
|
|
22
24
|
- [Popups](docs/popup.md)
|
|
@@ -37,6 +39,13 @@ A modern, high-performance, accessible UI component library built for Angular an
|
|
|
37
39
|
npm install @nanahoshi/mona-ui
|
|
38
40
|
```
|
|
39
41
|
|
|
42
|
+
Mona UI is styled with Tailwind CSS 4. Import the package's styles after Tailwind in your main stylesheet:
|
|
43
|
+
|
|
44
|
+
```css
|
|
45
|
+
@import "tailwindcss";
|
|
46
|
+
@import "@nanahoshi/mona-ui/styles.css";
|
|
47
|
+
```
|
|
48
|
+
|
|
40
49
|
### Setup Internationalization
|
|
41
50
|
|
|
42
51
|
Mona UI works out-of-the-box in English without configuration. To provide a customized locale or configure runtime language switching, import `provideMonaI18n`:
|
|
@@ -2,7 +2,7 @@ import { NgTemplateOutlet } from '@angular/common';
|
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { inject, DestroyRef, ElementRef, computed, linkedSignal, contentChild, TemplateRef, viewChild, input, output, booleanAttribute, model, afterNextRender, effect, untracked, forwardRef, Component } from '@angular/core';
|
|
4
4
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
|
-
import { themeControlSurfaceClasses, createElementControlId, rxTimeout } from '@nanahoshi/mona-ui/internal';
|
|
5
|
+
import { themeControlSurfaceClasses, injectEffectiveDisabled, createElementControlId, rxTimeout } from '@nanahoshi/mona-ui/internal';
|
|
6
6
|
import { FilterChangeEvent } from '@nanahoshi/mona-ui/common';
|
|
7
7
|
import { IndicatorIconComponent } from '@nanahoshi/mona-ui/internal/indicator-icon';
|
|
8
8
|
import { ListService, ListComponent, ListGroupHeaderTemplateDirective, ListFooterTemplateDirective, ListHeaderTemplateDirective, ListNoDataTemplateDirective, ListItemTemplateDirective } from '@nanahoshi/mona-ui/internal/list';
|
|
@@ -23,7 +23,7 @@ const AUTO_COMPLETE_DEFAULT_MESSAGES = {
|
|
|
23
23
|
const autoCompleteBaseThemeVariants = cva(`
|
|
24
24
|
flex
|
|
25
25
|
${themeControlSurfaceClasses} text-foreground
|
|
26
|
-
border border-input-border shadow-(--shadow-control) outline-none
|
|
26
|
+
border border-input-border shadow-(--shadow-control) outline-none focus-visible:outline-hidden
|
|
27
27
|
transition-[color,box-shadow,border] duration-(--mona-motion-standard) ease-in-out
|
|
28
28
|
data-[readonly='true']:cursor-default
|
|
29
29
|
focus-within:border-focus-indicator focus-within:ring-2 focus-within:ring-focus-indicator/35
|
|
@@ -81,7 +81,7 @@ const autoCompleteBaseThemeVariants = cva(`
|
|
|
81
81
|
});
|
|
82
82
|
const autoCompleteTextInputThemeVariants = cva(`
|
|
83
83
|
h-full w-full px-2 text-ellipsis
|
|
84
|
-
bg-transparent border-none shadow-none outline-none
|
|
84
|
+
bg-transparent border-none shadow-none outline-none focus-visible:outline-hidden
|
|
85
85
|
focus-within:ring-0 focus-visible:ring-0
|
|
86
86
|
`, {
|
|
87
87
|
variants: {
|
|
@@ -123,7 +123,7 @@ class AutoCompleteComponent {
|
|
|
123
123
|
...(ngDevMode ? [{ debugName: "autoCompleteValue" }] : /* istanbul ignore next */ []));
|
|
124
124
|
this.autoCompleteValue$ = new Subject();
|
|
125
125
|
this.baseClass = computed(() => {
|
|
126
|
-
const disabled = this.
|
|
126
|
+
const disabled = this.effectiveDisabled();
|
|
127
127
|
const expanded = this.expanded();
|
|
128
128
|
const focused = this.#popupRef() !== null;
|
|
129
129
|
const invalid = this.invalidState();
|
|
@@ -144,9 +144,10 @@ class AutoCompleteComponent {
|
|
|
144
144
|
this.clearButtonVisible = computed(() => this.showClearButton() &&
|
|
145
145
|
!!this.autoCompleteValue() &&
|
|
146
146
|
!this.loading() &&
|
|
147
|
-
!this.
|
|
147
|
+
!this.effectiveDisabled() &&
|
|
148
148
|
!this.readonly(), /* @ts-ignore */
|
|
149
149
|
...(ngDevMode ? [{ debugName: "clearButtonVisible" }] : /* istanbul ignore next */ []));
|
|
150
|
+
this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
|
|
150
151
|
this.expanded = computed(() => this.#popupRef() !== null, /* @ts-ignore */
|
|
151
152
|
...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
152
153
|
this.footerTemplate = contentChild(DropdownFooterTemplateDirective, { ...(ngDevMode ? { debugName: "footerTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
@@ -409,7 +410,7 @@ class AutoCompleteComponent {
|
|
|
409
410
|
}
|
|
410
411
|
}
|
|
411
412
|
onValueClear(event) {
|
|
412
|
-
if (this.
|
|
413
|
+
if (this.effectiveDisabled() ||
|
|
413
414
|
this.readonly() ||
|
|
414
415
|
(event instanceof KeyboardEvent && event.key !== "Enter" && event.key !== " ")) {
|
|
415
416
|
return;
|
|
@@ -551,7 +552,7 @@ class AutoCompleteComponent {
|
|
|
551
552
|
}
|
|
552
553
|
}
|
|
553
554
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AutoCompleteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
554
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: AutoCompleteComponent, isStandalone: true, selector: "mona-auto-complete", inputs: { ariaDescribedBy: { classPropertyName: "ariaDescribedBy", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, highlightFirst: { classPropertyName: "highlightFirst", publicName: "highlightFirst", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, itemDisabled: { classPropertyName: "itemDisabled", publicName: "itemDisabled", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, popupClass: { classPropertyName: "popupClass", publicName: "popupClass", isSignal: true, isRequired: false, transformFunction: null }, popupHeight: { classPropertyName: "popupHeight", publicName: "popupHeight", isSignal: true, isRequired: false, transformFunction: null }, popupWidth: { classPropertyName: "popupWidth", publicName: "popupWidth", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, showClearButton: { classPropertyName: "showClearButton", publicName: "showClearButton", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, textField: { classPropertyName: "textField", publicName: "textField", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, valueField: { classPropertyName: "valueField", publicName: "valueField", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { close: "close", closed: "closed", open: "open", opened: "opened", touch: "touch", value: "valueChange" }, host: { listeners: { "focusout": "onFocusOut($event)" }, properties: { "attr.aria-describedby": "null", "attr.aria-label": "null", "attr.aria-labelledby": "null", "attr.data-disabled": "
|
|
555
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: AutoCompleteComponent, isStandalone: true, selector: "mona-auto-complete", inputs: { ariaDescribedBy: { classPropertyName: "ariaDescribedBy", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, highlightFirst: { classPropertyName: "highlightFirst", publicName: "highlightFirst", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, itemDisabled: { classPropertyName: "itemDisabled", publicName: "itemDisabled", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, popupClass: { classPropertyName: "popupClass", publicName: "popupClass", isSignal: true, isRequired: false, transformFunction: null }, popupHeight: { classPropertyName: "popupHeight", publicName: "popupHeight", isSignal: true, isRequired: false, transformFunction: null }, popupWidth: { classPropertyName: "popupWidth", publicName: "popupWidth", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, showClearButton: { classPropertyName: "showClearButton", publicName: "showClearButton", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, textField: { classPropertyName: "textField", publicName: "textField", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, valueField: { classPropertyName: "valueField", publicName: "valueField", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { close: "close", closed: "closed", open: "open", opened: "opened", touch: "touch", value: "valueChange" }, host: { listeners: { "focusout": "onFocusOut($event)" }, properties: { "attr.aria-describedby": "null", "attr.aria-label": "null", "attr.aria-labelledby": "null", "attr.data-disabled": "effectiveDisabled() || null", "attr.data-invalid": "invalidState() || null", "attr.data-readonly": "readonly() || null", "attr.tabindex": "-1", "class": "baseClass()" } }, providers: [
|
|
555
556
|
ListService,
|
|
556
557
|
DropdownService,
|
|
557
558
|
{
|
|
@@ -564,7 +565,7 @@ class AutoCompleteComponent {
|
|
|
564
565
|
useExisting: forwardRef(() => AutoCompleteComponent),
|
|
565
566
|
multi: false
|
|
566
567
|
}
|
|
567
|
-
], queries: [{ propertyName: "footerTemplate", first: true, predicate: DropdownFooterTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "groupHeaderTemplate", first: true, predicate: DropdownGroupHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "headerTemplate", first: true, predicate: DropdownHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "itemTemplate", first: true, predicate: DropdownItemTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "noDataTemplate", first: true, predicate: DropdownNoDataTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "prefixTemplate", first: true, predicate: DropdownPrefixTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "suffixTemplate", first: true, predicate: DropdownSuffixTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1.DropdownDataHandlerDirective }, { directive: i1.DropdownListPopupHandlerDirective }, { directive: i1.DropdownLiveRegionDirective }], ngImport: i0, template: "@if (prefixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </span>\n}\n\n<input\n monaTextBox\n role=\"combobox\"\n [class]=\"inputClass()\"\n [disabled]=\"
|
|
568
|
+
], queries: [{ propertyName: "footerTemplate", first: true, predicate: DropdownFooterTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "groupHeaderTemplate", first: true, predicate: DropdownGroupHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "headerTemplate", first: true, predicate: DropdownHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "itemTemplate", first: true, predicate: DropdownItemTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "noDataTemplate", first: true, predicate: DropdownNoDataTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "prefixTemplate", first: true, predicate: DropdownPrefixTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "suffixTemplate", first: true, predicate: DropdownSuffixTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1.DropdownDataHandlerDirective }, { directive: i1.DropdownListPopupHandlerDirective }, { directive: i1.DropdownLiveRegionDirective }], ngImport: i0, template: "@if (prefixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </span>\n}\n\n<input\n monaTextBox\n role=\"combobox\"\n [class]=\"inputClass()\"\n [disabled]=\"effectiveDisabled()\"\n [id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [value]=\"autoCompleteValue()\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-autocomplete]=\"'list'\"\n [attr.aria-busy]=\"loading()\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-describedby]=\"ariaDescribedBy() || undefined\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-invalid]=\"invalidState() || undefined\"\n [attr.aria-label]=\"ariaLabel() || undefined\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || undefined\"\n (input)=\"onInput(textInput.value)\"\n #textInput />\n\n@if (clearButtonVisible()) {\n <mona-indicator-icon\n preset=\"clear\"\n [interactive]=\"true\"\n [label]=\"messages().clear\"\n (activate)=\"onValueClear($event)\"></mona-indicator-icon>\n}\n\n@if (loading()) {\n <mona-indicator-icon preset=\"loading\" [size]=\"12\"></mona-indicator-icon>\n}\n\n@if (suffixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"suffixTemplate()\"></ng-container>\n </span>\n}\n\n<ng-template #popupTemplate>\n <div [class]=\"listPopupClass()\" (pointerdown)=\"onPopupPointerDown($event)\">\n <mona-list (itemSelect)=\"onItemSelect($event)\" [focusOnMount]=\"false\" [size]=\"size()\" [listId]=\"listId\">\n @if (footerTemplate()) {\n <ng-template monaListFooterTemplate>\n <ng-container [ngTemplateOutlet]=\"footerTemplate()\"></ng-container>\n </ng-template>\n }\n @if (groupHeaderTemplate()) {\n <ng-template monaListGroupHeaderTemplate let-group>\n <ng-container\n [ngTemplateOutlet]=\"groupHeaderTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: group }\"></ng-container>\n </ng-template>\n }\n @if (headerTemplate()) {\n <ng-template monaListHeaderTemplate>\n <ng-container [ngTemplateOutlet]=\"headerTemplate()\"></ng-container>\n </ng-template>\n }\n @if (itemTemplate()) {\n <ng-template monaListItemTemplate let-dataItem>\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"></ng-container>\n </ng-template>\n }\n @if (noDataTemplate()) {\n <ng-template monaListNoDataTemplate>\n <ng-container [ngTemplateOutlet]=\"noDataTemplate()\"></ng-container>\n </ng-template>\n }\n </mona-list>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: TextBoxDirective, selector: "input[monaTextBox]", inputs: ["invalid", "rounded", "size", "touched", "class"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: ListComponent, selector: "mona-list", inputs: ["ariaLabel", "ariaLabelledBy", "busy", "data", "focusOnMount", "height", "listClass", "listId", "listItemClass", "listItemStyle", "listRole", "listStyle", "maxHeight", "maxWidth", "size", "textField", "width"], outputs: ["itemActivate", "itemSelect"] }, { kind: "directive", type: ListGroupHeaderTemplateDirective, selector: "ng-template[monaListGroupHeaderTemplate]" }, { kind: "directive", type: ListFooterTemplateDirective, selector: "ng-template[monaListFooterTemplate]" }, { kind: "directive", type: ListHeaderTemplateDirective, selector: "ng-template[monaListHeaderTemplate]" }, { kind: "directive", type: ListNoDataTemplateDirective, selector: "ng-template[monaListNoDataTemplate]" }, { kind: "directive", type: ListItemTemplateDirective, selector: "ng-template[monaListItemTemplate]" }, { kind: "component", type: IndicatorIconComponent, selector: "mona-indicator-icon", inputs: ["icon", "interactive", "label", "preset", "size", "class"], outputs: ["activate"] }] }); }
|
|
568
569
|
}
|
|
569
570
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AutoCompleteComponent, decorators: [{
|
|
570
571
|
type: Component,
|
|
@@ -597,13 +598,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
597
598
|
"[attr.aria-describedby]": "null",
|
|
598
599
|
"[attr.aria-label]": "null",
|
|
599
600
|
"[attr.aria-labelledby]": "null",
|
|
600
|
-
"[attr.data-disabled]": "
|
|
601
|
+
"[attr.data-disabled]": "effectiveDisabled() || null",
|
|
601
602
|
"[attr.data-invalid]": "invalidState() || null",
|
|
602
603
|
"[attr.data-readonly]": "readonly() || null",
|
|
603
604
|
"[attr.tabindex]": "-1",
|
|
604
605
|
"[class]": "baseClass()",
|
|
605
606
|
"(focusout)": "onFocusOut($event)"
|
|
606
|
-
}, template: "@if (prefixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </span>\n}\n\n<input\n monaTextBox\n role=\"combobox\"\n [class]=\"inputClass()\"\n [disabled]=\"
|
|
607
|
+
}, template: "@if (prefixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </span>\n}\n\n<input\n monaTextBox\n role=\"combobox\"\n [class]=\"inputClass()\"\n [disabled]=\"effectiveDisabled()\"\n [id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [value]=\"autoCompleteValue()\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-autocomplete]=\"'list'\"\n [attr.aria-busy]=\"loading()\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-describedby]=\"ariaDescribedBy() || undefined\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-invalid]=\"invalidState() || undefined\"\n [attr.aria-label]=\"ariaLabel() || undefined\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || undefined\"\n (input)=\"onInput(textInput.value)\"\n #textInput />\n\n@if (clearButtonVisible()) {\n <mona-indicator-icon\n preset=\"clear\"\n [interactive]=\"true\"\n [label]=\"messages().clear\"\n (activate)=\"onValueClear($event)\"></mona-indicator-icon>\n}\n\n@if (loading()) {\n <mona-indicator-icon preset=\"loading\" [size]=\"12\"></mona-indicator-icon>\n}\n\n@if (suffixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"suffixTemplate()\"></ng-container>\n </span>\n}\n\n<ng-template #popupTemplate>\n <div [class]=\"listPopupClass()\" (pointerdown)=\"onPopupPointerDown($event)\">\n <mona-list (itemSelect)=\"onItemSelect($event)\" [focusOnMount]=\"false\" [size]=\"size()\" [listId]=\"listId\">\n @if (footerTemplate()) {\n <ng-template monaListFooterTemplate>\n <ng-container [ngTemplateOutlet]=\"footerTemplate()\"></ng-container>\n </ng-template>\n }\n @if (groupHeaderTemplate()) {\n <ng-template monaListGroupHeaderTemplate let-group>\n <ng-container\n [ngTemplateOutlet]=\"groupHeaderTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: group }\"></ng-container>\n </ng-template>\n }\n @if (headerTemplate()) {\n <ng-template monaListHeaderTemplate>\n <ng-container [ngTemplateOutlet]=\"headerTemplate()\"></ng-container>\n </ng-template>\n }\n @if (itemTemplate()) {\n <ng-template monaListItemTemplate let-dataItem>\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"></ng-container>\n </ng-template>\n }\n @if (noDataTemplate()) {\n <ng-template monaListNoDataTemplate>\n <ng-container [ngTemplateOutlet]=\"noDataTemplate()\"></ng-container>\n </ng-template>\n }\n </mona-list>\n </div>\n</ng-template>\n" }]
|
|
607
608
|
}], ctorParameters: () => [], propDecorators: { footerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownFooterTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], groupHeaderTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownGroupHeaderTemplateDirective), { ...{
|
|
608
609
|
read: TemplateRef
|
|
609
610
|
}, isSignal: true }] }], headerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownHeaderTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], itemTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownItemTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], noDataTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownNoDataTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], popupTemplate: [{ type: i0.ViewChild, args: ["popupTemplate", { isSignal: true }] }], prefixTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownPrefixTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], suffixTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownSuffixTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], ariaDescribedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-describedby", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], close: [{ type: i0.Output, args: ["close"] }], closed: [{ type: i0.Output, args: ["closed"] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], highlightFirst: [{ type: i0.Input, args: [{ isSignal: true, alias: "highlightFirst", required: false }] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], itemDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemDisabled", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], open: [{ type: i0.Output, args: ["open"] }], opened: [{ type: i0.Output, args: ["opened"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], popupClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupClass", required: false }] }], popupHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupHeight", required: false }] }], popupWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupWidth", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], showClearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClearButton", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], textField: [{ type: i0.Input, args: [{ isSignal: true, alias: "textField", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], valueField: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueField", required: false }] }] } });
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { computed, input, Component } from '@angular/core';
|
|
2
|
+
import { linkedSignal, computed, input, Component } from '@angular/core';
|
|
3
3
|
|
|
4
4
|
class AvatarComponent {
|
|
5
5
|
constructor() {
|
|
6
|
+
this.#imageFailed = linkedSignal({ ...(ngDevMode ? { debugName: "#imageFailed" } : /* istanbul ignore next */ {}), source: () => this.image(), computation: () => false });
|
|
6
7
|
this.avatarLabelStyles = computed(() => {
|
|
7
8
|
return {
|
|
8
9
|
alignItems: "center",
|
|
@@ -17,8 +18,7 @@ class AvatarComponent {
|
|
|
17
18
|
}, /* @ts-ignore */
|
|
18
19
|
...(ngDevMode ? [{ debugName: "avatarLabelStyles" }] : /* istanbul ignore next */ []));
|
|
19
20
|
this.avatarStyles = computed(() => {
|
|
20
|
-
const
|
|
21
|
-
const backgroundColor = image ? "transparent" : this.backgroundColor();
|
|
21
|
+
const backgroundColor = this.imageVisible() ? "transparent" : this.backgroundColor();
|
|
22
22
|
return {
|
|
23
23
|
borderColor: this.borderColor(),
|
|
24
24
|
borderWidth: this.borderWidth(),
|
|
@@ -32,6 +32,18 @@ class AvatarComponent {
|
|
|
32
32
|
};
|
|
33
33
|
}, /* @ts-ignore */
|
|
34
34
|
...(ngDevMode ? [{ debugName: "avatarStyles" }] : /* istanbul ignore next */ []));
|
|
35
|
+
this.hostName = computed(() => {
|
|
36
|
+
if (this.imageVisible()) {
|
|
37
|
+
return "";
|
|
38
|
+
}
|
|
39
|
+
// A failed image keeps the name it had, so the fallback doesn't change what's announced.
|
|
40
|
+
return this.image() ? this.imageAlt() : this.ariaLabel();
|
|
41
|
+
}, /* @ts-ignore */
|
|
42
|
+
...(ngDevMode ? [{ debugName: "hostName" }] : /* istanbul ignore next */ []));
|
|
43
|
+
this.imageAlt = computed(() => this.alt() || this.ariaLabel(), /* @ts-ignore */
|
|
44
|
+
...(ngDevMode ? [{ debugName: "imageAlt" }] : /* istanbul ignore next */ []));
|
|
45
|
+
this.imageVisible = computed(() => !!this.image() && !this.#imageFailed(), /* @ts-ignore */
|
|
46
|
+
...(ngDevMode ? [{ debugName: "imageVisible" }] : /* istanbul ignore next */ []));
|
|
35
47
|
/**
|
|
36
48
|
* @description Alternative text for the avatar image. Provide a meaningful description for non-decorative images;
|
|
37
49
|
* an empty string marks the image as decorative.
|
|
@@ -40,8 +52,9 @@ class AvatarComponent {
|
|
|
40
52
|
this.alt = input("", /* @ts-ignore */
|
|
41
53
|
...(ngDevMode ? [{ debugName: "alt" }] : /* istanbul ignore next */ []));
|
|
42
54
|
/**
|
|
43
|
-
* @description Accessible name
|
|
44
|
-
*
|
|
55
|
+
* @description Accessible name of the avatar. Describe who or what it represents.
|
|
56
|
+
* In label and projected-content modes the host takes it with `role="img"`. While an image shows, it's the image's
|
|
57
|
+
* `alt` unless `alt` is set.
|
|
45
58
|
* @default ""
|
|
46
59
|
*/
|
|
47
60
|
this.ariaLabel = input("", { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
|
|
@@ -97,23 +110,23 @@ class AvatarComponent {
|
|
|
97
110
|
return `${value}px`;
|
|
98
111
|
} });
|
|
99
112
|
/**
|
|
100
|
-
* @description Image URL. When non-empty, renders an `<img>` and suppresses `label` and projected content
|
|
113
|
+
* @description Image URL. When non-empty, renders an `<img>` and suppresses `label` and projected content, until it
|
|
114
|
+
* fails to load. Then the avatar falls back to them, and a new URL tries again.
|
|
101
115
|
* @default ""
|
|
102
116
|
*/
|
|
103
|
-
// TODO(owner-review): migrate to NgOptimizedImage once width/height inputs are changed to number-only
|
|
104
117
|
this.image = input("", /* @ts-ignore */
|
|
105
118
|
...(ngDevMode ? [{ debugName: "image" }] : /* istanbul ignore next */ []));
|
|
106
119
|
/**
|
|
107
|
-
* @description Text label displayed inside the avatar when no image
|
|
120
|
+
* @description Text label displayed inside the avatar when there's no image, or the image failed to load.
|
|
108
121
|
* @default ""
|
|
109
122
|
*/
|
|
110
123
|
this.label = input("", /* @ts-ignore */
|
|
111
124
|
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
112
125
|
/**
|
|
113
126
|
* @description Color of the label text. Ignored in image mode.
|
|
114
|
-
* @default "var(--color-foreground)"
|
|
127
|
+
* @default "var(--color-primary-foreground)"
|
|
115
128
|
*/
|
|
116
|
-
this.labelColor = input("var(--color-foreground)", /* @ts-ignore */
|
|
129
|
+
this.labelColor = input("var(--color-primary-foreground)", /* @ts-ignore */
|
|
117
130
|
...(ngDevMode ? [{ debugName: "labelColor" }] : /* istanbul ignore next */ []));
|
|
118
131
|
/**
|
|
119
132
|
* @description Font size of the label text. Ignored in image mode.
|
|
@@ -127,6 +140,11 @@ class AvatarComponent {
|
|
|
127
140
|
*/
|
|
128
141
|
this.labelFontWeight = input("700", /* @ts-ignore */
|
|
129
142
|
...(ngDevMode ? [{ debugName: "labelFontWeight" }] : /* istanbul ignore next */ []));
|
|
143
|
+
/**
|
|
144
|
+
* @description Additional CSS classes applied to the host element.
|
|
145
|
+
* @default ""
|
|
146
|
+
*/
|
|
147
|
+
this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
|
|
130
148
|
/**
|
|
131
149
|
* @description Width of the host element. A string is used as-is; a number is converted to `px`.
|
|
132
150
|
* @default "64px"
|
|
@@ -137,24 +155,23 @@ class AvatarComponent {
|
|
|
137
155
|
}
|
|
138
156
|
return `${value}px`;
|
|
139
157
|
} });
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
|
|
158
|
+
}
|
|
159
|
+
#imageFailed;
|
|
160
|
+
onImageError() {
|
|
161
|
+
this.#imageFailed.set(true);
|
|
145
162
|
}
|
|
146
163
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AvatarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
147
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: AvatarComponent, isStandalone: true, selector: "mona-avatar", inputs: { alt: { classPropertyName: "alt", publicName: "alt", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, backgroundColor: { classPropertyName: "backgroundColor", publicName: "backgroundColor", isSignal: true, isRequired: false, transformFunction: null }, borderColor: { classPropertyName: "borderColor", publicName: "borderColor", isSignal: true, isRequired: false, transformFunction: null }, borderRadius: { classPropertyName: "borderRadius", publicName: "borderRadius", isSignal: true, isRequired: false, transformFunction: null }, borderWidth: { classPropertyName: "borderWidth", publicName: "borderWidth", isSignal: true, isRequired: false, transformFunction: null }, customStyles: { classPropertyName: "customStyles", publicName: "customStyles", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, image: { classPropertyName: "image", publicName: "image", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, labelColor: { classPropertyName: "labelColor", publicName: "labelColor", isSignal: true, isRequired: false, transformFunction: null }, labelFontSize: { classPropertyName: "labelFontSize", publicName: "labelFontSize", isSignal: true, isRequired: false, transformFunction: null }, labelFontWeight: { classPropertyName: "labelFontWeight", publicName: "labelFontWeight", isSignal: true, isRequired: false, transformFunction: null },
|
|
164
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: AvatarComponent, isStandalone: true, selector: "mona-avatar", inputs: { alt: { classPropertyName: "alt", publicName: "alt", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, backgroundColor: { classPropertyName: "backgroundColor", publicName: "backgroundColor", isSignal: true, isRequired: false, transformFunction: null }, borderColor: { classPropertyName: "borderColor", publicName: "borderColor", isSignal: true, isRequired: false, transformFunction: null }, borderRadius: { classPropertyName: "borderRadius", publicName: "borderRadius", isSignal: true, isRequired: false, transformFunction: null }, borderWidth: { classPropertyName: "borderWidth", publicName: "borderWidth", isSignal: true, isRequired: false, transformFunction: null }, customStyles: { classPropertyName: "customStyles", publicName: "customStyles", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, image: { classPropertyName: "image", publicName: "image", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, labelColor: { classPropertyName: "labelColor", publicName: "labelColor", isSignal: true, isRequired: false, transformFunction: null }, labelFontSize: { classPropertyName: "labelFontSize", publicName: "labelFontSize", isSignal: true, isRequired: false, transformFunction: null }, labelFontWeight: { classPropertyName: "labelFontWeight", publicName: "labelFontWeight", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.aria-label": "hostName() || null", "attr.role": "hostName() ? 'img' : null", "class": "userClass()", "style": "avatarStyles()" } }, ngImport: i0, template: "@if (imageVisible()) {\n <img\n loading=\"lazy\"\n decoding=\"async\"\n style=\"display: block; height: 100%; object-fit: cover; width: 100%\"\n [src]=\"image()\"\n [style.border-radius]=\"borderRadius()\"\n [alt]=\"imageAlt()\"\n (error)=\"onImageError()\" />\n} @else if (label()) {\n <div [style]=\"avatarLabelStyles()\">{{ label() }}</div>\n} @else {\n <ng-content></ng-content>\n}\n" }); }
|
|
148
165
|
}
|
|
149
166
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AvatarComponent, decorators: [{
|
|
150
167
|
type: Component,
|
|
151
168
|
args: [{ selector: "mona-avatar", host: {
|
|
152
|
-
"[attr.aria-label]": "
|
|
153
|
-
"[attr.role]": "
|
|
169
|
+
"[attr.aria-label]": "hostName() || null",
|
|
170
|
+
"[attr.role]": "hostName() ? 'img' : null",
|
|
154
171
|
"[class]": "userClass()",
|
|
155
172
|
"[style]": "avatarStyles()"
|
|
156
|
-
}, template: "@if (
|
|
157
|
-
}], propDecorators: { alt: [{ type: i0.Input, args: [{ isSignal: true, alias: "alt", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], backgroundColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "backgroundColor", required: false }] }], borderColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "borderColor", required: false }] }], borderRadius: [{ type: i0.Input, args: [{ isSignal: true, alias: "borderRadius", required: false }] }], borderWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "borderWidth", required: false }] }], customStyles: [{ type: i0.Input, args: [{ isSignal: true, alias: "customStyles", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], image: [{ type: i0.Input, args: [{ isSignal: true, alias: "image", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], labelColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelColor", required: false }] }], labelFontSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelFontSize", required: false }] }], labelFontWeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelFontWeight", required: false }] }],
|
|
173
|
+
}, template: "@if (imageVisible()) {\n <img\n loading=\"lazy\"\n decoding=\"async\"\n style=\"display: block; height: 100%; object-fit: cover; width: 100%\"\n [src]=\"image()\"\n [style.border-radius]=\"borderRadius()\"\n [alt]=\"imageAlt()\"\n (error)=\"onImageError()\" />\n} @else if (label()) {\n <div [style]=\"avatarLabelStyles()\">{{ label() }}</div>\n} @else {\n <ng-content></ng-content>\n}\n" }]
|
|
174
|
+
}], propDecorators: { alt: [{ type: i0.Input, args: [{ isSignal: true, alias: "alt", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], backgroundColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "backgroundColor", required: false }] }], borderColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "borderColor", required: false }] }], borderRadius: [{ type: i0.Input, args: [{ isSignal: true, alias: "borderRadius", required: false }] }], borderWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "borderWidth", required: false }] }], customStyles: [{ type: i0.Input, args: [{ isSignal: true, alias: "customStyles", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], image: [{ type: i0.Input, args: [{ isSignal: true, alias: "image", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], labelColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelColor", required: false }] }], labelFontSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelFontSize", required: false }] }], labelFontWeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelFontWeight", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }] } });
|
|
158
175
|
|
|
159
176
|
/*
|
|
160
177
|
* Public API Surface of @nanahoshi/mona-ui/avatar
|