@nanahoshi/mona-ui 0.37.0 → 0.39.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.
Files changed (103) hide show
  1. package/docs/api/common.md +1 -1
  2. package/docs/api/date-picker.md +2 -0
  3. package/docs/api/date-range-picker.md +2 -0
  4. package/docs/api/datetime-picker.md +2 -0
  5. package/docs/api/dropdown-list.md +2 -0
  6. package/docs/api/dropdown-tree.md +81 -0
  7. package/docs/api/dropdowns.md +34 -8
  8. package/docs/api/i18n.md +33 -4
  9. package/docs/api/list.md +1 -1
  10. package/docs/api/locales.md +14 -14
  11. package/docs/api/multi-select-tree.md +75 -0
  12. package/docs/api/multi-select.md +3 -1
  13. package/docs/api/popup.md +1 -1
  14. package/docs/api/time-picker.md +2 -0
  15. package/docs/api/tree-view.md +2 -2
  16. package/docs/auto-complete.md +2 -0
  17. package/docs/combo-box.md +2 -0
  18. package/docs/date-picker.md +5 -1
  19. package/docs/date-range-picker.md +5 -1
  20. package/docs/datetime-picker.md +5 -1
  21. package/docs/dropdown-list.md +52 -0
  22. package/docs/dropdown-tree.md +427 -0
  23. package/docs/multi-select-tree.md +353 -0
  24. package/docs/multi-select.md +6 -0
  25. package/docs/time-picker.md +5 -1
  26. package/dropdown-tree/package.json +4 -0
  27. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +2 -2
  28. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +36 -2
  29. package/fesm2022/nanahoshi-mona-ui-date-range-picker.mjs +37 -3
  30. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +52 -5
  31. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +40 -5
  32. package/fesm2022/nanahoshi-mona-ui-dropdown-tree.mjs +1061 -0
  33. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +730 -60
  34. package/fesm2022/nanahoshi-mona-ui-editor.mjs +8 -2
  35. package/fesm2022/nanahoshi-mona-ui-filter.mjs +4 -0
  36. package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-S2iCn8TV.mjs → nanahoshi-mona-ui-grid-grid-list.component-BoSXXLKQ.mjs} +2 -2
  37. package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-BUJvgihp.mjs → nanahoshi-mona-ui-grid-grid-row.component-Df2gfS0X.mjs} +3 -1
  38. package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-Wndy-_Bt.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-xjrcCXXF.mjs} +2 -2
  39. package/fesm2022/nanahoshi-mona-ui-grid.mjs +8 -4
  40. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +13 -0
  41. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +80 -37
  42. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +7 -0
  43. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +7 -0
  44. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +7 -0
  45. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +7 -0
  46. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +7 -0
  47. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +7 -0
  48. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +7 -0
  49. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +7 -0
  50. package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +17 -0
  51. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +7 -0
  52. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +17 -0
  53. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +7 -0
  54. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +7 -0
  55. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +7 -0
  56. package/fesm2022/nanahoshi-mona-ui-multi-select-tree.mjs +1179 -0
  57. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +42 -7
  58. package/fesm2022/nanahoshi-mona-ui-pager.mjs +3 -1
  59. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +39 -4
  60. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +2 -1
  61. package/i18n/catalogs/en-US.messages.json +9 -0
  62. package/llms.txt +6 -2
  63. package/locales/ar-sa/ar-sa.messages.json +9 -0
  64. package/locales/de-de/de-de.messages.json +9 -0
  65. package/locales/es-es/es-es.messages.json +9 -0
  66. package/locales/fr-fr/fr-fr.messages.json +9 -0
  67. package/locales/id-id/id-id.messages.json +9 -0
  68. package/locales/it-it/it-it.messages.json +9 -0
  69. package/locales/ja-jp/ja-jp.messages.json +9 -0
  70. package/locales/ko-kr/ko-kr.messages.json +9 -0
  71. package/locales/pl-pl/pl-pl.messages.json +9 -0
  72. package/locales/pt-br/pt-br.messages.json +9 -0
  73. package/locales/ru-ru/ru-ru.messages.json +9 -0
  74. package/locales/tr-tr/tr-tr.messages.json +9 -0
  75. package/locales/zh-cn/zh-cn.messages.json +9 -0
  76. package/locales/zh-tw/zh-tw.messages.json +9 -0
  77. package/multi-select-tree/package.json +4 -0
  78. package/package.json +9 -1
  79. package/types/nanahoshi-mona-ui-date-picker.d.ts +25 -1
  80. package/types/nanahoshi-mona-ui-date-range-picker.d.ts +26 -1
  81. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +34 -1
  82. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +33 -5
  83. package/types/nanahoshi-mona-ui-dropdown-tree.d.ts +414 -0
  84. package/types/nanahoshi-mona-ui-dropdowns.d.ts +218 -9
  85. package/types/nanahoshi-mona-ui-i18n.d.ts +12 -0
  86. package/types/nanahoshi-mona-ui-internal-tree.d.ts +36 -0
  87. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +9 -0
  88. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +9 -0
  89. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +9 -0
  90. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +9 -0
  91. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +9 -0
  92. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +9 -0
  93. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +9 -0
  94. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +9 -0
  95. package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +9 -0
  96. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +9 -0
  97. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +9 -0
  98. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +9 -0
  99. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +9 -0
  100. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +9 -0
  101. package/types/nanahoshi-mona-ui-multi-select-tree.d.ts +456 -0
  102. package/types/nanahoshi-mona-ui-multi-select.d.ts +43 -7
  103. package/types/nanahoshi-mona-ui-time-picker.d.ts +29 -2
