@raqm/ui 0.0.0-stage → 0.1.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 (178) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/LICENSE +21 -0
  3. package/NOTICE.md +28 -0
  4. package/README.md +125 -3
  5. package/combobox/README.md +17 -0
  6. package/fesm2022/raqm-ui-accordion.mjs +414 -0
  7. package/fesm2022/raqm-ui-accordion.mjs.map +1 -0
  8. package/fesm2022/raqm-ui-alert-dialog.mjs +457 -0
  9. package/fesm2022/raqm-ui-alert-dialog.mjs.map +1 -0
  10. package/fesm2022/raqm-ui-alert.mjs +195 -0
  11. package/fesm2022/raqm-ui-alert.mjs.map +1 -0
  12. package/fesm2022/raqm-ui-aspect-ratio.mjs +66 -0
  13. package/fesm2022/raqm-ui-aspect-ratio.mjs.map +1 -0
  14. package/fesm2022/raqm-ui-attachment.mjs +435 -0
  15. package/fesm2022/raqm-ui-attachment.mjs.map +1 -0
  16. package/fesm2022/raqm-ui-avatar.mjs +337 -0
  17. package/fesm2022/raqm-ui-avatar.mjs.map +1 -0
  18. package/fesm2022/raqm-ui-badge.mjs +68 -0
  19. package/fesm2022/raqm-ui-badge.mjs.map +1 -0
  20. package/fesm2022/raqm-ui-breadcrumb.mjs +309 -0
  21. package/fesm2022/raqm-ui-breadcrumb.mjs.map +1 -0
  22. package/fesm2022/raqm-ui-button-group.mjs +138 -0
  23. package/fesm2022/raqm-ui-button-group.mjs.map +1 -0
  24. package/fesm2022/raqm-ui-button.mjs +295 -0
  25. package/fesm2022/raqm-ui-button.mjs.map +1 -0
  26. package/fesm2022/raqm-ui-calendar.mjs +1394 -0
  27. package/fesm2022/raqm-ui-calendar.mjs.map +1 -0
  28. package/fesm2022/raqm-ui-card.mjs +331 -0
  29. package/fesm2022/raqm-ui-card.mjs.map +1 -0
  30. package/fesm2022/raqm-ui-carousel.mjs +410 -0
  31. package/fesm2022/raqm-ui-carousel.mjs.map +1 -0
  32. package/fesm2022/raqm-ui-checkbox.mjs +86 -0
  33. package/fesm2022/raqm-ui-checkbox.mjs.map +1 -0
  34. package/fesm2022/raqm-ui-collapsible.mjs +266 -0
  35. package/fesm2022/raqm-ui-collapsible.mjs.map +1 -0
  36. package/fesm2022/raqm-ui-combobox.mjs +1584 -0
  37. package/fesm2022/raqm-ui-combobox.mjs.map +1 -0
  38. package/fesm2022/raqm-ui-command.mjs +1210 -0
  39. package/fesm2022/raqm-ui-command.mjs.map +1 -0
  40. package/fesm2022/raqm-ui-context-menu.mjs +723 -0
  41. package/fesm2022/raqm-ui-context-menu.mjs.map +1 -0
  42. package/fesm2022/raqm-ui-dialog.mjs +1214 -0
  43. package/fesm2022/raqm-ui-dialog.mjs.map +1 -0
  44. package/fesm2022/raqm-ui-drawer.mjs +687 -0
  45. package/fesm2022/raqm-ui-drawer.mjs.map +1 -0
  46. package/fesm2022/raqm-ui-dropdown-menu.mjs +1168 -0
  47. package/fesm2022/raqm-ui-dropdown-menu.mjs.map +1 -0
  48. package/fesm2022/raqm-ui-empty.mjs +272 -0
  49. package/fesm2022/raqm-ui-empty.mjs.map +1 -0
  50. package/fesm2022/raqm-ui-field.mjs +517 -0
  51. package/fesm2022/raqm-ui-field.mjs.map +1 -0
  52. package/fesm2022/raqm-ui-hover-card.mjs +828 -0
  53. package/fesm2022/raqm-ui-hover-card.mjs.map +1 -0
  54. package/fesm2022/raqm-ui-input-group.mjs +270 -0
  55. package/fesm2022/raqm-ui-input-group.mjs.map +1 -0
  56. package/fesm2022/raqm-ui-input-otp.mjs +788 -0
  57. package/fesm2022/raqm-ui-input-otp.mjs.map +1 -0
  58. package/fesm2022/raqm-ui-input.mjs +73 -0
  59. package/fesm2022/raqm-ui-input.mjs.map +1 -0
  60. package/fesm2022/raqm-ui-item.mjs +495 -0
  61. package/fesm2022/raqm-ui-item.mjs.map +1 -0
  62. package/fesm2022/raqm-ui-kbd.mjs +80 -0
  63. package/fesm2022/raqm-ui-kbd.mjs.map +1 -0
  64. package/fesm2022/raqm-ui-label.mjs +44 -0
  65. package/fesm2022/raqm-ui-label.mjs.map +1 -0
  66. package/fesm2022/raqm-ui-menubar.mjs +536 -0
  67. package/fesm2022/raqm-ui-menubar.mjs.map +1 -0
  68. package/fesm2022/raqm-ui-native-select.mjs +131 -0
  69. package/fesm2022/raqm-ui-native-select.mjs.map +1 -0
  70. package/fesm2022/raqm-ui-navigation-menu.mjs +1399 -0
  71. package/fesm2022/raqm-ui-navigation-menu.mjs.map +1 -0
  72. package/fesm2022/raqm-ui-overlay-internal.mjs +185 -0
  73. package/fesm2022/raqm-ui-overlay-internal.mjs.map +1 -0
  74. package/fesm2022/raqm-ui-pagination.mjs +440 -0
  75. package/fesm2022/raqm-ui-pagination.mjs.map +1 -0
  76. package/fesm2022/raqm-ui-popover.mjs +1495 -0
  77. package/fesm2022/raqm-ui-popover.mjs.map +1 -0
  78. package/fesm2022/raqm-ui-progress.mjs +369 -0
  79. package/fesm2022/raqm-ui-progress.mjs.map +1 -0
  80. package/fesm2022/raqm-ui-questionnaire.mjs +1005 -0
  81. package/fesm2022/raqm-ui-questionnaire.mjs.map +1 -0
  82. package/fesm2022/raqm-ui-radio-group.mjs +151 -0
  83. package/fesm2022/raqm-ui-radio-group.mjs.map +1 -0
  84. package/fesm2022/raqm-ui-resizable.mjs +439 -0
  85. package/fesm2022/raqm-ui-resizable.mjs.map +1 -0
  86. package/fesm2022/raqm-ui-scroll-area.mjs +510 -0
  87. package/fesm2022/raqm-ui-scroll-area.mjs.map +1 -0
  88. package/fesm2022/raqm-ui-select.mjs +1073 -0
  89. package/fesm2022/raqm-ui-select.mjs.map +1 -0
  90. package/fesm2022/raqm-ui-separator.mjs +103 -0
  91. package/fesm2022/raqm-ui-separator.mjs.map +1 -0
  92. package/fesm2022/raqm-ui-sheet.mjs +411 -0
  93. package/fesm2022/raqm-ui-sheet.mjs.map +1 -0
  94. package/fesm2022/raqm-ui-sidebar.mjs +1784 -0
  95. package/fesm2022/raqm-ui-sidebar.mjs.map +1 -0
  96. package/fesm2022/raqm-ui-skeleton.mjs +50 -0
  97. package/fesm2022/raqm-ui-skeleton.mjs.map +1 -0
  98. package/fesm2022/raqm-ui-slider.mjs +609 -0
  99. package/fesm2022/raqm-ui-slider.mjs.map +1 -0
  100. package/fesm2022/raqm-ui-spinner.mjs +137 -0
  101. package/fesm2022/raqm-ui-spinner.mjs.map +1 -0
  102. package/fesm2022/raqm-ui-switch.mjs +109 -0
  103. package/fesm2022/raqm-ui-switch.mjs.map +1 -0
  104. package/fesm2022/raqm-ui-table.mjs +271 -0
  105. package/fesm2022/raqm-ui-table.mjs.map +1 -0
  106. package/fesm2022/raqm-ui-tabs.mjs +536 -0
  107. package/fesm2022/raqm-ui-tabs.mjs.map +1 -0
  108. package/fesm2022/raqm-ui-textarea.mjs +37 -0
  109. package/fesm2022/raqm-ui-textarea.mjs.map +1 -0
  110. package/fesm2022/raqm-ui-toast.mjs +918 -0
  111. package/fesm2022/raqm-ui-toast.mjs.map +1 -0
  112. package/fesm2022/raqm-ui-toggle-group.mjs +462 -0
  113. package/fesm2022/raqm-ui-toggle-group.mjs.map +1 -0
  114. package/fesm2022/raqm-ui-toggle.mjs +158 -0
  115. package/fesm2022/raqm-ui-toggle.mjs.map +1 -0
  116. package/fesm2022/raqm-ui-tooltip.mjs +1226 -0
  117. package/fesm2022/raqm-ui-tooltip.mjs.map +1 -0
  118. package/fesm2022/raqm-ui.mjs +50 -0
  119. package/input-otp/README.md +12 -0
  120. package/package.json +275 -3
  121. package/styles/theme.css +4322 -0
  122. package/types/raqm-ui-accordion.d.ts +124 -0
  123. package/types/raqm-ui-alert-dialog.d.ts +81 -0
  124. package/types/raqm-ui-alert.d.ts +29 -0
  125. package/types/raqm-ui-aspect-ratio.d.ts +13 -0
  126. package/types/raqm-ui-attachment.d.ts +72 -0
  127. package/types/raqm-ui-avatar.d.ts +67 -0
  128. package/types/raqm-ui-badge.d.ts +20 -0
  129. package/types/raqm-ui-breadcrumb.d.ts +35 -0
  130. package/types/raqm-ui-button-group.d.ts +27 -0
  131. package/types/raqm-ui-button.d.ts +80 -0
  132. package/types/raqm-ui-calendar.d.ts +359 -0
  133. package/types/raqm-ui-card.d.ts +34 -0
  134. package/types/raqm-ui-carousel.d.ts +81 -0
  135. package/types/raqm-ui-checkbox.d.ts +24 -0
  136. package/types/raqm-ui-collapsible.d.ts +72 -0
  137. package/types/raqm-ui-combobox.d.ts +405 -0
  138. package/types/raqm-ui-command.d.ts +256 -0
  139. package/types/raqm-ui-context-menu.d.ts +196 -0
  140. package/types/raqm-ui-dialog.d.ts +232 -0
  141. package/types/raqm-ui-drawer.d.ts +121 -0
  142. package/types/raqm-ui-dropdown-menu.d.ts +319 -0
  143. package/types/raqm-ui-empty.d.ts +35 -0
  144. package/types/raqm-ui-field.d.ts +88 -0
  145. package/types/raqm-ui-hover-card.d.ts +139 -0
  146. package/types/raqm-ui-input-group.d.ts +45 -0
  147. package/types/raqm-ui-input-otp.d.ts +197 -0
  148. package/types/raqm-ui-input.d.ts +16 -0
  149. package/types/raqm-ui-item.d.ts +71 -0
  150. package/types/raqm-ui-kbd.d.ts +12 -0
  151. package/types/raqm-ui-label.d.ts +6 -0
  152. package/types/raqm-ui-menubar.d.ts +159 -0
  153. package/types/raqm-ui-native-select.d.ts +23 -0
  154. package/types/raqm-ui-navigation-menu.d.ts +230 -0
  155. package/types/raqm-ui-overlay-internal.d.ts +5 -0
  156. package/types/raqm-ui-pagination.d.ts +84 -0
  157. package/types/raqm-ui-popover.d.ts +235 -0
  158. package/types/raqm-ui-progress.d.ts +79 -0
  159. package/types/raqm-ui-questionnaire.d.ts +217 -0
  160. package/types/raqm-ui-radio-group.d.ts +48 -0
  161. package/types/raqm-ui-resizable.d.ts +98 -0
  162. package/types/raqm-ui-scroll-area.d.ts +132 -0
  163. package/types/raqm-ui-select.d.ts +205 -0
  164. package/types/raqm-ui-separator.d.ts +21 -0
  165. package/types/raqm-ui-sheet.d.ts +79 -0
  166. package/types/raqm-ui-sidebar.d.ts +285 -0
  167. package/types/raqm-ui-skeleton.d.ts +6 -0
  168. package/types/raqm-ui-slider.d.ts +129 -0
  169. package/types/raqm-ui-spinner.d.ts +32 -0
  170. package/types/raqm-ui-switch.d.ts +32 -0
  171. package/types/raqm-ui-table.d.ts +36 -0
  172. package/types/raqm-ui-tabs.d.ts +154 -0
  173. package/types/raqm-ui-textarea.d.ts +6 -0
  174. package/types/raqm-ui-toast.d.ts +190 -0
  175. package/types/raqm-ui-toggle-group.d.ts +167 -0
  176. package/types/raqm-ui-toggle.d.ts +42 -0
  177. package/types/raqm-ui-tooltip.d.ts +207 -0
  178. package/types/raqm-ui.d.ts +50 -0
