@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.
Files changed (222) hide show
  1. package/README.md +2 -0
  2. package/command/package.json +4 -0
  3. package/docs/auto-complete.md +733 -0
  4. package/docs/avatar.md +220 -0
  5. package/docs/breadcrumb.md +320 -0
  6. package/docs/button-group.md +392 -0
  7. package/docs/button.md +256 -0
  8. package/docs/calendar.md +515 -0
  9. package/docs/card.md +292 -0
  10. package/docs/chart.md +4058 -0
  11. package/docs/checkbox.md +374 -0
  12. package/docs/chip.md +339 -0
  13. package/docs/circular-progress-bar.md +287 -0
  14. package/docs/collapsible.md +308 -0
  15. package/docs/color-gradient.md +336 -0
  16. package/docs/color-palette.md +317 -0
  17. package/docs/color-picker.md +387 -0
  18. package/docs/combo-box.md +764 -0
  19. package/docs/command.md +582 -0
  20. package/docs/contextmenu.md +530 -0
  21. package/docs/date-picker.md +251 -0
  22. package/docs/datetime-picker.md +284 -0
  23. package/docs/decimal-textbox.md +260 -0
  24. package/docs/dialog.md +822 -0
  25. package/docs/dropdown-button.md +507 -0
  26. package/docs/dropdown-list.md +779 -0
  27. package/docs/editor.md +374 -0
  28. package/docs/expansion-panel.md +348 -0
  29. package/docs/fieldset.md +217 -0
  30. package/docs/forms.md +162 -0
  31. package/docs/grid.md +2053 -0
  32. package/docs/input.md +197 -0
  33. package/docs/installation.md +54 -0
  34. package/docs/introduction.md +46 -0
  35. package/docs/label.md +340 -0
  36. package/docs/list-box.md +637 -0
  37. package/docs/list-view.md +584 -0
  38. package/docs/menubar.md +559 -0
  39. package/docs/multi-select.md +765 -0
  40. package/docs/notification.md +460 -0
  41. package/docs/numeric-textbox.md +301 -0
  42. package/docs/otp-input.md +539 -0
  43. package/docs/pager.md +513 -0
  44. package/docs/placeholder.md +176 -0
  45. package/docs/popover.md +423 -0
  46. package/docs/popup-menu.md +658 -0
  47. package/docs/popup.md +617 -0
  48. package/docs/progress-bar.md +368 -0
  49. package/docs/radio-button.md +451 -0
  50. package/docs/range-slider.md +367 -0
  51. package/docs/rating.md +518 -0
  52. package/docs/scroll-view.md +375 -0
  53. package/docs/segmented.md +434 -0
  54. package/docs/sheet.md +348 -0
  55. package/docs/sidebar.md +1126 -0
  56. package/docs/skeleton.md +181 -0
  57. package/docs/slider.md +423 -0
  58. package/docs/spinner.md +370 -0
  59. package/docs/split-button.md +522 -0
  60. package/docs/splitter.md +342 -0
  61. package/docs/stepper.md +539 -0
  62. package/docs/switch.md +340 -0
  63. package/docs/tabs.md +542 -0
  64. package/docs/textarea.md +196 -0
  65. package/docs/textbox.md +332 -0
  66. package/docs/theming.md +403 -0
  67. package/docs/time-picker.md +254 -0
  68. package/docs/tooltip-directive.md +340 -0
  69. package/docs/tooltip.md +321 -0
  70. package/docs/tree-view.md +1018 -0
  71. package/docs/window.md +663 -0
  72. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1 -1
  73. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +8 -0
  74. package/fesm2022/nanahoshi-mona-ui-button.mjs +12 -0
  75. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +5 -2
  76. package/fesm2022/nanahoshi-mona-ui-chart.mjs +86 -0
  77. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +4 -0
  78. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +4 -0
  79. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +16 -2
  80. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1 -1
  81. package/fesm2022/nanahoshi-mona-ui-command.mjs +924 -0
  82. package/fesm2022/nanahoshi-mona-ui-common.mjs +4 -0
  83. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +10 -6
  84. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +2 -1
  85. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +2 -1
  86. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +9 -5
  87. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +9 -5
  88. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +55 -1
  89. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3 -2
  90. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +13 -0
  91. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +5 -0
  92. package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-2tVhD2hK.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs} +2 -2
  93. package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-BAN70Wcn.mjs → nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs} +5 -5
  94. package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-C_kCaA5b.mjs → nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs} +18 -35
  95. package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-BsNfrAHz.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs} +5 -5
  96. package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CEfVa7eo.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs} +4653 -4529
  97. package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
  98. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +10 -0
  99. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1 -0
  100. package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +168 -0
  101. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +19 -1
  102. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +14 -0
  103. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +32 -0
  104. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +10 -0
  105. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +10 -0
  106. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +10 -0
  107. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +10 -0
  108. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +10 -0
  109. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +10 -0
  110. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +10 -0
  111. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +10 -0
  112. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +10 -0
  113. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +10 -0
  114. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +10 -0
  115. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +10 -0
  116. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +10 -0
  117. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +15 -8
  118. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +8 -5
  119. package/fesm2022/nanahoshi-mona-ui-notification.mjs +9 -0
  120. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1 -1
  121. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +5 -0
  122. package/fesm2022/nanahoshi-mona-ui-pager.mjs +2 -1
  123. package/fesm2022/nanahoshi-mona-ui-popover.mjs +14 -6
  124. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +48 -183
  125. package/fesm2022/nanahoshi-mona-ui-popup.mjs +16 -0
  126. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +4 -0
  127. package/fesm2022/nanahoshi-mona-ui-rating.mjs +2 -0
  128. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +1 -0
  129. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +5 -5
  130. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +1 -1
  131. package/fesm2022/nanahoshi-mona-ui-slider.mjs +7 -2
  132. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +9 -6
  133. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +18 -21
  134. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +11 -8
  135. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +9 -1
  136. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +2 -1
  137. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +16 -5
  138. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +13 -11
  139. package/fesm2022/nanahoshi-mona-ui-window.mjs +12 -5
  140. package/i18n/catalogs/en-US.messages.json +10 -0
  141. package/internal/popup-menu/package.json +4 -0
  142. package/llms.txt +123 -0
  143. package/locales/ar-sa/ar-sa.messages.json +10 -0
  144. package/locales/de-de/de-de.messages.json +10 -0
  145. package/locales/es-es/es-es.messages.json +10 -0
  146. package/locales/fr-fr/fr-fr.messages.json +10 -0
  147. package/locales/id-id/id-id.messages.json +10 -0
  148. package/locales/it-it/it-it.messages.json +10 -0
  149. package/locales/ja-jp/ja-jp.messages.json +10 -0
  150. package/locales/ko-kr/ko-kr.messages.json +10 -0
  151. package/locales/pt-br/pt-br.messages.json +10 -0
  152. package/locales/ru-ru/ru-ru.messages.json +10 -0
  153. package/locales/tr-tr/tr-tr.messages.json +10 -0
  154. package/locales/zh-cn/zh-cn.messages.json +10 -0
  155. package/locales/zh-tw/zh-tw.messages.json +10 -0
  156. package/package.json +9 -1
  157. package/types/nanahoshi-mona-ui-auto-complete.d.ts +1 -1
  158. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +8 -0
  159. package/types/nanahoshi-mona-ui-button.d.ts +12 -0
  160. package/types/nanahoshi-mona-ui-calendar.d.ts +3 -0
  161. package/types/nanahoshi-mona-ui-chart.d.ts +200 -0
  162. package/types/nanahoshi-mona-ui-check-box.d.ts +4 -0
  163. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +4 -0
  164. package/types/nanahoshi-mona-ui-collapsible.d.ts +10 -0
  165. package/types/nanahoshi-mona-ui-combo-box.d.ts +1 -1
  166. package/types/nanahoshi-mona-ui-command.d.ts +253 -0
  167. package/types/nanahoshi-mona-ui-common.d.ts +17 -1
  168. package/types/nanahoshi-mona-ui-contextmenu.d.ts +5 -2
  169. package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -1
  170. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +2 -1
  171. package/types/nanahoshi-mona-ui-dialog.d.ts +58 -1
  172. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +7 -3
  173. package/types/nanahoshi-mona-ui-dropdowns.d.ts +55 -1
  174. package/types/nanahoshi-mona-ui-editor.d.ts +31 -0
  175. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +13 -0
  176. package/types/nanahoshi-mona-ui-fieldset.d.ts +5 -0
  177. package/types/nanahoshi-mona-ui-grid.d.ts +162 -35
  178. package/types/nanahoshi-mona-ui-i18n.d.ts +144 -1
  179. package/types/nanahoshi-mona-ui-internal-list.d.ts +16 -1
  180. package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +165 -0
  181. package/types/nanahoshi-mona-ui-internal-tree.d.ts +21 -2
  182. package/types/nanahoshi-mona-ui-internal.d.ts +4 -5
  183. package/types/nanahoshi-mona-ui-label.d.ts +1 -0
  184. package/types/nanahoshi-mona-ui-list-box.d.ts +27 -4
  185. package/types/nanahoshi-mona-ui-list-view.d.ts +34 -1
  186. package/types/nanahoshi-mona-ui-list.d.ts +1 -1
  187. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +10 -0
  188. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +10 -0
  189. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +10 -0
  190. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +10 -0
  191. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +10 -0
  192. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +10 -0
  193. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +10 -0
  194. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +10 -0
  195. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +10 -0
  196. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +10 -0
  197. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +10 -0
  198. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +10 -0
  199. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +10 -0
  200. package/types/nanahoshi-mona-ui-menubar.d.ts +10 -3
  201. package/types/nanahoshi-mona-ui-multi-select.d.ts +3 -3
  202. package/types/nanahoshi-mona-ui-notification.d.ts +9 -0
  203. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +1 -1
  204. package/types/nanahoshi-mona-ui-otp-input.d.ts +1 -0
  205. package/types/nanahoshi-mona-ui-pager.d.ts +5 -1
  206. package/types/nanahoshi-mona-ui-popover.d.ts +9 -1
  207. package/types/nanahoshi-mona-ui-popup-menu.d.ts +48 -161
  208. package/types/nanahoshi-mona-ui-popup.d.ts +16 -0
  209. package/types/nanahoshi-mona-ui-progress-bar.d.ts +4 -0
  210. package/types/nanahoshi-mona-ui-rating.d.ts +2 -0
  211. package/types/nanahoshi-mona-ui-segmented.d.ts +1 -0
  212. package/types/nanahoshi-mona-ui-sheet.d.ts +1 -1
  213. package/types/nanahoshi-mona-ui-slider.d.ts +2 -0
  214. package/types/nanahoshi-mona-ui-spinner.d.ts +7 -0
  215. package/types/nanahoshi-mona-ui-split-button.d.ts +7 -4
  216. package/types/nanahoshi-mona-ui-stepper.d.ts +11 -2
  217. package/types/nanahoshi-mona-ui-tabs.d.ts +4 -1
  218. package/types/nanahoshi-mona-ui-text-box.d.ts +9 -1
  219. package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -1
  220. package/types/nanahoshi-mona-ui-tooltip.d.ts +10 -2
  221. package/types/nanahoshi-mona-ui-tree-view.d.ts +6 -5
  222. package/types/nanahoshi-mona-ui-window.d.ts +66 -1
