@nanahoshi/mona-ui 0.40.0 → 0.42.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 (80) hide show
  1. package/docs/api/auto-complete.md +2 -0
  2. package/docs/api/combo-box.md +2 -0
  3. package/docs/api/common.md +1 -1
  4. package/docs/api/dropdowns.md +3 -1
  5. package/docs/api/i18n.md +54 -0
  6. package/docs/api/kanban.md +222 -0
  7. package/docs/api/locales.md +14 -14
  8. package/docs/api/sortable.md +189 -0
  9. package/docs/api/sparkline.md +85 -0
  10. package/docs/api/tabs.md +20 -0
  11. package/docs/auto-complete.md +64 -0
  12. package/docs/combo-box.md +65 -0
  13. package/docs/kanban.md +293 -0
  14. package/docs/sortable.md +320 -0
  15. package/docs/sparkline.md +303 -0
  16. package/docs/tabs.md +59 -10
  17. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +95 -30
  18. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +58 -5
  19. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +64 -29
  20. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +87 -0
  21. package/fesm2022/nanahoshi-mona-ui-kanban.mjs +660 -0
  22. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +14 -0
  23. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +14 -0
  24. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +14 -0
  25. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +14 -0
  26. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +14 -0
  27. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +14 -0
  28. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +14 -0
  29. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +14 -0
  30. package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +44 -0
  31. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +14 -0
  32. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +44 -0
  33. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +14 -0
  34. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +14 -0
  35. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +14 -0
  36. package/fesm2022/nanahoshi-mona-ui-sortable.mjs +733 -0
  37. package/fesm2022/nanahoshi-mona-ui-sparkline.mjs +573 -0
  38. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +112 -5
  39. package/i18n/catalogs/en-US.messages.json +14 -0
  40. package/kanban/package.json +4 -0
  41. package/llms.txt +8 -2
  42. package/locales/ar-sa/ar-sa.messages.json +14 -0
  43. package/locales/de-de/de-de.messages.json +14 -0
  44. package/locales/es-es/es-es.messages.json +14 -0
  45. package/locales/fr-fr/fr-fr.messages.json +14 -0
  46. package/locales/id-id/id-id.messages.json +14 -0
  47. package/locales/it-it/it-it.messages.json +14 -0
  48. package/locales/ja-jp/ja-jp.messages.json +14 -0
  49. package/locales/ko-kr/ko-kr.messages.json +14 -0
  50. package/locales/pl-pl/pl-pl.messages.json +14 -0
  51. package/locales/pt-br/pt-br.messages.json +14 -0
  52. package/locales/ru-ru/ru-ru.messages.json +14 -0
  53. package/locales/tr-tr/tr-tr.messages.json +14 -0
  54. package/locales/zh-cn/zh-cn.messages.json +14 -0
  55. package/locales/zh-tw/zh-tw.messages.json +14 -0
  56. package/package.json +13 -1
  57. package/sortable/package.json +4 -0
  58. package/sparkline/package.json +4 -0
  59. package/types/nanahoshi-mona-ui-auto-complete.d.ts +42 -1
  60. package/types/nanahoshi-mona-ui-combo-box.d.ts +37 -1
  61. package/types/nanahoshi-mona-ui-dropdowns.d.ts +54 -4
  62. package/types/nanahoshi-mona-ui-i18n.d.ts +31 -0
  63. package/types/nanahoshi-mona-ui-kanban.d.ts +270 -0
  64. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +14 -0
  65. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +14 -0
  66. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +14 -0
  67. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +14 -0
  68. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +14 -0
  69. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +14 -0
  70. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +14 -0
  71. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +14 -0
  72. package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +14 -0
  73. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +14 -0
  74. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +14 -0
  75. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +14 -0
  76. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +14 -0
  77. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +14 -0
  78. package/types/nanahoshi-mona-ui-sortable.d.ts +245 -0
  79. package/types/nanahoshi-mona-ui-sparkline.d.ts +228 -0
  80. package/types/nanahoshi-mona-ui-tabs.d.ts +46 -0