@@ -0,0 +1,918 @@
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, DOCUMENT, Directive, ElementRef, Injectable, PLATFORM_ID, ViewContainerRef, afterEveryRender, afterNextRender, computed, effect, inject, input, output, signal, untracked, viewChild } from "@angular/core";
3
+ import { isPlatformBrowser } from "@angular/common";
4
+ import { Overlay } from "@angular/cdk/overlay";
5
+ import { TemplatePortal } from "@angular/cdk/portal";
6
+ var RaqmToastService = class RaqmToastService {
7
+ browser = isPlatformBrowser(inject(PLATFORM_ID));
8
+ records = signal([], ...ngDevMode ? [{ debugName: "records" }] : /* istanbul ignore next */ []);
9
+ clocks = /* @__PURE__ */ new Map();
10
+ document = inject(DOCUMENT);
11
+ exits = /* @__PURE__ */ new Map();
12
+ owner = null;
13
+ paused = false;
14
+ nextId = 0;
15
+ destroyed = false;
16
+ toasts = this.records.asReadonly();
17
+ visibleToasts = computed(() => this.toasts().filter((t) => !t.ending).slice(0, 3), ...ngDevMode ? [{ debugName: "visibleToasts" }] : /* istanbul ignore next */ []);
18
+ renderedToasts = computed(() => {
19
+ const visible = new Set(this.visibleToasts().map((t) => t.id));
20
+ return this.toasts().filter((t) => t.ending || visible.has(t.id));
21
+ }, ...ngDevMode ? [{ debugName: "renderedToasts" }] : /* istanbul ignore next */ []);
22
+ show(options) {
23
+ const id = options.id ?? this.createId();
24
+ if (this.destroyed) return id;
25
+ if (this.records().some((toast) => toast.id === id)) {
26
+ this.update(id, options);
27
+ return id;
28
+ }
29
+ const toast = {
30
+ ...options,
31
+ id,
32
+ timeout: this.timeout(options.timeout),
33
+ updateKey: 0
34
+ };
35
+ this.records.update((records) => [toast, ...records]);
36
+ this.clocks.set(id, {
37
+ remaining: toast.timeout,
38
+ started: 0
39
+ });
40
+ this.syncClocks();
41
+ return id;
42
+ }
43
+ success(options) {
44
+ return this.show({
45
+ ...options,
46
+ type: "success"
47
+ });
48
+ }
49
+ error(options) {
50
+ return this.show({
51
+ ...options,
52
+ type: "error"
53
+ });
54
+ }
55
+ update(id, options) {
56
+ const previous = this.records().find((toast) => toast.id === id);
57
+ if (!previous || previous.ending) return;
58
+ const timeout = this.timeout(options.timeout ?? previous.timeout);
59
+ this.stopClock(id);
60
+ this.records.update((records) => records.map((toast) => toast.id === id ? {
61
+ ...toast,
62
+ ...options,
63
+ id,
64
+ timeout,
65
+ updateKey: toast.updateKey + 1
66
+ } : toast));
67
+ this.clocks.set(id, {
68
+ remaining: timeout,
69
+ started: 0
70
+ });
71
+ this.syncClocks();
72
+ }
73
+ dismiss(id) {
74
+ const visible = new Set(this.visibleToasts().map((t) => t.id));
75
+ const removed = this.records().filter((toast) => !toast.ending && (id === void 0 || toast.id === id));
76
+ const animate = this.browser && this.owner !== null && !this.document.defaultView?.matchMedia("(prefers-reduced-motion: reduce)").matches;
77
+ for (const toast of removed) {
78
+ this.stopClock(toast.id);
79
+ this.clocks.delete(toast.id);
80
+ }
81
+ this.records.update((records) => records.flatMap((toast) => !removed.includes(toast) ? [toast] : animate && visible.has(toast.id) ? [{
82
+ ...toast,
83
+ ending: true
84
+ }] : []));
85
+ for (const toast of removed) if (animate && visible.has(toast.id)) this.exits.set(toast.id, setTimeout(() => {
86
+ this.exits.delete(toast.id);
87
+ this.records.update((records) => records.filter((record) => record.id !== toast.id));
88
+ }, 500));
89
+ this.syncClocks();
90
+ for (const toast of removed) toast.onClose?.();
91
+ }
92
+ claimViewport(owner) {
93
+ if (this.owner !== null && this.owner !== owner) return false;
94
+ this.owner = owner;
95
+ this.syncClocks();
96
+ return true;
97
+ }
98
+ releaseViewport(owner) {
99
+ if (this.owner !== owner) return;
100
+ this.owner = null;
101
+ for (const timer of this.exits.values()) clearTimeout(timer);
102
+ this.exits.clear();
103
+ this.records.update((records) => records.filter((t) => !t.ending));
104
+ this.paused = false;
105
+ this.syncClocks();
106
+ }
107
+ pauseViewport(owner, paused) {
108
+ if (this.owner !== owner) return;
109
+ this.paused = paused;
110
+ this.syncClocks();
111
+ }
112
+ ngOnDestroy() {
113
+ this.destroyed = true;
114
+ for (const id of this.clocks.keys()) this.stopClock(id);
115
+ this.clocks.clear();
116
+ for (const timer of this.exits.values()) clearTimeout(timer);
117
+ this.exits.clear();
118
+ this.records.set([]);
119
+ this.owner = null;
120
+ }
121
+ timeout(value = 5e3) {
122
+ return Number.isFinite(value) ? Math.max(0, Math.min(value, 2147483647)) : 5e3;
123
+ }
124
+ createId() {
125
+ let id;
126
+ do
127
+ id = `raqm-toast-${++this.nextId}`;
128
+ while (this.records().some((toast) => toast.id === id));
129
+ return id;
130
+ }
131
+ stopClock(id) {
132
+ const clock = this.clocks.get(id);
133
+ if (clock?.timer !== void 0) {
134
+ clearTimeout(clock.timer);
135
+ clock.timer = void 0;
136
+ clock.remaining = Math.max(0, clock.remaining - (Date.now() - clock.started));
137
+ }
138
+ }
139
+ syncClocks() {
140
+ const visible = new Set(this.visibleToasts().map((toast) => toast.id));
141
+ for (const [id, clock] of this.clocks) if (!this.browser || !this.owner || this.paused || !visible.has(id)) this.stopClock(id);
142
+ else if (clock.timer === void 0 && this.records().find((t) => t.id === id)?.timeout) {
143
+ clock.started = Date.now();
144
+ clock.timer = setTimeout(() => {
145
+ clock.timer = void 0;
146
+ this.dismiss(id);
147
+ }, clock.remaining);
148
+ }
149
+ }
150
+ static ɵfac = i0.ɵɵngDeclareFactory({
151
+ minVersion: "12.0.0",
152
+ version: "22.2.2",
153
+ ngImport: i0,
154
+ type: RaqmToastService,
155
+ deps: [],
156
+ target: i0.ɵɵFactoryTarget.Injectable
157
+ });
158
+ static ɵprov = i0.ɵɵngDeclareInjectable({
159
+ minVersion: "12.0.0",
160
+ version: "22.2.2",
161
+ ngImport: i0,
162
+ type: RaqmToastService,
163
+ providedIn: "root"
164
+ });
165
+ };
166
+ i0.ɵɵngDeclareClassMetadata({
167
+ minVersion: "12.0.0",
168
+ version: "22.2.2",
169
+ ngImport: i0,
170
+ type: RaqmToastService,
171
+ decorators: [{
172
+ type: Injectable,
173
+ args: [{ providedIn: "root" }]
174
+ }]
175
+ });
176
+ var RaqmToastComponent = class RaqmToastComponent {
177
+ toast = input.required(...ngDevMode ? [{ debugName: "toast" }] : /* istanbul ignore next */ []);
178
+ swipingChange = output();
179
+ service = inject(RaqmToastService);
180
+ element = inject(ElementRef).nativeElement;
181
+ pointer = null;
182
+ start = {
183
+ x: 0,
184
+ y: 0
185
+ };
186
+ initial = "";
187
+ axis = null;
188
+ firstMove = true;
189
+ maximum = 0;
190
+ baseline = {
191
+ x: 0,
192
+ y: 0
193
+ };
194
+ intended = false;
195
+ cancelled = false;
196
+ delta = 0;
197
+ constructor() {
198
+ effect(() => {
199
+ if (this.toast().ending) this.releasePointer();
200
+ });
201
+ }
202
+ pointerDown(event) {
203
+ if (event.button !== 0 || this.pointer !== null || this.toast().ending || event.target.closest("button,a,input,textarea,select,[role=\"button\"],[contenteditable],[data-base-ui-swipe-ignore],[data-swipe-ignore]")) return;
204
+ try {
205
+ this.element.setPointerCapture(event.pointerId);
206
+ } catch {
207
+ return;
208
+ }
209
+ this.pointer = event.pointerId;
210
+ this.swipingChange.emit(true);
211
+ this.start = {
212
+ x: event.clientX,
213
+ y: event.clientY
214
+ };
215
+ this.baseline = { ...this.start };
216
+ this.intended = false;
217
+ this.initial = this.element.ownerDocument.defaultView?.getComputedStyle(this.element).transform ?? "";
218
+ this.axis = null;
219
+ this.firstMove = true;
220
+ this.maximum = this.delta = 0;
221
+ this.cancelled = false;
222
+ this.element.setAttribute("data-raqm-swiping", "");
223
+ }
224
+ pointerMove(event) {
225
+ if (event.pointerId !== this.pointer) return;
226
+ event.preventDefault();
227
+ if (this.firstMove) {
228
+ this.start = {
229
+ x: event.clientX,
230
+ y: event.clientY
231
+ };
232
+ this.firstMove = false;
233
+ }
234
+ const x = event.clientX - this.start.x;
235
+ const y = event.clientY - this.start.y;
236
+ if (event.movementX < 0 && event.clientX > this.baseline.x || event.movementX > 0 && event.clientX < this.baseline.x) this.baseline.x = event.clientX;
237
+ if (event.movementY < 0 && event.clientY > this.baseline.y || event.movementY > 0 && event.clientY < this.baseline.y) this.baseline.y = event.clientY;
238
+ if (!this.axis && Math.hypot(x, y) >= 1) this.axis = Math.abs(x) > Math.abs(y) ? "x" : "y";
239
+ this.delta = this.axis === "x" ? x : this.axis === "y" ? y : 0;
240
+ if (!this.intended && this.delta > 0) {
241
+ this.intended = true;
242
+ this.maximum = this.delta;
243
+ } else if (this.intended) {
244
+ const displacement = this.axis === "x" ? event.clientX - this.baseline.x : event.clientY - this.baseline.y;
245
+ if (displacement > 40) this.cancelled = false;
246
+ else if (this.maximum - displacement >= 10) this.cancelled = true;
247
+ }
248
+ const damped = this.delta < 0 ? -Math.sqrt(-this.delta) : this.delta;
249
+ this.element.style.transform = `translate${this.axis === "x" ? "X" : "Y"}(${damped}px) ${this.initial === "none" ? "" : this.initial}`;
250
+ this.element.style.setProperty("--toast-swipe-movement-x", `${this.axis === "x" ? damped : 0}px`);
251
+ this.element.style.setProperty("--toast-swipe-movement-y", `${this.axis === "y" ? damped : 0}px`);
252
+ }
253
+ pointerEnd(event) {
254
+ if (event.pointerId !== this.pointer) return;
255
+ const dismiss = event.type === "pointerup" && this.delta > 40 && !this.cancelled;
256
+ const direction = this.axis === "x" ? "right" : "down";
257
+ this.releasePointer();
258
+ if (dismiss) {
259
+ this.element.setAttribute("data-raqm-swipe-direction", direction);
260
+ this.dismiss();
261
+ } else {
262
+ this.element.style.removeProperty("--toast-swipe-movement-x");
263
+ this.element.style.removeProperty("--toast-swipe-movement-y");
264
+ }
265
+ }
266
+ ngOnDestroy() {
267
+ this.releasePointer();
268
+ }
269
+ releasePointer() {
270
+ const pointer = this.pointer;
271
+ this.pointer = null;
272
+ if (pointer !== null) this.swipingChange.emit(false);
273
+ if (pointer !== null && this.element.hasPointerCapture(pointer)) this.element.releasePointerCapture(pointer);
274
+ this.element.removeAttribute("data-raqm-swiping");
275
+ this.element.style.removeProperty("transform");
276
+ }
277
+ dismiss(event) {
278
+ event?.preventDefault();
279
+ event?.stopPropagation();
280
+ this.service.dismiss(this.toast().id);
281
+ }
282
+ static ɵfac = i0.ɵɵngDeclareFactory({
283
+ minVersion: "12.0.0",
284
+ version: "22.2.2",
285
+ ngImport: i0,
286
+ type: RaqmToastComponent,
287
+ deps: [],
288
+ target: i0.ɵɵFactoryTarget.Component
289
+ });
290
+ static ɵcmp = i0.ɵɵngDeclareComponent({
291
+ minVersion: "17.1.0",
292
+ version: "22.2.2",
293
+ type: RaqmToastComponent,
294
+ isStandalone: true,
295
+ selector: "raqm-toast",
296
+ inputs: { toast: {
297
+ classPropertyName: "toast",
298
+ publicName: "toast",
299
+ isSignal: true,
300
+ isRequired: true,
301
+ transformFunction: null
302
+ } },
303
+ outputs: { swipingChange: "swipingChange" },
304
+ host: {
305
+ attributes: {
306
+ "tabindex": "-1",
307
+ "role": "group"
308
+ },
309
+ listeners: {
310
+ "keydown.escape": "dismiss($event)",
311
+ "pointerdown": "pointerDown($event)",
312
+ "pointermove": "pointerMove($event)",
313
+ "pointerup": "pointerEnd($event)",
314
+ "pointercancel": "pointerEnd($event)",
315
+ "lostpointercapture": "pointerEnd($event)"
316
+ },
317
+ properties: { "attr.data-raqm-type": "toast().type" },
318
+ classAttribute: "raqm-toast"
319
+ },
320
+ ngImport: i0,
321
+ template: "<ng-content />",
322
+ isInline: true,
323
+ styles: [""],
324
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
325
+ });
326
+ };
327
+ i0.ɵɵngDeclareClassMetadata({
328
+ minVersion: "12.0.0",
329
+ version: "22.2.2",
330
+ ngImport: i0,
331
+ type: RaqmToastComponent,
332
+ decorators: [{
333
+ type: Component,
334
+ args: [{
335
+ selector: "raqm-toast",
336
+ template: "<ng-content />",
337
+ changeDetection: ChangeDetectionStrategy.OnPush,
338
+ host: {
339
+ class: "raqm-toast",
340
+ tabindex: "-1",
341
+ role: "group",
342
+ "[attr.data-raqm-type]": "toast().type",
343
+ "(keydown.escape)": "dismiss($event)",
344
+ "(pointerdown)": "pointerDown($event)",
345
+ "(pointermove)": "pointerMove($event)",
346
+ "(pointerup)": "pointerEnd($event)",
347
+ "(pointercancel)": "pointerEnd($event)",
348
+ "(lostpointercapture)": "pointerEnd($event)"
349
+ }
350
+ }]
351
+ }],
352
+ ctorParameters: () => [],
353
+ propDecorators: {
354
+ toast: [{
355
+ type: i0.Input,
356
+ args: [{
357
+ isSignal: true,
358
+ alias: "toast",
359
+ required: true
360
+ }]
361
+ }],
362
+ swipingChange: [{
363
+ type: i0.Output,
364
+ args: ["swipingChange"]
365
+ }]
366
+ }
367
+ });
368
+ var RaqmToastTitleDirective = class RaqmToastTitleDirective {
369
+ static ɵfac = i0.ɵɵngDeclareFactory({
370
+ minVersion: "12.0.0",
371
+ version: "22.2.2",
372
+ ngImport: i0,
373
+ type: RaqmToastTitleDirective,
374
+ deps: [],
375
+ target: i0.ɵɵFactoryTarget.Directive
376
+ });
377
+ static ɵdir = i0.ɵɵngDeclareDirective({
378
+ minVersion: "14.0.0",
379
+ version: "22.2.2",
380
+ type: RaqmToastTitleDirective,
381
+ isStandalone: true,
382
+ selector: "[raqm-toast-title]",
383
+ host: { classAttribute: "raqm-toast-title" },
384
+ ngImport: i0
385
+ });
386
+ };
387
+ i0.ɵɵngDeclareClassMetadata({
388
+ minVersion: "12.0.0",
389
+ version: "22.2.2",
390
+ ngImport: i0,
391
+ type: RaqmToastTitleDirective,
392
+ decorators: [{
393
+ type: Directive,
394
+ args: [{
395
+ selector: "[raqm-toast-title]",
396
+ host: { class: "raqm-toast-title" }
397
+ }]
398
+ }]
399
+ });
400
+ var RaqmToastContentDirective = class RaqmToastContentDirective {
401
+ static ɵfac = i0.ɵɵngDeclareFactory({
402
+ minVersion: "12.0.0",
403
+ version: "22.2.2",
404
+ ngImport: i0,
405
+ type: RaqmToastContentDirective,
406
+ deps: [],
407
+ target: i0.ɵɵFactoryTarget.Directive
408
+ });
409
+ static ɵdir = i0.ɵɵngDeclareDirective({
410
+ minVersion: "14.0.0",
411
+ version: "22.2.2",
412
+ type: RaqmToastContentDirective,
413
+ isStandalone: true,
414
+ selector: "[raqm-toast-content]",
415
+ host: { classAttribute: "raqm-toast-content" },
416
+ ngImport: i0
417
+ });
418
+ };
419
+ i0.ɵɵngDeclareClassMetadata({
420
+ minVersion: "12.0.0",
421
+ version: "22.2.2",
422
+ ngImport: i0,
423
+ type: RaqmToastContentDirective,
424
+ decorators: [{
425
+ type: Directive,
426
+ args: [{
427
+ selector: "[raqm-toast-content]",
428
+ host: { class: "raqm-toast-content" }
429
+ }]
430
+ }]
431
+ });
432
+ var RaqmToastDescriptionDirective = class RaqmToastDescriptionDirective {
433
+ static ɵfac = i0.ɵɵngDeclareFactory({
434
+ minVersion: "12.0.0",
435
+ version: "22.2.2",
436
+ ngImport: i0,
437
+ type: RaqmToastDescriptionDirective,
438
+ deps: [],
439
+ target: i0.ɵɵFactoryTarget.Directive
440
+ });
441
+ static ɵdir = i0.ɵɵngDeclareDirective({
442
+ minVersion: "14.0.0",
443
+ version: "22.2.2",
444
+ type: RaqmToastDescriptionDirective,
445
+ isStandalone: true,
446
+ selector: "[raqm-toast-description]",
447
+ host: { classAttribute: "raqm-toast-description" },
448
+ ngImport: i0
449
+ });
450
+ };
451
+ i0.ɵɵngDeclareClassMetadata({
452
+ minVersion: "12.0.0",
453
+ version: "22.2.2",
454
+ ngImport: i0,
455
+ type: RaqmToastDescriptionDirective,
456
+ decorators: [{
457
+ type: Directive,
458
+ args: [{
459
+ selector: "[raqm-toast-description]",
460
+ host: { class: "raqm-toast-description" }
461
+ }]
462
+ }]
463
+ });
464
+ var RaqmToastActionDirective = class RaqmToastActionDirective {
465
+ constructor() {
466
+ const element = inject(ElementRef).nativeElement;
467
+ if (!element.hasAttribute("type")) element.type = "button";
468
+ }
469
+ static ɵfac = i0.ɵɵngDeclareFactory({
470
+ minVersion: "12.0.0",
471
+ version: "22.2.2",
472
+ ngImport: i0,
473
+ type: RaqmToastActionDirective,
474
+ deps: [],
475
+ target: i0.ɵɵFactoryTarget.Directive
476
+ });
477
+ static ɵdir = i0.ɵɵngDeclareDirective({
478
+ minVersion: "14.0.0",
479
+ version: "22.2.2",
480
+ type: RaqmToastActionDirective,
481
+ isStandalone: true,
482
+ selector: "button[raqm-toast-action]",
483
+ host: {
484
+ attributes: {
485
+ "data-raqm-variant": "outline",
486
+ "data-raqm-size": "sm"
487
+ },
488
+ classAttribute: "raqm-toast-action raqm-button"
489
+ },
490
+ ngImport: i0
491
+ });
492
+ };
493
+ i0.ɵɵngDeclareClassMetadata({
494
+ minVersion: "12.0.0",
495
+ version: "22.2.2",
496
+ ngImport: i0,
497
+ type: RaqmToastActionDirective,
498
+ decorators: [{
499
+ type: Directive,
500
+ args: [{
501
+ selector: "button[raqm-toast-action]",
502
+ host: {
503
+ class: "raqm-toast-action raqm-button",
504
+ "data-raqm-variant": "outline",
505
+ "data-raqm-size": "sm"
506
+ }
507
+ }]
508
+ }],
509
+ ctorParameters: () => []
510
+ });
511
+ var RaqmToastCloseComponent = class RaqmToastCloseComponent {
512
+ root = inject(RaqmToastComponent);
513
+ constructor() {
514
+ const element = inject(ElementRef).nativeElement;
515
+ if (!element.hasAttribute("type")) element.type = "button";
516
+ }
517
+ static ɵfac = i0.ɵɵngDeclareFactory({
518
+ minVersion: "12.0.0",
519
+ version: "22.2.2",
520
+ ngImport: i0,
521
+ type: RaqmToastCloseComponent,
522
+ deps: [],
523
+ target: i0.ɵɵFactoryTarget.Component
524
+ });
525
+ static ɵcmp = i0.ɵɵngDeclareComponent({
526
+ minVersion: "14.0.0",
527
+ version: "22.2.2",
528
+ type: RaqmToastCloseComponent,
529
+ isStandalone: true,
530
+ selector: "button[raqm-toast-close]",
531
+ host: {
532
+ attributes: {
533
+ "data-raqm-variant": "ghost",
534
+ "data-raqm-size": "icon-sm"
535
+ },
536
+ listeners: { "click": "root.dismiss()" },
537
+ classAttribute: "raqm-toast-close raqm-button"
538
+ },
539
+ ngImport: i0,
540
+ template: "<ng-content><svg viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" aria-hidden=\"true\" focusable=\"false\"><path d=\"m18 6-12 12M6 6l12 12\" /></svg></ng-content>",
541
+ isInline: true,
542
+ styles: [""],
543
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
544
+ });
545
+ };
546
+ i0.ɵɵngDeclareClassMetadata({
547
+ minVersion: "12.0.0",
548
+ version: "22.2.2",
549
+ ngImport: i0,
550
+ type: RaqmToastCloseComponent,
551
+ decorators: [{
552
+ type: Component,
553
+ args: [{
554
+ selector: "button[raqm-toast-close]",
555
+ template: "<ng-content><svg viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" aria-hidden=\"true\" focusable=\"false\"><path d=\"m18 6-12 12M6 6l12 12\" /></svg></ng-content>",
556
+ changeDetection: ChangeDetectionStrategy.OnPush,
557
+ host: {
558
+ class: "raqm-toast-close raqm-button",
559
+ "data-raqm-variant": "ghost",
560
+ "data-raqm-size": "icon-sm",
561
+ "(click)": "root.dismiss()"
562
+ }
563
+ }]
564
+ }],
565
+ ctorParameters: () => []
566
+ });
567
+ var RaqmToastIconComponent = class RaqmToastIconComponent {
568
+ type = input(...ngDevMode ? [void 0, { debugName: "type" }] : /* istanbul ignore next */ []);
569
+ static ɵfac = i0.ɵɵngDeclareFactory({
570
+ minVersion: "12.0.0",
571
+ version: "22.2.2",
572
+ ngImport: i0,
573
+ type: RaqmToastIconComponent,
574
+ deps: [],
575
+ target: i0.ɵɵFactoryTarget.Component
576
+ });
577
+ static ɵcmp = i0.ɵɵngDeclareComponent({
578
+ minVersion: "17.0.0",
579
+ version: "22.2.2",
580
+ type: RaqmToastIconComponent,
581
+ isStandalone: true,
582
+ selector: "raqm-toast-icon",
583
+ inputs: { type: {
584
+ classPropertyName: "type",
585
+ publicName: "type",
586
+ isSignal: true,
587
+ isRequired: false,
588
+ transformFunction: null
589
+ } },
590
+ host: {
591
+ attributes: { "aria-hidden": "true" },
592
+ properties: { "attr.data-raqm-type": "type()" },
593
+ classAttribute: "raqm-toast-icon"
594
+ },
595
+ ngImport: i0,
596
+ template: "@if (type()) {\n <svg\n viewBox=\"0 0 24 24\"\n width=\"16\"\n height=\"16\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n focusable=\"false\"\n >\n @switch (type()) {\n @case ('success') {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m9 12 2 2 4-4\" />\n }\n @case ('info') {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4M12 8h.01\" />\n }\n @case ('warning') {\n <path\n d=\"m10.3 3.9-8.1 14A2 2 0 0 0 3.9 21h16.2a2 2 0 0 0 1.7-3.1l-8.1-14a2 2 0 0 0-3.4 0ZM12 9v4M12 17h.01\"\n />\n }\n @case ('error') {\n <path d=\"m7.86 2-5.86 5.86v8.28l5.86 5.86h8.28l5.86-5.86V7.86L16.14 2ZM9 9l6 6M15 9l-6 6\" />\n }\n @case ('loading') {\n <path d=\"M12 2a10 10 0 1 1-7.07 2.93\" />\n }\n }\n </svg>\n}\n",
597
+ styles: [""],
598
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
599
+ });
600
+ };
601
+ i0.ɵɵngDeclareClassMetadata({
602
+ minVersion: "12.0.0",
603
+ version: "22.2.2",
604
+ ngImport: i0,
605
+ type: RaqmToastIconComponent,
606
+ decorators: [{
607
+ type: Component,
608
+ args: [{
609
+ selector: "raqm-toast-icon",
610
+ changeDetection: ChangeDetectionStrategy.OnPush,
611
+ host: {
612
+ class: "raqm-toast-icon",
613
+ "aria-hidden": "true",
614
+ "[attr.data-raqm-type]": "type()"
615
+ },
616
+ template: "@if (type()) {\n <svg\n viewBox=\"0 0 24 24\"\n width=\"16\"\n height=\"16\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n focusable=\"false\"\n >\n @switch (type()) {\n @case ('success') {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m9 12 2 2 4-4\" />\n }\n @case ('info') {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4M12 8h.01\" />\n }\n @case ('warning') {\n <path\n d=\"m10.3 3.9-8.1 14A2 2 0 0 0 3.9 21h16.2a2 2 0 0 0 1.7-3.1l-8.1-14a2 2 0 0 0-3.4 0ZM12 9v4M12 17h.01\"\n />\n }\n @case ('error') {\n <path d=\"m7.86 2-5.86 5.86v8.28l5.86 5.86h8.28l5.86-5.86V7.86L16.14 2ZM9 9l6 6M15 9l-6 6\" />\n }\n @case ('loading') {\n <path d=\"M12 2a10 10 0 1 1-7.07 2.93\" />\n }\n }\n </svg>\n}\n"
617
+ }]
618
+ }],
619
+ propDecorators: { type: [{
620
+ type: i0.Input,
621
+ args: [{
622
+ isSignal: true,
623
+ alias: "type",
624
+ required: false
625
+ }]
626
+ }] }
627
+ });
628
+ var RaqmToasterComponent = class RaqmToasterComponent {
629
+ label = input.required(...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
630
+ closeLabel = input.required(...ngDevMode ? [{ debugName: "closeLabel" }] : /* istanbul ignore next */ []);
631
+ service = inject(RaqmToastService);
632
+ document = inject(DOCUMENT);
633
+ overlay = inject(Overlay);
634
+ container = inject(ViewContainerRef);
635
+ host = inject(ElementRef);
636
+ panel = viewChild.required("panel", ...ngDevMode ? [{ debugName: "panel" }] : /* istanbul ignore next */ []);
637
+ overlayRef;
638
+ observer;
639
+ announcementTimer;
640
+ previousFocus = null;
641
+ hovered = false;
642
+ focused = false;
643
+ swiping = false;
644
+ indices = /* @__PURE__ */ new Map();
645
+ expanded = signal(false, ...ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []);
646
+ announcement = signal("", ...ngDevMode ? [{ debugName: "announcement" }] : /* istanbul ignore next */ []);
647
+ ready = signal(false, ...ngDevMode ? [{ debugName: "ready" }] : /* istanbul ignore next */ []);
648
+ announcementKey = computed(() => this.service.visibleToasts().map((t) => `${t.id}:${t.updateKey}`).join("|"), ...ngDevMode ? [{ debugName: "announcementKey" }] : /* istanbul ignore next */ []);
649
+ announced = /* @__PURE__ */ new Map();
650
+ pendingAnnouncements = /* @__PURE__ */ new Map();
651
+ constructor() {
652
+ afterNextRender(() => {
653
+ if (!this.service.claimViewport(this)) return;
654
+ const dir = this.document.defaultView?.getComputedStyle(this.host.nativeElement).direction === "rtl" ? "rtl" : "ltr";
655
+ this.overlayRef = this.overlay.create({
656
+ positionStrategy: this.overlay.position().global(),
657
+ scrollStrategy: this.overlay.scrollStrategies.noop(),
658
+ hasBackdrop: false,
659
+ panelClass: "raqm-toast-overlay-pane",
660
+ direction: dir
661
+ });
662
+ this.overlayRef.overlayElement.style.pointerEvents = "none";
663
+ this.overlayRef.attach(new TemplatePortal(this.panel(), this.container));
664
+ this.document.addEventListener("keydown", this.onDocumentKeydown);
665
+ if (typeof ResizeObserver !== "undefined") this.observer = new ResizeObserver(() => this.measure());
666
+ this.ready.set(true);
667
+ });
668
+ afterEveryRender(() => {
669
+ const pane = this.overlayRef?.overlayElement;
670
+ if (!pane) return;
671
+ const retained = new Set(this.service.renderedToasts().map((t) => t.id));
672
+ for (const id of this.indices.keys()) if (!retained.has(id)) this.indices.delete(id);
673
+ const dir = this.document.defaultView?.getComputedStyle(this.host.nativeElement).direction === "rtl" ? "rtl" : "ltr";
674
+ this.overlayRef?.setDirection(dir);
675
+ this.observer?.disconnect();
676
+ pane.querySelectorAll(".raqm-toast-content").forEach((element) => this.observer?.observe(element));
677
+ this.measure();
678
+ });
679
+ effect(() => {
680
+ const toasts = this.service.visibleToasts();
681
+ untracked(() => this.ensureFocus(toasts));
682
+ });
683
+ effect(() => {
684
+ this.announcementKey();
685
+ if (!this.ready()) return;
686
+ untracked(() => {
687
+ const fresh = this.service.visibleToasts().filter((t) => this.announced.get(t.id) !== t.updateKey);
688
+ this.announced = new Map(this.service.visibleToasts().map((t) => [t.id, t.updateKey]));
689
+ if (!fresh.length) return;
690
+ for (const toast of fresh) this.pendingAnnouncements.set(toast.id, toast);
691
+ if (this.announcementTimer !== void 0) clearTimeout(this.announcementTimer);
692
+ this.announcement.set("");
693
+ this.announcementTimer = setTimeout(() => {
694
+ this.announcementTimer = void 0;
695
+ this.announcement.set(Array.from(this.pendingAnnouncements.values()).filter((t) => this.service.visibleToasts().some((current) => current.id === t.id && current.updateKey === t.updateKey)).map((t) => [t.title, t.description].filter(Boolean).join(". ")).join(". "));
696
+ this.pendingAnnouncements.clear();
697
+ }, 100);
698
+ });
699
+ });
700
+ }
701
+ ngOnDestroy() {
702
+ this.restoreFocus();
703
+ this.document.removeEventListener("keydown", this.onDocumentKeydown);
704
+ this.observer?.disconnect();
705
+ if (this.announcementTimer !== void 0) clearTimeout(this.announcementTimer);
706
+ this.overlayRef?.dispose();
707
+ this.service.releaseViewport(this);
708
+ }
709
+ hover(value) {
710
+ this.hovered = value;
711
+ this.syncPause();
712
+ }
713
+ focusIn(event) {
714
+ const previous = event.relatedTarget;
715
+ if (previous && !this.overlayRef?.overlayElement.contains(previous)) this.previousFocus = previous;
716
+ this.focused = true;
717
+ this.syncPause();
718
+ }
719
+ focusOut(event) {
720
+ this.focused = !!event.relatedTarget && !!this.overlayRef?.overlayElement.contains(event.relatedTarget);
721
+ this.syncPause();
722
+ }
723
+ action(toast, event) {
724
+ toast.action?.onClick(toast.id, event);
725
+ }
726
+ toastIndex(toast) {
727
+ if (!toast.ending) this.indices.set(toast.id, Math.max(0, this.service.visibleToasts().findIndex((t) => t.id === toast.id)));
728
+ return this.indices.get(toast.id) ?? 0;
729
+ }
730
+ swipe(value) {
731
+ this.swiping = value;
732
+ this.syncPause();
733
+ }
734
+ syncPause() {
735
+ this.expanded.set(this.hovered || this.focused);
736
+ this.overlayRef?.overlayElement.querySelectorAll(".raqm-toast").forEach((root) => {
737
+ root.toggleAttribute("data-raqm-expanded", this.hovered || this.focused);
738
+ });
739
+ this.service.pauseViewport(this, this.hovered || this.focused || this.swiping);
740
+ }
741
+ measure() {
742
+ const viewport = this.overlayRef?.overlayElement.querySelector(".raqm-toast-viewport");
743
+ const roots = Array.from(viewport?.querySelectorAll(".raqm-toast:not([data-raqm-ending-style])") ?? []);
744
+ const frontHeight = roots[0]?.querySelector(".raqm-toast-content")?.offsetHeight;
745
+ if (viewport && frontHeight) viewport.style.setProperty("--toast-frontmost-height", `${frontHeight + 2}px`);
746
+ let offset = 0;
747
+ for (const root of roots) {
748
+ root.style.setProperty("--toast-offset-y", `${offset}px`);
749
+ offset += (root.querySelector(".raqm-toast-content")?.offsetHeight ?? 0) + 2;
750
+ }
751
+ }
752
+ ensureFocus(toasts) {
753
+ const root = this.document.activeElement?.closest(".raqm-toast");
754
+ if (!root || !this.overlayRef?.overlayElement.contains(root)) return;
755
+ if (toasts.some((t) => t.id === root.dataset["raqmToastId"])) return;
756
+ const next = Array.from(this.overlayRef.overlayElement.querySelectorAll(".raqm-toast")).find((element) => element !== root && toasts.some((t) => t.id === element.dataset["raqmToastId"]));
757
+ if (toasts.length && next) next.focus();
758
+ else this.restoreFocus();
759
+ }
760
+ restoreFocus() {
761
+ if (!this.overlayRef?.overlayElement.contains(this.document.activeElement)) return;
762
+ if (this.previousFocus?.isConnected && !this.previousFocus.closest("[inert]") && !this.previousFocus.matches(":disabled")) this.previousFocus.focus({ preventScroll: true });
763
+ else this.document.activeElement?.blur();
764
+ this.focused = false;
765
+ this.syncPause();
766
+ }
767
+ onDocumentKeydown = (event) => {
768
+ if (event.key !== "F6" || !this.service.visibleToasts().length) return;
769
+ event.preventDefault();
770
+ if (this.overlayRef?.overlayElement.contains(this.document.activeElement)) this.restoreFocus();
771
+ else {
772
+ this.previousFocus = this.document.activeElement;
773
+ this.overlayRef?.overlayElement.querySelector(".raqm-toast")?.focus();
774
+ }
775
+ };
776
+ static ɵfac = i0.ɵɵngDeclareFactory({
777
+ minVersion: "12.0.0",
778
+ version: "22.2.2",
779
+ ngImport: i0,
780
+ type: RaqmToasterComponent,
781
+ deps: [],
782
+ target: i0.ɵɵFactoryTarget.Component
783
+ });
784
+ static ɵcmp = i0.ɵɵngDeclareComponent({
785
+ minVersion: "17.0.0",
786
+ version: "22.2.2",
787
+ type: RaqmToasterComponent,
788
+ isStandalone: true,
789
+ selector: "raqm-toaster",
790
+ inputs: {
791
+ label: {
792
+ classPropertyName: "label",
793
+ publicName: "label",
794
+ isSignal: true,
795
+ isRequired: true,
796
+ transformFunction: null
797
+ },
798
+ closeLabel: {
799
+ classPropertyName: "closeLabel",
800
+ publicName: "closeLabel",
801
+ isSignal: true,
802
+ isRequired: true,
803
+ transformFunction: null
804
+ }
805
+ },
806
+ viewQueries: [{
807
+ propertyName: "panel",
808
+ first: true,
809
+ predicate: ["panel"],
810
+ descendants: true,
811
+ isSignal: true
812
+ }],
813
+ ngImport: i0,
814
+ template: "<ng-template #panel>\r\n <section\r\n class=\"raqm-toast-viewport\"\r\n [attr.aria-label]=\"label()\"\r\n tabindex=\"-1\"\r\n (mouseenter)=\"hover(true)\"\r\n (mouseleave)=\"hover(false)\"\r\n (focusin)=\"focusIn($event)\"\r\n (focusout)=\"focusOut($event)\"\r\n >\r\n <div class=\"raqm-toast-announcer\" aria-live=\"polite\" aria-atomic=\"true\">\r\n {{ announcement() }}\r\n </div>\r\n @for (toast of service.renderedToasts(); track toast.id) {\r\n <raqm-toast\r\n [toast]=\"toast\"\r\n (swipingChange)=\"swipe($event)\"\r\n [attr.data-raqm-toast-id]=\"toast.id\"\r\n [style.--toast-index]=\"toastIndex(toast)\"\r\n [attr.data-raqm-ending-style]=\"toast.ending ? '' : null\"\r\n [attr.inert]=\"toast.ending ? '' : null\"\r\n [attr.aria-hidden]=\"toast.ending ? 'true' : null\"\r\n [attr.data-raqm-expanded]=\"expanded() ? '' : null\"\r\n [attr.data-raqm-behind]=\"toastIndex(toast) > 0 ? '' : null\"\r\n [attr.aria-labelledby]=\"toast.title ? toast.id + '-title' : null\"\r\n [attr.aria-describedby]=\"toast.description ? toast.id + '-description' : null\"\r\n >\r\n <div raqm-toast-content>\r\n @if (toast.type) {\r\n <raqm-toast-icon [type]=\"toast.type\" />\r\n }\r\n <div class=\"raqm-toast-text\">\r\n @if (toast.title) {\r\n <h2 raqm-toast-title [id]=\"toast.id + '-title'\">{{ toast.title }}</h2>\r\n }\r\n @if (toast.description) {\r\n <p raqm-toast-description [id]=\"toast.id + '-description'\">{{ toast.description }}</p>\r\n }\r\n </div>\r\n @if (toast.action; as actionOptions) {\r\n <button\r\n raqm-toast-action\r\n [disabled]=\"actionOptions.disabled ?? false\"\r\n (click)=\"action(toast, $event)\"\r\n >\r\n {{ actionOptions.label }}\r\n </button>\r\n }\r\n <button raqm-toast-close [attr.aria-label]=\"closeLabel()\"></button>\r\n </div>\r\n </raqm-toast>\r\n }\r\n </section>\r\n</ng-template>\r\n",
815
+ styles: [":host{display:contents}.raqm-toast-viewport{position:fixed;inset-inline:1rem;inset-block-end:1rem;z-index:50;inline-size:auto;max-inline-size:24rem;margin-inline:auto;outline:none;pointer-events:none}.raqm-toast-announcer{position:absolute;inline-size:1px;block-size:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}@media(min-width:640px){.raqm-toast-viewport{inset-inline-start:auto;inline-size:100%;margin-inline:0}}\n"],
816
+ dependencies: [
817
+ {
818
+ kind: "component",
819
+ type: RaqmToastComponent,
820
+ selector: "raqm-toast",
821
+ inputs: ["toast"],
822
+ outputs: ["swipingChange"]
823
+ },
824
+ {
825
+ kind: "directive",
826
+ type: RaqmToastActionDirective,
827
+ selector: "button[raqm-toast-action]"
828
+ },
829
+ {
830
+ kind: "component",
831
+ type: RaqmToastCloseComponent,
832
+ selector: "button[raqm-toast-close]"
833
+ },
834
+ {
835
+ kind: "directive",
836
+ type: RaqmToastContentDirective,
837
+ selector: "[raqm-toast-content]"
838
+ },
839
+ {
840
+ kind: "directive",
841
+ type: RaqmToastDescriptionDirective,
842
+ selector: "[raqm-toast-description]"
843
+ },
844
+ {
845
+ kind: "component",
846
+ type: RaqmToastIconComponent,
847
+ selector: "raqm-toast-icon",
848
+ inputs: ["type"]
849
+ },
850
+ {
851
+ kind: "directive",
852
+ type: RaqmToastTitleDirective,
853
+ selector: "[raqm-toast-title]"
854
+ }
855
+ ],
856
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
857
+ });
858
+ };
859
+ i0.ɵɵngDeclareClassMetadata({
860
+ minVersion: "12.0.0",
861
+ version: "22.2.2",
862
+ ngImport: i0,
863
+ type: RaqmToasterComponent,
864
+ decorators: [{
865
+ type: Component,
866
+ args: [{
867
+ imports: [
868
+ RaqmToastComponent,
869
+ RaqmToastActionDirective,
870
+ RaqmToastCloseComponent,
871
+ RaqmToastContentDirective,
872
+ RaqmToastDescriptionDirective,
873
+ RaqmToastIconComponent,
874
+ RaqmToastTitleDirective
875
+ ],
876
+ selector: "raqm-toaster",
877
+ changeDetection: ChangeDetectionStrategy.OnPush,
878
+ template: "<ng-template #panel>\r\n <section\r\n class=\"raqm-toast-viewport\"\r\n [attr.aria-label]=\"label()\"\r\n tabindex=\"-1\"\r\n (mouseenter)=\"hover(true)\"\r\n (mouseleave)=\"hover(false)\"\r\n (focusin)=\"focusIn($event)\"\r\n (focusout)=\"focusOut($event)\"\r\n >\r\n <div class=\"raqm-toast-announcer\" aria-live=\"polite\" aria-atomic=\"true\">\r\n {{ announcement() }}\r\n </div>\r\n @for (toast of service.renderedToasts(); track toast.id) {\r\n <raqm-toast\r\n [toast]=\"toast\"\r\n (swipingChange)=\"swipe($event)\"\r\n [attr.data-raqm-toast-id]=\"toast.id\"\r\n [style.--toast-index]=\"toastIndex(toast)\"\r\n [attr.data-raqm-ending-style]=\"toast.ending ? '' : null\"\r\n [attr.inert]=\"toast.ending ? '' : null\"\r\n [attr.aria-hidden]=\"toast.ending ? 'true' : null\"\r\n [attr.data-raqm-expanded]=\"expanded() ? '' : null\"\r\n [attr.data-raqm-behind]=\"toastIndex(toast) > 0 ? '' : null\"\r\n [attr.aria-labelledby]=\"toast.title ? toast.id + '-title' : null\"\r\n [attr.aria-describedby]=\"toast.description ? toast.id + '-description' : null\"\r\n >\r\n <div raqm-toast-content>\r\n @if (toast.type) {\r\n <raqm-toast-icon [type]=\"toast.type\" />\r\n }\r\n <div class=\"raqm-toast-text\">\r\n @if (toast.title) {\r\n <h2 raqm-toast-title [id]=\"toast.id + '-title'\">{{ toast.title }}</h2>\r\n }\r\n @if (toast.description) {\r\n <p raqm-toast-description [id]=\"toast.id + '-description'\">{{ toast.description }}</p>\r\n }\r\n </div>\r\n @if (toast.action; as actionOptions) {\r\n <button\r\n raqm-toast-action\r\n [disabled]=\"actionOptions.disabled ?? false\"\r\n (click)=\"action(toast, $event)\"\r\n >\r\n {{ actionOptions.label }}\r\n </button>\r\n }\r\n <button raqm-toast-close [attr.aria-label]=\"closeLabel()\"></button>\r\n </div>\r\n </raqm-toast>\r\n }\r\n </section>\r\n</ng-template>\r\n",
879
+ styles: [":host{display:contents}.raqm-toast-viewport{position:fixed;inset-inline:1rem;inset-block-end:1rem;z-index:50;inline-size:auto;max-inline-size:24rem;margin-inline:auto;outline:none;pointer-events:none}.raqm-toast-announcer{position:absolute;inline-size:1px;block-size:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}@media(min-width:640px){.raqm-toast-viewport{inset-inline-start:auto;inline-size:100%;margin-inline:0}}\n"]
880
+ }]
881
+ }],
882
+ ctorParameters: () => [],
883
+ propDecorators: {
884
+ label: [{
885
+ type: i0.Input,
886
+ args: [{
887
+ isSignal: true,
888
+ alias: "label",
889
+ required: true
890
+ }]
891
+ }],
892
+ closeLabel: [{
893
+ type: i0.Input,
894
+ args: [{
895
+ isSignal: true,
896
+ alias: "closeLabel",
897
+ required: true
898
+ }]
899
+ }],
900
+ panel: [{
901
+ type: i0.ViewChild,
902
+ args: ["panel", { isSignal: true }]
903
+ }]
904
+ }
905
+ });
906
+ const RaqmToast = [
907
+ RaqmToastComponent,
908
+ RaqmToastTitleDirective,
909
+ RaqmToastContentDirective,
910
+ RaqmToastDescriptionDirective,
911
+ RaqmToastActionDirective,
912
+ RaqmToastCloseComponent,
913
+ RaqmToastIconComponent,
914
+ RaqmToasterComponent
915
+ ];
916
+ export { RaqmToast, RaqmToastActionDirective, RaqmToastCloseComponent, RaqmToastComponent, RaqmToastContentDirective, RaqmToastDescriptionDirective, RaqmToastIconComponent, RaqmToastService, RaqmToastTitleDirective, RaqmToasterComponent };
917
+
918
+ //# sourceMappingURL=raqm-ui-toast.mjs.map