@@ -0,0 +1,353 @@
1
+ # Multi Select Tree
2
+
3
+ > A control that opens a tree with checkboxes and shows the checked items as removable tags.
4
+
5
+ Entry point: `@nanahoshi/mona-ui/multi-select-tree`
6
+
7
+ **Selector:** `mona-multi-select-tree`
8
+
9
+ `MultiSelectTreeComponent` is a combobox that opens a tree with checkboxes and shows the checked items as removable tags. Checking an item checks its children too, and an item whose children are all checked is checked itself, so a whole branch can be chosen at once.
10
+
11
+ ## Overview
12
+
13
+ Multi Select Tree renders a combobox whose popup is a tree with checkboxes. The checked items show as removable tags in the field, and the value lists them. The popup opens on click, `Enter`, `Space`, `ArrowDown` or `Alt+ArrowDown`, and stays open while items are checked.
14
+
15
+ Checking follows the tree:
16
+
17
+ - **`checkChildren`** (on by default): checking an item checks its children, and unchecking it unchecks them.
18
+ - **`checkParents`** (on by default): an item is checked when all its children are, and unchecked when one isn't. An item with some of its children checked shows a mixed checkbox.
19
+
20
+ The data takes the shapes of the [dropdown tree](dropdown-tree.md): hierarchical, with `children`, or flat, with `mode="flat"`, `idField` and `parentIdField`.
21
+
22
+ **Use Multi Select Tree when:**
23
+
24
+ - More than one item can be chosen from a hierarchy, such as permissions, regions or folders.
25
+
26
+ **Use `DropdownTree` instead when:**
27
+
28
+ - Exactly one item is chosen.
29
+
30
+ **Use `MultiSelect` instead when:**
31
+
32
+ - The options are a flat list.
33
+
34
+ ## Import & Quick Start
35
+
36
+ ```typescript
37
+ import { MultiSelectTreeComponent } from "@nanahoshi/mona-ui/multi-select-tree";
38
+ ```
39
+
40
+ ```typescript
41
+ protected readonly regions = [
42
+ {
43
+ code: "EU",
44
+ name: "Europe",
45
+ countries: [
46
+ { code: "DE", name: "Germany" },
47
+ { code: "FR", name: "France" }
48
+ ]
49
+ }
50
+ ];
51
+
52
+ protected readonly countries = signal<string[]>([]);
53
+ ```
54
+
55
+ ```html
56
+ <mona-form-field label="Ships to">
57
+ <mona-multi-select-tree
58
+ children="countries"
59
+ textField="name"
60
+ valueField="code"
61
+ [data]="regions"
62
+ [valuePrimitive]="true"
63
+ [(value)]="countries" />
64
+ </mona-form-field>
65
+ ```
66
+
67
+ ## Anatomy
68
+
69
+ Each template below is an `ng-template` placed inside `<mona-multi-select-tree>`.
70
+
71
+ | Directive | Selector | Template context | Replaces |
72
+ |------------------------------------------|--------------------------------------------------|------------------------------------------|-------------------------------------------------|
73
+ | `DropdownItemTemplateDirective` | `ng-template[monaMultiSelectTreeItemTemplate]` | `{ $implicit: TData }` (the node's item) | Each node's text in the popup |
74
+ | `MultiSelectTagTemplateDirective` | `ng-template[monaMultiSelectTagTemplate]` | `{ $implicit: TData }` (the tag's item) | Each tag's text |
75
+ | `MultiSelectSummaryTagTemplateDirective` | `ng-template[monaMultiSelectSummaryTagTemplate]` | `{ $implicit: value, tagCount: number }` | The summary tag's "+ n items" |
76
+ | `DropdownHeaderTemplateDirective` | `ng-template[monaMultiSelectTreeHeaderTemplate]` | None | No default; renders above the tree |
77
+ | `DropdownFooterTemplateDirective` | `ng-template[monaMultiSelectTreeFooterTemplate]` | None | No default; renders below the tree |
78
+ | `DropdownNoDataTemplateDirective` | `ng-template[monaMultiSelectTreeNoDataTemplate]` | None | "No data", or "No matching items" when filtered |
79
+ | `DropdownPrefixTemplateDirective` | `ng-template[monaDropdownPrefixTemplate]` | None | No default; renders before the tags |
80
+
81
+ The tag and summary tag directives, and `MultiSelectSummaryTagDirective`, come from `@nanahoshi/mona-ui/multi-select`, and the others from `@nanahoshi/mona-ui/dropdowns`. With a value whose items aren't loaded (and `valuePrimitive`), the tag template gets the value itself.
82
+
83
+ ## Examples
84
+
85
+ ### Granting permissions
86
+
87
+ Checking a group grants every permission in it, and a group whose permissions are all granted is checked itself. `monaMultiSelectSummaryTag` shows three tags and sums up the rest, and the filter box finds a permission by name. With `adaptiveMode="auto"`, the popup opens as a bottom sheet on a phone.
88
+
89
+ `permissions-example.component.ts`
90
+
91
+ ```typescript
92
+ import { Component, signal } from "@angular/core";
93
+ import { DropdownFilterableDirective } from "@nanahoshi/mona-ui/dropdowns";
94
+ import { FormFieldComponent } from "@nanahoshi/mona-ui/form-field";
95
+ import { MultiSelectSummaryTagDirective } from "@nanahoshi/mona-ui/multi-select";
96
+ import { MultiSelectTreeComponent } from "@nanahoshi/mona-ui/multi-select-tree";
97
+
98
+ interface Permission {
99
+ readonly id: string;
100
+ readonly label: string;
101
+ readonly permissions?: readonly Permission[];
102
+ }
103
+
104
+ @Component({
105
+ selector: "app-multi-select-tree-permissions-example",
106
+ imports: [
107
+ DropdownFilterableDirective,
108
+ FormFieldComponent,
109
+ MultiSelectSummaryTagDirective,
110
+ MultiSelectTreeComponent
111
+ ],
112
+ templateUrl: "./permissions-example.component.html"
113
+ })
114
+ export class MultiSelectTreePermissionsExampleComponent {
115
+ protected readonly granted = signal<string[]>(["orders.view", "orders.refund"]);
116
+ protected readonly permissions: readonly Permission[] = [
117
+ {
118
+ id: "orders",
119
+ label: "Orders",
120
+ permissions: [
121
+ { id: "orders.view", label: "View orders" },
122
+ { id: "orders.edit", label: "Edit orders" },
123
+ { id: "orders.refund", label: "Issue refunds" }
124
+ ]
125
+ },
126
+ {
127
+ id: "products",
128
+ label: "Products",
129
+ permissions: [
130
+ { id: "products.view", label: "View products" },
131
+ { id: "products.edit", label: "Edit products" },
132
+ { id: "products.prices", label: "Change prices" }
133
+ ]
134
+ },
135
+ {
136
+ id: "team",
137
+ label: "Team",
138
+ permissions: [
139
+ { id: "team.invite", label: "Invite members" },
140
+ { id: "team.roles", label: "Change roles" }
141
+ ]
142
+ }
143
+ ];
144
+ }
145
+ ```
146
+
147
+ `permissions-example.component.html`
148
+
149
+ ```html
150
+ <div class="flex max-w-md flex-col gap-2">
151
+ <mona-form-field label="Permissions" hint="Checking a group grants everything in it.">
152
+ <mona-multi-select-tree
153
+ adaptiveMode="auto"
154
+ children="permissions"
155
+ monaDropDownFilterable
156
+ placeholder="Grant permissions"
157
+ textField="label"
158
+ valueField="id"
159
+ [data]="permissions"
160
+ [monaMultiSelectSummaryTag]="3"
161
+ [showClearButton]="true"
162
+ [valuePrimitive]="true"
163
+ [(value)]="granted" />
164
+ </mona-form-field>
165
+ <span class="text-sm">Granted: {{ granted().join(", ") || "nothing" }}</span>
166
+ </div>
167
+ ```
168
+
169
+ ### Signal Forms integration
170
+
171
+ A `minLength` rule on the field asks for at least one country, and the form field shows its message once the field is touched. With `checkParents` off, checking every country of a region leaves the region itself unchecked. Checking the region still checks its countries, and adds the region to the value too.
172
+
173
+ `forms-example.component.ts`
174
+
175
+ ```typescript
176
+ import { Component, signal } from "@angular/core";
177
+ import { form, FormField, minLength } from "@angular/forms/signals";
178
+ import { FormFieldComponent } from "@nanahoshi/mona-ui/form-field";
179
+ import { MultiSelectTreeComponent } from "@nanahoshi/mona-ui/multi-select-tree";
180
+
181
+ interface Region {
182
+ readonly code: string;
183
+ readonly countries?: readonly Region[];
184
+ readonly name: string;
185
+ }
186
+
187
+ interface ShippingModel {
188
+ countries: string[];
189
+ }
190
+
191
+ @Component({
192
+ selector: "app-multi-select-tree-forms-example",
193
+ imports: [FormField, FormFieldComponent, MultiSelectTreeComponent],
194
+ templateUrl: "./forms-example.component.html"
195
+ })
196
+ export class MultiSelectTreeFormsExampleComponent {
197
+ readonly #model = signal<ShippingModel>({ countries: [] });
198
+ protected readonly regions: readonly Region[] = [
199
+ {
200
+ code: "EU",
201
+ name: "Europe",
202
+ countries: [
203
+ { code: "DE", name: "Germany" },
204
+ { code: "FR", name: "France" },
205
+ { code: "IT", name: "Italy" },
206
+ { code: "PL", name: "Poland" }
207
+ ]
208
+ },
209
+ {
210
+ code: "AS",
211
+ name: "Asia",
212
+ countries: [
213
+ { code: "JP", name: "Japan" },
214
+ { code: "KR", name: "South Korea" },
215
+ { code: "TR", name: "Türkiye" }
216
+ ]
217
+ }
218
+ ];
219
+ protected readonly shipping = form(this.#model, path => {
220
+ minLength(path.countries, 1, { message: "Choose at least one country." });
221
+ });
222
+ }
223
+ ```
224
+
225
+ `forms-example.component.html`
226
+
227
+ ```html
228
+ <mona-form-field class="max-w-md" label="Ships to" hint="Choose a region to ship to all its countries.">
229
+ <mona-multi-select-tree
230
+ children="countries"
231
+ textField="name"
232
+ valueField="code"
233
+ [checkParents]="false"
234
+ [data]="regions"
235
+ [formField]="shipping.countries"
236
+ [valuePrimitive]="true" />
237
+ </mona-form-field>
238
+ ```
239
+
240
+ ## Appearance & Styling
241
+
242
+ The multi-select tree has the sizes, corner roundings and states of the [multi-select](multi-select.md): `size` is `small`, `medium` (default) or `large`, and `rounded` is `none`, `small`, `medium` (default), `large` or `full`. The tags wrap onto more lines as items are checked, and the popup moves with the field's bottom edge.
243
+
244
+ | Input | What it does |
245
+ |-------------------|-------------------------------------------------------------------------------------------------------------------------------------------|
246
+ | `popupHeight` | The popup's maximum height; 200 pixels when unset. Shorter trees shrink to fit. |
247
+ | `popupWidth` | The popup's width; the field's width when unset. |
248
+ | `popupClass` | Classes added to the popup. |
249
+ | `showClearButton` | A button in the field that unchecks every item. |
250
+ | `adaptiveMode` | `"auto"` opens the popup as a bottom sheet on a small screen, as described for the [dropdown tree](dropdown-tree.md#on-a-phone). |
251
+
252
+ ## Behavior
253
+
254
+ ### The value's order
255
+
256
+ A change the user makes lists the checked items in the tree's order. A value set from code keeps its own order until the next change, and a value item whose node isn't loaded yet stays in the value, after the loaded ones.
257
+
258
+ ### Tags
259
+
260
+ Each checked item has a tag. A tag's remove button unchecks its item as the tree does, so removing a group's tag unchecks the group's items with `checkChildren`. The summary tag's remove button unchecks only the items it stands for. `Backspace` in the field unchecks the item of the last tag.
261
+
262
+ ### Clicking a node checks it
263
+
264
+ A click anywhere on a node's row checks or unchecks it, as a click on its checkbox does, and the popup stays open. The arrow on a node opens and closes it. A disabled item (`itemDisabled`) can't be checked or opened, and checking its parent leaves it as it is.
265
+
266
+ ### Derived parents
267
+
268
+ With `checkParents`, an item whose children are all in a value set from code shows checked in the tree, but it joins the value only with the user's next change.
269
+
270
+ ### `open` and `close` are cancelable
271
+
272
+ `open` and `close` emit a `PreventableEvent`; calling `preventDefault()` keeps the popup as it is. `opened` and `closed` follow once it has opened or closed.
273
+
274
+ ## Forms Integration
275
+
276
+ The multi-select tree implements `FormValueControl<Iterable<TValue>>`, so `[formField]` binds it to a signal form field, which then sets `disabled`, `readonly`, `required`, `invalid` and `touched`. With `required`, it's invalid while nothing is checked. It also works with `[(ngModel)]` and reactive forms; a `null` value means nothing is checked.
277
+
278
+ ## Accessibility
279
+
280
+ ### Keyboard
281
+
282
+ | Key | When | Action |
283
+ |-----------------------------------------------------------|--------|---------------------------------------------------------------------------------|
284
+ | `Enter`, `Space`, `ArrowDown`, `ArrowUp`, `Alt+ArrowDown` | Closed | Opens the popup |
285
+ | `ArrowDown` / `ArrowUp` | Open | Moves to the next or previous visible node |
286
+ | `ArrowRight` | Open | Opens a closed node, or moves to its first child (`ArrowLeft` in right-to-left) |
287
+ | `ArrowLeft` | Open | Closes an open node, or moves to its parent (`ArrowRight` in right-to-left) |
288
+ | `Home` / `End` | Open | Moves to the first or last visible node |
289
+ | `*` | Open | Opens the active node's siblings |
290
+ | Letters and digits | Open | Moves to the next node whose text starts with them |
291
+ | `Enter` / `Space` | Open | Checks or unchecks the active node |
292
+ | `Backspace` | Any | Unchecks the item of the last tag |
293
+ | `Escape`, `Alt+ArrowUp` | Open | Closes the popup |
294
+ | `Tab` | Open | Closes the popup and moves focus on |
295
+
296
+ In the filter box, `ArrowDown`, `ArrowUp` and `Enter` work as above, and the other keys edit the text.
297
+
298
+ ### Focus
299
+
300
+ Focus stays on the field while the popup is open; the active node is shown with a focus ring and announced through `aria-activedescendant`. With a filter box, focus moves into it when the popup opens, and returns to the field when the popup closes. Tags and their remove buttons aren't Tab stops: `Backspace` removes tags from the keyboard.
301
+
302
+ ### ARIA
303
+
304
+ - The field has `role="combobox"`, `aria-haspopup="tree"`, `aria-expanded`, and `aria-controls` pointing at the tree. It's named by `aria-label`, `aria-labelledby`, a form field's label or, failing those, the placeholder.
305
+ - The popup's tree has `role="tree"` and the field's name. Its nodes are `treeitem`s with `aria-checked` (`mixed` for a partly checked parent), `aria-level`, `aria-setsize`, `aria-posinset` and `aria-expanded` on nodes with children. A disabled node has `aria-disabled`.
306
+ - Each tag's remove button is named "Remove" and the item's text, and the summary tag's "Remove n more items".
307
+ - The filter box is a combobox too, named "Filter" and the field's name. How many items match is announced as the filter changes.
308
+
309
+ ## API
310
+
311
+ Everything below is imported from `@nanahoshi/mona-ui/multi-select-tree`, unless a table names another entry point. Each name links to its reference page, with every input, output, property and method.
312
+
313
+ | Name | Kind |
314
+ | --- | --- |
315
+ | [`MultiSelectTreeComponent`](api/multi-select-tree.md#multiselecttreecomponent) | Component |
316
+
317
+ From `@nanahoshi/mona-ui/dropdowns`:
318
+
319
+ | Name | Kind |
320
+ | --- | --- |
321
+ | [`DropdownFilterableDirective`](api/dropdowns.md#dropdownfilterabledirective) | Directive |
322
+ | [`DropdownGroupableDirective`](api/dropdowns.md#dropdowngroupabledirective) | Directive |
323
+ | [`DropdownVirtualScrollDirective`](api/dropdowns.md#dropdownvirtualscrolldirective) | Directive |
324
+ | [`DropdownDataHandlerDirective`](api/dropdowns.md#dropdowndatahandlerdirective) | Directive |
325
+ | [`DropdownFooterTemplateDirective`](api/dropdowns.md#dropdownfootertemplatedirective) | Directive |
326
+ | [`DropdownGroupHeaderTemplateDirective`](api/dropdowns.md#dropdowngroupheadertemplatedirective) | Directive |
327
+ | [`DropdownHeaderTemplateDirective`](api/dropdowns.md#dropdownheadertemplatedirective) | Directive |
328
+ | [`DropdownItemTemplateDirective`](api/dropdowns.md#dropdownitemtemplatedirective) | Directive |
329
+ | [`DropdownListPopupHandlerDirective`](api/dropdowns.md#dropdownlistpopuphandlerdirective) | Directive |
330
+ | [`DropdownNoDataTemplateDirective`](api/dropdowns.md#dropdownnodatatemplatedirective) | Directive |
331
+ | [`DropdownPrefixTemplateDirective`](api/dropdowns.md#dropdownprefixtemplatedirective) | Directive |
332
+ | [`DropdownSuffixTemplateDirective`](api/dropdowns.md#dropdownsuffixtemplatedirective) | Directive |
333
+ | [`DropdownListService`](api/dropdowns.md#dropdownlistservice) | Service |
334
+
335
+ ### Types
336
+
337
+ | Type | Kind |
338
+ | --- | --- |
339
+ | [`MULTI_SELECT_TREE_DEFAULT_MESSAGES`](api/multi-select-tree.md#multi-select-tree-default-messages) | Constant |
340
+
341
+ From `@nanahoshi/mona-ui/dropdowns`:
342
+
343
+ | Type | Kind | Description |
344
+ | --- | --- | --- |
345
+ | [`DropdownDataInputToken`](api/dropdowns.md#dropdowndatainputtoken) | Constant | **Deprecated.** Use `DROPDOWN_DATA_INPUT_TOKEN`. |
346
+ | [`DROPDOWNS_DEFAULT_MESSAGES`](api/dropdowns.md#dropdowns-default-messages) | Constant | |
347
+ | [`DropdownDataInput`](api/dropdowns.md#dropdowndatainput) | Interface | |
348
+ | [`DropdownSheetData`](api/dropdowns.md#dropdownsheetdata) | Interface | What a dropdown passes to the bottom sheet its popup opens as. |
349
+ | [`AdaptiveMode`](api/dropdowns.md#adaptivemode) | Type alias | How a dropdown's popup adapts to a small screen: `"auto"` opens it as a sheet along the bottom of the screen when the screen is narrower than 640 pixels, and `"none"` always opens it under the field. |
350
+ | [`DropdownFieldPredicateType`](api/dropdowns.md#dropdownfieldpredicatetype) | Type alias | |
351
+ | [`DropdownFieldSelectorType`](api/dropdowns.md#dropdownfieldselectortype) | Type alias | |
352
+
353
+ **Related types:** [`ChildrenSelector`](api/tree-view.md#childrenselector), [`DataStructure`](api/tree-view.md#datastructure), [`FilterableOptions`](api/common.md#filterableoptions), [`FilterChangeEvent`](api/common.md#filterchangeevent), [`GroupableOptions`](api/grid.md#groupableoptions), [`ListItem`](api/list.md#listitem), [`ListSizeInputType`](api/list.md#listsizeinputtype), [`ListSizeType`](api/list.md#listsizetype), [`MonaDropdownsMessages`](api/i18n.md#monadropdownsmessages), [`MonaMultiSelectTreeMessages`](api/i18n.md#monamultiselecttreemessages), [`PopupCloseEvent`](api/popup.md#popupcloseevent), [`PreventableEvent`](api/common.md#preventableevent), [`VirtualScrollOptions`](api/common.md#virtualscrolloptions)
@@ -459,6 +459,10 @@ With nothing highlighted, such as when the filter matches no option, Enter in th
459
459
  - It's left out while the filter leaves no enabled option, and with `autoClose` the popup closes after it as after any option.
460
460
  - It counts among the options, in the position screen readers announce. Its text is the multi-select's `selectAll` message.
461
461
 
462
+ ### On a phone
463
+
464
+ With `adaptiveMode="auto"`, on a screen narrower than 640 pixels, the popup opens as a bottom sheet with the field's name (or `adaptiveTitle`) and a close button, as described for the [dropdown list](dropdown-list.md#the-bottom-sheet). The popup stays open while options are chosen, so the sheet does too.
465
+
462
466
  ### `showClearButton` clears every selection
463
467
 
464
468
  `showClearButton` renders a single clear button that removes all selected items at once, not one at a time.
@@ -560,6 +564,8 @@ From `@nanahoshi/mona-ui/dropdowns`:
560
564
  | [`DropdownDataInputToken`](api/dropdowns.md#dropdowndatainputtoken) | Constant | **Deprecated.** Use `DROPDOWN_DATA_INPUT_TOKEN`. |
561
565
  | [`DROPDOWNS_DEFAULT_MESSAGES`](api/dropdowns.md#dropdowns-default-messages) | Constant | |
562
566
  | [`DropdownDataInput`](api/dropdowns.md#dropdowndatainput) | Interface | |
567
+ | [`DropdownSheetData`](api/dropdowns.md#dropdownsheetdata) | Interface | What a dropdown passes to the bottom sheet its popup opens as. |
568
+ | [`AdaptiveMode`](api/dropdowns.md#adaptivemode) | Type alias | How a dropdown's popup adapts to a small screen: `"auto"` opens it as a sheet along the bottom of the screen when the screen is narrower than 640 pixels, and `"none"` always opens it under the field. |
563
569
  | [`DropdownFieldPredicateType`](api/dropdowns.md#dropdownfieldpredicatetype) | Type alias | |
564
570
  | [`DropdownFieldSelectorType`](api/dropdowns.md#dropdownfieldselectortype) | Type alias | |
565
571
 
@@ -63,6 +63,10 @@ Typed text is written to `value` on `Enter` and when the input loses focus, on t
63
63
 
64
64
  The popup holds a `mona-time-selector`. Choosing items in its lists moves the shown time; the **Set** button, `Enter` or `Space` writes it to `value` and closes the popup. The **Now** button moves the lists to the current time. A time outside `min` and `max` is moved inside them when it is set.
65
65
 
66
+ ### On a phone
67
+
68
+ With `adaptiveMode="auto"`, on a screen narrower than 640 pixels, the time lists open as a sheet along the bottom of the screen, over a dimmed page, as described for the [dropdown list](dropdown-list.md#the-bottom-sheet). The sheet has the field's name, or `adaptiveTitle`, and a close button, and its lists use the large size, to be easy to scroll and tap. Focus moves into the lists, as it does in the popup under the field, and goes back to the input when the sheet closes.
69
+
66
70
  ### Disabled and read-only
67
71
 
68
72
  `disabled` and `readonly` keep the popup from opening. `readonlyInput` blocks typing but keeps the popup button working, so the time can only be picked.
@@ -146,4 +150,4 @@ Everything below is imported from `@nanahoshi/mona-ui/time-picker`. Each name li
146
150
  | --- | --- |
147
151
  | [`TIME_PICKER_DEFAULT_MESSAGES`](api/time-picker.md#time-picker-default-messages) | Constant |
148
152
 
149
- **Related types:** [`HourFormat`](api/date-input.md#hourformat), [`ListSizeInputType`](api/list.md#listsizeinputtype), [`ListSizeType`](api/list.md#listsizetype), [`MonaTimePickerMessages`](api/i18n.md#monatimepickermessages), [`PopupCloseEvent`](api/popup.md#popupcloseevent), [`PreventableEvent`](api/common.md#preventableevent)
153
+ **Related types:** [`AdaptiveMode`](api/dropdowns.md#adaptivemode), [`HourFormat`](api/date-input.md#hourformat), [`ListSizeInputType`](api/list.md#listsizeinputtype), [`ListSizeType`](api/list.md#listsizetype), [`MonaTimePickerMessages`](api/i18n.md#monatimepickermessages), [`PopupCloseEvent`](api/popup.md#popupcloseevent), [`PreventableEvent`](api/common.md#preventableevent)
@@ -0,0 +1,4 @@
1
+ {
2
+ "module": "../fesm2022/nanahoshi-mona-ui-dropdown-tree.mjs",
3
+ "typings": "../types/nanahoshi-mona-ui-dropdown-tree.d.ts"
4
+ }
@@ -1973,7 +1973,7 @@ var CalendarComponent = class CalendarComponent {
1973
1973
  }
1974
1974
  ],
1975
1975
  ngImport: i0,
1976
- template: "<div [class]=\"headerClass()\">\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"'small'\"\n [disabled]=\"effectiveDisabled() || todayUnavailable()\"\n (click)=\"onTodayButtonClick()\"\n [attr.aria-label]=\"todayButtonLabel()\">\n <span>{{ messages().today }}</span>\n </button>\n @switch (calendarView()) {\n @case (\"month\") {\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onViewChangeClick('year')\"\n [attr.aria-label]=\"viewSwitchButtonLabel()\">\n <span\n class=\"font-semibold text-[var(--mona-primary-text-color,var(--color-primary))]\"\n [id]=\"gridId + '-heading'\"\n >{{ headerMonthYear() }}</span\n >\n </button>\n }\n @case (\"year\") {\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onViewChangeClick('decade')\"\n [attr.aria-label]=\"viewSwitchButtonLabel()\">\n <span\n class=\"font-semibold text-[var(--mona-primary-text-color,var(--color-primary))]\"\n [id]=\"gridId + '-heading'\"\n >{{ headerYear() }}</span\n >\n </button>\n }\n @case (\"decade\") {\n <!-- The decade is the top view, so its heading isn't a button. It names the grid with the locale's\n wording of the range, and shows the digits. -->\n <span\n class=\"inline-flex h-9 items-center px-4 text-sm font-semibold text-[var(--mona-primary-text-color,var(--color-primary))]\"\n [id]=\"gridId + '-heading'\"\n ><span aria-hidden=\"true\">{{ formatInteger(decadeStart()) }} - {{ formatInteger(decadeEnd()) }}</span\n ><span class=\"sr-only\">{{ viewSwitchButtonLabel() }}</span></span\n >\n }\n }\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [iconOnly]=\"true\"\n [size]=\"'small'\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onNavigationClick('prev')\"\n [attr.aria-label]=\"prevButtonLabel()\">\n <svg lucideChevronLeft class=\"rtl:rotate-180\"></svg>\n </button>\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [iconOnly]=\"true\"\n [size]=\"'small'\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onNavigationClick('next')\"\n [attr.aria-label]=\"nextButtonLabel()\">\n <svg lucideChevronRight class=\"rtl:rotate-180\"></svg>\n </button>\n</div>\n\n<div aria-live=\"polite\" aria-atomic=\"true\" class=\"sr-only\">{{ ariaLabel() }}</div>\n\n@if (calendarView() === \"month\") {\n @let columnCount = weekNumber() ? 8 : 7;\n @let multipleMonths = monthGrids().length > 1;\n <div [class]=\"monthViewClass\">\n @for (grid of monthGrids(); track grid.key) {\n <div class=\"flex flex-col\">\n @if (multipleMonths) {\n <div [class]=\"monthCaptionClass\" [id]=\"grid.captionId\">{{ grid.caption }}</div>\n }\n <div\n role=\"grid\"\n class=\"flex flex-col gap-0.5\"\n [attr.aria-labelledby]=\"multipleMonths ? grid.captionId : gridId + '-heading'\"\n [attr.aria-disabled]=\"effectiveDisabled() || null\"\n [attr.aria-invalid]=\"invalidState() ? 'true' : null\"\n [attr.aria-readonly]=\"readonly() || null\"\n (pointerleave)=\"onMonthGridPointerLeave()\">\n <div\n role=\"row\"\n [class]=\"monthGridHeaderClass()\"\n [style.grid-template-columns]=\"`repeat(${columnCount}, 32px)`\">\n @if (weekNumber()) {\n <!-- Week numbers are visual only: every day is already named by its full date. -->\n <div aria-hidden=\"true\"></div>\n }\n @for (day of weekdays(); track day.full) {\n <div role=\"columnheader\">\n <span aria-hidden=\"true\">{{ day.display }}</span>\n <span class=\"sr-only\">{{ day.full }}</span>\n </div>\n }\n </div>\n @for (week of grid.weeks; track week.key) {\n <div\n role=\"row\"\n [class]=\"monthGridClass()\"\n [style.grid-template-columns]=\"`repeat(${columnCount}, 32px)`\">\n @if (weekNumber()) {\n <div aria-hidden=\"true\">{{ formatInteger(week.weekNumber) }}</div>\n }\n <!-- Track by time: the months are rebuilt with new Date objects on every navigation. -->\n @for (entry of week.days; track entry ? entry.key.getTime() : -$index - 1) {\n @if (entry) {\n <div\n (dayPointerEnter)=\"onDayPointerEnter($event)\"\n (daySelect)=\"onDayClick($event.date, $event.event)\"\n monaMonthDay\n [disabled]=\"effectiveDisabled()\"\n [isDayUnavailable]=\"isDayUnavailable()\"\n [monthBounds]=\"grid.bounds\"\n [navigatedDate]=\"navigatedDate()\"\n [rangeEnds]=\"rangeEnds()\"\n [rangePreviewKeys]=\"rangePreviewKeys()\"\n [rounded]=\"rounded()\"\n [selectedKeys]=\"selectedKeys()\"\n [today]=\"today()\"\n [entry]=\"entry\">\n @if (monthCellTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"monthCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{\n $implicit: entry.value,\n date: entry.key\n }\"></ng-container>\n } @else {\n <span>{{ formatInteger(entry.value) }}</span>\n }\n </div>\n } @else {\n <!-- A day of the month before or after, shown in its own month instead. -->\n <div role=\"gridcell\"></div>\n }\n }\n </div>\n }\n </div>\n </div>\n }\n </div>\n} @else if (calendarView() === \"year\") {\n <div role=\"grid\" class=\"flex flex-col gap-0.5\" [attr.aria-labelledby]=\"gridId + '-heading'\">\n @for (row of yearViewMonths(); track $index) {\n <div role=\"row\" [class]=\"yearGridClass()\">\n @for (monthItem of row; track monthItem) {\n <div\n (click)=\"!effectiveDisabled() && onMonthClick(monthItem[0])\"\n monaYearMonth\n [disabled]=\"effectiveDisabled()\"\n [month]=\"monthItem[0]\"\n [navigatedDate]=\"navigatedDate()\"\n [rounded]=\"rounded()\"\n [selectedDate]=\"selectedDates()[0]\">\n @if (yearCellTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"yearCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: monthItem[0], text: monthItem[1] }\">\n </ng-container>\n } @else {\n <span>{{ monthItem[1] }}</span>\n }\n </div>\n }\n </div>\n }\n </div>\n} @else if (calendarView() === \"decade\") {\n <div role=\"grid\" class=\"flex flex-col gap-0.5\" [attr.aria-labelledby]=\"gridId + '-heading'\">\n @for (row of decadeYears(); track $index) {\n <div role=\"row\" [class]=\"decadeGridClass()\">\n @for (year of row; track year) {\n <div\n (click)=\"!effectiveDisabled() && onYearClick(year)\"\n monaDecadeYear\n [disabled]=\"effectiveDisabled()\"\n [navigatedDate]=\"navigatedDate()\"\n [rounded]=\"rounded()\"\n [year]=\"year\"\n [selectedDate]=\"selectedDates()[0]\">\n @if (decadeCellTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"decadeCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year }\">\n </ng-container>\n } @else {\n <span>{{ formatInteger(year) }}</span>\n }\n </div>\n }\n </div>\n }\n </div>\n}\n",
1976
+ template: "<div [class]=\"headerClass()\">\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"'small'\"\n [disabled]=\"effectiveDisabled() || todayUnavailable()\"\n (click)=\"onTodayButtonClick()\"\n [attr.aria-label]=\"todayButtonLabel()\">\n <span>{{ messages().today }}</span>\n </button>\n @switch (calendarView()) {\n @case (\"month\") {\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onViewChangeClick('year')\"\n [attr.aria-label]=\"viewSwitchButtonLabel()\">\n <span\n class=\"font-semibold text-[var(--mona-primary-text-color,var(--color-primary))]\"\n [id]=\"gridId + '-heading'\"\n >{{ headerMonthYear() }}</span\n >\n </button>\n }\n @case (\"year\") {\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onViewChangeClick('decade')\"\n [attr.aria-label]=\"viewSwitchButtonLabel()\">\n <span\n class=\"font-semibold text-[var(--mona-primary-text-color,var(--color-primary))]\"\n [id]=\"gridId + '-heading'\"\n >{{ headerYear() }}</span\n >\n </button>\n }\n @case (\"decade\") {\n <!-- The decade is the top view, so its heading isn't a button. It names the grid with the locale's\n wording of the range, and shows the digits. -->\n <span\n class=\"inline-flex h-9 items-center px-4 text-sm font-semibold text-[var(--mona-primary-text-color,var(--color-primary))]\"\n [id]=\"gridId + '-heading'\"\n ><span aria-hidden=\"true\">{{ formatInteger(decadeStart()) }} - {{ formatInteger(decadeEnd()) }}</span\n ><span class=\"sr-only\">{{ viewSwitchButtonLabel() }}</span></span\n >\n }\n }\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [iconOnly]=\"true\"\n [size]=\"'small'\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onNavigationClick('prev')\"\n [attr.aria-label]=\"prevButtonLabel()\">\n <svg lucideChevronLeft class=\"rtl:rotate-180\"></svg>\n </button>\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [iconOnly]=\"true\"\n [size]=\"'small'\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onNavigationClick('next')\"\n [attr.aria-label]=\"nextButtonLabel()\">\n <svg lucideChevronRight class=\"rtl:rotate-180\"></svg>\n </button>\n</div>\n\n<div aria-live=\"polite\" aria-atomic=\"true\" class=\"sr-only\">{{ ariaLabel() }}</div>\n\n@if (calendarView() === \"month\") {\n @let columnCount = weekNumber() ? 8 : 7;\n @let multipleMonths = monthGrids().length > 1;\n <div [class]=\"monthViewClass\">\n @for (grid of monthGrids(); track grid.key) {\n <div class=\"flex flex-col\">\n @if (multipleMonths) {\n <div [class]=\"monthCaptionClass\" [id]=\"grid.captionId\">{{ grid.caption }}</div>\n }\n <div\n role=\"grid\"\n class=\"flex flex-col gap-0.5\"\n [attr.aria-labelledby]=\"multipleMonths ? grid.captionId : gridId + '-heading'\"\n [attr.aria-disabled]=\"effectiveDisabled() || null\"\n [attr.aria-invalid]=\"invalidState() ? 'true' : null\"\n [attr.aria-readonly]=\"readonly() || null\"\n (pointerleave)=\"onMonthGridPointerLeave()\">\n <div\n role=\"row\"\n [class]=\"monthGridHeaderClass()\"\n [style.grid-template-columns]=\"`repeat(${columnCount}, var(--mona-calendar-cell-size, 32px))`\">\n @if (weekNumber()) {\n <!-- Week numbers are visual only: every day is already named by its full date. -->\n <div aria-hidden=\"true\"></div>\n }\n @for (day of weekdays(); track day.full) {\n <div role=\"columnheader\">\n <span aria-hidden=\"true\">{{ day.display }}</span>\n <span class=\"sr-only\">{{ day.full }}</span>\n </div>\n }\n </div>\n @for (week of grid.weeks; track week.key) {\n <div\n role=\"row\"\n [class]=\"monthGridClass()\"\n [style.grid-template-columns]=\"`repeat(${columnCount}, var(--mona-calendar-cell-size, 32px))`\">\n @if (weekNumber()) {\n <div aria-hidden=\"true\">{{ formatInteger(week.weekNumber) }}</div>\n }\n <!-- Track by time: the months are rebuilt with new Date objects on every navigation. -->\n @for (entry of week.days; track entry ? entry.key.getTime() : -$index - 1) {\n @if (entry) {\n <div\n (dayPointerEnter)=\"onDayPointerEnter($event)\"\n (daySelect)=\"onDayClick($event.date, $event.event)\"\n monaMonthDay\n [disabled]=\"effectiveDisabled()\"\n [isDayUnavailable]=\"isDayUnavailable()\"\n [monthBounds]=\"grid.bounds\"\n [navigatedDate]=\"navigatedDate()\"\n [rangeEnds]=\"rangeEnds()\"\n [rangePreviewKeys]=\"rangePreviewKeys()\"\n [rounded]=\"rounded()\"\n [selectedKeys]=\"selectedKeys()\"\n [today]=\"today()\"\n [entry]=\"entry\">\n @if (monthCellTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"monthCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{\n $implicit: entry.value,\n date: entry.key\n }\"></ng-container>\n } @else {\n <span>{{ formatInteger(entry.value) }}</span>\n }\n </div>\n } @else {\n <!-- A day of the month before or after, shown in its own month instead. -->\n <div role=\"gridcell\"></div>\n }\n }\n </div>\n }\n </div>\n </div>\n }\n </div>\n} @else if (calendarView() === \"year\") {\n <div role=\"grid\" class=\"flex flex-col gap-0.5\" [attr.aria-labelledby]=\"gridId + '-heading'\">\n @for (row of yearViewMonths(); track $index) {\n <div role=\"row\" [class]=\"yearGridClass()\">\n @for (monthItem of row; track monthItem) {\n <div\n (click)=\"!effectiveDisabled() && onMonthClick(monthItem[0])\"\n monaYearMonth\n [disabled]=\"effectiveDisabled()\"\n [month]=\"monthItem[0]\"\n [navigatedDate]=\"navigatedDate()\"\n [rounded]=\"rounded()\"\n [selectedDate]=\"selectedDates()[0]\">\n @if (yearCellTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"yearCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: monthItem[0], text: monthItem[1] }\">\n </ng-container>\n } @else {\n <span>{{ monthItem[1] }}</span>\n }\n </div>\n }\n </div>\n }\n </div>\n} @else if (calendarView() === \"decade\") {\n <div role=\"grid\" class=\"flex flex-col gap-0.5\" [attr.aria-labelledby]=\"gridId + '-heading'\">\n @for (row of decadeYears(); track $index) {\n <div role=\"row\" [class]=\"decadeGridClass()\">\n @for (year of row; track year) {\n <div\n (click)=\"!effectiveDisabled() && onYearClick(year)\"\n monaDecadeYear\n [disabled]=\"effectiveDisabled()\"\n [navigatedDate]=\"navigatedDate()\"\n [rounded]=\"rounded()\"\n [year]=\"year\"\n [selectedDate]=\"selectedDates()[0]\">\n @if (decadeCellTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"decadeCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year }\">\n </ng-container>\n } @else {\n <span>{{ formatInteger(year) }}</span>\n }\n </div>\n }\n </div>\n }\n </div>\n}\n",
1977
1977
  dependencies: [
1978
1978
  {
1979
1979
  kind: "directive",
@@ -2089,7 +2089,7 @@ i0.ɵɵngDeclareClassMetadata({
2089
2089
  "(focusin)": "refreshToday()",
2090
2090
  "(focusout)": "onFocusOut($event)"
2091
2091
  },
2092
- template: "<div [class]=\"headerClass()\">\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"'small'\"\n [disabled]=\"effectiveDisabled() || todayUnavailable()\"\n (click)=\"onTodayButtonClick()\"\n [attr.aria-label]=\"todayButtonLabel()\">\n <span>{{ messages().today }}</span>\n </button>\n @switch (calendarView()) {\n @case (\"month\") {\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onViewChangeClick('year')\"\n [attr.aria-label]=\"viewSwitchButtonLabel()\">\n <span\n class=\"font-semibold text-[var(--mona-primary-text-color,var(--color-primary))]\"\n [id]=\"gridId + '-heading'\"\n >{{ headerMonthYear() }}</span\n >\n </button>\n }\n @case (\"year\") {\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onViewChangeClick('decade')\"\n [attr.aria-label]=\"viewSwitchButtonLabel()\">\n <span\n class=\"font-semibold text-[var(--mona-primary-text-color,var(--color-primary))]\"\n [id]=\"gridId + '-heading'\"\n >{{ headerYear() }}</span\n >\n </button>\n }\n @case (\"decade\") {\n <!-- The decade is the top view, so its heading isn't a button. It names the grid with the locale's\n wording of the range, and shows the digits. -->\n <span\n class=\"inline-flex h-9 items-center px-4 text-sm font-semibold text-[var(--mona-primary-text-color,var(--color-primary))]\"\n [id]=\"gridId + '-heading'\"\n ><span aria-hidden=\"true\">{{ formatInteger(decadeStart()) }} - {{ formatInteger(decadeEnd()) }}</span\n ><span class=\"sr-only\">{{ viewSwitchButtonLabel() }}</span></span\n >\n }\n }\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [iconOnly]=\"true\"\n [size]=\"'small'\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onNavigationClick('prev')\"\n [attr.aria-label]=\"prevButtonLabel()\">\n <svg lucideChevronLeft class=\"rtl:rotate-180\"></svg>\n </button>\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [iconOnly]=\"true\"\n [size]=\"'small'\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onNavigationClick('next')\"\n [attr.aria-label]=\"nextButtonLabel()\">\n <svg lucideChevronRight class=\"rtl:rotate-180\"></svg>\n </button>\n</div>\n\n<div aria-live=\"polite\" aria-atomic=\"true\" class=\"sr-only\">{{ ariaLabel() }}</div>\n\n@if (calendarView() === \"month\") {\n @let columnCount = weekNumber() ? 8 : 7;\n @let multipleMonths = monthGrids().length > 1;\n <div [class]=\"monthViewClass\">\n @for (grid of monthGrids(); track grid.key) {\n <div class=\"flex flex-col\">\n @if (multipleMonths) {\n <div [class]=\"monthCaptionClass\" [id]=\"grid.captionId\">{{ grid.caption }}</div>\n }\n <div\n role=\"grid\"\n class=\"flex flex-col gap-0.5\"\n [attr.aria-labelledby]=\"multipleMonths ? grid.captionId : gridId + '-heading'\"\n [attr.aria-disabled]=\"effectiveDisabled() || null\"\n [attr.aria-invalid]=\"invalidState() ? 'true' : null\"\n [attr.aria-readonly]=\"readonly() || null\"\n (pointerleave)=\"onMonthGridPointerLeave()\">\n <div\n role=\"row\"\n [class]=\"monthGridHeaderClass()\"\n [style.grid-template-columns]=\"`repeat(${columnCount}, 32px)`\">\n @if (weekNumber()) {\n <!-- Week numbers are visual only: every day is already named by its full date. -->\n <div aria-hidden=\"true\"></div>\n }\n @for (day of weekdays(); track day.full) {\n <div role=\"columnheader\">\n <span aria-hidden=\"true\">{{ day.display }}</span>\n <span class=\"sr-only\">{{ day.full }}</span>\n </div>\n }\n </div>\n @for (week of grid.weeks; track week.key) {\n <div\n role=\"row\"\n [class]=\"monthGridClass()\"\n [style.grid-template-columns]=\"`repeat(${columnCount}, 32px)`\">\n @if (weekNumber()) {\n <div aria-hidden=\"true\">{{ formatInteger(week.weekNumber) }}</div>\n }\n <!-- Track by time: the months are rebuilt with new Date objects on every navigation. -->\n @for (entry of week.days; track entry ? entry.key.getTime() : -$index - 1) {\n @if (entry) {\n <div\n (dayPointerEnter)=\"onDayPointerEnter($event)\"\n (daySelect)=\"onDayClick($event.date, $event.event)\"\n monaMonthDay\n [disabled]=\"effectiveDisabled()\"\n [isDayUnavailable]=\"isDayUnavailable()\"\n [monthBounds]=\"grid.bounds\"\n [navigatedDate]=\"navigatedDate()\"\n [rangeEnds]=\"rangeEnds()\"\n [rangePreviewKeys]=\"rangePreviewKeys()\"\n [rounded]=\"rounded()\"\n [selectedKeys]=\"selectedKeys()\"\n [today]=\"today()\"\n [entry]=\"entry\">\n @if (monthCellTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"monthCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{\n $implicit: entry.value,\n date: entry.key\n }\"></ng-container>\n } @else {\n <span>{{ formatInteger(entry.value) }}</span>\n }\n </div>\n } @else {\n <!-- A day of the month before or after, shown in its own month instead. -->\n <div role=\"gridcell\"></div>\n }\n }\n </div>\n }\n </div>\n </div>\n }\n </div>\n} @else if (calendarView() === \"year\") {\n <div role=\"grid\" class=\"flex flex-col gap-0.5\" [attr.aria-labelledby]=\"gridId + '-heading'\">\n @for (row of yearViewMonths(); track $index) {\n <div role=\"row\" [class]=\"yearGridClass()\">\n @for (monthItem of row; track monthItem) {\n <div\n (click)=\"!effectiveDisabled() && onMonthClick(monthItem[0])\"\n monaYearMonth\n [disabled]=\"effectiveDisabled()\"\n [month]=\"monthItem[0]\"\n [navigatedDate]=\"navigatedDate()\"\n [rounded]=\"rounded()\"\n [selectedDate]=\"selectedDates()[0]\">\n @if (yearCellTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"yearCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: monthItem[0], text: monthItem[1] }\">\n </ng-container>\n } @else {\n <span>{{ monthItem[1] }}</span>\n }\n </div>\n }\n </div>\n }\n </div>\n} @else if (calendarView() === \"decade\") {\n <div role=\"grid\" class=\"flex flex-col gap-0.5\" [attr.aria-labelledby]=\"gridId + '-heading'\">\n @for (row of decadeYears(); track $index) {\n <div role=\"row\" [class]=\"decadeGridClass()\">\n @for (year of row; track year) {\n <div\n (click)=\"!effectiveDisabled() && onYearClick(year)\"\n monaDecadeYear\n [disabled]=\"effectiveDisabled()\"\n [navigatedDate]=\"navigatedDate()\"\n [rounded]=\"rounded()\"\n [year]=\"year\"\n [selectedDate]=\"selectedDates()[0]\">\n @if (decadeCellTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"decadeCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year }\">\n </ng-container>\n } @else {\n <span>{{ formatInteger(year) }}</span>\n }\n </div>\n }\n </div>\n }\n </div>\n}\n"
2092
+ template: "<div [class]=\"headerClass()\">\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"'small'\"\n [disabled]=\"effectiveDisabled() || todayUnavailable()\"\n (click)=\"onTodayButtonClick()\"\n [attr.aria-label]=\"todayButtonLabel()\">\n <span>{{ messages().today }}</span>\n </button>\n @switch (calendarView()) {\n @case (\"month\") {\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onViewChangeClick('year')\"\n [attr.aria-label]=\"viewSwitchButtonLabel()\">\n <span\n class=\"font-semibold text-[var(--mona-primary-text-color,var(--color-primary))]\"\n [id]=\"gridId + '-heading'\"\n >{{ headerMonthYear() }}</span\n >\n </button>\n }\n @case (\"year\") {\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onViewChangeClick('decade')\"\n [attr.aria-label]=\"viewSwitchButtonLabel()\">\n <span\n class=\"font-semibold text-[var(--mona-primary-text-color,var(--color-primary))]\"\n [id]=\"gridId + '-heading'\"\n >{{ headerYear() }}</span\n >\n </button>\n }\n @case (\"decade\") {\n <!-- The decade is the top view, so its heading isn't a button. It names the grid with the locale's\n wording of the range, and shows the digits. -->\n <span\n class=\"inline-flex h-9 items-center px-4 text-sm font-semibold text-[var(--mona-primary-text-color,var(--color-primary))]\"\n [id]=\"gridId + '-heading'\"\n ><span aria-hidden=\"true\">{{ formatInteger(decadeStart()) }} - {{ formatInteger(decadeEnd()) }}</span\n ><span class=\"sr-only\">{{ viewSwitchButtonLabel() }}</span></span\n >\n }\n }\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [iconOnly]=\"true\"\n [size]=\"'small'\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onNavigationClick('prev')\"\n [attr.aria-label]=\"prevButtonLabel()\">\n <svg lucideChevronLeft class=\"rtl:rotate-180\"></svg>\n </button>\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [iconOnly]=\"true\"\n [size]=\"'small'\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onNavigationClick('next')\"\n [attr.aria-label]=\"nextButtonLabel()\">\n <svg lucideChevronRight class=\"rtl:rotate-180\"></svg>\n </button>\n</div>\n\n<div aria-live=\"polite\" aria-atomic=\"true\" class=\"sr-only\">{{ ariaLabel() }}</div>\n\n@if (calendarView() === \"month\") {\n @let columnCount = weekNumber() ? 8 : 7;\n @let multipleMonths = monthGrids().length > 1;\n <div [class]=\"monthViewClass\">\n @for (grid of monthGrids(); track grid.key) {\n <div class=\"flex flex-col\">\n @if (multipleMonths) {\n <div [class]=\"monthCaptionClass\" [id]=\"grid.captionId\">{{ grid.caption }}</div>\n }\n <div\n role=\"grid\"\n class=\"flex flex-col gap-0.5\"\n [attr.aria-labelledby]=\"multipleMonths ? grid.captionId : gridId + '-heading'\"\n [attr.aria-disabled]=\"effectiveDisabled() || null\"\n [attr.aria-invalid]=\"invalidState() ? 'true' : null\"\n [attr.aria-readonly]=\"readonly() || null\"\n (pointerleave)=\"onMonthGridPointerLeave()\">\n <div\n role=\"row\"\n [class]=\"monthGridHeaderClass()\"\n [style.grid-template-columns]=\"`repeat(${columnCount}, var(--mona-calendar-cell-size, 32px))`\">\n @if (weekNumber()) {\n <!-- Week numbers are visual only: every day is already named by its full date. -->\n <div aria-hidden=\"true\"></div>\n }\n @for (day of weekdays(); track day.full) {\n <div role=\"columnheader\">\n <span aria-hidden=\"true\">{{ day.display }}</span>\n <span class=\"sr-only\">{{ day.full }}</span>\n </div>\n }\n </div>\n @for (week of grid.weeks; track week.key) {\n <div\n role=\"row\"\n [class]=\"monthGridClass()\"\n [style.grid-template-columns]=\"`repeat(${columnCount}, var(--mona-calendar-cell-size, 32px))`\">\n @if (weekNumber()) {\n <div aria-hidden=\"true\">{{ formatInteger(week.weekNumber) }}</div>\n }\n <!-- Track by time: the months are rebuilt with new Date objects on every navigation. -->\n @for (entry of week.days; track entry ? entry.key.getTime() : -$index - 1) {\n @if (entry) {\n <div\n (dayPointerEnter)=\"onDayPointerEnter($event)\"\n (daySelect)=\"onDayClick($event.date, $event.event)\"\n monaMonthDay\n [disabled]=\"effectiveDisabled()\"\n [isDayUnavailable]=\"isDayUnavailable()\"\n [monthBounds]=\"grid.bounds\"\n [navigatedDate]=\"navigatedDate()\"\n [rangeEnds]=\"rangeEnds()\"\n [rangePreviewKeys]=\"rangePreviewKeys()\"\n [rounded]=\"rounded()\"\n [selectedKeys]=\"selectedKeys()\"\n [today]=\"today()\"\n [entry]=\"entry\">\n @if (monthCellTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"monthCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{\n $implicit: entry.value,\n date: entry.key\n }\"></ng-container>\n } @else {\n <span>{{ formatInteger(entry.value) }}</span>\n }\n </div>\n } @else {\n <!-- A day of the month before or after, shown in its own month instead. -->\n <div role=\"gridcell\"></div>\n }\n }\n </div>\n }\n </div>\n </div>\n }\n </div>\n} @else if (calendarView() === \"year\") {\n <div role=\"grid\" class=\"flex flex-col gap-0.5\" [attr.aria-labelledby]=\"gridId + '-heading'\">\n @for (row of yearViewMonths(); track $index) {\n <div role=\"row\" [class]=\"yearGridClass()\">\n @for (monthItem of row; track monthItem) {\n <div\n (click)=\"!effectiveDisabled() && onMonthClick(monthItem[0])\"\n monaYearMonth\n [disabled]=\"effectiveDisabled()\"\n [month]=\"monthItem[0]\"\n [navigatedDate]=\"navigatedDate()\"\n [rounded]=\"rounded()\"\n [selectedDate]=\"selectedDates()[0]\">\n @if (yearCellTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"yearCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: monthItem[0], text: monthItem[1] }\">\n </ng-container>\n } @else {\n <span>{{ monthItem[1] }}</span>\n }\n </div>\n }\n </div>\n }\n </div>\n} @else if (calendarView() === \"decade\") {\n <div role=\"grid\" class=\"flex flex-col gap-0.5\" [attr.aria-labelledby]=\"gridId + '-heading'\">\n @for (row of decadeYears(); track $index) {\n <div role=\"row\" [class]=\"decadeGridClass()\">\n @for (year of row; track year) {\n <div\n (click)=\"!effectiveDisabled() && onYearClick(year)\"\n monaDecadeYear\n [disabled]=\"effectiveDisabled()\"\n [navigatedDate]=\"navigatedDate()\"\n [rounded]=\"rounded()\"\n [year]=\"year\"\n [selectedDate]=\"selectedDates()[0]\">\n @if (decadeCellTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"decadeCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year }\">\n </ng-container>\n } @else {\n <span>{{ formatInteger(year) }}</span>\n }\n </div>\n }\n </div>\n }\n </div>\n}\n"
2093
2093
  }]
2094
2094
  }],
2095
2095
  ctorParameters: () => [],
@@ -8,7 +8,7 @@ import { ButtonDirective } from "@nanahoshi/mona-ui/button";
8
8
  import { CalendarComponent, CalendarDecadeCellTemplateDirective, CalendarMonthCellTemplateDirective, CalendarYearCellTemplateDirective } from "@nanahoshi/mona-ui/calendar";
9
9
  import { CalendarService, DateInputPrefixTemplateDirective, createTypedDateInput, datePopupThemeVariants } from "@nanahoshi/mona-ui/date-input";
10
10
  import * as i1 from "@nanahoshi/mona-ui/dropdowns";
11
- import { DROPDOWN_POPUP_INPUT_TOKEN, DropdownPopupHandlerDirective, DropdownService } from "@nanahoshi/mona-ui/dropdowns";
11
+ import { DROPDOWN_POPUP_INPUT_TOKEN, DropdownPopupHandlerDirective, DropdownService, dropdownSheetPickerClasses } from "@nanahoshi/mona-ui/dropdowns";
12
12
  import { MonaI18nService, getLocaleDateInputFormat } from "@nanahoshi/mona-ui/i18n";
13
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";
@@ -129,7 +129,8 @@ var DatePickerComponent = class DatePickerComponent {
129
129
  rounded,
130
130
  size
131
131
  });
132
- return twMerge(variantClass, userClass);
132
+ const sheetClass = this.sheet() ? dropdownSheetPickerClasses : "";
133
+ return twMerge(variantClass, sheetClass, userClass);
133
134
  }, ...ngDevMode ? [{ debugName: "pickerPopupClass" }] : /* istanbul ignore next */ []);
134
135
  this.popupId = createElementControlId();
135
136
  this.popupTemplate = viewChild.required("popupTemplate", ...ngDevMode ? [{ debugName: "popupTemplate" }] : /* istanbul ignore next */ []);
@@ -137,7 +138,10 @@ var DatePickerComponent = class DatePickerComponent {
137
138
  ...ngDevMode ? { debugName: "prefixTemplate" } : /* istanbul ignore next */ {},
138
139
  read: TemplateRef
139
140
  });
141
+ this.sheet = this.#dropdownService.sheet.asReadonly();
140
142
  this.yearCellTemplate = contentChild(CalendarYearCellTemplateDirective, ...ngDevMode ? [{ debugName: "yearCellTemplate" }] : /* istanbul ignore next */ []);
143
+ this.adaptiveMode = input("none", ...ngDevMode ? [{ debugName: "adaptiveMode" }] : /* istanbul ignore next */ []);
144
+ this.adaptiveTitle = input("", ...ngDevMode ? [{ debugName: "adaptiveTitle" }] : /* istanbul ignore next */ []);
141
145
  this.ariaDescribedBy = input("", {
142
146
  ...ngDevMode ? { debugName: "ariaDescribedBy" } : /* istanbul ignore next */ {},
143
147
  alias: "aria-describedby"
@@ -325,6 +329,20 @@ var DatePickerComponent = class DatePickerComponent {
325
329
  isStandalone: true,
326
330
  selector: "mona-date-picker",
327
331
  inputs: {
332
+ adaptiveMode: {
333
+ classPropertyName: "adaptiveMode",
334
+ publicName: "adaptiveMode",
335
+ isSignal: true,
336
+ isRequired: false,
337
+ transformFunction: null
338
+ },
339
+ adaptiveTitle: {
340
+ classPropertyName: "adaptiveTitle",
341
+ publicName: "adaptiveTitle",
342
+ isSignal: true,
343
+ isRequired: false,
344
+ transformFunction: null
345
+ },
328
346
  ariaDescribedBy: {
329
347
  classPropertyName: "ariaDescribedBy",
330
348
  publicName: "aria-describedby",
@@ -787,6 +805,22 @@ i0.ɵɵngDeclareClassMetadata({
787
805
  type: i0.ContentChild,
788
806
  args: [i0.forwardRef(() => CalendarYearCellTemplateDirective), { isSignal: true }]
789
807
  }],
808
+ adaptiveMode: [{
809
+ type: i0.Input,
810
+ args: [{
811
+ isSignal: true,
812
+ alias: "adaptiveMode",
813
+ required: false
814
+ }]
815
+ }],
816
+ adaptiveTitle: [{
817
+ type: i0.Input,
818
+ args: [{
819
+ isSignal: true,
820
+ alias: "adaptiveTitle",
821
+ required: false
822
+ }]
823
+ }],
790
824
  ariaDescribedBy: [{
791
825
  type: i0.Input,
792
826
  args: [{