@nanahoshi/mona-ui 0.27.1 → 0.28.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 (359) hide show
  1. package/docs/api/auto-complete.md +67 -0
  2. package/docs/api/avatar.md +31 -0
  3. package/docs/api/breadcrumb.md +74 -0
  4. package/docs/api/button-group.md +71 -0
  5. package/docs/api/button.md +84 -0
  6. package/docs/api/calendar.md +123 -0
  7. package/docs/api/card.md +97 -0
  8. package/docs/api/chart.md +4380 -0
  9. package/docs/api/check-box.md +70 -0
  10. package/docs/api/chip.md +55 -0
  11. package/docs/api/circular-progress-bar.md +71 -0
  12. package/docs/api/collapsible.md +71 -0
  13. package/docs/api/color-gradient.md +54 -0
  14. package/docs/api/color-palette.md +52 -0
  15. package/docs/api/color-picker.md +89 -0
  16. package/docs/api/combo-box.md +69 -0
  17. package/docs/api/command.md +282 -0
  18. package/docs/api/common.md +599 -0
  19. package/docs/api/contextmenu.md +239 -0
  20. package/docs/api/date-input.md +119 -0
  21. package/docs/api/date-picker.md +67 -0
  22. package/docs/api/datetime-picker.md +72 -0
  23. package/docs/api/dialog.md +291 -0
  24. package/docs/api/dropdown-button.md +248 -0
  25. package/docs/api/dropdown-list.md +72 -0
  26. package/docs/api/dropdowns.md +172 -0
  27. package/docs/api/editor.md +117 -0
  28. package/docs/api/expansion-panel.md +85 -0
  29. package/docs/api/fieldset.md +33 -0
  30. package/docs/api/filter.md +116 -0
  31. package/docs/api/grid.md +1445 -0
  32. package/docs/api/i18n.md +1699 -0
  33. package/docs/api/label.md +58 -0
  34. package/docs/api/list-box.md +301 -0
  35. package/docs/api/list-view.md +294 -0
  36. package/docs/api/list.md +119 -0
  37. package/docs/api/locales.md +134 -0
  38. package/docs/api/menubar.md +275 -0
  39. package/docs/api/multi-select.md +92 -0
  40. package/docs/api/notification.md +164 -0
  41. package/docs/api/numeric-text-box.md +130 -0
  42. package/docs/api/otp-input.md +100 -0
  43. package/docs/api/pager.md +371 -0
  44. package/docs/api/placeholder.md +18 -0
  45. package/docs/api/popover.md +170 -0
  46. package/docs/api/popup-menu.md +328 -0
  47. package/docs/api/popup.md +299 -0
  48. package/docs/api/progress-bar.md +79 -0
  49. package/docs/api/query.md +367 -0
  50. package/docs/api/radio-button.md +113 -0
  51. package/docs/api/rating.md +187 -0
  52. package/docs/api/scroll-view.md +93 -0
  53. package/docs/api/segmented.md +114 -0
  54. package/docs/api/sheet.md +65 -0
  55. package/docs/api/sidebar.md +583 -0
  56. package/docs/api/skeleton.md +26 -0
  57. package/docs/api/slider.md +173 -0
  58. package/docs/api/spinner.md +132 -0
  59. package/docs/api/split-button.md +261 -0
  60. package/docs/api/splitter.md +57 -0
  61. package/docs/api/stepper.md +148 -0
  62. package/docs/api/switch.md +78 -0
  63. package/docs/api/tabs.md +139 -0
  64. package/docs/api/text-area.md +20 -0
  65. package/docs/api/text-box.md +106 -0
  66. package/docs/api/theme.md +627 -0
  67. package/docs/api/time-picker.md +69 -0
  68. package/docs/api/time-selector.md +54 -0
  69. package/docs/api/tooltip.md +112 -0
  70. package/docs/api/tree-view.md +631 -0
  71. package/docs/api/window.md +245 -0
  72. package/docs/auto-complete.md +28 -329
  73. package/docs/avatar.md +4 -24
  74. package/docs/breadcrumb.md +10 -65
  75. package/docs/button-group.md +7 -60
  76. package/docs/button.md +8 -67
  77. package/docs/calendar.md +16 -121
  78. package/docs/card.md +16 -79
  79. package/docs/chart-bar.md +16 -234
  80. package/docs/chart-financial.md +10 -121
  81. package/docs/chart-funnel.md +13 -176
  82. package/docs/chart-heatmap.md +15 -131
  83. package/docs/chart-line-area.md +12 -137
  84. package/docs/chart-pie.md +17 -221
  85. package/docs/chart-radar.md +13 -129
  86. package/docs/chart-radial.md +13 -211
  87. package/docs/chart-scatter.md +6 -74
  88. package/docs/chart-treemap.md +14 -196
  89. package/docs/chart.md +168 -1892
  90. package/docs/checkbox.md +5 -61
  91. package/docs/chip.md +7 -42
  92. package/docs/circular-progress-bar.md +9 -61
  93. package/docs/collapsible.md +5 -87
  94. package/docs/color-gradient.md +8 -81
  95. package/docs/color-palette.md +7 -69
  96. package/docs/color-picker.md +9 -105
  97. package/docs/combo-box.md +28 -331
  98. package/docs/command.md +25 -236
  99. package/docs/contextmenu.md +15 -140
  100. package/docs/date-picker.md +7 -110
  101. package/docs/datetime-picker.md +7 -129
  102. package/docs/decimal-textbox.md +6 -69
  103. package/docs/dialog.md +23 -263
  104. package/docs/dropdown-button.md +15 -146
  105. package/docs/dropdown-list.md +29 -332
  106. package/docs/editor.md +10 -164
  107. package/docs/expansion-panel.md +7 -69
  108. package/docs/fieldset.md +5 -24
  109. package/docs/grid-columns.md +12 -92
  110. package/docs/grid-editing.md +29 -291
  111. package/docs/grid-grouping.md +11 -50
  112. package/docs/grid-rows.md +10 -74
  113. package/docs/grid-selection.md +7 -36
  114. package/docs/grid-server.md +8 -293
  115. package/docs/grid-sorting-filtering.md +10 -333
  116. package/docs/grid-state-export.md +17 -228
  117. package/docs/grid.md +23 -216
  118. package/docs/input.md +7 -19
  119. package/docs/installation.md +147 -15
  120. package/docs/introduction.md +37 -15
  121. package/docs/label.md +8 -39
  122. package/docs/list-box.md +21 -253
  123. package/docs/list-view.md +25 -232
  124. package/docs/menubar.md +21 -167
  125. package/docs/multi-select.md +31 -350
  126. package/docs/notification.md +17 -116
  127. package/docs/numeric-textbox.md +9 -78
  128. package/docs/otp-input.md +9 -95
  129. package/docs/pager.md +19 -239
  130. package/docs/placeholder.md +5 -18
  131. package/docs/popover.md +13 -123
  132. package/docs/popup-menu.md +22 -243
  133. package/docs/popup.md +24 -248
  134. package/docs/progress-bar.md +10 -75
  135. package/docs/radio-button.md +8 -96
  136. package/docs/range-slider.md +9 -82
  137. package/docs/rating.md +15 -163
  138. package/docs/scroll-view.md +9 -86
  139. package/docs/segmented.md +8 -90
  140. package/docs/sheet.md +10 -74
  141. package/docs/sidebar-menus.md +20 -155
  142. package/docs/sidebar-state.md +16 -134
  143. package/docs/sidebar.md +18 -218
  144. package/docs/skeleton.md +5 -26
  145. package/docs/slider.md +9 -97
  146. package/docs/spinner.md +15 -95
  147. package/docs/split-button.md +21 -166
  148. package/docs/splitter.md +9 -56
  149. package/docs/stepper.md +13 -127
  150. package/docs/switch.md +8 -58
  151. package/docs/tabs.md +13 -111
  152. package/docs/textarea.md +4 -13
  153. package/docs/textbox.md +10 -77
  154. package/docs/theming-built-in-themes.md +67 -0
  155. package/docs/theming-custom-colors.md +274 -0
  156. package/docs/theming-custom-themes.md +168 -0
  157. package/docs/theming.md +164 -248
  158. package/docs/time-picker.md +7 -112
  159. package/docs/tooltip-directive.md +12 -96
  160. package/docs/tooltip.md +12 -96
  161. package/docs/tree-view.md +42 -495
  162. package/docs/window.md +19 -230
  163. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1089 -603
  164. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +369 -184
  165. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +658 -371
  166. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +513 -359
  167. package/fesm2022/nanahoshi-mona-ui-button.mjs +622 -517
  168. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +2070 -1573
  169. package/fesm2022/nanahoshi-mona-ui-card.mjs +620 -316
  170. package/fesm2022/nanahoshi-mona-ui-chart.mjs +61151 -64921
  171. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +646 -317
  172. package/fesm2022/nanahoshi-mona-ui-chip.mjs +737 -516
  173. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +441 -242
  174. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +443 -389
  175. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +1138 -814
  176. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +1114 -959
  177. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +858 -504
  178. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1181 -742
  179. package/fesm2022/nanahoshi-mona-ui-command.mjs +1454 -853
  180. package/fesm2022/nanahoshi-mona-ui-common.mjs +569 -740
  181. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +978 -532
  182. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +283 -254
  183. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +973 -451
  184. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +1203 -658
  185. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +1415 -936
  186. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +1165 -568
  187. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1142 -677
  188. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +1018 -729
  189. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3589 -2122
  190. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +577 -359
  191. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +311 -151
  192. package/fesm2022/nanahoshi-mona-ui-filter.mjs +1086 -718
  193. package/fesm2022/nanahoshi-mona-ui-grid-grid-colgroup.component-NhONCVIX.mjs +77 -0
  194. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-Djv8ZnT5.mjs +480 -0
  195. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-WbXAzGCa.mjs +470 -0
  196. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-DkWTD3pN.mjs +2115 -0
  197. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DAHqTwBJ.mjs +330 -0
  198. package/fesm2022/nanahoshi-mona-ui-grid-grid.styles-BmLU-3zP.mjs +3766 -0
  199. package/fesm2022/nanahoshi-mona-ui-grid.mjs +5418 -2
  200. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +1379 -1079
  201. package/fesm2022/nanahoshi-mona-ui-i18n.mjs +4451 -5068
  202. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +344 -143
  203. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +257 -127
  204. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +2080 -1829
  205. package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +103 -141
  206. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2498 -2706
  207. package/fesm2022/nanahoshi-mona-ui-internal.mjs +722 -1007
  208. package/fesm2022/nanahoshi-mona-ui-label.mjs +313 -202
  209. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +1308 -1009
  210. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +1411 -677
  211. package/fesm2022/nanahoshi-mona-ui-list.mjs +1 -6
  212. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +556 -577
  213. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +530 -573
  214. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +530 -573
  215. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +533 -576
  216. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +520 -555
  217. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +530 -571
  218. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +520 -555
  219. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +520 -555
  220. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +530 -571
  221. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +576 -591
  222. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +530 -565
  223. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +520 -555
  224. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +520 -555
  225. package/fesm2022/nanahoshi-mona-ui-locales.mjs +59 -77
  226. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +1411 -829
  227. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1326 -702
  228. package/fesm2022/nanahoshi-mona-ui-notification.mjs +763 -675
  229. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1306 -826
  230. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +1122 -897
  231. package/fesm2022/nanahoshi-mona-ui-pager.mjs +1110 -651
  232. package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +95 -53
  233. package/fesm2022/nanahoshi-mona-ui-popover.mjs +559 -397
  234. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +2323 -1694
  235. package/fesm2022/nanahoshi-mona-ui-popup.mjs +1657 -1455
  236. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +441 -267
  237. package/fesm2022/nanahoshi-mona-ui-query.mjs +211 -340
  238. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +1017 -548
  239. package/fesm2022/nanahoshi-mona-ui-rating.mjs +874 -624
  240. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +1130 -917
  241. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +705 -455
  242. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +461 -283
  243. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +2791 -2449
  244. package/fesm2022/nanahoshi-mona-ui-skeleton.mjs +145 -90
  245. package/fesm2022/nanahoshi-mona-ui-slider.mjs +1563 -1103
  246. package/fesm2022/nanahoshi-mona-ui-spinner.mjs +738 -673
  247. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +1287 -647
  248. package/fesm2022/nanahoshi-mona-ui-splitter.mjs +1313 -909
  249. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +761 -540
  250. package/fesm2022/nanahoshi-mona-ui-switch.mjs +611 -280
  251. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +1393 -841
  252. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +142 -73
  253. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +876 -374
  254. package/fesm2022/nanahoshi-mona-ui-theme.mjs +1465 -1449
  255. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +897 -443
  256. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +1100 -703
  257. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +789 -538
  258. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +1361 -805
  259. package/fesm2022/nanahoshi-mona-ui-window.mjs +2145 -1531
  260. package/fesm2022/nanahoshi-mona-ui.mjs +1 -8
  261. package/llms.txt +80 -2
  262. package/package.json +62 -23
  263. package/types/nanahoshi-mona-ui-auto-complete.d.ts +367 -233
  264. package/types/nanahoshi-mona-ui-avatar.d.ts +722 -649
  265. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +134 -103
  266. package/types/nanahoshi-mona-ui-button-group.d.ts +213 -152
  267. package/types/nanahoshi-mona-ui-button.d.ts +227 -166
  268. package/types/nanahoshi-mona-ui-calendar.d.ts +324 -259
  269. package/types/nanahoshi-mona-ui-card.d.ts +125 -111
  270. package/types/nanahoshi-mona-ui-chart.d.ts +10483 -7326
  271. package/types/nanahoshi-mona-ui-check-box.d.ts +293 -180
  272. package/types/nanahoshi-mona-ui-chip.d.ts +208 -141
  273. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +194 -133
  274. package/types/nanahoshi-mona-ui-collapsible.d.ts +105 -87
  275. package/types/nanahoshi-mona-ui-color-gradient.d.ts +281 -213
  276. package/types/nanahoshi-mona-ui-color-palette.d.ts +201 -138
  277. package/types/nanahoshi-mona-ui-color-picker.d.ts +283 -194
  278. package/types/nanahoshi-mona-ui-combo-box.d.ts +401 -262
  279. package/types/nanahoshi-mona-ui-command.d.ts +279 -191
  280. package/types/nanahoshi-mona-ui-common.d.ts +360 -385
  281. package/types/nanahoshi-mona-ui-contextmenu.d.ts +142 -117
  282. package/types/nanahoshi-mona-ui-date-input.d.ts +97 -97
  283. package/types/nanahoshi-mona-ui-date-picker.d.ts +338 -208
  284. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +413 -259
  285. package/types/nanahoshi-mona-ui-dialog.d.ts +470 -381
  286. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +216 -168
  287. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +369 -243
  288. package/types/nanahoshi-mona-ui-dropdowns.d.ts +255 -235
  289. package/types/nanahoshi-mona-ui-editor.d.ts +302 -235
  290. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +140 -109
  291. package/types/nanahoshi-mona-ui-fieldset.d.ts +98 -68
  292. package/types/nanahoshi-mona-ui-filter.d.ts +150 -124
  293. package/types/nanahoshi-mona-ui-grid.d.ts +1956 -1678
  294. package/types/nanahoshi-mona-ui-i18n-icu.d.ts +25 -34
  295. package/types/nanahoshi-mona-ui-i18n.d.ts +999 -1052
  296. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +118 -71
  297. package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +56 -27
  298. package/types/nanahoshi-mona-ui-internal-list.d.ts +474 -408
  299. package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +143 -150
  300. package/types/nanahoshi-mona-ui-internal-tree.d.ts +493 -506
  301. package/types/nanahoshi-mona-ui-internal.d.ts +195 -213
  302. package/types/nanahoshi-mona-ui-label.d.ts +108 -78
  303. package/types/nanahoshi-mona-ui-list-box.d.ts +392 -322
  304. package/types/nanahoshi-mona-ui-list-view.d.ts +423 -282
  305. package/types/nanahoshi-mona-ui-list.d.ts +2 -1
  306. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +540 -542
  307. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +540 -542
  308. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +540 -542
  309. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +540 -542
  310. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +540 -542
  311. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +540 -542
  312. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +540 -542
  313. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +540 -542
  314. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +540 -542
  315. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +540 -542
  316. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +540 -542
  317. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +540 -542
  318. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +540 -542
  319. package/types/nanahoshi-mona-ui-locales.d.ts +17 -19
  320. package/types/nanahoshi-mona-ui-menubar.d.ts +210 -181
  321. package/types/nanahoshi-mona-ui-multi-select.d.ts +416 -276
  322. package/types/nanahoshi-mona-ui-notification.d.ts +140 -151
  323. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +407 -270
  324. package/types/nanahoshi-mona-ui-otp-input.d.ts +364 -241
  325. package/types/nanahoshi-mona-ui-pager.d.ts +379 -301
  326. package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -28
  327. package/types/nanahoshi-mona-ui-popover.d.ts +176 -134
  328. package/types/nanahoshi-mona-ui-popup-menu.d.ts +488 -344
  329. package/types/nanahoshi-mona-ui-popup.d.ts +698 -560
  330. package/types/nanahoshi-mona-ui-progress-bar.d.ts +197 -137
  331. package/types/nanahoshi-mona-ui-query.d.ts +82 -88
  332. package/types/nanahoshi-mona-ui-radio-button.d.ts +434 -269
  333. package/types/nanahoshi-mona-ui-rating.d.ts +348 -254
  334. package/types/nanahoshi-mona-ui-scroll-view.d.ts +244 -172
  335. package/types/nanahoshi-mona-ui-segmented.d.ts +250 -175
  336. package/types/nanahoshi-mona-ui-sheet.d.ts +115 -63
  337. package/types/nanahoshi-mona-ui-sidebar.d.ts +653 -493
  338. package/types/nanahoshi-mona-ui-skeleton.d.ts +55 -39
  339. package/types/nanahoshi-mona-ui-slider.d.ts +503 -354
  340. package/types/nanahoshi-mona-ui-spinner.d.ts +125 -112
  341. package/types/nanahoshi-mona-ui-split-button.d.ts +241 -196
  342. package/types/nanahoshi-mona-ui-splitter.d.ts +124 -78
  343. package/types/nanahoshi-mona-ui-stepper.d.ts +206 -181
  344. package/types/nanahoshi-mona-ui-switch.d.ts +197 -131
  345. package/types/nanahoshi-mona-ui-tabs.d.ts +349 -248
  346. package/types/nanahoshi-mona-ui-text-area.d.ts +52 -36
  347. package/types/nanahoshi-mona-ui-text-box.d.ts +349 -218
  348. package/types/nanahoshi-mona-ui-theme.d.ts +415 -408
  349. package/types/nanahoshi-mona-ui-time-picker.d.ts +357 -217
  350. package/types/nanahoshi-mona-ui-time-selector.d.ts +255 -170
  351. package/types/nanahoshi-mona-ui-tooltip.d.ts +222 -144
  352. package/types/nanahoshi-mona-ui-tree-view.d.ts +466 -308
  353. package/types/nanahoshi-mona-ui-window.d.ts +494 -399
  354. package/types/nanahoshi-mona-ui.d.ts +1 -2
  355. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs +0 -181
  356. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs +0 -208
  357. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs +0 -1082
  358. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs +0 -186
  359. package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs +0 -7568
