@ojiepermana/angular 22.1.13 → 22.2.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 (252) hide show
  1. package/README.md +8 -6
  2. package/SUPPORT.md +3 -3
  3. package/chart/README.md +1 -1
  4. package/component/README.md +2 -2
  5. package/component/calendar/README.md +3 -15
  6. package/component/drawer/README.md +1 -2
  7. package/fesm2022/ojiepermana-angular-chart-area.mjs +352 -137
  8. package/fesm2022/ojiepermana-angular-chart-bar.mjs +744 -524
  9. package/fesm2022/ojiepermana-angular-chart-core.mjs +1140 -1344
  10. package/fesm2022/ojiepermana-angular-chart-line.mjs +393 -147
  11. package/fesm2022/ojiepermana-angular-chart-pie.mjs +408 -179
  12. package/fesm2022/ojiepermana-angular-chart-primitives.mjs +1262 -920
  13. package/fesm2022/ojiepermana-angular-chart-radar.mjs +473 -205
  14. package/fesm2022/ojiepermana-angular-chart-radial.mjs +425 -182
  15. package/fesm2022/ojiepermana-angular-chart-scatter.mjs +386 -210
  16. package/fesm2022/ojiepermana-angular-chart.mjs +3 -19
  17. package/fesm2022/ojiepermana-angular-component-accordion.mjs +485 -243
  18. package/fesm2022/ojiepermana-angular-component-alert-dialog.mjs +963 -325
  19. package/fesm2022/ojiepermana-angular-component-alert.mjs +266 -103
  20. package/fesm2022/ojiepermana-angular-component-aspect-ratio.mjs +80 -35
  21. package/fesm2022/ojiepermana-angular-component-avatar.mjs +402 -135
  22. package/fesm2022/ojiepermana-angular-component-badge.mjs +109 -59
  23. package/fesm2022/ojiepermana-angular-component-breadcrumb.mjs +410 -142
  24. package/fesm2022/ojiepermana-angular-component-button-group.mjs +249 -96
  25. package/fesm2022/ojiepermana-angular-component-button.mjs +153 -75
  26. package/fesm2022/ojiepermana-angular-component-calendar.mjs +531 -418
  27. package/fesm2022/ojiepermana-angular-component-card.mjs +457 -171
  28. package/fesm2022/ojiepermana-angular-component-carousel.mjs +642 -272
  29. package/fesm2022/ojiepermana-angular-component-checkbox.mjs +312 -108
  30. package/fesm2022/ojiepermana-angular-component-collapsible.mjs +299 -115
  31. package/fesm2022/ojiepermana-angular-component-combobox.mjs +396 -183
  32. package/fesm2022/ojiepermana-angular-component-command.mjs +807 -347
  33. package/fesm2022/ojiepermana-angular-component-composer.mjs +807 -330
  34. package/fesm2022/ojiepermana-angular-component-context-menu.mjs +196 -161
  35. package/fesm2022/ojiepermana-angular-component-date-picker.mjs +650 -338
  36. package/fesm2022/ojiepermana-angular-component-dialog.mjs +710 -316
  37. package/fesm2022/ojiepermana-angular-component-drawer.mjs +2 -5
  38. package/fesm2022/ojiepermana-angular-component-dropdown-menu.mjs +1212 -646
  39. package/fesm2022/ojiepermana-angular-component-editor.mjs +987 -502
  40. package/fesm2022/ojiepermana-angular-component-empty.mjs +350 -137
  41. package/fesm2022/ojiepermana-angular-component-form.mjs +813 -434
  42. package/fesm2022/ojiepermana-angular-component-hover-card.mjs +486 -277
  43. package/fesm2022/ojiepermana-angular-component-icon.mjs +241 -140
  44. package/fesm2022/ojiepermana-angular-component-input-group.mjs +449 -176
  45. package/fesm2022/ojiepermana-angular-component-input-otp.mjs +891 -488
  46. package/fesm2022/ojiepermana-angular-component-input.mjs +86 -55
  47. package/fesm2022/ojiepermana-angular-component-item.mjs +713 -261
  48. package/fesm2022/ojiepermana-angular-component-kanban.mjs +714 -216
  49. package/fesm2022/ojiepermana-angular-component-kbd.mjs +124 -52
  50. package/fesm2022/ojiepermana-angular-component-label.mjs +82 -31
  51. package/fesm2022/ojiepermana-angular-component-menubar.mjs +479 -329
  52. package/fesm2022/ojiepermana-angular-component-native-select.mjs +167 -65
  53. package/fesm2022/ojiepermana-angular-component-navigation-menu.mjs +683 -380
  54. package/fesm2022/ojiepermana-angular-component-pagination.mjs +277 -94
  55. package/fesm2022/ojiepermana-angular-component-pillbox.mjs +1283 -607
  56. package/fesm2022/ojiepermana-angular-component-popover.mjs +291 -204
  57. package/fesm2022/ojiepermana-angular-component-progress.mjs +176 -53
  58. package/fesm2022/ojiepermana-angular-component-radio.mjs +449 -142
  59. package/fesm2022/ojiepermana-angular-component-resizable.mjs +659 -453
  60. package/fesm2022/ojiepermana-angular-component-scroll-area.mjs +117 -39
  61. package/fesm2022/ojiepermana-angular-component-segmented-control.mjs +351 -172
  62. package/fesm2022/ojiepermana-angular-component-select.mjs +475 -345
  63. package/fesm2022/ojiepermana-angular-component-separator.mjs +102 -35
  64. package/fesm2022/ojiepermana-angular-component-sheet.mjs +797 -347
  65. package/fesm2022/ojiepermana-angular-component-skeleton.mjs +62 -29
  66. package/fesm2022/ojiepermana-angular-component-slider.mjs +592 -376
  67. package/fesm2022/ojiepermana-angular-component-spinner.mjs +135 -38
  68. package/fesm2022/ojiepermana-angular-component-switch.mjs +315 -103
  69. package/fesm2022/ojiepermana-angular-component-table.mjs +440 -153
  70. package/fesm2022/ojiepermana-angular-component-tabs.mjs +590 -317
  71. package/fesm2022/ojiepermana-angular-component-textarea.mjs +85 -50
  72. package/fesm2022/ojiepermana-angular-component-timeline.mjs +609 -231
  73. package/fesm2022/ojiepermana-angular-component-toast.mjs +229 -243
  74. package/fesm2022/ojiepermana-angular-component-toggle-group.mjs +573 -288
  75. package/fesm2022/ojiepermana-angular-component-toggle.mjs +187 -78
  76. package/fesm2022/ojiepermana-angular-component-tooltip.mjs +798 -517
  77. package/fesm2022/ojiepermana-angular-component-utils-core.mjs +159 -292
  78. package/fesm2022/ojiepermana-angular-component-utils-overlay.mjs +46 -58
  79. package/fesm2022/ojiepermana-angular-component-utils-scale.mjs +76 -38
  80. package/fesm2022/ojiepermana-angular-component-utils.mjs +2 -8
  81. package/fesm2022/ojiepermana-angular-component.mjs +0 -10
  82. package/fesm2022/ojiepermana-angular-navigation-core.mjs +13 -23
  83. package/fesm2022/ojiepermana-angular-navigation-icon.mjs +35 -24
  84. package/fesm2022/ojiepermana-angular-navigation-navigation-badge-count.component-BKCeWzml.mjs +129 -0
  85. package/fesm2022/ojiepermana-angular-navigation-navigation-dockbar-menu.component-DFEJK2jD.mjs +811 -0
  86. package/fesm2022/{ojiepermana-angular-navigation-navigation-entry-grid.component-Cd-jh6tg.mjs → ojiepermana-angular-navigation-navigation-entry-grid.component-mpK9Ar08.mjs} +387 -183
  87. package/fesm2022/ojiepermana-angular-navigation-navigation-flyout-menu.component-BPgH7FJk.mjs +650 -0
  88. package/fesm2022/ojiepermana-angular-navigation-navigation-horizontal.component-DMpYcD9t.mjs +662 -0
  89. package/fesm2022/ojiepermana-angular-navigation-navigation-item.component-Basp5SIk.mjs +1228 -0
  90. package/fesm2022/ojiepermana-angular-navigation-navigation-list.component-YUzHI9Pj.mjs +311 -0
  91. package/fesm2022/ojiepermana-angular-navigation-service.mjs +542 -724
  92. package/fesm2022/ojiepermana-angular-navigation-types.mjs +27 -56
  93. package/fesm2022/ojiepermana-angular-navigation.mjs +3052 -4
  94. package/fesm2022/ojiepermana-angular-sdk.mjs +91 -201
  95. package/fesm2022/ojiepermana-angular-theme-component-settings.mjs +1115 -737
  96. package/fesm2022/ojiepermana-angular-theme-layout-services.mjs +245 -328
  97. package/fesm2022/ojiepermana-angular-theme-layout-types.mjs +35 -38
  98. package/fesm2022/ojiepermana-angular-theme-layout-wrapper.mjs +1719 -552
  99. package/fesm2022/ojiepermana-angular-theme-layout.mjs +847 -491
  100. package/fesm2022/ojiepermana-angular-theme-page-core.mjs +288 -358
  101. package/fesm2022/ojiepermana-angular-theme-page-filter.mjs +362 -224
  102. package/fesm2022/ojiepermana-angular-theme-page-overview.mjs +88 -0
  103. package/fesm2022/ojiepermana-angular-theme-page-root.mjs +576 -254
  104. package/fesm2022/ojiepermana-angular-theme-page-side.mjs +317 -177
  105. package/fesm2022/ojiepermana-angular-theme-page-slots.mjs +256 -112
  106. package/fesm2022/ojiepermana-angular-theme-page.mjs +7 -12
  107. package/fesm2022/ojiepermana-angular-theme-shell-services.mjs +215 -326
  108. package/fesm2022/ojiepermana-angular-theme-shell-types.mjs +68 -129
  109. package/fesm2022/ojiepermana-angular-theme-shell.mjs +907 -378
  110. package/fesm2022/ojiepermana-angular-theme-styles.mjs +521 -720
  111. package/fesm2022/ojiepermana-angular-theme.mjs +0 -10
  112. package/fesm2022/ojiepermana-angular.mjs +5 -24
  113. package/navigation/README.md +1 -1
  114. package/package.json +16 -12
  115. package/sdk/README.md +1 -1
  116. package/sdk/src/writer/index.js +2 -2
  117. package/theme/README.md +1 -1
  118. package/theme/layout/README.md +2 -4
  119. package/theme/page/README.md +50 -0
  120. package/theme/styles/README.md +10 -10
  121. package/theme/styles/css/base/prefers-dark.css +1 -1
  122. package/theme/styles/css/base/status.css +1 -1
  123. package/theme/styles/css/color/amber.css +1 -1
  124. package/theme/styles/css/color/blue.css +1 -1
  125. package/theme/styles/css/color/cyan.css +1 -1
  126. package/theme/styles/css/color/emerald.css +1 -1
  127. package/theme/styles/css/color/fuchsia.css +1 -1
  128. package/theme/styles/css/color/green.css +1 -1
  129. package/theme/styles/css/color/indigo.css +1 -1
  130. package/theme/styles/css/color/lime.css +1 -1
  131. package/theme/styles/css/color/orange.css +1 -1
  132. package/theme/styles/css/color/pink.css +1 -1
  133. package/theme/styles/css/color/purple.css +1 -1
  134. package/theme/styles/css/color/red.css +1 -1
  135. package/theme/styles/css/color/rose.css +1 -1
  136. package/theme/styles/css/color/sky.css +1 -1
  137. package/theme/styles/css/color/teal.css +1 -1
  138. package/theme/styles/css/color/violet.css +1 -1
  139. package/theme/styles/css/color/yellow.css +1 -1
  140. package/theme/styles/css/neutral/gray.css +1 -1
  141. package/theme/styles/css/neutral/mauve.css +1 -1
  142. package/theme/styles/css/neutral/mist.css +1 -1
  143. package/theme/styles/css/neutral/neutral.css +1 -1
  144. package/theme/styles/css/neutral/olive.css +1 -1
  145. package/theme/styles/css/neutral/slate.css +1 -1
  146. package/theme/styles/css/neutral/stone.css +1 -1
  147. package/theme/styles/css/neutral/taupe.css +1 -1
  148. package/theme/styles/css/neutral/zinc.css +1 -1
  149. package/types/ojiepermana-angular-chart-area.d.ts +126 -63
  150. package/types/ojiepermana-angular-chart-bar.d.ts +244 -154
  151. package/types/ojiepermana-angular-chart-core.d.ts +409 -398
  152. package/types/ojiepermana-angular-chart-line.d.ts +141 -68
  153. package/types/ojiepermana-angular-chart-pie.d.ts +192 -121
  154. package/types/ojiepermana-angular-chart-primitives.d.ts +283 -214
  155. package/types/ojiepermana-angular-chart-radar.d.ts +189 -108
  156. package/types/ojiepermana-angular-chart-radial.d.ts +177 -106
  157. package/types/ojiepermana-angular-chart-scatter.d.ts +166 -110
  158. package/types/ojiepermana-angular-chart.d.ts +3 -2
  159. package/types/ojiepermana-angular-component-accordion.d.ts +135 -81
  160. package/types/ojiepermana-angular-component-alert-dialog.d.ts +271 -123
  161. package/types/ojiepermana-angular-component-alert.d.ts +69 -39
  162. package/types/ojiepermana-angular-component-aspect-ratio.d.ts +20 -12
  163. package/types/ojiepermana-angular-component-avatar.d.ts +103 -49
  164. package/types/ojiepermana-angular-component-badge.d.ts +36 -24
  165. package/types/ojiepermana-angular-component-breadcrumb.d.ts +79 -40
  166. package/types/ojiepermana-angular-component-button-group.d.ts +48 -24
  167. package/types/ojiepermana-angular-component-button.d.ts +44 -27
  168. package/types/ojiepermana-angular-component-calendar.d.ts +145 -107
  169. package/types/ojiepermana-angular-component-card.d.ts +112 -63
  170. package/types/ojiepermana-angular-component-carousel.d.ts +150 -81
  171. package/types/ojiepermana-angular-component-checkbox.d.ts +96 -38
  172. package/types/ojiepermana-angular-component-collapsible.d.ts +65 -39
  173. package/types/ojiepermana-angular-component-combobox.d.ts +100 -55
  174. package/types/ojiepermana-angular-component-command.d.ts +206 -121
  175. package/types/ojiepermana-angular-component-composer.d.ts +184 -84
  176. package/types/ojiepermana-angular-component-context-menu.d.ts +51 -41
  177. package/types/ojiepermana-angular-component-date-picker.d.ts +199 -109
  178. package/types/ojiepermana-angular-component-dialog.d.ts +200 -105
  179. package/types/ojiepermana-angular-component-drawer.d.ts +2 -1
  180. package/types/ojiepermana-angular-component-dropdown-menu.d.ts +324 -202
  181. package/types/ojiepermana-angular-component-editor.d.ts +215 -117
  182. package/types/ojiepermana-angular-component-empty.d.ts +80 -45
  183. package/types/ojiepermana-angular-component-form.d.ts +185 -121
  184. package/types/ojiepermana-angular-component-hover-card.d.ts +130 -72
  185. package/types/ojiepermana-angular-component-icon.d.ts +87 -57
  186. package/types/ojiepermana-angular-component-input-group.d.ts +93 -46
  187. package/types/ojiepermana-angular-component-input-otp.d.ts +243 -150
  188. package/types/ojiepermana-angular-component-input.d.ts +27 -17
  189. package/types/ojiepermana-angular-component-item.d.ts +160 -84
  190. package/types/ojiepermana-angular-component-kanban.d.ts +157 -62
  191. package/types/ojiepermana-angular-component-kbd.d.ts +24 -15
  192. package/types/ojiepermana-angular-component-label.d.ts +19 -11
  193. package/types/ojiepermana-angular-component-menubar.d.ts +120 -90
  194. package/types/ojiepermana-angular-component-native-select.d.ts +37 -24
  195. package/types/ojiepermana-angular-component-navigation-menu.d.ts +157 -98
  196. package/types/ojiepermana-angular-component-pagination.d.ts +78 -28
  197. package/types/ojiepermana-angular-component-pillbox.d.ts +361 -204
  198. package/types/ojiepermana-angular-component-popover.d.ts +94 -64
  199. package/types/ojiepermana-angular-component-progress.d.ts +45 -17
  200. package/types/ojiepermana-angular-component-radio.d.ts +129 -53
  201. package/types/ojiepermana-angular-component-resizable.d.ts +160 -112
  202. package/types/ojiepermana-angular-component-scroll-area.d.ts +33 -15
  203. package/types/ojiepermana-angular-component-segmented-control.d.ts +94 -50
  204. package/types/ojiepermana-angular-component-select.d.ts +94 -77
  205. package/types/ojiepermana-angular-component-separator.d.ts +26 -14
  206. package/types/ojiepermana-angular-component-sheet.d.ts +226 -116
  207. package/types/ojiepermana-angular-component-skeleton.d.ts +13 -10
  208. package/types/ojiepermana-angular-component-slider.d.ts +140 -75
  209. package/types/ojiepermana-angular-component-spinner.d.ts +31 -13
  210. package/types/ojiepermana-angular-component-switch.d.ts +97 -40
  211. package/types/ojiepermana-angular-component-table.d.ts +102 -50
  212. package/types/ojiepermana-angular-component-tabs.d.ts +174 -115
  213. package/types/ojiepermana-angular-component-textarea.d.ts +27 -17
  214. package/types/ojiepermana-angular-component-timeline.d.ts +141 -59
  215. package/types/ojiepermana-angular-component-toast.d.ts +51 -55
  216. package/types/ojiepermana-angular-component-toggle-group.d.ts +159 -88
  217. package/types/ojiepermana-angular-component-toggle.d.ts +47 -25
  218. package/types/ojiepermana-angular-component-tooltip.d.ts +222 -132
  219. package/types/ojiepermana-angular-component-utils-core.d.ts +81 -90
  220. package/types/ojiepermana-angular-component-utils-overlay.d.ts +7 -11
  221. package/types/ojiepermana-angular-component-utils-scale.d.ts +20 -12
  222. package/types/ojiepermana-angular-component-utils.d.ts +2 -2
  223. package/types/ojiepermana-angular-component.d.ts +1 -2
  224. package/types/ojiepermana-angular-navigation-core.d.ts +46 -50
  225. package/types/ojiepermana-angular-navigation-icon.d.ts +9 -12
  226. package/types/ojiepermana-angular-navigation-service.d.ts +112 -115
  227. package/types/ojiepermana-angular-navigation-types.d.ts +121 -125
  228. package/types/ojiepermana-angular-navigation.d.ts +663 -374
  229. package/types/ojiepermana-angular-sdk.d.ts +69 -71
  230. package/types/ojiepermana-angular-theme-component-settings.d.ts +115 -83
  231. package/types/ojiepermana-angular-theme-layout-services.d.ts +119 -124
  232. package/types/ojiepermana-angular-theme-layout-types.d.ts +27 -31
  233. package/types/ojiepermana-angular-theme-layout-wrapper.d.ts +399 -187
  234. package/types/ojiepermana-angular-theme-layout.d.ts +201 -112
  235. package/types/ojiepermana-angular-theme-page-core.d.ts +136 -142
  236. package/types/ojiepermana-angular-theme-page-filter.d.ts +112 -62
  237. package/types/ojiepermana-angular-theme-page-overview.d.ts +28 -0
  238. package/types/ojiepermana-angular-theme-page-root.d.ts +172 -88
  239. package/types/ojiepermana-angular-theme-page-side.d.ts +89 -49
  240. package/types/ojiepermana-angular-theme-page-slots.d.ts +58 -37
  241. package/types/ojiepermana-angular-theme-page.d.ts +7 -5
  242. package/types/ojiepermana-angular-theme-shell-services.d.ts +119 -125
  243. package/types/ojiepermana-angular-theme-shell-types.d.ts +38 -41
  244. package/types/ojiepermana-angular-theme-shell.d.ts +139 -61
  245. package/types/ojiepermana-angular-theme-styles.d.ts +184 -196
  246. package/types/ojiepermana-angular-theme.d.ts +1 -2
  247. package/types/ojiepermana-angular.d.ts +5 -5
  248. package/fesm2022/ojiepermana-angular-navigation-navigation-badge-count.component-CDBxQ8rk.mjs +0 -91
  249. package/fesm2022/ojiepermana-angular-navigation-navigation-dockbar-menu.component-DBQHdvGa.mjs +0 -512
  250. package/fesm2022/ojiepermana-angular-navigation-navigation-flyout-menu.component-BCGvhoYj.mjs +0 -404
  251. package/fesm2022/ojiepermana-angular-navigation-navigation-horizontal.component-Dk_03e-6.mjs +0 -466
  252. package/fesm2022/ojiepermana-angular-navigation-ojiepermana-angular-navigation-DNKU6viC.mjs +0 -2642
