@nanahoshi/mona-ui 0.24.10 → 0.25.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 (165) hide show
  1. package/README.md +9 -0
  2. package/chart/README.md +223 -77
  3. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +11 -10
  4. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +37 -20
  5. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +239 -47
  6. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +184 -31
  7. package/fesm2022/nanahoshi-mona-ui-button.mjs +47 -11
  8. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +17 -13
  9. package/fesm2022/nanahoshi-mona-ui-card.mjs +54 -30
  10. package/fesm2022/nanahoshi-mona-ui-chart.mjs +1909 -666
  11. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +112 -31
  12. package/fesm2022/nanahoshi-mona-ui-chip.mjs +131 -89
  13. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +59 -19
  14. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +118 -41
  15. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +243 -212
  16. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +155 -86
  17. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +161 -131
  18. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +12 -11
  19. package/fesm2022/nanahoshi-mona-ui-common.mjs +18 -1
  20. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +10 -9
  21. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +10 -9
  22. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +2 -2
  23. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +2 -2
  24. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +10 -9
  25. package/fesm2022/nanahoshi-mona-ui-editor.mjs +25 -24
  26. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +202 -33
  27. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +31 -10
  28. package/fesm2022/nanahoshi-mona-ui-filter.mjs +1 -1
  29. package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-DhKLnW06.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-2tVhD2hK.mjs} +2 -2
  30. package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-voGbKOiB.mjs → nanahoshi-mona-ui-grid-grid-list.component-BAN70Wcn.mjs} +4 -4
  31. package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-HQ1Kv6R9.mjs → nanahoshi-mona-ui-grid-grid-row.component-C_kCaA5b.mjs} +7 -7
  32. package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-PNLJFcuH.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-BsNfrAHz.mjs} +4 -4
  33. package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BO19AVwC.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CEfVa7eo.mjs} +27 -29
  34. package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
  35. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +146 -5
  36. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +2 -2
  37. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +1 -1
  38. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +5 -5
  39. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +7 -7
  40. package/fesm2022/nanahoshi-mona-ui-internal.mjs +183 -47
  41. package/fesm2022/nanahoshi-mona-ui-label.mjs +111 -15
  42. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +1 -1
  43. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +1 -1
  44. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +111 -5
  45. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +103 -5
  46. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +103 -5
  47. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +100 -6
  48. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +90 -5
  49. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +103 -5
  50. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +90 -5
  51. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +90 -5
  52. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +103 -5
  53. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +105 -5
  54. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +103 -5
  55. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +90 -5
  56. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +90 -5
  57. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +2 -2
  58. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +14 -13
  59. package/fesm2022/nanahoshi-mona-ui-notification.mjs +1 -1
  60. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +13 -12
  61. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +192 -56
  62. package/fesm2022/nanahoshi-mona-ui-pager.mjs +1 -1
  63. package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +3 -1
  64. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +2 -2
  65. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +60 -29
  66. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +334 -37
  67. package/fesm2022/nanahoshi-mona-ui-rating.mjs +84 -30
  68. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +274 -108
  69. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +127 -37
  70. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +2 -2
  71. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +595 -170
  72. package/fesm2022/nanahoshi-mona-ui-skeleton.mjs +3 -2
  73. package/fesm2022/nanahoshi-mona-ui-slider.mjs +323 -166
  74. package/fesm2022/nanahoshi-mona-ui-spinner.mjs +167 -82
  75. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +3 -3
  76. package/fesm2022/nanahoshi-mona-ui-splitter.mjs +273 -165
  77. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +219 -132
  78. package/fesm2022/nanahoshi-mona-ui-switch.mjs +84 -32
  79. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +337 -116
  80. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +10 -12
  81. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +21 -8
  82. package/fesm2022/nanahoshi-mona-ui-theme.mjs +444 -88
  83. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +10 -9
  84. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +15 -14
  85. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +17 -3
  86. package/fesm2022/nanahoshi-mona-ui-window.mjs +1 -1
  87. package/i18n/catalogs/en-US.messages.json +90 -5
  88. package/locales/ar-sa/ar-sa.messages.json +90 -5
  89. package/locales/de-de/de-de.messages.json +90 -5
  90. package/locales/es-es/es-es.messages.json +90 -5
  91. package/locales/fr-fr/fr-fr.messages.json +91 -6
  92. package/locales/id-id/id-id.messages.json +90 -5
  93. package/locales/it-it/it-it.messages.json +90 -5
  94. package/locales/ja-jp/ja-jp.messages.json +90 -5
  95. package/locales/ko-kr/ko-kr.messages.json +90 -5
  96. package/locales/pt-br/pt-br.messages.json +90 -5
  97. package/locales/ru-ru/ru-ru.messages.json +90 -5
  98. package/locales/tr-tr/tr-tr.messages.json +90 -5
  99. package/locales/zh-cn/zh-cn.messages.json +90 -5
  100. package/locales/zh-tw/zh-tw.messages.json +90 -5
  101. package/package.json +2 -1
  102. package/styles.css +156 -0
  103. package/types/nanahoshi-mona-ui-auto-complete.d.ts +1 -0
  104. package/types/nanahoshi-mona-ui-avatar.d.ts +18 -11
  105. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +62 -14
  106. package/types/nanahoshi-mona-ui-button-group.d.ts +86 -16
  107. package/types/nanahoshi-mona-ui-button.d.ts +26 -3
  108. package/types/nanahoshi-mona-ui-calendar.d.ts +1 -0
  109. package/types/nanahoshi-mona-ui-card.d.ts +22 -6
  110. package/types/nanahoshi-mona-ui-chart.d.ts +519 -527
  111. package/types/nanahoshi-mona-ui-check-box.d.ts +54 -13
  112. package/types/nanahoshi-mona-ui-chip.d.ts +31 -18
  113. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +21 -5
  114. package/types/nanahoshi-mona-ui-collapsible.d.ts +20 -11
  115. package/types/nanahoshi-mona-ui-color-gradient.d.ts +62 -36
  116. package/types/nanahoshi-mona-ui-color-palette.d.ts +65 -27
  117. package/types/nanahoshi-mona-ui-color-picker.d.ts +64 -23
  118. package/types/nanahoshi-mona-ui-combo-box.d.ts +1 -0
  119. package/types/nanahoshi-mona-ui-common.d.ts +28 -2
  120. package/types/nanahoshi-mona-ui-date-picker.d.ts +1 -0
  121. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +1 -0
  122. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +1 -0
  123. package/types/nanahoshi-mona-ui-editor.d.ts +1 -0
  124. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +51 -7
  125. package/types/nanahoshi-mona-ui-fieldset.d.ts +18 -4
  126. package/types/nanahoshi-mona-ui-grid.d.ts +0 -1
  127. package/types/nanahoshi-mona-ui-i18n.d.ts +130 -3
  128. package/types/nanahoshi-mona-ui-internal.d.ts +95 -14
  129. package/types/nanahoshi-mona-ui-label.d.ts +17 -2
  130. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +85 -0
  131. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +85 -0
  132. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +85 -0
  133. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +85 -0
  134. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +85 -0
  135. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +85 -0
  136. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +85 -0
  137. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +85 -0
  138. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +85 -0
  139. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +85 -0
  140. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +85 -0
  141. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +85 -0
  142. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +85 -0
  143. package/types/nanahoshi-mona-ui-multi-select.d.ts +1 -0
  144. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +1 -0
  145. package/types/nanahoshi-mona-ui-otp-input.d.ts +49 -12
  146. package/types/nanahoshi-mona-ui-placeholder.d.ts +2 -1
  147. package/types/nanahoshi-mona-ui-progress-bar.d.ts +21 -9
  148. package/types/nanahoshi-mona-ui-radio-button.d.ts +165 -20
  149. package/types/nanahoshi-mona-ui-rating.d.ts +21 -6
  150. package/types/nanahoshi-mona-ui-scroll-view.d.ts +59 -27
  151. package/types/nanahoshi-mona-ui-segmented.d.ts +52 -24
  152. package/types/nanahoshi-mona-ui-sidebar.d.ts +104 -41
  153. package/types/nanahoshi-mona-ui-skeleton.d.ts +1 -1
  154. package/types/nanahoshi-mona-ui-slider.d.ts +99 -35
  155. package/types/nanahoshi-mona-ui-spinner.d.ts +9 -5
  156. package/types/nanahoshi-mona-ui-splitter.d.ts +31 -10
  157. package/types/nanahoshi-mona-ui-stepper.d.ts +58 -12
  158. package/types/nanahoshi-mona-ui-switch.d.ts +32 -10
  159. package/types/nanahoshi-mona-ui-tabs.d.ts +75 -20
  160. package/types/nanahoshi-mona-ui-text-area.d.ts +7 -7
  161. package/types/nanahoshi-mona-ui-text-box.d.ts +2 -0
  162. package/types/nanahoshi-mona-ui-theme.d.ts +392 -15
  163. package/types/nanahoshi-mona-ui-time-picker.d.ts +1 -0
  164. package/types/nanahoshi-mona-ui-time-selector.d.ts +1 -0
  165. package/types/nanahoshi-mona-ui-tooltip.d.ts +7 -1
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, ElementRef, Renderer2, input, effect, Directive, DOCUMENT, signal, afterEveryRender, untracked } from '@angular/core';
2
+ import { inject, ElementRef, Renderer2, input, effect, Directive, InjectionToken, computed, signal, DestroyRef, DOCUMENT, afterEveryRender, untracked } from '@angular/core';
3
3
  import { GlobalPositionStrategy, ConnectionPositionPair } from '@angular/cdk/overlay';