@@ -1,52 +1,40 @@
1
- import { Directionality } from '@angular/cdk/bidi';
2
- import * as i0 from '@angular/core';
3
- import { InjectionToken, inject, DestroyRef, signal, ElementRef, Injector, computed, TemplateRef, viewChild, ViewContainerRef, untracked, input, effect, afterRenderEffect, afterNextRender, Component, ApplicationRef, DOCUMENT as DOCUMENT$1, createComponent, Injectable, makeEnvironmentProviders } from '@angular/core';
4
- import { MonaI18nService } from '@nanahoshi/mona-ui/i18n';
5
- import { themeOverlaySurfaceClasses, createElementControlId } from '@nanahoshi/mona-ui/internal';
6
- import { cva } from 'class-variance-authority';
7
- import { LiveAnnouncer } from '@angular/cdk/a11y';
8
- import { DOCUMENT, NgTemplateOutlet } from '@angular/common';
9
- import { LucideOctagonX, LucideBadgeInfo, LucideCircleCheckBig, LucideOctagonAlert, LucideX } from '@lucide/angular';
10
- import { ButtonDirective } from '@nanahoshi/mona-ui/button';
11
- import { ProgressBarComponent } from '@nanahoshi/mona-ui/progress-bar';
12
- import { Subject } from 'rxjs';
13
-
14
- // Generated from i18n/catalogs/en-US.messages.json by scripts/generate-locale-catalogs.ts. Do not edit.
15
- // Edit the JSON file and run `npm run generate:locale-catalogs`.
1
+ import { Directionality } from "@angular/cdk/bidi";
2
+ import * as i0 from "@angular/core";
3
+ import { ApplicationRef, Component, DOCUMENT, DestroyRef, ElementRef, Injectable, InjectionToken, Injector, TemplateRef, ViewContainerRef, afterNextRender, afterRenderEffect, computed, createComponent, effect, inject, input, makeEnvironmentProviders, signal, untracked, viewChild } from "@angular/core";
4
+ import { MonaI18nService } from "@nanahoshi/mona-ui/i18n";
5
+ import { createElementControlId, themeOverlaySurfaceClasses } from "@nanahoshi/mona-ui/internal";
6
+ import { cva } from "class-variance-authority";
7
+ import { LiveAnnouncer } from "@angular/cdk/a11y";
8
+ import { DOCUMENT as DOCUMENT$1, NgTemplateOutlet } from "@angular/common";
9
+ import { LucideBadgeInfo, LucideCircleCheckBig, LucideOctagonAlert, LucideOctagonX, LucideX } from "@lucide/angular";
10
+ import { ButtonDirective } from "@nanahoshi/mona-ui/button";
11
+ import { ProgressBarComponent } from "@nanahoshi/mona-ui/progress-bar";
12
+ import { Subject } from "rxjs";
16
13
  const NOTIFICATION_DEFAULT_MESSAGES = {
17
- close: "Close",
18
- error: "Error",
19
- info: "Info",
20
- region: "Notifications",
21
- success: "Success",
22
- warning: "Warning"
14
+ close: "Close",
15
+ error: "Error",
16
+ info: "Info",
17
+ region: "Notifications",
18
+ success: "Success",
19
+ warning: "Warning"
23
20
  };
24
-
25
- //---------------------------------
26
- // Notification Container Component
27
- //---------------------------------
28
21
  const notificationContainerBaseThemeVariants = cva(`p-2 z-40000`, {
29
- variants: {
30
- position: {
31
- bottom: "bottom-0 left-1/2 -translate-x-1/2",
32
- bottomleft: "bottom-0 left-0",
33
- bottomright: "bottom-0 right-0",
34
- top: "top-0 left-1/2 -translate-x-1/2",
35
- topleft: "top-0 left-0",
36
- topright: "top-0 right-0"
37
- },
38
- positionType: {
39
- fixed: "fixed",
40
- absolute: "absolute"
41
- }
42
- },
43
- defaultVariants: {
44
- positionType: "fixed"
45
- }
22
+ variants: {
23
+ position: {
24
+ bottom: "bottom-0 left-1/2 -translate-x-1/2",
25
+ bottomleft: "bottom-0 left-0",
26
+ bottomright: "bottom-0 right-0",
27
+ top: "top-0 left-1/2 -translate-x-1/2",
28
+ topleft: "top-0 left-0",
29
+ topright: "top-0 right-0"
30
+ },
31
+ positionType: {
32
+ fixed: "fixed",
33
+ absolute: "absolute"
34
+ }
35
+ },
36
+ defaultVariants: { positionType: "fixed" }
46
37
  });
47
- //-----------------------
48
- // Notification Component
49
- //-----------------------
50
38
  const notificationActionThemeVariants = cva(`
51
39
  absolute top-0 end-0 flex h-auto items-start
52
40
  [&>svg.lucide]:cursor-pointer
@@ -70,647 +58,747 @@ const notificationHeaderThemeVariants = cva(`
70
58
  `);
71
59
  const notificationIconThemeVariants = cva(`
72
60
  flex items-center justify-center px-4
73
- `, {
74
- variants: {
75
- type: {
76
- info: "text-info",
77
- success: "text-success",
78
- warning: "text-warning",
79
- error: "text-error"
80
- }
81
- }
82
- });
61
+ `, { variants: { type: {
62
+ info: "text-info",
63
+ success: "text-success",
64
+ warning: "text-warning",
65
+ error: "text-error"
66
+ } } });
83
67
  const notificationTextThemeVariants = cva(`
84
68
  text-sm text-foreground
85
69
  `);
86
-
87
- /** The defaults used when nothing is provided with `provideNotificationDefaults()`. */
88
70
  const DEFAULT_NOTIFICATION_DEFAULTS = {
89
- autoHide: true,
90
- durationScale: 1,
91
- pauseOnWindowBlur: true
71
+ autoHide: true,
72
+ durationScale: 1,
73
+ pauseOnWindowBlur: true
92
74
  };