@@ -1,245 +1,231 @@
1
- import { DOCUMENT } from '@angular/common';
2
- import * as i0 from '@angular/core';
3
- import { inject, DestroyRef, Service } from '@angular/core';
4
-
5
- const DEFAULT_TOAST_DURATION_MS = 5000;
1
+ import { DOCUMENT } from "@angular/common";
2
+ import * as i0 from "@angular/core";
3
+ import { DestroyRef, Service, inject } from "@angular/core";
4
+ const DEFAULT_TOAST_DURATION_MS = 5e3;
6
5
  const VARIANT_CLASSES = {
7
- default: 'border-border bg-background text-foreground',
8
- destructive: 'border-destructive/50 bg-destructive text-destructive-foreground',
9
- success: 'border-success/50 bg-success text-success-foreground',
10
- info: 'border-info/50 bg-info text-info-foreground',
11
- warning: 'border-warning/50 bg-warning text-warning-foreground',
6
+ default: "border-border bg-background text-foreground",
7
+ destructive: "border-destructive/50 bg-destructive text-destructive-foreground",
8
+ success: "border-success/50 bg-success text-success-foreground",
9
+ info: "border-info/50 bg-info text-info-foreground",
10
+ warning: "border-warning/50 bg-warning text-warning-foreground"
12
11
  };