@@ -0,0 +1,189 @@
1
+ # `@nanahoshi/mona-ui/sortable`
2
+
3
+ Everything `@nanahoshi/mona-ui/sortable` exports.
4
+
5
+ **Guides:** [Sortable](../sortable.md)
6
+
7
+ ## `SortableDirective`
8
+
9
+ Directive.
10
+
11
+ Lets the user reorder a list's items by dragging them, or with Control+Shift and the arrow keys (Command+Shift on
12
+ macOS), and announces each move. Mark each item with `monaSortableItem`, render every item of the array in order,
13
+ and bind the array two-way, `[(monaSortable)]`, or handle `sortableMove`. The list doesn't reorder its elements
14
+ itself. Lists inside one `monaSortableGroup` exchange items.
15
+
16
+ **Selector:** `[monaSortable]`
17
+ **Exported as:** `monaSortable`
18
+ **Type parameters:** `T = unknown`
19
+
20
+ ### Inputs
21
+
22
+ | Name | Type | Default | Description |
23
+ | --- | --- | --- | --- |
24
+ | `monaSortable` (required) | `readonly T[]` | — | The list's items, in the order they're shown. Bind it two-way, `[(monaSortable)]`, to take each new order. |
25
+ | `sortableCanEnter` | `((item: T) => boolean) \| null` | `null` | Whether an item from another list of the group may come into this one, such as to keep a list under a limit. The list's own items can always move within it. Without it, every item may come in. |
26
+ | `sortableDisabled` | `boolean` | `false` | Stops items from moving within the list, out of it or into it. |
27
+ | `sortableLabel` | `string` | `""` | The list's name in the announcement of a move into it from another list. Without it, the list's `aria-label` or `aria-labelledby` text. |
28
+ | `sortableLockAxis` | `boolean` | `false` | Keeps a dragged item on the list's axis: across for a horizontal list, up and down for a vertical one. A list whose rows wrap doesn't lock. |
29
+ | `sortableOrientation` | `SortableOrientation` | `"vertical"` | How the items are laid out, which sets the keys that move them: Up and Down in a column, Left and Right in a row, and all four in rows that wrap. |
30
+
31
+ ### Outputs
32
+
33
+ | Name | Type | Description |
34
+ | --- | --- | --- |
35
+ | `monaSortableChange` | `T[]` | Emitted with the list's new items after an item moves within it, out of it or into it, unless the move was refused. |
36
+ | `sortableMove` | `SortableMoveEvent<T>` | Emitted with a `SortableMoveEvent` when an item moves within this list or into it from another list, before the lists emit their new items. This event is preventable. |
37
+
38
+ ### Properties
39
+
40
+ | Name | Type | Description |
41
+ | --- | --- | --- |
42
+ | `keyShortcuts` (read-only) | `Signal<string \| null>` | The shortcuts that move an item, in `aria-keyshortcuts` form, or `null` while the list is disabled. Items put it on themselves; an item that's presentational can bind it on the element in it that takes focus. |
43
+
44
+ **Used by:** [`SortableMoveEvent`](sortable.md#sortablemoveevent), [`SortableMoveEventOptions`](sortable.md#sortablemoveeventoptions)
45
+
46
+ ## `SortableItemDirective`
47
+
48
+ Directive.
49
+
50
+ An item of a `monaSortable` list, given the array element it shows. Drag it, or focus it, or a control in it, and
51
+ press Control+Shift with an arrow key, Home or End (Command+Shift on macOS) to move it. On a touch screen, press and
52
+ hold it first, so a swipe still scrolls.
53
+
54
+ **Selector:** `[monaSortableItem]`
55
+ **Exported as:** `monaSortableItem`
56
+ **Type parameters:** `T = unknown`
57
+
58
+ ### Inputs
59
+
60
+ | Name | Type | Default | Description |
61
+ | --- | --- | --- | --- |
62
+ | `monaSortableItem` (required) | `T` | — | The element of the list's array that this item shows. |
63
+ | `sortableDisabled` | `boolean` | `false` | Stops this item from moving. Other items still move past it. |
64
+ | `sortableLabel` | `string` | `""` | The item's name in announcements of its moves. Without it, the item's `aria-label`, `aria-labelledby` text or own text. |
65
+
66
+ ### Properties
67
+
68
+ | Name | Type | Description |
69
+ | --- | --- | --- |
70
+ | `keyShortcuts` (read-only) | `Signal<string \| null>` | The shortcuts that move this item, in `aria-keyshortcuts` form, or `null` when it can't move. The item sets them on itself, unless it has `role="presentation"` or `role="none"`: then bind them on the element in it that takes focus. |
71
+
72
+ ## `SortableGroupDirective`
73
+
74
+ Directive.
75
+
76
+ Connects the sortable lists inside it, so an item can move from one to another: dragged, or with Control+Shift and
77
+ the arrow keys that cross the lists, such as Left and Right between columns. The lists keep their own items; the
78
+ one an item lands in emits the move.
79
+
80
+ **Selector:** `[monaSortableGroup]`
81
+ **Exported as:** `monaSortableGroup`
82
+
83
+ ## `SortableHandleDirective`
84
+
85
+ Directive.
86
+
87
+ Marks the part of a sortable item that starts a drag, such as a grip icon. With a handle, the rest of the item
88
+ doesn't start one, so its text can be selected. The keyboard still moves the item from anywhere in it.
89
+
90
+ **Selector:** `[monaSortableHandle]`
91
+
92
+ ## `SortableMoveEvent`
93
+
94
+ Class.
95
+
96
+ A move of an item, by pointer or keyboard, within a sortable list or into another list of its group. The list the
97
+ item lands in emits it. Call `preventDefault()` to refuse the move: the lists then don't emit their new items, and
98
+ the item goes back where it was.
99
+
100
+ **Type parameters:** `T = unknown`
101
+ **Extends:** `PreventableEvent`
102
+
103
+ ### Properties
104
+
105
+ | Name | Type | Description |
106
+ | --- | --- | --- |
107
+ | `currentIndex` (read-only) | `number` | The item's index in `currentItems`. |
108
+ | `currentItems` (read-only) | `readonly T[]` | The items of the list the item lands in, after the move. |
109
+ | `currentList` (read-only) | `SortableDirective<T>` | The list the item lands in: the one that emits this event. |
110
+ | `item` (read-only) | `T` | The item that moves. |
111
+ | `previousIndex` (read-only) | `number` | The item's index in its list before the move. |
112
+ | `previousItems` (read-only) | `readonly T[]` | The items of the list the item comes from, after the move. For a move within one list, the same array as `currentItems`. |
113
+ | `previousList` (read-only) | `SortableDirective<T>` | The list the item comes from. The same as `currentList` for a move within one list. |
114
+
115
+ ### Inherited from `PreventableEvent`
116
+
117
+ | Name | Type | Description |
118
+ | --- | --- | --- |
119
+ | `originalEvent` (read-only) | `E \| undefined` | The DOM event that caused this one, when there is one. |
120
+ | `type` (read-only) | `string \| undefined` | A name for the kind of event, when the component that emits it sets one. |
121
+
122
+ **Methods**
123
+
124
+ | Signature | Description |
125
+ | --- | --- |
126
+ | `isDefaultPrevented(): boolean` | Whether `preventDefault()` was called. |
127
+ | `preventDefault(): void` | Cancels what the event announces, such as opening or closing a popup, or closing a dialog. |
128
+
129
+ **Used by:** [`SortableDirective`](sortable.md#sortabledirective)
130
+
131
+ ## `moveItem`
132
+
133
+ Function.
134
+
135
+ A copy of `items` with the item at `from` moved to `to`, the index it has afterwards. Use it to apply a move that a
136
+ list reports by index, such as a reordered tab. Indexes out of range are clamped; the array isn't changed.
137
+
138
+ ```typescript
139
+ function moveItem<T>(items: readonly T[], from: number, to: number): T[];
140
+ ```
141
+
142
+ ## `SORTABLE_DEFAULT_MESSAGES`
143
+
144
+ Constant.
145
+
146
+ ```typescript
147
+ const SORTABLE_DEFAULT_MESSAGES: MonaSortableMessages;
148
+ ```
149
+
150
+ ## `SortableMoveEventOptions`
151
+
152
+ Interface.
153
+
154
+ **Type parameters:** `T`
155
+
156
+ ### Properties
157
+
158
+ | Name | Type |
159
+ | --- | --- |
160
+ | `currentIndex` (read-only) | `number` |
161
+ | `currentItems` (read-only) | `readonly T[]` |
162
+ | `currentList` (read-only) | `SortableDirective<T>` |
163
+ | `item` (read-only) | `T` |
164
+ | `previousIndex` (read-only) | `number` |
165
+ | `previousItems` (read-only) | `readonly T[]` |
166
+ | `previousList` (read-only) | `SortableDirective<T>` |
167
+
168
+ ## `SortableMoveKey`
169
+
170
+ Type alias.
171
+
172
+ The keys that move an item, held with Control and Shift (Command and Shift on macOS).
173
+
174
+ ```typescript
175
+ type SortableMoveKey = "ArrowDown" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "End" | "Home";
176
+ ```
177
+
178
+ ## `SortableOrientation`
179
+
180
+ Type alias.
181
+
182
+ How a sortable list lays out its items: in a column (`vertical`), in a row (`horizontal`), or in rows that wrap
183
+ (`mixed`), such as a grid of cards.
184
+
185
+ ```typescript
186
+ type SortableOrientation = "horizontal" | "mixed" | "vertical";
187
+ ```
188
+
189
+ **Used by:** [`SortableDirective`](sortable.md#sortabledirective)
@@ -0,0 +1,85 @@
1
+ # `@nanahoshi/mona-ui/sparkline`
2
+
3
+ Everything `@nanahoshi/mona-ui/sparkline` exports.
4
+
5
+ **Guides:** [Sparkline](../sparkline.md)
6
+
7
+ ## `SparklineComponent`
8
+
9
+ Component.
10
+
11
+ A word-sized chart of a series of values, to sit on a line of text or in a table cell: a line, an area, columns or
12
+ wins and losses. It's an image to assistive technology, which reads its name and a summary of its values: how many,
13
+ the first, the last, the lowest and the highest, or how many wins, losses and draws.
14
+
15
+ Values run from left to right, also in a right-to-left layout, as on a chart's axis.
16
+
17
+ **Selector:** `mona-sparkline`
18
+
19
+ ### Inputs
20
+
21
+ | Name | Type | Default | Description |
22
+ | --- | --- | --- | --- |
23
+ | `aria-describedby` | `string` | `""` | Ids of elements that describe the sparkline further. The summary of its values is added after them when it has a name. |
24
+ | `aria-label` | `string` | `""` | The sparkline's name, what its values are, such as "Weekly sales". Assistive technology reads the summary of its values after it. Without a name, the summary is the name. |
25
+ | `class` | `string` | `""` | Additional CSS classes merged onto the host element via `tailwind-merge`, such as a size: it's 6rem wide and 1.5rem tall by default. |
26
+ | `color` | `string` | `""` | The color of the line, the area and the bars, as a CSS color. The first chart color when empty. The `--mona-sparkline-color` custom property sets it from a style sheet. |
27
+ | `curve` | `SparklineCurve` | `"linear"` | How a line or an area joins its values, as a chart's line series does: `"linear"`, `"monotone-x"` (smooth, never past the values), `"natural"` (smoother, but it can swing past them), `"step"` (changing halfway between values) or `"step-after"` (holding each value until the next). Columns and win-loss bars ignore it. |
28
+ | `data` | `Iterable<number \| null \| undefined>` | `[]` | The values, in order. A `null`, or anything that isn't a finite number, leaves a gap. |
29
+ | `decorative` | `boolean` | `false` | Hides the sparkline from assistive technology, for one beside text that already gives its values. |
30
+ | `format` | `Intl.NumberFormatOptions \| null` | `null` | How the values are formatted in the summary assistive technology reads, such as `{ style: "currency", currency: "EUR" }`. The locale's number format when `null`. |
31
+ | `markers` | `readonly SparklineMarker[]` | `[]` | Values a line or area sparkline marks with a dot: `"first"`, `"last"`, `"min"` and `"max"`. |
32
+ | `max` | `number \| null` | `null` | The value at the top of the sparkline. Give several sparklines the same `min` and `max` to compare them. When `null`, the highest value, or zero for columns, or the reference value when it's higher. |
33
+ | `min` | `number \| null` | `null` | The value at the bottom of the sparkline. When `null`, the lowest value, or zero for columns, or the reference value when it's lower. |
34
+ | `negativeColor` | `string` | `""` | The color of column bars below zero and of losses, as a CSS color. The error color when empty. The `--mona-sparkline-negative-color` custom property sets it from a style sheet. |
35
+ | `referenceValue` | `number \| null` | `null` | A value to draw a dashed line at, such as a target or an average. Not drawn on a win-loss sparkline. |
36
+ | `type` | `SparklineType` | `"line"` | How the values are drawn: `"line"`, `"area"`, `"column"` or `"win-loss"`. |
37
+
38
+ ## `SPARKLINE_DEFAULT_MESSAGES`
39
+
40
+ Constant.
41
+
42
+ ```typescript
43
+ const SPARKLINE_DEFAULT_MESSAGES: MonaSparklineMessages;
44
+ ```
45
+
46
+ ## `SparklineCurve`
47
+
48
+ Type alias.
49
+
50
+ How a line or an area sparkline joins its values, as a chart's line series does: `"linear"` with straight segments,
51
+ `"monotone-x"` with a smooth curve that never swings past the values, `"natural"` with a smoother curve that can,
52
+ `"step"` in steps that change halfway between values, and `"step-after"` in steps that hold each value until the
53
+ next one.
54
+
55
+ ```typescript
56
+ type SparklineCurve = "linear" | "monotone-x" | "natural" | "step" | "step-after";
57
+ ```
58
+
59
+ **Used by:** [`SparklineComponent`](sparkline.md#sparklinecomponent)
60
+
61
+ ## `SparklineMarker`
62
+
63
+ Type alias.
64
+
65
+ A value a line or area sparkline marks with a dot: its first, its last, its lowest or its highest.
66
+
67
+ ```typescript
68
+ type SparklineMarker = "first" | "last" | "max" | "min";
69
+ ```
70
+
71
+ **Used by:** [`SparklineComponent`](sparkline.md#sparklinecomponent)
72
+
73
+ ## `SparklineType`
74
+
75
+ Type alias.
76
+
77
+ How a sparkline draws its values: `"line"` joins them, `"area"` fills under the line, `"column"` draws a bar for
78
+ each from zero, and `"win-loss"` draws a bar up for each positive value, down for each negative one and a short tick
79
+ for each zero, all of one height.
80
+
81
+ ```typescript
82
+ type SparklineType = "area" | "column" | "line" | "win-loss";
83
+ ```
84
+
85
+ **Used by:** [`SparklineComponent`](sparkline.md#sparklinecomponent)
package/docs/api/tabs.md CHANGED
@@ -23,6 +23,7 @@ Component.
23
23
  | `position` | `"bottom" \| "left" \| "right" \| "top"` | `"top"` | Placement of the tab list relative to the tab content. |
24
24
  | `selectedIndex` (two-way) | `number` | `0` | The zero-based index of the selected tab. Writing it selects that tab, unless it's disabled or out of range, in which case the value goes back to the selected tab's index. It also changes when the component moves the selection itself, such as when the selected tab is removed. |
25
25
  | `size` | `"large" \| "medium" \| "small"` | `"medium"` | Size preset controlling the tabs' dimensions. |
26
+ | `sortable` | `boolean` | `false` | Lets the user reorder the tabs: by dragging them, or with Control+Shift and the arrow keys along the strip, Home or End (Command+Shift on macOS). The component emits `tabReorder` and doesn't move the tabs itself. |
26
27
 
27
28
  ### Outputs
28
29
 
@@ -30,6 +31,7 @@ Component.
30
31
  | --- | --- | --- |
31
32
  | `selectedIndexChange` | `number` | Emitted when `selectedIndex` changes. |
32
33
  | `tabClose` | `TabCloseEvent` | Emitted with a `TabCloseEvent` when a close is requested. The component doesn't remove the tab: remove it from whatever renders the `mona-tab` elements. |
34
+ | `tabReorder` | `TabReorderEvent` | Emitted with a `TabReorderEvent` when a tab of a `sortable` strip is moved. The component doesn't reorder the tabs: move the tab in whatever renders the `mona-tab` elements. The selected tab stays selected. |
33
35
  | `tabSelect` | `TabSelectEvent` | Emitted with a `TabSelectEvent` before a click or key selects a tab. This event is preventable. It doesn't fire for selections made through `selectedIndex` or `selected`, or when the selected tab is removed. |
34
36
 
35
37
  ## `TabComponent`
@@ -94,6 +96,24 @@ Class.
94
96
 
95
97
  **Used by:** [`TabsComponent`](tabs.md#tabscomponent)
96
98
 
99
+ ## `TabReorderEvent`
100
+
101
+ Class.
102
+
103
+ A tab dragged, or moved with Control+Shift and an arrow key, Home or End, to a new place in a sortable tab strip.
104
+ The component doesn't reorder the tabs: move the tab in whatever renders the `mona-tab` elements, such as with
105
+ `moveItem` from `@nanahoshi/mona-ui/sortable`.
106
+
107
+ ### Properties
108
+
109
+ | Name | Type | Description |
110
+ | --- | --- | --- |
111
+ | `currentIndex` (read-only) | `number` | The index the tab moves to. |
112
+ | `originalEvent` (read-only) | `Event \| undefined` | The DOM event that moved the tab: the key press, or the pointer release that dropped it. |
113
+ | `previousIndex` (read-only) | `number` | The index the tab had. |
114
+
115
+ **Used by:** [`TabsComponent`](tabs.md#tabscomponent)
116
+
97
117
  ## `TabSelectEvent`
98
118
 
99
119
  Class.
@@ -274,6 +274,58 @@ export class AutoCompleteFormsExampleComponent {
274
274
  </div>
275
275
  ```
276
276
 
277
+ ### A bottom sheet on a phone
278
+
279
+ With `adaptiveMode="auto"`, on a screen narrower than 640 pixels, the suggestions open as a sheet along the bottom of the screen, with a text box of its own at the top. Narrow the window to see it.
280
+
281
+ `adaptive-example.component.ts`
282
+
283
+ ```typescript
284
+ import { Component, signal } from "@angular/core";
285
+ import { AutoCompleteComponent } from "@nanahoshi/mona-ui/auto-complete";
286
+ import { DropdownFilterableDirective } from "@nanahoshi/mona-ui/dropdowns";
287
+ import { FormFieldComponent } from "@nanahoshi/mona-ui/form-field";
288
+
289
+ @Component({
290
+ selector: "app-auto-complete-adaptive-example",
291
+ imports: [AutoCompleteComponent, DropdownFilterableDirective, FormFieldComponent],
292
+ templateUrl: "./adaptive-example.component.html"
293
+ })
294
+ export class AutoCompleteAdaptiveExampleComponent {
295
+ protected readonly cities = [
296
+ "Amsterdam",
297
+ "Barcelona",
298
+ "Berlin",
299
+ "Istanbul",
300
+ "Kraków",
301
+ "Lisbon",
302
+ "Osaka",
303
+ "Seoul",
304
+ "Sydney",
305
+ "Toronto",
306
+ "Vienna"
307
+ ];
308
+ protected readonly city = signal<string | null>(null);
309
+ }
310
+ ```
311
+
312
+ `adaptive-example.component.html`
313
+
314
+ ```html
315
+ <mona-form-field
316
+ class="max-w-sm"
317
+ label="City"
318
+ hint="On a phone, suggestions open along the bottom of the screen, with a box to type in.">
319
+ <mona-auto-complete
320
+ adaptiveMode="auto"
321
+ class="w-full"
322
+ monaDropDownFilterable
323
+ placeholder="Type a city"
324
+ [data]="cities"
325
+ [(value)]="city" />
326
+ </mona-form-field>
327
+ ```
328
+
277
329
  ### Highlight the first match while typing
278
330
 
279
331
  `highlightFirst` (default `true`) highlights the first option whose text matches the typed text as the consumer types, so `Enter` can commit it immediately. Set it to `false` to require the consumer to navigate to an option explicitly before `Enter` commits it.
@@ -335,6 +387,16 @@ Blurring the input while the popup is closed commits the typed text as `value`,
335
387
 
336
388
  `open` and `close` emit event objects with `preventDefault()` and `isDefaultPrevented()`. Calling `preventDefault()` in an `open` handler stops the popup from opening; calling it in a `close` handler stops the popup from closing. `close`'s event object also exposes `via`, describing what triggered the close attempt.
337
389
 
390
+ ### The bottom sheet
391
+
392
+ With `adaptiveMode="auto"`, the popup opens as a bottom sheet when the screen is narrower than 640 pixels as it opens; it doesn't switch while open. On such a screen, the field raises no on-screen keyboard. Pressing it opens the sheet, with the matches for the field's text, or the whole list when it has none. Typing into the field with a keyboard opens it too, and carries the text along.
393
+
394
+ The sheet covers the page with a dimmed backdrop and has a header with the field's name (or `adaptiveTitle`) and a close button. Below it is a text box, which takes focus and is named by that header, then the list, whose options are 44 pixels tall.
395
+
396
+ The text box works as the field does: typing suggests, the arrow keys highlight, `Enter` commits and `Escape` closes. Deleting its text keeps the sheet open, with the whole list. The sheet keeps its height while the list filters, so the text box stays put, and it sits above an on-screen keyboard.
397
+
398
+ When the sheet closes, focus goes back to the field, with the typed text, which becomes the value when focus leaves, as usual. Without `adaptiveMode`, or with `"none"`, the popup always opens under the field.
399
+
338
400
  ### `DropdownFieldSelectorType`, `DropdownFieldPredicateType`, and `ListSizeInputType` are not exported
339
401
 
340
402
  `textField`, `valueField`, `itemDisabled`, `popupHeight`, and `popupWidth` are typed with these generic aliases internally, but none of the three types are re-exported from `@nanahoshi/mona-ui`. Inline values (as in the examples above) still type-check structurally; only a standalone typed variable would require an import.
@@ -362,6 +424,8 @@ Blurring the input while the popup is closed commits the typed text as `value`,
362
424
 
363
425
  The host element itself is not a Tab stop (`tabindex="-1"`); the inner `<input>` element receives focus and is the actual Tab stop. Arrow-key navigation moves an internal highlighted-option pointer, reflected through `aria-activedescendant` on the input, instead of moving DOM focus into the popup.
364
426
 
427
+ In a bottom sheet (`adaptiveMode="auto"` on a small screen), focus moves to the sheet's text box, which has the same role and states as the input, and comes back to the input when the sheet closes.
428
+
365
429
  ### ARIA
366
430
 
367
431
  | Element | Attribute | When present | Value |
package/docs/combo-box.md CHANGED
@@ -295,6 +295,59 @@ export class ComboBoxFormsExampleComponent {
295
295
  </div>
296
296
  ```
297
297
 
298
+ ### A bottom sheet on a phone
299
+
300
+ With `adaptiveMode="auto"`, on a screen narrower than 640 pixels, the popup opens as a sheet along the bottom of the screen, with a text box of its own at the top. Narrow the window to see it.
301
+
302
+ `adaptive-example.component.ts`
303
+
304
+ ```typescript
305
+ import { Component, signal } from "@angular/core";
306
+ import { ComboBoxComponent } from "@nanahoshi/mona-ui/combo-box";
307
+ import { DropdownFilterableDirective } from "@nanahoshi/mona-ui/dropdowns";
308
+ import { FormFieldComponent } from "@nanahoshi/mona-ui/form-field";
309
+
310
+ @Component({
311
+ selector: "app-combo-box-adaptive-example",
312
+ imports: [ComboBoxComponent, DropdownFilterableDirective, FormFieldComponent],
313
+ templateUrl: "./adaptive-example.component.html"
314
+ })
315
+ export class ComboBoxAdaptiveExampleComponent {
316
+ protected readonly countries = [
317
+ "Argentina",
318
+ "Australia",
319
+ "Brazil",
320
+ "Canada",
321
+ "Germany",
322
+ "Indonesia",
323
+ "Italy",
324
+ "Japan",
325
+ "Poland",
326
+ "South Korea",
327
+ "Spain",
328
+ "Türkiye"
329
+ ];
330
+ protected readonly country = signal<string | null>("Japan");
331
+ }
332
+ ```
333
+
334
+ `adaptive-example.component.html`
335
+
336
+ ```html
337
+ <mona-form-field
338
+ class="max-w-sm"
339
+ label="Country"
340
+ hint="On a phone, the list opens along the bottom of the screen, with a box to type in.">
341
+ <mona-combo-box
342
+ adaptiveMode="auto"
343
+ class="w-full"
344
+ monaDropDownFilterable
345
+ placeholder="Type a country"
346
+ [data]="countries"
347
+ [(value)]="country" />
348
+ </mona-form-field>
349
+ ```
350
+
298
351
  ### Grouping
299
352
 
300
353
  `monaDropDownGroupable` groups options under a header row, driven by `groupBy`.
@@ -365,6 +418,16 @@ While the popup is open, `Escape` reverts the displayed text to the currently se
365
418
 
366
419
  `open` and `close` emit event objects with `preventDefault()` and `isDefaultPrevented()`. Calling `preventDefault()` in an `open` handler stops the popup from opening; calling it in a `close` handler stops the popup from closing. `close`'s event object also exposes `via`, describing what triggered the close attempt.
367
420
 
421
+ ### The bottom sheet
422
+
423
+ With `adaptiveMode="auto"`, the popup opens as a bottom sheet when the screen is narrower than 640 pixels as it opens; it doesn't switch while open. On such a screen, the field raises no on-screen keyboard. Pressing it opens the sheet, and so does typing into it with a keyboard, which carries the text along.
424
+
425
+ The sheet covers the page with a dimmed backdrop and has a header with the field's name (or `adaptiveTitle`) and a close button. Below it is a text box, which takes focus and is named by that header, then the list, whose options are 44 pixels tall.
426
+
427
+ The text box works as the field does: it filters the list, the arrow keys move through it, `Enter` resolves the text as described in [Enter key resolution](#enter-key-resolution), and `Escape` reverts it. The sheet keeps its height while the list filters, so the text box stays put, and it sits above an on-screen keyboard.
428
+
429
+ When the sheet closes, focus goes back to the field. Pressing the backdrop or the close button leaves the typed text in the field, which resolves it when focus leaves, as usual. Without `adaptiveMode`, or with `"none"`, the popup always opens under the field.
430
+
368
431
  ### `DropdownFieldSelectorType`, `DropdownFieldPredicateType`, and `ListSizeInputType` are not exported
369
432
 
370
433
  `textField`, `valueField`, `itemDisabled`, `popupHeight`, and `popupWidth` are typed with these generic aliases internally, but none of the three types are re-exported from `@nanahoshi/mona-ui`. Inline values (as in the examples above) still type-check structurally; only a standalone typed variable would require an import.
@@ -390,6 +453,8 @@ While the popup is open, `Escape` reverts the displayed text to the currently se
390
453
 
391
454
  The host element itself is not a Tab stop (`tabindex="-1"`); the inner `<input>` element receives focus and is the actual Tab stop. Arrow-key navigation moves an internal highlighted-option pointer, reflected through `aria-activedescendant` on the input, instead of moving DOM focus into the popup.
392
455
 
456
+ In a bottom sheet (`adaptiveMode="auto"` on a small screen), focus moves to the sheet's text box, which has the same role and states as the input, and comes back to the input when the sheet closes.
457
+
393
458
  ### ARIA
394
459
 
395
460
  | Element | Attribute | When present | Value |