@@ -0,0 +1,403 @@
1
+ # Theming
2
+
3
+ > Customize colors, density and shape through design tokens.
4
+
5
+ Entry point: `@nanahoshi/mona-ui/theme`
6
+
7
+ `@nanahoshi/mona-ui/theme` writes a theme's colors, shadows, motion and materials to `<html>` as CSS variables. Components read those variables through Tailwind classes, so a theme can change while the application runs, without a stylesheet of its own.
8
+
9
+ There are three built-in themes: `mona` (light and dark), `luna` (light and dark) and `anna` (dark only).
10
+
11
+ ---
12
+
13
+ ## 1. Setup
14
+
15
+ Add the package's stylesheet after Tailwind:
16
+
17
+ ```css
18
+ @import "tailwindcss";
19
+ @import "@nanahoshi/mona-ui/styles.css";
20
+
21
+ body {
22
+ background-color: var(--color-canvas);
23
+ color: var(--color-foreground);
24
+ }
25
+ ```
26
+
27
+ It does two things. It tells Tailwind to scan the package for the classes its components use, and it declares the tokens those classes name in a `@theme` block. The values there are Mona Light. Without a provider they're what you get, and without the `@theme` block a class like `bg-primary` wouldn't be generated at all.
28
+
29
+ Any theme provider applies the theme at startup, before the first component renders. A configuration that can't be applied, such as an unknown theme name, throws during bootstrap.
30
+
31
+ ```ts
32
+ import { provideThemeOptions } from "@nanahoshi/mona-ui/theme";
33
+
34
+ bootstrapApplication(AppComponent, {
35
+ providers: [provideThemeOptions({ initialTheme: { name: "luna", variant: "system" } })]
36
+ });
37
+ ```
38
+
39
+ An application with no theme provider has no theme written until something injects `ThemeService`.
40
+
41
+ ---
42
+
43
+ ## 2. Choosing a Theme
44
+
45
+ Mona Light is the default. `provideThemeOptions()` chooses another, and `ThemeService.setTheme()` switches at runtime.
46
+
47
+ ```ts
48
+ import { inject } from "@angular/core";
49
+ import { ThemeService } from "@nanahoshi/mona-ui/theme";
50
+
51
+ export class AppearanceSettings {
52
+ readonly #theme = inject(ThemeService);
53
+
54
+ protected useDark(): void {
55
+ this.#theme.setTheme({ name: "mona", variant: "dark" });
56
+ }
57
+ }
58
+ ```
59
+
60
+ Unknown themes and variants a theme doesn't have throw, and leave the signals and the page as they were. To offer only what exists, use `availableThemes()` to list the themes and their variants, and `supportsVariant(name, variant)` to check one.
61
+
62
+ ### Following the system
63
+
64
+ `variant: "system"` follows the operating system's light or dark setting, and keeps following it. A theme with one variant, such as Anna, takes that variant whatever the system says.
65
+
66
+ - `preference()` says what was asked for, which is where `"system"` shows.
67
+ - `selection()`, `themeName()` and `themeVariant()` say what's in effect, so `themeVariant()` is only ever `"light"` or `"dark"`.
68
+
69
+ The service also sets `color-scheme` on the root, so native controls and scrollbars match the variant.
70
+
71
+ ### Remembering the choice
72
+
73
+ Give `provideThemeOptions()` a `persistKey`, and `setTheme()` remembers what was chosen. It's restored in place of `initialTheme` on the next load.
74
+
75
+ ```ts
76
+ providers: [provideThemeOptions({ initialTheme: { name: "mona", variant: "system" }, persistKey: "app-theme" })];
77
+ ```
78
+
79
+ It's kept in `localStorage` as JSON by default. A stored value that isn't a preference, or names a theme that no longer exists, counts as nothing stored, and it stays in storage. It's only written when it changes. For anywhere else, implement `ThemeStorage` and supply it with `provideThemeStorage()`, or replace `THEME_STORAGE` by hand. A storage that throws doesn't stop the application, and reports an error in development.
80
+
81
+ ### Avoiding a flash on load
82
+
83
+ The theme can't be applied before the application's code has loaded, so a dark theme can show the light canvas for a moment. A small script in `<head>` covers that gap. It sets the same variables the service sets, so the service overwrites them at startup and nothing has to be removed.
84
+
85
+ ```html
86
+ <script>
87
+ (function () {
88
+ var stored = null;
89
+ try {
90
+ stored = JSON.parse(localStorage.getItem("app-theme"));
91
+ } catch (error) {}
92
+ var variant = stored && stored.variant !== "system" ? stored.variant : null;
93
+ var dark = variant ? variant === "dark" : matchMedia("(prefers-color-scheme: dark)").matches;
94
+ var root = document.documentElement.style;
95
+ root.setProperty("color-scheme", dark ? "dark" : "light");
96
+ root.setProperty("--color-canvas", dark ? "oklch(14.1% 0.005 285.823)" : "oklch(98.5% 0 0)");
97
+ })();
98
+ </script>
99
+ ```
100
+
101
+ Use your own key and your theme's canvas colors. The values above are Mona's. A Content Security Policy has to allow this inline script, by hash or nonce.
102
+
103
+ ### Server rendering
104
+
105
+ `localStorage` can't answer on the server, so a server-rendered application gets `initialTheme` in its markup and the remembered theme on hydration. A storage the server can read too, such as a cookie, avoids that. Supply it with a factory, which runs in an injection context, where `CookieThemeStorage` is a class of your own:
106
+
107
+ ```ts
108
+ providers: [provideThemeStorage(() => new CookieThemeStorage(inject(REQUEST)))];
109
+ ```
110
+
111
+ Luna also changes on hydration in any case, because `backdrop-filter` support can only be read in a browser: the server renders its reduced material, and the client switches to the full one.
112
+
113
+ ---
114
+
115
+ ## 3. Color Roles
116
+
117
+ Mona's colors describe intent instead of a specific component:
118
+
119
+ - `canvas` is the application backdrop; `surface` is the normal content plane.
120
+ - `surface-raised` contains controls and elevated regions; `surface-overlay` is reserved for menus, popups, and dialogs.
121
+ - `input-background` and the control-border tokens give form fields, buttons and other outlined controls a quiet boundary, so they match side by side. It's below the 3:1 of WCAG 1.4.11 unless the user asks for more contrast, as [Contrast and Forced Colors](#10-contrast-and-forced-colors) explains. Hover changes a field's border, and focus and invalid states add their own cue.
122
+ - `hover` and `active` are neutral, temporary interaction feedback.
123
+ - `accent` is persistent selection and keyboard highlighting. Mona's built-in accent is a quiet zinc tone rather than a competing hue.
124
+ - `primary` is the stronger action color used by prominent buttons, links, and focus indicators. It is near-black in Mona Light and near-white in Mona Dark.
125
+
126
+ This separation lets the same textbox work on a page or inside a dropdown without turning every hover state into brand color. The built-in palette is monochrome except for success, error, warning, and info, where color communicates meaning.
127
+
128
+ Not all of these reach a component through a named utility. Slider ranges, progress, switches, radio dots, tab bars and steps use an optional `--mona-indicator-color`, with `--mona-indicator-foreground` for what sits on it. Both fall back to the primary pair, and a theme sets them through `custom`. Anna uses them to keep its violet under labels while its fills use a lighter tone with 3:1 against the surface.
129
+
130
+ ---
131
+
132
+ ## 4. A Palette from Brand Colors
133
+
134
+ Use `provideThemeColorPalette()` for a contrast-fitted light and dark palette. Only `primary` is required. Optional seeds replace their own role; an omitted secondary or status seed keeps Mona's built-in value.
135
+
136
+ ```ts
137
+ import { provideThemeColorPalette } from "@nanahoshi/mona-ui/theme";
138
+
139
+ bootstrapApplication(AppComponent, {
140
+ providers: [
141
+ provideThemeColorPalette({
142
+ theme: "mona",
143
+ seeds: {
144
+ primary: "#7444c3",
145
+ secondary: "hsl(212 27% 39%)",
146
+ success: "oklch(62% 0.14 150)",
147
+ error: "rgb(194 65 59)",
148
+ warning: "#b36b00",
149
+ info: "oklch(60% 0.15 255)"
150
+ }
151
+ })
152
+ ]
153
+ });
154
+ ```
155
+
156
+ Seeds may use opaque CSS Color Level 4 syntax, including hex, RGB, HSL, and OKLCH. Seed hue and chroma establish identity; Mona generates variant-aware tones and adjusts lightness and chroma when required for WCAG contrast and sRGB gamut. Invalid or translucent seeds throw a role-specific configuration error.
157
+
158
+ You can also call `generateThemeColorPalette()` directly when you need to inspect the immutable light and dark color maps before registration.
159
+
160
+ ---
161
+
162
+ ## 5. Explicit Overrides
163
+
164
+ Register application-wide color additions and overrides in your root bootstrap providers:
165
+
166
+ ```ts
167
+ import { provideThemeOverrides } from "@nanahoshi/mona-ui/theme";
168
+
169
+ bootstrapApplication(AppComponent, {
170
+ providers: [
171
+ provideThemeOverrides({
172
+ theme: "mona",
173
+ common: {
174
+ colors: {
175
+ "--color-brand": "oklch(62% 0.18 280)"
176
+ }
177
+ },
178
+ light: {
179
+ colors: {
180
+ "--color-primary": "oklch(48% 0.16 280)",
181
+ "--color-primary-foreground": "white"
182
+ }
183
+ },
184
+ dark: {
185
+ colors: {
186
+ "--color-primary": "oklch(72% 0.14 280)",
187
+ "--color-primary-foreground": "oklch(18% 0.02 280)"
188
+ }
189
+ }
190
+ })
191
+ ]
192
+ });
193
+ ```
194
+
195
+ `common` values apply to light and dark variants. Variant-specific values override `common` values. You can register the helper more than once; later providers override earlier providers while preserving unrelated values.
196
+
197
+ Generated palettes use the same ordered provider pipeline. Place `provideThemeOverrides()` after `provideThemeColorPalette()` to fine-tune any generated token:
198
+
199
+ ```ts
200
+ providers: [
201
+ provideThemeColorPalette({ theme: "mona", seeds: { primary: "#7444c3" } }),
202
+ provideThemeOverrides({
203
+ theme: "mona",
204
+ dark: { colors: { "--color-primary": "oklch(74% 0.14 308.49)" } }
205
+ })
206
+ ];
207
+ ```
208
+
209
+ Theme registrations are static root-level configuration. They customize the global theme written by `ThemeService`; component-level providers do not create independently scoped themes.
210
+
211
+ ---
212
+
213
+ ## 6. Brand Colors at Runtime
214
+
215
+ Inject `ThemeService` when the application user can choose a brand color after bootstrap. A single primary seed regenerates all related semantic roles and updates the root variables immediately:
216
+
217
+ ```ts
218
+ import { inject } from "@angular/core";
219
+ import { ThemeService } from "@nanahoshi/mona-ui/theme";
220
+
221
+ export class AppearanceSettings {
222
+ readonly #theme = inject(ThemeService);
223
+
224
+ protected usePrimaryColor(color: string): void {
225
+ this.#theme.setPrimaryColor(color);
226
+ }
227
+
228
+ protected restoreConfiguredPalette(): void {
229
+ this.#theme.clearColorPalette();
230
+ }
231
+ }
232
+ ```
233
+
234
+ Use `setColorPalette()` when users can customize more roles:
235
+
236
+ ```ts
237
+ themeService.setColorPalette({
238
+ primary: "#3f6be2",
239
+ secondary: "#526070",
240
+ success: "#287a4b"
241
+ });
242
+ ```
243
+
244
+ The runtime palette is applied after registered profiles and provider overrides. It remains active when `setTheme()` switches families or variants, using its generated light or dark tones as appropriate. `clearColorPalette()` restores the provider-resolved palette. `colorPaletteSeeds` is a readonly signal for displaying the current runtime choice.
245
+
246
+ Runtime updates are atomic: invalid or translucent colors throw before the active profile, signals, or root styles change. `persistKey` remembers the theme, not the palette. To keep a runtime palette, save its seeds in your own settings store and apply them again at startup.
247
+
248
+ A seed gives a hue and a chroma, and Mona chooses the lightness each role needs for contrast. `setPrimaryColor("#fff")` and `setPrimaryColor("#000")` come to the same color, so a palette can't reproduce an exact brand color. To use one, set it with `provideThemeOverrides()`, and check its contrast yourself.
249
+
250
+ ---
251
+
252
+ ## 7. Registering a Theme
253
+
254
+ Custom families provide one or both variants. Every declared variant is a complete, independent `ThemeProfile` with `colors`, `shadows`, `motion`, `effects`, `shape`, and `components` sections. The only optional tokens are the two contrast border colors in [Contrast and Forced Colors](#10-contrast-and-forced-colors):
255
+
256
+ ```ts
257
+ import { provideThemeFamily, type ThemeFamilyRegistration } from "@nanahoshi/mona-ui/theme";
258
+ import { auroraDarkProfile } from "./aurora-dark-profile";
259
+
260
+ const auroraTheme = {
261
+ name: "aurora",
262
+ variants: { dark: auroraDarkProfile }
263
+ } satisfies ThemeFamilyRegistration;
264
+
265
+ providers: [provideThemeFamily(auroraTheme)];
266
+ ```
267
+
268
+ The profile must declare the full canonical token contract. The required `effects` section defines control, raised, and overlay materials, including opaque fallbacks; `shape` defines the shared small, medium, and large radius scale. Optional custom variables may not collide with required profile variables. Mona UI automatically substitutes effect fallbacks when backdrop filtering is unavailable or reduced transparency is requested.
269
+
270
+ ### Using New Color Names with Tailwind
271
+
272
+ Registering `--color-brand` creates the runtime CSS variable, but Tailwind discovers named utilities at build time. To generate utilities such as `bg-brand`, declare the token in your application's `@theme` block:
273
+
274
+ ```css
275
+ @theme {
276
+ --color-brand: transparent;
277
+ }
278
+ ```
279
+
280
+ Alternatively, use `bg-(--color-brand)` or ordinary CSS such as `color: var(--color-brand)` without adding a named Tailwind token.
281
+
282
+ A custom theme can start from a built-in one, since `monaTheme`, `lunaTheme`, `annaTheme` and `builtInThemes` are exported. A strategy can wrap `DefaultThemeStrategy`, and a custom one can report its themes through an optional `availableThemes()`. Without it, `ThemeService.availableThemes()` is empty.
283
+
284
+ ### What's checked
285
+
286
+ A name with whitespace, a duplicate theme, a theme with no variants, and an override for a theme or variant that doesn't exist all throw when the application starts.
287
+
288
+ In development, custom themes and overrides are also checked, and each problem logs a warning:
289
+
290
+ - A value that isn't a color.
291
+ - A custom variable without `--`.
292
+ - A main pair below what AA needs: 4.5:1 for `--color-foreground` and `--color-muted-foreground` on `--color-surface`, `--color-input-foreground` on `--color-input-background`, and `--color-primary-foreground` on `--color-primary`, and 3:1 for `--color-focus-indicator` and `--color-selected-border` on `--color-surface`, and for `--color-border-control-contrast` and `--color-border-control-contrast-hover` on `--color-input-background` when a theme sets them.
293
+
294
+ Values it can't read, such as `color-mix()`, aren't reported, because they may well be right.
295
+
296
+ ---
297
+
298
+ ## 8. Theming Part of a Page
299
+
300
+ `provideThemeRoot()` writes the theme to an element in place of `<html>`, for an application embedded in a larger page. It sets `THEME_ROOT`, which defaults to `<html>`. The element, or a factory for it, has to exist at startup.
301
+
302
+ ```ts
303
+ providers: [provideThemeRoot(() => document.getElementById("app-shell"))];
304
+ ```
305
+
306
+ - Overlays render outside that element, so the overlay container gets the theme too. It gets it a moment after startup, because the overlay module loads on demand, and an overlay opened before that gets its colors when it arrives.
307
+ - Only what's in the overlay container follows. A full-page spinner sits on `body`, so it keeps the page's own colors.
308
+ - Charts inside the element follow a switch.
309
+
310
+ ### One writer for each element
311
+
312
+ Only one service should write to an element. If two do, the later one owns it: it warns in development, and the earlier one's `selection()` stops being true. Give each application its own element with `provideThemeRoot()`.
313
+
314
+ A theme is written once per application. Component-level providers don't create a theme of their own.
315
+
316
+ When the application's injector is destroyed, the service removes the variables and the `data-mona-*` attributes it wrote, and `color-scheme` with them.
317
+
318
+ ---
319
+
320
+ ## 9. Attributes on the Root
321
+
322
+ | Attribute | Value |
323
+ | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
324
+ | `data-mona-theme` | The theme's name. |
325
+ | `data-mona-variant` | `light` or `dark`. |
326
+ | `data-mona-transparency` | `full`, or `reduced` when materials are opaque, because the browser has no `backdrop-filter` or the user asked for less transparency. |
327
+
328
+ ---
329
+
330
+ ## 10. Contrast and Forced Colors
331
+
332
+ The built-in themes meet WCAG AA with one deliberate exception. A field's border is quiet by default, below the 3:1 that WCAG 1.4.11 asks for, so a field whose background matches its surface is harder to make out.
333
+
334
+ When the user asks for more contrast (`prefers-contrast: more`), the theme service replaces `--color-border-control` and `--color-border-control-hover` with `--color-border-control-contrast` and `--color-border-control-contrast-hover`, which are at least 3:1 on every surface, and a slider's track gains a border. Everything that shares those tokens follows, including buttons, chips and chart gridlines. A custom theme without the contrast tokens keeps its own border. If it sets them, the development check warns when they're below 3:1. If your application has to meet 1.4.11 for everyone, set `--color-border-control` and `--color-border-control-hover` to at least 3:1 in a custom theme.
335
+
336
+ A spec checks the rest: text is 4.5:1, and focus indicators, selected borders, chart colors and scrollbar thumbs are 3:1.
337
+
338
+ In forced colors the browser replaces most of these colors, and rings and many backgrounds don't paint. When you add your own styles to a component or build on the tokens:
339
+
340
+ - Pair `outline-none` with `focus-visible:outline-hidden`, which draws an outline there and nothing elsewhere.
341
+ - Give a state drawn only by a background `forced-colors:bg-[Highlight]`.
342
+ - Where the color is the content, or text sits on it, use `forced-color-adjust-none`. Otherwise the browser paints a Canvas backplate behind the text, which can leave it white on white.
343
+
344
+ ---
345
+
346
+ ## 11. Replacing Profile Resolution
347
+
348
+ Advanced integrations can provide their own `ThemeStrategy` through `THEME_STRATEGY`. Most applications should use the family and override providers instead.
349
+
350
+ ## API
351
+
352
+ ### `ThemeService`
353
+
354
+ Provided in root. It's created by any theme provider at startup, or by the first thing that injects it.
355
+
356
+ #### Signals
357
+
358
+ | Name | Type | Description |
359
+ | ------------------- | ---------------------------------------- | ------------------------------------------------------------------- |
360
+ | `colorPaletteSeeds` | `Signal<ThemeColorPaletteSeeds \| null>` | The seeds of the runtime palette, or `null` when none is active. |
361
+ | `preference` | `Signal<ThemePreference>` | What was asked for. This is where `"system"` shows. |
362
+ | `profile` | `Signal<ThemeProfile>` | The tokens in effect. |
363
+ | `selection` | `Signal<ThemeSelection>` | The theme and variant in effect, which is always `light` or `dark`. |
364
+ | `themeName` | `Signal<ThemeName>` | The name from `selection`. |
365
+ | `themeVariant` | `Signal<ThemeVariant>` | The variant from `selection`. |
366
+
367
+ #### Methods
368
+
369
+ | Method | Description |
370
+ | -------------------------------- | ------------------------------------------------------------------------------------------------------------- |
371
+ | `availableThemes()` | The registered themes and their variants. Empty for a custom strategy with no `availableThemes()` of its own. |
372
+ | `clearColorPalette()` | Removes the runtime palette, and restores the registered profile and overrides. |
373
+ | `setColorPalette(seeds)` | Applies a generated palette after all overrides, and keeps it across theme switches. Throws on a bad seed. |
374
+ | `setPrimaryColor(primary)` | Changes only the primary seed, and keeps any other seeds. |
375
+ | `setTheme(preference)` | Switches theme, and remembers it if there's a `persistKey`. Throws on an unknown theme or variant. |
376
+ | `supportsVariant(name, variant)` | Whether `setTheme` would accept this. |
377
+
378
+ ### Providers
379
+
380
+ | Provider | Description |
381
+ | ----------------------------------- | ------------------------------------------------------------------------------------------- |
382
+ | `provideThemeOptions(options)` | Sets `initialTheme`, and `persistKey` if the theme should be remembered. |
383
+ | `provideThemeFamily(registration)` | Registers a theme with one or both variants. |
384
+ | `provideThemeOverrides(override)` | Changes tokens of a registered theme. Later providers override earlier ones. |
385
+ | `provideThemeColorPalette(palette)` | Generates a light and a dark palette from seed colors, and applies whichever the theme has. |
386
+ | `provideThemeRoot(root)` | Writes the theme to an element in place of `<html>`, and to the overlay container. |
387
+ | `provideThemeStorage(storage)` | Replaces where the theme is remembered. It's only used when there's a `persistKey`. |
388
+
389
+ ### Tokens
390
+
391
+ | Token | Type | Default |
392
+ | ---------------- | --------------------- | --------------------------------------------- |
393
+ | `THEME_ROOT` | `HTMLElement \| null` | `document.documentElement` |
394
+ | `THEME_STORAGE` | `ThemeStorage` | `LocalStorageThemeStorage` |
395
+ | `THEME_STRATEGY` | `ThemeStrategy` | `DefaultThemeStrategy` with what's registered |
396
+
397
+ ### Exported Types and Values
398
+
399
+ - **Selections:** `ThemeName`, `ThemeVariant`, `ThemeVariantPreference`, `ThemePreference`, `ThemeSelection`, `ThemeAvailability`.
400
+ - **Definitions:** `ThemeProfile`, `ThemeFamilyRegistration`, `ThemeOverrideRegistration`, `ThemeOptions`, `ThemeColorPaletteRegistration`, `ThemeColorPaletteSeeds`.
401
+ - **Extending:** `ThemeStrategy`, `ThemeStorage`, `DefaultThemeStrategy`, `LocalStorageThemeStorage`.
402
+ - **Built-in themes:** `monaTheme`, `lunaTheme`, `annaTheme`, `builtInThemes`.
403
+ - **Helpers:** `generateThemeColorPalette`, `flattenThemeProfile`, `createSidebarColorRoles`.
@@ -0,0 +1,254 @@
1
+ # Time Picker
2
+
3
+ > A time input that opens a time selector popup.
4
+
5
+ Entry point: `@nanahoshi/mona-ui/time-picker`
6
+
7
+ **Selector:** `mona-time-picker`
8
+
9
+ `TimePickerComponent` is a time input that opens a time selector popup. Users can type a time in the locale's format or pick the hours, minutes and seconds from lists.
10
+
11
+ ## Overview
12
+
13
+ Use `TimePickerComponent` for a time of day in a form field, where users may type the time or pick it from lists of hours, minutes and seconds. The lists stay hidden until the user opens them.
14
+
15
+ Use `DateTimePickerComponent` instead when the value also needs a date, and `DatePickerComponent` when it is only a date.
16
+
17
+ ## Import & Quick Start
18
+
19
+ ```typescript
20
+ import { TimePickerComponent } from "@nanahoshi/mona-ui/time-picker";
21
+ ```
22
+
23
+ ```html
24
+ <label for="meeting-time">Meeting time</label>
25
+ <mona-time-picker inputId="meeting-time" [(value)]="meetingTime"></mona-time-picker>
26
+ ```
27
+
28
+ ```typescript
29
+ protected readonly meetingTime = signal<Date | null>(null);
30
+ ```
31
+
32
+ The value is a `Date`. Only its time of day is chosen; a time typed into an empty picker is put on today's date.
33
+
34
+ ## Appearance & Styling
35
+
36
+ ### Size and rounding
37
+
38
+ ```html
39
+ <mona-time-picker [(value)]="time" size="large" rounded="full"></mona-time-picker>
40
+ ```
41
+
42
+ 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 time selector.
43
+
44
+ `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 the time selector.
45
+
46
+ ### Clock and steps
47
+
48
+ ```html
49
+ <mona-time-picker [(value)]="time" hourFormat="24" [minuteStep]="15" [showSeconds]="true"></mona-time-picker>
50
+ ```
51
+
52
+ `hourFormat` is `"12"`, with an AM/PM list, or `"24"`. When it is `null`, the active locale's clock is used: 12-hour for `en-US`, 24-hour for `de-DE`. `hourStep`, `minuteStep` and `secondStep` set the distance between list items, and `showSeconds` adds the seconds list.
53
+
54
+ ## Behavior
55
+
56
+ ### Typing a time
57
+
58
+ 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 hours, minutes and seconds.
59
+
60
+ Typed text is written to `value` on `Enter` and when the input loses focus, on the current value's day (today when empty). Text that isn't a time keeps the previous value and reports a `parse` error. A time before `min` or after `max` reports a `minDate` or `maxDate` error instead of setting the value. Only the time of day of `min` and `max` is compared. Clearing the text, or pressing the clear button shown by `showClearButton`, sets `value` to `null` at once.
61
+
62
+ ### Picking from the popup
63
+
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
+
66
+ ### Disabled and read-only
67
+
68
+ `disabled` and `readonly` keep the popup from opening. `readonlyInput` blocks typing but keeps the popup button working, so the time can only be picked.
69
+
70
+ ### Popup events
71
+
72
+ `open` and `close` fire before the popup opens or closes, and both can be prevented. `opened` and `closed` fire after.
73
+
74
+ ## Forms Integration
75
+
76
+ `TimePickerComponent` implements `FormValueControl<Date | null>` from `@angular/forms/signals`.
77
+
78
+ ```typescript
79
+ import { signal } from "@angular/core";
80
+ import { FormField, form, required } from "@angular/forms/signals";
81
+
82
+ protected readonly form = form(signal<{ time: Date | null }>({ time: null }), schema => {
83
+ required(schema.time);
84
+ });
85
+ ```
86
+
87
+ ```html
88
+ <mona-time-picker [formField]="form.time"></mona-time-picker>
89
+ ```
90
+
91
+ 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 time selector doesn't mark the field touched.
92
+
93
+ Typing errors (`parse`, `minDate`, `maxDate`) are reported to the bound form field, whether it is a signal form, `ngModel` or a reactive form control.
94
+
95
+ ## Accessibility
96
+
97
+ 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 `timePicker` message ("Time picker"). It traps focus, and the time selector inside takes focus when it opens.
98
+
99
+ | Attribute | Where | Value |
100
+ |---|---|---|
101
+ | `role` | Input | `"combobox"` |
102
+ | `aria-haspopup` | Input | `"dialog"` |
103
+ | `aria-expanded` | Input | `"true"` while the popup is open, otherwise `"false"` |
104
+ | `aria-controls` | Input and popup button | The popup's `id` |
105
+ | `aria-label`, `aria-labelledby`, `aria-describedby` | Input | The matching inputs on the picker |
106
+ | `aria-invalid` | Input and host | `"true"` on a typing error, or once `touched` and either `invalid`, or `required` with no time |
107
+ | `aria-label` | Popup button | The `openTimePicker` message ("Open time picker") |
108
+ | `role` | Popup | `"dialog"`, with `aria-modal="true"` |
109
+ | `role` | Time selector | `"group"`, named by its `timeSelector` message |
110
+ | `aria-label` | Each list in the time selector | Its hours, minutes, seconds or AM/PM message |
111
+ | `aria-activedescendant` | Each list in the time selector | The item at the shown time |
112
+
113
+ The popup button has `tabindex="-1"`, so the picker is one Tab stop. Keyboard users open the popup with `Alt+ArrowDown`.
114
+
115
+ **Consumer responsibilities**
116
+
117
+ - 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.
118
+ - Link hint or error text with `aria-describedby`.
119
+
120
+ ### Keyboard Interaction
121
+
122
+ | Key | Where | Action |
123
+ |---|---|---|
124
+ | `Alt+ArrowDown` | Input | Opens the popup |
125
+ | `Alt+ArrowUp` | Input | Closes the popup |
126
+ | `Escape` | Input or popup | Closes the popup |
127
+ | `Enter` | Input | Writes the typed text to `value` |
128
+ | `ArrowUp` / `ArrowDown` | Time selector list | Moves to the previous or next item |
129
+ | `ArrowLeft` / `ArrowRight` | Time selector list | Moves to the list on that side, also in right-to-left layouts, wrapping around at the ends |
130
+ | `Home` / `End` | Time selector list | Moves to the first or last item |
131
+ | `Enter` / `Space` | Time selector list | Sets the shown time and closes the popup |
132
+
133
+ Closing the popup returns focus to the input, unless the user moved focus elsewhere.
134
+
135
+ ## API
136
+
137
+ Everything below is imported from `@nanahoshi/mona-ui/time-picker`.
138
+
139
+ ### `TimePickerComponent`
140
+
141
+ **Selector:** `mona-time-picker`
142
+ **Implements:** `FormValueControl<Date \| null>`
143
+
144
+ #### Inputs
145
+
146
+ | Name | Type | Default | Description |
147
+ | --- | --- | --- | --- |
148
+ | `aria-describedby` | `string` | `""` | Id of an element that describes the input, such as a hint or an error message. |
149
+ | `aria-label` | `string` | `""` | Accessible name of the input. Prefer a visible label, linked through `inputId` or `aria-labelledby`; the placeholder is not a label. |
150
+ | `aria-labelledby` | `string` | `""` | Id of the element that labels the input. |
151
+ | `class` | `string` | `""` | Extra classes for the input's container. |
152
+ | `disabled` | `boolean` | `false` | Sets the disabled state of the time picker. |
153
+ | `format` | `string \| null` | `null` | Sets the format of the time picker. If not specified, derives from the active locale, hourFormat, and showSeconds. Typed text is also accepted with one-digit hours, minutes and seconds. |
154
+ | `hourFormat` | `HourFormat \| null` | `null` | Sets the hour format of the time picker. When null, the active locale's clock is used: 12-hour for en-US, 24-hour for de-DE. |
155
+ | `hourStep` | `number` | `1` | Sets the hour step of the time picker. |
156
+ | `inputId` | `string` | `generated` | Id of the inner `<input>` element. Point a `<label for>` or `<mona-label for>` at it to label the time picker. A unique id is generated when it isn't set. |
157
+ | `invalid` | `boolean` | `false` | Marks the time picker as invalid. When bound to a signal form field via `[formField]`, this is written by the `FormField` directive. |
158
+ | `max` | `Date \| undefined` | `undefined` | Sets the latest time of the time picker. Only the time of day is compared; a later typed time is reported as a `maxDate` error. |
159
+ | `min` | `Date \| undefined` | `undefined` | Sets the earliest time of the time picker. Only the time of day is compared; an earlier typed time is reported as a `minDate` error. |
160
+ | `minuteStep` | `number` | `1` | Sets the minute step of the time picker. |
161
+ | `placeholder` | `string` | `""` | Sets the placeholder of the time picker. |
162
+ | `popupClass` | `string` | `""` | Sets the class of the popup element. |
163
+ | `popupHeight` | `ListSizeInputType` | `undefined` | Sets the height of the popup element. When not set, the popup fits the time selector. |
164
+ | `popupWidth` | `ListSizeInputType` | `undefined` | Sets the width of the popup element. When not set, the popup fits the time selector. |
165
+ | `readonly` | `boolean` | `false` | Sets the readonly state of the time picker. |
166
+ | `readonlyInput` | `boolean` | `false` | When true, the input is readonly but the popup button remains enabled. |
167
+ | `required` | `boolean` | `false` | Sets the required state of the time picker. When bound to a signal form field via `[formField]`, this is written by the `FormField` directive. |
168
+ | `rounded` | `"full" \| "large" \| "medium" \| "none" \| "small"` | `"medium"` | Sets the border radius of the time picker. |
169
+ | `secondStep` | `number` | `1` | Sets the second step of the time picker. |
170
+ | `showClearButton` | `boolean` | `false` | Sets the visibility of the clear button. Clearing empties the value at once. |
171
+ | `showSeconds` | `boolean` | `false` | Sets the visibility of the second selector. |
172
+ | `size` | `"large" \| "medium" \| "small"` | `"medium"` | Sets the size of the time picker. |
173
+ | `touched` | `boolean` | `false` | Sets the touched state of the time picker. When bound to a signal form field via `[formField]`, this is written by the `FormField` directive. |
174
+ | `value` (two-way) | `Date \| null` | `null` | Two-way bindable current time value. Typed text is written on Enter and when the input loses focus, on the current value's day (today when empty); text that isn't a valid time keeps the previous value and marks the field invalid. |
175
+
176
+ #### Outputs
177
+
178
+ | Name | Type | Description |
179
+ | --- | --- | --- |
180
+ | `close` | `PopupCloseEvent<unknown>` | Emits when the popup is about to close. This event is preventable. |
181
+ | `closed` | `void` | Emits after the popup is closed. |
182
+ | `open` | `PreventableEvent<Event>` | Emits when the popup is about to open. This event is preventable. |
183
+ | `opened` | `void` | Emits after the popup is opened. |
184
+ | `touch` | `void` | Emitted when focus leaves the time picker and its popup. The `FormField` directive listens to this to mark the field as touched. |
185
+ | `valueChange` | `Date \| null` | Emitted when `value` changes. |
186
+
187
+ #### Methods
188
+
189
+ | Signature | Description |
190
+ | --- | --- |
191
+ | `focus(options?: FocusOptions): void` | Focuses the input and places the caret after the text. Read-only pickers take focus too. |
192
+
193
+ ### Types
194
+
195
+ #### `TIME_PICKER_DEFAULT_MESSAGES`
196
+
197
+ ```typescript
198
+ const TIME_PICKER_DEFAULT_MESSAGES: MonaTimePickerMessages;
199
+ ```
200
+
201
+ #### `HourFormat`
202
+
203
+ From `@nanahoshi/mona-ui/date-input`.
204
+
205
+ ```typescript
206
+ type HourFormat = "12" | "24";
207
+ ```
208
+
209
+ #### `ListSizeInputType`
210
+
211
+ From `@nanahoshi/mona-ui/list`.
212
+
213
+ ```typescript
214
+ type ListSizeInputType = ListSizeType | number;
215
+ ```
216
+
217
+ #### `ListSizeType`
218
+
219
+ From `@nanahoshi/mona-ui/list`.
220
+
221
+ A CSS length, or nothing to leave it to the stylesheet.
222
+
223
+ ```typescript
224
+ type ListSizeType = string | null | undefined;
225
+ ```
226
+
227
+ #### `MonaTimePickerMessages`
228
+
229
+ From `@nanahoshi/mona-ui/i18n`.
230
+
231
+ | Name | Type |
232
+ | --- | --- |
233
+ | `openTimePicker` (read-only) | `string` |
234
+ | `timePicker` (read-only) | `string` |
235
+
236
+ #### `PreventableEvent`
237
+
238
+ From `@nanahoshi/mona-ui/common`.
239
+
240
+ **Type parameters:** `E extends Event = Event`
241
+
242
+ | Name | Type | Description |
243
+ | --- | --- | --- |
244
+ | `originalEvent` (read-only) | `E \| undefined` | The DOM event that caused this one, when there is one. |
245
+ | `type` (read-only) | `string \| undefined` | A name for the kind of event, when the component that emits it sets one. |
246
+
247
+ **Methods**
248
+
249
+ | Signature | Description |
250
+ | --- | --- |
251
+ | `isDefaultPrevented(): boolean` | Whether `preventDefault()` was called. |
252
+ | `preventDefault(): void` | Cancels what the event announces, such as opening or closing a popup, or closing a dialog. |
253
+
254
+ **Documented elsewhere:** [`PopupCloseEvent`](popup.md)