13
- const resolveToastMessage = (message, value) => typeof message === 'function' ? message(value) : message;
14
- /**
15
- * Signal-era toast tanpa dependensi Material: stack dirender ke sebuah live
16
- * region (`role="status"`, `aria-live="polite"`) sehingga screen reader
17
- * mengumumkan setiap toast.
18
- */
19
- class ToastService {
20
- documentRef = inject(DOCUMENT, { optional: true });
21
- container = null;
22
- active = new Map();
23
- constructor() {
24
- // The live region is created as soon as the service is injected, and it is
25
- // never taken away again.
26
- //
27
- // A screen reader only announces content that appears INSIDE a live region
28
- // that was already there. Creating the region together with the first toast
29
- // meant the first message was silently missed, and removing the region when
30
- // the stack emptied made the next first message miss too. An empty region
31
- // costs nothing: it is fixed, has no background, and ignores the pointer.
32
- const doc = this.documentRef;
33
- if (doc) {
34
- this.ensureContainer(doc);
35
- inject(DestroyRef).onDestroy(() => {
36
- this.container?.remove();
37
- this.container = null;
38
- });
39
- }
40
- }
41
- show(options) {
42
- const doc = this.documentRef;
43
- if (!doc) {
44
- return { dismiss: () => { }, afterDismissed: Promise.resolve({ dismissedByAction: false }) };
45
- }
46
- const variant = options.variant ?? 'default';
47
- const container = this.ensureContainer(doc);
48
- // Only move the container while it is empty. The container outlives its
49
- // toasts now, so repositioning it for a later toast would teleport the ones
50
- // already on screen out from under the reader.
51
- if (this.active.size === 0) {
52
- this.applyPosition(container, options);
53
- }
54
- const toast = doc.createElement('div');
55
- toast.className = [
56
- 'toast-panel pointer-events-auto flex w-80 items-start gap-3 rounded-md border p-4 shadow-lg',
57
- `toast-${variant}`,
58
- VARIANT_CLASSES[variant],
59
- ].join(' ');
60
- toast.setAttribute('data-variant', variant);
61
- const body = doc.createElement('div');
62
- body.className = 'flex min-w-0 flex-1 flex-col gap-1';
63
- if (options.title) {
64
- const title = doc.createElement('p');
65
- title.className = 'text-sm font-semibold leading-tight';
66
- title.textContent = options.title;
67
- body.appendChild(title);
68
- }
69
- if (options.description) {
70
- const description = doc.createElement('p');
71
- description.className = 'text-sm leading-snug opacity-90';
72
- description.textContent = options.description;
73
- body.appendChild(description);
74
- }
75
- toast.appendChild(body);
76
- let resolveDismiss = () => { };
77
- const afterDismissed = new Promise((resolve) => {
78
- resolveDismiss = resolve;
79
- });
80
- let timeoutId = null;
81
- const duration = options.durationMs === null ? null : (options.durationMs ?? DEFAULT_TOAST_DURATION_MS);
82
- let remainingMs = duration;
83
- let timerStartedAt = 0;
84
- const clearTimer = () => {
85
- if (timeoutId !== null) {
86
- (doc.defaultView ?? globalThis).clearTimeout(timeoutId);
87
- timeoutId = null;
88
- }
89
- };
90
- const dismiss = (dismissedByAction = false) => {
91
- clearTimer();
92
- if (!this.active.delete(toast)) {
93
- return;
94
- }
95
- toast.remove();
96
- // The container stays: see the constructor. Removing it here is what made
97
- // the next first toast go unannounced.
98
- resolveDismiss({ dismissedByAction });
99
- };
100
- const resumeTimer = () => {
101
- if (remainingMs === null || timeoutId !== null) {
102
- return;
103
- }
104
- if (remainingMs <= 0) {
105
- dismiss(false);
106
- return;
107
- }
108
- timerStartedAt = Date.now();
109
- timeoutId = (doc.defaultView ?? globalThis).setTimeout(() => {
110
- timeoutId = null;
111
- remainingMs = 0;
112
- dismiss(false);
113
- }, remainingMs);
114
- };
115
- const pauseTimer = () => {
116
- if (remainingMs === null || timeoutId === null) {
117
- return;
118
- }
119
- remainingMs = Math.max(0, remainingMs - (Date.now() - timerStartedAt));
120
- clearTimer();
121
- };
122
- if (options.action) {
123
- const action = doc.createElement('button');
124
- action.type = 'button';
125
- action.className =
126
- 'shrink-0 rounded-md border border-current/30 px-2 py-1 text-xs font-medium transition-opacity hover:opacity-80';
127
- action.textContent = options.action;
128
- action.addEventListener('click', () => dismiss(true), { once: true });
129
- toast.appendChild(action);
130
- }
131
- const dismissButton = doc.createElement('button');
132
- dismissButton.type = 'button';
133
- dismissButton.className =
134
- 'toast-dismiss shrink-0 rounded-md p-1 text-current/80 transition-opacity hover:opacity-100';
135
- dismissButton.setAttribute('aria-label', options.dismissLabel ?? 'Dismiss notification');
136
- const dismissIcon = doc.createElementNS('http://www.w3.org/2000/svg', 'svg');
137
- dismissIcon.setAttribute('aria-hidden', 'true');
138
- dismissIcon.setAttribute('viewBox', '0 0 24 24');
139
- dismissIcon.setAttribute('width', '16');
140
- dismissIcon.setAttribute('height', '16');
141
- dismissIcon.setAttribute('fill', 'none');
142
- dismissIcon.setAttribute('stroke', 'currentColor');
143
- dismissIcon.setAttribute('stroke-width', '2');
144
- const dismissPath = doc.createElementNS('http://www.w3.org/2000/svg', 'path');
145
- dismissPath.setAttribute('d', 'M6 6l12 12M18 6 6 18');
146
- dismissIcon.appendChild(dismissPath);
147
- dismissButton.appendChild(dismissIcon);
148
- dismissButton.addEventListener('click', () => dismiss(false), { once: true });
149
- toast.appendChild(dismissButton);
150
- container.appendChild(toast);
151
- this.active.set(toast, dismiss);
152
- if (duration !== null && (options.pauseOnInteraction ?? true)) {
153
- toast.addEventListener('pointerenter', pauseTimer);
154
- toast.addEventListener('pointerleave', resumeTimer);
155
- toast.addEventListener('focusin', pauseTimer);
156
- toast.addEventListener('focusout', (event) => {
157
- if (!toast.contains(event.relatedTarget)) {
158
- resumeTimer();
159
- }
160
- });
161
- }
162
- resumeTimer();
163
- return { dismiss: () => dismiss(false), afterDismissed };
164
- }
165
- success(opts) {
166
- return this.show({ ...opts, variant: 'success' });
167
- }
168
- info(opts) {
169
- return this.show({ ...opts, variant: 'info' });
170
- }
171
- warning(opts) {
172
- return this.show({ ...opts, variant: 'warning' });
173
- }
174
- error(opts) {
175
- return this.show({ ...opts, variant: 'destructive' });
176
- }
177
- async promise(taskOrFactory, messages) {
178
- const loading = this.show({ title: messages.loading, durationMs: null });
179
- try {
180
- const task = typeof taskOrFactory === 'function' ? taskOrFactory() : taskOrFactory;
181
- const value = await task;
182
- loading.dismiss();
183
- this.success({ title: resolveToastMessage(messages.success, value) });
184
- return value;
185
- }
186
- catch (error) {
187
- loading.dismiss();
188
- this.error({ title: resolveToastMessage(messages.error, error) });
189
- throw error;
190
- }
191
- }
192
- dismiss() {
193
- for (const dismiss of [...this.active.values()]) {
194
- dismiss(false);
195
- }
196
- }
197
- ensureContainer(doc) {
198
- if (this.container?.isConnected) {
199
- return this.container;
200
- }
201
- const container = doc.createElement('div');
202
- container.className = 'toast-container pointer-events-none fixed z-50 flex flex-col gap-2 p-4';
203
- container.setAttribute('role', 'status');
204
- container.setAttribute('aria-live', 'polite');
205
- doc.body.appendChild(container);
206
- this.container = container;
207
- return container;
208
- }
209
- /**
210
- * Position the persistent container for the toast being shown.
211
- *
212
- * Applied only when the stack is empty (see {@link show}), so a run of toasts
213
- * shares one corner and nothing already visible jumps. The previous corner is
214
- * cleared first, so switching corners between runs works.
215
- */
216
- applyPosition(container, options) {
217
- for (const property of ['top', 'bottom', 'left', 'right', 'transform']) {
218
- container.style.removeProperty(property);
219
- }
220
- const vertical = options.verticalPosition ?? 'bottom';
221
- const horizontal = options.horizontalPosition ?? 'end';
222
- container.style.setProperty(vertical === 'top' ? 'top' : 'bottom', '0');
223
- if (horizontal === 'center') {
224
- container.style.setProperty('left', '50%');
225
- container.style.setProperty('transform', 'translateX(-50%)');
226
- }
227
- else if (horizontal === 'start' || horizontal === 'left') {
228
- container.style.setProperty('left', '0');
229
- }
230
- else {
231
- container.style.setProperty('right', '0');
232
- }
233
- }
234
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ToastService, deps: [], target: i0.ɵɵFactoryTarget.Service });
235
- static ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.1.4", ngImport: i0, type: ToastService });
236
- }
237
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ToastService, decorators: [{
238
- type: Service
239
- }], ctorParameters: () => [] });
240
-
241
- /**
242
- * Generated bundle index. Do not edit.
243
- */
244
-
245
- export { ToastService };
12
+ const resolveToastMessage = (message, value) => typeof message === "function" ? message(value) : message;
13
+ var ToastService = class ToastService {
14
+ documentRef = inject(DOCUMENT, { optional: true });
15
+ container = null;
16
+ active = /* @__PURE__ */ new Map();
17
+ constructor() {
18
+ const doc = this.documentRef;
19
+ if (doc) {
20
+ this.ensureContainer(doc);
21
+ inject(DestroyRef).onDestroy(() => {
22
+ this.container?.remove();
23
+ this.container = null;
24
+ });
25
+ }
26
+ }
27
+ show(options) {
28
+ const doc = this.documentRef;
29
+ if (!doc) return {
30
+ dismiss: () => {},
31
+ afterDismissed: Promise.resolve({ dismissedByAction: false })
32
+ };
33
+ const variant = options.variant ?? "default";
34
+ const container = this.ensureContainer(doc);
35
+ if (this.active.size === 0) this.applyPosition(container, options);
36
+ const toast = doc.createElement("div");
37
+ toast.className = [
38
+ "toast-panel pointer-events-auto flex w-80 items-start gap-3 rounded-md border p-4 shadow-lg",
39
+ `toast-${variant}`,
40
+ VARIANT_CLASSES[variant]
41
+ ].join(" ");
42
+ toast.setAttribute("data-variant", variant);
43
+ const body = doc.createElement("div");
44
+ body.className = "flex min-w-0 flex-1 flex-col gap-1";
45
+ if (options.title) {
46
+ const title = doc.createElement("p");
47
+ title.className = "text-sm font-semibold leading-tight";
48
+ title.textContent = options.title;
49
+ body.appendChild(title);
50
+ }
51
+ if (options.description) {
52
+ const description = doc.createElement("p");
53
+ description.className = "text-sm leading-snug opacity-90";
54
+ description.textContent = options.description;
55
+ body.appendChild(description);
56
+ }
57
+ toast.appendChild(body);
58
+ let resolveDismiss = () => {};
59
+ const afterDismissed = new Promise((resolve) => {
60
+ resolveDismiss = resolve;
61
+ });
62
+ let timeoutId = null;
63
+ const duration = options.durationMs === null ? null : options.durationMs ?? DEFAULT_TOAST_DURATION_MS;
64
+ let remainingMs = duration;
65
+ let timerStartedAt = 0;
66
+ const clearTimer = () => {
67
+ if (timeoutId !== null) {
68
+ (doc.defaultView ?? globalThis).clearTimeout(timeoutId);
69
+ timeoutId = null;
70
+ }
71
+ };
72
+ const dismiss = (dismissedByAction = false) => {
73
+ clearTimer();
74
+ if (!this.active.delete(toast)) return;
75
+ toast.remove();
76
+ resolveDismiss({ dismissedByAction });
77
+ };
78
+ const resumeTimer = () => {
79
+ if (remainingMs === null || timeoutId !== null) return;
80
+ if (remainingMs <= 0) {
81
+ dismiss(false);
82
+ return;
83
+ }
84
+ timerStartedAt = Date.now();
85
+ timeoutId = (doc.defaultView ?? globalThis).setTimeout(() => {
86
+ timeoutId = null;
87
+ remainingMs = 0;
88
+ dismiss(false);
89
+ }, remainingMs);
90
+ };
91
+ const pauseTimer = () => {
92
+ if (remainingMs === null || timeoutId === null) return;
93
+ remainingMs = Math.max(0, remainingMs - (Date.now() - timerStartedAt));
94
+ clearTimer();
95
+ };
96
+ if (options.action) {
97
+ const action = doc.createElement("button");
98
+ action.type = "button";
99
+ action.className = "shrink-0 rounded-md border border-current/30 px-2 py-1 text-xs font-medium transition-opacity hover:opacity-80";
100
+ action.textContent = options.action;
101
+ action.addEventListener("click", () => dismiss(true), { once: true });
102
+ toast.appendChild(action);
103
+ }
104
+ const dismissButton = doc.createElement("button");
105
+ dismissButton.type = "button";
106
+ dismissButton.className = "toast-dismiss shrink-0 rounded-md p-1 text-current/80 transition-opacity hover:opacity-100";
107
+ dismissButton.setAttribute("aria-label", options.dismissLabel ?? "Dismiss notification");
108
+ const dismissIcon = doc.createElementNS("http://www.w3.org/2000/svg", "svg");
109
+ dismissIcon.setAttribute("aria-hidden", "true");
110
+ dismissIcon.setAttribute("viewBox", "0 0 24 24");
111
+ dismissIcon.setAttribute("width", "16");
112
+ dismissIcon.setAttribute("height", "16");
113
+ dismissIcon.setAttribute("fill", "none");
114
+ dismissIcon.setAttribute("stroke", "currentColor");
115
+ dismissIcon.setAttribute("stroke-width", "2");
116
+ const dismissPath = doc.createElementNS("http://www.w3.org/2000/svg", "path");
117
+ dismissPath.setAttribute("d", "M6 6l12 12M18 6 6 18");
118
+ dismissIcon.appendChild(dismissPath);
119
+ dismissButton.appendChild(dismissIcon);
120
+ dismissButton.addEventListener("click", () => dismiss(false), { once: true });
121
+ toast.appendChild(dismissButton);
122
+ container.appendChild(toast);
123
+ this.active.set(toast, dismiss);
124
+ if (duration !== null && (options.pauseOnInteraction ?? true)) {
125
+ toast.addEventListener("pointerenter", pauseTimer);
126
+ toast.addEventListener("pointerleave", resumeTimer);
127
+ toast.addEventListener("focusin", pauseTimer);
128
+ toast.addEventListener("focusout", (event) => {
129
+ if (!toast.contains(event.relatedTarget)) resumeTimer();
130
+ });
131
+ }
132
+ resumeTimer();
133
+ return {
134
+ dismiss: () => dismiss(false),
135
+ afterDismissed
136
+ };
137
+ }
138
+ success(opts) {
139
+ return this.show({
140
+ ...opts,
141
+ variant: "success"
142
+ });
143
+ }
144
+ info(opts) {
145
+ return this.show({
146
+ ...opts,
147
+ variant: "info"
148
+ });
149
+ }
150
+ warning(opts) {
151
+ return this.show({
152
+ ...opts,
153
+ variant: "warning"
154
+ });
155
+ }
156
+ error(opts) {
157
+ return this.show({
158
+ ...opts,
159
+ variant: "destructive"
160
+ });
161
+ }
162
+ async promise(taskOrFactory, messages) {
163
+ const loading = this.show({
164
+ title: messages.loading,
165
+ durationMs: null
166
+ });
167
+ try {
168
+ const value = await (typeof taskOrFactory === "function" ? taskOrFactory() : taskOrFactory);
169
+ loading.dismiss();
170
+ this.success({ title: resolveToastMessage(messages.success, value) });
171
+ return value;
172
+ } catch (error) {
173
+ loading.dismiss();
174
+ this.error({ title: resolveToastMessage(messages.error, error) });
175
+ throw error;
176
+ }
177
+ }
178
+ dismiss() {
179
+ for (const dismiss of [...this.active.values()]) dismiss(false);
180
+ }
181
+ ensureContainer(doc) {
182
+ if (this.container?.isConnected) return this.container;
183
+ const container = doc.createElement("div");
184
+ container.className = "toast-container pointer-events-none fixed z-50 flex flex-col gap-2 p-4";
185
+ container.setAttribute("role", "status");
186
+ container.setAttribute("aria-live", "polite");
187
+ doc.body.appendChild(container);
188
+ this.container = container;
189
+ return container;
190
+ }
191
+ applyPosition(container, options) {
192
+ for (const property of [
193
+ "top",
194
+ "bottom",
195
+ "left",
196
+ "right",
197
+ "transform"
198
+ ]) container.style.removeProperty(property);
199
+ const vertical = options.verticalPosition ?? "bottom";
200
+ const horizontal = options.horizontalPosition ?? "end";
201
+ container.style.setProperty(vertical === "top" ? "top" : "bottom", "0");
202
+ if (horizontal === "center") {
203
+ container.style.setProperty("left", "50%");
204
+ container.style.setProperty("transform", "translateX(-50%)");
205
+ } else if (horizontal === "start" || horizontal === "left") container.style.setProperty("left", "0");
206
+ else container.style.setProperty("right", "0");
207
+ }
208
+ static ɵfac = i0.ɵɵngDeclareFactory({
209
+ minVersion: "12.0.0",
210
+ version: "22.2.0",
211
+ ngImport: i0,
212
+ type: ToastService,
213
+ deps: [],
214
+ target: i0.ɵɵFactoryTarget.Service
215
+ });
216
+ static ɵprov = i0.ɵɵngDeclareService({
217
+ minVersion: "22.0.0",
218
+ version: "22.2.0",
219
+ ngImport: i0,
220
+ type: ToastService
221
+ });
222
+ };
223
+ i0.ɵɵngDeclareClassMetadata({
224
+ minVersion: "12.0.0",
225
+ version: "22.2.0",
226
+ ngImport: i0,
227
+ type: ToastService,
228
+ decorators: [{ type: Service }],
229
+ ctorParameters: () => []
230
+ });
231
+ export { ToastService };