@midas-ds/components 1.1.0 → 1.3.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 (183) hide show
  1. package/CHANGELOG.md +63 -1
  2. package/accordion/AccordionItem.d.ts +2 -2
  3. package/index.cjs +138 -0
  4. package/index.css +1 -0
  5. package/index.d.ts +0 -2
  6. package/index.js +27094 -105
  7. package/package.json +22 -4
  8. package/table/Table.d.ts +3 -4
  9. package/textfield/TextField.d.ts +15 -4
  10. package/theme.cjs +1 -0
  11. package/theme.js +20 -0
  12. package/tokens-BskyMDHv.cjs +1 -0
  13. package/Breadcrumbs.css +0 -1
  14. package/Button-DL6nqUco.js +0 -182
  15. package/Button.css +0 -1
  16. package/ButtonGroup.css +0 -1
  17. package/Card.css +0 -1
  18. package/Checkbox-q0dugR2t.js +0 -402
  19. package/Checkbox.css +0 -1
  20. package/Collection-KMFfVuzU.js +0 -510
  21. package/ComboBox.css +0 -1
  22. package/DatePicker.css +0 -1
  23. package/Dialog-D6Bqrpn-.js +0 -1952
  24. package/Disclosure-dAZYXyTH.js +0 -225
  25. package/Disclosure.css +0 -1
  26. package/DragAndDrop-B0T3WgjL.js +0 -40
  27. package/Dropdown.css +0 -1
  28. package/FileUpload.css +0 -1
  29. package/Flex.css +0 -1
  30. package/Flex.module-CpoxBzQX.js +0 -37
  31. package/FocusScope-B7CkxXNC.js +0 -513
  32. package/Form-BWBjJC6v.js +0 -238
  33. package/Grid.css +0 -1
  34. package/Grid.module-Ia0e9Dix.js +0 -36
  35. package/Group-D7_8007y.js +0 -42
  36. package/Heading-RCRHv6hd.js +0 -15
  37. package/Hidden-CVlUgUJM.js +0 -37
  38. package/InfoBanner.css +0 -1
  39. package/Layout.css +0 -1
  40. package/Link-BnQvB-hH.js +0 -75
  41. package/Link.css +0 -1
  42. package/LinkButton.css +0 -1
  43. package/ListBox-DBBiqvcR.js +0 -474
  44. package/ListKeyboardDelegate-gCXy-Xnn.js +0 -172
  45. package/Logo.css +0 -1
  46. package/Modal.css +0 -1
  47. package/MultiSelect.css +0 -1
  48. package/PressResponder-B4g56kDz.js +0 -31
  49. package/RSPContexts-BW2SEIqe.js +0 -11
  50. package/Radio.css +0 -1
  51. package/SearchField.css +0 -1
  52. package/Select.css +0 -1
  53. package/SelectionManager-BfXUE1qg.js +0 -1031
  54. package/Separator-BBX9m2O2.js +0 -49
  55. package/Spinner.css +0 -1
  56. package/Table.css +0 -1
  57. package/Tabs.css +0 -1
  58. package/Tag-DWt0koFj.js +0 -728
  59. package/Tag.css +0 -1
  60. package/Text-BCF0xvqL.js +0 -15
  61. package/TextArea.css +0 -1
  62. package/TextField-CX4eOQf6.js +0 -225
  63. package/TextField.css +0 -1
  64. package/TextField.module-DdICj682.js +0 -143
  65. package/Toast.css +0 -1
  66. package/VisuallyHidden-Dhr5caPC.js +0 -39
  67. package/chevron-down-Cd1bkzXT.js +0 -13
  68. package/chevron-right-DBMc9VMi.js +0 -23
  69. package/clsx-OuTLNxxd.js +0 -16
  70. package/context-BpJLnOuu.js +0 -80
  71. package/createLucideIcon-DeWljiyi.js +0 -79
  72. package/index-B-jHjTDC.js +0 -120
  73. package/index-BPdc9gJ8.js +0 -3122
  74. package/index-KSgQWWiy.js +0 -26984
  75. package/index10.js +0 -4
  76. package/index11.js +0 -5
  77. package/index12.js +0 -4
  78. package/index13.js +0 -4
  79. package/index14.js +0 -4
  80. package/index15.js +0 -6
  81. package/index16.js +0 -6
  82. package/index17.js +0 -6
  83. package/index18.js +0 -4
  84. package/index19.js +0 -6
  85. package/index2.js +0 -8
  86. package/index20.js +0 -6
  87. package/index21.js +0 -4
  88. package/index22.js +0 -5
  89. package/index23.js +0 -5
  90. package/index24.js +0 -5
  91. package/index25.js +0 -6
  92. package/index26.js +0 -6
  93. package/index27.js +0 -6
  94. package/index28.js +0 -4
  95. package/index29.js +0 -6
  96. package/index3.js +0 -6
  97. package/index30.js +0 -21
  98. package/index31.js +0 -22
  99. package/index32.js +0 -14
  100. package/index33.js +0 -11
  101. package/index34.js +0 -31
  102. package/index35.js +0 -8
  103. package/index36.js +0 -9
  104. package/index37.js +0 -19
  105. package/index38.js +0 -9
  106. package/index39.js +0 -9
  107. package/index4.js +0 -4
  108. package/index40.js +0 -23
  109. package/index41.js +0 -63
  110. package/index42.js +0 -53
  111. package/index43.js +0 -18
  112. package/index44.js +0 -27
  113. package/index45.js +0 -18
  114. package/index46.js +0 -21
  115. package/index47.js +0 -49
  116. package/index48.js +0 -5
  117. package/index49.js +0 -25
  118. package/index5.js +0 -5
  119. package/index50.js +0 -18
  120. package/index51.js +0 -9
  121. package/index52.js +0 -25
  122. package/index53.js +0 -18
  123. package/index54.js +0 -11
  124. package/index55.js +0 -12
  125. package/index56.js +0 -15
  126. package/index57.js +0 -9
  127. package/index58.js +0 -9
  128. package/index59.js +0 -19
  129. package/index6.js +0 -4
  130. package/index60.js +0 -22
  131. package/index61.js +0 -61
  132. package/index62.js +0 -15
  133. package/index63.js +0 -11
  134. package/index64.js +0 -53
  135. package/index65.js +0 -85
  136. package/index66.js +0 -74
  137. package/index67.js +0 -24
  138. package/index68.js +0 -69
  139. package/index69.js +0 -80
  140. package/index7.js +0 -9
  141. package/index70.js +0 -140
  142. package/index71.js +0 -70
  143. package/index72.js +0 -42
  144. package/index73.js +0 -82
  145. package/index74.js +0 -71
  146. package/index75.js +0 -104
  147. package/index76.js +0 -275
  148. package/index77.js +0 -723
  149. package/index78.js +0 -489
  150. package/index79.js +0 -314
  151. package/index8.js +0 -4
  152. package/index80.js +0 -389
  153. package/index81.js +0 -252
  154. package/index82.js +0 -1364
  155. package/index83.js +0 -1009
  156. package/index84.js +0 -386
  157. package/index85.js +0 -2101
  158. package/index86.js +0 -2368
  159. package/index87.js +0 -6831
  160. package/index88.js +0 -17
  161. package/index89.js +0 -14
  162. package/index9.js +0 -5
  163. package/index90.js +0 -6
  164. package/index91.js +0 -9
  165. package/intlStrings-Cd44R5hT.js +0 -278
  166. package/react.esm-sMU8Z7rL.js +0 -11060
  167. package/triangle-alert-1OYl9KWz.js +0 -56
  168. package/useControlledState-Kv9K2AYu.js +0 -30
  169. package/useDescription-B7stiK3j.js +0 -32
  170. package/useEvent-Xk5kn5Ns.js +0 -21
  171. package/useField-DMzJIIN4.js +0 -67
  172. package/useFilter-Bt9dbV1U.js +0 -35
  173. package/useFocusRing-9PXyKy2A.js +0 -1297
  174. package/useFocusable-CcEBZe40.js +0 -59
  175. package/useGridSelectionCheckbox-DYgEnElE.js +0 -22
  176. package/useHasTabbableChild-D6DwR81L.js +0 -34
  177. package/useHighlightSelectionDescription-WYAbP4No.js +0 -552
  178. package/useLabels-9zaZ9oa0.js +0 -17
  179. package/useListState-BfTeKTk5.js +0 -119
  180. package/useLocalizedStringFormatter-BlCbn-hX.js +0 -96
  181. package/useSingleSelectListState-DPkaL0la.js +0 -34
  182. package/useUpdateEffect-Dtz-i14F.js +0 -12
  183. package/x-JK7i-TQC.js +0 -14