4
4
  import { forEach } from '@mirei/ts-collections';
5
5
  import { Observable, timer, take, debounceTime, map, merge, scan, filter } from 'rxjs';
@@ -50,12 +50,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
50
50
  const isValidHex = (hex) => {
51
51
  return /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(hex);
52
52
  };
53
- const isValidHsla = (hslaText) => {
54
- return /^hsla?\(\s*(\d{1,2}|[1-2]\d{2}|3[0-5]\d|360)\s*,\s*(\d{1,2}|100)%\s*,\s*(\d{1,2}|100)%\s*(?:,\s*(0|1|0?\.\d+))?\s*\)$/.test(hslaText);
55
- };
56
- const isValidRgb = (rgbText) => {
57
- return /^rgba?\(\s*(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\s*,\s*(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\s*,\s*(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])(?:\s*,\s*(0|1|0?\.\d+))?\s*\)$/.test(rgbText);
58
- };
59
53
 
60
54
  const hex2rgba = (hex) => {
61
55
  let r = 0, g = 0, b = 0, a = 255;
@@ -154,14 +148,115 @@ const rgba2hsla = (red, green, blue, alpha) => {
154
148
  }
155
149
  h /= 6;
156
150
  }
151
+ // One decimal, because whole percentages can't bring most colors back: #123456 would return as #123354.
157
152
  return {
158
- h: Math.round(h * 360),
159
- s: Math.round(s * 100),
160
- l: Math.round(l * 100),
153
+ h: Math.round(h * 3600) / 10,
154
+ s: Math.round(s * 1000) / 10,
155
+ l: Math.round(l * 1000) / 10,
161
156
  a: alpha ?? 255
162
157
  };
163
158
  };
164
159
 