93
- /**
94
- * @description Application-wide notification settings. Provide them with `provideNotificationDefaults()`.
95
- */
96
75
  const NOTIFICATION_DEFAULTS = new InjectionToken("Mona UI notification defaults", {
97
- providedIn: "root",
98
- factory: () => DEFAULT_NOTIFICATION_DEFAULTS
76
+ providedIn: "root",
77
+ factory: () => DEFAULT_NOTIFICATION_DEFAULTS
99
78
  });
100
- /**
101
- * @description The `data` given in the notification's options, for a content component or template to inject.
102
- */
103
79
  const NOTIFICATION_DATA = new InjectionToken("Mona UI notification data");
104
- /**
105
- * @description The reference of the notification a content component or template is shown in.
106
- */
107
80
  const NOTIFICATION_REF = new InjectionToken("Mona UI notification reference");
108
-
109
- /** Elements that can take focus with Tab, for moving focus to another notification. */
110
81
  const TABBABLE = [
111
- "a[href]",
112
- "button:not([disabled])",
113
- "input:not([disabled]):not([type='hidden'])",
114
- "select:not([disabled])",
115
- "textarea:not([disabled])",
116
- "[tabindex]:not([tabindex='-1'])"
82
+ "a[href]",
83
+ "button:not([disabled])",
84
+ "input:not([disabled]):not([type='hidden'])",
85
+ "select:not([disabled])",
86
+ "textarea:not([disabled])",
87
+ "[tabindex]:not([tabindex='-1'])"
117
88
  ].join(", ");
