@nanahoshi/mona-ui 0.39.0 → 0.39.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -43,7 +43,7 @@ Component.
|
|
|
43
43
|
|
|
44
44
|
| Signature | Description |
|
|
45
45
|
| --- | --- |
|
|
46
|
-
| `focus(options?: FocusOptions): void` | Moves focus to the
|
|
46
|
+
| `focus(options?: FocusOptions): void` | Moves focus to the list that had it last, the hour list at first. |
|
|
47
47
|
|
|
48
48
|
## `TIME_SELECTOR_DEFAULT_MESSAGES`
|
|
49
49
|
|
package/docs/datetime-picker.md
CHANGED
|
@@ -145,9 +145,10 @@ The popup button has `tabindex="-1"`, so the picker is one Tab stop. Keyboard us
|
|
|
145
145
|
| `Alt+ArrowRight` / `Alt+ArrowLeft` | Input, calendar or time selector | Shows the Time or Date view (swapped in right-to-left layouts) |
|
|
146
146
|
| `ArrowRight` / `ArrowLeft`, `Home` / `End` | Tabs | Selects and focuses the Date or Time tab (arrows swapped in right-to-left layouts) |
|
|
147
147
|
| `Enter` | Input | Writes the typed text to `value` |
|
|
148
|
+
| `Tab` / `Shift+Tab` | Time view | Moves through the Now button, each time selector list and the Set and Cancel buttons, then back to the Time tab |
|
|
148
149
|
| `Enter` | Time selector | Sets the chosen date and time and closes the popup |
|
|
149
150
|
|
|
150
|
-
Inside the panel, the calendar's and the time selector's own keyboard maps apply. Closing the popup returns focus to the input, unless the user moved focus elsewhere.
|
|
151
|
+
Inside the panel, the calendar's and the time selector's own keyboard maps apply. Each list in the time selector is a Tab stop, so keyboard users can reach every list that scrolls, and the arrow keys act on the list that has focus; the [Time Picker](time-picker.md) page lists its keys. Closing the popup returns focus to the input, unless the user moved focus elsewhere.
|
|
151
152
|
|
|
152
153
|
## API
|
|
153
154
|
|
package/docs/time-picker.md
CHANGED
|
@@ -116,6 +116,8 @@ The input is a `role="combobox"` with `aria-haspopup="dialog"`, `aria-autocomple
|
|
|
116
116
|
|
|
117
117
|
The popup button has `tabindex="-1"`, so the picker is one Tab stop. Keyboard users open the popup with `Alt+ArrowDown`.
|
|
118
118
|
|
|
119
|
+
Inside the popup, each list in the time selector is a listbox of its own and a Tab stop, as each part of a native time input is, so keyboard users can reach every list that scrolls. `Tab` moves from the Now button through the Hours, Minutes, Seconds and AM/PM lists to the Set button. The arrow keys act on the list that has focus, whether `Tab`, a click or `ArrowLeft` / `ArrowRight` put it there.
|
|
120
|
+
|
|
119
121
|
**Consumer responsibilities**
|
|
120
122
|
|
|
121
123
|
- Label the picker. Point a `<label for>` or `<mona-label for>` at `inputId`, or set `aria-labelledby` or `aria-label`. The placeholder is not a label.
|
|
@@ -129,6 +131,7 @@ The popup button has `tabindex="-1"`, so the picker is one Tab stop. Keyboard us
|
|
|
129
131
|
| `Alt+ArrowUp` | Input | Closes the popup |
|
|
130
132
|
| `Escape` | Input or popup | Closes the popup |
|
|
131
133
|
| `Enter` | Input | Writes the typed text to `value` |
|
|
134
|
+
| `Tab` / `Shift+Tab` | Popup | Moves through the Now button, each time selector list and the Set button, wrapping around at the ends |
|
|
132
135
|
| `ArrowUp` / `ArrowDown` | Time selector list | Moves to the previous or next item |
|
|
133
136
|
| `ArrowLeft` / `ArrowRight` | Time selector list | Moves to the list on that side, also in right-to-left layouts, wrapping around at the ends |
|
|
134
137
|
| `Home` / `End` | Time selector list | Moves to the first or last item |
|
|
@@ -219,7 +219,6 @@ var TimeSelectorListDirective = class TimeSelectorListDirective {
|
|
|
219
219
|
const itemHeight = this.#itemHeight();
|
|
220
220
|
return this.popupHeight() / 2 - itemHeight / 2;
|
|
221
221
|
}, ...ngDevMode ? [{ debugName: "listPadding" }] : /* istanbul ignore next */ []);
|
|
222
|
-
this.active = input.required(...ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []);
|
|
223
222
|
this.popupHeight = input.required(...ngDevMode ? [{ debugName: "popupHeight" }] : /* istanbul ignore next */ []);
|
|
224
223
|
this.size = input.required(...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
225
224
|
}
|
|
@@ -242,13 +241,6 @@ var TimeSelectorListDirective = class TimeSelectorListDirective {
|
|
|
242
241
|
isStandalone: true,
|
|
243
242
|
selector: "ol[monaTimeSelectorList]",
|
|
244
243
|
inputs: {
|
|
245
|
-
active: {
|
|
246
|
-
classPropertyName: "active",
|
|
247
|
-
publicName: "active",
|
|
248
|
-
isSignal: true,
|
|
249
|
-
isRequired: true,
|
|
250
|
-
transformFunction: null
|
|
251
|
-
},
|
|
252
244
|
popupHeight: {
|
|
253
245
|
classPropertyName: "popupHeight",
|
|
254
246
|
publicName: "popupHeight",
|
|
@@ -265,12 +257,14 @@ var TimeSelectorListDirective = class TimeSelectorListDirective {
|
|
|
265
257
|
}
|
|
266
258
|
},
|
|
267
259
|
host: {
|
|
268
|
-
attributes: {
|
|
260
|
+
attributes: {
|
|
261
|
+
"role": "listbox",
|
|
262
|
+
"tabindex": "0"
|
|
263
|
+
},
|
|
269
264
|
properties: {
|
|
270
265
|
"class": "baseClass()",
|
|
271
266
|
"style.padding-top.px": "listPadding()",
|
|
272
|
-
"style.padding-bottom.px": "listPadding()"
|
|
273
|
-
"attr.tabindex": "active() ? 0 : -1"
|
|
267
|
+
"style.padding-bottom.px": "listPadding()"
|
|
274
268
|
}
|
|
275
269
|
},
|
|
276
270
|
ngImport: i0
|
|
@@ -288,22 +282,14 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
288
282
|
selector: "ol[monaTimeSelectorList]",
|
|
289
283
|
host: {
|
|
290
284
|
role: "listbox",
|
|
285
|
+
tabindex: "0",
|
|
291
286
|
"[class]": "baseClass()",
|
|
292
287
|
"[style.padding-top.px]": "listPadding()",
|
|
293
|
-
"[style.padding-bottom.px]": "listPadding()"
|
|
294
|
-
"[attr.tabindex]": "active() ? 0 : -1"
|
|
288
|
+
"[style.padding-bottom.px]": "listPadding()"
|
|
295
289
|
}
|
|
296
290
|
}]
|
|
297
291
|
}],
|
|
298
292
|
propDecorators: {
|
|
299
|
-
active: [{
|
|
300
|
-
type: i0.Input,
|
|
301
|
-
args: [{
|
|
302
|
-
isSignal: true,
|
|
303
|
-
alias: "active",
|
|
304
|
-
required: true
|
|
305
|
-
}]
|
|
306
|
-
}],
|
|
307
293
|
popupHeight: [{
|
|
308
294
|
type: i0.Input,
|
|
309
295
|
args: [{
|
|
@@ -513,6 +499,9 @@ var TimeSelectorComponent = class TimeSelectorComponent {
|
|
|
513
499
|
if (this.effectiveDisabled() || this.readonly()) return;
|
|
514
500
|
this.navigateTo(this.navigatedDate().set({ hour }));
|
|
515
501
|
}
|
|
502
|
+
onListFocus(listType) {
|
|
503
|
+
this.focusedList.set(listType);
|
|
504
|
+
}
|
|
516
505
|
onMeridiemClick(meridiem) {
|
|
517
506
|
if (this.effectiveDisabled() || this.readonly()) return;
|
|
518
507
|
if (this.meridiem() === meridiem) return;
|
|
@@ -894,7 +883,7 @@ var TimeSelectorComponent = class TimeSelectorComponent {
|
|
|
894
883
|
}
|
|
895
884
|
],
|
|
896
885
|
ngImport: i0,
|
|
897
|
-
template: "<div [class]=\"headerClass()\">\n <div>{{ messages().headerHours }}</div>\n <div>{{ messages().headerMinutes }}</div>\n @if (showSeconds()) {\n <div>{{ messages().headerSeconds }}</div>\n }\n</div>\n\n<div [class]=\"infoContainerClass()\">\n <span>{{ navigatedDateText() }}</span>\n <button monaButton look=\"ghost\" [rounded]=\"rounded()\" [size]=\"'small'\" (click)=\"onNowClick()\">\n {{ messages().now }}\n </button>\n</div>\n\n<div [class]=\"listContainerClass()\">\n <ol\n #hourList\n monaTimeSelectorList\n [attr.aria-label]=\"messages().hours\"\n [attr.aria-activedescendant]=\"activeOptionId(hourListId, hourOptions(), navigatedDate().hour)\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-required]=\"required() || null\"\n
|
|
886
|
+
template: "<div [class]=\"headerClass()\">\n <div>{{ messages().headerHours }}</div>\n <div>{{ messages().headerMinutes }}</div>\n @if (showSeconds()) {\n <div>{{ messages().headerSeconds }}</div>\n }\n</div>\n\n<div [class]=\"infoContainerClass()\">\n <span>{{ navigatedDateText() }}</span>\n <button monaButton look=\"ghost\" [rounded]=\"rounded()\" [size]=\"'small'\" (click)=\"onNowClick()\">\n {{ messages().now }}\n </button>\n</div>\n\n<div [class]=\"listContainerClass()\">\n <ol\n #hourList\n monaTimeSelectorList\n [attr.aria-label]=\"messages().hours\"\n [attr.aria-activedescendant]=\"activeOptionId(hourListId, hourOptions(), navigatedDate().hour)\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-required]=\"required() || null\"\n (focus)=\"onListFocus('hours')\"\n [id]=\"hourListId\"\n [popupHeight]=\"computedPopupHeight()\"\n [size]=\"size()\">\n @for (h of hourOptions(); track h.value) {\n <li\n monaTimeSelectorItem\n [size]=\"size()\"\n [selected]=\"h.viewValue === hour()\"\n [value]=\"h.value\"\n [id]=\"`${hourListId}${h.value}`\"\n (click)=\"onHourChange(h.value)\">\n {{ formatTwoDigit(h.viewValue) }}\n </li>\n }\n </ol>\n <ol\n #minuteList\n monaTimeSelectorList\n [attr.aria-label]=\"messages().minutes\"\n [attr.aria-activedescendant]=\"activeOptionId(minuteListId, minuteOptions(), minute())\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-required]=\"required() || null\"\n (focus)=\"onListFocus('minutes')\"\n [id]=\"minuteListId\"\n [popupHeight]=\"computedPopupHeight()\"\n [size]=\"size()\">\n @for (m of minuteOptions(); track m.value) {\n <li\n monaTimeSelectorItem\n [size]=\"size()\"\n [selected]=\"m.value === minute()\"\n [value]=\"m.value\"\n [id]=\"`${minuteListId}${m.value}`\"\n (click)=\"onMinuteChange(m.value)\">\n {{ formatTwoDigit(m.viewValue) }}\n </li>\n }\n </ol>\n @if (showSeconds()) {\n <ol\n #secondList\n monaTimeSelectorList\n [attr.aria-label]=\"messages().seconds\"\n [attr.aria-activedescendant]=\"activeOptionId(secondListId, secondOptions(), second())\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-required]=\"required() || null\"\n (focus)=\"onListFocus('seconds')\"\n [id]=\"secondListId\"\n [popupHeight]=\"computedPopupHeight()\"\n [size]=\"size()\">\n @for (s of secondOptions(); track s.value) {\n <li\n monaTimeSelectorItem\n [size]=\"size()\"\n [selected]=\"s.value === second()\"\n [value]=\"s.value\"\n [id]=\"`${secondListId}${s.value}`\"\n (click)=\"onSecondChange(s.value)\">\n {{ formatTwoDigit(s.value) }}\n </li>\n }\n </ol>\n }\n @if (effectiveHourFormat() === \"12\") {\n <ol\n #meridiemList\n monaTimeSelectorList\n [attr.aria-label]=\"messages().amPm\"\n [attr.aria-activedescendant]=\"`${meridiemListId}${meridiem()}`\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-required]=\"required() || null\"\n (focus)=\"onListFocus('meridiem')\"\n [id]=\"meridiemListId\"\n [popupHeight]=\"computedPopupHeight()\"\n [size]=\"size()\">\n @if (amMeridiemVisible()) {\n <li\n monaTimeSelectorItem\n [size]=\"size()\"\n [selected]=\"meridiem() === 'AM'\"\n [value]=\"'AM'\"\n (click)=\"onMeridiemClick('AM')\"\n [id]=\"`${meridiemListId}AM`\">\n {{ messages().am }}\n </li>\n }\n @if (pmMeridiemVisible()) {\n <li\n monaTimeSelectorItem\n [size]=\"size()\"\n [selected]=\"meridiem() === 'PM'\"\n [value]=\"'PM'\"\n (click)=\"onMeridiemClick('PM')\"\n [id]=\"`${meridiemListId}PM`\">\n {{ messages().pm }}\n </li>\n }\n </ol>\n }\n</div>\n\n@if (footer()) {\n <div [class]=\"footerClass()\">\n <button monaButton look=\"primary\" [rounded]=\"rounded()\" [size]=\"size()\" (click)=\"onSetTimeClick()\">\n {{ messages().set }}\n </button>\n </div>\n}\n",
|
|
898
887
|
dependencies: [
|
|
899
888
|
{
|
|
900
889
|
kind: "directive",
|
|
@@ -931,11 +920,7 @@ var TimeSelectorComponent = class TimeSelectorComponent {
|
|
|
931
920
|
kind: "directive",
|
|
932
921
|
type: TimeSelectorListDirective,
|
|
933
922
|
selector: "ol[monaTimeSelectorList]",
|
|
934
|
-
inputs: [
|
|
935
|
-
"active",
|
|
936
|
-
"popupHeight",
|
|
937
|
-
"size"
|
|
938
|
-
]
|
|
923
|
+
inputs: ["popupHeight", "size"]
|
|
939
924
|
}
|
|
940
925
|
]
|
|
941
926
|
});
|
|
@@ -966,7 +951,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
966
951
|
"[class]": "baseClass()",
|
|
967
952
|
"(focusout)": "onFocusOut($event)"
|
|
968
953
|
},
|
|
969
|
-
template: "<div [class]=\"headerClass()\">\n <div>{{ messages().headerHours }}</div>\n <div>{{ messages().headerMinutes }}</div>\n @if (showSeconds()) {\n <div>{{ messages().headerSeconds }}</div>\n }\n</div>\n\n<div [class]=\"infoContainerClass()\">\n <span>{{ navigatedDateText() }}</span>\n <button monaButton look=\"ghost\" [rounded]=\"rounded()\" [size]=\"'small'\" (click)=\"onNowClick()\">\n {{ messages().now }}\n </button>\n</div>\n\n<div [class]=\"listContainerClass()\">\n <ol\n #hourList\n monaTimeSelectorList\n [attr.aria-label]=\"messages().hours\"\n [attr.aria-activedescendant]=\"activeOptionId(hourListId, hourOptions(), navigatedDate().hour)\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-required]=\"required() || null\"\n
|
|
954
|
+
template: "<div [class]=\"headerClass()\">\n <div>{{ messages().headerHours }}</div>\n <div>{{ messages().headerMinutes }}</div>\n @if (showSeconds()) {\n <div>{{ messages().headerSeconds }}</div>\n }\n</div>\n\n<div [class]=\"infoContainerClass()\">\n <span>{{ navigatedDateText() }}</span>\n <button monaButton look=\"ghost\" [rounded]=\"rounded()\" [size]=\"'small'\" (click)=\"onNowClick()\">\n {{ messages().now }}\n </button>\n</div>\n\n<div [class]=\"listContainerClass()\">\n <ol\n #hourList\n monaTimeSelectorList\n [attr.aria-label]=\"messages().hours\"\n [attr.aria-activedescendant]=\"activeOptionId(hourListId, hourOptions(), navigatedDate().hour)\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-required]=\"required() || null\"\n (focus)=\"onListFocus('hours')\"\n [id]=\"hourListId\"\n [popupHeight]=\"computedPopupHeight()\"\n [size]=\"size()\">\n @for (h of hourOptions(); track h.value) {\n <li\n monaTimeSelectorItem\n [size]=\"size()\"\n [selected]=\"h.viewValue === hour()\"\n [value]=\"h.value\"\n [id]=\"`${hourListId}${h.value}`\"\n (click)=\"onHourChange(h.value)\">\n {{ formatTwoDigit(h.viewValue) }}\n </li>\n }\n </ol>\n <ol\n #minuteList\n monaTimeSelectorList\n [attr.aria-label]=\"messages().minutes\"\n [attr.aria-activedescendant]=\"activeOptionId(minuteListId, minuteOptions(), minute())\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-required]=\"required() || null\"\n (focus)=\"onListFocus('minutes')\"\n [id]=\"minuteListId\"\n [popupHeight]=\"computedPopupHeight()\"\n [size]=\"size()\">\n @for (m of minuteOptions(); track m.value) {\n <li\n monaTimeSelectorItem\n [size]=\"size()\"\n [selected]=\"m.value === minute()\"\n [value]=\"m.value\"\n [id]=\"`${minuteListId}${m.value}`\"\n (click)=\"onMinuteChange(m.value)\">\n {{ formatTwoDigit(m.viewValue) }}\n </li>\n }\n </ol>\n @if (showSeconds()) {\n <ol\n #secondList\n monaTimeSelectorList\n [attr.aria-label]=\"messages().seconds\"\n [attr.aria-activedescendant]=\"activeOptionId(secondListId, secondOptions(), second())\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-required]=\"required() || null\"\n (focus)=\"onListFocus('seconds')\"\n [id]=\"secondListId\"\n [popupHeight]=\"computedPopupHeight()\"\n [size]=\"size()\">\n @for (s of secondOptions(); track s.value) {\n <li\n monaTimeSelectorItem\n [size]=\"size()\"\n [selected]=\"s.value === second()\"\n [value]=\"s.value\"\n [id]=\"`${secondListId}${s.value}`\"\n (click)=\"onSecondChange(s.value)\">\n {{ formatTwoDigit(s.value) }}\n </li>\n }\n </ol>\n }\n @if (effectiveHourFormat() === \"12\") {\n <ol\n #meridiemList\n monaTimeSelectorList\n [attr.aria-label]=\"messages().amPm\"\n [attr.aria-activedescendant]=\"`${meridiemListId}${meridiem()}`\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-required]=\"required() || null\"\n (focus)=\"onListFocus('meridiem')\"\n [id]=\"meridiemListId\"\n [popupHeight]=\"computedPopupHeight()\"\n [size]=\"size()\">\n @if (amMeridiemVisible()) {\n <li\n monaTimeSelectorItem\n [size]=\"size()\"\n [selected]=\"meridiem() === 'AM'\"\n [value]=\"'AM'\"\n (click)=\"onMeridiemClick('AM')\"\n [id]=\"`${meridiemListId}AM`\">\n {{ messages().am }}\n </li>\n }\n @if (pmMeridiemVisible()) {\n <li\n monaTimeSelectorItem\n [size]=\"size()\"\n [selected]=\"meridiem() === 'PM'\"\n [value]=\"'PM'\"\n (click)=\"onMeridiemClick('PM')\"\n [id]=\"`${meridiemListId}PM`\">\n {{ messages().pm }}\n </li>\n }\n </ol>\n }\n</div>\n\n@if (footer()) {\n <div [class]=\"footerClass()\">\n <button monaButton look=\"primary\" [rounded]=\"rounded()\" [size]=\"size()\" (click)=\"onSetTimeClick()\">\n {{ messages().set }}\n </button>\n </div>\n}\n"
|
|
970
955
|
}]
|
|
971
956
|
}],
|
|
972
957
|
ctorParameters: () => [],
|
package/package.json
CHANGED
|
@@ -138,7 +138,7 @@ export declare class TimeSelectorComponent implements FormValueControl<Date | nu
|
|
|
138
138
|
readonly value: import("@angular/core").ModelSignal<Date | null>;
|
|
139
139
|
constructor();
|
|
140
140
|
/**
|
|
141
|
-
* Moves focus to the
|
|
141
|
+
* Moves focus to the list that had it last, the hour list at first.
|
|
142
142
|
* @param options passed to the native `focus()` call, for example `{ preventScroll: true }`.
|
|
143
143
|
*/
|
|
144
144
|
focus(options?: FocusOptions): void;
|
|
@@ -147,6 +147,8 @@ export declare class TimeSelectorComponent implements FormValueControl<Date | nu
|
|
|
147
147
|
protected formatTwoDigit(value: number): string;
|
|
148
148
|
protected onFocusOut(event: FocusEvent): void;
|
|
149
149
|
protected onHourChange(hour: number): void;
|
|
150
|
+
/** Keeps the arrow keys on the list that has focus, however it got there: Tab, a click or the arrow keys. */
|
|
151
|
+
protected onListFocus(listType: TimeListType): void;
|
|
150
152
|
protected onMeridiemClick(meridiem: Meridiem): void;
|
|
151
153
|
protected onMinuteChange(minute: number): void;
|
|
152
154
|
protected onNowClick(): void;
|