@nanahoshi/mona-ui 0.29.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 +44 -0
- package/docs/api/locales.md +14 -14
- package/docs/api/qr-code.md +287 -0
- 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/qr-code.md +377 -0
- 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 +32 -0
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +27 -2
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +28 -0
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +14 -0
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +20 -0
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +20 -0
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +14 -0
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +20 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +14 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +14 -0
- package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +24 -0
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +20 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +24 -0
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +14 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +14 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +14 -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-qr-code.mjs +1671 -0
- 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 +16 -0
- package/llms.txt +5 -1
- package/locales/ar-sa/ar-sa.messages.json +16 -0
- package/locales/de-de/de-de.messages.json +16 -0
- package/locales/es-es/es-es.messages.json +16 -0
- package/locales/fr-fr/fr-fr.messages.json +16 -0
- package/locales/id-id/id-id.messages.json +16 -0
- package/locales/it-it/it-it.messages.json +16 -0
- package/locales/ja-jp/ja-jp.messages.json +16 -0
- package/locales/ko-kr/ko-kr.messages.json +16 -0
- package/locales/pl-pl/pl-pl.messages.json +16 -0
- package/locales/pt-br/pt-br.messages.json +16 -0
- package/locales/ru-ru/ru-ru.messages.json +16 -0
- package/locales/tr-tr/tr-tr.messages.json +16 -0
- package/locales/zh-cn/zh-cn.messages.json +16 -0
- package/locales/zh-tw/zh-tw.messages.json +16 -0
- package/package.json +9 -1
- package/qr-code/package.json +4 -0
- 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 +33 -0
- package/types/nanahoshi-mona-ui-internal.d.ts +39 -4
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +16 -0
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +16 -0
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +16 -0
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +16 -0
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +16 -0
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +16 -0
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +16 -0
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +16 -0
- package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +16 -0
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +16 -0
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +16 -0
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +16 -0
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +16 -0
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +16 -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-qr-code.d.ts +322 -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
|
@@ -10,7 +10,7 @@ import { CalendarService, DateInputPrefixTemplateDirective, TimeSelectorService,
|
|
|
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, getLocaleDateTimeInputFormat, injectComponentDirection } 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 { TimeSelectorComponent } from "@nanahoshi/mona-ui/time-selector";
|
|
16
16
|
import { DateTime } from "luxon";
|
|
@@ -98,6 +98,7 @@ var DateTimePickerComponent = class DateTimePickerComponent {
|
|
|
98
98
|
#dropdownService;
|
|
99
99
|
#hostElementRef;
|
|
100
100
|
#i18n;
|
|
101
|
+
#label;
|
|
101
102
|
#timeSelectorService;
|
|
102
103
|
constructor() {
|
|
103
104
|
this.#calendarService = inject(CalendarService);
|
|
@@ -106,6 +107,12 @@ var DateTimePickerComponent = class DateTimePickerComponent {
|
|
|
106
107
|
this.#dropdownService = inject(DropdownService);
|
|
107
108
|
this.#hostElementRef = inject(ElementRef);
|
|
108
109
|
this.#i18n = inject(MonaI18nService);
|
|
110
|
+
this.#label = injectLabelAssociation({
|
|
111
|
+
ariaDescribedBy: () => this.ariaDescribedBy(),
|
|
112
|
+
ariaLabel: () => this.ariaLabel(),
|
|
113
|
+
ariaLabelledBy: () => this.ariaLabelledBy(),
|
|
114
|
+
focus: () => this.focus()
|
|
115
|
+
});
|
|
109
116
|
this.#timeSelectorService = inject(TimeSelectorService);
|
|
110
117
|
this.activeView = signal("date", ...ngDevMode ? [{ debugName: "activeView" }] : /* istanbul ignore next */ []);
|
|
111
118
|
this.baseClass = computed(() => {
|
|
@@ -122,6 +129,7 @@ var DateTimePickerComponent = class DateTimePickerComponent {
|
|
|
122
129
|
}, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
|
|
123
130
|
this.dateTabId = createElementControlId();
|
|
124
131
|
this.decadeCellTemplate = contentChild(CalendarDecadeCellTemplateDirective, ...ngDevMode ? [{ debugName: "decadeCellTemplate" }] : /* istanbul ignore next */ []);
|
|
132
|
+
this.describedBy = this.#label.describedBy;
|
|
125
133
|
this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
|
|
126
134
|
this.effectiveFormat = computed(() => {
|
|
127
135
|
return this.format() ?? getLocaleDateTimeInputFormat(this.#i18n.localeId(), {
|
|
@@ -150,6 +158,7 @@ var DateTimePickerComponent = class DateTimePickerComponent {
|
|
|
150
158
|
}, ...ngDevMode ? [{ debugName: "inputAttributes" }] : /* istanbul ignore next */ []);
|
|
151
159
|
this.invalidState = computed(() => this.typedInput.errors().length > 0 || this.touched() && (this.invalid() || this.required() && !this.value()), ...ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []);
|
|
152
160
|
this.isRtl = computed(() => this.#direction() === "rtl", ...ngDevMode ? [{ debugName: "isRtl" }] : /* istanbul ignore next */ []);
|
|
161
|
+
this.labelledBy = this.#label.labelledBy;
|
|
153
162
|
this.messages = this.#i18n.componentMessages("dateTimePicker", DATETIME_PICKER_DEFAULT_MESSAGES);
|
|
154
163
|
this.monthCellTemplate = contentChild(CalendarMonthCellTemplateDirective, ...ngDevMode ? [{ debugName: "monthCellTemplate" }] : /* istanbul ignore next */ []);
|
|
155
164
|
this.navigatedDate = linkedSignal(() => this.value() ?? /* @__PURE__ */ new Date(), ...ngDevMode ? [{ debugName: "navigatedDate" }] : /* istanbul ignore next */ []);
|
|
@@ -743,7 +752,7 @@ var DateTimePickerComponent = class DateTimePickerComponent {
|
|
|
743
752
|
}],
|
|
744
753
|
hostDirectives: [{ directive: i1.DropdownPopupHandlerDirective }],
|
|
745
754
|
ngImport: i0,
|
|
746
|
-
template: "<mona-text-box\n (inputBlur)=\"onInputBlur()\"\n (valueChange)=\"typedInput.edit($event)\"\n [aria-describedby]=\"
|
|
755
|
+
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 [clearButton]=\"showClearButton()\"\n [disabled]=\"effectiveDisabled()\"\n [inputAttributes]=\"inputAttributes()\"\n [inputId]=\"inputId()\"\n [invalid]=\"invalidState()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [touched]=\"invalidState() || touched()\"\n [value]=\"typedInput.text()\">\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 [size]=\"size()\"\n [rounded]=\"'none'\"\n class=\"aspect-square h-full w-auto\"\n [attr.aria-label]=\"messages().openDateTimePicker\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"popupId\"\n (click)=\"onDateInputButtonClick()\"\n [disabled]=\"effectiveDisabled() || readonly()\"\n [tabindex]=\"-1\">\n <svg lucideCalendar [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </ng-template>\n</mona-text-box>\n\n<ng-template #datePopupTemplate>\n <div\n [class]=\"pickerPopupClass()\"\n [id]=\"popupId\"\n class=\"flex h-68 flex-col\"\n aria-modal=\"true\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().dateTimePicker\"\n cdkTrapFocus>\n <div [class]=\"headerClass()\">\n <div class=\"flex w-full gap-1\" role=\"tablist\" (keydown)=\"onTabKeydown($event)\">\n <button\n monaButton\n type=\"button\"\n role=\"tab\"\n class=\"flex-1\"\n [id]=\"dateTabId\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-selected]=\"activeView() === 'date'\"\n [disabled]=\"effectiveDisabled()\"\n [rounded]=\"rounded()\"\n [selected]=\"activeView() === 'date'\"\n [size]=\"size()\"\n [tabindex]=\"activeView() === 'date' ? 0 : -1\"\n (click)=\"selectTab('date')\">\n {{ messages().date }}\n </button>\n <button\n monaButton\n type=\"button\"\n role=\"tab\"\n class=\"flex-1\"\n [id]=\"timeTabId\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-selected]=\"activeView() === 'time'\"\n [disabled]=\"effectiveDisabled()\"\n [rounded]=\"rounded()\"\n [selected]=\"activeView() === 'time'\"\n [size]=\"size()\"\n [tabindex]=\"activeView() === 'time' ? 0 : -1\"\n (click)=\"selectTab('time')\">\n {{ messages().time }}\n </button>\n </div>\n </div>\n <div\n class=\"overflow-hidden\"\n role=\"tabpanel\"\n [id]=\"panelId\"\n [attr.aria-labelledby]=\"activeView() === 'date' ? dateTabId : timeTabId\">\n @if (activeView() === \"date\") {\n <div class=\"flex h-full items-center justify-center\">\n <mona-calendar\n [focusOnMount]=\"focusViewOnMount()\"\n [disabledDates]=\"disabledDates()\"\n [minDate]=\"min()\"\n [maxDate]=\"max()\"\n [firstDay]=\"firstDay()\"\n [weekNumber]=\"weekNumber()\"\n [value]=\"navigatedDate()\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n [rounded]=\"rounded()\"\n (valueChange)=\"onCalendarValueChange($event)\"\n class=\"flex-1 border-none shadow-none\">\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 }\n @if (activeView() === \"time\") {\n <div class=\"flex h-full max-h-64 items-center justify-center\">\n <mona-time-selector\n [focusOnMount]=\"focusViewOnMount()\"\n [value]=\"navigatedDate()\"\n (valueChange)=\"onTimeSelectorValueChange($event)\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n [max]=\"timePickerMax()\"\n [min]=\"timePickerMin()\"\n [footer]=\"false\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [hourStep]=\"hourStep()\"\n [minuteStep]=\"minuteStep()\"\n [secondStep]=\"secondStep()\"\n [hourFormat]=\"effectiveHourFormat()\"\n [showSeconds]=\"showSeconds()\"></mona-time-selector>\n </div>\n }\n </div>\n <div [class]=\"footerClass()\">\n <button\n monaButton\n look=\"primary\"\n [disabled]=\"effectiveDisabled()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n (click)=\"onSetDateClick()\">\n {{ messages().set }}\n </button>\n <button\n monaButton\n look=\"default\"\n [disabled]=\"effectiveDisabled()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n (click)=\"onCancelClick()\">\n {{ messages().cancel }}\n </button>\n </div>\n </div>\n</ng-template>\n",
|
|
747
756
|
dependencies: [
|
|
748
757
|
{
|
|
749
758
|
kind: "component",
|
|
@@ -897,7 +906,8 @@ var DateTimePickerComponent = class DateTimePickerComponent {
|
|
|
897
906
|
type: TextBoxPrefixTemplateDirective,
|
|
898
907
|
selector: "ng-template[monaTextBoxPrefixTemplate]"
|
|
899
908
|
}
|
|
900
|
-
]
|
|
909
|
+
],
|
|
910
|
+
viewProviders: [...FIELD_ASSOCIATION_BOUNDARY]
|
|
901
911
|
});
|
|
902
912
|
}
|
|
903
913
|
};
|
|
@@ -935,6 +945,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
935
945
|
TextBoxPrefixTemplateDirective
|
|
936
946
|
],
|
|
937
947
|
hostDirectives: [DropdownPopupHandlerDirective],
|
|
948
|
+
viewProviders: [...FIELD_ASSOCIATION_BOUNDARY],
|
|
938
949
|
host: {
|
|
939
950
|
"[attr.aria-describedby]": "null",
|
|
940
951
|
"[attr.aria-label]": "null",
|
|
@@ -950,7 +961,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
950
961
|
"(focusout)": "onFocusOut($event)",
|
|
951
962
|
"(keydown)": "onKeydown($event)"
|
|
952
963
|
},
|
|
953
|
-
template: "<mona-text-box\n (inputBlur)=\"onInputBlur()\"\n (valueChange)=\"typedInput.edit($event)\"\n [aria-describedby]=\"
|
|
964
|
+
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 [clearButton]=\"showClearButton()\"\n [disabled]=\"effectiveDisabled()\"\n [inputAttributes]=\"inputAttributes()\"\n [inputId]=\"inputId()\"\n [invalid]=\"invalidState()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [touched]=\"invalidState() || touched()\"\n [value]=\"typedInput.text()\">\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 [size]=\"size()\"\n [rounded]=\"'none'\"\n class=\"aspect-square h-full w-auto\"\n [attr.aria-label]=\"messages().openDateTimePicker\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"popupId\"\n (click)=\"onDateInputButtonClick()\"\n [disabled]=\"effectiveDisabled() || readonly()\"\n [tabindex]=\"-1\">\n <svg lucideCalendar [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </ng-template>\n</mona-text-box>\n\n<ng-template #datePopupTemplate>\n <div\n [class]=\"pickerPopupClass()\"\n [id]=\"popupId\"\n class=\"flex h-68 flex-col\"\n aria-modal=\"true\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().dateTimePicker\"\n cdkTrapFocus>\n <div [class]=\"headerClass()\">\n <div class=\"flex w-full gap-1\" role=\"tablist\" (keydown)=\"onTabKeydown($event)\">\n <button\n monaButton\n type=\"button\"\n role=\"tab\"\n class=\"flex-1\"\n [id]=\"dateTabId\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-selected]=\"activeView() === 'date'\"\n [disabled]=\"effectiveDisabled()\"\n [rounded]=\"rounded()\"\n [selected]=\"activeView() === 'date'\"\n [size]=\"size()\"\n [tabindex]=\"activeView() === 'date' ? 0 : -1\"\n (click)=\"selectTab('date')\">\n {{ messages().date }}\n </button>\n <button\n monaButton\n type=\"button\"\n role=\"tab\"\n class=\"flex-1\"\n [id]=\"timeTabId\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-selected]=\"activeView() === 'time'\"\n [disabled]=\"effectiveDisabled()\"\n [rounded]=\"rounded()\"\n [selected]=\"activeView() === 'time'\"\n [size]=\"size()\"\n [tabindex]=\"activeView() === 'time' ? 0 : -1\"\n (click)=\"selectTab('time')\">\n {{ messages().time }}\n </button>\n </div>\n </div>\n <div\n class=\"overflow-hidden\"\n role=\"tabpanel\"\n [id]=\"panelId\"\n [attr.aria-labelledby]=\"activeView() === 'date' ? dateTabId : timeTabId\">\n @if (activeView() === \"date\") {\n <div class=\"flex h-full items-center justify-center\">\n <mona-calendar\n [focusOnMount]=\"focusViewOnMount()\"\n [disabledDates]=\"disabledDates()\"\n [minDate]=\"min()\"\n [maxDate]=\"max()\"\n [firstDay]=\"firstDay()\"\n [weekNumber]=\"weekNumber()\"\n [value]=\"navigatedDate()\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n [rounded]=\"rounded()\"\n (valueChange)=\"onCalendarValueChange($event)\"\n class=\"flex-1 border-none shadow-none\">\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 }\n @if (activeView() === \"time\") {\n <div class=\"flex h-full max-h-64 items-center justify-center\">\n <mona-time-selector\n [focusOnMount]=\"focusViewOnMount()\"\n [value]=\"navigatedDate()\"\n (valueChange)=\"onTimeSelectorValueChange($event)\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n [max]=\"timePickerMax()\"\n [min]=\"timePickerMin()\"\n [footer]=\"false\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [hourStep]=\"hourStep()\"\n [minuteStep]=\"minuteStep()\"\n [secondStep]=\"secondStep()\"\n [hourFormat]=\"effectiveHourFormat()\"\n [showSeconds]=\"showSeconds()\"></mona-time-selector>\n </div>\n }\n </div>\n <div [class]=\"footerClass()\">\n <button\n monaButton\n look=\"primary\"\n [disabled]=\"effectiveDisabled()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n (click)=\"onSetDateClick()\">\n {{ messages().set }}\n </button>\n <button\n monaButton\n look=\"default\"\n [disabled]=\"effectiveDisabled()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n (click)=\"onCancelClick()\">\n {{ messages().cancel }}\n </button>\n </div>\n </div>\n</ng-template>\n"
|
|
954
965
|
}]
|
|
955
966
|
}],
|
|
956
967
|
ctorParameters: () => [],
|
|
@@ -4,7 +4,7 @@ import { Component, DestroyRef, Directive, ElementRef, TemplateRef, afterNextRen
|
|
|
4
4
|
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
5
5
|
import * as i1 from "@nanahoshi/mona-ui/dropdowns";
|
|
6
6
|
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";
|
|
7
|
-
import { TYPEAHEAD_RESET_DELAY, createElementControlId, injectEffectiveDisabled, isTypeaheadKey, setupTypeahead, themeControlSurfaceClasses } from "@nanahoshi/mona-ui/internal";
|
|
7
|
+
import { FIELD_ASSOCIATION_BOUNDARY, TYPEAHEAD_RESET_DELAY, createElementControlId, injectEffectiveDisabled, injectLabelAssociation, isTypeaheadKey, setupTypeahead, themeControlSurfaceClasses } from "@nanahoshi/mona-ui/internal";
|
|
8
8
|
import { IndicatorIconComponent } from "@nanahoshi/mona-ui/internal/indicator-icon";
|
|
9
9
|
import { ListComponent, ListFooterTemplateDirective, ListGroupHeaderTemplateDirective, ListHeaderTemplateDirective, ListItemTemplateDirective, ListNoDataTemplateDirective, ListService } from "@nanahoshi/mona-ui/internal/list";
|
|
10
10
|
import { PopupCloseSource } from "@nanahoshi/mona-ui/popup";
|
|
@@ -106,6 +106,7 @@ var DropdownListComponent = class DropdownListComponent {
|
|
|
106
106
|
#dropdownService;
|
|
107
107
|
#hostElementRef;
|
|
108
108
|
#i18n;
|
|
109
|
+
#label;
|
|
109
110
|
#listService;
|
|
110
111
|
#navigatedItem;
|
|
111
112
|
#typeaheadKey;
|
|
@@ -116,6 +117,13 @@ var DropdownListComponent = class DropdownListComponent {
|
|
|
116
117
|
this.#dropdownService = inject(DropdownService);
|
|
117
118
|
this.#hostElementRef = inject(ElementRef);
|
|
118
119
|
this.#i18n = inject(MonaI18nService);
|
|
120
|
+
this.#label = injectLabelAssociation({
|
|
121
|
+
activate: () => this.focus(),
|
|
122
|
+
ariaDescribedBy: () => this.ariaDescribedBy(),
|
|
123
|
+
ariaLabel: () => this.ariaLabel(),
|
|
124
|
+
ariaLabelledBy: () => this.ariaLabelledBy(),
|
|
125
|
+
focus: () => this.focus()
|
|
126
|
+
});
|
|
119
127
|
this.#listService = inject(ListService);
|
|
120
128
|
this.#navigatedItem = linkedSignal(() => this.selectedDataItem(), ...ngDevMode ? [{ debugName: "#navigatedItem" }] : /* istanbul ignore next */ []);
|
|
121
129
|
this.#typeaheadKey = new Subject();
|
|
@@ -146,7 +154,8 @@ var DropdownListComponent = class DropdownListComponent {
|
|
|
146
154
|
return twMerge(classes, userClass);
|
|
147
155
|
}, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
|
|
148
156
|
this.clearButtonVisible = computed(() => this.showClearButton() && this.selectedListItem() != null && !this.loading() && !this.effectiveDisabled() && !this.readonly(), ...ngDevMode ? [{ debugName: "clearButtonVisible" }] : /* istanbul ignore next */ []);
|
|
149
|
-
this.
|
|
157
|
+
this.describedBy = this.#label.describedBy;
|
|
158
|
+
this.effectiveAriaLabel = computed(() => this.ariaLabel() || (this.labelledBy() ? "" : this.placeholder()), ...ngDevMode ? [{ debugName: "effectiveAriaLabel" }] : /* istanbul ignore next */ []);
|
|
150
159
|
this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
|
|
151
160
|
this.expanded = computed(() => this.#dropdownService.popupRef() !== null, ...ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []);
|
|
152
161
|
this.footerTemplate = contentChild(DropdownFooterTemplateDirective, {
|
|
@@ -167,6 +176,7 @@ var DropdownListComponent = class DropdownListComponent {
|
|
|
167
176
|
...ngDevMode ? { debugName: "itemTemplate" } : /* istanbul ignore next */ {},
|
|
168
177
|
read: TemplateRef
|
|
169
178
|
});
|
|
179
|
+
this.labelledBy = this.#label.labelledBy;
|
|
170
180
|
this.listId = createElementControlId();
|
|
171
181
|
this.listPopupClass = computed(() => {
|
|
172
182
|
const rounded = this.rounded();
|
|
@@ -646,13 +656,13 @@ var DropdownListComponent = class DropdownListComponent {
|
|
|
646
656
|
"attr.aria-activedescendant": "activeDescendant()",
|
|
647
657
|
"attr.aria-busy": "loading() ? 'true' : undefined",
|
|
648
658
|
"attr.aria-controls": "listId",
|
|
649
|
-
"attr.aria-describedby": "
|
|
659
|
+
"attr.aria-describedby": "describedBy()",
|
|
650
660
|
"attr.aria-disabled": "effectiveDisabled() ? true : undefined",
|
|
651
661
|
"attr.aria-expanded": "expanded()",
|
|
652
662
|
"attr.aria-haspopup": "'listbox'",
|
|
653
663
|
"attr.aria-invalid": "invalidState() ? true : undefined",
|
|
654
664
|
"attr.aria-label": "effectiveAriaLabel() || null",
|
|
655
|
-
"attr.aria-labelledby": "
|
|
665
|
+
"attr.aria-labelledby": "labelledBy()",
|
|
656
666
|
"attr.aria-readonly": "readonly() ? true : undefined",
|
|
657
667
|
"attr.aria-required": "required() ? true : undefined",
|
|
658
668
|
"attr.data-disabled": "effectiveDisabled() || null",
|
|
@@ -825,7 +835,8 @@ var DropdownListComponent = class DropdownListComponent {
|
|
|
825
835
|
],
|
|
826
836
|
outputs: ["activate"]
|
|
827
837
|
}
|
|
828
|
-
]
|
|
838
|
+
],
|
|
839
|
+
viewProviders: [...FIELD_ASSOCIATION_BOUNDARY]
|
|
829
840
|
});
|
|
830
841
|
}
|
|
831
842
|
};
|
|
@@ -868,17 +879,18 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
868
879
|
ListNoDataTemplateDirective,
|
|
869
880
|
IndicatorIconComponent
|
|
870
881
|
],
|
|
882
|
+
viewProviders: [...FIELD_ASSOCIATION_BOUNDARY],
|
|
871
883
|
host: {
|
|
872
884
|
"[attr.aria-activedescendant]": "activeDescendant()",
|
|
873
885
|
"[attr.aria-busy]": "loading() ? 'true' : undefined",
|
|
874
886
|
"[attr.aria-controls]": "listId",
|
|
875
|
-
"[attr.aria-describedby]": "
|
|
887
|
+
"[attr.aria-describedby]": "describedBy()",
|
|
876
888
|
"[attr.aria-disabled]": "effectiveDisabled() ? true : undefined",
|
|
877
889
|
"[attr.aria-expanded]": "expanded()",
|
|
878
890
|
"[attr.aria-haspopup]": "'listbox'",
|
|
879
891
|
"[attr.aria-invalid]": "invalidState() ? true : undefined",
|
|
880
892
|
"[attr.aria-label]": "effectiveAriaLabel() || null",
|
|
881
|
-
"[attr.aria-labelledby]": "
|
|
893
|
+
"[attr.aria-labelledby]": "labelledBy()",
|
|
882
894
|
"[attr.aria-readonly]": "readonly() ? true : undefined",
|
|
883
895
|
"[attr.aria-required]": "required() ? true : undefined",
|
|
884
896
|
"[attr.data-disabled]": "effectiveDisabled() || null",
|
|
@@ -2,7 +2,7 @@ import * as i0 from "@angular/core";
|
|
|
2
2
|
import { Component, DOCUMENT, DestroyRef, Directive, ElementRef, Injectable, Injector, afterEveryRender, afterNextRender, afterRenderEffect, booleanAttribute, computed, effect, inject, input, model, output, signal, untracked, viewChild } from "@angular/core";
|
|
3
3
|
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
4
4
|
import { MonaI18nService, formatNumber, injectComponentDirection } from "@nanahoshi/mona-ui/i18n";
|
|
5
|
-
import { RovingToolbar, createElementControlId, injectEffectiveDisabled } from "@nanahoshi/mona-ui/internal";
|
|
5
|
+
import { FIELD_ASSOCIATION_BOUNDARY, RovingToolbar, createElementControlId, injectEffectiveDisabled, injectLabelAssociation } from "@nanahoshi/mona-ui/internal";
|
|
6
6
|
import { twMerge } from "tailwind-merge";
|
|
7
7
|
import { ImmutableSet, List, any, range } from "@mirei/ts-collections";
|
|
8
8
|
import { Editor, Extension } from "@tiptap/core";
|
|
@@ -825,6 +825,7 @@ var EditorBasicTextStylesComponent = class EditorBasicTextStylesComponent {
|
|
|
825
825
|
selector: "mona-button-group",
|
|
826
826
|
inputs: [
|
|
827
827
|
"allowEmpty",
|
|
828
|
+
"aria-describedby",
|
|
828
829
|
"aria-label",
|
|
829
830
|
"aria-labelledby",
|
|
830
831
|
"disabled",
|
|
@@ -1103,6 +1104,7 @@ var EditorFontColorComponent = class EditorFontColorComponent {
|
|
|
1103
1104
|
type: ColorPickerComponent,
|
|
1104
1105
|
selector: "mona-color-picker",
|
|
1105
1106
|
inputs: [
|
|
1107
|
+
"aria-describedby",
|
|
1106
1108
|
"aria-label",
|
|
1107
1109
|
"aria-labelledby",
|
|
1108
1110
|
"closeOnSelect",
|
|
@@ -1299,6 +1301,7 @@ var EditorFontHighlightComponent = class EditorFontHighlightComponent {
|
|
|
1299
1301
|
type: ColorPickerComponent,
|
|
1300
1302
|
selector: "mona-color-picker",
|
|
1301
1303
|
inputs: [
|
|
1304
|
+
"aria-describedby",
|
|
1302
1305
|
"aria-label",
|
|
1303
1306
|
"aria-labelledby",
|
|
1304
1307
|
"closeOnSelect",
|
|
@@ -1616,6 +1619,7 @@ var EditorHistoryComponent = class EditorHistoryComponent {
|
|
|
1616
1619
|
selector: "mona-button-group",
|
|
1617
1620
|
inputs: [
|
|
1618
1621
|
"allowEmpty",
|
|
1622
|
+
"aria-describedby",
|
|
1619
1623
|
"aria-label",
|
|
1620
1624
|
"aria-labelledby",
|
|
1621
1625
|
"disabled",
|
|
@@ -2122,6 +2126,7 @@ var EditorIndentComponent = class EditorIndentComponent {
|
|
|
2122
2126
|
selector: "mona-button-group",
|
|
2123
2127
|
inputs: [
|
|
2124
2128
|
"allowEmpty",
|
|
2129
|
+
"aria-describedby",
|
|
2125
2130
|
"aria-label",
|
|
2126
2131
|
"aria-labelledby",
|
|
2127
2132
|
"disabled",
|
|
@@ -2404,6 +2409,7 @@ var EditorLinkComponent = class EditorLinkComponent {
|
|
|
2404
2409
|
selector: "mona-button-group",
|
|
2405
2410
|
inputs: [
|
|
2406
2411
|
"allowEmpty",
|
|
2412
|
+
"aria-describedby",
|
|
2407
2413
|
"aria-label",
|
|
2408
2414
|
"aria-labelledby",
|
|
2409
2415
|
"disabled",
|
|
@@ -2508,6 +2514,7 @@ var EditorListComponent = class EditorListComponent {
|
|
|
2508
2514
|
selector: "mona-button-group",
|
|
2509
2515
|
inputs: [
|
|
2510
2516
|
"allowEmpty",
|
|
2517
|
+
"aria-describedby",
|
|
2511
2518
|
"aria-label",
|
|
2512
2519
|
"aria-labelledby",
|
|
2513
2520
|
"disabled",
|
|
@@ -2853,6 +2860,7 @@ var EditorTableComponent = class EditorTableComponent {
|
|
|
2853
2860
|
selector: "mona-button-group",
|
|
2854
2861
|
inputs: [
|
|
2855
2862
|
"allowEmpty",
|
|
2863
|
+
"aria-describedby",
|
|
2856
2864
|
"aria-label",
|
|
2857
2865
|
"aria-labelledby",
|
|
2858
2866
|
"disabled",
|
|
@@ -3097,6 +3105,7 @@ var EditorTextAlignmentsComponent = class EditorTextAlignmentsComponent {
|
|
|
3097
3105
|
selector: "mona-button-group",
|
|
3098
3106
|
inputs: [
|
|
3099
3107
|
"allowEmpty",
|
|
3108
|
+
"aria-describedby",
|
|
3100
3109
|
"aria-label",
|
|
3101
3110
|
"aria-labelledby",
|
|
3102
3111
|
"disabled",
|
|
@@ -3175,6 +3184,7 @@ var EditorComponent = class EditorComponent {
|
|
|
3175
3184
|
#direction;
|
|
3176
3185
|
#editable;
|
|
3177
3186
|
#i18n;
|
|
3187
|
+
#label;
|
|
3178
3188
|
#rendered;
|
|
3179
3189
|
#toolbar;
|
|
3180
3190
|
#appliedContent;
|
|
@@ -3187,10 +3197,11 @@ var EditorComponent = class EditorComponent {
|
|
|
3187
3197
|
dir: this.#direction(),
|
|
3188
3198
|
role: "textbox"
|
|
3189
3199
|
};
|
|
3190
|
-
const ariaLabelledBy = this.
|
|
3200
|
+
const ariaLabelledBy = this.#label.labelledBy();
|
|
3191
3201
|
if (ariaLabelledBy) attributes["aria-labelledby"] = ariaLabelledBy;
|
|
3192
3202
|
else attributes["aria-label"] = this.ariaLabel() || this.messages().contentLabel;
|
|
3193
|
-
|
|
3203
|
+
const ariaDescribedBy = this.#label.describedBy();
|
|
3204
|
+
if (ariaDescribedBy) attributes["aria-describedby"] = ariaDescribedBy;
|
|
3194
3205
|
if (this.placeholder()) attributes["aria-placeholder"] = this.placeholder();
|
|
3195
3206
|
if (this.effectiveDisabled()) attributes["aria-disabled"] = "true";
|
|
3196
3207
|
if (this.readonly()) attributes["aria-readonly"] = "true";
|
|
@@ -3202,6 +3213,13 @@ var EditorComponent = class EditorComponent {
|
|
|
3202
3213
|
this.#direction = injectComponentDirection();
|
|
3203
3214
|
this.#editable = computed(() => !this.effectiveDisabled() && !this.readonly(), ...ngDevMode ? [{ debugName: "#editable" }] : /* istanbul ignore next */ []);
|
|
3204
3215
|
this.#i18n = inject(MonaI18nService);
|
|
3216
|
+
this.#label = injectLabelAssociation({
|
|
3217
|
+
activate: () => this.focus(),
|
|
3218
|
+
ariaDescribedBy: () => this.ariaDescribedBy(),
|
|
3219
|
+
ariaLabel: () => this.ariaLabel(),
|
|
3220
|
+
ariaLabelledBy: () => this.ariaLabelledBy(),
|
|
3221
|
+
focus: () => this.focus()
|
|
3222
|
+
});
|
|
3205
3223
|
this.#rendered = signal(false, ...ngDevMode ? [{ debugName: "#rendered" }] : /* istanbul ignore next */ []);
|
|
3206
3224
|
this.#toolbar = new RovingToolbar(() => this.toolbarElement()?.nativeElement);
|
|
3207
3225
|
this.#appliedContent = void 0;
|
|
@@ -3618,7 +3636,8 @@ var EditorComponent = class EditorComponent {
|
|
|
3618
3636
|
type: EditorCodeBlockComponent,
|
|
3619
3637
|
selector: "mona-editor-code-block"
|
|
3620
3638
|
}
|
|
3621
|
-
]
|
|
3639
|
+
],
|
|
3640
|
+
viewProviders: [...FIELD_ASSOCIATION_BOUNDARY]
|
|
3622
3641
|
});
|
|
3623
3642
|
}
|
|
3624
3643
|
};
|
|
@@ -3651,6 +3670,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
3651
3670
|
EditorCodeBlockComponent
|
|
3652
3671
|
],
|
|
3653
3672
|
providers: [EditorService],
|
|
3673
|
+
viewProviders: [...FIELD_ASSOCIATION_BOUNDARY],
|
|
3654
3674
|
host: {
|
|
3655
3675
|
"[class]": "baseClass()",
|
|
3656
3676
|
"[attr.aria-describedby]": "null",
|