118
- /** How long closing waits for the leave animation before removing the notification anyway. */
119
- const LEAVE_FALLBACK = 1000;
120
- /**
121
- * Where focus goes back to once a notification closes, by notification element. Focus handed from one notification
122
- * to the next keeps the place it first came from.
123
- */
124
- const RETURN_FOCUS = new WeakMap();
125
- class NotificationComponent {
126
- #announcer;
127
- #defaults;
128
- #destroyRef;
129
- #document;
130
- #focused;
131
- #host;
132
- #hovered;
133
- #i18n;
134
- #injector;
135
- #isUrgent;
136
- /** Whether the countdown runs: there is one, and nothing pauses it. */
137
- #running;
138
- #windowBlurred;
139
- #closeTimer;
140
- #progressTimer;
141
- #remaining;
142
- #startedAt;
143
- constructor() {
144
- this.#announcer = inject(LiveAnnouncer);
145
- this.#defaults = inject(NOTIFICATION_DEFAULTS);
146
- this.#destroyRef = inject(DestroyRef);
147
- this.#document = inject(DOCUMENT);
148
- this.#focused = signal(false, /* @ts-ignore */
149
- ...(ngDevMode ? [{ debugName: "#focused" }] : /* istanbul ignore next */ []));
150
- this.#host = inject(ElementRef);
151
- this.#hovered = signal(false, /* @ts-ignore */
152
- ...(ngDevMode ? [{ debugName: "#hovered" }] : /* istanbul ignore next */ []));
153
- this.#i18n = inject(MonaI18nService);
154
- this.#injector = inject(Injector);
155
- this.#isUrgent = computed(() => this.type() === "error" || this.type() === "warning", /* @ts-ignore */
156
- ...(ngDevMode ? [{ debugName: "#isUrgent" }] : /* istanbul ignore next */ []));
157
- /** Whether the countdown runs: there is one, and nothing pauses it. */
158
- this.#running = computed(() => this.options().duration != null &&
159
- !this.data().closing() &&
160
- !this.#hovered() &&
161
- !this.#focused() &&
162
- !this.#windowBlurred(), /* @ts-ignore */
163
- ...(ngDevMode ? [{ debugName: "#running" }] : /* istanbul ignore next */ []));
164
- this.#windowBlurred = signal(false, /* @ts-ignore */
165
- ...(ngDevMode ? [{ debugName: "#windowBlurred" }] : /* istanbul ignore next */ []));
166
- this.#closeTimer = null;
167
- this.#progressTimer = null;
168
- this.#remaining = null;
169
- this.#startedAt = 0;
170
- this.actionClass = computed(() => {
171
- return notificationActionThemeVariants();
172
- }, /* @ts-ignore */
173
- ...(ngDevMode ? [{ debugName: "actionClass" }] : /* istanbul ignore next */ []));
174
- this.baseClass = computed(() => {
175
- return notificationBaseThemeVariants();
176
- }, /* @ts-ignore */
177
- ...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
178
- this.bodyClass = computed(() => {
179
- return notificationBodyThemeVariants();
180
- }, /* @ts-ignore */
181
- ...(ngDevMode ? [{ debugName: "bodyClass" }] : /* istanbul ignore next */ []));
182
- this.closeTitle = computed(() => {
183
- return this.options().closeTitle ?? this.messages().close;
184
- }, /* @ts-ignore */
185
- ...(ngDevMode ? [{ debugName: "closeTitle" }] : /* istanbul ignore next */ []));
186
- this.contentClass = computed(() => {
187
- return notificationContentThemeVariants();
188
- }, /* @ts-ignore */
189
- ...(ngDevMode ? [{ debugName: "contentClass" }] : /* istanbul ignore next */ []));
190
- this.contentComponent = computed(() => {
191
- const content = this.options().content;
192
- return typeof content !== "string" && !(content instanceof TemplateRef) ? content : null;
193
- }, /* @ts-ignore */
194
- ...(ngDevMode ? [{ debugName: "contentComponent" }] : /* istanbul ignore next */ []));
195
- this.contentHost = viewChild("contentHost", { ...(ngDevMode ? { debugName: "contentHost" } : /* istanbul ignore next */ {}), read: ViewContainerRef });
196
- /** Gives a content component or template the notification's reference and data. */
197
- this.contentInjector = computed(() => {
198
- const data = this.data();
199
- return Injector.create({
200
- parent: this.#injector,
201
- providers: [
202
- { provide: NOTIFICATION_REF, useValue: data.ref },
203
- { provide: NOTIFICATION_DATA, useValue: untracked(() => data.options().data) }
204
- ]
205
- });
206
- }, /* @ts-ignore */
207
- ...(ngDevMode ? [{ debugName: "contentInjector" }] : /* istanbul ignore next */ []));
208
- this.contentTemplate = computed(() => {
209
- const content = this.options().content;
210
- return content instanceof TemplateRef ? content : null;
211
- }, /* @ts-ignore */
212
- ...(ngDevMode ? [{ debugName: "contentTemplate" }] : /* istanbul ignore next */ []));
213
- this.headerClass = computed(() => {
214
- return notificationHeaderThemeVariants();
215
- }, /* @ts-ignore */
216
- ...(ngDevMode ? [{ debugName: "headerClass" }] : /* istanbul ignore next */ []));
217
- this.iconClass = computed(() => {
218
- const type = this.type();
219
- return notificationIconThemeVariants({ type });
220
- }, /* @ts-ignore */
221
- ...(ngDevMode ? [{ debugName: "iconClass" }] : /* istanbul ignore next */ []));
222
- this.messageElement = viewChild("message", /* @ts-ignore */
223
- ...(ngDevMode ? [{ debugName: "messageElement" }] : /* istanbul ignore next */ []));
224
- this.messages = this.#i18n.componentMessages("notification", NOTIFICATION_DEFAULT_MESSAGES);
225
- this.options = computed(() => this.data().options(), /* @ts-ignore */
226
- ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
227
- /** A theme color through its variable, so it follows a theme switch. */
228
- this.progressColor = computed(() => `var(--color-${this.type()})`, /* @ts-ignore */
229
- ...(ngDevMode ? [{ debugName: "progressColor" }] : /* istanbul ignore next */ []));
230
- this.progressValue = signal(100, /* @ts-ignore */
231
- ...(ngDevMode ? [{ debugName: "progressValue" }] : /* istanbul ignore next */ []));
232
- this.stringContent = computed(() => {
233
- const content = this.options().content;
234
- return typeof content === "string" ? content : null;
235
- }, /* @ts-ignore */
236
- ...(ngDevMode ? [{ debugName: "stringContent" }] : /* istanbul ignore next */ []));
237
- this.templateContext = computed(() => ({
238
- $implicit: this.data().ref,
239
- data: this.options().data
240
- }), /* @ts-ignore */
241
- ...(ngDevMode ? [{ debugName: "templateContext" }] : /* istanbul ignore next */ []));
242
- this.textClass = computed(() => {
243
- return notificationTextThemeVariants();
244
- }, /* @ts-ignore */
245
- ...(ngDevMode ? [{ debugName: "textClass" }] : /* istanbul ignore next */ []));
246
- this.title = computed(() => this.options().title ?? this.messages()[this.type()], /* @ts-ignore */
247
- ...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
248
- this.type = computed(() => this.options().type ?? "info", /* @ts-ignore */
249
- ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
250
- /**
251
- * @description The notification's internal state, created and managed by `NotificationService`. Not intended to be provided directly by consumers.
252
- */
253
- this.data = input.required(/* @ts-ignore */
254
- ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
255
- /**
256
- * @description The edge the notification's container is on, which its leave animation moves towards.
257
- */
258
- this.side = input("top", /* @ts-ignore */
259
- ...(ngDevMode ? [{ debugName: "side" }] : /* istanbul ignore next */ []));
260
- effect(() => {
261
- this.data().rendered = true;
262
- });
263
- effect(() => {
264
- const running = this.#running();
265
- untracked(() => (running ? this.#resume() : this.#pause()));
266
- });
267
- effect(() => {
268
- if (this.data().closing()) {
269
- untracked(() => this.#leave());
270
- }
271
- });
272
- afterRenderEffect({
273
- write: () => {
274
- const type = this.contentComponent();
275
- const host = this.contentHost();
276
- const injector = this.contentInjector();
277
- untracked(() => {
278
- host?.clear();
279
- const componentRef = type && host ? host.createComponent(type, { injector }) : null;
280
- componentRef?.changeDetectorRef.detectChanges();
281
- this.data().contentComponentRef.set(componentRef);
282
- });
283
- }
284
- });
285
- // Announced once rendered, and again when update() changes it. The notification itself isn't a live
286
- // region: one inserted with its text already in it is often skipped by screen readers.
287
- afterRenderEffect({
288
- read: () => {
289
- this.options();
290
- untracked(() => this.#announce());
291
- }
292
- });
293
- this.#listenForWindowFocus();
294
- this.#destroyRef.onDestroy(() => {
295
- this.#stopTimers();
296
- this.data().finish();
297
- });
298
- }
299
- close() {
300
- this.data().close();
301
- }
302
- onFocusIn(event) {
303
- const host = this.#host.nativeElement;
304
- const from = event.relatedTarget;
305
- if (!this.#focused() && from instanceof HTMLElement && !host.contains(from)) {
306
- const fromNotification = from.closest(host.tagName);
307
- const target = fromNotification ? RETURN_FOCUS.get(fromNotification) : from;
308
- if (target) {
309
- RETURN_FOCUS.set(host, target);
310
- }
311
- }
312
- this.#focused.set(true);
313
- }
314
- onFocusOut(event) {
315
- const to = event.relatedTarget;
316
- if (to instanceof Node && this.#host.nativeElement.contains(to)) {
317
- return;
318
- }
319
- this.#focused.set(false);
320
- }
321
- onPointerChange(inside) {
322
- this.#hovered.set(inside);
323
- }
324
- #announce() {
325
- const content = this.stringContent();
326
- const element = this.messageElement()?.nativeElement;
327
- const text = content != null
328
- ? `${this.title()} ${content}`
329
- : (element?.innerText ?? element?.textContent);
330
- const message = text?.replace(/\s+/g, " ").trim();
331
- if (message) {
332
- void this.#announcer.announce(message, this.#isUrgent() ? "assertive" : "polite");
333
- }
334
- }
335
- /** Plays the leave animation, then removes the notification. */
336
- #leave() {
337
- this.#stopTimers();
338
- this.#moveFocusAway();
339
- afterNextRender({
340
- read: () => {
341
- const host = this.#host.nativeElement;
342
- const animation = this.#document.defaultView?.getComputedStyle(host).animationName;
343
- if (!animation || animation === "none") {
344
- this.data().finish();
345
- return;
346
- }
347
- const done = () => {
348
- clearTimeout(fallback);
349
- host.removeEventListener("animationend", onEnd);
350
- this.data().finish();
351
- };
352
- const onEnd = (event) => {
353
- if (event.target === host) {
354
- done();
355
- }
356
- };
357
- const fallback = setTimeout(done, LEAVE_FALLBACK);
358
- host.addEventListener("animationend", onEnd);
359
- }
360
- }, { injector: this.#injector });
361
- }
362
- #listenForWindowFocus() {
363
- const view = this.#document.defaultView;
364
- if (!this.#defaults.pauseOnWindowBlur || !view) {
365
- return;
366
- }
367
- const blur = () => this.#windowBlurred.set(true);
368
- const focus = () => this.#windowBlurred.set(false);
369
- view.addEventListener("blur", blur);
370
- view.addEventListener("focus", focus);
371
- this.#destroyRef.onDestroy(() => {
372
- view.removeEventListener("blur", blur);
373
- view.removeEventListener("focus", focus);
374
- });
375
- }
376
- /** A closing notification that has focus hands it to the next notification, else back to where it came from. */
377
- #moveFocusAway() {
378
- const host = this.#host.nativeElement;
379
- const active = this.#document.activeElement;
380
- if (!(active instanceof HTMLElement) || !host.contains(active)) {
381
- return;
382
- }
383
- const siblings = Array.from(host.parentElement?.children ?? []).filter(element => element !== host && element.tagName === host.tagName && !element.hasAttribute("data-closing"));
384
- const isAfter = (element) => !!(host.compareDocumentPosition(element) & Node.DOCUMENT_POSITION_FOLLOWING);
385
- const ordered = [...siblings.filter(isAfter), ...siblings.filter(element => !isAfter(element)).reverse()];
386
- for (const sibling of ordered) {
387
- const target = sibling.querySelector(TABBABLE);
388
- if (target) {
389
- target.focus();
390
- return;
391
- }
392
- }
393
- const returnFocus = RETURN_FOCUS.get(host);
394
- if (returnFocus?.isConnected) {
395
- returnFocus.focus();
396
- return;
397
- }
398
- active.blur();
399
- }
400
- #pause() {
401
- if (this.#closeTimer == null) {
402
- return;
403
- }
404
- const duration = this.options().duration ?? 0;
405
- this.#remaining = Math.max(0, (this.#remaining ?? duration) - (performance.now() - this.#startedAt));
406
- this.#stopTimers();
407
- this.progressValue.set(duration > 0 ? (this.#remaining / duration) * 100 : 0);
408
- }
409
- /** Runs the countdown from the time left, measured with the clock rather than by counting ticks. */
410
- #resume() {
411
- const duration = this.options().duration;
412
- if (duration == null || this.#closeTimer != null) {
413
- return;
414
- }
415
- const remaining = (this.#remaining ??= duration);
416
- this.#startedAt = performance.now();
417
- this.#closeTimer = setTimeout(() => {
418
- this.#closeTimer = null;
419
- this.#remaining = 0;
420
- this.#stopTimers();
421
- this.progressValue.set(0);
422
- this.data().close();
423
- }, remaining);
424
- if (this.options().progressBar && duration > 0) {
425
- const step = Math.min(100, Math.max(16, duration / 100));
426
- this.#progressTimer = setInterval(() => {
427
- const left = remaining - (performance.now() - this.#startedAt);
428
- this.progressValue.set(Math.max(0, (left / duration) * 100));
429
- }, step);
430
- }
431
- }
432
- #stopTimers() {
433
- if (this.#closeTimer != null) {
434
- clearTimeout(this.#closeTimer);
435
- this.#closeTimer = null;
436
- }
437
- if (this.#progressTimer != null) {
438
- clearInterval(this.#progressTimer);
439
- this.#progressTimer = null;
440
- }
441
- }
442
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NotificationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
443
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: NotificationComponent, isStandalone: true, selector: "mona-notification", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, side: { classPropertyName: "side", publicName: "side", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "focusin": "onFocusIn($event)", "focusout": "onFocusOut($event)", "pointerenter": "onPointerChange(true)", "pointerleave": "onPointerChange(false)" }, properties: { "attr.data-closing": "data().closing() ? '' : null", "class.notification-leave-bottom": "data().closing() && side() === 'bottom'", "class.notification-leave-top": "data().closing() && side() !== 'bottom'" } }, viewQueries: [{ propertyName: "contentHost", first: true, predicate: ["contentHost"], descendants: true, read: ViewContainerRef, isSignal: true }, { propertyName: "messageElement", first: true, predicate: ["message"], descendants: true, isSignal: true }], ngImport: i0, template: "@let opts = options();\n@let width = typeof opts.width === \"string\" ? opts.width : `${opts.width}px`;\n@let height = typeof opts.height === \"string\" ? opts.height : `${opts.height}px`;\n\n<div [class]=\"baseClass()\" [style.width]=\"width\" [style.height]=\"height\">\n @if (contentTemplate(); as template) {\n <div #message class=\"contents\">\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"templateContext()\"\n [ngTemplateOutletInjector]=\"contentInjector()\"></ng-container>\n </div>\n } @else if (contentComponent()) {\n <div #message class=\"contents\">\n <ng-container #contentHost></ng-container>\n </div>\n } @else {\n <div #message [class]=\"bodyClass()\">\n <div [class]=\"iconClass()\" aria-hidden=\"true\">\n @switch (type()) {\n @case (\"error\") {\n <svg lucideOctagonX aria-hidden=\"true\"></svg>\n }\n @case (\"info\") {\n <svg lucideBadgeInfo aria-hidden=\"true\"></svg>\n }\n @case (\"success\") {\n <svg lucideCircleCheckBig aria-hidden=\"true\"></svg>\n }\n @case (\"warning\") {\n <svg lucideOctagonAlert aria-hidden=\"true\"></svg>\n }\n }\n </div>\n <div class=\"flex flex-col flex-1\">\n <div [class]=\"headerClass()\">{{ title() }}</div>\n <div [class]=\"contentClass()\">\n <span [class]=\"textClass()\">{{ stringContent() }}</span>\n </div>\n </div>\n </div>\n @if (opts.progressBar && opts.duration !== undefined) {\n <!-- Decorative: the time left isn't worth announcing. -->\n <div class=\"w-full h-1\" aria-hidden=\"true\">\n <mona-progress-bar\n [value]=\"progressValue()\"\n [color]=\"progressColor()\"\n [labelVisible]=\"false\"\n [animate]=\"false\"\n rounded=\"none\"\n class=\"h-full\"></mona-progress-bar>\n </div>\n }\n }\n @if (opts.closable) {\n <div [class]=\"actionClass()\">\n <button\n monaButton\n size=\"small\"\n look=\"link\"\n rounded=\"none\"\n [iconOnly]=\"true\"\n [title]=\"closeTitle()\"\n [attr.aria-label]=\"closeTitle()\"\n (click)=\"close()\">\n <svg lucideX [size]=\"14\" aria-hidden=\"true\"></svg>\n </button>\n </div>\n }\n</div>\n", styles: [":host{display:block}@keyframes notification-slide-in-top{0%{clip-path:inset(0 -20px 100% -20px);transform:translateY(-12px);opacity:0}to{clip-path:inset(-20px);transform:translateY(0);opacity:1}}@keyframes notification-slide-out-top{0%{clip-path:inset(-20px);transform:translateY(0);opacity:1}to{clip-path:inset(0 -20px 100% -20px);transform:translateY(-12px);opacity:0}}@keyframes notification-slide-in-bottom{0%{clip-path:inset(100% -20px 0 -20px);transform:translateY(12px);opacity:0}to{clip-path:inset(-20px);transform:translateY(0);opacity:1}}@keyframes notification-slide-out-bottom{0%{clip-path:inset(-20px);transform:translateY(0);opacity:1}to{clip-path:inset(100% -20px 0 -20px);transform:translateY(12px);opacity:0}}:host.notification-enter-top{animation:notification-slide-in-top .3s cubic-bezier(.4,0,.2,1) forwards}:host.notification-enter-bottom{animation:notification-slide-in-bottom .3s cubic-bezier(.4,0,.2,1) forwards}:host.notification-leave-top{animation:notification-slide-out-top .3s cubic-bezier(.4,0,.2,1) forwards}:host.notification-leave-bottom{animation:notification-slide-out-bottom .3s cubic-bezier(.4,0,.2,1) forwards}@media(prefers-reduced-motion:reduce){:host.notification-enter-top,:host.notification-enter-bottom,:host.notification-leave-top,:host.notification-leave-bottom{animation:none}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: ProgressBarComponent, selector: "mona-progress-bar", inputs: ["animate", "aria-label", "aria-valuetext", "color", "disabled", "indeterminate", "labelPosition", "labelStyles", "labelVisible", "max", "min", "rounded", "class", "value"] }, { 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: "component", type: LucideOctagonX, selector: "svg[lucideOctagonX], svg[lucideXOctagon]" }, { kind: "component", type: LucideBadgeInfo, selector: "svg[lucideBadgeInfo]" }, { kind: "component", type: LucideCircleCheckBig, selector: "svg[lucideCircleCheckBig], svg[lucideCheckCircle]" }, { kind: "component", type: LucideOctagonAlert, selector: "svg[lucideOctagonAlert], svg[lucideAlertOctagon]" }, { kind: "component", type: LucideX, selector: "svg[lucideX]" }] }); }
444
- }
445
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NotificationComponent, decorators: [{
446
- type: Component,
447
- args: [{ selector: "mona-notification", imports: [
448
- NgTemplateOutlet,
449
- ProgressBarComponent,
450
- ButtonDirective,
451
- LucideOctagonX,
452
- LucideBadgeInfo,
453
- LucideCircleCheckBig,
454
- LucideOctagonAlert,
455
- LucideX
456
- ], host: {
457
- "[attr.data-closing]": "data().closing() ? '' : null",
458
- "[class.notification-leave-bottom]": "data().closing() && side() === 'bottom'",
459
- "[class.notification-leave-top]": "data().closing() && side() !== 'bottom'",
460
- "(focusin)": "onFocusIn($event)",
461
- "(focusout)": "onFocusOut($event)",
462
- "(pointerenter)": "onPointerChange(true)",
463
- "(pointerleave)": "onPointerChange(false)"
464
- }, template: "@let opts = options();\n@let width = typeof opts.width === \"string\" ? opts.width : `${opts.width}px`;\n@let height = typeof opts.height === \"string\" ? opts.height : `${opts.height}px`;\n\n<div [class]=\"baseClass()\" [style.width]=\"width\" [style.height]=\"height\">\n @if (contentTemplate(); as template) {\n <div #message class=\"contents\">\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"templateContext()\"\n [ngTemplateOutletInjector]=\"contentInjector()\"></ng-container>\n </div>\n } @else if (contentComponent()) {\n <div #message class=\"contents\">\n <ng-container #contentHost></ng-container>\n </div>\n } @else {\n <div #message [class]=\"bodyClass()\">\n <div [class]=\"iconClass()\" aria-hidden=\"true\">\n @switch (type()) {\n @case (\"error\") {\n <svg lucideOctagonX aria-hidden=\"true\"></svg>\n }\n @case (\"info\") {\n <svg lucideBadgeInfo aria-hidden=\"true\"></svg>\n }\n @case (\"success\") {\n <svg lucideCircleCheckBig aria-hidden=\"true\"></svg>\n }\n @case (\"warning\") {\n <svg lucideOctagonAlert aria-hidden=\"true\"></svg>\n }\n }\n </div>\n <div class=\"flex flex-col flex-1\">\n <div [class]=\"headerClass()\">{{ title() }}</div>\n <div [class]=\"contentClass()\">\n <span [class]=\"textClass()\">{{ stringContent() }}</span>\n </div>\n </div>\n </div>\n @if (opts.progressBar && opts.duration !== undefined) {\n <!-- Decorative: the time left isn't worth announcing. -->\n <div class=\"w-full h-1\" aria-hidden=\"true\">\n <mona-progress-bar\n [value]=\"progressValue()\"\n [color]=\"progressColor()\"\n [labelVisible]=\"false\"\n [animate]=\"false\"\n rounded=\"none\"\n class=\"h-full\"></mona-progress-bar>\n </div>\n }\n }\n @if (opts.closable) {\n <div [class]=\"actionClass()\">\n <button\n monaButton\n size=\"small\"\n look=\"link\"\n rounded=\"none\"\n [iconOnly]=\"true\"\n [title]=\"closeTitle()\"\n [attr.aria-label]=\"closeTitle()\"\n (click)=\"close()\">\n <svg lucideX [size]=\"14\" aria-hidden=\"true\"></svg>\n </button>\n </div>\n }\n</div>\n", styles: [":host{display:block}@keyframes notification-slide-in-top{0%{clip-path:inset(0 -20px 100% -20px);transform:translateY(-12px);opacity:0}to{clip-path:inset(-20px);transform:translateY(0);opacity:1}}@keyframes notification-slide-out-top{0%{clip-path:inset(-20px);transform:translateY(0);opacity:1}to{clip-path:inset(0 -20px 100% -20px);transform:translateY(-12px);opacity:0}}@keyframes notification-slide-in-bottom{0%{clip-path:inset(100% -20px 0 -20px);transform:translateY(12px);opacity:0}to{clip-path:inset(-20px);transform:translateY(0);opacity:1}}@keyframes notification-slide-out-bottom{0%{clip-path:inset(-20px);transform:translateY(0);opacity:1}to{clip-path:inset(100% -20px 0 -20px);transform:translateY(12px);opacity:0}}:host.notification-enter-top{animation:notification-slide-in-top .3s cubic-bezier(.4,0,.2,1) forwards}:host.notification-enter-bottom{animation:notification-slide-in-bottom .3s cubic-bezier(.4,0,.2,1) forwards}:host.notification-leave-top{animation:notification-slide-out-top .3s cubic-bezier(.4,0,.2,1) forwards}:host.notification-leave-bottom{animation:notification-slide-out-bottom .3s cubic-bezier(.4,0,.2,1) forwards}@media(prefers-reduced-motion:reduce){:host.notification-enter-top,:host.notification-enter-bottom,:host.notification-leave-top,:host.notification-leave-bottom{animation:none}}\n"] }]
465
- }], ctorParameters: () => [], propDecorators: { contentHost: [{ type: i0.ViewChild, args: ["contentHost", { ...{ read: ViewContainerRef }, isSignal: true }] }], messageElement: [{ type: i0.ViewChild, args: ["message", { isSignal: true }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], side: [{ type: i0.Input, args: [{ isSignal: true, alias: "side", required: false }] }] } });
466
-
467
- class NotificationContainerComponent {
468
- constructor() {
469
- this.#i18n = inject(MonaI18nService);
470
- this.baseClass = computed(() => {
471
- const position = this.position();
472
- const positionType = this.positionType();
473
- return notificationContainerBaseThemeVariants({ position, positionType });
474
- }, /* @ts-ignore */
475
- ...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
476
- this.enterAnimClass = computed(() => this.side() === "bottom" ? "notification-enter-bottom" : "notification-enter-top", /* @ts-ignore */
477
- ...(ngDevMode ? [{ debugName: "enterAnimClass" }] : /* istanbul ignore next */ []));
478
- this.messages = this.#i18n.componentMessages("notification", NOTIFICATION_DEFAULT_MESSAGES);
479
- this.side = computed(() => (this.position().startsWith("bottom") ? "bottom" : "top"), /* @ts-ignore */
480
- ...(ngDevMode ? [{ debugName: "side" }] : /* istanbul ignore next */ []));
481
- this.notificationDataList = signal([], /* @ts-ignore */
482
- ...(ngDevMode ? [{ debugName: "notificationDataList" }] : /* istanbul ignore next */ []));
483
- this.position = signal("topright", /* @ts-ignore */
484
- ...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
485
- this.positionType = signal("fixed", /* @ts-ignore */
486
- ...(ngDevMode ? [{ debugName: "positionType" }] : /* istanbul ignore next */ []));
487
- }
488
- #i18n;
489
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NotificationContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
490
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: NotificationContainerComponent, isStandalone: true, selector: "mona-notification-container", host: { attributes: { "role": "region" }, properties: { "attr.aria-label": "messages().region", "class": "baseClass()" } }, ngImport: i0, template: "@for (notificationData of notificationDataList(); track notificationData) {\n <mona-notification [data]=\"notificationData\" [side]=\"side()\" [animate.enter]=\"enterAnimClass()\"></mona-notification>\n}\n", dependencies: [{ kind: "component", type: NotificationComponent, selector: "mona-notification", inputs: ["data", "side"] }] }); }
491
- }
492
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NotificationContainerComponent, decorators: [{
493
- type: Component,
494
- args: [{ selector: "mona-notification-container", imports: [NotificationComponent], host: {
495
- "[attr.aria-label]": "messages().region",
496
- "[class]": "baseClass()",
497
- role: "region"
498
- }, template: "@for (notificationData of notificationDataList(); track notificationData) {\n <mona-notification [data]=\"notificationData\" [side]=\"side()\" [animate.enter]=\"enterAnimClass()\"></mona-notification>\n}\n" }]
499
- }] });
500
-
501
- /**
502
- * The internal state of one shown notification, shared by the service and the notification component.
503
- * Closing has two steps: `close()` starts it and the component plays its leave animation, then `finish()` removes it.
504
- */
505
- class NotificationData {
506
- #afterHide$;
507
- #onFinish;
508
- #finished;
509
- constructor(options, onFinish = () => undefined) {
510
- this.#afterHide$ = new Subject();
511
- this.#finished = false;
512
- this.closing = signal(false, /* @ts-ignore */
513
- ...(ngDevMode ? [{ debugName: "closing" }] : /* istanbul ignore next */ []));
514
- this.contentComponentRef = signal(null, /* @ts-ignore */
515
- ...(ngDevMode ? [{ debugName: "contentComponentRef" }] : /* istanbul ignore next */ []));
516
- /** Set once the notification component exists, so closing waits for its leave animation. */
517
- this.rendered = false;
518
- this.#onFinish = onFinish;
519
- this.options = signal(options, /* @ts-ignore */
520
- ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
521
- const contentComponentRef = this.contentComponentRef;
522
- this.ref = {
523
- afterHide: this.#afterHide$.asObservable(),
524
- get content() {
525
- return contentComponentRef();
526
- },
527
- hide: () => this.close(),
528
- id: options.id,
529
- update: changes => {
530
- if (!this.#finished) {
531
- this.options.update(current => ({ ...current, ...changes }));
532
- }
533
- }
534
- };
535
- }
536
- get finished() {
537
- return this.#finished;
538
- }
539
- get id() {
540
- return this.options().id;
541
- }
542
- /** Starts closing. A notification that hasn't rendered yet is removed at once. */
543
- close() {
544
- if (this.#finished || this.closing()) {
545
- return;
546
- }
547
- if (!this.rendered) {
548
- this.finish();
549
- return;
550
- }
551
- this.closing.set(true);
552
- }
553
- /** Removes the notification, and emits and completes `afterHide`. */
554
- finish() {
555
- if (this.#finished) {
556
- return;
557
- }
558
- this.#finished = true;
559
- this.closing.set(true);
560
- this.#onFinish(this);
561
- this.#afterHide$.next();
562
- this.#afterHide$.complete();
563
- }
564
- }
565
-
566
- class NotificationService {
567
- #appRef = inject(ApplicationRef);
568
- #containers = new Map();
569
- #defaults = inject(NOTIFICATION_DEFAULTS);
570
- #directionality = inject(Directionality, { optional: true });
571
- #document = inject(DOCUMENT$1);
572
- #i18n = inject(MonaI18nService, { optional: true });
573
- #destroyed = false;
574
- constructor() {
575
- inject(DestroyRef).onDestroy(() => {
576
- this.#destroyed = true;
577
- for (const container of this.#containers.values()) {
578
- this.#destroyContainer(container);
579
- }
580
- this.#containers.clear();
581
- });
582
- }
583
- /**
584
- * Closes the notification with the given `id`, wherever its container is positioned. No-op if no notification with
585
- * that `id` is currently shown.
586
- */
587
- hide(id) {
588
- for (const container of this.#containers.values()) {
589
- container.notifications.get(id)?.close();
590
- }
591
- }
592
- /** Closes every currently visible notification, across all positions. */
593
- hideAll() {
594
- for (const container of [...this.#containers.values()]) {
595
- for (const notification of [...container.notifications.values()]) {
596
- notification.close();
597
- }
598
- }
599
- }
600
- /**
601
- * Creates a notification and returns a `NotificationRef`. If a notification with the same `id` already exists at
602
- * the resolved `position`, returns a ref to that existing notification instead of creating a duplicate.
603
- */
604
- show(options) {
605
- const position = options.position ?? "topright";
606
- const id = options.id ?? createElementControlId();
607
- const existing = this.#containers.get(position)?.notifications.get(id);
608
- if (existing && !existing.finished) {
609
- return existing.ref;
610
- }
611
- const duration = options.duration != null && this.#defaults.autoHide
612
- ? options.duration * this.#defaults.durationScale
613
- : undefined;
614
- const resolved = {
615
- ...options,
616
- closable: options.closable ?? true,
617
- duration,
618
- id,
619
- position,
620
- type: options.type ?? "info"
621
- };
622
- const container = this.#containers.get(position) ?? this.#createContainer(position, options.appendTo);
623
- const data = new NotificationData(resolved, finished => this.#remove(position, finished));
624
- container.notifications.set(id, data);
625
- this.#limit(container);
626
- this.#sync(container);
627
- return data.ref;
628
- }
629
- #createContainer(position, appendTo) {
630
- // Created and attached at once, so a notification hidden in the same tick never leaves a container behind.
631
- const componentRef = createComponent(NotificationContainerComponent, {
632
- environmentInjector: this.#appRef.injector
633
- });
634
- const element = componentRef.location.nativeElement;
635
- const host = appendTo ? appendTo.element.nativeElement : this.#document.body;
636
- componentRef.instance.position.set(position);
637
- componentRef.instance.positionType.set(appendTo ? "absolute" : "fixed");
638
- if (!appendTo) {
639
- // The container sits outside the app root, so it takes the app's direction and language explicitly.
640
- element.setAttribute("dir", this.#directionality?.value ?? "ltr");
641
- const lang = this.#i18n?.localeId();
642
- if (lang) {
643
- element.setAttribute("lang", lang);
644
- }
645
- }
646
- host.appendChild(element);
647
- this.#appRef.attachView(componentRef.hostView);
648
- componentRef.changeDetectorRef.detectChanges();
649
- const container = { componentRef, notifications: new Map() };
650
- this.#containers.set(position, container);
651
- return container;
652
- }
653
- #destroyContainer(container) {
654
- const { componentRef } = container;
655
- if (!componentRef.hostView.destroyed) {
656
- componentRef.destroy();
657
- }
658
- componentRef.location.nativeElement.remove();
659
- }
660
- /** Closes the oldest notifications beyond `maxVisible`. */
661
- #limit(container) {
662
- const max = this.#defaults.maxVisible;
663
- if (max == null || max < 1) {
664
- return;
665
- }
666
- const open = [...container.notifications.values()].filter(notification => !notification.closing());
667
- for (const notification of open.slice(0, Math.max(0, open.length - max))) {
668
- notification.close();
669
- }
670
- }
671
- #remove(position, data) {
672
- const container = this.#containers.get(position);
673
- if (this.#destroyed || !container || container.notifications.get(data.id) !== data) {
674
- return;
675
- }
676
- container.notifications.delete(data.id);
677
- if (container.notifications.size === 0) {
678
- this.#containers.delete(position);
679
- this.#destroyContainer(container);
680
- return;
681
- }
682
- this.#sync(container);
683
- }
684
- #sync(container) {
685
- container.componentRef.instance.notificationDataList.set([...container.notifications.values()]);
686
- }
687
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NotificationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
688
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NotificationService, providedIn: "root" }); }
689
- }
690
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NotificationService, decorators: [{
691
- type: Injectable,
692
- args: [{
693
- providedIn: "root"
694
- }]
695
- }], ctorParameters: () => [] });
696
-
697
- /**
698
- * Sets application-wide notification behavior: whether timed notifications close on their own, how much longer they
699
- * stay, how many show at once, and whether the countdown pauses while the window is in the background.
700
- */
89
+ const LEAVE_FALLBACK = 1e3;
90
+ const RETURN_FOCUS = /* @__PURE__ */ new WeakMap();
91
+ var NotificationComponent = class NotificationComponent {
92
+ #announcer;
93
+ #defaults;
94
+ #destroyRef;
95
+ #document;
96
+ #focused;
97
+ #host;
98
+ #hovered;
99
+ #i18n;
100
+ #injector;
101
+ #isUrgent;
102
+ #running;
103
+ #windowBlurred;
104
+ #closeTimer;
105
+ #progressTimer;
106
+ #remaining;
107
+ #startedAt;
108
+ constructor() {
109
+ this.#announcer = inject(LiveAnnouncer);
110
+ this.#defaults = inject(NOTIFICATION_DEFAULTS);
111
+ this.#destroyRef = inject(DestroyRef);
112
+ this.#document = inject(DOCUMENT$1);
113
+ this.#focused = signal(false, ...ngDevMode ? [{ debugName: "#focused" }] : /* istanbul ignore next */ []);
114
+ this.#host = inject(ElementRef);
115
+ this.#hovered = signal(false, ...ngDevMode ? [{ debugName: "#hovered" }] : /* istanbul ignore next */ []);
116
+ this.#i18n = inject(MonaI18nService);
117
+ this.#injector = inject(Injector);
118
+ this.#isUrgent = computed(() => this.type() === "error" || this.type() === "warning", ...ngDevMode ? [{ debugName: "#isUrgent" }] : /* istanbul ignore next */ []);
119
+ this.#running = computed(() => this.options().duration != null && !this.data().closing() && !this.#hovered() && !this.#focused() && !this.#windowBlurred(), ...ngDevMode ? [{ debugName: "#running" }] : /* istanbul ignore next */ []);
120
+ this.#windowBlurred = signal(false, ...ngDevMode ? [{ debugName: "#windowBlurred" }] : /* istanbul ignore next */ []);
121
+ this.#closeTimer = null;
122
+ this.#progressTimer = null;
123
+ this.#remaining = null;
124
+ this.#startedAt = 0;
125
+ this.actionClass = computed(() => {
126
+ return notificationActionThemeVariants();
127
+ }, ...ngDevMode ? [{ debugName: "actionClass" }] : /* istanbul ignore next */ []);
128
+ this.baseClass = computed(() => {
129
+ return notificationBaseThemeVariants();
130
+ }, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
131
+ this.bodyClass = computed(() => {
132
+ return notificationBodyThemeVariants();
133
+ }, ...ngDevMode ? [{ debugName: "bodyClass" }] : /* istanbul ignore next */ []);
134
+ this.closeTitle = computed(() => {
135
+ return this.options().closeTitle ?? this.messages().close;
136
+ }, ...ngDevMode ? [{ debugName: "closeTitle" }] : /* istanbul ignore next */ []);
137
+ this.contentClass = computed(() => {
138
+ return notificationContentThemeVariants();
139
+ }, ...ngDevMode ? [{ debugName: "contentClass" }] : /* istanbul ignore next */ []);
140
+ this.contentComponent = computed(() => {
141
+ const content = this.options().content;
142
+ return typeof content !== "string" && !(content instanceof TemplateRef) ? content : null;
143
+ }, ...ngDevMode ? [{ debugName: "contentComponent" }] : /* istanbul ignore next */ []);
144
+ this.contentHost = viewChild("contentHost", {
145
+ ...ngDevMode ? { debugName: "contentHost" } : /* istanbul ignore next */ {},
146
+ read: ViewContainerRef
147
+ });
148
+ this.contentInjector = computed(() => {
149
+ const data = this.data();
150
+ return Injector.create({
151
+ parent: this.#injector,
152
+ providers: [{
153
+ provide: NOTIFICATION_REF,
154
+ useValue: data.ref
155
+ }, {
156
+ provide: NOTIFICATION_DATA,
157
+ useValue: untracked(() => data.options().data)
158
+ }]
159
+ });
160
+ }, ...ngDevMode ? [{ debugName: "contentInjector" }] : /* istanbul ignore next */ []);
161
+ this.contentTemplate = computed(() => {
162
+ const content = this.options().content;
163
+ return content instanceof TemplateRef ? content : null;
164
+ }, ...ngDevMode ? [{ debugName: "contentTemplate" }] : /* istanbul ignore next */ []);
165
+ this.headerClass = computed(() => {
166
+ return notificationHeaderThemeVariants();
167
+ }, ...ngDevMode ? [{ debugName: "headerClass" }] : /* istanbul ignore next */ []);
168
+ this.iconClass = computed(() => {
169
+ const type = this.type();
170
+ return notificationIconThemeVariants({ type });
171
+ }, ...ngDevMode ? [{ debugName: "iconClass" }] : /* istanbul ignore next */ []);
172
+ this.messageElement = viewChild("message", ...ngDevMode ? [{ debugName: "messageElement" }] : /* istanbul ignore next */ []);
173
+ this.messages = this.#i18n.componentMessages("notification", NOTIFICATION_DEFAULT_MESSAGES);
174
+ this.options = computed(() => this.data().options(), ...ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []);
175
+ this.progressColor = computed(() => `var(--color-${this.type()})`, ...ngDevMode ? [{ debugName: "progressColor" }] : /* istanbul ignore next */ []);
176
+ this.progressValue = signal(100, ...ngDevMode ? [{ debugName: "progressValue" }] : /* istanbul ignore next */ []);
177
+ this.stringContent = computed(() => {
178
+ const content = this.options().content;
179
+ return typeof content === "string" ? content : null;
180
+ }, ...ngDevMode ? [{ debugName: "stringContent" }] : /* istanbul ignore next */ []);
181
+ this.templateContext = computed(() => ({
182
+ $implicit: this.data().ref,
183
+ data: this.options().data
184
+ }), ...ngDevMode ? [{ debugName: "templateContext" }] : /* istanbul ignore next */ []);
185
+ this.textClass = computed(() => {
186
+ return notificationTextThemeVariants();
187
+ }, ...ngDevMode ? [{ debugName: "textClass" }] : /* istanbul ignore next */ []);
188
+ this.title = computed(() => this.options().title ?? this.messages()[this.type()], ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
189
+ this.type = computed(() => this.options().type ?? "info", ...ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []);
190
+ this.data = input.required(...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
191
+ this.side = input("top", ...ngDevMode ? [{ debugName: "side" }] : /* istanbul ignore next */ []);
192
+ effect(() => {
193
+ this.data().rendered = true;
194
+ });
195
+ effect(() => {
196
+ const running = this.#running();
197
+ untracked(() => running ? this.#resume() : this.#pause());
198
+ });
199
+ effect(() => {
200
+ if (this.data().closing()) untracked(() => this.#leave());
201
+ });
202
+ afterRenderEffect({ write: () => {
203
+ const type = this.contentComponent();
204
+ const host = this.contentHost();
205
+ const injector = this.contentInjector();
206
+ untracked(() => {
207
+ host?.clear();
208
+ const componentRef = type && host ? host.createComponent(type, { injector }) : null;
209
+ componentRef?.changeDetectorRef.detectChanges();
210
+ this.data().contentComponentRef.set(componentRef);
211
+ });
212
+ } });
213
+ afterRenderEffect({ read: () => {
214
+ this.options();
215
+ untracked(() => this.#announce());
216
+ } });
217
+ this.#listenForWindowFocus();
218
+ this.#destroyRef.onDestroy(() => {
219
+ this.#stopTimers();
220
+ this.data().finish();
221
+ });
222
+ }
223
+ close() {
224
+ this.data().close();
225
+ }
226
+ onFocusIn(event) {
227
+ const host = this.#host.nativeElement;
228
+ const from = event.relatedTarget;
229
+ if (!this.#focused() && from instanceof HTMLElement && !host.contains(from)) {
230
+ const fromNotification = from.closest(host.tagName);
231
+ const target = fromNotification ? RETURN_FOCUS.get(fromNotification) : from;
232
+ if (target) RETURN_FOCUS.set(host, target);
233
+ }
234
+ this.#focused.set(true);
235
+ }
236
+ onFocusOut(event) {
237
+ const to = event.relatedTarget;
238
+ if (to instanceof Node && this.#host.nativeElement.contains(to)) return;
239
+ this.#focused.set(false);
240
+ }
241
+ onPointerChange(inside) {
242
+ this.#hovered.set(inside);
243
+ }
244
+ #announce() {
245
+ const content = this.stringContent();
246
+ const element = this.messageElement()?.nativeElement;
247
+ const message = (content != null ? `${this.title()} ${content}` : element?.innerText ?? element?.textContent)?.replace(/\s+/g, " ").trim();
248
+ if (message) this.#announcer.announce(message, this.#isUrgent() ? "assertive" : "polite");
249
+ }
250
+ #leave() {
251
+ this.#stopTimers();
252
+ this.#moveFocusAway();
253
+ afterNextRender({ read: () => {
254
+ const host = this.#host.nativeElement;
255
+ const animation = this.#document.defaultView?.getComputedStyle(host).animationName;
256
+ if (!animation || animation === "none") {
257
+ this.data().finish();
258
+ return;
259
+ }
260
+ const done = () => {
261
+ clearTimeout(fallback);
262
+ host.removeEventListener("animationend", onEnd);
263
+ this.data().finish();
264
+ };
265
+ const onEnd = (event) => {
266
+ if (event.target === host) done();
267
+ };
268
+ const fallback = setTimeout(done, LEAVE_FALLBACK);
269
+ host.addEventListener("animationend", onEnd);
270
+ } }, { injector: this.#injector });
271
+ }
272
+ #listenForWindowFocus() {
273
+ const view = this.#document.defaultView;
274
+ if (!this.#defaults.pauseOnWindowBlur || !view) return;
275
+ const blur = () => this.#windowBlurred.set(true);
276
+ const focus = () => this.#windowBlurred.set(false);
277
+ view.addEventListener("blur", blur);
278
+ view.addEventListener("focus", focus);
279
+ this.#destroyRef.onDestroy(() => {
280
+ view.removeEventListener("blur", blur);
281
+ view.removeEventListener("focus", focus);
282
+ });
283
+ }
284
+ #moveFocusAway() {
285
+ const host = this.#host.nativeElement;
286
+ const active = this.#document.activeElement;
287
+ if (!(active instanceof HTMLElement) || !host.contains(active)) return;
288
+ const siblings = Array.from(host.parentElement?.children ?? []).filter((element) => element !== host && element.tagName === host.tagName && !element.hasAttribute("data-closing"));
289
+ const isAfter = (element) => !!(host.compareDocumentPosition(element) & Node.DOCUMENT_POSITION_FOLLOWING);
290
+ const ordered = [...siblings.filter(isAfter), ...siblings.filter((element) => !isAfter(element)).reverse()];
291
+ for (const sibling of ordered) {
292
+ const target = sibling.querySelector(TABBABLE);
293
+ if (target) {
294
+ target.focus();
295
+ return;
296
+ }
297
+ }
298
+ const returnFocus = RETURN_FOCUS.get(host);
299
+ if (returnFocus?.isConnected) {
300
+ returnFocus.focus();
301
+ return;
302
+ }
303
+ active.blur();
304
+ }
305
+ #pause() {
306
+ if (this.#closeTimer == null) return;
307
+ const duration = this.options().duration ?? 0;
308
+ this.#remaining = Math.max(0, (this.#remaining ?? duration) - (performance.now() - this.#startedAt));
309
+ this.#stopTimers();
310
+ this.progressValue.set(duration > 0 ? this.#remaining / duration * 100 : 0);
311
+ }
312
+ #resume() {
313
+ const duration = this.options().duration;
314
+ if (duration == null || this.#closeTimer != null) return;
315
+ const remaining = this.#remaining ??= duration;
316
+ this.#startedAt = performance.now();
317
+ this.#closeTimer = setTimeout(() => {
318
+ this.#closeTimer = null;
319
+ this.#remaining = 0;
320
+ this.#stopTimers();
321
+ this.progressValue.set(0);
322
+ this.data().close();
323
+ }, remaining);
324
+ if (this.options().progressBar && duration > 0) {
325
+ const step = Math.min(100, Math.max(16, duration / 100));
326
+ this.#progressTimer = setInterval(() => {
327
+ const left = remaining - (performance.now() - this.#startedAt);
328
+ this.progressValue.set(Math.max(0, left / duration * 100));
329
+ }, step);
330
+ }
331
+ }
332
+ #stopTimers() {
333
+ if (this.#closeTimer != null) {
334
+ clearTimeout(this.#closeTimer);
335
+ this.#closeTimer = null;
336
+ }
337
+ if (this.#progressTimer != null) {
338
+ clearInterval(this.#progressTimer);
339
+ this.#progressTimer = null;
340
+ }
341
+ }
342
+ static {
343
+ this.ɵfac = i0.ɵɵngDeclareFactory({
344
+ minVersion: "12.0.0",
345
+ version: "22.2.6",
346
+ ngImport: i0,
347
+ type: NotificationComponent,
348
+ deps: [],
349
+ target: i0.ɵɵFactoryTarget.Component
350
+ });
351
+ }
352
+ static {
353
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
354
+ minVersion: "17.0.0",
355
+ version: "22.2.6",
356
+ type: NotificationComponent,
357
+ isStandalone: true,
358
+ selector: "mona-notification",
359
+ inputs: {
360
+ data: {
361
+ classPropertyName: "data",
362
+ publicName: "data",
363
+ isSignal: true,
364
+ isRequired: true,
365
+ transformFunction: null
366
+ },
367
+ side: {
368
+ classPropertyName: "side",
369
+ publicName: "side",
370
+ isSignal: true,
371
+ isRequired: false,
372
+ transformFunction: null
373
+ }
374
+ },
375
+ host: {
376
+ listeners: {
377
+ "focusin": "onFocusIn($event)",
378
+ "focusout": "onFocusOut($event)",
379
+ "pointerenter": "onPointerChange(true)",
380
+ "pointerleave": "onPointerChange(false)"
381
+ },
382
+ properties: {
383
+ "attr.data-closing": "data().closing() ? '' : null",
384
+ "class.notification-leave-bottom": "data().closing() && side() === 'bottom'",
385
+ "class.notification-leave-top": "data().closing() && side() !== 'bottom'"
386
+ }
387
+ },
388
+ viewQueries: [{
389
+ propertyName: "contentHost",
390
+ first: true,
391
+ predicate: ["contentHost"],
392
+ descendants: true,
393
+ read: ViewContainerRef,
394
+ isSignal: true
395
+ }, {
396
+ propertyName: "messageElement",
397
+ first: true,
398
+ predicate: ["message"],
399
+ descendants: true,
400
+ isSignal: true
401
+ }],
402
+ ngImport: i0,
403
+ template: "@let opts = options();\n@let width = typeof opts.width === \"string\" ? opts.width : `${opts.width}px`;\n@let height = typeof opts.height === \"string\" ? opts.height : `${opts.height}px`;\n\n<div [class]=\"baseClass()\" [style.width]=\"width\" [style.height]=\"height\">\n @if (contentTemplate(); as template) {\n <div #message class=\"contents\">\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"templateContext()\"\n [ngTemplateOutletInjector]=\"contentInjector()\"></ng-container>\n </div>\n } @else if (contentComponent()) {\n <div #message class=\"contents\">\n <ng-container #contentHost></ng-container>\n </div>\n } @else {\n <div #message [class]=\"bodyClass()\">\n <div [class]=\"iconClass()\" aria-hidden=\"true\">\n @switch (type()) {\n @case (\"error\") {\n <svg lucideOctagonX aria-hidden=\"true\"></svg>\n }\n @case (\"info\") {\n <svg lucideBadgeInfo aria-hidden=\"true\"></svg>\n }\n @case (\"success\") {\n <svg lucideCircleCheckBig aria-hidden=\"true\"></svg>\n }\n @case (\"warning\") {\n <svg lucideOctagonAlert aria-hidden=\"true\"></svg>\n }\n }\n </div>\n <div class=\"flex flex-col flex-1\">\n <div [class]=\"headerClass()\">{{ title() }}</div>\n <div [class]=\"contentClass()\">\n <span [class]=\"textClass()\">{{ stringContent() }}</span>\n </div>\n </div>\n </div>\n @if (opts.progressBar && opts.duration !== undefined) {\n <!-- Decorative: the time left isn't worth announcing. -->\n <div class=\"w-full h-1\" aria-hidden=\"true\">\n <mona-progress-bar\n [value]=\"progressValue()\"\n [color]=\"progressColor()\"\n [labelVisible]=\"false\"\n [animate]=\"false\"\n rounded=\"none\"\n class=\"h-full\"></mona-progress-bar>\n </div>\n }\n }\n @if (opts.closable) {\n <div [class]=\"actionClass()\">\n <button\n monaButton\n size=\"small\"\n look=\"link\"\n rounded=\"none\"\n [iconOnly]=\"true\"\n [title]=\"closeTitle()\"\n [attr.aria-label]=\"closeTitle()\"\n (click)=\"close()\">\n <svg lucideX [size]=\"14\" aria-hidden=\"true\"></svg>\n </button>\n </div>\n }\n</div>\n",
404
+ styles: [":host{display:block}@keyframes notification-slide-in-top{0%{clip-path:inset(0 -20px 100% -20px);transform:translateY(-12px);opacity:0}to{clip-path:inset(-20px);transform:translateY(0);opacity:1}}@keyframes notification-slide-out-top{0%{clip-path:inset(-20px);transform:translateY(0);opacity:1}to{clip-path:inset(0 -20px 100% -20px);transform:translateY(-12px);opacity:0}}@keyframes notification-slide-in-bottom{0%{clip-path:inset(100% -20px 0 -20px);transform:translateY(12px);opacity:0}to{clip-path:inset(-20px);transform:translateY(0);opacity:1}}@keyframes notification-slide-out-bottom{0%{clip-path:inset(-20px);transform:translateY(0);opacity:1}to{clip-path:inset(100% -20px 0 -20px);transform:translateY(12px);opacity:0}}:host.notification-enter-top{animation:notification-slide-in-top .3s cubic-bezier(.4,0,.2,1) forwards}:host.notification-enter-bottom{animation:notification-slide-in-bottom .3s cubic-bezier(.4,0,.2,1) forwards}:host.notification-leave-top{animation:notification-slide-out-top .3s cubic-bezier(.4,0,.2,1) forwards}:host.notification-leave-bottom{animation:notification-slide-out-bottom .3s cubic-bezier(.4,0,.2,1) forwards}@media(prefers-reduced-motion:reduce){:host.notification-enter-top,:host.notification-enter-bottom,:host.notification-leave-top,:host.notification-leave-bottom{animation:none}}\n"],
405
+ dependencies: [
406
+ {
407
+ kind: "directive",
408
+ type: NgTemplateOutlet,
409
+ selector: "[ngTemplateOutlet]",
410
+ inputs: [
411
+ "ngTemplateOutletContext",
412
+ "ngTemplateOutlet",
413
+ "ngTemplateOutletInjector"
414
+ ]
415
+ },
416
+ {
417
+ kind: "component",
418
+ type: ProgressBarComponent,
419
+ selector: "mona-progress-bar",
420
+ inputs: [
421
+ "animate",
422
+ "aria-label",
423
+ "aria-valuetext",
424
+ "color",
425
+ "disabled",
426
+ "indeterminate",
427
+ "labelPosition",
428
+ "labelStyles",
429
+ "labelVisible",
430
+ "max",
431
+ "min",
432
+ "rounded",
433
+ "class",
434
+ "value"
435
+ ]
436
+ },
437
+ {
438
+ kind: "directive",
439
+ type: ButtonDirective,
440
+ selector: "button[monaButton]",
441
+ inputs: [
442
+ "aria-haspopup",
443
+ "disabled",
444
+ "iconOnly",
445
+ "loading",
446
+ "look",
447
+ "rounded",
448
+ "selected",
449
+ "size",
450
+ "tabindex",
451
+ "toggleable",
452
+ "type",
453
+ "class",
454
+ "value"
455
+ ],
456
+ outputs: ["lookChange", "selectedChange"]
457
+ },
458
+ {
459
+ kind: "component",
460
+ type: LucideOctagonX,
461
+ selector: "svg[lucideOctagonX], svg[lucideXOctagon]"
462
+ },
463
+ {
464
+ kind: "component",
465
+ type: LucideBadgeInfo,
466
+ selector: "svg[lucideBadgeInfo]"
467
+ },
468
+ {
469
+ kind: "component",
470
+ type: LucideCircleCheckBig,
471
+ selector: "svg[lucideCircleCheckBig], svg[lucideCheckCircle]"
472
+ },
473
+ {
474
+ kind: "component",
475
+ type: LucideOctagonAlert,
476
+ selector: "svg[lucideOctagonExclamationPoint], svg[lucideAlertOctagon], svg[lucideOctagonAlert]"
477
+ },
478
+ {
479
+ kind: "component",
480
+ type: LucideX,
481
+ selector: "svg[lucideX]"
482
+ }
483
+ ]
484
+ });
485
+ }
486
+ };
487
+ i0.ɵɵngDeclareClassMetadata({
488
+ minVersion: "12.0.0",
489
+ version: "22.2.6",
490
+ ngImport: i0,
491
+ type: NotificationComponent,
492
+ decorators: [{
493
+ type: Component,
494
+ args: [{
495
+ selector: "mona-notification",
496
+ imports: [
497
+ NgTemplateOutlet,
498
+ ProgressBarComponent,
499
+ ButtonDirective,
500
+ LucideOctagonX,
501
+ LucideBadgeInfo,
502
+ LucideCircleCheckBig,
503
+ LucideOctagonAlert,
504
+ LucideX
505
+ ],
506
+ host: {
507
+ "[attr.data-closing]": "data().closing() ? '' : null",
508
+ "[class.notification-leave-bottom]": "data().closing() && side() === 'bottom'",
509
+ "[class.notification-leave-top]": "data().closing() && side() !== 'bottom'",
510
+ "(focusin)": "onFocusIn($event)",
511
+ "(focusout)": "onFocusOut($event)",
512
+ "(pointerenter)": "onPointerChange(true)",
513
+ "(pointerleave)": "onPointerChange(false)"
514
+ },
515
+ template: "@let opts = options();\n@let width = typeof opts.width === \"string\" ? opts.width : `${opts.width}px`;\n@let height = typeof opts.height === \"string\" ? opts.height : `${opts.height}px`;\n\n<div [class]=\"baseClass()\" [style.width]=\"width\" [style.height]=\"height\">\n @if (contentTemplate(); as template) {\n <div #message class=\"contents\">\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"templateContext()\"\n [ngTemplateOutletInjector]=\"contentInjector()\"></ng-container>\n </div>\n } @else if (contentComponent()) {\n <div #message class=\"contents\">\n <ng-container #contentHost></ng-container>\n </div>\n } @else {\n <div #message [class]=\"bodyClass()\">\n <div [class]=\"iconClass()\" aria-hidden=\"true\">\n @switch (type()) {\n @case (\"error\") {\n <svg lucideOctagonX aria-hidden=\"true\"></svg>\n }\n @case (\"info\") {\n <svg lucideBadgeInfo aria-hidden=\"true\"></svg>\n }\n @case (\"success\") {\n <svg lucideCircleCheckBig aria-hidden=\"true\"></svg>\n }\n @case (\"warning\") {\n <svg lucideOctagonAlert aria-hidden=\"true\"></svg>\n }\n }\n </div>\n <div class=\"flex flex-col flex-1\">\n <div [class]=\"headerClass()\">{{ title() }}</div>\n <div [class]=\"contentClass()\">\n <span [class]=\"textClass()\">{{ stringContent() }}</span>\n </div>\n </div>\n </div>\n @if (opts.progressBar && opts.duration !== undefined) {\n <!-- Decorative: the time left isn't worth announcing. -->\n <div class=\"w-full h-1\" aria-hidden=\"true\">\n <mona-progress-bar\n [value]=\"progressValue()\"\n [color]=\"progressColor()\"\n [labelVisible]=\"false\"\n [animate]=\"false\"\n rounded=\"none\"\n class=\"h-full\"></mona-progress-bar>\n </div>\n }\n }\n @if (opts.closable) {\n <div [class]=\"actionClass()\">\n <button\n monaButton\n size=\"small\"\n look=\"link\"\n rounded=\"none\"\n [iconOnly]=\"true\"\n [title]=\"closeTitle()\"\n [attr.aria-label]=\"closeTitle()\"\n (click)=\"close()\">\n <svg lucideX [size]=\"14\" aria-hidden=\"true\"></svg>\n </button>\n </div>\n }\n</div>\n",
516
+ styles: [":host{display:block}@keyframes notification-slide-in-top{0%{clip-path:inset(0 -20px 100% -20px);transform:translateY(-12px);opacity:0}to{clip-path:inset(-20px);transform:translateY(0);opacity:1}}@keyframes notification-slide-out-top{0%{clip-path:inset(-20px);transform:translateY(0);opacity:1}to{clip-path:inset(0 -20px 100% -20px);transform:translateY(-12px);opacity:0}}@keyframes notification-slide-in-bottom{0%{clip-path:inset(100% -20px 0 -20px);transform:translateY(12px);opacity:0}to{clip-path:inset(-20px);transform:translateY(0);opacity:1}}@keyframes notification-slide-out-bottom{0%{clip-path:inset(-20px);transform:translateY(0);opacity:1}to{clip-path:inset(100% -20px 0 -20px);transform:translateY(12px);opacity:0}}:host.notification-enter-top{animation:notification-slide-in-top .3s cubic-bezier(.4,0,.2,1) forwards}:host.notification-enter-bottom{animation:notification-slide-in-bottom .3s cubic-bezier(.4,0,.2,1) forwards}:host.notification-leave-top{animation:notification-slide-out-top .3s cubic-bezier(.4,0,.2,1) forwards}:host.notification-leave-bottom{animation:notification-slide-out-bottom .3s cubic-bezier(.4,0,.2,1) forwards}@media(prefers-reduced-motion:reduce){:host.notification-enter-top,:host.notification-enter-bottom,:host.notification-leave-top,:host.notification-leave-bottom{animation:none}}\n"]
517
+ }]
518
+ }],
519
+ ctorParameters: () => [],
520
+ propDecorators: {
521
+ contentHost: [{
522
+ type: i0.ViewChild,
523
+ args: ["contentHost", {
524
+ read: ViewContainerRef,
525
+ isSignal: true
526
+ }]
527
+ }],
528
+ messageElement: [{
529
+ type: i0.ViewChild,
530
+ args: ["message", { isSignal: true }]
531
+ }],
532
+ data: [{
533
+ type: i0.Input,
534
+ args: [{
535
+ isSignal: true,
536
+ alias: "data",
537
+ required: true
538
+ }]
539
+ }],
540
+ side: [{
541
+ type: i0.Input,
542
+ args: [{
543
+ isSignal: true,
544
+ alias: "side",
545
+ required: false
546
+ }]
547
+ }]
548
+ }
549
+ });
550
+ var NotificationContainerComponent = class NotificationContainerComponent {
551
+ constructor() {
552
+ this.#i18n = inject(MonaI18nService);
553
+ this.baseClass = computed(() => {
554
+ const position = this.position();
555
+ const positionType = this.positionType();
556
+ return notificationContainerBaseThemeVariants({
557
+ position,
558
+ positionType
559
+ });
560
+ }, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
561
+ this.enterAnimClass = computed(() => this.side() === "bottom" ? "notification-enter-bottom" : "notification-enter-top", ...ngDevMode ? [{ debugName: "enterAnimClass" }] : /* istanbul ignore next */ []);
562
+ this.messages = this.#i18n.componentMessages("notification", NOTIFICATION_DEFAULT_MESSAGES);
563
+ this.side = computed(() => this.position().startsWith("bottom") ? "bottom" : "top", ...ngDevMode ? [{ debugName: "side" }] : /* istanbul ignore next */ []);
564
+ this.notificationDataList = signal([], ...ngDevMode ? [{ debugName: "notificationDataList" }] : /* istanbul ignore next */ []);
565
+ this.position = signal("topright", ...ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []);
566
+ this.positionType = signal("fixed", ...ngDevMode ? [{ debugName: "positionType" }] : /* istanbul ignore next */ []);
567
+ }
568
+ #i18n;
569
+ static {
570
+ this.ɵfac = i0.ɵɵngDeclareFactory({
571
+ minVersion: "12.0.0",
572
+ version: "22.2.6",
573
+ ngImport: i0,
574
+ type: NotificationContainerComponent,
575
+ deps: [],
576
+ target: i0.ɵɵFactoryTarget.Component
577
+ });
578
+ }
579
+ static {
580
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
581
+ minVersion: "17.0.0",
582
+ version: "22.2.6",
583
+ type: NotificationContainerComponent,
584
+ isStandalone: true,
585
+ selector: "mona-notification-container",
586
+ host: {
587
+ attributes: { "role": "region" },
588
+ properties: {
589
+ "attr.aria-label": "messages().region",
590
+ "class": "baseClass()"
591
+ }
592
+ },
593
+ ngImport: i0,
594
+ template: "@for (notificationData of notificationDataList(); track notificationData) {\n <mona-notification [data]=\"notificationData\" [side]=\"side()\" [animate.enter]=\"enterAnimClass()\"></mona-notification>\n}\n",
595
+ dependencies: [{
596
+ kind: "component",
597
+ type: NotificationComponent,
598
+ selector: "mona-notification",
599
+ inputs: ["data", "side"]
600
+ }]
601
+ });
602
+ }
603
+ };
604
+ i0.ɵɵngDeclareClassMetadata({
605
+ minVersion: "12.0.0",
606
+ version: "22.2.6",
607
+ ngImport: i0,
608
+ type: NotificationContainerComponent,
609
+ decorators: [{
610
+ type: Component,
611
+ args: [{
612
+ selector: "mona-notification-container",
613
+ imports: [NotificationComponent],
614
+ host: {
615
+ "[attr.aria-label]": "messages().region",
616
+ "[class]": "baseClass()",
617
+ role: "region"
618
+ },
619
+ template: "@for (notificationData of notificationDataList(); track notificationData) {\n <mona-notification [data]=\"notificationData\" [side]=\"side()\" [animate.enter]=\"enterAnimClass()\"></mona-notification>\n}\n"
620
+ }]
621
+ }]
622
+ });
623
+ var NotificationData = class {
624
+ #afterHide$;
625
+ #onFinish;
626
+ #finished;
627
+ constructor(options, onFinish = () => void 0) {
628
+ this.#afterHide$ = new Subject();
629
+ this.#finished = false;
630
+ this.closing = signal(false, ...ngDevMode ? [{ debugName: "closing" }] : /* istanbul ignore next */ []);
631
+ this.contentComponentRef = signal(null, ...ngDevMode ? [{ debugName: "contentComponentRef" }] : /* istanbul ignore next */ []);
632
+ this.rendered = false;
633
+ this.#onFinish = onFinish;
634
+ this.options = signal(options, ...ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []);
635
+ const contentComponentRef = this.contentComponentRef;
636
+ this.ref = {
637
+ afterHide: this.#afterHide$.asObservable(),
638
+ get content() {
639
+ return contentComponentRef();
640
+ },
641
+ hide: () => this.close(),
642
+ id: options.id,
643
+ update: (changes) => {
644
+ if (!this.#finished) this.options.update((current) => ({
645
+ ...current,
646
+ ...changes
647
+ }));
648
+ }
649
+ };
650
+ }
651
+ get finished() {
652
+ return this.#finished;
653
+ }
654
+ get id() {
655
+ return this.options().id;
656
+ }
657
+ close() {
658
+ if (this.#finished || this.closing()) return;
659
+ if (!this.rendered) {
660
+ this.finish();
661
+ return;
662
+ }
663
+ this.closing.set(true);
664
+ }
665
+ finish() {
666
+ if (this.#finished) return;
667
+ this.#finished = true;
668
+ this.closing.set(true);
669
+ this.#onFinish(this);
670
+ this.#afterHide$.next();
671
+ this.#afterHide$.complete();
672
+ }
673
+ };
674
+ var NotificationService = class NotificationService {
675
+ #appRef = inject(ApplicationRef);
676
+ #containers = /* @__PURE__ */ new Map();
677
+ #defaults = inject(NOTIFICATION_DEFAULTS);
678
+ #directionality = inject(Directionality, { optional: true });
679
+ #document = inject(DOCUMENT);
680
+ #i18n = inject(MonaI18nService, { optional: true });
681
+ #destroyed = false;
682
+ constructor() {
683
+ inject(DestroyRef).onDestroy(() => {
684
+ this.#destroyed = true;
685
+ for (const container of this.#containers.values()) this.#destroyContainer(container);
686
+ this.#containers.clear();
687
+ });
688
+ }
689
+ hide(id) {
690
+ for (const container of this.#containers.values()) container.notifications.get(id)?.close();
691
+ }
692
+ hideAll() {
693
+ for (const container of [...this.#containers.values()]) for (const notification of [...container.notifications.values()]) notification.close();
694
+ }
695
+ show(options) {
696
+ const position = options.position ?? "topright";
697
+ const id = options.id ?? createElementControlId();
698
+ const existing = this.#containers.get(position)?.notifications.get(id);
699
+ if (existing && !existing.finished) return existing.ref;
700
+ const duration = options.duration != null && this.#defaults.autoHide ? options.duration * this.#defaults.durationScale : void 0;
701
+ const resolved = {
702
+ ...options,
703
+ closable: options.closable ?? true,
704
+ duration,
705
+ id,
706
+ position,
707
+ type: options.type ?? "info"
708
+ };
709
+ const container = this.#containers.get(position) ?? this.#createContainer(position, options.appendTo);
710
+ const data = new NotificationData(resolved, (finished) => this.#remove(position, finished));
711
+ container.notifications.set(id, data);
712
+ this.#limit(container);
713
+ this.#sync(container);
714
+ return data.ref;
715
+ }
716
+ #createContainer(position, appendTo) {
717
+ const componentRef = createComponent(NotificationContainerComponent, { environmentInjector: this.#appRef.injector });
718
+ const element = componentRef.location.nativeElement;
719
+ const host = appendTo ? appendTo.element.nativeElement : this.#document.body;
720
+ componentRef.instance.position.set(position);
721
+ componentRef.instance.positionType.set(appendTo ? "absolute" : "fixed");
722
+ if (!appendTo) {
723
+ element.setAttribute("dir", this.#directionality?.value ?? "ltr");
724
+ const lang = this.#i18n?.localeId();
725
+ if (lang) element.setAttribute("lang", lang);
726
+ }
727
+ host.appendChild(element);
728
+ this.#appRef.attachView(componentRef.hostView);
729
+ componentRef.changeDetectorRef.detectChanges();
730
+ const container = {
731
+ componentRef,
732
+ notifications: /* @__PURE__ */ new Map()
733
+ };
734
+ this.#containers.set(position, container);
735
+ return container;
736
+ }
737
+ #destroyContainer(container) {
738
+ const { componentRef } = container;
739
+ if (!componentRef.hostView.destroyed) componentRef.destroy();
740
+ componentRef.location.nativeElement.remove();
741
+ }
742
+ #limit(container) {
743
+ const max = this.#defaults.maxVisible;
744
+ if (max == null || max < 1) return;
745
+ const open = [...container.notifications.values()].filter((notification) => !notification.closing());
746
+ for (const notification of open.slice(0, Math.max(0, open.length - max))) notification.close();
747
+ }
748
+ #remove(position, data) {
749
+ const container = this.#containers.get(position);
750
+ if (this.#destroyed || !container || container.notifications.get(data.id) !== data) return;
751
+ container.notifications.delete(data.id);
752
+ if (container.notifications.size === 0) {
753
+ this.#containers.delete(position);
754
+ this.#destroyContainer(container);
755
+ return;
756
+ }
757
+ this.#sync(container);
758
+ }
759
+ #sync(container) {
760
+ container.componentRef.instance.notificationDataList.set([...container.notifications.values()]);
761
+ }
762
+ static {
763
+ this.ɵfac = i0.ɵɵngDeclareFactory({
764
+ minVersion: "12.0.0",
765
+ version: "22.2.6",
766
+ ngImport: i0,
767
+ type: NotificationService,
768
+ deps: [],
769
+ target: i0.ɵɵFactoryTarget.Injectable
770
+ });
771
+ }
772
+ static {
773
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
774
+ minVersion: "12.0.0",
775
+ version: "22.2.6",
776
+ ngImport: i0,
777
+ type: NotificationService,
778
+ providedIn: "root"
779
+ });
780
+ }
781
+ };
782
+ i0.ɵɵngDeclareClassMetadata({
783
+ minVersion: "12.0.0",
784
+ version: "22.2.6",
785
+ ngImport: i0,
786
+ type: NotificationService,
787
+ decorators: [{
788
+ type: Injectable,
789
+ args: [{ providedIn: "root" }]
790
+ }],
791
+ ctorParameters: () => []
792
+ });
701
793
  function provideNotificationDefaults(defaults) {
702
- return makeEnvironmentProviders([
703
- { provide: NOTIFICATION_DEFAULTS, useValue: { ...DEFAULT_NOTIFICATION_DEFAULTS, ...defaults } }
704
- ]);
794
+ return makeEnvironmentProviders([{
795
+ provide: NOTIFICATION_DEFAULTS,
796
+ useValue: {
797
+ ...DEFAULT_NOTIFICATION_DEFAULTS,
798
+ ...defaults
799
+ }
800
+ }]);
705
801
  }
706
-
707
- /*
708
- * Public API Surface of @nanahoshi/mona-ui/notification
709
- */
710
-
711
- /**
712
- * Generated bundle index. Do not edit.
713
- */
714
-
715
802
  export { NOTIFICATION_DATA, NOTIFICATION_DEFAULTS, NOTIFICATION_DEFAULT_MESSAGES, NOTIFICATION_REF, NotificationService, provideNotificationDefaults };
716
- //# sourceMappingURL=nanahoshi-mona-ui-notification.mjs.map
803
+
804
+ //# sourceMappingURL=nanahoshi-mona-ui-notification.mjs.map