@nanahoshi/mona-ui 0.25.1 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/command/package.json +4 -0
- package/docs/auto-complete.md +733 -0
- package/docs/avatar.md +220 -0
- package/docs/breadcrumb.md +320 -0
- package/docs/button-group.md +392 -0
- package/docs/button.md +256 -0
- package/docs/calendar.md +515 -0
- package/docs/card.md +292 -0
- package/docs/chart.md +4058 -0
- package/docs/checkbox.md +374 -0
- package/docs/chip.md +339 -0
- package/docs/circular-progress-bar.md +287 -0
- package/docs/collapsible.md +308 -0
- package/docs/color-gradient.md +336 -0
- package/docs/color-palette.md +317 -0
- package/docs/color-picker.md +387 -0
- package/docs/combo-box.md +764 -0
- package/docs/command.md +582 -0
- package/docs/contextmenu.md +530 -0
- package/docs/date-picker.md +251 -0
- package/docs/datetime-picker.md +284 -0
- package/docs/decimal-textbox.md +260 -0
- package/docs/dialog.md +822 -0
- package/docs/dropdown-button.md +507 -0
- package/docs/dropdown-list.md +779 -0
- package/docs/editor.md +374 -0
- package/docs/expansion-panel.md +348 -0
- package/docs/fieldset.md +217 -0
- package/docs/forms.md +162 -0
- package/docs/grid.md +2053 -0
- package/docs/input.md +197 -0
- package/docs/installation.md +54 -0
- package/docs/introduction.md +46 -0
- package/docs/label.md +340 -0
- package/docs/list-box.md +637 -0
- package/docs/list-view.md +584 -0
- package/docs/menubar.md +559 -0
- package/docs/multi-select.md +765 -0
- package/docs/notification.md +460 -0
- package/docs/numeric-textbox.md +301 -0
- package/docs/otp-input.md +539 -0
- package/docs/pager.md +513 -0
- package/docs/placeholder.md +176 -0
- package/docs/popover.md +423 -0
- package/docs/popup-menu.md +658 -0
- package/docs/popup.md +617 -0
- package/docs/progress-bar.md +368 -0
- package/docs/radio-button.md +451 -0
- package/docs/range-slider.md +367 -0
- package/docs/rating.md +518 -0
- package/docs/scroll-view.md +375 -0
- package/docs/segmented.md +434 -0
- package/docs/sheet.md +348 -0
- package/docs/sidebar.md +1126 -0
- package/docs/skeleton.md +181 -0
- package/docs/slider.md +423 -0
- package/docs/spinner.md +370 -0
- package/docs/split-button.md +522 -0
- package/docs/splitter.md +342 -0
- package/docs/stepper.md +539 -0
- package/docs/switch.md +340 -0
- package/docs/tabs.md +542 -0
- package/docs/textarea.md +196 -0
- package/docs/textbox.md +332 -0
- package/docs/theming.md +403 -0
- package/docs/time-picker.md +254 -0
- package/docs/tooltip-directive.md +340 -0
- package/docs/tooltip.md +321 -0
- package/docs/tree-view.md +1018 -0
- package/docs/window.md +663 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +8 -0
- package/fesm2022/nanahoshi-mona-ui-button.mjs +12 -0
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +5 -2
- package/fesm2022/nanahoshi-mona-ui-chart.mjs +86 -0
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +16 -2
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-command.mjs +924 -0
- package/fesm2022/nanahoshi-mona-ui-common.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +10 -6
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +2 -1
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +2 -1
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +9 -5
- package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +9 -5
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +55 -1
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +3 -2
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +13 -0
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +5 -0
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-2tVhD2hK.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs} +2 -2
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-BAN70Wcn.mjs → nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs} +5 -5
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-C_kCaA5b.mjs → nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs} +18 -35
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-BsNfrAHz.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs} +5 -5
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CEfVa7eo.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs} +4653 -4529
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1 -0
- package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +168 -0
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +19 -1
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +14 -0
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +32 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +15 -8
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +8 -5
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +9 -0
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +5 -0
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +2 -1
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +14 -6
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +48 -183
- package/fesm2022/nanahoshi-mona-ui-popup.mjs +16 -0
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-rating.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-segmented.mjs +1 -0
- package/fesm2022/nanahoshi-mona-ui-sheet.mjs +5 -5
- package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +7 -2
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +9 -6
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +18 -21
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +11 -8
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +9 -1
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +2 -1
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +16 -5
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +13 -11
- package/fesm2022/nanahoshi-mona-ui-window.mjs +12 -5
- package/i18n/catalogs/en-US.messages.json +10 -0
- package/internal/popup-menu/package.json +4 -0
- package/llms.txt +123 -0
- package/locales/ar-sa/ar-sa.messages.json +10 -0
- package/locales/de-de/de-de.messages.json +10 -0
- package/locales/es-es/es-es.messages.json +10 -0
- package/locales/fr-fr/fr-fr.messages.json +10 -0
- package/locales/id-id/id-id.messages.json +10 -0
- package/locales/it-it/it-it.messages.json +10 -0
- package/locales/ja-jp/ja-jp.messages.json +10 -0
- package/locales/ko-kr/ko-kr.messages.json +10 -0
- package/locales/pt-br/pt-br.messages.json +10 -0
- package/locales/ru-ru/ru-ru.messages.json +10 -0
- package/locales/tr-tr/tr-tr.messages.json +10 -0
- package/locales/zh-cn/zh-cn.messages.json +10 -0
- package/locales/zh-tw/zh-tw.messages.json +10 -0
- package/package.json +9 -1
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +1 -1
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +8 -0
- package/types/nanahoshi-mona-ui-button.d.ts +12 -0
- package/types/nanahoshi-mona-ui-calendar.d.ts +3 -0
- package/types/nanahoshi-mona-ui-chart.d.ts +200 -0
- package/types/nanahoshi-mona-ui-check-box.d.ts +4 -0
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +4 -0
- package/types/nanahoshi-mona-ui-collapsible.d.ts +10 -0
- package/types/nanahoshi-mona-ui-combo-box.d.ts +1 -1
- package/types/nanahoshi-mona-ui-command.d.ts +253 -0
- package/types/nanahoshi-mona-ui-common.d.ts +17 -1
- package/types/nanahoshi-mona-ui-contextmenu.d.ts +5 -2
- package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -1
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +2 -1
- package/types/nanahoshi-mona-ui-dialog.d.ts +58 -1
- package/types/nanahoshi-mona-ui-dropdown-button.d.ts +7 -3
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +55 -1
- package/types/nanahoshi-mona-ui-editor.d.ts +31 -0
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +13 -0
- package/types/nanahoshi-mona-ui-fieldset.d.ts +5 -0
- package/types/nanahoshi-mona-ui-grid.d.ts +162 -35
- package/types/nanahoshi-mona-ui-i18n.d.ts +144 -1
- package/types/nanahoshi-mona-ui-internal-list.d.ts +16 -1
- package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +165 -0
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +21 -2
- package/types/nanahoshi-mona-ui-internal.d.ts +4 -5
- package/types/nanahoshi-mona-ui-label.d.ts +1 -0
- package/types/nanahoshi-mona-ui-list-box.d.ts +27 -4
- package/types/nanahoshi-mona-ui-list-view.d.ts +34 -1
- package/types/nanahoshi-mona-ui-list.d.ts +1 -1
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +10 -0
- package/types/nanahoshi-mona-ui-menubar.d.ts +10 -3
- package/types/nanahoshi-mona-ui-multi-select.d.ts +3 -3
- package/types/nanahoshi-mona-ui-notification.d.ts +9 -0
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +1 -1
- package/types/nanahoshi-mona-ui-otp-input.d.ts +1 -0
- package/types/nanahoshi-mona-ui-pager.d.ts +5 -1
- package/types/nanahoshi-mona-ui-popover.d.ts +9 -1
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +48 -161
- package/types/nanahoshi-mona-ui-popup.d.ts +16 -0
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +4 -0
- package/types/nanahoshi-mona-ui-rating.d.ts +2 -0
- package/types/nanahoshi-mona-ui-segmented.d.ts +1 -0
- package/types/nanahoshi-mona-ui-sheet.d.ts +1 -1
- package/types/nanahoshi-mona-ui-slider.d.ts +2 -0
- package/types/nanahoshi-mona-ui-spinner.d.ts +7 -0
- package/types/nanahoshi-mona-ui-split-button.d.ts +7 -4
- package/types/nanahoshi-mona-ui-stepper.d.ts +11 -2
- package/types/nanahoshi-mona-ui-tabs.d.ts +4 -1
- package/types/nanahoshi-mona-ui-text-box.d.ts +9 -1
- package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -1
- package/types/nanahoshi-mona-ui-tooltip.d.ts +10 -2
- package/types/nanahoshi-mona-ui-tree-view.d.ts +6 -5
- package/types/nanahoshi-mona-ui-window.d.ts +66 -1
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
# Date Picker
|
|
2
|
+
|
|
3
|
+
> A date input that opens a calendar popup.
|
|
4
|
+
|
|
5
|
+
Entry point: `@nanahoshi/mona-ui/date-picker`
|
|
6
|
+
|
|
7
|
+
**Selector:** `mona-date-picker`
|
|
8
|
+
|
|
9
|
+
`DatePickerComponent` is a date input that opens a calendar popup. Users can type a date in the locale's format or pick one from the calendar.
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
Use `DatePickerComponent` for a single date in a form field, where users may type the date or pick it from a calendar. The calendar stays hidden until the user opens it.
|
|
14
|
+
|
|
15
|
+
Use `CalendarComponent` instead when the calendar should always be visible, or when users select several dates or a range. Use `DateTimePickerComponent` when the value also needs a time of day, and `TimePickerComponent` when it is only a time.
|
|
16
|
+
|
|
17
|
+
## Import & Quick Start
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { DatePickerComponent } from "@nanahoshi/mona-ui/date-picker";
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```html
|
|
24
|
+
<label for="start-date">Start date</label>
|
|
25
|
+
<mona-date-picker inputId="start-date" [(value)]="startDate"></mona-date-picker>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
protected readonly startDate = signal<Date | null>(null);
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Anatomy
|
|
33
|
+
|
|
34
|
+
The picker is a text input with a calendar button at its end. The button opens a popup that holds a `mona-calendar`.
|
|
35
|
+
|
|
36
|
+
| Template | Imported from | Fills |
|
|
37
|
+
|---|---|---|
|
|
38
|
+
| `ng-template[monaDateInputPrefixTemplate]` | `@nanahoshi/mona-ui/date-input` | Content before the input text, such as an icon |
|
|
39
|
+
| `ng-template[monaCalendarMonthCellTemplate]` | `@nanahoshi/mona-ui/calendar` | Each day cell of the popup calendar |
|
|
40
|
+
| `ng-template[monaCalendarYearCellTemplate]` | `@nanahoshi/mona-ui/calendar` | Each month cell of the year view |
|
|
41
|
+
| `ng-template[monaCalendarDecadeCellTemplate]` | `@nanahoshi/mona-ui/calendar` | Each year cell of the decade view |
|
|
42
|
+
|
|
43
|
+
The cell templates receive the same context as on the [Calendar](calendar.md) page.
|
|
44
|
+
|
|
45
|
+
## Appearance & Styling
|
|
46
|
+
|
|
47
|
+
### Size and rounding
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
<mona-date-picker [(value)]="date" size="large" rounded="full"></mona-date-picker>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Supported `size` values are `small`, `medium` and `large`. Supported `rounded` values are `none`, `small`, `medium`, `large` and `full`. Both also apply to the popup.
|
|
54
|
+
|
|
55
|
+
`class` adds classes to the input's container, and `popupClass` to the popup. `popupWidth` and `popupHeight` size the popup; when they are empty, it fits the calendar.
|
|
56
|
+
|
|
57
|
+
### Calendar options
|
|
58
|
+
|
|
59
|
+
`firstDay` sets the first day of the week, and `weekNumber` shows week numbers in the calendar. Without `firstDay`, the week starts on the day the active locale uses.
|
|
60
|
+
|
|
61
|
+
## Behavior
|
|
62
|
+
|
|
63
|
+
### Typing a date
|
|
64
|
+
|
|
65
|
+
The input shows the value in `format`, or in the active locale's date format when `format` is `null`. Typed text is also accepted with one-digit days and months and a two-digit year, which is read as a year in this century.
|
|
66
|
+
|
|
67
|
+
Typed text is written to `value` on `Enter` and when the input loses focus. Text that isn't a date keeps the previous value and reports a `parse` error. A date before `min` or after `max` reports a `minDate` or `maxDate` error, and a date in `disabledDates` reports a `disabledDate` error, instead of setting the value. Clearing the text, or pressing the clear button shown by `showClearButton`, sets `value` to `null` at once.
|
|
68
|
+
|
|
69
|
+
### Picking from the calendar
|
|
70
|
+
|
|
71
|
+
Choosing a day in the calendar sets `value` and closes the popup. Days before `min`, after `max`, or in `disabledDates` can't be chosen. `disabledDates` takes an iterable of dates or a predicate.
|
|
72
|
+
|
|
73
|
+
### Disabled and read-only
|
|
74
|
+
|
|
75
|
+
`disabled` and `readonly` keep the popup from opening. `readonlyInput` blocks typing but keeps the calendar button working, so the date can only be picked.
|
|
76
|
+
|
|
77
|
+
### Popup events
|
|
78
|
+
|
|
79
|
+
`open` and `close` fire before the popup opens or closes, and both can be prevented. `opened` and `closed` fire after.
|
|
80
|
+
|
|
81
|
+
## Forms Integration
|
|
82
|
+
|
|
83
|
+
`DatePickerComponent` implements `FormValueControl<Date | null>` from `@angular/forms/signals`.
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import { signal } from "@angular/core";
|
|
87
|
+
import { FormField, form, required } from "@angular/forms/signals";
|
|
88
|
+
|
|
89
|
+
protected readonly form = form(signal<{ start: Date | null }>({ start: null }), schema => {
|
|
90
|
+
required(schema.start);
|
|
91
|
+
});
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```html
|
|
95
|
+
<mona-date-picker [formField]="form.start"></mona-date-picker>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The `FormField` directive writes `disabled`, `invalid`, `readonly`, `required` and `touched`. The `touch` output fires when focus leaves both the picker and its popup, so moving into the calendar doesn't mark the field touched.
|
|
99
|
+
|
|
100
|
+
Typing errors (`parse`, `minDate`, `maxDate`, `disabledDate`) are reported to the bound form field, whether it is a signal form, `ngModel` or a reactive form control.
|
|
101
|
+
|
|
102
|
+
## Accessibility
|
|
103
|
+
|
|
104
|
+
The input is a `role="combobox"` with `aria-haspopup="dialog"`, `aria-autocomplete="none"`, `aria-expanded` and `aria-controls` pointing at the popup. The popup is a `role="dialog"` with `aria-modal="true"`, named by the `datePicker` message ("Date picker"). It traps focus, and the calendar inside takes focus when it opens.
|
|
105
|
+
|
|
106
|
+
| Attribute | Where | Value |
|
|
107
|
+
|---|---|---|
|
|
108
|
+
| `role` | Input | `"combobox"` |
|
|
109
|
+
| `aria-haspopup` | Input | `"dialog"` |
|
|
110
|
+
| `aria-expanded` | Input | `"true"` while the popup is open, otherwise `"false"` |
|
|
111
|
+
| `aria-controls` | Input and calendar button | The popup's `id` |
|
|
112
|
+
| `aria-label`, `aria-labelledby`, `aria-describedby` | Input | The matching inputs on the picker |
|
|
113
|
+
| `aria-invalid` | Input and host | `"true"` on a typing error, or once `touched` and either `invalid`, or `required` with no date |
|
|
114
|
+
| `aria-label` | Calendar button | The `openCalendar` message ("Open calendar") |
|
|
115
|
+
| `role` | Popup | `"dialog"`, with `aria-modal="true"` |
|
|
116
|
+
|
|
117
|
+
The calendar button has `tabindex="-1"`, so the picker is one Tab stop. Keyboard users open the popup with `Alt+ArrowDown`. The calendar's own roles are described on the [Calendar](calendar.md) page.
|
|
118
|
+
|
|
119
|
+
**Consumer responsibilities**
|
|
120
|
+
|
|
121
|
+
- Label the picker. Point a `<label for>` or `<mona-label for>` at `inputId`, wrap it in `<mona-label text="...">`, or set `aria-labelledby` or `aria-label`. The placeholder is not a label. `[for]` bound to the picker's template reference only moves focus to the input on click, and doesn't name it.
|
|
122
|
+
- Link hint or error text with `aria-describedby`.
|
|
123
|
+
|
|
124
|
+
### Keyboard Interaction
|
|
125
|
+
|
|
126
|
+
| Key | Where | Action |
|
|
127
|
+
|---|---|---|
|
|
128
|
+
| `Alt+ArrowDown` | Input | Opens the popup |
|
|
129
|
+
| `Alt+ArrowUp` / `Escape` | Input or calendar | Closes the popup |
|
|
130
|
+
| `Enter` | Input | Writes the typed text to `value` |
|
|
131
|
+
|
|
132
|
+
Inside the popup, the calendar's keyboard map applies. Closing the popup returns focus to the input, unless the user moved focus elsewhere.
|
|
133
|
+
|
|
134
|
+
## API
|
|
135
|
+
|
|
136
|
+
Everything below is imported from `@nanahoshi/mona-ui/date-picker`.
|
|
137
|
+
|
|
138
|
+
### `DatePickerComponent`
|
|
139
|
+
|
|
140
|
+
**Selector:** `mona-date-picker`
|
|
141
|
+
**Implements:** `FormValueControl<Date \| null>`
|
|
142
|
+
|
|
143
|
+
#### Inputs
|
|
144
|
+
|
|
145
|
+
| Name | Type | Default | Description |
|
|
146
|
+
| --- | --- | --- | --- |
|
|
147
|
+
| `aria-describedby` | `string` | `""` | Id of an element that describes the input, such as a hint or an error message. |
|
|
148
|
+
| `aria-label` | `string` | `""` | Accessible name of the input. Prefer a visible label, linked through `inputId` or `aria-labelledby`; the placeholder is not a label. |
|
|
149
|
+
| `aria-labelledby` | `string` | `""` | Id of the element that labels the input. |
|
|
150
|
+
| `class` | `string` | `""` | Extra classes for the input's container. |
|
|
151
|
+
| `disabled` | `boolean` | `false` | Sets the disabled state of the date picker. |
|
|
152
|
+
| `disabledDates` | `DateDisabledType` | — | Sets the disabled dates of the date picker. Accepts either an iterable of Date objects or a predicate function. Typing a disabled date is reported as a `disabledDate` error instead of setting the value. |
|
|
153
|
+
| `firstDay` | `FirstDayOfWeek \| null` | `null` | Sets the first day of the week. If not specified, derives from the active locale. |
|
|
154
|
+
| `format` | `string \| null` | `null` | Sets the date format of the date picker. If not specified, derives from the active locale. Typed text is also accepted with one-digit days and months and a two-digit year. |
|
|
155
|
+
| `inputId` | `string` | `generated` | Id of the inner `<input>` element. Point a `<label for>` or `<mona-label for>` at it to label the date picker. A unique id is generated when it isn't set. |
|
|
156
|
+
| `invalid` | `boolean` | `false` | Marks the date picker as invalid. When bound to a signal form field via `[formField]`, this is written by the `FormField` directive. |
|
|
157
|
+
| `max` | `Date \| undefined` | `undefined` | Sets the maximum date of the date picker. A later typed date is reported as a `maxDate` error. |
|
|
158
|
+
| `min` | `Date \| undefined` | `undefined` | Sets the minimum date of the date picker. An earlier typed date is reported as a `minDate` error. |
|
|
159
|
+
| `placeholder` | `string` | `""` | Sets the placeholder of the date picker. |
|
|
160
|
+
| `popupClass` | `string` | `""` | Sets the class of the popup element. |
|
|
161
|
+
| `popupHeight` | `ListSizeInputType` | `""` | Sets the height of the popup element. When empty, the popup fits the calendar. |
|
|
162
|
+
| `popupWidth` | `ListSizeInputType` | `""` | Sets the width of the popup element. When empty, the popup fits the calendar. |
|
|
163
|
+
| `readonly` | `boolean` | `false` | Sets the readonly state of the date picker. |
|
|
164
|
+
| `readonlyInput` | `boolean` | `false` | When true, the input is readonly but the calendar button remains enabled. |
|
|
165
|
+
| `required` | `boolean` | `false` | Sets the required state of the date picker. When bound to a signal form field via `[formField]`, this is written by the `FormField` directive. |
|
|
166
|
+
| `rounded` | `"full" \| "large" \| "medium" \| "none" \| "small"` | `"medium"` | Sets the border radius of the date picker. |
|
|
167
|
+
| `showClearButton` | `boolean` | `false` | Sets the visibility of the clear button. Clearing empties the value at once. |
|
|
168
|
+
| `size` | `"large" \| "medium" \| "small"` | `"medium"` | Sets the size of the date picker. |
|
|
169
|
+
| `touched` | `boolean` | `false` | Sets the touched state of the date picker. When bound to a signal form field via `[formField]`, this is written by the `FormField` directive. |
|
|
170
|
+
| `value` (two-way) | `Date \| null` | `null` | Two-way bindable current date value. Typed text is written on Enter and when the input loses focus; text that isn't a valid date keeps the previous value and marks the field invalid. |
|
|
171
|
+
| `weekNumber` | `boolean` | `false` | Enables the display of week numbers in the calendar. |
|
|
172
|
+
|
|
173
|
+
#### Outputs
|
|
174
|
+
|
|
175
|
+
| Name | Type | Description |
|
|
176
|
+
| --- | --- | --- |
|
|
177
|
+
| `close` | `PopupCloseEvent<unknown>` | Emits when the popup is about to close. This event is preventable. |
|
|
178
|
+
| `closed` | `void` | Emits after the popup is closed. |
|
|
179
|
+
| `open` | `PreventableEvent<Event>` | Emits when the popup is about to open. This event is preventable. |
|
|
180
|
+
| `opened` | `void` | Emits after the popup is opened. |
|
|
181
|
+
| `touch` | `void` | Emitted when focus leaves the date picker and its popup. The `FormField` directive listens to this to mark the field as touched. |
|
|
182
|
+
| `valueChange` | `Date \| null` | Emitted when `value` changes. |
|
|
183
|
+
|
|
184
|
+
#### Methods
|
|
185
|
+
|
|
186
|
+
| Signature | Description |
|
|
187
|
+
| --- | --- |
|
|
188
|
+
| `focus(options?: FocusOptions): void` | Focuses the input and places the caret after the text. Read-only pickers take focus too. |
|
|
189
|
+
|
|
190
|
+
### Types
|
|
191
|
+
|
|
192
|
+
#### `DATE_PICKER_DEFAULT_MESSAGES`
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
const DATE_PICKER_DEFAULT_MESSAGES: MonaDatePickerMessages;
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
#### `DateDisabledType`
|
|
199
|
+
|
|
200
|
+
From `@nanahoshi/mona-ui/date-input`.
|
|
201
|
+
|
|
202
|
+
```typescript
|
|
203
|
+
type DateDisabledType = Iterable<Date> | Predicate<Date> | null | undefined;
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
#### `ListSizeInputType`
|
|
207
|
+
|
|
208
|
+
From `@nanahoshi/mona-ui/list`.
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
type ListSizeInputType = ListSizeType | number;
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
#### `ListSizeType`
|
|
215
|
+
|
|
216
|
+
From `@nanahoshi/mona-ui/list`.
|
|
217
|
+
|
|
218
|
+
A CSS length, or nothing to leave it to the stylesheet.
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
type ListSizeType = string | null | undefined;
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
#### `MonaDatePickerMessages`
|
|
225
|
+
|
|
226
|
+
From `@nanahoshi/mona-ui/i18n`.
|
|
227
|
+
|
|
228
|
+
| Name | Type |
|
|
229
|
+
| --- | --- |
|
|
230
|
+
| `datePicker` (read-only) | `string` |
|
|
231
|
+
| `openCalendar` (read-only) | `string` |
|
|
232
|
+
|
|
233
|
+
#### `PreventableEvent`
|
|
234
|
+
|
|
235
|
+
From `@nanahoshi/mona-ui/common`.
|
|
236
|
+
|
|
237
|
+
**Type parameters:** `E extends Event = Event`
|
|
238
|
+
|
|
239
|
+
| Name | Type | Description |
|
|
240
|
+
| --- | --- | --- |
|
|
241
|
+
| `originalEvent` (read-only) | `E \| undefined` | The DOM event that caused this one, when there is one. |
|
|
242
|
+
| `type` (read-only) | `string \| undefined` | A name for the kind of event, when the component that emits it sets one. |
|
|
243
|
+
|
|
244
|
+
**Methods**
|
|
245
|
+
|
|
246
|
+
| Signature | Description |
|
|
247
|
+
| --- | --- |
|
|
248
|
+
| `isDefaultPrevented(): boolean` | Whether `preventDefault()` was called. |
|
|
249
|
+
| `preventDefault(): void` | Cancels what the event announces, such as opening or closing a popup, or closing a dialog. |
|
|
250
|
+
|
|
251
|
+
**Documented elsewhere:** [`FirstDayOfWeek`](calendar.md), [`PopupCloseEvent`](popup.md)
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
# Date Time Picker
|
|
2
|
+
|
|
3
|
+
> An input for choosing a date and a time together.
|
|
4
|
+
|
|
5
|
+
Entry point: `@nanahoshi/mona-ui/datetime-picker`
|
|
6
|
+
|
|
7
|
+
**Selector:** `mona-datetime-picker`
|
|
8
|
+
|
|
9
|
+
`DateTimePickerComponent` is an input for choosing a date and a time together. Users can type both in the locale's format, or open a popup with a Date tab and a Time tab.
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
Use `DateTimePickerComponent` when one value holds both a date and a time of day, such as an appointment. Users may type both, or open a popup that shows a calendar on a Date tab and time lists on a Time tab.
|
|
14
|
+
|
|
15
|
+
Use `DatePickerComponent` instead when only the date matters, and `TimePickerComponent` when only the time does. Use `CalendarComponent` when the calendar should always be visible.
|
|
16
|
+
|
|
17
|
+
## Import & Quick Start
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { DateTimePickerComponent } from "@nanahoshi/mona-ui/datetime-picker";
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```html
|
|
24
|
+
<label for="appointment">Appointment</label>
|
|
25
|
+
<mona-datetime-picker inputId="appointment" [(value)]="appointment"></mona-datetime-picker>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
protected readonly appointment = signal<Date | null>(null);
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Anatomy
|
|
33
|
+
|
|
34
|
+
The picker is a text input with a button at its end. The button opens a popup with a Date tab and a Time tab, one panel showing either a `mona-calendar` or a `mona-time-selector`, and **Set** and **Cancel** buttons.
|
|
35
|
+
|
|
36
|
+
| Template | Imported from | Fills |
|
|
37
|
+
|---|---|---|
|
|
38
|
+
| `ng-template[monaDateInputPrefixTemplate]` | `@nanahoshi/mona-ui/date-input` | Content before the input text, such as an icon |
|
|
39
|
+
| `ng-template[monaCalendarMonthCellTemplate]` | `@nanahoshi/mona-ui/calendar` | Each day cell of the popup calendar |
|
|
40
|
+
| `ng-template[monaCalendarYearCellTemplate]` | `@nanahoshi/mona-ui/calendar` | Each month cell of the year view |
|
|
41
|
+
| `ng-template[monaCalendarDecadeCellTemplate]` | `@nanahoshi/mona-ui/calendar` | Each year cell of the decade view |
|
|
42
|
+
|
|
43
|
+
The cell templates receive the same context as on the [Calendar](calendar.md) page.
|
|
44
|
+
|
|
45
|
+
## Appearance & Styling
|
|
46
|
+
|
|
47
|
+
### Size and rounding
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
<mona-datetime-picker [(value)]="appointment" size="large" rounded="full"></mona-datetime-picker>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Supported `size` values are `small`, `medium` and `large`. Supported `rounded` values are `none`, `small`, `medium`, `large` and `full`. Both also apply to the popup and its contents.
|
|
54
|
+
|
|
55
|
+
`class` adds classes to the input's container, and `popupClass` to the popup. `popupWidth` and `popupHeight` size the popup; when they aren't set, it fits its content and is at least as wide as the input.
|
|
56
|
+
|
|
57
|
+
### Calendar and clock options
|
|
58
|
+
|
|
59
|
+
`firstDay` sets the first day of the week, and `weekNumber` shows week numbers in the calendar. `hourFormat` is `"12"`, with an AM/PM list, or `"24"`; when it is `null`, the active locale's clock is used. `hourStep`, `minuteStep` and `secondStep` set the distance between time list items, and `showSeconds` adds the seconds list.
|
|
60
|
+
|
|
61
|
+
## Behavior
|
|
62
|
+
|
|
63
|
+
### Typing a date and time
|
|
64
|
+
|
|
65
|
+
The input shows the value in `format`, or in a format built from the active locale, `hourFormat` and `showSeconds` when `format` is `null`. Typed text is also accepted with one-digit parts and a two-digit year.
|
|
66
|
+
|
|
67
|
+
Typed text is written to `value` on `Enter` and when the input loses focus. Text that isn't a date and time keeps the previous value and reports a `parse` error. A value before `min` or after `max` reports a `minDate` or `maxDate` error, and a date in `disabledDates` reports a `disabledDate` error, instead of setting the value. Clearing the text, or pressing the clear button shown by `showClearButton`, sets `value` to `null` at once.
|
|
68
|
+
|
|
69
|
+
### Picking from the popup
|
|
70
|
+
|
|
71
|
+
The popup opens on the Date tab. Choosing a day keeps the time already chosen and moves to the Time tab. Changes in the popup don't touch `value` until the user confirms them:
|
|
72
|
+
|
|
73
|
+
- **Set** writes the chosen date and time to `value` and closes the popup. `Enter` on the Time tab, outside a button, does the same.
|
|
74
|
+
- **Cancel** and `Escape` close the popup and drop the changes.
|
|
75
|
+
|
|
76
|
+
A chosen date and time before `min` or after `max` is moved to that limit. On the day of `min` or `max`, the time lists are limited too. Each time the popup closes, it goes back to the Date tab and to the current value.
|
|
77
|
+
|
|
78
|
+
### Disabled and read-only
|
|
79
|
+
|
|
80
|
+
`disabled` and `readonly` keep the popup from opening. `readonlyInput` blocks typing but keeps the popup button working, so the value can only be picked.
|
|
81
|
+
|
|
82
|
+
### Popup events
|
|
83
|
+
|
|
84
|
+
`open` and `close` fire before the popup opens or closes, and both can be prevented. `opened` and `closed` fire after.
|
|
85
|
+
|
|
86
|
+
## Forms Integration
|
|
87
|
+
|
|
88
|
+
`DateTimePickerComponent` implements `FormValueControl<Date | null>` from `@angular/forms/signals`.
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
import { signal } from "@angular/core";
|
|
92
|
+
import { FormField, form, required } from "@angular/forms/signals";
|
|
93
|
+
|
|
94
|
+
protected readonly form = form(signal<{ appointment: Date | null }>({ appointment: null }), schema => {
|
|
95
|
+
required(schema.appointment);
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
```html
|
|
100
|
+
<mona-datetime-picker [formField]="form.appointment"></mona-datetime-picker>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The `FormField` directive writes `disabled`, `invalid`, `readonly`, `required` and `touched`. The `touch` output fires when focus leaves both the picker and its popup, so moving into the popup doesn't mark the field touched.
|
|
104
|
+
|
|
105
|
+
Typing errors (`parse`, `minDate`, `maxDate`, `disabledDate`) are reported to the bound form field, whether it is a signal form, `ngModel` or a reactive form control.
|
|
106
|
+
|
|
107
|
+
## Accessibility
|
|
108
|
+
|
|
109
|
+
The input is a `role="combobox"` with `aria-haspopup="dialog"`, `aria-autocomplete="none"`, `aria-expanded` and `aria-controls` pointing at the popup. The popup is a `role="dialog"` with `aria-modal="true"`, named by the `dateTimePicker` message ("Date and time picker"). It traps focus, and the calendar takes focus when it opens.
|
|
110
|
+
|
|
111
|
+
The Date and Time buttons form a `role="tablist"` following the tabs pattern: each is a `role="tab"` with `aria-selected` and `aria-controls`, only the selected tab is in the Tab order, and the panel is a `role="tabpanel"` labelled by the selected tab. Choosing a tab keeps focus on it; picking a day moves focus into the time selector.
|
|
112
|
+
|
|
113
|
+
| Attribute | Where | Value |
|
|
114
|
+
|---|---|---|
|
|
115
|
+
| `role` | Input | `"combobox"` |
|
|
116
|
+
| `aria-haspopup` | Input | `"dialog"` |
|
|
117
|
+
| `aria-expanded` | Input | `"true"` while the popup is open, otherwise `"false"` |
|
|
118
|
+
| `aria-controls` | Input and popup button | The popup's `id` |
|
|
119
|
+
| `aria-label`, `aria-labelledby`, `aria-describedby` | Input | The matching inputs on the picker |
|
|
120
|
+
| `aria-invalid` | Input and host | `"true"` on a typing error, or once `touched` and either `invalid`, or `required` with no value |
|
|
121
|
+
| `aria-label` | Popup button | The `openDateTimePicker` message ("Open date and time picker") |
|
|
122
|
+
| `role` | Popup | `"dialog"`, with `aria-modal="true"` |
|
|
123
|
+
| `role` | Date and Time buttons | `"tab"`, inside a `"tablist"` |
|
|
124
|
+
| `aria-selected` | Date and Time buttons | `"true"` on the shown view |
|
|
125
|
+
| `role` | Panel | `"tabpanel"`, with `aria-labelledby` set to the selected tab |
|
|
126
|
+
|
|
127
|
+
The popup button has `tabindex="-1"`, so the picker is one Tab stop. Keyboard users open the popup with `Alt+ArrowDown`. The calendar's own roles are described on the [Calendar](calendar.md) page.
|
|
128
|
+
|
|
129
|
+
**Consumer responsibilities**
|
|
130
|
+
|
|
131
|
+
- 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.
|
|
132
|
+
- Link hint or error text with `aria-describedby`.
|
|
133
|
+
|
|
134
|
+
### Keyboard Interaction
|
|
135
|
+
|
|
136
|
+
| Key | Where | Action |
|
|
137
|
+
|---|---|---|
|
|
138
|
+
| `Alt+ArrowDown` | Input | Opens the popup |
|
|
139
|
+
| `Alt+ArrowUp` | Input, calendar or time selector | Closes the popup |
|
|
140
|
+
| `Escape` | Input, calendar or time selector | Closes the popup and drops the changes |
|
|
141
|
+
| `Alt+ArrowRight` / `Alt+ArrowLeft` | Input, calendar or time selector | Shows the Time or Date view (swapped in right-to-left layouts) |
|
|
142
|
+
| `ArrowRight` / `ArrowLeft`, `Home` / `End` | Tabs | Selects and focuses the Date or Time tab (arrows swapped in right-to-left layouts) |
|
|
143
|
+
| `Enter` | Input | Writes the typed text to `value` |
|
|
144
|
+
| `Enter` | Time selector | Sets the chosen date and time and closes the popup |
|
|
145
|
+
|
|
146
|
+
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.
|
|
147
|
+
|
|
148
|
+
## API
|
|
149
|
+
|
|
150
|
+
Everything below is imported from `@nanahoshi/mona-ui/datetime-picker`.
|
|
151
|
+
|
|
152
|
+
### `DateTimePickerComponent`
|
|
153
|
+
|
|
154
|
+
**Selector:** `mona-datetime-picker`
|
|
155
|
+
**Implements:** `FormValueControl<Date \| null>`
|
|
156
|
+
|
|
157
|
+
#### Inputs
|
|
158
|
+
|
|
159
|
+
| Name | Type | Default | Description |
|
|
160
|
+
| --- | --- | --- | --- |
|
|
161
|
+
| `aria-describedby` | `string` | `""` | Id of an element that describes the input, such as a hint or an error message. |
|
|
162
|
+
| `aria-label` | `string` | `""` | Accessible name of the input. Prefer a visible label, linked through `inputId` or `aria-labelledby`; the placeholder is not a label. |
|
|
163
|
+
| `aria-labelledby` | `string` | `""` | Id of the element that labels the input. |
|
|
164
|
+
| `class` | `string` | `""` | Extra classes for the input's container. |
|
|
165
|
+
| `disabled` | `boolean` | `false` | Sets the disabled state of the date time picker. |
|
|
166
|
+
| `disabledDates` | `DateDisabledType` | — | Sets the disabled dates of the date time picker. Accepts either an iterable of Date objects or a predicate function. Typing a disabled date is reported as a `disabledDate` error instead of setting the value. |
|
|
167
|
+
| `firstDay` | `FirstDayOfWeek \| null` | `null` | Sets the first day of the week. If not specified, derives from the active locale. |
|
|
168
|
+
| `format` | `string \| null` | `null` | Sets the date format of the date time picker. If not specified, derives from the active locale, hourFormat, and showSeconds. Typed text is also accepted with one-digit parts and a two-digit year. |
|
|
169
|
+
| `hourFormat` | `HourFormat \| null` | `null` | Sets the hour format of the date time picker. When null, the active locale's clock is used: 12-hour for en-US, 24-hour for de-DE. |
|
|
170
|
+
| `hourStep` | `number` | `1` | Sets the hour step of the time picker. |
|
|
171
|
+
| `inputId` | `string` | `generated` | Id of the inner `<input>` element. Point a `<label for>` or `<mona-label for>` at it to label the date time picker. A unique id is generated when it isn't set. |
|
|
172
|
+
| `invalid` | `boolean` | `false` | Marks the date time picker as invalid. When bound to a signal form field via `[formField]`, this is written by the `FormField` directive. |
|
|
173
|
+
| `max` | `Date \| undefined` | `undefined` | Sets the maximum date of the date time picker. A later typed date is reported as a `maxDate` error. |
|
|
174
|
+
| `min` | `Date \| undefined` | `undefined` | Sets the minimum date of the date time picker. An earlier typed date is reported as a `minDate` error. |
|
|
175
|
+
| `minuteStep` | `number` | `1` | Sets the minute step of the time picker. |
|
|
176
|
+
| `placeholder` | `string` | `""` | Sets the placeholder of the date time picker. |
|
|
177
|
+
| `popupClass` | `string` | `""` | Sets the class of the popup element. |
|
|
178
|
+
| `popupHeight` | `ListSizeInputType` | `undefined` | Sets the height of the popup element. When not set, the popup fits its content. |
|
|
179
|
+
| `popupWidth` | `ListSizeInputType` | `undefined` | Sets the width of the popup element. When not set, the popup is at least as wide as the input. |
|
|
180
|
+
| `readonly` | `boolean` | `false` | Sets the readonly state of the date time picker. |
|
|
181
|
+
| `readonlyInput` | `boolean` | `false` | When true, the input is readonly but the popup button remains enabled. |
|
|
182
|
+
| `required` | `boolean` | `false` | Sets the required state of the date time picker. When bound to a signal form field via `[formField]`, this is written by the `FormField` directive. |
|
|
183
|
+
| `rounded` | `"full" \| "large" \| "medium" \| "none" \| "small"` | `"medium"` | Sets the border radius of the date time picker. |
|
|
184
|
+
| `secondStep` | `number` | `1` | Sets the second step of the time picker. |
|
|
185
|
+
| `showClearButton` | `boolean` | `false` | Sets the visibility of the clear button. Clearing empties the value at once. |
|
|
186
|
+
| `showSeconds` | `boolean` | `false` | Sets the visibility of the second selector. |
|
|
187
|
+
| `size` | `"large" \| "medium" \| "small"` | `"medium"` | Sets the size of the date time picker. |
|
|
188
|
+
| `touched` | `boolean` | `false` | Sets the touched state of the date time picker. When bound to a signal form field via `[formField]`, this is written by the `FormField` directive. |
|
|
189
|
+
| `value` (two-way) | `Date \| null` | `null` | Two-way bindable current date time value. Typed text is written on Enter and when the input loses focus; text that isn't a valid date and time keeps the previous value and marks the field invalid. |
|
|
190
|
+
| `weekNumber` | `boolean` | `false` | Enables the display of week numbers in the calendar. |
|
|
191
|
+
|
|
192
|
+
#### Outputs
|
|
193
|
+
|
|
194
|
+
| Name | Type | Description |
|
|
195
|
+
| --- | --- | --- |
|
|
196
|
+
| `close` | `PopupCloseEvent<unknown>` | Emits when the popup is about to close. This event is preventable. |
|
|
197
|
+
| `closed` | `void` | Emits after the popup is closed. |
|
|
198
|
+
| `open` | `PreventableEvent<Event>` | Emits when the popup is about to open. This event is preventable. |
|
|
199
|
+
| `opened` | `void` | Emits after the popup is opened. |
|
|
200
|
+
| `touch` | `void` | Emitted when focus leaves the date time picker and its popup. The `FormField` directive listens to this to mark the field as touched. |
|
|
201
|
+
| `valueChange` | `Date \| null` | Emitted when `value` changes. |
|
|
202
|
+
|
|
203
|
+
#### Methods
|
|
204
|
+
|
|
205
|
+
| Signature | Description |
|
|
206
|
+
| --- | --- |
|
|
207
|
+
| `focus(options?: FocusOptions): void` | Focuses the input and places the caret after the text. Read-only pickers take focus too. |
|
|
208
|
+
|
|
209
|
+
### Types
|
|
210
|
+
|
|
211
|
+
#### `DATETIME_PICKER_DEFAULT_MESSAGES`
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
const DATETIME_PICKER_DEFAULT_MESSAGES: MonaDateTimePickerMessages;
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
#### `DateDisabledType`
|
|
218
|
+
|
|
219
|
+
From `@nanahoshi/mona-ui/date-input`.
|
|
220
|
+
|
|
221
|
+
```typescript
|
|
222
|
+
type DateDisabledType = Iterable<Date> | Predicate<Date> | null | undefined;
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
#### `HourFormat`
|
|
226
|
+
|
|
227
|
+
From `@nanahoshi/mona-ui/date-input`.
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
type HourFormat = "12" | "24";
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
#### `ListSizeInputType`
|
|
234
|
+
|
|
235
|
+
From `@nanahoshi/mona-ui/list`.
|
|
236
|
+
|
|
237
|
+
```typescript
|
|
238
|
+
type ListSizeInputType = ListSizeType | number;
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
#### `ListSizeType`
|
|
242
|
+
|
|
243
|
+
From `@nanahoshi/mona-ui/list`.
|
|
244
|
+
|
|
245
|
+
A CSS length, or nothing to leave it to the stylesheet.
|
|
246
|
+
|
|
247
|
+
```typescript
|
|
248
|
+
type ListSizeType = string | null | undefined;
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
#### `MonaDateTimePickerMessages`
|
|
252
|
+
|
|
253
|
+
From `@nanahoshi/mona-ui/i18n`.
|
|
254
|
+
|
|
255
|
+
| Name | Type |
|
|
256
|
+
| --- | --- |
|
|
257
|
+
| `calendar` (read-only) | `string` |
|
|
258
|
+
| `cancel` (read-only) | `string` |
|
|
259
|
+
| `date` (read-only) | `string` |
|
|
260
|
+
| `dateTimePicker` (read-only) | `string` |
|
|
261
|
+
| `openDateTimePicker` (read-only) | `string` |
|
|
262
|
+
| `set` (read-only) | `string` |
|
|
263
|
+
| `time` (read-only) | `string` |
|
|
264
|
+
| `timePicker` (read-only) | `string` |
|
|
265
|
+
|
|
266
|
+
#### `PreventableEvent`
|
|
267
|
+
|
|
268
|
+
From `@nanahoshi/mona-ui/common`.
|
|
269
|
+
|
|
270
|
+
**Type parameters:** `E extends Event = Event`
|
|
271
|
+
|
|
272
|
+
| Name | Type | Description |
|
|
273
|
+
| --- | --- | --- |
|
|
274
|
+
| `originalEvent` (read-only) | `E \| undefined` | The DOM event that caused this one, when there is one. |
|
|
275
|
+
| `type` (read-only) | `string \| undefined` | A name for the kind of event, when the component that emits it sets one. |
|
|
276
|
+
|
|
277
|
+
**Methods**
|
|
278
|
+
|
|
279
|
+
| Signature | Description |
|
|
280
|
+
| --- | --- |
|
|
281
|
+
| `isDefaultPrevented(): boolean` | Whether `preventDefault()` was called. |
|
|
282
|
+
| `preventDefault(): void` | Cancels what the event announces, such as opening or closing a popup, or closing a dialog. |
|
|
283
|
+
|
|
284
|
+
**Documented elsewhere:** [`FirstDayOfWeek`](calendar.md), [`PopupCloseEvent`](popup.md)
|