package/index83.js DELETED
@@ -1,1009 +0,0 @@
1
- import { jsx as h, jsxs as E, Fragment as he } from "react/jsx-runtime";
2
- import { Button as $e } from "./index66.js";
3
- import { c as pe } from "./clsx-OuTLNxxd.js";
4
- import y, { useEffect as v, useState as ve, useCallback as T, useRef as x, useMemo as xe } from "react";
5
- import { k as ke, C as Ee, l as A, b as Te, N as k, f as ge, x as L, e as ye } from "./useFocusRing-9PXyKy2A.js";
6
- import { $ as w } from "./useLocalizedStringFormatter-BlCbn-hX.js";
7
- import { s as I } from "./index-B-jHjTDC.js";
8
- import { createPortal as _e } from "react-dom";
9
- import { X as Le } from "./x-JK7i-TQC.js";
10
- import { C as Be, I as Ae, a as we, T as Ie } from "./triangle-alert-1OYl9KWz.js";
11
- import './Toast.css';var C = {};
12
- C = {
13
- close: "إغلاق",
14
- notifications: (n, e) => `${e.plural(n.count, {
15
- one: () => `${e.number(n.count)} إشعار`,
16
- other: () => `${e.number(n.count)} إشعارات`
17
- })}.`
18
- };
19
- var P = {};
20
- P = {
21
- close: "Затвори",
22
- notifications: (n, e) => `${e.plural(n.count, {
23
- one: () => `${e.number(n.count)} известие`,
24
- other: () => `${e.number(n.count)} известия`
25
- })}.`
26
- };
27
- var F = {};
28
- F = {
29
- close: "Zavřít",
30
- notifications: (n, e) => `${e.plural(n.count, {
31
- one: () => `${e.number(n.count)} oznámení`,
32
- other: () => `${e.number(n.count)} oznámení`
33
- })}.`
34
- };
35
- var R = {};
36
- R = {
37
- close: "Luk",
38
- notifications: (n, e) => `${e.plural(n.count, {
39
- one: () => `${e.number(n.count)} besked`,
40
- other: () => `${e.number(n.count)} beskeder`
41
- })}.`
42
- };
43
- var N = {};
44
- N = {
45
- close: "Schließen",
46
- notifications: (n, e) => `${e.plural(n.count, {
47
- one: () => `${e.number(n.count)} Benachrichtigung`,
48
- other: () => `${e.number(n.count)} Benachrichtigungen`
49
- })}.`
50
- };
51
- var S = {};
52
- S = {
53
- close: "Κλείσιμο",
54
- notifications: (n, e) => `${e.plural(n.count, {
55
- one: () => `${e.number(n.count)} ειδοποίηση`,
56
- other: () => `${e.number(n.count)} ειδοποιήσεις`
57
- })}.`
58
- };
59
- var D = {};
60
- D = {
61
- close: "Close",
62
- notifications: (n, e) => `${e.plural(n.count, {
63
- one: () => `${e.number(n.count)} notification`,
64
- other: () => `${e.number(n.count)} notifications`
65
- })}.`
66
- };
67
- var M = {};
68
- M = {
69
- close: "Cerrar",
70
- notifications: (n, e) => `${e.plural(n.count, {
71
- one: () => `${e.number(n.count)} notificación`,
72
- other: () => `${e.number(n.count)} notificaciones`
73
- })}.`
74
- };
75
- var H = {};
76
- H = {
77
- close: "Sule",
78
- notifications: (n, e) => `${e.plural(n.count, {
79
- one: () => `${e.number(n.count)} teatis`,
80
- other: () => `${e.number(n.count)} teatist`
81
- })}.`
82
- };
83
- var O = {};
84
- O = {
85
- close: "Sulje",
86
- notifications: (n, e) => `${e.plural(n.count, {
87
- one: () => `${e.number(n.count)} ilmoitus`,
88
- other: () => `${e.number(n.count)} ilmoitusta`
89
- })}.`
90
- };
91
- var V = {};
92
- V = {
93
- close: "Fermer",
94
- notifications: (n, e) => `${e.plural(n.count, {
95
- one: () => `${e.number(n.count)} notification`,
96
- other: () => `${e.number(n.count)} notifications`
97
- })}.`
98
- };
99
- var z = {};
100
- z = {
101
- close: "סגור",
102
- notifications: (n, e) => `${e.plural(n.count, {
103
- one: () => `${e.number(n.count)} התראה`,
104
- other: () => `${e.number(n.count)} התראות`
105
- })}.`
106
- };
107
- var j = {};
108
- j = {
109
- close: "Zatvori",
110
- notifications: (n, e) => `${e.plural(n.count, {
111
- one: () => `${e.number(n.count)} obavijest`,
112
- other: () => `${e.number(n.count)} obavijesti`
113
- })}.`
114
- };
115
- var G = {};
116
- G = {
117
- close: "Bezárás",
118
- notifications: (n, e) => `${e.plural(n.count, {
119
- one: () => `${e.number(n.count)} értesítés`,
120
- other: () => `${e.number(n.count)} értesítés`
121
- })}.`
122
- };
123
- var K = {};
124
- K = {
125
- close: "Chiudi",
126
- notifications: (n, e) => `${e.plural(n.count, {
127
- one: () => `${e.number(n.count)} notifica`,
128
- other: () => `${e.number(n.count)} notifiche`
129
- })}.`
130
- };
131
- var U = {};
132
- U = {
133
- close: "閉じる",
134
- notifications: (n, e) => `${e.plural(n.count, {
135
- one: () => `${e.number(n.count)} 個の通知`,
136
- other: () => `${e.number(n.count)} 個の通知`
137
- })}。`
138
- };
139
- var W = {};
140
- W = {
141
- close: "닫기",
142
- notifications: (n, e) => `${e.plural(n.count, {
143
- one: () => `${e.number(n.count)}개 알림`,
144
- other: () => `${e.number(n.count)}개 알림`
145
- })}.`
146
- };
147
- var Z = {};
148
- Z = {
149
- close: "Uždaryti",
150
- notifications: (n, e) => `${e.plural(n.count, {
151
- one: () => `${e.number(n.count)} pranešimas`,
152
- other: () => `${e.number(n.count)} pranešimai`
153
- })}.`
154
- };
155
- var q = {};
156
- q = {
157
- close: "Aizvērt",
158
- notifications: (n, e) => `${e.plural(n.count, {
159
- one: () => `${e.number(n.count)} paziņojums`,
160
- other: () => `${e.number(n.count)} paziņojumi`
161
- })}.`
162
- };
163
- var Y = {};
164
- Y = {
165
- close: "Lukk",
166
- notifications: (n, e) => `${e.plural(n.count, {
167
- one: () => `${e.number(n.count)} varsling`,
168
- other: () => `${e.number(n.count)} varsler`
169
- })}.`
170
- };
171
- var J = {};
172
- J = {
173
- close: "Sluiten",
174
- notifications: (n, e) => `${e.plural(n.count, {
175
- one: () => `${e.number(n.count)} melding`,
176
- other: () => `${e.number(n.count)} meldingen`
177
- })}.`
178
- };
179
- var Q = {};
180
- Q = {
181
- close: "Zamknij",
182
- notifications: (n, e) => `${e.plural(n.count, {
183
- one: () => `${e.number(n.count)} powiadomienie`,
184
- few: () => `${e.number(n.count)} powiadomienia`,
185
- many: () => `${e.number(n.count)} powiadomień`,
186
- other: () => `${e.number(n.count)} powiadomienia`
187
- })}.`
188
- };
189
- var X = {};
190
- X = {
191
- close: "Fechar",
192
- notifications: (n, e) => `${e.plural(n.count, {
193
- one: () => `${e.number(n.count)} notificação`,
194
- other: () => `${e.number(n.count)} notificações`
195
- })}.`
196
- };
197
- var ee = {};
198
- ee = {
199
- close: "Fechar",
200
- notifications: (n, e) => `${e.plural(n.count, {
201
- one: () => `${e.number(n.count)} notificação`,
202
- other: () => `${e.number(n.count)} notificações`
203
- })}.`
204
- };
205
- var ne = {};
206
- ne = {
207
- close: "Închideţi",
208
- notifications: (n, e) => `${e.plural(n.count, {
209
- one: () => `${e.number(n.count)} notificare`,
210
- other: () => `${e.number(n.count)} notificări`
211
- })}.`
212
- };
213
- var te = {};
214
- te = {
215
- close: "Закрыть",
216
- notifications: (n, e) => `${e.plural(n.count, {
217
- one: () => `${e.number(n.count)} уведомление`,
218
- other: () => `${e.number(n.count)} уведомления`
219
- })}.`
220
- };
221
- var ie = {};
222
- ie = {
223
- close: "Zatvoriť",
224
- notifications: (n, e) => `${e.plural(n.count, {
225
- one: () => `${e.number(n.count)} oznámenie`,
226
- few: () => `${e.number(n.count)} oznámenia`,
227
- other: () => `${e.number(n.count)} oznámení`
228
- })}.`
229
- };
230
- var oe = {};
231
- oe = {
232
- close: "Zapri",
233
- notifications: (n, e) => `${e.plural(n.count, {
234
- one: () => `${e.number(n.count)} obvestilo`,
235
- two: () => `${e.number(n.count)} obvestili`,
236
- few: () => `${e.number(n.count)} obvestila`,
237
- other: () => `${e.number(n.count)} obvestil`
238
- })}.`
239
- };
240
- var ue = {};
241
- ue = {
242
- close: "Zatvori",
243
- notifications: (n, e) => `${e.plural(n.count, {
244
- one: () => `${e.number(n.count)} obaveštenje`,
245
- other: () => `${e.number(n.count)} obaveštenja`
246
- })}.`
247
- };
248
- var ae = {};
249
- ae = {
250
- close: "Stäng",
251
- notifications: (n, e) => `${e.plural(n.count, {
252
- one: () => `${e.number(n.count)} meddelande`,
253
- other: () => `${e.number(n.count)} meddelanden`
254
- })}.`
255
- };
256
- var se = {};
257
- se = {
258
- close: "Kapat",
259
- notifications: (n, e) => `${e.plural(n.count, {
260
- one: () => `${e.number(n.count)} bildirim`,
261
- other: () => `${e.number(n.count)} bildirim`
262
- })}.`
263
- };
264
- var re = {};
265
- re = {
266
- close: "Закрити",
267
- notifications: (n, e) => `${e.plural(n.count, {
268
- one: () => `${e.number(n.count)} сповіщення`,
269
- other: () => `${e.number(n.count)} сповіщення`
270
- })}.`
271
- };
272
- var le = {};
273
- le = {
274
- close: "关闭",
275
- notifications: (n, e) => `${e.plural(n.count, {
276
- one: () => `${e.number(n.count)} 个通知`,
277
- other: () => `${e.number(n.count)} 个通知`
278
- })}。`
279
- };
280
- var ce = {};
281
- ce = {
282
- close: "關閉",
283
- notifications: (n, e) => `${e.plural(n.count, {
284
- one: () => `${e.number(n.count)} 個通知`,
285
- other: () => `${e.number(n.count)} 個通知`
286
- })}。`
287
- };
288
- var _ = {};
289
- _ = {
290
- "ar-AE": C,
291
- "bg-BG": P,
292
- "cs-CZ": F,
293
- "da-DK": R,
294
- "de-DE": N,
295
- "el-GR": S,
296
- "en-US": D,
297
- "es-ES": M,
298
- "et-EE": H,
299
- "fi-FI": O,
300
- "fr-FR": V,
301
- "he-IL": z,
302
- "hr-HR": j,
303
- "hu-HU": G,
304
- "it-IT": K,
305
- "ja-JP": U,
306
- "ko-KR": W,
307
- "lt-LT": Z,
308
- "lv-LV": q,
309
- "nb-NO": Y,
310
- "nl-NL": J,
311
- "pl-PL": Q,
312
- "pt-BR": X,
313
- "pt-PT": ee,
314
- "ro-RO": ne,
315
- "ru-RU": te,
316
- "sk-SK": ie,
317
- "sl-SI": oe,
318
- "sr-SP": ue,
319
- "sv-SE": ae,
320
- "tr-TR": se,
321
- "uk-UA": re,
322
- "zh-CN": le,
323
- "zh-TW": ce
324
- };
325
- function Ce(n) {
326
- return n && n.__esModule ? n.default : n;
327
- }
328
- function Pe(n, e, t) {
329
- let { key: i, timer: o, timeout: u, animation: a } = n.toast;
330
- v(() => {
331
- if (!(o == null || u == null))
332
- return o.reset(u), () => {
333
- o.pause();
334
- };
335
- }, [
336
- o,
337
- u
338
- ]);
339
- let [s, l] = y.useState(!1);
340
- v(() => {
341
- (a === "entering" || a === "queued") && l(!0);
342
- }, [
343
- a
344
- ]);
345
- let r = ke(), $ = Ee(), d = w(Ce(_), "@react-aria/toast");
346
- return {
347
- toastProps: {
348
- role: "alertdialog",
349
- "aria-modal": "false",
350
- "aria-label": n["aria-label"],
351
- "aria-labelledby": n["aria-labelledby"] || r,
352
- "aria-describedby": n["aria-describedby"] || $,
353
- "aria-details": n["aria-details"],
354
- // Hide toasts that are animating out so VoiceOver doesn't announce them.
355
- "aria-hidden": a === "exiting" ? "true" : void 0,
356
- tabIndex: 0
357
- },
358
- contentProps: {
359
- role: "alert",
360
- "aria-atomic": "true",
361
- style: {
362
- visibility: s || a === null ? "visible" : "hidden"
363
- }
364
- },
365
- titleProps: {
366
- id: r
367
- },
368
- descriptionProps: {
369
- id: $
370
- },
371
- closeButtonProps: {
372
- "aria-label": d.format("close"),
373
- onPress: () => e.close(i)
374
- }
375
- };
376
- }
377
- const de = 1, g = Symbol.for("react-aria-landmark-manager");
378
- function Fe(n) {
379
- return document.addEventListener("react-aria-landmark-manager-change", n), () => document.removeEventListener("react-aria-landmark-manager-change", n);
380
- }
381
- function B() {
382
- if (typeof document > "u") return null;
383
- let n = document[g];
384
- return n && n.version >= de ? n : (document[g] = new Ne(), document.dispatchEvent(new CustomEvent("react-aria-landmark-manager-change")), document[g]);
385
- }
386
- function Re() {
387
- return I.useSyncExternalStore(Fe, B, B);
388
- }
389
- class Ne {
390
- setupIfNeeded() {
391
- this.isListening || (document.addEventListener("keydown", this.f6Handler, {
392
- capture: !0
393
- }), document.addEventListener("focusin", this.focusinHandler, {
394
- capture: !0
395
- }), document.addEventListener("focusout", this.focusoutHandler, {
396
- capture: !0
397
- }), this.isListening = !0);
398
- }
399
- teardownIfNeeded() {
400
- !this.isListening || this.landmarks.length > 0 || this.refCount > 0 || (document.removeEventListener("keydown", this.f6Handler, {
401
- capture: !0
402
- }), document.removeEventListener("focusin", this.focusinHandler, {
403
- capture: !0
404
- }), document.removeEventListener("focusout", this.focusoutHandler, {
405
- capture: !0
406
- }), this.isListening = !1);
407
- }
408
- focusLandmark(e, t) {
409
- var i, o;
410
- (o = this.landmarks.find((u) => u.ref.current === e)) === null || o === void 0 || (i = o.focus) === null || i === void 0 || i.call(o, t);
411
- }
412
- /**
413
- * Return set of landmarks with a specific role.
414
- */
415
- getLandmarksByRole(e) {
416
- return new Set(this.landmarks.filter((t) => t.role === e));
417
- }
418
- /**
419
- * Return first landmark with a specific role.
420
- */
421
- getLandmarkByRole(e) {
422
- return this.landmarks.find((t) => t.role === e);
423
- }
424
- addLandmark(e) {
425
- if (this.setupIfNeeded(), this.landmarks.find((o) => o.ref === e.ref) || !e.ref.current) return;
426
- if (this.landmarks.filter((o) => o.role === "main").length > 1 && console.error('Page can contain no more than one landmark with the role "main".'), this.landmarks.length === 0) {
427
- this.landmarks = [
428
- e
429
- ], this.checkLabels(e.role);
430
- return;
431
- }
432
- let t = 0, i = this.landmarks.length - 1;
433
- for (; t <= i; ) {
434
- let o = Math.floor((t + i) / 2), u = e.ref.current.compareDocumentPosition(this.landmarks[o].ref.current);
435
- !!(u & Node.DOCUMENT_POSITION_PRECEDING || u & Node.DOCUMENT_POSITION_CONTAINS) ? t = o + 1 : i = o - 1;
436
- }
437
- this.landmarks.splice(t, 0, e), this.checkLabels(e.role);
438
- }
439
- updateLandmark(e) {
440
- let t = this.landmarks.findIndex((i) => i.ref === e.ref);
441
- t >= 0 && (this.landmarks[t] = {
442
- ...this.landmarks[t],
443
- ...e
444
- }, this.checkLabels(this.landmarks[t].role));
445
- }
446
- removeLandmark(e) {
447
- this.landmarks = this.landmarks.filter((t) => t.ref !== e), this.teardownIfNeeded();
448
- }
449
- /**
450
- * Warn if there are 2+ landmarks with the same role but no label.
451
- * Labels for landmarks with the same role must also be unique.
452
- *
453
- * See https://www.w3.org/WAI/ARIA/apg/practices/landmark-regions/.
454
- */
455
- checkLabels(e) {
456
- let t = this.getLandmarksByRole(e);
457
- if (t.size > 1) {
458
- let i = [
459
- ...t
460
- ].filter((o) => !o.label);
461
- if (i.length > 0) console.warn(`Page contains more than one landmark with the '${e}' role. If two or more landmarks on a page share the same role, all must be labeled with an aria-label or aria-labelledby attribute: `, i.map((o) => o.ref.current));
462
- else {
463
- let o = [
464
- ...t
465
- ].map((a) => a.label);
466
- o.filter((a, s) => o.indexOf(a) !== s).forEach((a) => {
467
- console.warn(`Page contains more than one landmark with the '${e}' role and '${a}' label. If two or more landmarks on a page share the same role, they must have unique labels: `, [
468
- ...t
469
- ].filter((s) => s.label === a).map((s) => s.ref.current));
470
- });
471
- }
472
- }
473
- }
474
- /**
475
- * Get the landmark that is the closest parent in the DOM.
476
- * Returns undefined if no parent is a landmark.
477
- */
478
- closestLandmark(e) {
479
- let t = new Map(this.landmarks.map((o) => [
480
- o.ref.current,
481
- o
482
- ])), i = e;
483
- for (; i && !t.has(i) && i !== document.body && i.parentElement; ) i = i.parentElement;
484
- return t.get(i);
485
- }
486
- /**
487
- * Gets the next landmark, in DOM focus order, or previous if backwards is specified.
488
- * If last landmark, next should be the first landmark.
489
- * If not inside a landmark, will return first landmark.
490
- * Returns undefined if there are no landmarks.
491
- */
492
- getNextLandmark(e, { backward: t }) {
493
- var i;
494
- let o = this.closestLandmark(e), u = t ? this.landmarks.length - 1 : 0;
495
- o && (u = this.landmarks.indexOf(o) + (t ? -1 : 1));
496
- let a = () => {
497
- if (u < 0) {
498
- if (!e.dispatchEvent(new CustomEvent("react-aria-landmark-navigation", {
499
- detail: {
500
- direction: "backward"
501
- },
502
- bubbles: !0,
503
- cancelable: !0
504
- }))) return !0;
505
- u = this.landmarks.length - 1;
506
- } else if (u >= this.landmarks.length) {
507
- if (!e.dispatchEvent(new CustomEvent("react-aria-landmark-navigation", {
508
- detail: {
509
- direction: "forward"
510
- },
511
- bubbles: !0,
512
- cancelable: !0
513
- }))) return !0;
514
- u = 0;
515
- }
516
- return u < 0 || u >= this.landmarks.length;
517
- };
518
- if (a()) return;
519
- let s = u;
520
- for (; !((i = this.landmarks[u].ref.current) === null || i === void 0) && i.closest("[aria-hidden=true]"); ) {
521
- if (u += t ? -1 : 1, a()) return;
522
- if (u === s) break;
523
- }
524
- return this.landmarks[u];
525
- }
526
- /**
527
- * Look at next landmark. If an element was previously focused inside, restore focus there.
528
- * If not, focus the landmark itself.
529
- * If no landmarks at all, or none with focusable elements, don't move focus.
530
- */
531
- f6Handler(e) {
532
- e.key === "F6" && (e.altKey ? this.focusMain() : this.navigate(e.target, e.shiftKey)) && (e.preventDefault(), e.stopPropagation());
533
- }
534
- focusMain() {
535
- let e = this.getLandmarkByRole("main");
536
- return e && e.ref.current && document.contains(e.ref.current) ? (this.focusLandmark(e.ref.current, "forward"), !0) : !1;
537
- }
538
- navigate(e, t) {
539
- let i = this.getNextLandmark(e, {
540
- backward: t
541
- });
542
- if (!i) return !1;
543
- if (i.lastFocused) {
544
- let o = i.lastFocused;
545
- if (document.body.contains(o))
546
- return o.focus(), !0;
547
- }
548
- return i.ref.current && document.contains(i.ref.current) ? (this.focusLandmark(i.ref.current, t ? "backward" : "forward"), !0) : !1;
549
- }
550
- /**
551
- * Sets lastFocused for a landmark, if focus is moved within that landmark.
552
- * Lets the last focused landmark know it was blurred if something else is focused.
553
- */
554
- focusinHandler(e) {
555
- let t = this.closestLandmark(e.target);
556
- t && t.ref.current !== e.target && this.updateLandmark({
557
- ref: t.ref,
558
- lastFocused: e.target
559
- });
560
- let i = e.relatedTarget;
561
- if (i) {
562
- let o = this.closestLandmark(i);
563
- o && o.ref.current === i && o.blur();
564
- }
565
- }
566
- /**
567
- * Track if the focus is lost to the body. If it is, do cleanup on the landmark that last had focus.
568
- */
569
- focusoutHandler(e) {
570
- let t = e.target, i = e.relatedTarget;
571
- if (!i || i === document) {
572
- let o = this.closestLandmark(t);
573
- o && o.ref.current === t && o.blur();
574
- }
575
- }
576
- createLandmarkController() {
577
- let e = this;
578
- return e.refCount++, e.setupIfNeeded(), {
579
- navigate(t, i) {
580
- let o = (i == null ? void 0 : i.from) || document.activeElement;
581
- return e.navigate(o, t === "backward");
582
- },
583
- focusNext(t) {
584
- let i = (t == null ? void 0 : t.from) || document.activeElement;
585
- return e.navigate(i, !1);
586
- },
587
- focusPrevious(t) {
588
- let i = (t == null ? void 0 : t.from) || document.activeElement;
589
- return e.navigate(i, !0);
590
- },
591
- focusMain() {
592
- return e.focusMain();
593
- },
594
- dispose() {
595
- e && (e.refCount--, e.teardownIfNeeded(), e = null);
596
- }
597
- };
598
- }
599
- registerLandmark(e) {
600
- return this.landmarks.find((t) => t.ref === e.ref) ? this.updateLandmark(e) : this.addLandmark(e), () => this.removeLandmark(e.ref);
601
- }
602
- constructor() {
603
- this.landmarks = [], this.isListening = !1, this.refCount = 0, this.version = de, this.f6Handler = this.f6Handler.bind(this), this.focusinHandler = this.focusinHandler.bind(this), this.focusoutHandler = this.focusoutHandler.bind(this);
604
- }
605
- }
606
- function Se(n, e) {
607
- const { role: t, "aria-label": i, "aria-labelledby": o, focus: u } = n;
608
- let a = Re(), s = i || o, [l, r] = ve(!1), $ = T(() => {
609
- r(!0);
610
- }, [
611
- r
612
- ]), d = T(() => {
613
- r(!1);
614
- }, [
615
- r
616
- ]);
617
- return A(() => {
618
- if (a) return a.registerLandmark({
619
- ref: e,
620
- label: s,
621
- role: t,
622
- focus: u || $,
623
- blur: d
624
- });
625
- }, [
626
- a,
627
- s,
628
- e,
629
- t,
630
- u,
631
- $,
632
- d
633
- ]), v(() => {
634
- var b;
635
- l && ((b = e.current) === null || b === void 0 || b.focus());
636
- }, [
637
- l,
638
- e
639
- ]), {
640
- landmarkProps: {
641
- role: t,
642
- tabIndex: l ? -1 : void 0,
643
- "aria-label": i,
644
- "aria-labelledby": o
645
- }
646
- };
647
- }
648
- function De(n) {
649
- return n && n.__esModule ? n.default : n;
650
- }
651
- function Me(n, e, t) {
652
- let i = w(De(_), "@react-aria/toast"), { landmarkProps: o } = Se({
653
- role: "region",
654
- "aria-label": n["aria-label"] || i.format("notifications", {
655
- count: e.visibleToasts.length
656
- })
657
- }, t), { hoverProps: u } = Te({
658
- onHoverStart: e.pauseAll,
659
- onHoverEnd: e.resumeAll
660
- }), a = x([]), s = x(e.visibleToasts), l = x(null);
661
- A(() => {
662
- if (l.current === -1 || e.visibleToasts.length === 0 || !t.current) {
663
- a.current = [], s.current = e.visibleToasts;
664
- return;
665
- }
666
- if (a.current = [
667
- ...t.current.querySelectorAll('[role="alertdialog"]')
668
- ], s.current.length === e.visibleToasts.length && e.visibleToasts.every((c, f) => c.key === s.current[f].key)) {
669
- s.current = e.visibleToasts;
670
- return;
671
- }
672
- let d = s.current.map((c, f) => ({
673
- ...c,
674
- i: f,
675
- isRemoved: !e.visibleToasts.some((m) => c.key === m.key)
676
- })), b = d.findIndex((c) => c.i === l.current);
677
- if (b > -1) {
678
- let c = 0, f, m;
679
- for (; c <= b; )
680
- d[c].isRemoved || (m = Math.max(0, c - 1)), c++;
681
- for (; c < d.length; ) {
682
- if (!d[c].isRemoved) {
683
- f = c - 1;
684
- break;
685
- }
686
- c++;
687
- }
688
- m === void 0 && f === void 0 && (m = 0), m >= 0 && m < a.current.length ? k(a.current[m]) : f >= 0 && f < a.current.length && k(a.current[f]);
689
- }
690
- s.current = e.visibleToasts;
691
- }, [
692
- e.visibleToasts,
693
- t
694
- ]);
695
- let r = x(null), { focusWithinProps: $ } = ge({
696
- onFocusWithin: (d) => {
697
- e.pauseAll(), r.current = d.relatedTarget;
698
- },
699
- onBlurWithin: () => {
700
- e.resumeAll(), r.current = null;
701
- }
702
- });
703
- return v(() => {
704
- e.visibleToasts.length === 0 && r.current && document.body.contains(r.current) && (L() === "pointer" ? k(r.current) : r.current.focus(), r.current = null);
705
- }, [
706
- t,
707
- e.visibleToasts.length
708
- ]), v(() => () => {
709
- r.current && document.body.contains(r.current) && (L() === "pointer" ? k(r.current) : r.current.focus(), r.current = null);
710
- }, [
711
- t
712
- ]), {
713
- regionProps: ye(o, u, $, {
714
- tabIndex: -1,
715
- // Mark the toast region as a "top layer", so that it:
716
- // - is not aria-hidden when opening an overlay
717
- // - allows focus even outside a containing focus scope
718
- // - doesn’t dismiss overlays when clicking on it, even though it is outside
719
- // @ts-ignore
720
- "data-react-aria-top-layer": !0,
721
- // listen to focus events separate from focuswithin because that will only fire once
722
- // and we need to follow all focus changes
723
- onFocus: (d) => {
724
- let b = d.target.closest('[role="alertdialog"]');
725
- l.current = a.current.findIndex((c) => c === b);
726
- },
727
- onBlur: () => {
728
- l.current = -1;
729
- }
730
- })
731
- };
732
- }
733
- function He(n = {}) {
734
- let { maxVisibleToasts: e = 1, hasExitAnimation: t = !1 } = n, i = xe(() => new be({
735
- maxVisibleToasts: e,
736
- hasExitAnimation: t
737
- }), [
738
- e,
739
- t
740
- ]);
741
- return fe(i);
742
- }
743
- function fe(n) {
744
- let e = T((o) => n.subscribe(o), [
745
- n
746
- ]), t = T(() => n.visibleToasts, [
747
- n
748
- ]);
749
- return {
750
- visibleToasts: I.useSyncExternalStore(e, t, t),
751
- add: (o, u) => n.add(o, u),
752
- close: (o) => n.close(o),
753
- remove: (o) => n.remove(o),
754
- pauseAll: () => n.pauseAll(),
755
- resumeAll: () => n.resumeAll()
756
- };
757
- }
758
- class be {
759
- /** Subscribes to updates to the visible toasts. */
760
- subscribe(e) {
761
- return this.subscriptions.add(e), () => this.subscriptions.delete(e);
762
- }
763
- /** Adds a new toast to the queue. */
764
- add(e, t = {}) {
765
- let i = Math.random().toString(36), o = {
766
- ...t,
767
- content: e,
768
- key: i,
769
- timer: t.timeout ? new Oe(() => this.close(i), t.timeout) : void 0
770
- }, u = 0, a = this.queue.length;
771
- for (; u < a; ) {
772
- let l = Math.floor((u + a) / 2);
773
- (o.priority || 0) > (this.queue[l].priority || 0) ? a = l : u = l + 1;
774
- }
775
- this.queue.splice(u, 0, o), o.animation = u < this.maxVisibleToasts ? "entering" : "queued";
776
- let s = this.maxVisibleToasts;
777
- for (; s < this.queue.length; ) this.queue[s++].animation = "queued";
778
- return this.updateVisibleToasts({
779
- action: "add"
780
- }), i;
781
- }
782
- /**
783
- * Closes a toast. If `hasExitAnimation` is true, the toast
784
- * transitions to an "exiting" state instead of being removed immediately.
785
- */
786
- close(e) {
787
- let t = this.queue.findIndex((u) => u.key === e);
788
- if (t >= 0) {
789
- var i, o;
790
- (i = (o = this.queue[t]).onClose) === null || i === void 0 || i.call(o), this.queue.splice(t, 1);
791
- }
792
- this.updateVisibleToasts({
793
- action: "close",
794
- key: e
795
- });
796
- }
797
- /** Removes a toast from the visible toasts after an exiting animation. */
798
- remove(e) {
799
- this.updateVisibleToasts({
800
- action: "remove",
801
- key: e
802
- });
803
- }
804
- updateVisibleToasts(e) {
805
- let { action: t, key: i } = e, o = this.queue.slice(0, this.maxVisibleToasts);
806
- if (t === "add" && this.hasExitAnimation) {
807
- let u = this.visibleToasts.filter((a) => !o.some((s) => a.key === s.key)).map((a) => ({
808
- ...a,
809
- animation: "exiting"
810
- }));
811
- this.visibleToasts = u.concat(o).sort((a, s) => {
812
- var l, r;
813
- return ((l = s.priority) !== null && l !== void 0 ? l : 0) - ((r = a.priority) !== null && r !== void 0 ? r : 0);
814
- });
815
- } else t === "close" && this.hasExitAnimation ? this.visibleToasts = this.visibleToasts.map((u) => u.key !== i ? u : {
816
- ...u,
817
- animation: "exiting"
818
- }) : this.visibleToasts = o;
819
- for (let u of this.subscriptions) u();
820
- }
821
- /** Pauses the timers for all visible toasts. */
822
- pauseAll() {
823
- for (let e of this.visibleToasts) e.timer && e.timer.pause();
824
- }
825
- /** Resumes the timers for all visible toasts. */
826
- resumeAll() {
827
- for (let e of this.visibleToasts) e.timer && e.timer.resume();
828
- }
829
- constructor(e) {
830
- this.queue = [], this.subscriptions = /* @__PURE__ */ new Set(), this.visibleToasts = [];
831
- var t;
832
- this.maxVisibleToasts = (t = e == null ? void 0 : e.maxVisibleToasts) !== null && t !== void 0 ? t : 1;
833
- var i;
834
- this.hasExitAnimation = (i = e == null ? void 0 : e.hasExitAnimation) !== null && i !== void 0 ? i : !1;
835
- }
836
- }
837
- class Oe {
838
- reset(e) {
839
- this.remaining = e, this.resume();
840
- }
841
- pause() {
842
- this.timerId != null && (clearTimeout(this.timerId), this.timerId = null, this.remaining -= Date.now() - this.startTime);
843
- }
844
- resume() {
845
- this.remaining <= 0 || (this.startTime = Date.now(), this.timerId = setTimeout(() => {
846
- this.timerId = null, this.remaining = 0, this.callback();
847
- }, this.remaining));
848
- }
849
- constructor(e, t) {
850
- this.startTime = null, this.remaining = t, this.callback = e;
851
- }
852
- }
853
- const Ve = '"../theme/tokens.css"', ze = '"Inter", sans-serif', je = "#d5f2d9", Ge = "#008d3c", Ke = "#eaf2f6", Ue = "#0066cc", We = "#fff8e1", Ze = "#f1c21b", qe = "#ffdfdf", Ye = "#e62323", Je = "#1f1f1f", Qe = "0 0 0 2px #ffffff, 0 0 0 4px #000000", Xe = "(min-width: 768px)", en = "_toastRegion_i4o11_52", nn = "_toast_i4o11_52", tn = "_success_i4o11_96", on = "_info_i4o11_104", un = "_important_i4o11_112", an = "_warning_i4o11_120", sn = "_icon_i4o11_128", rn = "_toastContent_i4o11_138", ln = "_toastMessage_i4o11_145", cn = "_slideInTop_i4o11_1", dn = "_slideInEnd_i4o11_1", fn = "_slideOutTop_i4o11_1", bn = "_slideOutEnd_i4o11_1", p = {
854
- tokens: Ve,
855
- display: ze,
856
- signalGreen10: je,
857
- signalGreen100: Ge,
858
- signalBlue10: Ke,
859
- signalBlue100: Ue,
860
- signalYellow10: We,
861
- signalYellow100: Ze,
862
- signalRed10: qe,
863
- signalRed100: Ye,
864
- gray150: Je,
865
- focus: Qe,
866
- mdBreakpoint: Xe,
867
- toastRegion: en,
868
- toast: nn,
869
- success: tn,
870
- info: on,
871
- important: un,
872
- warning: an,
873
- icon: sn,
874
- toastContent: rn,
875
- toastMessage: ln,
876
- slideInTop: cn,
877
- slideInEnd: dn,
878
- slideOutTop: fn,
879
- slideOutEnd: bn
880
- }, mn = {
881
- success: Be,
882
- info: Ae,
883
- important: we,
884
- warning: Ie
885
- }, hn = new be({
886
- maxVisibleToasts: 5,
887
- hasExitAnimation: !0
888
- }), Bn = (n) => {
889
- const e = fe(hn);
890
- return e.visibleToasts.length > 0 ? _e(
891
- /* @__PURE__ */ h(
892
- me,
893
- {
894
- ...n,
895
- state: e
896
- }
897
- ),
898
- document.body
899
- ) : null;
900
- }, An = ({ children: n, ...e }) => {
901
- const t = He({
902
- maxVisibleToasts: 5,
903
- hasExitAnimation: !0
904
- });
905
- return /* @__PURE__ */ E(he, { children: [
906
- typeof n == "function" ? n(t) : n,
907
- t.visibleToasts.length > 0 && /* @__PURE__ */ h(
908
- me,
909
- {
910
- ...e,
911
- state: t
912
- }
913
- )
914
- ] });
915
- };
916
- function me({
917
- state: n,
918
- ...e
919
- }) {
920
- const t = y.useRef(null), { regionProps: i } = Me(e, n, t);
921
- return /* @__PURE__ */ h(
922
- "div",
923
- {
924
- ...i,
925
- ref: t,
926
- className: p.toastRegion,
927
- children: n.visibleToasts.map((o) => /* @__PURE__ */ h(
928
- $n,
929
- {
930
- toast: o,
931
- state: n
932
- },
933
- o.key
934
- ))
935
- }
936
- );
937
- }
938
- function $n({
939
- state: n,
940
- ...e
941
- }) {
942
- const t = y.useRef(null), { toastProps: i, contentProps: o, titleProps: u, closeButtonProps: a } = Pe(
943
- e,
944
- n
945
- ), s = mn[e.toast.content.type];
946
- return /* @__PURE__ */ E(
947
- "div",
948
- {
949
- ...i,
950
- ref: t,
951
- className: pe(p.toast, p[e.toast.content.type]),
952
- "data-animation": e.toast.animation,
953
- onAnimationEnd: () => {
954
- e.toast.animation === "exiting" && n.remove(e.toast.key);
955
- },
956
- children: [
957
- /* @__PURE__ */ E(
958
- "div",
959
- {
960
- className: p.toastContent,
961
- ...o,
962
- children: [
963
- /* @__PURE__ */ h(
964
- s,
965
- {
966
- className: p.icon,
967
- size: 20,
968
- "aria-hidden": !0
969
- }
970
- ),
971
- /* @__PURE__ */ E("div", { children: [
972
- /* @__PURE__ */ h(
973
- "p",
974
- {
975
- className: p.toastMessage,
976
- ...u,
977
- children: e.toast.content.message
978
- }
979
- ),
980
- e.toast.content.children
981
- ] })
982
- ]
983
- }
984
- ),
985
- /* @__PURE__ */ h(
986
- $e,
987
- {
988
- variant: "icon",
989
- ...a,
990
- children: /* @__PURE__ */ h(
991
- Le,
992
- {
993
- size: 20,
994
- "aria-hidden": !0
995
- }
996
- )
997
- }
998
- )
999
- ]
1000
- }
1001
- );
1002
- }
1003
- export {
1004
- Bn as GlobalToastRegion,
1005
- $n as Toast,
1006
- An as ToastProvider,
1007
- me as ToastRegion,
1008
- hn as toastQueue
1009
- };