@nanahoshi/mona-ui 0.30.0 → 0.32.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/date-range-picker/package.json +4 -0
- package/docs/api/button-group.md +1 -0
- package/docs/api/calendar.md +3 -2
- 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/common.md +1 -1
- package/docs/api/date-input.md +1 -1
- package/docs/api/date-range-picker.md +137 -0
- package/docs/api/form-field.md +88 -0
- package/docs/api/i18n.md +84 -0
- package/docs/api/list.md +1 -1
- package/docs/api/locales.md +14 -14
- package/docs/api/popup.md +1 -1
- package/docs/api/segmented.md +1 -0
- package/docs/api/switch.md +1 -0
- package/docs/calendar.md +47 -3
- package/docs/date-picker.md +1 -1
- package/docs/date-range-picker.md +420 -0
- package/docs/dropdown-list.md +1 -1
- package/docs/form-field.md +425 -0
- package/docs/forms.md +13 -4
- package/docs/label.md +5 -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-calendar.mjs +171 -59
- 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 +16 -4
- package/fesm2022/nanahoshi-mona-ui-date-range-picker.mjs +1331 -0
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +16 -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 +50 -0
- package/fesm2022/nanahoshi-mona-ui-i18n.mjs +7 -1
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +27 -2
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +50 -0
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +32 -0
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +38 -0
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +38 -0
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +29 -0
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +38 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +29 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +29 -0
- package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +44 -0
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +38 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +44 -0
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +32 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +29 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +29 -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 +29 -0
- package/llms.txt +5 -1
- package/locales/ar-sa/ar-sa.messages.json +29 -0
- package/locales/de-de/de-de.messages.json +29 -0
- package/locales/es-es/es-es.messages.json +29 -0
- package/locales/fr-fr/fr-fr.messages.json +29 -0
- package/locales/id-id/id-id.messages.json +29 -0
- package/locales/it-it/it-it.messages.json +29 -0
- package/locales/ja-jp/ja-jp.messages.json +29 -0
- package/locales/ko-kr/ko-kr.messages.json +29 -0
- package/locales/pl-pl/pl-pl.messages.json +29 -0
- package/locales/pt-br/pt-br.messages.json +29 -0
- package/locales/ru-ru/ru-ru.messages.json +29 -0
- package/locales/tr-tr/tr-tr.messages.json +29 -0
- package/locales/zh-cn/zh-cn.messages.json +29 -0
- package/locales/zh-tw/zh-tw.messages.json +29 -0
- package/package.json +9 -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-calendar.d.ts +66 -8
- 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-date-range-picker.d.ts +462 -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 +68 -0
- package/types/nanahoshi-mona-ui-internal.d.ts +39 -4
- 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-pl-pl.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 +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
|
@@ -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: () => [],
|
|
@@ -10,7 +10,7 @@ import { CalendarService, DateInputPrefixTemplateDirective, createTypedDateInput
|
|
|
10
10
|
import * as i1 from "@nanahoshi/mona-ui/dropdowns";
|
|
11
11
|
import { DROPDOWN_POPUP_INPUT_TOKEN, DropdownPopupHandlerDirective, DropdownService } from "@nanahoshi/mona-ui/dropdowns";
|
|
12
12
|
import { MonaI18nService, getLocaleDateInputFormat } from "@nanahoshi/mona-ui/i18n";
|
|
13
|
-
import { createElementControlId, injectEffectiveDisabled, themeControlSurfaceClasses } from "@nanahoshi/mona-ui/internal";
|
|
13
|
+
import { FIELD_ASSOCIATION_BOUNDARY, createElementControlId, injectEffectiveDisabled, injectLabelAssociation, themeControlSurfaceClasses } from "@nanahoshi/mona-ui/internal";
|
|
14
14
|
import { TextBoxComponent, TextBoxPrefixTemplateDirective, TextBoxSuffixTemplateDirective } from "@nanahoshi/mona-ui/text-box";
|
|
15
15
|
import { twMerge } from "tailwind-merge";
|
|
16
16
|
import { cva } from "class-variance-authority";
|
|
@@ -75,12 +75,19 @@ var DatePickerComponent = class DatePickerComponent {
|
|
|
75
75
|
#dropdownService;
|
|
76
76
|
#hostElementRef;
|
|
77
77
|
#i18n;
|
|
78
|
+
#label;
|
|
78
79
|
constructor() {
|
|
79
80
|
this.#calendarService = inject(CalendarService);
|
|
80
81
|
this.#destroyRef = inject(DestroyRef);
|
|
81
82
|
this.#dropdownService = inject(DropdownService);
|
|
82
83
|
this.#hostElementRef = inject(ElementRef);
|
|
83
84
|
this.#i18n = inject(MonaI18nService);
|
|
85
|
+
this.#label = injectLabelAssociation({
|
|
86
|
+
ariaDescribedBy: () => this.ariaDescribedBy(),
|
|
87
|
+
ariaLabel: () => this.ariaLabel(),
|
|
88
|
+
ariaLabelledBy: () => this.ariaLabelledBy(),
|
|
89
|
+
focus: () => this.focus()
|
|
90
|
+
});
|
|
84
91
|
this.baseClass = computed(() => {
|
|
85
92
|
const focused = this.#dropdownService.popupRef() != null;
|
|
86
93
|
const rounded = this.rounded();
|
|
@@ -94,6 +101,7 @@ var DatePickerComponent = class DatePickerComponent {
|
|
|
94
101
|
return twMerge(variantClass, userClass);
|
|
95
102
|
}, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
|
|
96
103
|
this.decadeCellTemplate = contentChild(CalendarDecadeCellTemplateDirective, ...ngDevMode ? [{ debugName: "decadeCellTemplate" }] : /* istanbul ignore next */ []);
|
|
104
|
+
this.describedBy = this.#label.describedBy;
|
|
97
105
|
this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
|
|
98
106
|
this.effectiveFormat = computed(() => {
|
|
99
107
|
return this.format() ?? getLocaleDateInputFormat(this.#i18n.localeId());
|
|
@@ -110,6 +118,7 @@ var DatePickerComponent = class DatePickerComponent {
|
|
|
110
118
|
};
|
|
111
119
|
}, ...ngDevMode ? [{ debugName: "inputAttributes" }] : /* istanbul ignore next */ []);
|
|
112
120
|
this.invalidState = computed(() => this.typedInput.errors().length > 0 || this.touched() && (this.invalid() || this.required() && !this.value()), ...ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []);
|
|
121
|
+
this.labelledBy = this.#label.labelledBy;
|
|
113
122
|
this.messages = this.#i18n.componentMessages("datePicker", DATE_PICKER_DEFAULT_MESSAGES);
|
|
114
123
|
this.monthCellTemplate = contentChild(CalendarMonthCellTemplateDirective, ...ngDevMode ? [{ debugName: "monthCellTemplate" }] : /* istanbul ignore next */ []);
|
|
115
124
|
this.pickerPopupClass = computed(() => {
|
|
@@ -568,7 +577,7 @@ var DatePickerComponent = class DatePickerComponent {
|
|
|
568
577
|
}],
|
|
569
578
|
hostDirectives: [{ directive: i1.DropdownPopupHandlerDirective }],
|
|
570
579
|
ngImport: i0,
|
|
571
|
-
template: "<mona-text-box\n (inputBlur)=\"onInputBlur()\"\n (valueChange)=\"typedInput.edit($event)\"\n [aria-describedby]=\"
|
|
580
|
+
template: "<mona-text-box\n (inputBlur)=\"onInputBlur()\"\n (valueChange)=\"typedInput.edit($event)\"\n [aria-describedby]=\"describedBy() ?? ''\"\n [aria-label]=\"ariaLabel()\"\n [aria-labelledby]=\"labelledBy() ?? ''\"\n [disabled]=\"effectiveDisabled()\"\n [inputId]=\"inputId()\"\n [value]=\"typedInput.text()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [inputAttributes]=\"inputAttributes()\"\n [invalid]=\"invalidState()\"\n [required]=\"required()\"\n [clearButton]=\"showClearButton()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [touched]=\"invalidState() || touched()\">\n @if (prefixTemplate()) {\n <ng-template monaTextBoxPrefixTemplate>\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </ng-template>\n }\n <ng-template monaTextBoxSuffixTemplate>\n <button\n monaButton\n look=\"ghost\"\n [iconOnly]=\"true\"\n [rounded]=\"'none'\"\n [size]=\"size()\"\n class=\"aspect-square h-full w-auto\"\n [attr.aria-label]=\"messages().openCalendar\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"popupId\"\n [disabled]=\"effectiveDisabled() || readonly()\"\n [tabindex]=\"-1\"\n (click)=\"onDateInputButtonClick()\">\n <svg lucideCalendar [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </ng-template>\n</mona-text-box>\n\n<ng-template #popupTemplate>\n <div\n [class]=\"pickerPopupClass()\"\n [id]=\"popupId\"\n aria-modal=\"true\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().datePicker\"\n cdkTrapFocus>\n <mona-calendar\n focusOnMount\n [disabledDates]=\"disabledDates()\"\n [minDate]=\"min()\"\n [maxDate]=\"max()\"\n [readonly]=\"readonly()\"\n [rounded]=\"rounded()\"\n [weekNumber]=\"weekNumber()\"\n [firstDay]=\"firstDay()\"\n [value]=\"value()\"\n (valueChange)=\"onCalendarValueChange($event)\">\n @if (decadeCellTemplate()) {\n <ng-template monaCalendarDecadeCellTemplate let-year>\n <ng-container\n [ngTemplateOutlet]=\"decadeCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year }\"></ng-container>\n </ng-template>\n }\n @if (monthCellTemplate()) {\n <ng-template monaCalendarMonthCellTemplate let-day let-date=\"date\">\n <ng-container\n [ngTemplateOutlet]=\"monthCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: day, date }\"></ng-container>\n </ng-template>\n }\n @if (yearCellTemplate()) {\n <ng-template monaCalendarYearCellTemplate let-year let-text=\"text\">\n <ng-container\n [ngTemplateOutlet]=\"yearCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year, text }\"></ng-container>\n </ng-template>\n }\n </mona-calendar>\n </div>\n</ng-template>\n",
|
|
572
581
|
dependencies: [
|
|
573
582
|
{
|
|
574
583
|
kind: "component",
|
|
@@ -587,6 +596,7 @@ var DatePickerComponent = class DatePickerComponent {
|
|
|
587
596
|
"invalid",
|
|
588
597
|
"maxDate",
|
|
589
598
|
"minDate",
|
|
599
|
+
"months",
|
|
590
600
|
"readonly",
|
|
591
601
|
"required",
|
|
592
602
|
"rounded",
|
|
@@ -696,7 +706,8 @@ var DatePickerComponent = class DatePickerComponent {
|
|
|
696
706
|
inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"],
|
|
697
707
|
exportAs: ["cdkTrapFocus"]
|
|
698
708
|
}
|
|
699
|
-
]
|
|
709
|
+
],
|
|
710
|
+
viewProviders: [...FIELD_ASSOCIATION_BOUNDARY]
|
|
700
711
|
});
|
|
701
712
|
}
|
|
702
713
|
};
|
|
@@ -732,6 +743,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
732
743
|
CdkTrapFocus
|
|
733
744
|
],
|
|
734
745
|
hostDirectives: [DropdownPopupHandlerDirective],
|
|
746
|
+
viewProviders: [...FIELD_ASSOCIATION_BOUNDARY],
|
|
735
747
|
host: {
|
|
736
748
|
"[attr.aria-describedby]": "null",
|
|
737
749
|
"[attr.aria-label]": "null",
|
|
@@ -747,7 +759,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
747
759
|
"(focusout)": "onFocusOut($event)",
|
|
748
760
|
"(keydown)": "onKeydown($event)"
|
|
749
761
|
},
|
|
750
|
-
template: "<mona-text-box\n (inputBlur)=\"onInputBlur()\"\n (valueChange)=\"typedInput.edit($event)\"\n [aria-describedby]=\"
|
|
762
|
+
template: "<mona-text-box\n (inputBlur)=\"onInputBlur()\"\n (valueChange)=\"typedInput.edit($event)\"\n [aria-describedby]=\"describedBy() ?? ''\"\n [aria-label]=\"ariaLabel()\"\n [aria-labelledby]=\"labelledBy() ?? ''\"\n [disabled]=\"effectiveDisabled()\"\n [inputId]=\"inputId()\"\n [value]=\"typedInput.text()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [inputAttributes]=\"inputAttributes()\"\n [invalid]=\"invalidState()\"\n [required]=\"required()\"\n [clearButton]=\"showClearButton()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [touched]=\"invalidState() || touched()\">\n @if (prefixTemplate()) {\n <ng-template monaTextBoxPrefixTemplate>\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </ng-template>\n }\n <ng-template monaTextBoxSuffixTemplate>\n <button\n monaButton\n look=\"ghost\"\n [iconOnly]=\"true\"\n [rounded]=\"'none'\"\n [size]=\"size()\"\n class=\"aspect-square h-full w-auto\"\n [attr.aria-label]=\"messages().openCalendar\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"popupId\"\n [disabled]=\"effectiveDisabled() || readonly()\"\n [tabindex]=\"-1\"\n (click)=\"onDateInputButtonClick()\">\n <svg lucideCalendar [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </ng-template>\n</mona-text-box>\n\n<ng-template #popupTemplate>\n <div\n [class]=\"pickerPopupClass()\"\n [id]=\"popupId\"\n aria-modal=\"true\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().datePicker\"\n cdkTrapFocus>\n <mona-calendar\n focusOnMount\n [disabledDates]=\"disabledDates()\"\n [minDate]=\"min()\"\n [maxDate]=\"max()\"\n [readonly]=\"readonly()\"\n [rounded]=\"rounded()\"\n [weekNumber]=\"weekNumber()\"\n [firstDay]=\"firstDay()\"\n [value]=\"value()\"\n (valueChange)=\"onCalendarValueChange($event)\">\n @if (decadeCellTemplate()) {\n <ng-template monaCalendarDecadeCellTemplate let-year>\n <ng-container\n [ngTemplateOutlet]=\"decadeCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year }\"></ng-container>\n </ng-template>\n }\n @if (monthCellTemplate()) {\n <ng-template monaCalendarMonthCellTemplate let-day let-date=\"date\">\n <ng-container\n [ngTemplateOutlet]=\"monthCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: day, date }\"></ng-container>\n </ng-template>\n }\n @if (yearCellTemplate()) {\n <ng-template monaCalendarYearCellTemplate let-year let-text=\"text\">\n <ng-container\n [ngTemplateOutlet]=\"yearCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year, text }\"></ng-container>\n </ng-template>\n }\n </mona-calendar>\n </div>\n</ng-template>\n"
|
|
751
763
|
}]
|
|
752
764
|
}],
|
|
753
765
|
ctorParameters: () => [],
|