160
+ const NUMBER = "[+-]?(?:\\d+\\.?\\d*|\\.\\d+)(?:e[+-]?\\d+)?";
161
+ const SEPARATOR = "(?:\\s*,\\s*|\\s+)";
162
+ const ALPHA = `(?:\\s*[,/]\\s*(${NUMBER}%?))?`;
163
+ const RGB_PATTERN = new RegExp(`^rgba?\\(\\s*(${NUMBER}%?)${SEPARATOR}(${NUMBER}%?)${SEPARATOR}(${NUMBER}%?)${ALPHA}\\s*\\)$`, "i");
164
+ const HSL_PATTERN = new RegExp(`^hsla?\\(\\s*(${NUMBER})(?:deg)?${SEPARATOR}(${NUMBER})%?${SEPARATOR}(${NUMBER})%?${ALPHA}\\s*\\)$`, "i");
165
+ const clamp = (value, max) => Math.min(max, Math.max(0, value));
166
+ const parseAlpha = (text) => {
167
+ if (text === undefined) {
168
+ return 255;
169
+ }
170
+ const opacity = text.endsWith("%") ? parseFloat(text) / 100 : parseFloat(text);
171
+ return Math.round(clamp(opacity, 1) * 255);
172
+ };
173
+ const parseRgbChannel = (text) => {
174
+ const channel = text.endsWith("%") ? (parseFloat(text) / 100) * 255 : parseFloat(text);
175
+ return Math.round(clamp(channel, 255));
176
+ };
177
+ const parseFunctionalColor = (color) => {
178
+ const rgb = RGB_PATTERN.exec(color);
179
+ if (rgb) {
180
+ return {
181
+ r: parseRgbChannel(rgb[1]),
182
+ g: parseRgbChannel(rgb[2]),
183
+ b: parseRgbChannel(rgb[3]),
184
+ a: parseAlpha(rgb[4])
185
+ };
186
+ }
187
+ const hsl = HSL_PATTERN.exec(color);
188
+ if (hsl) {
189
+ const hue = ((parseFloat(hsl[1]) % 360) + 360) % 360;
190
+ const hsv = hsla2hsva(hue, clamp(parseFloat(hsl[2]), 100), clamp(parseFloat(hsl[3]), 100), parseAlpha(hsl[4]));
191
+ return hsva2rgba(hsv.h, hsv.s, hsv.v, hsv.a);
192
+ }
193
+ return null;
194
+ };
195
+ /**
196
+ * Asks the browser about everything else it can paint: color names, `transparent`, `oklch()`, `color-mix()` and so on.
197
+ * A color the browser rejects leaves `fillStyle` as it was, so it reads differently from two starting points.
198
+ */
199
+ const readThroughCanvas = (color, document) => {
200
+ const context = document.createElement("canvas").getContext?.("2d", { willReadFrequently: true });
201
+ if (!context) {
202
+ return null;
203
+ }
204
+ context.fillStyle = "#000000";
205
+ context.fillStyle = color;
206
+ const fromBlack = context.fillStyle;
207
+ context.fillStyle = "#ffffff";
208
+ context.fillStyle = color;
209
+ if (typeof fromBlack !== "string" || context.fillStyle !== fromBlack) {
210
+ return null;
211
+ }
212
+ if (isValidHex(fromBlack)) {
213
+ return hex2rgba(fromBlack);
214
+ }
215
+ const legacy = parseFunctionalColor(fromBlack);
216
+ if (legacy) {
217
+ return legacy;
218
+ }
219
+ // Wider color spaces keep their own notation in `fillStyle`, so read what actually gets painted.
220
+ context.clearRect(0, 0, 1, 1);
221
+ context.fillRect(0, 0, 1, 1);
222
+ const [r, g, b, a] = context.getImageData(0, 0, 1, 1).data;
223
+ return { r, g, b, a };
224
+ };
225
+ /**
226
+ * Reads a CSS color. Hex, `rgb()` and `hsl()` in both their comma and space forms need nothing but the text; with a
227
+ * `document`, anything else the browser can paint is read through a canvas.
228
+ * @returns The channels, each from 0 to 255, or null when the text isn't a color.
229
+ */
230
+ const parseColor = (text, document) => {
231
+ const color = text.trim();
232
+ if (!color) {
233
+ return null;
234
+ }
235
+ if (isValidHex(color)) {
236
+ return hex2rgba(color);
237
+ }
238
+ return parseFunctionalColor(color) ?? (document ? readThroughCanvas(color, document) : null);
239
+ };
240
+ /**
241
+ * A key that is equal for two spellings of the same color, such as `#ABC`, `#aabbcc` and `rgb(170, 187, 204)`. Text that
242
+ * can't be read as a color only compares equal to itself, ignoring case.
243
+ */
244
+ const colorKey = (text, document) => {
245
+ const color = parseColor(text, document);
246
+ return color ? rgba2hex(color.r, color.g, color.b, color.a) : text.trim().toLowerCase();
247
+ };
248
+ /**
249
+ * The shortest opacity, as CSS writes it, that still reads back as the same 8-bit alpha. A saved `0.5` stays `0.5`.
250
+ */
251
+ const formatAlpha = (alpha) => {
252
+ const short = Math.round((alpha / 255) * 100) / 100;
253
+ return Math.round(short * 255) === alpha ? short : Math.round((alpha / 255) * 1000) / 1000;
254
+ };
255
+
256
+ /**
257
+ * Hue, saturation and value are left unrounded, so converting to RGB and back returns the same color. Round them for
258
+ * display only.
259
+ */
165
260
  const rgba2hsva = (r, g, b, a) => {
166
261
  if (r == null || g == null || b == null) {
167
262
  return { h: 0, s: 0, v: 0, a: 255 };
@@ -188,39 +283,13 @@ const rgba2hsva = (r, g, b, a) => {
188
283
  h /= 6;
189
284
  }
190
285
  return {
191
- h: Math.round(h * 360),
192
- s: Math.round(s * 100),
193
- v: Math.round(v * 100),
286
+ h: h * 360,
287
+ s: s * 100,
288
+ v: v * 100,
194
289
  a: a ?? 255
195
290
  };
196
291
  };
197
292
 
198
- const string2Hsla = (hslText) => {
199
- const match = RegExp(/^hsla?\(\s*(\d{1,2}|[1-2]\d{2}|3[0-5]\d|360)\s*,\s*(\d{1,2}|100)%\s*,\s*(\d{1,2}|100)%\s*(?:,\s*(0|1|0?\.\d+))?\s*\)$/).exec(hslText);
200
- if (match) {
201
- return {
202
- h: parseInt(match[1]),
203
- s: parseInt(match[2]),
204
- l: parseInt(match[3]),
205
- a: match[4] ? Math.round(parseFloat(match[4]) * 255) : 255
206
- };
207
- }
208
- return { h: 0, s: 0, l: 0, a: 255 };
209
- };
210
-
211
- const string2rgba = (rgbText) => {
212
- const match = RegExp(/^rgba?\(\s*(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\s*,\s*(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\s*,\s*(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])(?:\s*,\s*(0|1|0?\.\d+))?\s*\)$/).exec(rgbText);
213
- if (match) {
214
- return {
215
- r: parseInt(match[1]),
216
- g: parseInt(match[2]),
217
- b: parseInt(match[3]),
218
- a: match[4] ? Math.round(parseFloat(match[4]) * 255) : 255
219
- };
220
- }
221
- return { r: 0, g: 0, b: 0, a: 255 };
222
- };
223
-
224
293
  const tokensOf = (element, attribute) => (element.getAttribute(attribute) ?? "").split(/\s+/).filter(token => token !== "");
225
294
  /**
226
295
  * Adds `id` to an id-list attribute such as `aria-describedby`, keeping the ids already there.
@@ -271,6 +340,53 @@ const createElementControlId = (level = 0, length = 7) => {
271
340
  return `${prefix}${hex}`;
272
341
  };
273
342
 
343
+ /**
344
+ * Whether the enclosing `mona-fieldset` is disabled. A native `<fieldset disabled>` reaches only native controls,
345
+ * so the fieldset also provides this for controls that draw their own focusable element.
346
+ */
347
+ const MONA_FIELDSET_DISABLED = new InjectionToken("MONA_FIELDSET_DISABLED");
348
+ /**
349
+ * Combines a control's own `disabled` with the enclosing `mona-fieldset`. Call it from an injection context.
350
+ *
351
+ * @param disabled Reads the control's own disabled state. It runs lazily, so it may read an input declared later.
352
+ */
353
+ function injectEffectiveDisabled(disabled) {
354
+ const fieldsetDisabled = inject(MONA_FIELDSET_DISABLED, { optional: true });
355
+ return computed(() => disabled() || (fieldsetDisabled?.() ?? false));
356
+ }
357
+
358
+ /**
359
+ * Provided by `mona-label` to the content it wraps.
360
+ */
361
+ const MONA_LABEL = new InjectionToken("MONA_LABEL");
362
+ /**
363
+ * Connects a control to a `mona-label` or `label[monaLabel]` that names it, by wrapping it or through `[for]`.
364
+ */
365
+ function injectLabelAssociation(options) {
366
+ const context = options.wrapped === false ? null : inject(MONA_LABEL, { optional: true });
367
+ const fromTarget = signal(null, /* @ts-ignore */
368
+ ...(ngDevMode ? [{ debugName: "fromTarget" }] : /* istanbul ignore next */ []));
369
+ const { activate } = options;
370
+ if (context && activate) {
371
+ const element = inject(ElementRef).nativeElement;
372
+ const named = () => !!options.ariaLabel() || !!options.ariaLabelledBy();
373
+ inject(DestroyRef).onDestroy(context.register({ activate, element, named }));
374
+ }
375
+ return {
376
+ labelledBy: computed(() => {
377
+ const explicit = options.ariaLabelledBy();
378
+ if (explicit) {
379
+ return explicit;
380
+ }
381
+ if (options.ariaLabel()) {
382
+ return null;
383
+ }
384
+ return fromTarget() ?? context?.captionId() ?? null;
385
+ }),
386
+ setLabelledBy: id => fromTarget.set(id)
387
+ };
388
+ }
389
+
274
390
  /**
275
391
  * Whether a closing popup may move focus back to its trigger without taking it from somewhere the user put it.
276
392
  * That holds while focus is on the page itself or inside one of `containers`, usually the trigger and the popup.
@@ -304,25 +420,31 @@ function focusElement(host, element) {
304
420
  * last, so closing one of two stacked modals leaves the page behind the other one inert.
305
421
  */
306
422
  const inertCounts = new WeakMap();
307
- /** Elements left alone: they hold no content, or announce for everyone (live regions, CDK's live announcer). */
423
+ /**
424
+ * Elements left alone: they hold no content, announce for everyone (live regions, CDK's live announcer), or hold the
425
+ * popups a modal opens. A modal in the overlay container has that container on its own path, so this only matters for
426
+ * one in the page.
427
+ */
308
428
  const isExempt = (element) => element instanceof HTMLScriptElement ||
309
429
  element instanceof HTMLStyleElement ||
310
430
  element instanceof HTMLTemplateElement ||
311
431
  element.hasAttribute("aria-live") ||
312
- element.classList.contains("cdk-overlay-backdrop");
432
+ element.classList.contains("cdk-overlay-backdrop") ||
433
+ element.classList.contains("cdk-overlay-container");
313
434
  /**
314
435
  * Makes everything outside a modal overlay inert, so assistive technology, the pointer and Tab can't reach the page
315
436
  * behind it. Walking up from `element` to `<body>`, every sibling is made inert, except that inside the CDK overlay
316
437
  * container only the overlays opened before this one are: popups opened later (a dropdown inside the dialog) stay
317
438
  * usable. Elements that were inert already are left as they are.
318
439
  * @param element the overlay's host element (the CDK overlay wrapper)
440
+ * @param options what to leave alone, and where to stop
319
441
  * @returns the function that releases what this call made inert
320
442
  */
321
- const inertOutside = (element) => {
443
+ const inertOutside = (element, options = {}) => {
322
444
  const body = element.ownerDocument.body;
323
445
  const acquired = [];
324
446
  let node = element;
325
- while (node && node !== body && node.parentElement) {
447
+ while (node && node !== body && node !== options.stopAt && node.parentElement) {
326
448
  const parent = node.parentElement;
327
449
  const onlyEarlier = parent.classList.contains("cdk-overlay-container");
328
450
  for (const sibling of Array.from(parent.children)) {
@@ -332,7 +454,7 @@ const inertOutside = (element) => {
332
454
  }
333
455
  continue;
334
456
  }
335
- if (isExempt(sibling)) {
457
+ if (isExempt(sibling) || options.keep?.(sibling)) {
336
458
  continue;
337
459
  }
338
460
  const count = inertCounts.get(sibling) ?? 0;
@@ -557,6 +679,20 @@ const rxTimeout = (destroyRef, fn, delay = 0) => {
557
679
  .subscribe(() => fn());
558
680
  };
559
681
 
682
+ /**
683
+ * What says a row is selected besides its tint, which is faint in every theme and gone in forced colors. The row
684
+ * has to be positioned.
685
+ */
686
+ const themeSelectionBarClasses = `
687
+ before:absolute before:inset-y-0 before:start-0 before:w-0.5 before:bg-(--color-selected-border)
688
+ before:forced-color-adjust-none forced-colors:before:bg-[Highlight]
689
+ `;
690
+ /** A border in the text's color, for a selected control whose fill doesn't say it alone. */
691
+ const themeSelectionBorderClasses = `
692
+ relative
693
+ after:pointer-events-none after:absolute after:inset-0
694
+ after:rounded-[inherit] after:border-2 after:border-current
695
+ `;
560
696
  const themeControlBackdropClasses = `
561
697
  [background-image:var(--mona-effect-control-background-image,none)]
562
698
  [backdrop-filter:var(--mona-effect-control-backdrop-filter,none)]
@@ -967,9 +1103,9 @@ var NavigationKeys;
967
1103
  NavigationKeys["PageUp"] = "PageUp";
968
1104
  NavigationKeys["Space"] = " ";
969
1105
  })(NavigationKeys || (NavigationKeys = {}));
970
- const NavigationKeysList = Object.values(NavigationKeys);
1106
+ const navigationKeysList = Object.values(NavigationKeys);
971
1107
  const isNavigationKey = (key) => {
972
- return NavigationKeysList.includes(key);
1108
+ return navigationKeysList.includes(key);
973
1109
  };
974
1110
 
975
1111
  /**
@@ -994,5 +1130,5 @@ const setupTypeahead = (typeaheadKey$) => {
994
1130
  * Generated bundle index. Do not edit.
995
1131
  */
996
1132
 
997
- export { AttributeBinderDirective, HOVER_GRACE, HoverIntent, NavigationKeys, NavigationKeysList, RovingToolbar, TYPEAHEAD_RESET_DELAY, addAriaReference, createElementControlId, focusCanReturn, focusElement, hex2rgba, hsla2hsva, hsva2rgba, inertOutside, injectLabelledByText, isNavigationKey, isTypeaheadKey, isValidHex, isValidHsla, isValidRgb, listenForHover, onDisconnect, overlaySidePositions, positionGlobalOverlay, removeAriaReference, resolveOverlaySide, restoreOverlayScroll, rgba2hex, rgba2hsla, rgba2hsva, rxFromResize, rxTimeout, setupTypeahead, sideOfPosition, string2Hsla, string2rgba, themeControlBackdropClasses, themeControlSurfaceClasses, themeOverlayBackdropClasses, themeOverlaySurfaceClasses, themeRaisedBackdropClasses, themeRaisedSurfaceClasses, toCssValue };
1133
+ export { AttributeBinderDirective, HOVER_GRACE, HoverIntent, MONA_FIELDSET_DISABLED, MONA_LABEL, NavigationKeys, RovingToolbar, TYPEAHEAD_RESET_DELAY, addAriaReference, colorKey, createElementControlId, focusCanReturn, focusElement, formatAlpha, hex2rgba, hsla2hsva, hsva2rgba, inertOutside, injectEffectiveDisabled, injectLabelAssociation, injectLabelledByText, isNavigationKey, isTypeaheadKey, isValidHex, listenForHover, navigationKeysList, onDisconnect, overlaySidePositions, parseColor, positionGlobalOverlay, removeAriaReference, resolveOverlaySide, restoreOverlayScroll, rgba2hex, rgba2hsla, rgba2hsva, rxFromResize, rxTimeout, setupTypeahead, sideOfPosition, themeControlBackdropClasses, themeControlSurfaceClasses, themeOverlayBackdropClasses, themeOverlaySurfaceClasses, themeRaisedBackdropClasses, themeRaisedSurfaceClasses, themeSelectionBarClasses, themeSelectionBorderClasses, toCssValue };
998
1134
  //# sourceMappingURL=nanahoshi-mona-ui-internal.mjs.map
@@ -1,7 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
- import { computed, input, Directive, Component } from '@angular/core';
2
+ import { effect, inject, ElementRef, computed, HostAttributeToken, input, afterNextRender, isDevMode, Directive, viewChild, booleanAttribute, Component } from '@angular/core';
3
+ import { createElementControlId, MONA_LABEL } from '@nanahoshi/mona-ui/internal';
3
4
  import { twMerge } from 'tailwind-merge';
4
5
  import { cva } from 'class-variance-authority';
6
+ import { MonaI18nService } from '@nanahoshi/mona-ui/i18n';
5
7
 
6
8
  const labelComponentThemeVariants = cva(`
7
9
  inline-flex
@@ -36,15 +38,47 @@ function focusLabelTarget(target, event) {
36
38
  if (event.defaultPrevented || target === null || target === undefined || typeof target === "string") {
37
39
  return;
38
40
  }
39
- target.focus();
41
+ if (target.activateFromLabel) {
42
+ target.activateFromLabel();
43
+ }
44
+ else {
45
+ target.focus();
46
+ }
47
+ }
48
+ /**
49
+ * Tells a control bound through `[for]` which element names it.
50
+ */
51
+ function linkLabelTarget(target, labelId) {
52
+ effect(onCleanup => {
53
+ const current = target();
54
+ if (current === null || current === undefined || typeof current === "string" || !current.setLabelledBy) {
55
+ return;
56
+ }
57
+ current.setLabelledBy(labelId());
58
+ onCleanup(() => current.setLabelledBy?.(null));
59
+ });
60
+ }
61
+ /**
62
+ * Warns when a string `for` points at an element a label can't control, such as the host of a mona-switch. The browser
63
+ * says nothing about this, and the control stays unnamed.
64
+ */
65
+ function warnIfTargetNotLabelable(target, label) {
66
+ if (typeof target !== "string" || label.control || !label.ownerDocument.getElementById(target)) {
67
+ return;
68
+ }
69
+ console.warn(`[Mona Label] for="${target}" points at an element a label can't control. Bind the component instead, as ` +
70
+ `[for]="ref", or use the control's inputId.`, label);
40
71
  }
41
72
 
42
73
  class LabelDirective {
74
+ #hostElementRef;
43
75
  constructor() {
76
+ this.#hostElementRef = inject(ElementRef);
44
77
  this.classes = computed(() => twMerge(labelDirectiveThemeVariants(), this.userClass()), /* @ts-ignore */
45
78
  ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
46
79
  this.forAttribute = computed(() => getLabelForAttribute(this.for()), /* @ts-ignore */
47
80
  ...(ngDevMode ? [{ debugName: "forAttribute" }] : /* istanbul ignore next */ []));
81
+ this.labelId = inject(new HostAttributeToken("id"), { optional: true }) ?? createElementControlId();
48
82
  /**
49
83
  * @description Associates the label with a native control ID or a target that exposes a public `focus()` method.
50
84
  * String values are reflected as the native `for` attribute. Object targets receive focus when the label is clicked.
@@ -57,12 +91,18 @@ class LabelDirective {
57
91
  * @default ""
58
92
  */
59
93
  this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
94
+ linkLabelTarget(() => this.for(), () => this.labelId);
95
+ afterNextRender(() => {
96
+ if (isDevMode()) {
97
+ warnIfTargetNotLabelable(this.for(), this.#hostElementRef.nativeElement);
98
+ }
99
+ });
60
100
  }
61
101
  onLabelClick(event) {
62
102
  focusLabelTarget(this.for(), event);
63
103
  }
64
104
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: LabelDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
65
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: LabelDirective, isStandalone: true, selector: "label[monaLabel]", inputs: { for: { classPropertyName: "for", publicName: "for", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onLabelClick($event)" }, properties: { "attr.for": "forAttribute()", "class": "classes()" } }, ngImport: i0 }); }
105
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: LabelDirective, isStandalone: true, selector: "label[monaLabel]", inputs: { for: { classPropertyName: "for", publicName: "for", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onLabelClick($event)" }, properties: { "attr.for": "forAttribute()", "attr.id": "labelId", "class": "classes()" } }, ngImport: i0 }); }
66
106
  }
67
107
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: LabelDirective, decorators: [{
68
108
  type: Directive,
@@ -70,20 +110,48 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
70
110
  selector: "label[monaLabel]",
71
111
  host: {
72
112
  "[attr.for]": "forAttribute()",
113
+ "[attr.id]": "labelId",
73
114
  "[class]": "classes()",
74
115
  "(click)": "onLabelClick($event)"
75
116
  }
76
117
  }]
77
- }], propDecorators: { for: [{ type: i0.Input, args: [{ isSignal: true, alias: "for", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
118
+ }], ctorParameters: () => [], propDecorators: { for: [{ type: i0.Input, args: [{ isSignal: true, alias: "for", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
119
+
120
+ // Generated from i18n/catalogs/en-US.messages.json by scripts/generate-locale-catalogs.ts. Do not edit.
121
+ // Edit the JSON file and run `npm run generate:locale-catalogs`.
122
+ const LABEL_DEFAULT_MESSAGES = {
123
+ optional: "Optional"
124
+ };
78
125
 
79
126
  class LabelComponent {
127
+ #i18n;
128
+ #wrappedControl;
80
129
  constructor() {
130
+ this.#i18n = inject(MonaI18nService);
131
+ this.#wrappedControl = null;
81
132
  this.captionClasses = labelCaptionThemeVariants();
133
+ this.captionElementId = createElementControlId();
82
134
  this.classes = computed(() => twMerge(labelComponentThemeVariants(), this.userClass()), /* @ts-ignore */
83
135
  ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
84
136
  this.forAttribute = computed(() => getLabelForAttribute(this.for()), /* @ts-ignore */
85
137
  ...(ngDevMode ? [{ debugName: "forAttribute" }] : /* istanbul ignore next */ []));
138
+ this.labelElementId = createElementControlId();
139
+ this.labelRef = viewChild.required("label", /* @ts-ignore */
140
+ ...(ngDevMode ? [{ debugName: "labelRef" }] : /* istanbul ignore next */ []));
141
+ this.messages = this.#i18n.componentMessages("label", LABEL_DEFAULT_MESSAGES);
86
142
  this.optionalClasses = labelOptionalThemeVariants();
143
+ /**
144
+ * @internal
145
+ */
146
+ this.context = {
147
+ captionId: computed(() => (this.text() || this.optional() ? this.captionElementId : null)),
148
+ register: control => {
149
+ this.#wrappedControl = control;
150
+ return () => {
151
+ this.#wrappedControl = null;
152
+ };
153
+ }
154
+ };
87
155
  /**
88
156
  * @description Associates the label with a native control ID or a target that exposes a public `focus()` method.
89
157
  * String values are reflected as the native `for` attribute. Object targets receive focus when the label is clicked.
@@ -95,13 +163,12 @@ class LabelComponent {
95
163
  * @description Whether to display optional-field text next to the caption.
96
164
  * @default false
97
165
  */
98
- this.optional = input(false, /* @ts-ignore */
99
- ...(ngDevMode ? [{ debugName: "optional" }] : /* istanbul ignore next */ []));
166
+ this.optional = input(false, { ...(ngDevMode ? { debugName: "optional" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
100
167
  /**
101
168
  * @description Text displayed when `optional` is enabled.
102
- * @default "Optional"
169
+ * @default the `label.optional` message
103
170
  */
104
- this.optionalText = input("Optional", /* @ts-ignore */
171
+ this.optionalText = input("", /* @ts-ignore */
105
172
  ...(ngDevMode ? [{ debugName: "optionalText" }] : /* istanbul ignore next */ []));
106
173
  /**
107
174
  * @description Visible label caption text.
@@ -114,24 +181,50 @@ class LabelComponent {
114
181
  * @default ""
115
182
  */
116
183
  this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
184
+ // Without a caption of its own, the label's whole content is what names a control it points at.
185
+ linkLabelTarget(() => this.for(), () => this.context.captionId() ?? this.labelElementId);
186
+ afterNextRender(() => {
187
+ if (isDevMode()) {
188
+ this.#warnIfMisassociated();
189
+ }
190
+ });
191
+ }
192
+ #warnIfMisassociated() {
193
+ warnIfTargetNotLabelable(this.for(), this.labelRef().nativeElement);
194
+ if (this.#wrappedControl && !this.for() && !this.context.captionId() && !this.#wrappedControl.named()) {
195
+ console.warn("[Mona Label] A wrapped control takes its name from the text input. Text projected next to it can't " +
196
+ "name it.", this.labelRef().nativeElement);
197
+ }
117
198
  }
118
199
  onLabelClick(event) {
119
- focusLabelTarget(this.for(), event);
200
+ const wrapped = this.#wrappedControl;
201
+ if (!wrapped || this.for()) {
202
+ focusLabelTarget(this.for(), event);
203
+ return;
204
+ }
205
+ if (event.defaultPrevented || (event.target instanceof Node && wrapped.element.contains(event.target))) {
206
+ return;
207
+ }
208
+ // Cancels the browser's own activation, which would otherwise pick the first native input in the control.
209
+ event.preventDefault();
210
+ wrapped.activate();
120
211
  }
121
212
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: LabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
122
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: LabelComponent, isStandalone: true, selector: "mona-label", inputs: { for: { classPropertyName: "for", publicName: "for", isSignal: true, isRequired: false, transformFunction: null }, optional: { classPropertyName: "optional", publicName: "optional", isSignal: true, isRequired: false, transformFunction: null }, optionalText: { classPropertyName: "optionalText", publicName: "optionalText", isSignal: true, isRequired: false, transformFunction: null }, text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "inline-block" }, ngImport: i0, template: `
213
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: LabelComponent, isStandalone: true, selector: "mona-label", inputs: { for: { classPropertyName: "for", publicName: "for", isSignal: true, isRequired: false, transformFunction: null }, optional: { classPropertyName: "optional", publicName: "optional", isSignal: true, isRequired: false, transformFunction: null }, optionalText: { classPropertyName: "optionalText", publicName: "optionalText", isSignal: true, isRequired: false, transformFunction: null }, text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "inline-block" }, providers: [{ provide: MONA_LABEL, useFactory: () => inject(LabelComponent).context }], viewQueries: [{ propertyName: "labelRef", first: true, predicate: ["label"], descendants: true, isSignal: true }], ngImport: i0, template: `
123
214
  <label
215
+ #label
124
216
  [attr.for]="forAttribute()"
217
+ [attr.id]="labelElementId"
125
218
  [class]="classes()"
126
219
  [attr.data-optional]="optional() || null"
127
220
  (click)="onLabelClick($event)">
128
221
  @if (text() || optional()) {
129
- <span [class]="captionClasses">
222
+ <span [attr.id]="captionElementId" [class]="captionClasses">
130
223
  @if (text()) {
131
224
  <span>{{ text() }}</span>
132
225
  }
133
226
  @if (optional()) {
134
- <span [class]="optionalClasses">{{ optionalText() }}</span>
227
+ <span [class]="optionalClasses">{{ optionalText() || messages().optional }}</span>
135
228
  }
136
229
  </span>
137
230
  }
@@ -145,28 +238,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
145
238
  selector: "mona-label",
146
239
  template: `
147
240
  <label
241
+ #label
148
242
  [attr.for]="forAttribute()"
243
+ [attr.id]="labelElementId"
149
244
  [class]="classes()"
150
245
  [attr.data-optional]="optional() || null"
151
246
  (click)="onLabelClick($event)">
152
247
  @if (text() || optional()) {
153
- <span [class]="captionClasses">
248
+ <span [attr.id]="captionElementId" [class]="captionClasses">
154
249
  @if (text()) {
155
250
  <span>{{ text() }}</span>
156
251
  }
157
252
  @if (optional()) {
158
- <span [class]="optionalClasses">{{ optionalText() }}</span>
253
+ <span [class]="optionalClasses">{{ optionalText() || messages().optional }}</span>
159
254
  }
160
255
  </span>
161
256
  }
162
257
  <ng-content></ng-content>
163
258
  </label>
164
259
  `,
260
+ providers: [{ provide: MONA_LABEL, useFactory: () => inject(LabelComponent).context }],
165
261
  host: {
166
262
  class: "inline-block"
167
263
  }
168
264
  }]
169
- }], propDecorators: { for: [{ type: i0.Input, args: [{ isSignal: true, alias: "for", required: false }] }], optional: [{ type: i0.Input, args: [{ isSignal: true, alias: "optional", required: false }] }], optionalText: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionalText", required: false }] }], text: [{ type: i0.Input, args: [{ isSignal: true, alias: "text", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
265
+ }], ctorParameters: () => [], propDecorators: { labelRef: [{ type: i0.ViewChild, args: ["label", { isSignal: true }] }], for: [{ type: i0.Input, args: [{ isSignal: true, alias: "for", required: false }] }], optional: [{ type: i0.Input, args: [{ isSignal: true, alias: "optional", required: false }] }], optionalText: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionalText", required: false }] }], text: [{ type: i0.Input, args: [{ isSignal: true, alias: "text", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
170
266
 
171
267
  /*
172
268
  * Public API Surface of @nanahoshi/mona-ui/label
@@ -971,7 +971,7 @@ class ListBoxComponent {
971
971
  });
972
972
  }
973
973
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ListBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
974
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ListBoxComponent, isStandalone: true, selector: "mona-list-box", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, connectedList: { classPropertyName: "connectedList", publicName: "connectedList", isSignal: true, isRequired: false, transformFunction: null }, disabledBy: { classPropertyName: "disabledBy", publicName: "disabledBy", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, selectBy: { classPropertyName: "selectBy", publicName: "selectBy", isSignal: true, isRequired: false, transformFunction: null }, selectedKeys: { classPropertyName: "selectedKeys", publicName: "selectedKeys", isSignal: true, isRequired: false, transformFunction: null }, selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null }, singleSelectionToggleable: { classPropertyName: "singleSelectionToggleable", publicName: "singleSelectionToggleable", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, textField: { classPropertyName: "textField", publicName: "textField", isSignal: true, isRequired: false, transformFunction: null }, toolbar: { classPropertyName: "toolbar", publicName: "toolbar", isSignal: true, isRequired: false, transformFunction: null }, toolbarAriaLabel: { classPropertyName: "toolbarAriaLabel", publicName: "toolbarAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { actionClick: "actionClick", selectedKeysChange: "selectedKeysChange", selectionChange: "selectionChange" }, host: { listeners: { "keydown": "onHostKeydown($event)" }, properties: { "attr.aria-label": "null", "class": "baseClasses()", "style.height": "listHeight()", "style.width": "listWidth()" } }, providers: [ListService], queries: [{ propertyName: "footerTemplate", first: true, predicate: ListBoxFooterTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "headerTemplate", first: true, predicate: ListBoxHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "itemTemplate", first: true, predicate: ListBoxItemTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "noDataTemplate", first: true, predicate: ListBoxNoDataTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], ngImport: i0, template: "<mona-list-view\n [aria-label]=\"ariaLabel()\"\n [aria-labelledby]=\"ariaLabelledBy()\"\n [items]=\"listBoxItems()\"\n [height]=\"'100%'\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [textField]=\"textField()\"\n [width]=\"'100%'\"\n [disabledBy]=\"disabledBy()\"\n [monaListViewNavigable]=\"{ enabled: true, mode: 'select' }\"\n [monaListViewSelectable]=\"selectableOptions()\"\n [selectBy]=\"selectBy()\"\n [selectedKeys]=\"selectedKeys()\"\n (selectedKeysChange)=\"onSelectedKeysChange()\">\n @if (footerTemplate()) {\n <ng-template monaListViewFooterTemplate>\n <ng-container [ngTemplateOutlet]=\"footerTemplate()\"></ng-container>\n </ng-template>\n }\n @if (headerTemplate()) {\n <ng-template monaListViewHeaderTemplate>\n <ng-container [ngTemplateOutlet]=\"headerTemplate()\"></ng-container>\n </ng-template>\n }\n @if (itemTemplate()) {\n <ng-template monaListViewItemTemplate let-dataItem>\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"></ng-container>\n </ng-template>\n }\n @if (noDataTemplate()) {\n <ng-template monaListViewNoDataTemplate>\n <ng-container [ngTemplateOutlet]=\"noDataTemplate()\"></ng-container>\n </ng-template>\n }\n</mona-list-view>\n\n@let buttons = toolbarButtons();\n@if (buttons.length > 0) {\n @let tabStop = toolbarTabStop();\n <div\n role=\"toolbar\"\n [attr.aria-label]=\"toolbarLabel()\"\n [attr.aria-orientation]=\"toolbarOrientation()\"\n [class]=\"toolbarClasses()\"\n (focusin)=\"onToolbarFocusIn($event)\"\n (keydown)=\"onToolbarKeydown($event)\">\n @for (button of buttons; track button.action) {\n <button\n monaButton\n type=\"button\"\n [attr.data-action]=\"button.action\"\n (click)=\"onActionClick(button.action, $event)\"\n [iconOnly]=\"true\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [title]=\"button.label\"\n [attr.aria-label]=\"button.label\"\n [disabled]=\"!button.enabled\"\n [tabindex]=\"tabStop === button.action ? 0 : -1\">\n @switch (button.action) {\n @case (\"moveUp\") {\n <svg lucideChevronUp [size]=\"16\"></svg>\n }\n @case (\"moveDown\") {\n <svg lucideChevronDown [size]=\"16\"></svg>\n }\n @case (\"transferFrom\") {\n <svg lucideChevronLeft [size]=\"16\" class=\"rtl:rotate-180\"></svg>\n }\n @case (\"transferTo\") {\n <svg lucideChevronRight [size]=\"16\" class=\"rtl:rotate-180\"></svg>\n }\n @case (\"transferAllFrom\") {\n <svg lucideChevronsLeft [size]=\"16\" class=\"rtl:rotate-180\"></svg>\n }\n @case (\"transferAllTo\") {\n <svg lucideChevronsRight [size]=\"16\" class=\"rtl:rotate-180\"></svg>\n }\n @case (\"clear\") {\n <svg lucideX [size]=\"16\"></svg>\n }\n @case (\"remove\") {\n <svg lucideTrash2 [size]=\"14\"></svg>\n }\n }\n </button>\n }\n </div>\n}\n", dependencies: [{ kind: "component", type: ListViewComponent, selector: "mona-list-view", inputs: ["aria-label", "aria-labelledby", "disabledBy", "height", "items", "listClass", "listItemClass", "listItemStyle", "listStyle", "loading", "maxHeight", "maxWidth", "pagerAriaLabel", "rounded", "size", "textField", "class", "width"], outputs: ["itemActivate", "scrollBottom"] }, { kind: "directive", type: ListViewSelectableDirective, selector: "mona-list-view[monaListViewSelectable]", inputs: ["monaListViewSelectable", "selectBy", "selectedKeys"], outputs: ["selectedKeysChange"] }, { kind: "directive", type: ListViewItemTemplateDirective, selector: "ng-template[monaListViewItemTemplate]", inputs: ["monaListViewItemTemplateOf"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "type", "class"], outputs: ["lookChange", "selectedChange"] }, { kind: "directive", type: ListViewNavigableDirective, selector: "mona-list-view[monaListViewNavigable]", inputs: ["monaListViewNavigable"] }, { kind: "directive", type: ListViewNoDataTemplateDirective, selector: "ng-template[monaListViewNoDataTemplate]" }, { kind: "directive", type: ListViewFooterTemplateDirective, selector: "ng-template[monaListViewFooterTemplate]" }, { kind: "directive", type: ListViewHeaderTemplateDirective, selector: "ng-template[monaListViewHeaderTemplate]" }, { kind: "component", type: LucideChevronUp, selector: "svg[lucideChevronUp]" }, { kind: "component", type: LucideChevronDown, selector: "svg[lucideChevronDown]" }, { kind: "component", type: LucideChevronLeft, selector: "svg[lucideChevronLeft]" }, { kind: "component", type: LucideChevronRight, selector: "svg[lucideChevronRight]" }, { kind: "component", type: LucideChevronsLeft, selector: "svg[lucideChevronsLeft]" }, { kind: "component", type: LucideChevronsRight, selector: "svg[lucideChevronsRight]" }, { kind: "component", type: LucideX, selector: "svg[lucideX]" }, { kind: "component", type: LucideTrash2, selector: "svg[lucideTrash2]" }], viewProviders: [{ provide: LIST_VIEW_HOST_LIST_SERVICE, useExisting: ListService }] }); }
974
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ListBoxComponent, isStandalone: true, selector: "mona-list-box", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, connectedList: { classPropertyName: "connectedList", publicName: "connectedList", isSignal: true, isRequired: false, transformFunction: null }, disabledBy: { classPropertyName: "disabledBy", publicName: "disabledBy", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, selectBy: { classPropertyName: "selectBy", publicName: "selectBy", isSignal: true, isRequired: false, transformFunction: null }, selectedKeys: { classPropertyName: "selectedKeys", publicName: "selectedKeys", isSignal: true, isRequired: false, transformFunction: null }, selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null }, singleSelectionToggleable: { classPropertyName: "singleSelectionToggleable", publicName: "singleSelectionToggleable", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, textField: { classPropertyName: "textField", publicName: "textField", isSignal: true, isRequired: false, transformFunction: null }, toolbar: { classPropertyName: "toolbar", publicName: "toolbar", isSignal: true, isRequired: false, transformFunction: null }, toolbarAriaLabel: { classPropertyName: "toolbarAriaLabel", publicName: "toolbarAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { actionClick: "actionClick", selectedKeysChange: "selectedKeysChange", selectionChange: "selectionChange" }, host: { listeners: { "keydown": "onHostKeydown($event)" }, properties: { "attr.aria-label": "null", "class": "baseClasses()", "style.height": "listHeight()", "style.width": "listWidth()" } }, providers: [ListService], queries: [{ propertyName: "footerTemplate", first: true, predicate: ListBoxFooterTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "headerTemplate", first: true, predicate: ListBoxHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "itemTemplate", first: true, predicate: ListBoxItemTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "noDataTemplate", first: true, predicate: ListBoxNoDataTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], ngImport: i0, template: "<mona-list-view\n [aria-label]=\"ariaLabel()\"\n [aria-labelledby]=\"ariaLabelledBy()\"\n [items]=\"listBoxItems()\"\n [height]=\"'100%'\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [textField]=\"textField()\"\n [width]=\"'100%'\"\n [disabledBy]=\"disabledBy()\"\n [monaListViewNavigable]=\"{ enabled: true, mode: 'select' }\"\n [monaListViewSelectable]=\"selectableOptions()\"\n [selectBy]=\"selectBy()\"\n [selectedKeys]=\"selectedKeys()\"\n (selectedKeysChange)=\"onSelectedKeysChange()\">\n @if (footerTemplate()) {\n <ng-template monaListViewFooterTemplate>\n <ng-container [ngTemplateOutlet]=\"footerTemplate()\"></ng-container>\n </ng-template>\n }\n @if (headerTemplate()) {\n <ng-template monaListViewHeaderTemplate>\n <ng-container [ngTemplateOutlet]=\"headerTemplate()\"></ng-container>\n </ng-template>\n }\n @if (itemTemplate()) {\n <ng-template monaListViewItemTemplate let-dataItem>\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"></ng-container>\n </ng-template>\n }\n @if (noDataTemplate()) {\n <ng-template monaListViewNoDataTemplate>\n <ng-container [ngTemplateOutlet]=\"noDataTemplate()\"></ng-container>\n </ng-template>\n }\n</mona-list-view>\n\n@let buttons = toolbarButtons();\n@if (buttons.length > 0) {\n @let tabStop = toolbarTabStop();\n <div\n role=\"toolbar\"\n [attr.aria-label]=\"toolbarLabel()\"\n [attr.aria-orientation]=\"toolbarOrientation()\"\n [class]=\"toolbarClasses()\"\n (focusin)=\"onToolbarFocusIn($event)\"\n (keydown)=\"onToolbarKeydown($event)\">\n @for (button of buttons; track button.action) {\n <button\n monaButton\n type=\"button\"\n [attr.data-action]=\"button.action\"\n (click)=\"onActionClick(button.action, $event)\"\n [iconOnly]=\"true\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [title]=\"button.label\"\n [attr.aria-label]=\"button.label\"\n [disabled]=\"!button.enabled\"\n [tabindex]=\"tabStop === button.action ? 0 : -1\">\n @switch (button.action) {\n @case (\"moveUp\") {\n <svg lucideChevronUp [size]=\"16\"></svg>\n }\n @case (\"moveDown\") {\n <svg lucideChevronDown [size]=\"16\"></svg>\n }\n @case (\"transferFrom\") {\n <svg lucideChevronLeft [size]=\"16\" class=\"rtl:rotate-180\"></svg>\n }\n @case (\"transferTo\") {\n <svg lucideChevronRight [size]=\"16\" class=\"rtl:rotate-180\"></svg>\n }\n @case (\"transferAllFrom\") {\n <svg lucideChevronsLeft [size]=\"16\" class=\"rtl:rotate-180\"></svg>\n }\n @case (\"transferAllTo\") {\n <svg lucideChevronsRight [size]=\"16\" class=\"rtl:rotate-180\"></svg>\n }\n @case (\"clear\") {\n <svg lucideX [size]=\"16\"></svg>\n }\n @case (\"remove\") {\n <svg lucideTrash2 [size]=\"14\"></svg>\n }\n }\n </button>\n }\n </div>\n}\n", dependencies: [{ kind: "component", type: ListViewComponent, selector: "mona-list-view", inputs: ["aria-label", "aria-labelledby", "disabledBy", "height", "items", "listClass", "listItemClass", "listItemStyle", "listStyle", "loading", "maxHeight", "maxWidth", "pagerAriaLabel", "rounded", "size", "textField", "class", "width"], outputs: ["itemActivate", "scrollBottom"] }, { kind: "directive", type: ListViewSelectableDirective, selector: "mona-list-view[monaListViewSelectable]", inputs: ["monaListViewSelectable", "selectBy", "selectedKeys"], outputs: ["selectedKeysChange"] }, { kind: "directive", type: ListViewItemTemplateDirective, selector: "ng-template[monaListViewItemTemplate]", inputs: ["monaListViewItemTemplateOf"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "type", "class", "value"], outputs: ["lookChange", "selectedChange"] }, { kind: "directive", type: ListViewNavigableDirective, selector: "mona-list-view[monaListViewNavigable]", inputs: ["monaListViewNavigable"] }, { kind: "directive", type: ListViewNoDataTemplateDirective, selector: "ng-template[monaListViewNoDataTemplate]" }, { kind: "directive", type: ListViewFooterTemplateDirective, selector: "ng-template[monaListViewFooterTemplate]" }, { kind: "directive", type: ListViewHeaderTemplateDirective, selector: "ng-template[monaListViewHeaderTemplate]" }, { kind: "component", type: LucideChevronUp, selector: "svg[lucideChevronUp]" }, { kind: "component", type: LucideChevronDown, selector: "svg[lucideChevronDown]" }, { kind: "component", type: LucideChevronLeft, selector: "svg[lucideChevronLeft]" }, { kind: "component", type: LucideChevronRight, selector: "svg[lucideChevronRight]" }, { kind: "component", type: LucideChevronsLeft, selector: "svg[lucideChevronsLeft]" }, { kind: "component", type: LucideChevronsRight, selector: "svg[lucideChevronsRight]" }, { kind: "component", type: LucideX, selector: "svg[lucideX]" }, { kind: "component", type: LucideTrash2, selector: "svg[lucideTrash2]" }], viewProviders: [{ provide: LIST_VIEW_HOST_LIST_SERVICE, useExisting: ListService }] }); }
975
975
  }
976
976
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ListBoxComponent, decorators: [{
977
977
  type: Component,
@@ -91,7 +91,7 @@ const listViewBaseThemeVariants = cva(`
91
91
  flex h-full flex-col overflow-hidden
92
92
  bg-surface text-foreground
93
93
  border border-border
94
- outline-none
94
+ outline-none focus-visible:outline-hidden
95
95
  `, {
96
96
  variants: {
97
97
  rounded: {