@nanahoshi/mona-ui 0.30.0 → 0.31.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/docs/api/button-group.md +1 -0
- package/docs/api/color-gradient.md +1 -0
- package/docs/api/color-palette.md +1 -0
- package/docs/api/color-picker.md +1 -0
- package/docs/api/form-field.md +88 -0
- package/docs/api/i18n.md +31 -0
- package/docs/api/locales.md +14 -14
- package/docs/api/segmented.md +1 -0
- package/docs/api/switch.md +1 -0
- package/docs/dropdown-list.md +1 -1
- package/docs/form-field.md +425 -0
- package/docs/forms.md +12 -4
- package/docs/label.md +4 -5
- package/docs/numeric-textbox.md +1 -1
- package/docs/radio-button.md +2 -1
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +15 -4
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +25 -1
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +5 -2
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +29 -3
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +25 -1
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +31 -3
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +15 -4
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +15 -4
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +15 -4
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +19 -7
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +24 -4
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +1 -0
- package/fesm2022/nanahoshi-mona-ui-form-field.mjs +666 -0
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +31 -0
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +27 -2
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +27 -0
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +13 -0
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +13 -0
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +13 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +13 -0
- package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +23 -0
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +23 -0
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +13 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +13 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +13 -0
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +19 -7
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +14 -5
- package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +6 -3
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +15 -9
- package/fesm2022/nanahoshi-mona-ui-rating.mjs +6 -3
- package/fesm2022/nanahoshi-mona-ui-segmented.mjs +25 -1
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +8 -5
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +25 -1
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +6 -3
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +15 -4
- package/form-field/package.json +4 -0
- package/i18n/catalogs/en-US.messages.json +13 -0
- package/llms.txt +3 -1
- package/locales/ar-sa/ar-sa.messages.json +13 -0
- package/locales/de-de/de-de.messages.json +13 -0
- package/locales/es-es/es-es.messages.json +13 -0
- package/locales/fr-fr/fr-fr.messages.json +13 -0
- package/locales/id-id/id-id.messages.json +13 -0
- package/locales/it-it/it-it.messages.json +13 -0
- package/locales/ja-jp/ja-jp.messages.json +13 -0
- package/locales/ko-kr/ko-kr.messages.json +13 -0
- package/locales/pl-pl/pl-pl.messages.json +13 -0
- package/locales/pt-br/pt-br.messages.json +13 -0
- package/locales/ru-ru/ru-ru.messages.json +13 -0
- package/locales/tr-tr/tr-tr.messages.json +13 -0
- package/locales/zh-cn/zh-cn.messages.json +13 -0
- package/locales/zh-tw/zh-tw.messages.json +13 -0
- package/package.json +5 -1
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +2 -0
- package/types/nanahoshi-mona-ui-button-group.d.ts +11 -0
- package/types/nanahoshi-mona-ui-check-box.d.ts +1 -0
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +11 -0
- package/types/nanahoshi-mona-ui-color-palette.d.ts +11 -0
- package/types/nanahoshi-mona-ui-color-picker.d.ts +11 -0
- package/types/nanahoshi-mona-ui-combo-box.d.ts +2 -0
- package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -0
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +2 -0
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +2 -0
- package/types/nanahoshi-mona-ui-form-field.d.ts +173 -0
- package/types/nanahoshi-mona-ui-i18n.d.ts +29 -0
- package/types/nanahoshi-mona-ui-internal.d.ts +39 -4
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +13 -0
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +13 -0
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +13 -0
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +13 -0
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +13 -0
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +13 -0
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +13 -0
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +13 -0
- package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +13 -0
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +13 -0
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +13 -0
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +13 -0
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +13 -0
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +13 -0
- package/types/nanahoshi-mona-ui-multi-select.d.ts +2 -0
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +2 -0
- package/types/nanahoshi-mona-ui-otp-input.d.ts +1 -0
- package/types/nanahoshi-mona-ui-radio-button.d.ts +2 -0
- package/types/nanahoshi-mona-ui-rating.d.ts +1 -0
- package/types/nanahoshi-mona-ui-segmented.d.ts +11 -0
- package/types/nanahoshi-mona-ui-slider.d.ts +1 -0
- package/types/nanahoshi-mona-ui-switch.d.ts +11 -0
- package/types/nanahoshi-mona-ui-text-box.d.ts +1 -0
- package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -0
|
@@ -2,7 +2,7 @@ import { NgTemplateOutlet } from "@angular/common";
|
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
3
|
import { Component, DestroyRef, ElementRef, TemplateRef, afterNextRender, booleanAttribute, computed, contentChild, effect, forwardRef, inject, input, linkedSignal, model, output, untracked, viewChild } from "@angular/core";
|
|
4
4
|
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
5
|
-
import { createElementControlId, injectEffectiveDisabled, rxTimeout, themeControlSurfaceClasses } from "@nanahoshi/mona-ui/internal";
|
|
5
|
+
import { FIELD_ASSOCIATION_BOUNDARY, createElementControlId, injectEffectiveDisabled, injectLabelAssociation, rxTimeout, themeControlSurfaceClasses } 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 { ListComponent, ListFooterTemplateDirective, ListGroupHeaderTemplateDirective, ListHeaderTemplateDirective, ListItemTemplateDirective, ListNoDataTemplateDirective, ListService } from "@nanahoshi/mona-ui/internal/list";
|
|
@@ -81,6 +81,7 @@ var AutoCompleteComponent = class AutoCompleteComponent {
|
|
|
81
81
|
#dropdownService;
|
|
82
82
|
#hostElementRef;
|
|
83
83
|
#i18n;
|
|
84
|
+
#label;
|
|
84
85
|
#listService;
|
|
85
86
|
#popupRef;
|
|
86
87
|
constructor() {
|
|
@@ -88,6 +89,12 @@ var AutoCompleteComponent = class AutoCompleteComponent {
|
|
|
88
89
|
this.#dropdownService = inject(DropdownService);
|
|
89
90
|
this.#hostElementRef = inject(ElementRef);
|
|
90
91
|
this.#i18n = inject(MonaI18nService);
|
|
92
|
+
this.#label = injectLabelAssociation({
|
|
93
|
+
ariaDescribedBy: () => this.ariaDescribedBy(),
|
|
94
|
+
ariaLabel: () => this.ariaLabel(),
|
|
95
|
+
ariaLabelledBy: () => this.ariaLabelledBy(),
|
|
96
|
+
focus: () => this.focus()
|
|
97
|
+
});
|
|
91
98
|
this.#listService = inject(ListService);
|
|
92
99
|
this.#popupRef = this.#dropdownService.popupRef;
|
|
93
100
|
this.activeDescendant = computed(() => {
|
|
@@ -118,6 +125,7 @@ var AutoCompleteComponent = class AutoCompleteComponent {
|
|
|
118
125
|
return twMerge(variantClass, userClass);
|
|
119
126
|
}, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
|
|
120
127
|
this.clearButtonVisible = computed(() => this.showClearButton() && !!this.autoCompleteValue() && !this.loading() && !this.effectiveDisabled() && !this.readonly(), ...ngDevMode ? [{ debugName: "clearButtonVisible" }] : /* istanbul ignore next */ []);
|
|
128
|
+
this.describedBy = this.#label.describedBy;
|
|
121
129
|
this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
|
|
122
130
|
this.expanded = computed(() => this.#popupRef() !== null, ...ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []);
|
|
123
131
|
this.footerTemplate = contentChild(DropdownFooterTemplateDirective, {
|
|
@@ -142,6 +150,7 @@ var AutoCompleteComponent = class AutoCompleteComponent {
|
|
|
142
150
|
...ngDevMode ? { debugName: "itemTemplate" } : /* istanbul ignore next */ {},
|
|
143
151
|
read: TemplateRef
|
|
144
152
|
});
|
|
153
|
+
this.labelledBy = this.#label.labelledBy;
|
|
145
154
|
this.listId = createElementControlId();
|
|
146
155
|
this.listPopupClass = computed(() => {
|
|
147
156
|
const rounded = this.rounded();
|
|
@@ -685,7 +694,7 @@ var AutoCompleteComponent = class AutoCompleteComponent {
|
|
|
685
694
|
{ directive: i1.DropdownLiveRegionDirective }
|
|
686
695
|
],
|
|
687
696
|
ngImport: i0,
|
|
688
|
-
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]=\"
|
|
697
|
+
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]=\"describedBy()\"\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]=\"labelledBy()\"\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",
|
|
689
698
|
dependencies: [
|
|
690
699
|
{
|
|
691
700
|
kind: "directive",
|
|
@@ -773,7 +782,8 @@ var AutoCompleteComponent = class AutoCompleteComponent {
|
|
|
773
782
|
],
|
|
774
783
|
outputs: ["activate"]
|
|
775
784
|
}
|
|
776
|
-
]
|
|
785
|
+
],
|
|
786
|
+
viewProviders: [...FIELD_ASSOCIATION_BOUNDARY]
|
|
777
787
|
});
|
|
778
788
|
}
|
|
779
789
|
};
|
|
@@ -816,6 +826,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
816
826
|
ListItemTemplateDirective,
|
|
817
827
|
IndicatorIconComponent
|
|
818
828
|
],
|
|
829
|
+
viewProviders: [...FIELD_ASSOCIATION_BOUNDARY],
|
|
819
830
|
host: {
|
|
820
831
|
"[attr.aria-describedby]": "null",
|
|
821
832
|
"[attr.aria-label]": "null",
|
|
@@ -827,7 +838,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
827
838
|
"[class]": "baseClass()",
|
|
828
839
|
"(focusout)": "onFocusOut($event)"
|
|
829
840
|
},
|
|
830
|
-
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]=\"
|
|
841
|
+
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]=\"describedBy()\"\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]=\"labelledBy()\"\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"
|
|
831
842
|
}]
|
|
832
843
|
}],
|
|
833
844
|
ctorParameters: () => [],
|
|
@@ -97,8 +97,10 @@ var ButtonGroupComponent = class ButtonGroupComponent {
|
|
|
97
97
|
this.#i18n = inject(MonaI18nService);
|
|
98
98
|
this.#label = injectLabelAssociation({
|
|
99
99
|
activate: () => this.focus(),
|
|
100
|
+
ariaDescribedBy: () => this.ariaDescribedBy(),
|
|
100
101
|
ariaLabel: () => this.ariaLabel(),
|
|
101
|
-
ariaLabelledBy: () => this.ariaLabelledBy()
|
|
102
|
+
ariaLabelledBy: () => this.ariaLabelledBy(),
|
|
103
|
+
focus: () => this.focus()
|
|
102
104
|
});
|
|
103
105
|
this.#lastSelected = [];
|
|
104
106
|
this.baseClass = computed(() => {
|
|
@@ -115,6 +117,7 @@ var ButtonGroupComponent = class ButtonGroupComponent {
|
|
|
115
117
|
}, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
|
|
116
118
|
this.buttons = contentChildren(ButtonDirective, ...ngDevMode ? [{ debugName: "buttons" }] : /* istanbul ignore next */ []);
|
|
117
119
|
this.components = contentChildren(BUTTON_GROUP_MEMBER, ...ngDevMode ? [{ debugName: "components" }] : /* istanbul ignore next */ []);
|
|
120
|
+
this.describedBy = this.#label.describedBy;
|
|
118
121
|
this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
|
|
119
122
|
this.invalidState = computed(() => this.touched() && this.invalid(), ...ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []);
|
|
120
123
|
this.labelledBy = this.#label.labelledBy;
|
|
@@ -124,6 +127,10 @@ var ButtonGroupComponent = class ButtonGroupComponent {
|
|
|
124
127
|
...ngDevMode ? { debugName: "allowEmpty" } : /* istanbul ignore next */ {},
|
|
125
128
|
transform: booleanAttribute
|
|
126
129
|
});
|
|
130
|
+
this.ariaDescribedBy = input("", {
|
|
131
|
+
...ngDevMode ? { debugName: "ariaDescribedBy" } : /* istanbul ignore next */ {},
|
|
132
|
+
alias: "aria-describedby"
|
|
133
|
+
});
|
|
127
134
|
this.ariaLabel = input(void 0, {
|
|
128
135
|
...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
|
|
129
136
|
alias: "aria-label"
|
|
@@ -288,6 +295,13 @@ var ButtonGroupComponent = class ButtonGroupComponent {
|
|
|
288
295
|
isRequired: false,
|
|
289
296
|
transformFunction: null
|
|
290
297
|
},
|
|
298
|
+
ariaDescribedBy: {
|
|
299
|
+
classPropertyName: "ariaDescribedBy",
|
|
300
|
+
publicName: "aria-describedby",
|
|
301
|
+
isSignal: true,
|
|
302
|
+
isRequired: false,
|
|
303
|
+
transformFunction: null
|
|
304
|
+
},
|
|
291
305
|
ariaLabel: {
|
|
292
306
|
classPropertyName: "ariaLabel",
|
|
293
307
|
publicName: "aria-label",
|
|
@@ -383,6 +397,7 @@ var ButtonGroupComponent = class ButtonGroupComponent {
|
|
|
383
397
|
listeners: { "focusout": "onFocusOut($event)" },
|
|
384
398
|
properties: {
|
|
385
399
|
"attr.aria-invalid": "invalidState() ? 'true' : null",
|
|
400
|
+
"attr.aria-describedby": "describedBy()",
|
|
386
401
|
"attr.aria-label": "labelledBy() ? null : ariaLabel() || messages().buttonGroup",
|
|
387
402
|
"attr.aria-labelledby": "labelledBy()",
|
|
388
403
|
"attr.data-invalid": "invalidState() || null",
|
|
@@ -417,6 +432,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
417
432
|
providers: [ButtonService],
|
|
418
433
|
host: {
|
|
419
434
|
"[attr.aria-invalid]": "invalidState() ? 'true' : null",
|
|
435
|
+
"[attr.aria-describedby]": "describedBy()",
|
|
420
436
|
"[attr.aria-label]": "labelledBy() ? null : ariaLabel() || messages().buttonGroup",
|
|
421
437
|
"[attr.aria-labelledby]": "labelledBy()",
|
|
422
438
|
"[attr.data-invalid]": "invalidState() || null",
|
|
@@ -446,6 +462,14 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
446
462
|
required: false
|
|
447
463
|
}]
|
|
448
464
|
}],
|
|
465
|
+
ariaDescribedBy: [{
|
|
466
|
+
type: i0.Input,
|
|
467
|
+
args: [{
|
|
468
|
+
isSignal: true,
|
|
469
|
+
alias: "aria-describedby",
|
|
470
|
+
required: false
|
|
471
|
+
}]
|
|
472
|
+
}],
|
|
449
473
|
ariaLabel: [{
|
|
450
474
|
type: i0.Input,
|
|
451
475
|
args: [{
|
|
@@ -106,8 +106,10 @@ const checkboxDirectiveThemeVariants = cva(`
|
|
|
106
106
|
var CheckBoxComponent = class CheckBoxComponent {
|
|
107
107
|
constructor() {
|
|
108
108
|
this.#label = injectLabelAssociation({
|
|
109
|
+
ariaDescribedBy: () => this.ariaDescribedBy(),
|
|
109
110
|
ariaLabel: () => this.ariaLabel(),
|
|
110
111
|
ariaLabelledBy: () => this.ariaLabelledBy(),
|
|
112
|
+
focus: () => this.focus(),
|
|
111
113
|
wrapped: false
|
|
112
114
|
});
|
|
113
115
|
this.checkBoxClasses = computed(() => {
|
|
@@ -123,6 +125,7 @@ var CheckBoxComponent = class CheckBoxComponent {
|
|
|
123
125
|
const variantClasses = checkboxContainerLabelThemeVariants({ labelSize });
|
|
124
126
|
return twMerge(variantClasses, classes);
|
|
125
127
|
}, ...ngDevMode ? [{ debugName: "containerLabelClasses" }] : /* istanbul ignore next */ []);
|
|
128
|
+
this.describedBy = this.#label.describedBy;
|
|
126
129
|
this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
|
|
127
130
|
this.indeterminateState = linkedSignal(() => this.indeterminate(), ...ngDevMode ? [{ debugName: "indeterminateState" }] : /* istanbul ignore next */ []);
|
|
128
131
|
this.inputRef = viewChild.required("checkBox", ...ngDevMode ? [{ debugName: "inputRef" }] : /* istanbul ignore next */ []);
|
|
@@ -382,7 +385,7 @@ var CheckBoxComponent = class CheckBoxComponent {
|
|
|
382
385
|
isSignal: true
|
|
383
386
|
}],
|
|
384
387
|
ngImport: i0,
|
|
385
|
-
template: "<label\n [class]=\"containerLabelClasses()\"\n [attr.data-disabled]=\"effectiveDisabled()\"\n [attr.data-readonly]=\"readonly() || null\">\n @if (labelPosition() === \"before\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n\n <input\n type=\"checkbox\"\n [id]=\"inputId()\"\n [name]=\"name()\"\n [disabled]=\"effectiveDisabled()\"\n [indeterminate]=\"indeterminateState()\"\n [required]=\"required()\"\n [checked]=\"checked()\"\n [tabindex]=\"effectiveDisabled() ? -1 : tabIndex()\"\n [class]=\"checkBoxClasses()\"\n [attr.aria-checked]=\"indeterminateState() ? 'mixed' : null\"\n [attr.aria-invalid]=\"invalidState() ? 'true' : null\"\n [attr.aria-label]=\"ariaLabel() || label() || null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-describedby]=\"
|
|
388
|
+
template: "<label\n [class]=\"containerLabelClasses()\"\n [attr.data-disabled]=\"effectiveDisabled()\"\n [attr.data-readonly]=\"readonly() || null\">\n @if (labelPosition() === \"before\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n\n <input\n type=\"checkbox\"\n [id]=\"inputId()\"\n [name]=\"name()\"\n [disabled]=\"effectiveDisabled()\"\n [indeterminate]=\"indeterminateState()\"\n [required]=\"required()\"\n [checked]=\"checked()\"\n [tabindex]=\"effectiveDisabled() ? -1 : tabIndex()\"\n [class]=\"checkBoxClasses()\"\n [attr.aria-checked]=\"indeterminateState() ? 'mixed' : null\"\n [attr.aria-invalid]=\"invalidState() ? 'true' : null\"\n [attr.aria-label]=\"ariaLabel() || label() || null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-describedby]=\"describedBy()\"\n [attr.aria-readonly]=\"readonly() ? 'true' : null\"\n (click)=\"onInputClick($event)\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onInputBlur($event)\"\n (focus)=\"inputFocus.emit($event)\"\n #checkBox />\n\n <span [class]=\"checkMarkClasses()\" [attr.data-invalid]=\"invalidState() || null\" aria-hidden=\"true\">\n @if (checked() && !indeterminateState()) {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"lucide lucide-check stroke-primary-foreground forced-colors:stroke-[CanvasText]\">\n <path d=\"M18 6 9 17l-5-5\" />\n </svg>\n }\n </span>\n @if (labelPosition() === \"after\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n</label>\n\n<ng-template #labelTemplate>\n @if (label()) {\n <span>{{ label() }}</span>\n } @else {\n <ng-content></ng-content>\n }\n</ng-template>\n",
|
|
386
389
|
dependencies: [{
|
|
387
390
|
kind: "directive",
|
|
388
391
|
type: NgTemplateOutlet,
|
|
@@ -416,7 +419,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
416
419
|
"[attr.data-disabled]": "effectiveDisabled()",
|
|
417
420
|
"[attr.data-indeterminate]": "indeterminateState()"
|
|
418
421
|
},
|
|
419
|
-
template: "<label\n [class]=\"containerLabelClasses()\"\n [attr.data-disabled]=\"effectiveDisabled()\"\n [attr.data-readonly]=\"readonly() || null\">\n @if (labelPosition() === \"before\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n\n <input\n type=\"checkbox\"\n [id]=\"inputId()\"\n [name]=\"name()\"\n [disabled]=\"effectiveDisabled()\"\n [indeterminate]=\"indeterminateState()\"\n [required]=\"required()\"\n [checked]=\"checked()\"\n [tabindex]=\"effectiveDisabled() ? -1 : tabIndex()\"\n [class]=\"checkBoxClasses()\"\n [attr.aria-checked]=\"indeterminateState() ? 'mixed' : null\"\n [attr.aria-invalid]=\"invalidState() ? 'true' : null\"\n [attr.aria-label]=\"ariaLabel() || label() || null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-describedby]=\"
|
|
422
|
+
template: "<label\n [class]=\"containerLabelClasses()\"\n [attr.data-disabled]=\"effectiveDisabled()\"\n [attr.data-readonly]=\"readonly() || null\">\n @if (labelPosition() === \"before\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n\n <input\n type=\"checkbox\"\n [id]=\"inputId()\"\n [name]=\"name()\"\n [disabled]=\"effectiveDisabled()\"\n [indeterminate]=\"indeterminateState()\"\n [required]=\"required()\"\n [checked]=\"checked()\"\n [tabindex]=\"effectiveDisabled() ? -1 : tabIndex()\"\n [class]=\"checkBoxClasses()\"\n [attr.aria-checked]=\"indeterminateState() ? 'mixed' : null\"\n [attr.aria-invalid]=\"invalidState() ? 'true' : null\"\n [attr.aria-label]=\"ariaLabel() || label() || null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-describedby]=\"describedBy()\"\n [attr.aria-readonly]=\"readonly() ? 'true' : null\"\n (click)=\"onInputClick($event)\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onInputBlur($event)\"\n (focus)=\"inputFocus.emit($event)\"\n #checkBox />\n\n <span [class]=\"checkMarkClasses()\" [attr.data-invalid]=\"invalidState() || null\" aria-hidden=\"true\">\n @if (checked() && !indeterminateState()) {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"lucide lucide-check stroke-primary-foreground forced-colors:stroke-[CanvasText]\">\n <path d=\"M18 6 9 17l-5-5\" />\n </svg>\n }\n </span>\n @if (labelPosition() === \"after\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n</label>\n\n<ng-template #labelTemplate>\n @if (label()) {\n <span>{{ label() }}</span>\n } @else {\n <ng-content></ng-content>\n }\n</ng-template>\n"
|
|
420
423
|
}]
|
|
421
424
|
}],
|
|
422
425
|
propDecorators: {
|
|
@@ -6,7 +6,7 @@ import { Component, DOCUMENT, DestroyRef, ElementRef, afterNextRender, booleanAt
|
|
|
6
6
|
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
7
7
|
import { LucideChevronsUpDown, LucideCopy, LucideDropletOff } from "@lucide/angular";
|
|
8
8
|
import { ButtonDirective } from "@nanahoshi/mona-ui/button";
|
|
9
|
-
import { formatAlpha, hex2rgba, hsva2rgba, injectEffectiveDisabled, injectLabelAssociation, isValidHex, parseColor, rgba2hex, rgba2hsla, rgba2hsva } from "@nanahoshi/mona-ui/internal";
|
|
9
|
+
import { FIELD_ASSOCIATION_BOUNDARY, formatAlpha, hex2rgba, hsva2rgba, injectEffectiveDisabled, injectLabelAssociation, isValidHex, parseColor, rgba2hex, rgba2hsla, rgba2hsva } from "@nanahoshi/mona-ui/internal";
|
|
10
10
|
import { DropdownButtonComponent, DropdownButtonItemComponent, DropdownButtonTextTemplateDirective } from "@nanahoshi/mona-ui/dropdown-button";
|
|
11
11
|
import { NumericTextBoxComponent, NumericTextBoxPrefixTemplateDirective } from "@nanahoshi/mona-ui/numeric-text-box";
|
|
12
12
|
import { SliderComponent } from "@nanahoshi/mona-ui/slider";
|
|
@@ -134,8 +134,10 @@ var ColorGradientComponent = class ColorGradientComponent {
|
|
|
134
134
|
this.#i18n = inject(MonaI18nService);
|
|
135
135
|
this.#label = injectLabelAssociation({
|
|
136
136
|
activate: () => this.focus(),
|
|
137
|
+
ariaDescribedBy: () => this.ariaDescribedBy(),
|
|
137
138
|
ariaLabel: () => this.ariaLabel(),
|
|
138
|
-
ariaLabelledBy: () => this.ariaLabelledBy()
|
|
139
|
+
ariaLabelledBy: () => this.ariaLabelledBy(),
|
|
140
|
+
focus: () => this.focus()
|
|
139
141
|
});
|
|
140
142
|
this.#viewReady = signal(false, ...ngDevMode ? [{ debugName: "#viewReady" }] : /* istanbul ignore next */ []);
|
|
141
143
|
this.#edited = false;
|
|
@@ -184,6 +186,7 @@ var ColorGradientComponent = class ColorGradientComponent {
|
|
|
184
186
|
title: this.messages().previousColor,
|
|
185
187
|
onClick: () => this.onResetColorClick()
|
|
186
188
|
}], ...ngDevMode ? [{ debugName: "colorPreviews" }] : /* istanbul ignore next */ []);
|
|
189
|
+
this.describedBy = this.#label.describedBy;
|
|
187
190
|
this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
|
|
188
191
|
this.hex = computed(() => {
|
|
189
192
|
const rgb = this.rgb();
|
|
@@ -227,6 +230,10 @@ var ColorGradientComponent = class ColorGradientComponent {
|
|
|
227
230
|
}, ...ngDevMode ? [{ debugName: "sliderHandleClasses" }] : /* istanbul ignore next */ []);
|
|
228
231
|
this.sliderHeight = 10;
|
|
229
232
|
this.apply = output();
|
|
233
|
+
this.ariaDescribedBy = input("", {
|
|
234
|
+
...ngDevMode ? { debugName: "ariaDescribedBy" } : /* istanbul ignore next */ {},
|
|
235
|
+
alias: "aria-describedby"
|
|
236
|
+
});
|
|
230
237
|
this.ariaLabel = input("", {
|
|
231
238
|
...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
|
|
232
239
|
alias: "aria-label"
|
|
@@ -712,6 +719,13 @@ var ColorGradientComponent = class ColorGradientComponent {
|
|
|
712
719
|
isStandalone: true,
|
|
713
720
|
selector: "mona-color-gradient",
|
|
714
721
|
inputs: {
|
|
722
|
+
ariaDescribedBy: {
|
|
723
|
+
classPropertyName: "ariaDescribedBy",
|
|
724
|
+
publicName: "aria-describedby",
|
|
725
|
+
isSignal: true,
|
|
726
|
+
isRequired: false,
|
|
727
|
+
transformFunction: null
|
|
728
|
+
},
|
|
715
729
|
ariaLabel: {
|
|
716
730
|
classPropertyName: "ariaLabel",
|
|
717
731
|
publicName: "aria-label",
|
|
@@ -825,6 +839,7 @@ var ColorGradientComponent = class ColorGradientComponent {
|
|
|
825
839
|
"attr.data-readonly": "readonly() || null",
|
|
826
840
|
"attr.data-invalid": "invalidState() || null",
|
|
827
841
|
"attr.role": "'group'",
|
|
842
|
+
"attr.aria-describedby": "describedBy()",
|
|
828
843
|
"attr.aria-label": "labelledBy() ? null : ariaLabel() || messages().colorGradient",
|
|
829
844
|
"attr.aria-labelledby": "labelledBy()",
|
|
830
845
|
"attr.aria-invalid": "invalidState() ? 'true' : null"
|
|
@@ -996,7 +1011,8 @@ var ColorGradientComponent = class ColorGradientComponent {
|
|
|
996
1011
|
type: LucideCopy,
|
|
997
1012
|
selector: "svg[lucideCopy]"
|
|
998
1013
|
}
|
|
999
|
-
]
|
|
1014
|
+
],
|
|
1015
|
+
viewProviders: [...FIELD_ASSOCIATION_BOUNDARY]
|
|
1000
1016
|
});
|
|
1001
1017
|
}
|
|
1002
1018
|
};
|
|
@@ -1025,6 +1041,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
1025
1041
|
DropdownButtonTextTemplateDirective,
|
|
1026
1042
|
LucideCopy
|
|
1027
1043
|
],
|
|
1044
|
+
viewProviders: [...FIELD_ASSOCIATION_BOUNDARY],
|
|
1028
1045
|
host: {
|
|
1029
1046
|
"[class]": "baseClasses()",
|
|
1030
1047
|
"[attr.data-disabled]": "effectiveDisabled()",
|
|
@@ -1032,6 +1049,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
1032
1049
|
"(focusout)": "onFocusOut($event)",
|
|
1033
1050
|
"[attr.data-invalid]": "invalidState() || null",
|
|
1034
1051
|
"[attr.role]": "'group'",
|
|
1052
|
+
"[attr.aria-describedby]": "describedBy()",
|
|
1035
1053
|
"[attr.aria-label]": "labelledBy() ? null : ariaLabel() || messages().colorGradient",
|
|
1036
1054
|
"[attr.aria-labelledby]": "labelledBy()",
|
|
1037
1055
|
"[attr.aria-invalid]": "invalidState() ? 'true' : null"
|
|
@@ -1053,6 +1071,14 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
1053
1071
|
type: i0.Output,
|
|
1054
1072
|
args: ["apply"]
|
|
1055
1073
|
}],
|
|
1074
|
+
ariaDescribedBy: [{
|
|
1075
|
+
type: i0.Input,
|
|
1076
|
+
args: [{
|
|
1077
|
+
isSignal: true,
|
|
1078
|
+
alias: "aria-describedby",
|
|
1079
|
+
required: false
|
|
1080
|
+
}]
|
|
1081
|
+
}],
|
|
1056
1082
|
ariaLabel: [{
|
|
1057
1083
|
type: i0.Input,
|
|
1058
1084
|
args: [{
|
|
@@ -672,8 +672,10 @@ var ColorPaletteComponent = class ColorPaletteComponent {
|
|
|
672
672
|
this.#i18n = inject(MonaI18nService);
|
|
673
673
|
this.#label = injectLabelAssociation({
|
|
674
674
|
activate: () => this.focus(),
|
|
675
|
+
ariaDescribedBy: () => this.ariaDescribedBy(),
|
|
675
676
|
ariaLabel: () => this.ariaLabel(),
|
|
676
|
-
ariaLabelledBy: () => this.ariaLabelledBy()
|
|
677
|
+
ariaLabelledBy: () => this.ariaLabelledBy(),
|
|
678
|
+
focus: () => this.focus()
|
|
677
679
|
});
|
|
678
680
|
this.activeColorIndex = computed(() => {
|
|
679
681
|
const focused = this.focusedColorIndex();
|
|
@@ -689,6 +691,7 @@ var ColorPaletteComponent = class ColorPaletteComponent {
|
|
|
689
691
|
for (let i = 0; i < tiles.length; i += columns) rows.push(tiles.slice(i, i + columns));
|
|
690
692
|
return rows;
|
|
691
693
|
}, ...ngDevMode ? [{ debugName: "colorRows" }] : /* istanbul ignore next */ []);
|
|
694
|
+
this.describedBy = this.#label.describedBy;
|
|
692
695
|
this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
|
|
693
696
|
this.focusedColorIndex = signal(-1, ...ngDevMode ? [{ debugName: "focusedColorIndex" }] : /* istanbul ignore next */ []);
|
|
694
697
|
this.grid = computed(() => {
|
|
@@ -722,6 +725,10 @@ var ColorPaletteComponent = class ColorPaletteComponent {
|
|
|
722
725
|
return this.tileKeys().indexOf(key);
|
|
723
726
|
}, ...ngDevMode ? [{ debugName: "selectedIndex" }] : /* istanbul ignore next */ []);
|
|
724
727
|
this.tileKeys = computed(() => this.grid().tiles.map((tile) => colorKey(tile.color, this.#document)), ...ngDevMode ? [{ debugName: "tileKeys" }] : /* istanbul ignore next */ []);
|
|
728
|
+
this.ariaDescribedBy = input("", {
|
|
729
|
+
...ngDevMode ? { debugName: "ariaDescribedBy" } : /* istanbul ignore next */ {},
|
|
730
|
+
alias: "aria-describedby"
|
|
731
|
+
});
|
|
725
732
|
this.ariaLabel = input("", {
|
|
726
733
|
...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
|
|
727
734
|
alias: "aria-label"
|
|
@@ -875,6 +882,13 @@ var ColorPaletteComponent = class ColorPaletteComponent {
|
|
|
875
882
|
isStandalone: true,
|
|
876
883
|
selector: "mona-color-palette",
|
|
877
884
|
inputs: {
|
|
885
|
+
ariaDescribedBy: {
|
|
886
|
+
classPropertyName: "ariaDescribedBy",
|
|
887
|
+
publicName: "aria-describedby",
|
|
888
|
+
isSignal: true,
|
|
889
|
+
isRequired: false,
|
|
890
|
+
transformFunction: null
|
|
891
|
+
},
|
|
878
892
|
ariaLabel: {
|
|
879
893
|
classPropertyName: "ariaLabel",
|
|
880
894
|
publicName: "aria-label",
|
|
@@ -983,6 +997,7 @@ var ColorPaletteComponent = class ColorPaletteComponent {
|
|
|
983
997
|
"attr.data-readonly": "readonly()",
|
|
984
998
|
"attr.data-required": "required() || null",
|
|
985
999
|
"attr.role": "'grid'",
|
|
1000
|
+
"attr.aria-describedby": "describedBy()",
|
|
986
1001
|
"attr.aria-label": "labelledBy() ? null : ariaLabel() || messages().colorPalette",
|
|
987
1002
|
"attr.aria-labelledby": "labelledBy()",
|
|
988
1003
|
"attr.aria-disabled": "effectiveDisabled()",
|
|
@@ -1015,6 +1030,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
1015
1030
|
"(focusout)": "onFocusOut($event)",
|
|
1016
1031
|
"[attr.data-required]": "required() || null",
|
|
1017
1032
|
"[attr.role]": "'grid'",
|
|
1033
|
+
"[attr.aria-describedby]": "describedBy()",
|
|
1018
1034
|
"[attr.aria-label]": "labelledBy() ? null : ariaLabel() || messages().colorPalette",
|
|
1019
1035
|
"[attr.aria-labelledby]": "labelledBy()",
|
|
1020
1036
|
"[attr.aria-disabled]": "effectiveDisabled()",
|
|
@@ -1026,6 +1042,14 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
1026
1042
|
}]
|
|
1027
1043
|
}],
|
|
1028
1044
|
propDecorators: {
|
|
1045
|
+
ariaDescribedBy: [{
|
|
1046
|
+
type: i0.Input,
|
|
1047
|
+
args: [{
|
|
1048
|
+
isSignal: true,
|
|
1049
|
+
alias: "aria-describedby",
|
|
1050
|
+
required: false
|
|
1051
|
+
}]
|
|
1052
|
+
}],
|
|
1029
1053
|
ariaLabel: [{
|
|
1030
1054
|
type: i0.Input,
|
|
1031
1055
|
args: [{
|
|
@@ -6,7 +6,7 @@ import { LucideCircleX, LucideDropletOff } from "@lucide/angular";
|
|
|
6
6
|
import { ButtonDirective } from "@nanahoshi/mona-ui/button";
|
|
7
7
|
import { ColorGradientComponent } from "@nanahoshi/mona-ui/color-gradient";
|
|
8
8
|
import { ColorPaletteComponent } from "@nanahoshi/mona-ui/color-palette";
|
|
9
|
-
import { colorKey, createElementControlId, injectEffectiveDisabled, injectLabelAssociation, themeControlSurfaceClasses, themeOverlaySurfaceClasses } from "@nanahoshi/mona-ui/internal";
|
|
9
|
+
import { FIELD_ASSOCIATION_BOUNDARY, colorKey, createElementControlId, injectEffectiveDisabled, injectLabelAssociation, themeControlSurfaceClasses, themeOverlaySurfaceClasses } from "@nanahoshi/mona-ui/internal";
|
|
10
10
|
import { IndicatorIconComponent } from "@nanahoshi/mona-ui/internal/indicator-icon";
|
|
11
11
|
import { MonaI18nService } from "@nanahoshi/mona-ui/i18n";
|
|
12
12
|
import { PopupService, dropdownPopupAnimation } from "@nanahoshi/mona-ui/popup";
|
|
@@ -140,8 +140,10 @@ var ColorPickerComponent = class ColorPickerComponent {
|
|
|
140
140
|
this.#i18n = inject(MonaI18nService);
|
|
141
141
|
this.#label = injectLabelAssociation({
|
|
142
142
|
activate: () => this.focus(),
|
|
143
|
+
ariaDescribedBy: () => this.ariaDescribedBy(),
|
|
143
144
|
ariaLabel: () => this.ariaLabel(),
|
|
144
|
-
ariaLabelledBy: () => this.ariaLabelledBy()
|
|
145
|
+
ariaLabelledBy: () => this.ariaLabelledBy(),
|
|
146
|
+
focus: () => this.focus()
|
|
145
147
|
});
|
|
146
148
|
this.#paletteItems = computed(() => {
|
|
147
149
|
const palette = this.palette();
|
|
@@ -168,6 +170,7 @@ var ColorPickerComponent = class ColorPickerComponent {
|
|
|
168
170
|
size
|
|
169
171
|
});
|
|
170
172
|
}, ...ngDevMode ? [{ debugName: "colorClasses" }] : /* istanbul ignore next */ []);
|
|
173
|
+
this.describedBy = this.#label.describedBy;
|
|
171
174
|
this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
|
|
172
175
|
this.expanded = computed(() => this.#popupRef() !== null, ...ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []);
|
|
173
176
|
this.gradientPopupClasses = `${themeOverlaySurfaceClasses} border border-border shadow-(--shadow-overlay) outline-none focus-visible:outline-hidden`;
|
|
@@ -192,6 +195,10 @@ var ColorPickerComponent = class ColorPickerComponent {
|
|
|
192
195
|
for (const item of this.#paletteItems()) if (typeof item !== "string" && item.name && colorKey(item.color, this.#document) === key) return item.name;
|
|
193
196
|
return value;
|
|
194
197
|
}, ...ngDevMode ? [{ debugName: "valueText" }] : /* istanbul ignore next */ []);
|
|
198
|
+
this.ariaDescribedBy = input("", {
|
|
199
|
+
...ngDevMode ? { debugName: "ariaDescribedBy" } : /* istanbul ignore next */ {},
|
|
200
|
+
alias: "aria-describedby"
|
|
201
|
+
});
|
|
195
202
|
this.ariaLabel = input("", {
|
|
196
203
|
...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
|
|
197
204
|
alias: "aria-label"
|
|
@@ -388,6 +395,13 @@ var ColorPickerComponent = class ColorPickerComponent {
|
|
|
388
395
|
isStandalone: true,
|
|
389
396
|
selector: "mona-color-picker",
|
|
390
397
|
inputs: {
|
|
398
|
+
ariaDescribedBy: {
|
|
399
|
+
classPropertyName: "ariaDescribedBy",
|
|
400
|
+
publicName: "aria-describedby",
|
|
401
|
+
isSignal: true,
|
|
402
|
+
isRequired: false,
|
|
403
|
+
transformFunction: null
|
|
404
|
+
},
|
|
391
405
|
ariaLabel: {
|
|
392
406
|
classPropertyName: "ariaLabel",
|
|
393
407
|
publicName: "aria-label",
|
|
@@ -538,6 +552,7 @@ var ColorPickerComponent = class ColorPickerComponent {
|
|
|
538
552
|
"attr.aria-controls": "expanded() ? popupId : null",
|
|
539
553
|
"attr.aria-expanded": "expanded() ? 'true' : 'false'",
|
|
540
554
|
"attr.aria-haspopup": "'dialog'",
|
|
555
|
+
"attr.aria-describedby": "describedBy()",
|
|
541
556
|
"attr.aria-label": "labelledBy() ? null : ariaLabel() || messages().colorPicker",
|
|
542
557
|
"attr.aria-labelledby": "labelledBy()",
|
|
543
558
|
"attr.aria-disabled": "effectiveDisabled()",
|
|
@@ -594,6 +609,7 @@ var ColorPickerComponent = class ColorPickerComponent {
|
|
|
594
609
|
type: ColorPaletteComponent,
|
|
595
610
|
selector: "mona-color-palette",
|
|
596
611
|
inputs: [
|
|
612
|
+
"aria-describedby",
|
|
597
613
|
"aria-label",
|
|
598
614
|
"aria-labelledby",
|
|
599
615
|
"clearable",
|
|
@@ -619,6 +635,7 @@ var ColorPickerComponent = class ColorPickerComponent {
|
|
|
619
635
|
type: ColorGradientComponent,
|
|
620
636
|
selector: "mona-color-gradient",
|
|
621
637
|
inputs: [
|
|
638
|
+
"aria-describedby",
|
|
622
639
|
"aria-label",
|
|
623
640
|
"aria-labelledby",
|
|
624
641
|
"disabled",
|
|
@@ -670,7 +687,8 @@ var ColorPickerComponent = class ColorPickerComponent {
|
|
|
670
687
|
],
|
|
671
688
|
outputs: ["activate"]
|
|
672
689
|
}
|
|
673
|
-
]
|
|
690
|
+
],
|
|
691
|
+
viewProviders: [...FIELD_ASSOCIATION_BOUNDARY]
|
|
674
692
|
});
|
|
675
693
|
}
|
|
676
694
|
};
|
|
@@ -692,6 +710,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
692
710
|
LucideCircleX,
|
|
693
711
|
IndicatorIconComponent
|
|
694
712
|
],
|
|
713
|
+
viewProviders: [...FIELD_ASSOCIATION_BOUNDARY],
|
|
695
714
|
host: {
|
|
696
715
|
"[class]": "baseClasses()",
|
|
697
716
|
"[attr.tabindex]": "effectiveDisabled() ? -1 : 0",
|
|
@@ -704,6 +723,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
704
723
|
"[attr.aria-controls]": "expanded() ? popupId : null",
|
|
705
724
|
"[attr.aria-expanded]": "expanded() ? 'true' : 'false'",
|
|
706
725
|
"[attr.aria-haspopup]": "'dialog'",
|
|
726
|
+
"[attr.aria-describedby]": "describedBy()",
|
|
707
727
|
"[attr.aria-label]": "labelledBy() ? null : ariaLabel() || messages().colorPicker",
|
|
708
728
|
"[attr.aria-labelledby]": "labelledBy()",
|
|
709
729
|
"[attr.aria-disabled]": "effectiveDisabled()",
|
|
@@ -727,6 +747,14 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
727
747
|
isSignal: true
|
|
728
748
|
}]
|
|
729
749
|
}],
|
|
750
|
+
ariaDescribedBy: [{
|
|
751
|
+
type: i0.Input,
|
|
752
|
+
args: [{
|
|
753
|
+
isSignal: true,
|
|
754
|
+
alias: "aria-describedby",
|
|
755
|
+
required: false
|
|
756
|
+
}]
|
|
757
|
+
}],
|
|
730
758
|
ariaLabel: [{
|
|
731
759
|
type: i0.Input,
|
|
732
760
|
args: [{
|
|
@@ -5,7 +5,7 @@ import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
|
5
5
|
import { FilterChangeEvent } from "@nanahoshi/mona-ui/common";
|
|
6
6
|
import * as i1 from "@nanahoshi/mona-ui/dropdowns";
|
|
7
7
|
import { DROPDOWN_DATA_INPUT_TOKEN, DROPDOWN_POPUP_INPUT_TOKEN, DropdownDataHandlerDirective, DropdownFooterTemplateDirective, DropdownGroupHeaderTemplateDirective, DropdownHeaderTemplateDirective, DropdownItemTemplateDirective, DropdownListPopupHandlerDirective, DropdownListService, DropdownLiveRegionDirective, DropdownNoDataTemplateDirective, DropdownPrefixTemplateDirective, DropdownService, dropdownPopupThemeVariants } from "@nanahoshi/mona-ui/dropdowns";
|
|
8
|
-
import { createElementControlId, injectEffectiveDisabled, themeControlSurfaceClasses } from "@nanahoshi/mona-ui/internal";
|
|
8
|
+
import { FIELD_ASSOCIATION_BOUNDARY, createElementControlId, injectEffectiveDisabled, injectLabelAssociation, themeControlSurfaceClasses } from "@nanahoshi/mona-ui/internal";
|
|
9
9
|
import { IndicatorIconComponent } from "@nanahoshi/mona-ui/internal/indicator-icon";
|
|
10
10
|
import { ListComponent, ListFooterTemplateDirective, ListGroupHeaderTemplateDirective, ListHeaderTemplateDirective, ListItemTemplateDirective, ListNoDataTemplateDirective, ListService } from "@nanahoshi/mona-ui/internal/list";
|
|
11
11
|
import { TextBoxDirective } from "@nanahoshi/mona-ui/text-box";
|
|
@@ -79,6 +79,7 @@ var ComboBoxComponent = class ComboBoxComponent {
|
|
|
79
79
|
#dropdownService;
|
|
80
80
|
#hostElementRef;
|
|
81
81
|
#i18n;
|
|
82
|
+
#label;
|
|
82
83
|
#listService;
|
|
83
84
|
#popupRef;
|
|
84
85
|
#userNavigatedViaArrows;
|
|
@@ -88,6 +89,12 @@ var ComboBoxComponent = class ComboBoxComponent {
|
|
|
88
89
|
this.#dropdownService = inject(DropdownService);
|
|
89
90
|
this.#hostElementRef = inject(ElementRef);
|
|
90
91
|
this.#i18n = inject(MonaI18nService);
|
|
92
|
+
this.#label = injectLabelAssociation({
|
|
93
|
+
ariaDescribedBy: () => this.ariaDescribedBy(),
|
|
94
|
+
ariaLabel: () => this.ariaLabel(),
|
|
95
|
+
ariaLabelledBy: () => this.ariaLabelledBy(),
|
|
96
|
+
focus: () => this.focus()
|
|
97
|
+
});
|
|
91
98
|
this.#listService = inject(ListService);
|
|
92
99
|
this.#popupRef = this.#dropdownService.popupRef;
|
|
93
100
|
this.#userNavigatedViaArrows = signal(false, ...ngDevMode ? [{ debugName: "#userNavigatedViaArrows" }] : /* istanbul ignore next */ []);
|
|
@@ -117,6 +124,7 @@ var ComboBoxComponent = class ComboBoxComponent {
|
|
|
117
124
|
this.clearButtonVisible = computed(() => this.showClearButton() && this.selectedListItem() != null && !this.loading() && !this.effectiveDisabled() && !this.readonly(), ...ngDevMode ? [{ debugName: "clearButtonVisible" }] : /* istanbul ignore next */ []);
|
|
118
125
|
this.comboBoxValue = signal("", ...ngDevMode ? [{ debugName: "comboBoxValue" }] : /* istanbul ignore next */ []);
|
|
119
126
|
this.comboBoxValue$ = new Subject();
|
|
127
|
+
this.describedBy = this.#label.describedBy;
|
|
120
128
|
this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
|
|
121
129
|
this.expanded = computed(() => this.#popupRef() !== null, ...ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []);
|
|
122
130
|
this.footerTemplate = contentChild(DropdownFooterTemplateDirective, {
|
|
@@ -140,6 +148,7 @@ var ComboBoxComponent = class ComboBoxComponent {
|
|
|
140
148
|
...ngDevMode ? { debugName: "itemTemplate" } : /* istanbul ignore next */ {},
|
|
141
149
|
read: TemplateRef
|
|
142
150
|
});
|
|
151
|
+
this.labelledBy = this.#label.labelledBy;
|
|
143
152
|
this.listId = createElementControlId();
|
|
144
153
|
this.listPopupClass = computed(() => {
|
|
145
154
|
const rounded = this.rounded();
|
|
@@ -772,7 +781,7 @@ var ComboBoxComponent = class ComboBoxComponent {
|
|
|
772
781
|
{ directive: i1.DropdownLiveRegionDirective }
|
|
773
782
|
],
|
|
774
783
|
ngImport: i0,
|
|
775
|
-
template: "@if (prefixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </span>\n}\n\n<input\n monaTextBox\n [class]=\"inputClass()\"\n [disabled]=\"effectiveDisabled()\"\n [id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [value]=\"comboBoxValue()\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-autocomplete]=\"'list'\"\n [attr.aria-busy]=\"loading()\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-describedby]=\"
|
|
784
|
+
template: "@if (prefixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </span>\n}\n\n<input\n monaTextBox\n [class]=\"inputClass()\"\n [disabled]=\"effectiveDisabled()\"\n [id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [value]=\"comboBoxValue()\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-autocomplete]=\"'list'\"\n [attr.aria-busy]=\"loading()\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-describedby]=\"describedBy()\"\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]=\"labelledBy()\"\n role=\"combobox\"\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<mona-indicator-icon preset=\"dropdown\" [size]=\"18\"></mona-indicator-icon>\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",
|
|
776
785
|
dependencies: [
|
|
777
786
|
{
|
|
778
787
|
kind: "directive",
|
|
@@ -860,7 +869,8 @@ var ComboBoxComponent = class ComboBoxComponent {
|
|
|
860
869
|
],
|
|
861
870
|
outputs: ["activate"]
|
|
862
871
|
}
|
|
863
|
-
]
|
|
872
|
+
],
|
|
873
|
+
viewProviders: [...FIELD_ASSOCIATION_BOUNDARY]
|
|
864
874
|
});
|
|
865
875
|
}
|
|
866
876
|
};
|
|
@@ -904,6 +914,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
904
914
|
DropdownListPopupHandlerDirective,
|
|
905
915
|
DropdownLiveRegionDirective
|
|
906
916
|
],
|
|
917
|
+
viewProviders: [...FIELD_ASSOCIATION_BOUNDARY],
|
|
907
918
|
host: {
|
|
908
919
|
"[attr.aria-describedby]": "null",
|
|
909
920
|
"[attr.aria-label]": "null",
|
|
@@ -916,7 +927,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
916
927
|
"(focusout)": "onFocusOut($event)",
|
|
917
928
|
"(pointerdown)": "onHostPointerDown($event)"
|
|
918
929
|
},
|
|
919
|
-
template: "@if (prefixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </span>\n}\n\n<input\n monaTextBox\n [class]=\"inputClass()\"\n [disabled]=\"effectiveDisabled()\"\n [id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [value]=\"comboBoxValue()\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-autocomplete]=\"'list'\"\n [attr.aria-busy]=\"loading()\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-describedby]=\"
|
|
930
|
+
template: "@if (prefixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </span>\n}\n\n<input\n monaTextBox\n [class]=\"inputClass()\"\n [disabled]=\"effectiveDisabled()\"\n [id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [value]=\"comboBoxValue()\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-autocomplete]=\"'list'\"\n [attr.aria-busy]=\"loading()\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-describedby]=\"describedBy()\"\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]=\"labelledBy()\"\n role=\"combobox\"\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<mona-indicator-icon preset=\"dropdown\" [size]=\"18\"></mona-indicator-icon>\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"
|
|
920
931
|
}]
|
|
921
932
|
}],
|
|
922
933
|
ctorParameters: () => [],
|