fictoan-react 2.0.0-beta.17 → 2.0.0-beta.18

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 (181) hide show
  1. package/dist/components/Accordion/Accordion.d.ts.map +1 -1
  2. package/dist/components/Accordion/Accordion.js +27 -0
  3. package/dist/components/Accordion/Accordion.js.map +1 -0
  4. package/dist/components/Badge/Badge.d.ts.map +1 -1
  5. package/dist/components/Badge/Badge.js +56 -0
  6. package/dist/components/Badge/Badge.js.map +1 -0
  7. package/dist/components/Breadcrumbs/Breadcrumbs.js +65 -0
  8. package/dist/components/Breadcrumbs/Breadcrumbs.js.map +1 -0
  9. package/dist/components/Button/Button.js +28 -0
  10. package/dist/components/Button/Button.js.map +1 -0
  11. package/dist/components/ButtonGroup/ButtonGroup.js +27 -0
  12. package/dist/components/ButtonGroup/ButtonGroup.js.map +1 -0
  13. package/dist/components/Callout/Callout.js +31 -0
  14. package/dist/components/Callout/Callout.js.map +1 -0
  15. package/dist/components/Card/Card.js +27 -0
  16. package/dist/components/Card/Card.js.map +1 -0
  17. package/dist/components/CodeBlock/CodeBlock.js +191 -0
  18. package/dist/components/CodeBlock/CodeBlock.js.map +1 -0
  19. package/dist/components/Divider/Divider.js +29 -0
  20. package/dist/components/Divider/Divider.js.map +1 -0
  21. package/dist/components/Drawer/Drawer.d.ts +3 -0
  22. package/dist/components/Drawer/Drawer.d.ts.map +1 -1
  23. package/dist/components/Drawer/Drawer.js +96 -0
  24. package/dist/components/Drawer/Drawer.js.map +1 -0
  25. package/dist/components/Element/Element.d.ts +6 -2
  26. package/dist/components/Element/Element.d.ts.map +1 -1
  27. package/dist/components/Element/Element.js +152 -0
  28. package/dist/components/Element/Element.js.map +1 -0
  29. package/dist/components/Element/Tags.js +31 -0
  30. package/dist/components/Element/Tags.js.map +1 -0
  31. package/dist/components/Element/constants.js +8 -0
  32. package/dist/components/Element/constants.js.map +1 -0
  33. package/dist/components/Form/Checkbox/Checkbox.d.ts.map +1 -1
  34. package/dist/components/Form/Checkbox/Checkbox.js +78 -0
  35. package/dist/components/Form/Checkbox/Checkbox.js.map +1 -0
  36. package/dist/components/Form/Checkbox/CheckboxAndSwitchGroup.d.ts.map +1 -1
  37. package/dist/components/Form/Checkbox/CheckboxAndSwitchGroup.js +177 -0
  38. package/dist/components/Form/Checkbox/CheckboxAndSwitchGroup.js.map +1 -0
  39. package/dist/components/Form/Checkbox/Switch.d.ts.map +1 -1
  40. package/dist/components/Form/Checkbox/Switch.js +78 -0
  41. package/dist/components/Form/Checkbox/Switch.js.map +1 -0
  42. package/dist/components/Form/FileUpload/FileUpload.d.ts.map +1 -1
  43. package/dist/components/Form/FileUpload/FileUpload.js +142 -0
  44. package/dist/components/Form/FileUpload/FileUpload.js.map +1 -0
  45. package/dist/components/Form/Form/Form.js +37 -0
  46. package/dist/components/Form/Form/Form.js.map +1 -0
  47. package/dist/components/Form/Form/FormGenerator.js +64 -0
  48. package/dist/components/Form/Form/FormGenerator.js.map +1 -0
  49. package/dist/components/Form/FormItem/FormItem.d.ts +16 -0
  50. package/dist/components/Form/FormItem/FormItem.d.ts.map +1 -1
  51. package/dist/components/Form/FormItem/FormItem.js +127 -0
  52. package/dist/components/Form/FormItem/FormItem.js.map +1 -0
  53. package/dist/components/Form/FormItemGroup/FormItemGroup.js +42 -0
  54. package/dist/components/Form/FormItemGroup/FormItemGroup.js.map +1 -0
  55. package/dist/components/Form/InputField/InputField.d.ts.map +1 -1
  56. package/dist/components/Form/InputField/InputField.js +156 -0
  57. package/dist/components/Form/InputField/InputField.js.map +1 -0
  58. package/dist/components/Form/InputLabel/InputLabel.js +30 -0
  59. package/dist/components/Form/InputLabel/InputLabel.js.map +1 -0
  60. package/dist/components/Form/ListBox/ListBox.d.ts.map +1 -1
  61. package/dist/components/Form/ListBox/ListBox.js +284 -0
  62. package/dist/components/Form/ListBox/ListBox.js.map +1 -0
  63. package/dist/components/Form/ListBox/constants.d.ts +1 -1
  64. package/dist/components/Form/ListBox/constants.d.ts.map +1 -1
  65. package/dist/components/Form/ListBox/listBoxUtils.js +49 -0
  66. package/dist/components/Form/ListBox/listBoxUtils.js.map +1 -0
  67. package/dist/components/Form/PinInputField/PinInputField.d.ts +6 -1
  68. package/dist/components/Form/PinInputField/PinInputField.d.ts.map +1 -1
  69. package/dist/components/Form/PinInputField/PinInputField.js +165 -0
  70. package/dist/components/Form/PinInputField/PinInputField.js.map +1 -0
  71. package/dist/components/Form/RadioButton/RadioButton.d.ts.map +1 -1
  72. package/dist/components/Form/RadioButton/RadioButton.js +82 -0
  73. package/dist/components/Form/RadioButton/RadioButton.js.map +1 -0
  74. package/dist/components/Form/RadioButton/RadioGroup.d.ts.map +1 -1
  75. package/dist/components/Form/RadioButton/RadioGroup.js +97 -0
  76. package/dist/components/Form/RadioButton/RadioGroup.js.map +1 -0
  77. package/dist/components/Form/RadioButton/RadioTabGroup.d.ts.map +1 -1
  78. package/dist/components/Form/RadioButton/RadioTabGroup.js +182 -0
  79. package/dist/components/Form/RadioButton/RadioTabGroup.js.map +1 -0
  80. package/dist/components/Form/Range/Range.js +376 -0
  81. package/dist/components/Form/Range/Range.js.map +1 -0
  82. package/dist/components/Form/Select/Select.d.ts.map +1 -1
  83. package/dist/components/Form/Select/Select.js +83 -0
  84. package/dist/components/Form/Select/Select.js.map +1 -0
  85. package/dist/components/Form/TextArea/TextArea.d.ts.map +1 -1
  86. package/dist/components/Form/TextArea/TextArea.js +111 -0
  87. package/dist/components/Form/TextArea/TextArea.js.map +1 -0
  88. package/dist/components/Meter/Meter.js +110 -0
  89. package/dist/components/Meter/Meter.js.map +1 -0
  90. package/dist/components/Modal/Modal.d.ts.map +1 -1
  91. package/dist/components/Modal/Modal.js +75 -0
  92. package/dist/components/Modal/Modal.js.map +1 -0
  93. package/dist/components/Notification/NotificationItem/NotificationItem.d.ts.map +1 -1
  94. package/dist/components/Notification/NotificationItem/NotificationItem.js +70 -0
  95. package/dist/components/Notification/NotificationItem/NotificationItem.js.map +1 -0
  96. package/dist/components/Notification/NotificationsProvider/NotificationsProvider.js +88 -0
  97. package/dist/components/Notification/NotificationsProvider/NotificationsProvider.js.map +1 -0
  98. package/dist/components/Notification/NotificationsWrapper/NotificationsWrapper.d.ts.map +1 -1
  99. package/dist/components/Notification/NotificationsWrapper/NotificationsWrapper.js +35 -0
  100. package/dist/components/Notification/NotificationsWrapper/NotificationsWrapper.js.map +1 -0
  101. package/dist/components/OptionCard/OptionCard.js +150 -0
  102. package/dist/components/OptionCard/OptionCard.js.map +1 -0
  103. package/dist/components/Pagination/Pagination.d.ts.map +1 -1
  104. package/dist/components/Pagination/Pagination.js +206 -0
  105. package/dist/components/Pagination/Pagination.js.map +1 -0
  106. package/dist/components/Pagination/usePagination.js +35 -0
  107. package/dist/components/Pagination/usePagination.js.map +1 -0
  108. package/dist/components/Portion/Portion.js +34 -0
  109. package/dist/components/Portion/Portion.js.map +1 -0
  110. package/dist/components/ProgressBar/ProgressBar.js +63 -0
  111. package/dist/components/ProgressBar/ProgressBar.js.map +1 -0
  112. package/dist/components/Row/Row.js +40 -0
  113. package/dist/components/Row/Row.js.map +1 -0
  114. package/dist/components/Sidebar/ContentWrapper/ContentWrapper.js +23 -0
  115. package/dist/components/Sidebar/ContentWrapper/ContentWrapper.js.map +1 -0
  116. package/dist/components/Sidebar/SidebarFooter/SidebarFooter.js +25 -0
  117. package/dist/components/Sidebar/SidebarFooter/SidebarFooter.js.map +1 -0
  118. package/dist/components/Sidebar/SidebarHeader/SidebarHeader.js +25 -0
  119. package/dist/components/Sidebar/SidebarHeader/SidebarHeader.js.map +1 -0
  120. package/dist/components/Sidebar/SidebarItem/SidebarItem.js +30 -0
  121. package/dist/components/Sidebar/SidebarItem/SidebarItem.js.map +1 -0
  122. package/dist/components/Sidebar/SidebarItemsGroup/SidebarItemsGroup.js +29 -0
  123. package/dist/components/Sidebar/SidebarItemsGroup/SidebarItemsGroup.js.map +1 -0
  124. package/dist/components/Sidebar/SidebarWrapper/SidebarWrapper.d.ts.map +1 -1
  125. package/dist/components/Sidebar/SidebarWrapper/SidebarWrapper.js +35 -0
  126. package/dist/components/Sidebar/SidebarWrapper/SidebarWrapper.js.map +1 -0
  127. package/dist/components/Skeleton/Skeleton.js +84 -0
  128. package/dist/components/Skeleton/Skeleton.js.map +1 -0
  129. package/dist/components/Spinner/Spinner.js +33 -0
  130. package/dist/components/Spinner/Spinner.js.map +1 -0
  131. package/dist/components/Table/Table.js +53 -0
  132. package/dist/components/Table/Table.js.map +1 -0
  133. package/dist/components/Tabs/Tabs.d.ts.map +1 -1
  134. package/dist/components/Tabs/Tabs.js +104 -0
  135. package/dist/components/Tabs/Tabs.js.map +1 -0
  136. package/dist/components/ThemeProvider/ThemeProvider.d.ts +6 -0
  137. package/dist/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
  138. package/dist/components/ThemeProvider/ThemeProvider.js +52 -0
  139. package/dist/components/ThemeProvider/ThemeProvider.js.map +1 -0
  140. package/dist/components/Toast/ToastItem/ToastItem.js +47 -0
  141. package/dist/components/Toast/ToastItem/ToastItem.js.map +1 -0
  142. package/dist/components/Toast/ToastsProvider/ToastsProvider.js +45 -0
  143. package/dist/components/Toast/ToastsProvider/ToastsProvider.js.map +1 -0
  144. package/dist/components/Toast/ToastsWrapper/ToastsWrapper.d.ts.map +1 -1
  145. package/dist/components/Toast/ToastsWrapper/ToastsWrapper.js +28 -0
  146. package/dist/components/Toast/ToastsWrapper/ToastsWrapper.js.map +1 -0
  147. package/dist/components/Tooltip/Tooltip.d.ts +1 -1
  148. package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
  149. package/dist/components/Tooltip/Tooltip.js +62 -0
  150. package/dist/components/Tooltip/Tooltip.js.map +1 -0
  151. package/dist/components/Typography/Heading.js +30 -0
  152. package/dist/components/Typography/Heading.js.map +1 -0
  153. package/dist/components/Typography/Text.js +15 -0
  154. package/dist/components/Typography/Text.js.map +1 -0
  155. package/dist/components/index.js +124 -75
  156. package/dist/components/index.js.map +1 -1
  157. package/dist/fictoan-schema.json +2070 -0
  158. package/dist/hooks/UseClickOutside.js +17 -0
  159. package/dist/hooks/UseClickOutside.js.map +1 -0
  160. package/dist/hooks/UseViewTransition.d.ts +2 -0
  161. package/dist/hooks/UseViewTransition.d.ts.map +1 -0
  162. package/dist/hooks/UseViewTransition.js +17 -0
  163. package/dist/hooks/UseViewTransition.js.map +1 -0
  164. package/dist/index.css +6 -10661
  165. package/dist/index.d.ts +1 -0
  166. package/dist/index.d.ts.map +1 -1
  167. package/dist/index.js +142 -151
  168. package/dist/index.js.map +1 -1
  169. package/dist/scripts/generateSchema.d.ts +2 -0
  170. package/dist/scripts/generateSchema.d.ts.map +1 -0
  171. package/dist/scripts/schema-meta.d.ts +12 -0
  172. package/dist/scripts/schema-meta.d.ts.map +1 -0
  173. package/dist/styles/colours.js +55 -0
  174. package/dist/styles/colours.js.map +1 -0
  175. package/dist/utils/classNames.js +6 -0
  176. package/dist/utils/classNames.js.map +1 -0
  177. package/dist/utils/propSeparation.js +77 -0
  178. package/dist/utils/propSeparation.js.map +1 -0
  179. package/package.json +12 -18
  180. package/dist/Accordion-CeGNgNW8.js +0 -4254
  181. package/dist/Accordion-CeGNgNW8.js.map +0 -1
@@ -1,4254 +0,0 @@
1
- "use client";
2
- "use client;";
3
- import { jsx as o, jsxs as I, Fragment as Me } from "react/jsx-runtime";
4
- import N, { useCallback as G, useEffect as U, useRef as Y, useState as j, useMemo as ye, createElement as Mt, createRef as Et, useImperativeHandle as Qe, createContext as Le, useContext as Ne } from "react";
5
- import { createRoot as Pt } from "react-dom/client";
6
- const St = (e) => e.filter((t) => !!t).join(" "), D = N.forwardRef(
7
- ({
8
- as: e = "div",
9
- role: t,
10
- ariaLabel: a,
11
- tabIndex: r,
12
- onKeyDown: c,
13
- ...n
14
- }, s) => {
15
- const {
16
- classNames: l = [],
17
- bgColor: i,
18
- bgColour: u,
19
- bgOpacity: d,
20
- borderColor: f,
21
- borderColour: p,
22
- borderOpacity: $,
23
- className: v,
24
- columns: k,
25
- fillColor: m,
26
- fillColour: A,
27
- gap: y,
28
- hideOnDesktop: R,
29
- hideOnMobile: T,
30
- hideOnTabletLandscape: F,
31
- hideOnTabletPortrait: V,
32
- horizontalMargin: E,
33
- horizontalPadding: P,
34
- horizontallyCenterThis: g,
35
- horizontallyCentreThis: L,
36
- inheritFormSpacing: _,
37
- isClickable: S,
38
- isFullHeight: w,
39
- isFullWidth: z,
40
- layoutAsFlexbox: C,
41
- layoutAsGrid: B,
42
- stackVertically: b,
43
- stackHorizontally: x,
44
- marginLeft: h,
45
- marginBottom: M,
46
- margin: O,
47
- marginRight: H,
48
- marginTop: Z,
49
- opacity: le,
50
- paddingBottom: te,
51
- paddingLeft: ae,
52
- padding: re,
53
- paddingRight: we,
54
- paddingTop: ge,
55
- pushItemsToEnds: W,
56
- shadow: X,
57
- shape: Q,
58
- showOnlyOnDesktop: se,
59
- showOnlyOnMobile: $e,
60
- showOnlyOnTabletLandscape: Ce,
61
- showOnlyOnTabletPortrait: q,
62
- size: he,
63
- strokeColor: be,
64
- strokeColour: ue,
65
- textColor: xe,
66
- textColour: Se,
67
- verticalMargin: Fe,
68
- verticalPadding: Ve,
69
- verticallyCenterItems: kt,
70
- verticallyCentreItems: $t,
71
- weight: Ke,
72
- style: xt,
73
- ...Rt
74
- } = n, { className: La, classNames: Ba, ...Oa } = n, je = {
75
- ...xt,
76
- ...d && { "--bg-opacity": Number(d) / 100 },
77
- ...$ && { "--border-opacity": Number($) / 100 }
78
- };
79
- return /* @__PURE__ */ o(
80
- e,
81
- {
82
- ref: s,
83
- role: t,
84
- "aria-label": a,
85
- tabIndex: r,
86
- onKeyDown: c,
87
- ...Rt,
88
- "data-form-spaced": _ || void 0,
89
- style: Object.keys(je).length > 0 ? je : void 0,
90
- className: St(
91
- [
92
- v,
93
- i && `bg-${i}`,
94
- u && `bg-${u}`,
95
- f && `border-${f}`,
96
- p && `border-${p}`,
97
- m && `fill-${m}`,
98
- A && `fill-${A}`,
99
- R && "hide-on-desktop",
100
- T && "hide-on-mobile",
101
- F && "hide-on-tablet-landscape",
102
- V && "hide-on-tablet-portrait",
103
- E && `margin-right-${E} margin-left-${E}`,
104
- P && `padding-right-${P} padding-left-${P}`,
105
- g && "horizontally-centre-this",
106
- L && "horizontally-centre-this",
107
- S && "is-clickable",
108
- w && "full-height",
109
- z && "full-width",
110
- C && "layout-flexbox",
111
- B && "layout-grid",
112
- b && "stack-vertically",
113
- x && "stack-horizontally",
114
- y && `gap-${y}`,
115
- h && `margin-left-${h}`,
116
- M && `margin-bottom-${M}`,
117
- O && `margin-all-${O}`,
118
- H && `margin-right-${H}`,
119
- Z && `margin-top-${Z}`,
120
- le && `opacity-${le}`,
121
- te && `padding-bottom-${te}`,
122
- ae && `padding-left-${ae}`,
123
- re && `padding-all-${re}`,
124
- we && `padding-right-${we}`,
125
- ge && `padding-top-${ge}`,
126
- W && "push-to-ends",
127
- X && `shadow-${X}`,
128
- Q && `shape-${Q}`,
129
- se && "show-only-on-desktop",
130
- $e && "show-only-on-mobile",
131
- Ce && "show-only-on-tablet-landscape",
132
- q && "show-only-on-tablet-portrait",
133
- he && `size-${he}`,
134
- be && `stroke-${be}`,
135
- ue && `stroke-${ue}`,
136
- xe && `text-${xe}`,
137
- Se && `text-${Se}`,
138
- Fe && `margin-top-${Fe} margin-bottom-${Fe}`,
139
- Ve && `padding-top-${Ve} padding-bottom-${Ve}`,
140
- kt && "vertically-centre-items",
141
- $t && "vertically-centre-items",
142
- Ke && `weight-${Ke}`
143
- ].concat(l)
144
- )
145
- }
146
- );
147
- }
148
- );
149
- D.displayName = "Element";
150
- const de = (e, t) => N.forwardRef(
151
- (a, r) => {
152
- const c = { ...t, ...a };
153
- if (e === "a" && "external" in c) {
154
- const { external: n } = c;
155
- n && (c.target = "_blank", c.rel = "noopener noreferrer");
156
- }
157
- return /* @__PURE__ */ o(D, { as: e, ref: r, ...c });
158
- }
159
- ), Wa = de("article"), za = de("aside"), Ha = de("body"), K = de("div"), _a = de("footer"), Ga = de("header"), Ka = de("main"), It = de("nav"), ja = de("section"), Xa = de("span"), Ua = de("a", {
160
- rel: "noopener noreferrer"
161
- // Default props for Hyperlink
162
- }), Tt = {
163
- cross: /* @__PURE__ */ o("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ o("path", { d: "M18 6L6 18M6 6l12 12" }) }),
164
- tick: /* @__PURE__ */ o("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ o("path", { d: "M5 12l5 5L20 7" }) }),
165
- plus: /* @__PURE__ */ o("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ o("path", { d: "M12 5v14M5 12h14" }) }),
166
- minus: /* @__PURE__ */ o("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ o("path", { d: "M5 12h14" }) })
167
- }, Be = N.forwardRef(
168
- ({
169
- children: e,
170
- size: t = "medium",
171
- shape: a,
172
- actionIcon: r,
173
- onActionClick: c,
174
- actionAriaLabel: n,
175
- ...s
176
- }, l) => {
177
- let i = [];
178
- t && i.push(`size-${t}`), a && i.push(`shape-${a}`);
179
- const u = (f) => {
180
- f.stopPropagation(), c == null || c(f);
181
- }, d = !!r;
182
- return /* @__PURE__ */ I(
183
- D,
184
- {
185
- "data-badge": !0,
186
- "data-has-action": d || void 0,
187
- ref: l,
188
- classNames: i,
189
- role: "status",
190
- "aria-label": typeof e == "string" ? e : void 0,
191
- ...s,
192
- children: [
193
- e,
194
- d && /* @__PURE__ */ o(
195
- "button",
196
- {
197
- type: "button",
198
- className: "badge-action-button",
199
- onClick: u,
200
- "aria-label": n,
201
- children: Tt[r]
202
- }
203
- )
204
- ]
205
- }
206
- );
207
- }
208
- );
209
- Be.displayName = "Badge";
210
- const ze = (e, t) => {
211
- const a = G(t, [t]);
212
- U(() => {
213
- const r = (c) => {
214
- !e.current || typeof a != "function" || e.current.contains(c.target) || a(c);
215
- };
216
- return document.addEventListener("mousedown", r), document.addEventListener("touchstart", r), () => {
217
- document.removeEventListener("mousedown", r), document.removeEventListener("touchstart", r);
218
- };
219
- }, [e, a]);
220
- }, Dt = N.forwardRef(
221
- ({
222
- id: e,
223
- children: t,
224
- isOpen: a = !1,
225
- onClose: r,
226
- position: c = "right",
227
- size: n = "medium",
228
- padding: s = "micro",
229
- bgColor: l,
230
- bgColour: i,
231
- isDismissible: u = !0,
232
- showOverlay: d = !0,
233
- blurOverlay: f = !1,
234
- closeOnClickOutside: p = !0,
235
- zIndex: $,
236
- label: v,
237
- description: k,
238
- classNames: m = [],
239
- ...A
240
- }, y) => {
241
- const R = `${e}`, T = k ? `${R}-description` : void 0, F = Y(null), V = y || F, E = [
242
- "drawer",
243
- c,
244
- n,
245
- ...a ? ["open"] : [],
246
- ...d ? ["with-overlay"] : [],
247
- ...f ? ["blur-overlay"] : [],
248
- ...m
249
- ];
250
- return U(() => {
251
- const g = V.current, L = document.querySelector(`[data-drawer-overlay-for="${R}"]`);
252
- return a ? (g == null || g.classList.add("open"), g == null || g.classList.remove("closing"), g == null || g.focus(), L && L.classList.add("visible"), document.body.style.overflow = "hidden") : g != null && g.classList.contains("open") && (g.classList.add("closing"), g.classList.remove("open"), L && L.classList.remove("visible"), document.body.style.overflow = ""), () => {
253
- document.body.style.overflow = "";
254
- };
255
- }, [a, R, V]), U(() => {
256
- const g = (L) => {
257
- L.key === "Escape" && u && a && r && r();
258
- };
259
- return document.addEventListener("keydown", g), () => document.removeEventListener("keydown", g);
260
- }, [u, a, r]), ze(V, () => {
261
- p && u && a && r && r();
262
- }), /* @__PURE__ */ I(Me, { children: [
263
- d && /* @__PURE__ */ o(
264
- K,
265
- {
266
- className: `drawer-overlay ${f ? "blur" : ""} ${a ? "visible" : ""}`,
267
- "data-drawer-overlay-for": e,
268
- "aria-hidden": "true",
269
- onClick: p && u && r ? r : void 0,
270
- style: { zIndex: $ ?? 9999 }
271
- }
272
- ),
273
- /* @__PURE__ */ I(
274
- D,
275
- {
276
- as: "div",
277
- id: R,
278
- "data-drawer": !0,
279
- ref: V,
280
- classNames: E,
281
- onAnimationEnd: (g) => {
282
- (g.animationName.includes("slide-out") || g.animationName.includes("fade-out")) && g.currentTarget.classList.remove("closing");
283
- },
284
- role: "dialog",
285
- "aria-modal": "true",
286
- "aria-label": v || "Drawer",
287
- "aria-describedby": T,
288
- tabIndex: -1,
289
- style: { zIndex: $ ?? 1e4 },
290
- ...A,
291
- children: [
292
- u && r && /* @__PURE__ */ o(
293
- "button",
294
- {
295
- className: "drawer-dismiss-button",
296
- onClick: r,
297
- "aria-label": "Close drawer",
298
- tabIndex: 0,
299
- children: "×"
300
- }
301
- ),
302
- /* @__PURE__ */ I(
303
- K,
304
- {
305
- className: "drawer-content",
306
- role: "document",
307
- padding: s,
308
- bgColor: l,
309
- bgColour: i,
310
- children: [
311
- k && /* @__PURE__ */ o("div", { id: T, className: "sr-only", children: k }),
312
- t
313
- ]
314
- }
315
- )
316
- ]
317
- }
318
- )
319
- ] });
320
- }
321
- );
322
- Dt.displayName = "Drawer";
323
- const He = N.forwardRef(
324
- ({ size: e = "medium", shape: t, kind: a, variant: r, isLoading: c, label: n, ...s }, l) => {
325
- let i = [];
326
- return a && i.push(a), r && i.push(r), e && i.push(`size-${e}`), t && i.push(`shape-${t}`), c && i.push("is-loading"), /* @__PURE__ */ o(
327
- D,
328
- {
329
- as: "button",
330
- "data-button": !0,
331
- ref: l,
332
- classNames: i,
333
- "aria-label": n,
334
- "aria-disabled": s.disabled || c,
335
- "aria-busy": c,
336
- ...s
337
- }
338
- );
339
- }
340
- );
341
- He.displayName = "Button";
342
- const At = N.forwardRef(
343
- ({ isJoint: e = !0, spacing: t, equaliseWidth: a, children: r, ...c }, n) => {
344
- let s = [];
345
- return e && s.push("is-joint"), t && !e && s.push(`spacing-${t}`), a && s.push("equal-width"), /* @__PURE__ */ o(
346
- D,
347
- {
348
- as: "div",
349
- "data-button-group": !0,
350
- ref: n,
351
- role: "group",
352
- classNames: s,
353
- ...c,
354
- children: r
355
- }
356
- );
357
- }
358
- );
359
- At.displayName = "ButtonGroup";
360
- const Xe = N.forwardRef(
361
- ({ children: e, current: t, ...a }, r) => /* @__PURE__ */ o(
362
- D,
363
- {
364
- as: "li",
365
- "data-breadcrumb-item": !0,
366
- ref: r,
367
- ...a,
368
- "aria-current": t ? "page" : void 0,
369
- className: t ? "current" : void 0,
370
- role: "listitem",
371
- children: /* @__PURE__ */ o("span", { className: "breadcrumb-content", children: e })
372
- }
373
- )
374
- ), Lt = ({ separator: e }) => /* @__PURE__ */ o(
375
- J,
376
- {
377
- className: "breadcrumb-separator",
378
- "aria-hidden": "true",
379
- role: "presentation",
380
- margin: "none",
381
- children: e
382
- }
383
- ), Bt = N.forwardRef(
384
- ({ children: e, separator: t = "/", spacing: a = "micro", ...r }, c) => {
385
- let n = [];
386
- a && n.push(`spacing-${a}`);
387
- const s = N.Children.toArray(e).filter(Boolean), l = s.reduce((i, u, d) => {
388
- if (!N.isValidElement(u)) return i;
389
- const f = d === s.length - 1;
390
- let p;
391
- if (u.type === Xe) {
392
- const $ = u;
393
- p = N.cloneElement($, {
394
- current: f
395
- });
396
- } else
397
- p = /* @__PURE__ */ o(Xe, { current: f, children: u }, `item-${d}`);
398
- return i.push(p), f || i.push(
399
- /* @__PURE__ */ o(Lt, { separator: t }, `sep-${d}`)
400
- ), i;
401
- }, []);
402
- return /* @__PURE__ */ o("nav", { "aria-label": "Breadcrumb", ref: c, ...r, children: /* @__PURE__ */ o(
403
- D,
404
- {
405
- as: "ul",
406
- "data-breadcrumbs-wrapper": !0,
407
- role: "list",
408
- classNames: n,
409
- children: l
410
- }
411
- ) });
412
- }
413
- );
414
- Bt.displayName = "Breadcrumbs";
415
- const et = N.forwardRef(
416
- ({ kind: e, children: t, title: a, ...r }, c) => /* @__PURE__ */ o(
417
- D,
418
- {
419
- as: "div",
420
- "data-callout": !0,
421
- ref: c,
422
- className: e,
423
- role: {
424
- info: "status",
425
- success: "status",
426
- warning: "alert",
427
- error: "alert"
428
- }[e],
429
- "aria-live": e === "error" || e === "warning" ? "assertive" : "polite",
430
- "aria-label": a,
431
- ...r,
432
- children: t
433
- }
434
- )
435
- );
436
- et.displayName = "Callout";
437
- const tt = N.forwardRef(({ shape: e, heading: t, children: a, ...r }, c) => {
438
- let n = [];
439
- return e && n.push(`shape-${e}`), /* @__PURE__ */ o(
440
- D,
441
- {
442
- as: "div",
443
- "data-card": !0,
444
- ref: c,
445
- classNames: n,
446
- role: "region",
447
- "aria-label": t,
448
- tabIndex: 0,
449
- ...r,
450
- children: a
451
- }
452
- );
453
- });
454
- tt.displayName = "Card";
455
- const Ot = N.forwardRef(({
456
- children: e,
457
- source: t,
458
- language: a = "json",
459
- showCopyButton: r,
460
- showLineNumbers: c,
461
- description: n,
462
- withSyntaxHighlighting: s = !1,
463
- makeEditable: l = !1,
464
- onChange: i,
465
- shadow: u,
466
- ...d
467
- }, f) => {
468
- const [p, $] = j(!1), [v, k] = j(null), [m, A] = j(s), [y, R] = j(null), T = Y(null);
469
- let F = typeof e == "string" ? e : N.Children.toArray(e).join("");
470
- e || (F = typeof t == "object" ? JSON.stringify(t, null, 2) : t ?? ""), U(() => {
471
- if (!s) return;
472
- (async () => {
473
- var z;
474
- A(!0);
475
- try {
476
- const B = (await import("prismjs")).default;
477
- if (typeof window < "u" && !window.Prism && (window.Prism = B), a !== "plain" && !B.languages[a])
478
- try {
479
- await import(`prismjs/components/prism-${a}`);
480
- } catch {
481
- console.warn(`Language "${a}" not available, falling back to plain text`);
482
- }
483
- k(B);
484
- } catch (C) {
485
- (C == null ? void 0 : C.code) === "ERR_MODULE_NOT_FOUND" || (z = C == null ? void 0 : C.message) != null && z.includes("Cannot find module") ? console.warn(
486
- "PrismJS is not installed. To enable syntax highlighting, run: npm install prismjs"
487
- ) : console.warn(`Failed to load syntax highlighting for ${a}:`, C);
488
- } finally {
489
- A(!1);
490
- }
491
- })();
492
- }, [s, a]);
493
- const V = G(() => {
494
- var x;
495
- const w = window.getSelection();
496
- if (!w || w.rangeCount === 0) return null;
497
- const z = w.getRangeAt(0), C = z.startContainer;
498
- let b = z.startOffset;
499
- if (C && C !== y && y) {
500
- const h = document.createTreeWalker(
501
- y,
502
- NodeFilter.SHOW_TEXT,
503
- null
504
- );
505
- let M;
506
- for (; (M = h.nextNode()) && M !== C; )
507
- b += ((x = M.textContent) == null ? void 0 : x.length) || 0;
508
- }
509
- return b;
510
- }, [y]), E = G((w) => {
511
- var z;
512
- if (!(!y || !s || !v))
513
- try {
514
- const C = l ? V() : null, B = v.highlight(
515
- w,
516
- v.languages[a] || v.languages.plain,
517
- a
518
- );
519
- if (y.innerHTML = B, l && C !== null) {
520
- const b = window.getSelection(), x = document.createRange(), h = document.createTreeWalker(
521
- y,
522
- NodeFilter.SHOW_TEXT,
523
- null
524
- );
525
- let M = 0, O;
526
- for (; O = h.nextNode(); ) {
527
- const H = ((z = O.textContent) == null ? void 0 : z.length) || 0;
528
- if (M + H >= C) {
529
- x.setStart(O, C - M), x.setEnd(O, C - M), b == null || b.removeAllRanges(), b == null || b.addRange(x);
530
- break;
531
- }
532
- M += H;
533
- }
534
- }
535
- } catch (C) {
536
- console.warn("Error highlighting code:", C), y && (y.textContent = w);
537
- }
538
- }, [a, s, l, v, V, y]), P = G((w) => {
539
- if (!y) return;
540
- const z = y.textContent || "";
541
- i == null || i(z), requestAnimationFrame(() => {
542
- E(z);
543
- });
544
- }, [E, i, y]);
545
- U(() => {
546
- const w = y;
547
- if (!(!w || !l))
548
- return w.addEventListener("input", P), () => {
549
- w.removeEventListener("input", P);
550
- };
551
- }, [l, P, y]), U(() => {
552
- !y || !v || E(F);
553
- }, [E, F, v, y]);
554
- const g = async () => {
555
- try {
556
- const w = y ? y.textContent || "" : F;
557
- await navigator.clipboard.writeText(w), $(!0), setTimeout(() => $(!1), 3e3);
558
- } catch (w) {
559
- console.error("Could not copy text: ", w);
560
- }
561
- }, L = async (w) => {
562
- (w.key === "Enter" || w.key === " ") && w.target === T.current && (w.preventDefault(), await g());
563
- };
564
- let _ = [];
565
- c && _.push("show-line-numbers");
566
- const S = F.split(/\r\n|\r|\n/gm);
567
- return /* @__PURE__ */ I(
568
- D,
569
- {
570
- "data-code-block": !0,
571
- as: "div",
572
- classNames: _,
573
- role: "region",
574
- "aria-label": n || `Code block in ${a}`,
575
- ...d,
576
- children: [
577
- r ? p ? /* @__PURE__ */ o(
578
- Be,
579
- {
580
- className: "code-block-copied-badge",
581
- size: "tiny",
582
- shape: "rounded",
583
- "aria-live": "polite",
584
- children: "Copied!"
585
- }
586
- ) : /* @__PURE__ */ o(
587
- He,
588
- {
589
- type: "button",
590
- className: "code-block-copy-button",
591
- size: "tiny",
592
- shape: "rounded",
593
- onClick: g,
594
- onKeyDown: L,
595
- "aria-label": "Copy code to clipboard",
596
- children: "Copy"
597
- }
598
- ) : null,
599
- /* @__PURE__ */ I(
600
- "pre",
601
- {
602
- ref: T,
603
- className: `language-${a}${u ? ` shadow-${u}` : ""}`,
604
- tabIndex: 0,
605
- "aria-label": `Code in ${a}`,
606
- children: [
607
- c && Array.from(Array(S.length).keys()).map((w) => /* @__PURE__ */ o(
608
- "span",
609
- {
610
- className: "line-numbers",
611
- "aria-hidden": "true",
612
- children: w + 1
613
- },
614
- w
615
- )),
616
- /* @__PURE__ */ o(
617
- "code",
618
- {
619
- ref: R,
620
- contentEditable: l,
621
- suppressContentEditableWarning: !0,
622
- spellCheck: "false",
623
- className: `language-${a} ${m ? "is-loading" : ""}`,
624
- children: F
625
- }
626
- )
627
- ]
628
- }
629
- )
630
- ]
631
- }
632
- );
633
- });
634
- Ot.displayName = "CodeBlock";
635
- const at = N.forwardRef(
636
- ({ kind: e, height: t, label: a, ...r }, c) => {
637
- let n = [];
638
- return e && n.push(e), /* @__PURE__ */ o(
639
- D,
640
- {
641
- as: "hr",
642
- "data-hrule": !0,
643
- ref: c,
644
- classNames: n,
645
- role: "separator",
646
- "aria-orientation": "horizontal",
647
- "aria-label": a,
648
- ...r,
649
- style: { height: t }
650
- }
651
- );
652
- }
653
- );
654
- at.displayName = "Divider";
655
- const Ct = [
656
- // Colours
657
- "bgColor",
658
- "bgColour",
659
- "bgOpacity",
660
- "textColor",
661
- "textColour",
662
- "borderColor",
663
- "borderColour",
664
- "borderOpacity",
665
- "fillColor",
666
- "fillColour",
667
- "strokeColor",
668
- "strokeColour",
669
- // Visual
670
- "shadow",
671
- "shape",
672
- "opacity",
673
- // Layout
674
- "layoutAsFlexbox",
675
- "stackVertically",
676
- "stackHorizontally",
677
- "layoutAsGrid",
678
- "columns",
679
- "gap",
680
- // Margin
681
- "margin",
682
- "horizontalMargin",
683
- "verticalMargin",
684
- "marginTop",
685
- "marginRight",
686
- "marginBottom",
687
- "marginLeft",
688
- // Padding
689
- "padding",
690
- "horizontalPadding",
691
- "verticalPadding",
692
- "paddingTop",
693
- "paddingRight",
694
- "paddingBottom",
695
- "paddingLeft",
696
- // Alignment
697
- "horizontallyCentreThis",
698
- "horizontallyCenterThis",
699
- "verticallyCentreItems",
700
- "verticallyCenterItems",
701
- "pushItemsToEnds",
702
- // Sizing
703
- "isFullWidth",
704
- "isFullHeight",
705
- // Responsive visibility
706
- "hideOnMobile",
707
- "showOnlyOnMobile",
708
- "hideOnTabletPortrait",
709
- "showOnlyOnTabletPortrait",
710
- "hideOnTabletLandscape",
711
- "showOnlyOnTabletLandscape",
712
- "hideOnDesktop",
713
- "showOnlyOnDesktop",
714
- // Typography
715
- "weight",
716
- // Custom classes
717
- "classNames"
718
- ], ie = (e) => {
719
- const t = {}, a = {};
720
- for (const r of Object.keys(e))
721
- Ct.includes(r) ? t[r] = e[r] : a[r] = e[r];
722
- return {
723
- wrapperProps: t,
724
- inputProps: a
725
- };
726
- }, Ee = N.forwardRef(
727
- ({
728
- label: e,
729
- hideLabel: t,
730
- htmlFor: a,
731
- ...r
732
- }, c) => {
733
- let n = [];
734
- return t && n.push("visually-hidden"), /* @__PURE__ */ o(
735
- D,
736
- {
737
- as: "label",
738
- ref: c,
739
- htmlFor: a,
740
- classNames: n,
741
- ...r,
742
- children: e
743
- }
744
- );
745
- }
746
- );
747
- Ee.displayName = "InputLabel";
748
- const J = N.forwardRef(
749
- ({ weight: e, size: t, fontStyle: a = "sans-serif", align: r, isSubtext: c, ...n }, s) => {
750
- let l = [];
751
- return e && l.push(`weight-${e}`), t && l.push(`text-${t}`), a && l.push(`font-${a}`), c && l.push("sub-text"), r && l.push(`text-${r}`), /* @__PURE__ */ o(D, { as: "p", ref: s, classNames: l, ...n });
752
- }
753
- );
754
- J.displayName = "Text";
755
- const Ft = ({ state: e }) => e === "valid" ? /* @__PURE__ */ o(
756
- "svg",
757
- {
758
- "data-validation-icon": "valid",
759
- xmlns: "http://www.w3.org/2000/svg",
760
- viewBox: "0 0 24 24",
761
- width: "20",
762
- height: "20",
763
- children: /* @__PURE__ */ o(
764
- "polyline",
765
- {
766
- points: "3.5 12.5 8.5 17.5 20.5 5.5",
767
- fill: "none",
768
- stroke: "#0ec05c",
769
- strokeMiterlimit: "10",
770
- strokeWidth: "2"
771
- }
772
- )
773
- }
774
- ) : /* @__PURE__ */ I(
775
- "svg",
776
- {
777
- "data-validation-icon": "invalid",
778
- xmlns: "http://www.w3.org/2000/svg",
779
- viewBox: "0 0 24 24",
780
- width: "20",
781
- height: "20",
782
- children: [
783
- /* @__PURE__ */ o(
784
- "line",
785
- {
786
- x1: "6.5",
787
- y1: "17.5",
788
- x2: "18.5",
789
- y2: "5.5",
790
- fill: "none",
791
- stroke: "#ef4343",
792
- strokeMiterlimit: "10",
793
- strokeWidth: "2"
794
- }
795
- ),
796
- /* @__PURE__ */ o(
797
- "line",
798
- {
799
- x1: "6.5",
800
- y1: "5.5",
801
- x2: "18.5",
802
- y2: "17.5",
803
- fill: "none",
804
- stroke: "#ef4343",
805
- strokeMiterlimit: "10",
806
- strokeWidth: "2"
807
- }
808
- )
809
- ]
810
- }
811
- ), ee = N.forwardRef(
812
- ({
813
- label: e,
814
- customLabel: t,
815
- htmlFor: a,
816
- helpText: r,
817
- errorText: c,
818
- validationState: n,
819
- required: s,
820
- size: l,
821
- labelFirst: i,
822
- children: u,
823
- ...d
824
- }, f) => {
825
- const p = e || t, $ = r || c;
826
- return /* @__PURE__ */ I(
827
- D,
828
- {
829
- as: "div",
830
- "data-form-item": !0,
831
- "data-form-spaced": !0,
832
- ref: f,
833
- role: "group",
834
- required: s,
835
- className: [l ? `size-${l}` : "", i ? "label-first" : ""].filter(Boolean).join(" ") || void 0,
836
- ...d,
837
- children: [
838
- p && /* @__PURE__ */ I(K, { "data-label-wrapper": !0, "data-has-validation": n ? "true" : void 0, children: [
839
- t || e && /* @__PURE__ */ o(Ee, { label: e, htmlFor: a }),
840
- n && /* @__PURE__ */ o(Ft, { state: n })
841
- ] }),
842
- /* @__PURE__ */ o(K, { "data-input-wrapper": !0, children: u }),
843
- $ && /* @__PURE__ */ I(K, { className: "info-section vertically-center-items", children: [
844
- r && /* @__PURE__ */ o(J, { className: "help-text", children: r }),
845
- c && /* @__PURE__ */ o(J, { className: "error-text", children: c })
846
- ] })
847
- ]
848
- }
849
- );
850
- }
851
- );
852
- ee.displayName = "FormItem";
853
- const _e = N.forwardRef(
854
- ({
855
- id: e,
856
- name: t,
857
- label: a,
858
- hideLabel: r,
859
- helpText: c,
860
- errorText: n,
861
- onChange: s,
862
- checked: l,
863
- defaultChecked: i,
864
- disabled: u,
865
- required: d,
866
- size: f = "medium",
867
- labelFirst: p,
868
- ...$
869
- }, v) => {
870
- const k = ye(() => t || e, [t, e]), m = (R) => {
871
- s == null || s(R.target.checked);
872
- }, { wrapperProps: A, inputProps: y } = ie($);
873
- return /* @__PURE__ */ I(
874
- ee,
875
- {
876
- label: a,
877
- htmlFor: e,
878
- helpText: c,
879
- errorText: n,
880
- required: d,
881
- size: f,
882
- labelFirst: p,
883
- ...A,
884
- children: [
885
- /* @__PURE__ */ o(
886
- D,
887
- {
888
- as: "input",
889
- type: "checkbox",
890
- ref: v,
891
- id: e,
892
- name: k,
893
- checked: l,
894
- defaultChecked: i,
895
- disabled: u,
896
- required: d,
897
- onChange: m,
898
- ...y
899
- }
900
- ),
901
- /* @__PURE__ */ o(
902
- D,
903
- {
904
- as: p ? "label" : "div",
905
- htmlFor: p ? e : void 0,
906
- "data-checkbox": !0,
907
- className: `size-${f}`
908
- }
909
- )
910
- ]
911
- }
912
- );
913
- }
914
- );
915
- _e.displayName = "Checkbox";
916
- const Ge = N.forwardRef(
917
- ({
918
- id: e,
919
- name: t,
920
- label: a,
921
- hideLabel: r,
922
- helpText: c,
923
- errorText: n,
924
- onChange: s,
925
- checked: l,
926
- defaultChecked: i,
927
- disabled: u,
928
- required: d,
929
- size: f = "medium",
930
- labelFirst: p,
931
- ...$
932
- }, v) => {
933
- const k = ye(() => t || e, [t, e]), m = (R) => {
934
- s == null || s(R.target.checked);
935
- }, { wrapperProps: A, inputProps: y } = ie($);
936
- return /* @__PURE__ */ I(
937
- ee,
938
- {
939
- label: a,
940
- htmlFor: e,
941
- helpText: c,
942
- errorText: n,
943
- required: d,
944
- size: f,
945
- labelFirst: p,
946
- ...A,
947
- children: [
948
- /* @__PURE__ */ o(
949
- D,
950
- {
951
- as: "input",
952
- type: "checkbox",
953
- ref: v,
954
- id: e,
955
- name: k,
956
- checked: l,
957
- defaultChecked: i,
958
- disabled: u,
959
- required: d,
960
- onChange: m,
961
- ...y
962
- }
963
- ),
964
- /* @__PURE__ */ o(
965
- D,
966
- {
967
- as: p ? "label" : "div",
968
- htmlFor: p ? e : void 0,
969
- "data-switch": !0,
970
- className: `size-${f}`
971
- }
972
- )
973
- ]
974
- }
975
- );
976
- }
977
- );
978
- Ge.displayName = "Switch";
979
- const Vt = N.forwardRef(
980
- ({
981
- id: e,
982
- name: t,
983
- label: a,
984
- helpText: r,
985
- errorText: c,
986
- options: n,
987
- value: s,
988
- defaultValue: l,
989
- onChange: i,
990
- align: u,
991
- equaliseWidth: d,
992
- equalizeWidth: f,
993
- required: p,
994
- disabled: $,
995
- size: v,
996
- columns: k,
997
- labelFirst: m,
998
- ...A
999
- }, y) => {
1000
- const R = ye(() => t || e, [t, e]), [T, F] = N.useState(
1001
- s || l || []
1002
- );
1003
- N.useEffect(() => {
1004
- s !== void 0 && F(s);
1005
- }, [s]);
1006
- const V = (P, g) => {
1007
- let L;
1008
- g ? L = [...T, P] : L = T.filter((_) => _ !== P), s === void 0 && F(L), i == null || i(L);
1009
- };
1010
- let E = [];
1011
- return u && E.push(`align-${u}`), (d || f) && E.push("equalise-width"), k && E.push("with-columns"), m && E.push("label-first"), /* @__PURE__ */ o(
1012
- ee,
1013
- {
1014
- label: a,
1015
- htmlFor: e,
1016
- helpText: r,
1017
- errorText: c,
1018
- required: p,
1019
- children: /* @__PURE__ */ o(
1020
- D,
1021
- {
1022
- as: "div",
1023
- "data-checkbox-group": !0,
1024
- ref: y,
1025
- classNames: E,
1026
- role: "group",
1027
- "aria-label": a,
1028
- style: k ? { gridTemplateColumns: `repeat(${k}, 1fr)` } : void 0,
1029
- ...A,
1030
- children: n.map((P, g) => {
1031
- const { id: L, value: _, label: S, ...w } = P, z = L || `${e}-option-${g}`, C = T.includes(_);
1032
- return /* @__PURE__ */ o(
1033
- _e,
1034
- {
1035
- id: z,
1036
- name: R,
1037
- label: S,
1038
- checked: C,
1039
- disabled: $ || P.disabled,
1040
- size: v,
1041
- labelFirst: m,
1042
- onChange: (B) => V(_, B),
1043
- ...w
1044
- },
1045
- z
1046
- );
1047
- })
1048
- }
1049
- )
1050
- }
1051
- );
1052
- }
1053
- );
1054
- Vt.displayName = "CheckboxGroup";
1055
- const Wt = N.forwardRef(
1056
- ({
1057
- id: e,
1058
- name: t,
1059
- label: a,
1060
- helpText: r,
1061
- errorText: c,
1062
- options: n,
1063
- value: s,
1064
- defaultValue: l,
1065
- onChange: i,
1066
- align: u,
1067
- equaliseWidth: d,
1068
- equalizeWidth: f,
1069
- required: p,
1070
- disabled: $,
1071
- size: v,
1072
- columns: k,
1073
- labelFirst: m,
1074
- ...A
1075
- }, y) => {
1076
- const R = ye(() => t || e, [t, e]), [T, F] = N.useState(
1077
- s || l || []
1078
- );
1079
- N.useEffect(() => {
1080
- s !== void 0 && F(s);
1081
- }, [s]);
1082
- const V = (P, g) => {
1083
- let L;
1084
- g ? L = [...T, P] : L = T.filter((_) => _ !== P), s === void 0 && F(L), i == null || i(L);
1085
- };
1086
- let E = [];
1087
- return u && E.push(`align-${u}`), (d || f) && E.push("equalise-width"), k && E.push("with-columns"), m && E.push("label-first"), /* @__PURE__ */ o(
1088
- ee,
1089
- {
1090
- label: a,
1091
- htmlFor: e,
1092
- helpText: r,
1093
- errorText: c,
1094
- required: p,
1095
- children: /* @__PURE__ */ o(
1096
- D,
1097
- {
1098
- as: "div",
1099
- "data-switch-group": !0,
1100
- ref: y,
1101
- classNames: E,
1102
- role: "group",
1103
- "aria-label": a,
1104
- style: k ? { gridTemplateColumns: `repeat(${k}, 1fr)` } : void 0,
1105
- ...A,
1106
- children: n.map((P, g) => {
1107
- const { id: L, value: _, label: S, ...w } = P, z = L || `${e}-option-${g}`, C = T.includes(_);
1108
- return /* @__PURE__ */ o(
1109
- Ge,
1110
- {
1111
- id: z,
1112
- name: R,
1113
- label: S,
1114
- checked: C,
1115
- disabled: $ || P.disabled,
1116
- size: v,
1117
- labelFirst: m,
1118
- onChange: (B) => V(_, B),
1119
- ...w
1120
- },
1121
- z
1122
- );
1123
- })
1124
- }
1125
- )
1126
- }
1127
- );
1128
- }
1129
- );
1130
- Wt.displayName = "SwitchGroup";
1131
- const rt = N.forwardRef(
1132
- ({
1133
- "aria-label": e,
1134
- "aria-invalid": t,
1135
- label: a,
1136
- helpText: r,
1137
- errorText: c,
1138
- required: n,
1139
- accept: s,
1140
- allowMultipleFiles: l = !1,
1141
- capture: i,
1142
- height: u = "120px",
1143
- onChange: d,
1144
- className: f = "",
1145
- instructionMainText: p = "Drag and drop or click to upload",
1146
- instructionSubText: $ = "You can add multiple files",
1147
- invalid: v,
1148
- id: k,
1149
- name: m,
1150
- badgeBgColour: A,
1151
- badgeTextColour: y,
1152
- size: R,
1153
- ...T
1154
- }, F) => {
1155
- const [V, E] = j([]), [P, g] = j(!1), L = Y(null), _ = (h) => {
1156
- h.preventDefault(), h.stopPropagation(), g(!0);
1157
- }, S = (h) => {
1158
- h.preventDefault(), h.stopPropagation(), g(!1);
1159
- }, w = (h) => {
1160
- h.preventDefault(), h.stopPropagation(), g(!1);
1161
- const M = Array.from(h.dataTransfer.files);
1162
- z(M);
1163
- }, z = (h) => {
1164
- if (l)
1165
- E((M) => [...M, ...h]), d == null || d([...V, ...h]);
1166
- else {
1167
- const M = h[0];
1168
- E([M]), d == null || d([M]);
1169
- }
1170
- }, C = (h) => {
1171
- if (h.target.files) {
1172
- const M = Array.from(h.target.files);
1173
- z(M);
1174
- }
1175
- }, B = (h) => {
1176
- const M = V.filter((O, H) => H !== h);
1177
- E(M), d == null || d(M);
1178
- }, b = () => {
1179
- var h;
1180
- (h = L.current) == null || h.click();
1181
- }, { wrapperProps: x } = ie(T);
1182
- return /* @__PURE__ */ o(
1183
- ee,
1184
- {
1185
- label: a,
1186
- htmlFor: k,
1187
- helpText: r,
1188
- errorText: c,
1189
- required: n,
1190
- size: R,
1191
- ...x,
1192
- children: /* @__PURE__ */ I(
1193
- K,
1194
- {
1195
- "data-file-upload-area": !0,
1196
- ref: F,
1197
- className: [
1198
- "file-upload-wrapper",
1199
- P ? "dragging" : "",
1200
- f
1201
- ].filter(Boolean).join(" "),
1202
- "aria-label": e || a,
1203
- "aria-invalid": t || v || void 0,
1204
- "aria-required": n,
1205
- children: [
1206
- /* @__PURE__ */ I(
1207
- K,
1208
- {
1209
- className: "file-upload-area",
1210
- onDragOver: _,
1211
- onDragLeave: S,
1212
- onDrop: w,
1213
- onClick: b,
1214
- style: { height: u },
1215
- children: [
1216
- /* @__PURE__ */ o(
1217
- "input",
1218
- {
1219
- ref: L,
1220
- type: "file",
1221
- id: k,
1222
- name: m,
1223
- onChange: C,
1224
- multiple: l,
1225
- accept: s,
1226
- capture: i,
1227
- className: "file-input"
1228
- }
1229
- ),
1230
- p && /* @__PURE__ */ I(K, { className: "file-upload-content", children: [
1231
- /* @__PURE__ */ o(J, { children: p }),
1232
- $ && /* @__PURE__ */ o(J, { isSubtext: !0, children: $ })
1233
- ] })
1234
- ]
1235
- }
1236
- ),
1237
- V.length > 0 && /* @__PURE__ */ o(K, { className: "uploaded-files", children: V.map((h, M) => /* @__PURE__ */ o(
1238
- Be,
1239
- {
1240
- size: "small",
1241
- shape: "rounded",
1242
- actionIcon: "cross",
1243
- onActionClick: () => B(M),
1244
- actionAriaLabel: `Remove ${h.name}`,
1245
- bgColour: A,
1246
- textColour: y,
1247
- children: h.name
1248
- },
1249
- `${h.name}-${M}`
1250
- )) })
1251
- ]
1252
- }
1253
- )
1254
- }
1255
- );
1256
- }
1257
- );
1258
- rt.displayName = "FileUpload";
1259
- const Pe = N.forwardRef(
1260
- ({
1261
- // FormItem props
1262
- label: e,
1263
- hideLabel: t,
1264
- helpText: a,
1265
- errorText: r,
1266
- size: c,
1267
- required: n,
1268
- // Side elements
1269
- innerIconLeft: s,
1270
- innerIconRight: l,
1271
- innerTextLeft: i,
1272
- innerTextRight: u,
1273
- // Validation
1274
- validateThis: d,
1275
- valid: f,
1276
- invalid: p,
1277
- validationState: $,
1278
- // Handlers
1279
- onChange: v,
1280
- onBlur: k,
1281
- onFocus: m,
1282
- // Aria
1283
- "aria-label": A,
1284
- "aria-invalid": y,
1285
- // Input props
1286
- id: R,
1287
- name: T,
1288
- value: F,
1289
- defaultValue: V,
1290
- type: E = "text",
1291
- placeholder: P,
1292
- autoComplete: g,
1293
- maxLength: L,
1294
- minLength: _,
1295
- pattern: S,
1296
- readOnly: w,
1297
- disabled: z,
1298
- className: C,
1299
- ...B
1300
- }, b) => {
1301
- const x = Y(null), h = Y(null), M = Y(null), [O, H] = j(!1), [Z, le] = j(null), te = $ ?? (d ? Z : null), ae = N.useCallback(
1302
- (q) => {
1303
- M.current = q, typeof b == "function" ? b(q) : b && (b.current = q);
1304
- },
1305
- [b]
1306
- ), re = () => {
1307
- const q = M.current;
1308
- if (!q || q.value === "") {
1309
- le(null);
1310
- return;
1311
- }
1312
- le(q.validity.valid ? "valid" : "invalid");
1313
- }, we = (q) => {
1314
- v == null || v(q.target.value), O && d && re();
1315
- }, ge = (q) => {
1316
- H(!0), d && re(), k == null || k(q);
1317
- }, W = (q) => {
1318
- m == null || m(q);
1319
- };
1320
- U(() => {
1321
- const q = (he, be) => {
1322
- if (!he) return;
1323
- const ue = he.closest("[data-form-item]");
1324
- ue == null || ue.style.setProperty(
1325
- `--side-element-${be}-width`,
1326
- `${he.getBoundingClientRect().width}px`
1327
- );
1328
- };
1329
- (i || s) && q(x.current, "left"), (u || l) && q(h.current, "right");
1330
- }, [i, u, s, l]);
1331
- const X = (q, he, be) => {
1332
- if (!q) return null;
1333
- const ue = typeof q == "string", xe = N.isValidElement(q) ? q.props : {}, Se = !ue && N.isValidElement(q) && (xe.onClick || xe.onKeyDown || q.type === "button" || q.type === "a");
1334
- return /* @__PURE__ */ o(
1335
- K,
1336
- {
1337
- ref: be,
1338
- "data-input-side-element": !0,
1339
- className: `${he} ${ue ? "is-text" : "is-icon"} ${Se ? "is-interactive" : ""}`,
1340
- "aria-hidden": "true",
1341
- children: q
1342
- }
1343
- );
1344
- }, Q = !!(s || i), se = !!(l || u), { wrapperProps: $e, inputProps: Ce } = ie(B);
1345
- return /* @__PURE__ */ I(
1346
- ee,
1347
- {
1348
- label: e,
1349
- htmlFor: R,
1350
- helpText: a,
1351
- errorText: r,
1352
- validationState: te,
1353
- required: n,
1354
- size: c,
1355
- ...$e,
1356
- children: [
1357
- /* @__PURE__ */ o(
1358
- D,
1359
- {
1360
- as: "input",
1361
- ref: ae,
1362
- "data-input-field": !0,
1363
- id: R,
1364
- name: T,
1365
- type: E,
1366
- value: F,
1367
- defaultValue: V,
1368
- placeholder: P || " ",
1369
- autoComplete: g,
1370
- maxLength: L,
1371
- minLength: _,
1372
- pattern: S,
1373
- readOnly: w,
1374
- disabled: z,
1375
- required: n,
1376
- className: [
1377
- C,
1378
- Q && "with-left-element",
1379
- se && "with-right-element"
1380
- ].filter(Boolean).join(" "),
1381
- "aria-label": A || e,
1382
- "aria-invalid": y || p,
1383
- "aria-required": n,
1384
- onChange: we,
1385
- onBlur: ge,
1386
- onFocus: W,
1387
- ...Ce
1388
- }
1389
- ),
1390
- (Q || se) && /* @__PURE__ */ I(K, { "data-input-helper": !0, "aria-hidden": "true", children: [
1391
- X(s || i, "left", x),
1392
- X(l || u, "right", h)
1393
- ] })
1394
- ]
1395
- }
1396
- );
1397
- }
1398
- );
1399
- Pe.displayName = "InputField";
1400
- const st = N.forwardRef(
1401
- ({
1402
- desktopSpan: e,
1403
- mobileSpan: t,
1404
- tabletLandscapeSpan: a,
1405
- tabletPortraitSpan: r,
1406
- isHorizontal: c,
1407
- role: n,
1408
- ...s
1409
- }, l) => {
1410
- let i = [];
1411
- return e || a || r || t ? (e && i.push(`${e}`), a && i.push(`${a}-on-tablet-landscape`), r && i.push(`${r}-on-tablet-portrait`), t && i.push(`${t}-on-mobile`)) : i.push("whole"), c && i.push("horizontal"), /* @__PURE__ */ o(
1412
- D,
1413
- {
1414
- as: "div",
1415
- "data-portion": !0,
1416
- ref: l,
1417
- classNames: i,
1418
- role: n,
1419
- ...s
1420
- }
1421
- );
1422
- }
1423
- );
1424
- st.displayName = "Portion";
1425
- const nt = N.forwardRef(
1426
- ({
1427
- id: e,
1428
- name: t,
1429
- value: a,
1430
- label: r,
1431
- helpText: c,
1432
- errorText: n,
1433
- onChange: s,
1434
- checked: l,
1435
- disabled: i,
1436
- required: u,
1437
- labelFirst: d,
1438
- ...f
1439
- }, p) => {
1440
- const $ = ye(() => t || e, [t, e]), v = (A) => {
1441
- A.target.checked && s && s(a);
1442
- }, { wrapperProps: k, inputProps: m } = ie(f);
1443
- return /* @__PURE__ */ o(
1444
- D,
1445
- {
1446
- as: "div",
1447
- "data-radio-button": !0,
1448
- ref: p,
1449
- role: "radio",
1450
- "aria-checked": l,
1451
- "aria-disabled": i,
1452
- className: d ? "label-first" : void 0,
1453
- ...k,
1454
- children: /* @__PURE__ */ I(
1455
- ee,
1456
- {
1457
- label: r,
1458
- htmlFor: e,
1459
- helpText: c,
1460
- errorText: n,
1461
- required: u,
1462
- labelFirst: d,
1463
- children: [
1464
- /* @__PURE__ */ o(
1465
- D,
1466
- {
1467
- as: "input",
1468
- type: "radio",
1469
- id: e,
1470
- name: $,
1471
- value: a,
1472
- checked: l,
1473
- disabled: i,
1474
- required: u,
1475
- onChange: v,
1476
- ...m
1477
- }
1478
- ),
1479
- /* @__PURE__ */ o(
1480
- D,
1481
- {
1482
- as: d ? "label" : "div",
1483
- htmlFor: d ? e : void 0,
1484
- "data-radio": !0
1485
- }
1486
- )
1487
- ]
1488
- }
1489
- )
1490
- }
1491
- );
1492
- }
1493
- );
1494
- nt.displayName = "RadioButton";
1495
- const ot = N.forwardRef(
1496
- ({
1497
- id: e,
1498
- name: t,
1499
- label: a,
1500
- helpText: r,
1501
- errorText: c,
1502
- options: n,
1503
- value: s,
1504
- defaultValue: l,
1505
- onChange: i,
1506
- align: u,
1507
- equaliseWidth: d,
1508
- equalizeWidth: f,
1509
- required: p,
1510
- disabled: $,
1511
- size: v,
1512
- columns: k,
1513
- labelFirst: m,
1514
- ...A
1515
- }, y) => {
1516
- const R = ye(() => t || e, [t, e]), T = (V) => {
1517
- i == null || i(V.target.value);
1518
- };
1519
- let F = [];
1520
- return u && F.push(`align-${u}`), (d || f) && F.push("equalise-width"), k && F.push("with-columns"), m && F.push("label-first"), /* @__PURE__ */ o(
1521
- ee,
1522
- {
1523
- label: a,
1524
- htmlFor: e,
1525
- helpText: r,
1526
- errorText: c,
1527
- required: p,
1528
- size: v,
1529
- children: /* @__PURE__ */ o(
1530
- D,
1531
- {
1532
- as: "div",
1533
- "data-radio-group": !0,
1534
- ref: y,
1535
- classNames: F,
1536
- role: "radiogroup",
1537
- "aria-label": a,
1538
- style: k ? { gridTemplateColumns: `repeat(${k}, 1fr)` } : void 0,
1539
- ...A,
1540
- children: n.map((V, E) => {
1541
- const { id: P, value: g, label: L, ..._ } = V, S = P || `${e}-option-${E}`, w = s ? s === g : l === g;
1542
- return /* @__PURE__ */ I(
1543
- K,
1544
- {
1545
- "data-radio-button": !0,
1546
- role: "radio",
1547
- "aria-checked": w,
1548
- className: m ? "label-first" : void 0,
1549
- children: [
1550
- /* @__PURE__ */ o(
1551
- "input",
1552
- {
1553
- type: "radio",
1554
- id: S,
1555
- name: R,
1556
- value: g,
1557
- checked: w,
1558
- disabled: $,
1559
- onChange: T,
1560
- ..._
1561
- }
1562
- ),
1563
- /* @__PURE__ */ o("label", { htmlFor: S, children: L }),
1564
- m ? /* @__PURE__ */ o("label", { htmlFor: S, "data-radio": !0 }) : /* @__PURE__ */ o(K, { "data-radio": !0 })
1565
- ]
1566
- },
1567
- S
1568
- );
1569
- })
1570
- }
1571
- )
1572
- }
1573
- );
1574
- }
1575
- );
1576
- ot.displayName = "RadioGroup";
1577
- const it = N.forwardRef(
1578
- ({
1579
- layout: e = "grid",
1580
- gutters: t = "medium",
1581
- retainLayoutOnTabletLandscape: a,
1582
- retainLayoutOnTabletPortrait: r,
1583
- retainLayoutOnMobile: c,
1584
- retainLayoutAlways: n,
1585
- allowUltraWide: s,
1586
- groupLabel: l,
1587
- ...i
1588
- }, u) => {
1589
- let d = [];
1590
- return e && d.push(`layout-${e}`), t && d.push(t === "none" ? "no-gutters" : `${t}-gutters`), a && d.push("retain-layout-on-tablet-landscape"), r && d.push("retain-layout-on-tablet-portrait"), c && d.push("retain-layout-on-mobile"), n && d.push(
1591
- "retain-layout-on-tablet-landscape retain-layout-on-tablet-portrait retain-layout-on-mobile"
1592
- ), s && d.push("allow-ultra-wide"), /* @__PURE__ */ o(
1593
- D,
1594
- {
1595
- as: "div",
1596
- "data-row": !0,
1597
- ref: u,
1598
- classNames: [d.join(" ")],
1599
- marginBottom: "tiny",
1600
- role: "grid",
1601
- "aria-label": l,
1602
- ...i
1603
- }
1604
- );
1605
- }
1606
- );
1607
- it.displayName = "Row";
1608
- const lt = N.forwardRef(
1609
- ({
1610
- // FormItem props
1611
- label: e,
1612
- helpText: t,
1613
- errorText: a,
1614
- required: r,
1615
- size: c,
1616
- // Select props
1617
- id: n,
1618
- name: s,
1619
- options: l,
1620
- onChange: i,
1621
- disabled: u,
1622
- className: d,
1623
- ...f
1624
- }, p) => {
1625
- const $ = ye(() => s || n, [s, n]), v = (R) => /* @__PURE__ */ o(
1626
- D,
1627
- {
1628
- as: "option",
1629
- value: R.value,
1630
- disabled: R.disabled,
1631
- children: R.label
1632
- },
1633
- R.value
1634
- ), k = (R) => /* @__PURE__ */ o(
1635
- D,
1636
- {
1637
- as: "optgroup",
1638
- label: R.label,
1639
- children: R.options.map(v)
1640
- },
1641
- R.label
1642
- ), m = (R) => {
1643
- i == null || i(R.target.value);
1644
- }, { wrapperProps: A, inputProps: y } = ie(f);
1645
- return /* @__PURE__ */ o(
1646
- ee,
1647
- {
1648
- label: e,
1649
- htmlFor: n,
1650
- helpText: t,
1651
- errorText: a,
1652
- required: r,
1653
- size: c,
1654
- ...A,
1655
- children: /* @__PURE__ */ o(K, { "data-select": !0, className: d, disabled: u, children: /* @__PURE__ */ o(
1656
- D,
1657
- {
1658
- as: "select",
1659
- ref: p,
1660
- id: n,
1661
- name: $,
1662
- disabled: u,
1663
- required: r,
1664
- onChange: m,
1665
- ...y,
1666
- children: l.map(
1667
- (R) => "options" in R ? k(R) : v(R)
1668
- )
1669
- }
1670
- ) })
1671
- }
1672
- );
1673
- }
1674
- );
1675
- lt.displayName = "Select";
1676
- const Ue = (e, t) => e > t ? "exceeded" : e >= t * 0.9 ? "warning" : "normal", Ie = (e, t, a) => Math.abs(e) === 1 ? t : a, ct = N.forwardRef(
1677
- ({
1678
- // FormItem props
1679
- label: e,
1680
- hideLabel: t,
1681
- helpText: a,
1682
- errorText: r,
1683
- size: c,
1684
- required: n,
1685
- // TextArea-specific
1686
- onChange: s,
1687
- value: l = "",
1688
- characterLimit: i,
1689
- wordLimit: u,
1690
- // Input props
1691
- id: d,
1692
- name: f,
1693
- rows: p,
1694
- cols: $,
1695
- minLength: v,
1696
- maxLength: k,
1697
- placeholder: m,
1698
- readOnly: A,
1699
- disabled: y,
1700
- autoComplete: R,
1701
- // Validation (unused but destructured to not pass to DOM)
1702
- validateThis: T,
1703
- valid: F,
1704
- invalid: V,
1705
- ...E
1706
- }, P) => {
1707
- const g = Y(null), L = (C) => {
1708
- s == null || s(C.target.value);
1709
- }, _ = () => {
1710
- const C = [];
1711
- if (i) {
1712
- const B = l.length, b = Ue(B, i), x = Math.max(0, B - i), h = i - B;
1713
- C.push(
1714
- /* @__PURE__ */ o("span", { className: `limit-${b}`, children: x > 0 ? `${x} ${Ie(x, "char", "chars")} over limit` : `${h} ${Ie(h, "char", "chars")} left` }, "char-limit")
1715
- );
1716
- }
1717
- if (u) {
1718
- const B = l.trim().split(/\s+/).filter(Boolean).length, b = Ue(B, u), x = Math.max(0, B - u), h = u - B;
1719
- C.push(
1720
- /* @__PURE__ */ o("span", { className: `limit-${b}`, children: x > 0 ? `${x} ${Ie(x, "word", "words")} over limit` : `${h} ${Ie(h, "word", "words")} left` }, "word-limit")
1721
- );
1722
- }
1723
- if (!(!C.length && !a))
1724
- return /* @__PURE__ */ I(Me, { children: [
1725
- a,
1726
- a && C.length > 0 && /* @__PURE__ */ o("span", { className: "separator", children: " • " }),
1727
- C.map((B, b) => /* @__PURE__ */ I(N.Fragment, { children: [
1728
- b > 0 && /* @__PURE__ */ o("span", { className: "separator", children: " • " }),
1729
- B
1730
- ] }, b))
1731
- ] });
1732
- }, S = (C) => {
1733
- g.current = C, typeof P == "function" ? P(C) : P && (P.current = C);
1734
- }, { wrapperProps: w, inputProps: z } = ie(E);
1735
- return /* @__PURE__ */ o(
1736
- ee,
1737
- {
1738
- label: e,
1739
- htmlFor: d,
1740
- helpText: _(),
1741
- errorText: r,
1742
- required: n,
1743
- size: c,
1744
- ...w,
1745
- children: /* @__PURE__ */ o(
1746
- D,
1747
- {
1748
- as: "textarea",
1749
- ref: S,
1750
- "data-textarea": !0,
1751
- id: d,
1752
- name: f,
1753
- value: l,
1754
- rows: p,
1755
- cols: $,
1756
- minLength: v,
1757
- maxLength: k,
1758
- placeholder: m,
1759
- readOnly: A,
1760
- disabled: y,
1761
- required: n,
1762
- autoComplete: R,
1763
- onChange: L,
1764
- ...z
1765
- }
1766
- )
1767
- }
1768
- );
1769
- }
1770
- );
1771
- ct.displayName = "TextArea";
1772
- const zt = {
1773
- Checkbox: _e,
1774
- Switch: Ge,
1775
- InputField: Pe,
1776
- FileUpload: rt,
1777
- InputLabel: Ee,
1778
- RadioButton: nt,
1779
- RadioGroup: ot,
1780
- Select: lt,
1781
- TextArea: ct,
1782
- Empty: "div"
1783
- }, Ht = (e, t) => {
1784
- const { as: a, name: r, ...c } = e, n = (l) => {
1785
- t(r, l);
1786
- }, s = zt[a] || Pe;
1787
- return /* @__PURE__ */ o(
1788
- D,
1789
- {
1790
- as: s,
1791
- ...c,
1792
- name: r,
1793
- isFullWidth: !0,
1794
- onChange: n
1795
- }
1796
- );
1797
- }, _t = (e, t, a) => {
1798
- const r = e.map((c, n) => {
1799
- const {
1800
- desktopSpan: s,
1801
- tabletLandscapeSpan: l,
1802
- tabletPortraitSpan: i,
1803
- mobileSpan: u,
1804
- isHorizontal: d,
1805
- ...f
1806
- } = c;
1807
- return /* @__PURE__ */ Mt(st, { ...{
1808
- desktopSpan: s,
1809
- tabletLandscapeSpan: l,
1810
- tabletPortraitSpan: i,
1811
- mobileSpan: u,
1812
- isHorizontal: d
1813
- }, key: `${c.name}-${n}` }, Ht(f, t));
1814
- });
1815
- return /* @__PURE__ */ o(it, { gutters: a, children: r });
1816
- }, Gt = N.forwardRef(
1817
- ({ spacing: e = "small", fields: t, onFieldsChange: a, children: r, errorText: c, ...n }, s) => {
1818
- let l = [];
1819
- e && l.push(`spacing-${e}`);
1820
- const i = (d, f) => {
1821
- a && a({
1822
- [d]: f
1823
- });
1824
- }, u = t != null && t.length ? _t(t, i, e) : r;
1825
- return /* @__PURE__ */ I(
1826
- D,
1827
- {
1828
- as: "form",
1829
- "data-form": !0,
1830
- ref: s,
1831
- classNames: l,
1832
- ...n,
1833
- children: [
1834
- u,
1835
- c && /* @__PURE__ */ o(et, { kind: "error", children: c })
1836
- ]
1837
- }
1838
- );
1839
- }
1840
- );
1841
- Gt.displayName = "Form";
1842
- const Kt = N.forwardRef(
1843
- ({
1844
- isJoint: e,
1845
- equalWidthForChildren: t,
1846
- retainLayout: a,
1847
- children: r,
1848
- legend: c,
1849
- id: n,
1850
- columns: s,
1851
- style: l,
1852
- ...i
1853
- }, u) => {
1854
- const d = n || `form-group-${Math.random().toString(36).substring(2, 9)}`;
1855
- let f = [];
1856
- return e && f.push("is-joint"), t && f.push("equal-width-for-children"), a && f.push("retain-layout"), s && f.push("with-columns"), /* @__PURE__ */ o(
1857
- D,
1858
- {
1859
- as: "div",
1860
- "data-form-item-group": !0,
1861
- "data-form-spaced": !0,
1862
- ref: u,
1863
- id: d,
1864
- role: "group",
1865
- "aria-label": c,
1866
- classNames: f,
1867
- style: s ? { gridTemplateColumns: `repeat(${s}, 1fr)`, ...l } : l,
1868
- ...i,
1869
- children: r
1870
- }
1871
- );
1872
- }
1873
- );
1874
- Kt.displayName = "FormItemGroup";
1875
- const jt = (e, t) => {
1876
- const a = [], r = e.length, c = t.length;
1877
- if (r === 0) return c;
1878
- if (c === 0) return r;
1879
- for (let n = 0; n <= c; n++)
1880
- a[n] = [n];
1881
- for (let n = 0; n <= r; n++)
1882
- a[0][n] = n;
1883
- for (let n = 1; n <= c; n++)
1884
- for (let s = 1; s <= r; s++)
1885
- t[n - 1] === e[s - 1] ? a[n][s] = a[n - 1][s - 1] : a[n][s] = Math.min(
1886
- a[n - 1][s] + 1,
1887
- // Deletion
1888
- a[n][s - 1] + 1,
1889
- // Insertion
1890
- a[n - 1][s - 1] + 1
1891
- // Substitution
1892
- );
1893
- return a[c][r];
1894
- }, Xt = (e, t) => {
1895
- let a = 0, r = 0;
1896
- for (; a < e.length && r < t.length; )
1897
- e[a] === t[r] && a++, r++;
1898
- return a === e.length;
1899
- }, Ut = (e) => e.split(/[\s\-_]+/).map((t) => t.slice(0, 2)).join("").toLowerCase(), qt = (e, t) => {
1900
- if (!t) return e;
1901
- const a = t.toLowerCase().trim(), r = Math.floor(a.length / 2);
1902
- return e.map((n) => {
1903
- const s = n.label.toLowerCase(), l = jt(a, s), i = s.split(/[\s\-_]+/), u = a.split(/[\s\-_]+/), d = s.includes(a) || u.every(
1904
- ($) => i.some((v) => v.startsWith($))
1905
- ), f = Ut(s), p = Xt(a, f);
1906
- return {
1907
- option: n,
1908
- distance: l,
1909
- isPartialMatch: d,
1910
- isAcronymMatch: p
1911
- };
1912
- }).filter(
1913
- ({ distance: n, isPartialMatch: s, isAcronymMatch: l }) => s || l || n <= r
1914
- ).sort((n, s) => n.isPartialMatch && !s.isPartialMatch ? -1 : !n.isPartialMatch && s.isPartialMatch ? 1 : n.isAcronymMatch && !s.isAcronymMatch ? -1 : !n.isAcronymMatch && s.isAcronymMatch ? 1 : n.distance - s.distance).map(({ option: n }) => n);
1915
- }, Yt = N.forwardRef(
1916
- ({
1917
- options: e = [],
1918
- label: t,
1919
- helpText: a,
1920
- errorText: r,
1921
- placeholder: c = "Select an option",
1922
- id: n,
1923
- defaultValue: s,
1924
- onChange: l,
1925
- disabled: i,
1926
- selectionLimit: u,
1927
- allowMultiSelect: d = !1,
1928
- allowCustomEntries: f = !1,
1929
- isLoading: p,
1930
- value: $,
1931
- isFullWidth: v,
1932
- className: k,
1933
- required: m,
1934
- size: A,
1935
- ...y
1936
- }, R) => {
1937
- const [T, F] = j(!1), [V, E] = j(""), [P, g] = j(-1), [L, _] = j(null), [S, w] = j([]), [z, C] = j(!1);
1938
- U(() => {
1939
- s && l && l(s);
1940
- }, []);
1941
- const B = N.useMemo(() => [...e], [e]), b = Y(null), x = Y(null), h = Y(null), M = n || `listbox-${Math.random().toString(36).substring(2, 9)}`, O = qt(B, V), H = (W) => {
1942
- if (W.disabled) return;
1943
- let X;
1944
- if (d) {
1945
- if (S.some((se) => se.value === W.value))
1946
- X = S.filter((se) => se.value !== W.value);
1947
- else {
1948
- if (u && S.length >= u)
1949
- return;
1950
- X = [...S, W];
1951
- }
1952
- w(X), l == null || l(X.map((se) => se.value));
1953
- } else
1954
- X = [W], _(W), w(X), l == null || l(W.value), F(!1);
1955
- E(""), g(-1);
1956
- }, Z = (W) => {
1957
- E(W);
1958
- }, le = () => {
1959
- if (!V.trim() || !f) return;
1960
- const W = V.trim(), X = {
1961
- value: W,
1962
- label: W
1963
- };
1964
- B.some((Q) => Q.value === W) || H(X);
1965
- }, te = (W) => {
1966
- if (d) {
1967
- const X = S.filter((Q) => Q.value !== W);
1968
- w(X), l == null || l(X.map((Q) => Q.value));
1969
- } else
1970
- _(null), w([]), l == null || l("");
1971
- }, ae = () => {
1972
- _(null), w([]), l == null || l(d ? [] : "");
1973
- }, re = (W) => {
1974
- switch (W.key) {
1975
- case "ArrowDown":
1976
- W.preventDefault(), T ? g(
1977
- (X) => X < O.length - 1 ? X + 1 : X
1978
- ) : (F(!0), g(0));
1979
- break;
1980
- case "ArrowUp":
1981
- W.preventDefault(), g((X) => X > 0 ? X - 1 : X);
1982
- break;
1983
- case "Enter":
1984
- if (W.preventDefault(), f && V.trim()) {
1985
- const X = O.find(
1986
- (Q) => Q.label.toLowerCase() === V.trim().toLowerCase()
1987
- );
1988
- X ? H(X) : le();
1989
- } else P >= 0 && O[P] && H(O[P]);
1990
- break;
1991
- case "Escape":
1992
- W.preventDefault(), F(!1), g(-1);
1993
- break;
1994
- case " ":
1995
- T || (W.preventDefault(), F(!0), g(0));
1996
- break;
1997
- case "Home":
1998
- T && (W.preventDefault(), g(0));
1999
- break;
2000
- case "End":
2001
- T && (W.preventDefault(), g(O.length - 1));
2002
- break;
2003
- }
2004
- };
2005
- ze(b, () => {
2006
- F(!1), g(-1);
2007
- }), U(() => {
2008
- T && x.current && x.current.focus();
2009
- }, [T]), U(() => {
2010
- if (T && b.current) {
2011
- const W = b.current.getBoundingClientRect(), X = window.innerHeight, Q = 300, se = X - W.bottom, $e = W.top;
2012
- C(se < Q && $e > se);
2013
- } else
2014
- C(!1);
2015
- }, [T]), U(() => {
2016
- if (P >= 0) {
2017
- const W = document.querySelector(`[data-index="${P}"]`);
2018
- W == null || W.scrollIntoView({ block: "nearest" });
2019
- }
2020
- }, [P]);
2021
- const { wrapperProps: we, inputProps: ge } = ie(y);
2022
- return /* @__PURE__ */ o(
2023
- ee,
2024
- {
2025
- label: t,
2026
- htmlFor: n,
2027
- helpText: a,
2028
- errorText: r,
2029
- required: m,
2030
- isFullWidth: v,
2031
- size: A,
2032
- ...we,
2033
- children: /* @__PURE__ */ I(
2034
- D,
2035
- {
2036
- as: "div",
2037
- "data-list-box": !0,
2038
- classNames: ["list-box-wrapper", i ? "disabled" : "", k || ""],
2039
- ref: b,
2040
- isFullWidth: v,
2041
- ...ge,
2042
- children: [
2043
- /* @__PURE__ */ I(
2044
- K,
2045
- {
2046
- className: "list-box-input-wrapper",
2047
- onClick: () => !i && F(!T),
2048
- role: "combobox",
2049
- "aria-haspopup": "listbox",
2050
- "aria-expanded": T,
2051
- "aria-controls": `${M}-listbox`,
2052
- "aria-owns": `${M}-listbox`,
2053
- tabIndex: i ? -1 : 0,
2054
- children: [
2055
- d ? /* @__PURE__ */ I(Me, { children: [
2056
- S.length > 0 ? /* @__PURE__ */ I(K, { className: "options-wrapper", children: [
2057
- /* @__PURE__ */ o(K, { className: "options-list", children: S.map((W) => /* @__PURE__ */ o(
2058
- Be,
2059
- {
2060
- actionIcon: "cross",
2061
- onActionClick: () => te(W.value),
2062
- actionAriaLabel: `Remove ${W.label}`,
2063
- size: "small",
2064
- shape: "rounded",
2065
- children: /* @__PURE__ */ o(J, { children: W.label })
2066
- },
2067
- W.value
2068
- )) }),
2069
- u && S.length >= u && /* @__PURE__ */ I(J, { className: "options-limit-warning", textColour: "red", size: "tiny", children: [
2070
- "You can choose only ",
2071
- u,
2072
- " option",
2073
- u === 1 ? "" : "s"
2074
- ] })
2075
- ] }) : /* @__PURE__ */ o("span", { className: "placeholder", children: c }),
2076
- S.length > 0 && /* @__PURE__ */ o(
2077
- K,
2078
- {
2079
- className: "icon-wrapper clear-all",
2080
- title: "Clear all options",
2081
- onClick: () => ae(),
2082
- children: /* @__PURE__ */ I("svg", { viewBox: "0 0 24 24", children: [
2083
- /* @__PURE__ */ o("line", { x1: "5", y1: "5", x2: "19", y2: "19" }),
2084
- /* @__PURE__ */ o("line", { x1: "5", y1: "19", x2: "19", y2: "5" })
2085
- ] })
2086
- }
2087
- )
2088
- ] }) : S[0] ? /* @__PURE__ */ o(J, { className: "selected-option", children: S[0].label }) : /* @__PURE__ */ o("span", { className: "placeholder", children: c }),
2089
- /* @__PURE__ */ o(K, { className: "icon-wrapper chevrons", children: /* @__PURE__ */ I("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", children: [
2090
- /* @__PURE__ */ o("polyline", { points: "6 9 12 4 18 9" }),
2091
- /* @__PURE__ */ o("polyline", { points: "6 15 12 20 18 15" })
2092
- ] }) })
2093
- ]
2094
- }
2095
- ),
2096
- T && !i && /* @__PURE__ */ I(
2097
- K,
2098
- {
2099
- ref: h,
2100
- className: `list-box-dropdown${z ? " opens-upward" : ""}`,
2101
- children: [
2102
- /* @__PURE__ */ I(K, { className: "list-box-search-wrapper", children: [
2103
- /* @__PURE__ */ o(
2104
- Pe,
2105
- {
2106
- type: "text",
2107
- ref: x,
2108
- className: "list-box-search",
2109
- placeholder: f ? "Type to search or add new" : "Search",
2110
- value: V,
2111
- onChange: Z,
2112
- onKeyDown: re,
2113
- "aria-controls": `${M}-listbox`,
2114
- "aria-label": "Search options",
2115
- isFullWidth: !0
2116
- }
2117
- ),
2118
- f && V.trim() && !S.some((W) => W.label.toLowerCase() === V.trim().toLowerCase()) && /* @__PURE__ */ o(
2119
- "kbd",
2120
- {
2121
- className: "list-box-enter-key",
2122
- "aria-label": "Press Enter to add custom option",
2123
- children: "↵"
2124
- }
2125
- )
2126
- ] }),
2127
- /* @__PURE__ */ o(
2128
- D,
2129
- {
2130
- as: "ul",
2131
- id: `${M}-listbox`,
2132
- className: "list-box-options",
2133
- role: "listbox",
2134
- "aria-multiselectable": d,
2135
- "aria-busy": p,
2136
- tabIndex: -1,
2137
- children: O.length > 0 ? O.map((W, X) => /* @__PURE__ */ o(
2138
- "li",
2139
- {
2140
- id: `${M}-option-${W.value}`,
2141
- className: `list-box-option ${W.disabled ? "disabled" : ""} ${P === X ? "active" : ""}`,
2142
- role: "option",
2143
- "aria-selected": S.some((Q) => Q.value === W.value),
2144
- "aria-disabled": W.disabled,
2145
- onClick: () => H(W),
2146
- "data-index": X,
2147
- tabIndex: -1,
2148
- children: W.customLabel || W.label
2149
- },
2150
- W.value
2151
- )) : /* @__PURE__ */ o(
2152
- "li",
2153
- {
2154
- className: "list-box-option disabled",
2155
- role: "alert",
2156
- "aria-live": "polite",
2157
- children: f ? "Type and press Enter to add new option" : "No matches found"
2158
- }
2159
- )
2160
- }
2161
- )
2162
- ]
2163
- }
2164
- )
2165
- ]
2166
- }
2167
- )
2168
- }
2169
- );
2170
- }
2171
- );
2172
- Yt.displayName = "ListBox";
2173
- function qe(e, t) {
2174
- return (t === "alphanumeric" ? /^[a-zA-Z0-9]+$/i : /^[0-9]+$/).test(e);
2175
- }
2176
- const Jt = N.forwardRef(
2177
- ({
2178
- numberOfFields: e,
2179
- onChange: t,
2180
- type: a = "number",
2181
- mask: r = !1,
2182
- isOTP: c = !1,
2183
- autoFocus: n = !1,
2184
- pasteFromClipboard: s = "enabled",
2185
- focusFirstInputOnReset: l = !0,
2186
- isFullWidth: i,
2187
- ariaLabel: u,
2188
- ...d
2189
- }, f) => {
2190
- const p = Y(null), [$, v] = j([]), [k, m] = j([]), [A, y] = j(!0), [R, T] = j(-1), F = d.id || `pin-input-${Math.random().toString(36).substring(2, 9)}`, V = u || "Enter verification code", E = G(
2191
- (B) => {
2192
- var x;
2193
- const b = $[B];
2194
- (x = b == null ? void 0 : b.current) == null || x.focus();
2195
- },
2196
- [$]
2197
- ), P = G(
2198
- (B) => {
2199
- if (!A) return;
2200
- const b = B + 1 < e ? B + 1 : null;
2201
- b && E(b);
2202
- },
2203
- [E, e, A]
2204
- ), g = G(() => {
2205
- m(Array(e).fill("")), t == null || t(""), l && (E(0), T(0));
2206
- }, [e, t, E, l]), L = G(
2207
- (B, b) => {
2208
- const x = [...k];
2209
- x[b] = B, m(x), t == null || t(x.join("")), B !== "" && x.length === e && x.every((M) => M != null && M !== "") && b === e - 1 || (y(!0), P(b));
2210
- },
2211
- [P, e, t, k]
2212
- ), _ = G((B, b) => {
2213
- var M;
2214
- const x = typeof B == "string" ? B : B.target.value, h = k[b];
2215
- if (x === "") {
2216
- L("", b);
2217
- return;
2218
- }
2219
- if (x.length > 1 && b < e - 1) {
2220
- if (qe(x, a)) {
2221
- let O = [];
2222
- const H = x.split("");
2223
- h === "" ? O = H.filter((te, ae) => b + ae < e) : ((M = $[b].current) == null ? void 0 : M.selectionEnd) === x.length ? O = H.filter((ae, re) => re > 0 && b + re - 1 < e) : O = H.filter((ae, re) => re < x.length - 1 && b + re < e);
2224
- const Z = k.map(
2225
- (te, ae) => ae >= b && ae < b + O.length ? O[ae - b] : te
2226
- );
2227
- m(Z), t == null || t(Z.join(""));
2228
- const le = Math.min(b + O.length, e - 1);
2229
- E(le);
2230
- }
2231
- } else {
2232
- let O = x;
2233
- (h == null ? void 0 : h.length) > 0 && (O = x.charAt(x.length - 1)), qe(O, a) && L(O, b);
2234
- }
2235
- }, [e, t, L, a, k, E, $]), S = G((B, b) => {
2236
- var x;
2237
- if (B.key === "Backspace")
2238
- if (B.target.value === "") {
2239
- if (b > 0) {
2240
- const h = b - 1;
2241
- L("", h), E(h), y(!0);
2242
- }
2243
- } else
2244
- y(!1);
2245
- else B.key === "Escape" ? ((x = $[b].current) == null || x.blur(), C()) : B.key === "ArrowRight" ? b < e - 1 && E(b + 1) : B.key === "ArrowLeft" && b > 0 && E(b - 1);
2246
- }, [E, L, $, e]), w = G((B, b) => {
2247
- T(b);
2248
- }, []), z = G((B) => {
2249
- const b = B.target;
2250
- setTimeout(() => {
2251
- b.setSelectionRange(b.value.length, b.value.length);
2252
- }, 0);
2253
- }, []), C = G(() => {
2254
- T(-1);
2255
- }, []);
2256
- return U(() => {
2257
- v((B) => Array(e).fill(0).map((x, h) => {
2258
- var O;
2259
- const M = B[h] || Et();
2260
- return n && h === 0 && ((O = M.current) == null || O.focus()), M;
2261
- }));
2262
- }, [e, n]), Qe(
2263
- f,
2264
- () => ({
2265
- ...p.current,
2266
- reset: g
2267
- }),
2268
- [g]
2269
- ), /* @__PURE__ */ o(
2270
- K,
2271
- {
2272
- "data-pin-input-field": !0,
2273
- ref: p,
2274
- classNames: i ? ["full-width"] : [],
2275
- role: "group",
2276
- "aria-label": V,
2277
- "aria-required": d.required,
2278
- ...d,
2279
- children: Array.from({ length: e }, (B, b) => /* @__PURE__ */ o(
2280
- Pe,
2281
- {
2282
- id: `${F}-${b}`,
2283
- ref: $[b],
2284
- type: r ? "password" : a === "number" ? "tel" : "text",
2285
- inputMode: a === "number" ? "numeric" : "text",
2286
- onChange: (x) => _(x, b),
2287
- onKeyDown: (x) => S(x, b),
2288
- onFocus: (x) => w(x, b),
2289
- onSelect: z,
2290
- onBlur: C,
2291
- placeholder: R !== b ? "⦁" : void 0,
2292
- autoComplete: c ? "one-time-code" : "off",
2293
- value: k[b] || "",
2294
- autoFocus: n && b === 0,
2295
- onCopy: (x) => s === "disabled" && x.preventDefault(),
2296
- onPaste: (x) => s === "disabled" && x.preventDefault(),
2297
- "aria-label": `Digit ${b + 1} of ${e}`,
2298
- "aria-required": d.required
2299
- },
2300
- b
2301
- ))
2302
- }
2303
- );
2304
- }
2305
- );
2306
- Jt.displayName = "PinInputField";
2307
- const Zt = N.forwardRef(
2308
- ({
2309
- id: e,
2310
- name: t,
2311
- label: a,
2312
- helpText: r,
2313
- errorText: c,
2314
- options: n,
2315
- defaultValue: s,
2316
- value: l,
2317
- required: i,
2318
- onChange: u,
2319
- size: d = "medium",
2320
- bgColour: f,
2321
- disabled: p,
2322
- ...$
2323
- }, v) => {
2324
- const k = ye(() => t || e, [t, e]), m = Y(null), [A, y] = j({
2325
- width: 0,
2326
- transform: "translateX(0)"
2327
- }), [R, T] = j(!1), [F, V] = j(0), [E, P] = j(0), g = Y([]), L = G(() => {
2328
- if (!m.current) return;
2329
- const x = m.current, h = x.closest("[data-input-wrapper]");
2330
- if (x && h) {
2331
- const M = x.scrollWidth, O = h.clientWidth, H = M > O;
2332
- T(H), P(H ? M - O : 0);
2333
- }
2334
- }, []);
2335
- U(() => {
2336
- const x = m.current;
2337
- if (!x) return;
2338
- L();
2339
- const h = new ResizeObserver(() => {
2340
- L();
2341
- });
2342
- return h.observe(x), x.closest("[data-input-wrapper]") && h.observe(x.closest("[data-input-wrapper]")), () => h.disconnect();
2343
- }, [L]), U(() => {
2344
- const x = n.findIndex((h) => h.value === l);
2345
- if (x >= 0) {
2346
- const h = () => {
2347
- const M = g.current[x];
2348
- if (M) {
2349
- const O = M.offsetWidth;
2350
- let H = "translateX(0)";
2351
- x > 0 && (H = `translateX(${g.current.slice(0, x).reduce((le, te) => le + ((te == null ? void 0 : te.offsetWidth) || 0), 0)}px)`), y({ width: O, transform: H });
2352
- }
2353
- };
2354
- if (document.fonts && document.fonts.ready)
2355
- document.fonts.ready.then(() => {
2356
- requestAnimationFrame(() => {
2357
- requestAnimationFrame(h);
2358
- });
2359
- });
2360
- else {
2361
- const M = setTimeout(h, 100);
2362
- return () => clearTimeout(M);
2363
- }
2364
- }
2365
- }, [l, n]);
2366
- const _ = (x) => {
2367
- u == null || u(x.target.value);
2368
- }, { wrapperProps: S, inputProps: w } = ie($), z = G((x) => {
2369
- const h = m.current;
2370
- if (!h) return;
2371
- const O = h.clientWidth * 0.8;
2372
- let H = x === "right" ? Math.min(F + O, E) : Math.max(F - O, 0);
2373
- V(H), requestAnimationFrame(() => {
2374
- h.style.transform = `translateX(-${H}px)`;
2375
- });
2376
- }, [F, E]), C = F > 0, B = F < E, b = [];
2377
- return d && b.push(`size-${d}`), /* @__PURE__ */ o(
2378
- ee,
2379
- {
2380
- label: a,
2381
- htmlFor: e,
2382
- helpText: r,
2383
- errorText: c,
2384
- required: i,
2385
- size: d,
2386
- ...S,
2387
- children: /* @__PURE__ */ I(
2388
- D,
2389
- {
2390
- as: "div",
2391
- "data-radio-tab-group": !0,
2392
- ref: v,
2393
- classNames: b,
2394
- name: k,
2395
- ...w,
2396
- children: [
2397
- R && C && /* @__PURE__ */ o(
2398
- K,
2399
- {
2400
- className: "scroll-button left",
2401
- onClick: () => z("left"),
2402
- children: /* @__PURE__ */ o("svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ o("polyline", { points: "15 18 9 12 15 6" }) })
2403
- }
2404
- ),
2405
- /* @__PURE__ */ I(K, { className: "rtg-options-container", children: [
2406
- /* @__PURE__ */ I(
2407
- K,
2408
- {
2409
- className: "rtg-options-wrapper",
2410
- ref: m,
2411
- children: [
2412
- /* @__PURE__ */ o(
2413
- K,
2414
- {
2415
- className: "indicator",
2416
- style: {
2417
- width: `${A.width}px`,
2418
- transform: A.transform
2419
- }
2420
- }
2421
- ),
2422
- n.map((x, h) => {
2423
- const { id: M, ...O } = x, H = M || `${e}-option-${h}`;
2424
- return /* @__PURE__ */ I(N.Fragment, { children: [
2425
- /* @__PURE__ */ o(
2426
- "input",
2427
- {
2428
- type: "radio",
2429
- ...O,
2430
- id: H,
2431
- name: k,
2432
- checked: l === x.value,
2433
- disabled: p || x.disabled,
2434
- onChange: _
2435
- }
2436
- ),
2437
- /* @__PURE__ */ o(
2438
- "label",
2439
- {
2440
- ref: (Z) => {
2441
- g.current[h] = Z;
2442
- },
2443
- htmlFor: H,
2444
- children: x.label
2445
- }
2446
- )
2447
- ] }, H);
2448
- })
2449
- ]
2450
- }
2451
- ),
2452
- R && B && /* @__PURE__ */ o(
2453
- K,
2454
- {
2455
- className: "scroll-button right",
2456
- onClick: () => z("right"),
2457
- children: /* @__PURE__ */ o("svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ o("polyline", { points: "9 6 15 12 9 18" }) })
2458
- }
2459
- )
2460
- ] })
2461
- ]
2462
- }
2463
- )
2464
- }
2465
- );
2466
- }
2467
- );
2468
- Zt.displayName = "RadioTabGroup";
2469
- function Qt(e) {
2470
- return Array.isArray(e.value);
2471
- }
2472
- const ea = N.forwardRef(
2473
- (e, t) => Qt(e) ? /* @__PURE__ */ o(ut, { ...e, forwardedRef: t }) : /* @__PURE__ */ o(dt, { ...e, forwardedRef: t })
2474
- );
2475
- ea.displayName = "Range";
2476
- const dt = ({
2477
- label: e,
2478
- helpText: t,
2479
- errorText: a,
2480
- value: r = 0,
2481
- suffix: c,
2482
- onChange: n,
2483
- min: s = 0,
2484
- max: l = 100,
2485
- step: i = 1,
2486
- id: u,
2487
- disabled: d,
2488
- size: f,
2489
- ...p
2490
- }) => {
2491
- const { wrapperProps: $ } = ie(p), v = Y(null), k = Y(null), [m, A] = j(!1), [y, R] = j(!1), T = Math.max(s, Math.min(l, r)), F = G((S) => l <= s ? 0 : (Math.max(s, Math.min(l, S)) - s) / (l - s) * 100, [s, l]), V = G((S) => {
2492
- if (!k.current) return s;
2493
- const w = k.current.getBoundingClientRect(), z = Math.max(0, Math.min(1, (S - w.left) / w.width)), C = s + z * (l - s), B = Math.round(C / i) * i;
2494
- return Math.max(s, Math.min(l, B));
2495
- }, [s, l, i]), E = G((S) => {
2496
- const w = V(S);
2497
- n == null || n(w);
2498
- }, [V, n]), P = G((S) => {
2499
- d || (S.preventDefault(), A(!0), R(!0), E(S.clientX));
2500
- }, [d, E]);
2501
- U(() => {
2502
- if (!m) return;
2503
- const S = (z) => {
2504
- E(z.clientX);
2505
- }, w = () => {
2506
- A(!1);
2507
- };
2508
- return document.addEventListener("mousemove", S), document.addEventListener("mouseup", w), () => {
2509
- document.removeEventListener("mousemove", S), document.removeEventListener("mouseup", w);
2510
- };
2511
- }, [m, E]);
2512
- const g = G((S) => {
2513
- d || (A(!0), R(!0), E(S.touches[0].clientX));
2514
- }, [d, E]);
2515
- U(() => {
2516
- if (!m) return;
2517
- const S = (z) => {
2518
- z.preventDefault(), E(z.touches[0].clientX);
2519
- }, w = () => {
2520
- A(!1);
2521
- };
2522
- return document.addEventListener("touchmove", S, { passive: !1 }), document.addEventListener("touchend", w), () => {
2523
- document.removeEventListener("touchmove", S), document.removeEventListener("touchend", w);
2524
- };
2525
- }, [m, E]);
2526
- const L = G((S) => {
2527
- if (d) return;
2528
- let w = T;
2529
- switch (S.key) {
2530
- case "ArrowRight":
2531
- case "ArrowUp":
2532
- S.preventDefault(), w = Math.min(T + i, l);
2533
- break;
2534
- case "ArrowLeft":
2535
- case "ArrowDown":
2536
- S.preventDefault(), w = Math.max(T - i, s);
2537
- break;
2538
- case "Home":
2539
- S.preventDefault(), w = s;
2540
- break;
2541
- case "End":
2542
- S.preventDefault(), w = l;
2543
- break;
2544
- case "PageUp":
2545
- S.preventDefault(), w = Math.min(T + i * 10, l);
2546
- break;
2547
- case "PageDown":
2548
- S.preventDefault(), w = Math.max(T - i * 10, s);
2549
- break;
2550
- default:
2551
- return;
2552
- }
2553
- n == null || n(w);
2554
- }, [d, T, s, l, i, n]), _ = F(T);
2555
- return /* @__PURE__ */ o(
2556
- ee,
2557
- {
2558
- customLabel: e && /* @__PURE__ */ I(K, { "data-range-meta": !0, children: [
2559
- /* @__PURE__ */ o(
2560
- Ee,
2561
- {
2562
- className: "range-label",
2563
- label: e,
2564
- htmlFor: u
2565
- }
2566
- ),
2567
- /* @__PURE__ */ I(J, { className: "range-value", children: [
2568
- T,
2569
- c && c
2570
- ] })
2571
- ] }),
2572
- helpText: t,
2573
- errorText: a,
2574
- size: f,
2575
- ...$,
2576
- children: /* @__PURE__ */ I(
2577
- K,
2578
- {
2579
- ref: k,
2580
- "data-range-single": !0,
2581
- className: d ? "disabled" : "",
2582
- role: "group",
2583
- "aria-labelledby": e ? `${u}-label` : void 0,
2584
- children: [
2585
- /* @__PURE__ */ o(K, { className: "range-track", "aria-hidden": "true" }),
2586
- /* @__PURE__ */ o(
2587
- K,
2588
- {
2589
- className: "range-track-fill",
2590
- style: {
2591
- left: "0%",
2592
- right: `${100 - _}%`
2593
- },
2594
- "aria-hidden": "true"
2595
- }
2596
- ),
2597
- /* @__PURE__ */ o(
2598
- "button",
2599
- {
2600
- ref: v,
2601
- id: u,
2602
- type: "button",
2603
- className: "range-thumb",
2604
- style: { left: `${_}%` },
2605
- disabled: d,
2606
- onMouseDown: P,
2607
- onTouchStart: g,
2608
- onKeyDown: L,
2609
- onFocus: () => R(!0),
2610
- onBlur: () => R(!1),
2611
- "data-active": y || m,
2612
- role: "slider",
2613
- "aria-valuemin": s,
2614
- "aria-valuemax": l,
2615
- "aria-valuenow": T,
2616
- "aria-valuetext": `${T}${c ? ` ${c}` : ""}`,
2617
- "aria-orientation": "horizontal"
2618
- }
2619
- )
2620
- ]
2621
- }
2622
- )
2623
- }
2624
- );
2625
- };
2626
- dt.displayName = "SingleThumbRange";
2627
- const ut = ({
2628
- label: e,
2629
- helpText: t,
2630
- errorText: a,
2631
- value: r = [0, 100],
2632
- suffix: c,
2633
- onChange: n,
2634
- min: s = 0,
2635
- max: l = 100,
2636
- step: i = 1,
2637
- minLabel: u = "Minimum value",
2638
- maxLabel: d = "Maximum value",
2639
- id: f,
2640
- disabled: p,
2641
- size: $,
2642
- ...v
2643
- }) => {
2644
- const { wrapperProps: k } = ie(v), [m, A] = r, y = Math.max(s, Math.min(l, m)), R = Math.max(s, Math.min(l, A)), T = Y(null), F = Y(null), V = Y(null), [E, P] = j(null), [g, L] = j(null), _ = G((h) => l <= s ? 0 : (Math.max(s, Math.min(l, h)) - s) / (l - s) * 100, [s, l]), S = G((h) => {
2645
- if (!V.current) return s;
2646
- const M = V.current.getBoundingClientRect(), O = Math.max(0, Math.min(1, (h - M.left) / M.width)), H = s + O * (l - s), Z = Math.round(H / i) * i;
2647
- return Math.max(s, Math.min(l, Z));
2648
- }, [s, l, i]), w = G((h, M) => {
2649
- const O = S(h);
2650
- if (M === "min") {
2651
- const H = Math.min(O, R - i);
2652
- n == null || n([H, R]);
2653
- } else {
2654
- const H = Math.max(O, y + i);
2655
- n == null || n([y, H]);
2656
- }
2657
- }, [S, y, R, i, n]), z = G((h) => (M) => {
2658
- p || (M.preventDefault(), P(h), L(h), w(M.clientX, h));
2659
- }, [p, w]);
2660
- U(() => {
2661
- if (!E) return;
2662
- const h = (O) => {
2663
- w(O.clientX, E);
2664
- }, M = () => {
2665
- P(null);
2666
- };
2667
- return document.addEventListener("mousemove", h), document.addEventListener("mouseup", M), () => {
2668
- document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", M);
2669
- };
2670
- }, [E, w]);
2671
- const C = G((h) => (M) => {
2672
- p || (P(h), L(h), w(M.touches[0].clientX, h));
2673
- }, [p, w]);
2674
- U(() => {
2675
- if (!E) return;
2676
- const h = (O) => {
2677
- O.preventDefault(), w(O.touches[0].clientX, E);
2678
- }, M = () => {
2679
- P(null);
2680
- };
2681
- return document.addEventListener("touchmove", h, { passive: !1 }), document.addEventListener("touchend", M), () => {
2682
- document.removeEventListener("touchmove", h), document.removeEventListener("touchend", M);
2683
- };
2684
- }, [E, w]);
2685
- const B = G((h) => (M) => {
2686
- if (p) return;
2687
- const O = h === "min" ? y : R;
2688
- let H = O;
2689
- switch (M.key) {
2690
- case "ArrowRight":
2691
- case "ArrowUp":
2692
- M.preventDefault(), H = Math.min(O + i, l);
2693
- break;
2694
- case "ArrowLeft":
2695
- case "ArrowDown":
2696
- M.preventDefault(), H = Math.max(O - i, s);
2697
- break;
2698
- case "Home":
2699
- M.preventDefault(), H = h === "min" ? s : y + i;
2700
- break;
2701
- case "End":
2702
- M.preventDefault(), H = h === "max" ? l : R - i;
2703
- break;
2704
- case "PageUp":
2705
- M.preventDefault(), H = Math.min(O + i * 10, l);
2706
- break;
2707
- case "PageDown":
2708
- M.preventDefault(), H = Math.max(O - i * 10, s);
2709
- break;
2710
- default:
2711
- return;
2712
- }
2713
- if (h === "min") {
2714
- const Z = Math.min(H, R - i);
2715
- n == null || n([Z, R]);
2716
- } else {
2717
- const Z = Math.max(H, y + i);
2718
- n == null || n([y, Z]);
2719
- }
2720
- }, [p, y, R, s, l, i, n]), b = _(y), x = _(R);
2721
- return /* @__PURE__ */ o(
2722
- ee,
2723
- {
2724
- customLabel: e && /* @__PURE__ */ I(K, { "data-range-meta": !0, children: [
2725
- /* @__PURE__ */ o(
2726
- Ee,
2727
- {
2728
- className: "range-label",
2729
- label: e,
2730
- htmlFor: f
2731
- }
2732
- ),
2733
- /* @__PURE__ */ I(J, { className: "range-value", children: [
2734
- y,
2735
- "–",
2736
- R,
2737
- c && c
2738
- ] })
2739
- ] }),
2740
- helpText: t,
2741
- errorText: a,
2742
- size: $,
2743
- ...k,
2744
- children: /* @__PURE__ */ I(
2745
- K,
2746
- {
2747
- ref: V,
2748
- "data-range-dual": !0,
2749
- className: p ? "disabled" : "",
2750
- role: "group",
2751
- "aria-labelledby": e ? `${f}-label` : void 0,
2752
- children: [
2753
- /* @__PURE__ */ o(K, { className: "range-track", "aria-hidden": "true" }),
2754
- /* @__PURE__ */ o(
2755
- K,
2756
- {
2757
- className: "range-track-fill",
2758
- style: {
2759
- left: `${b}%`,
2760
- right: `${100 - x}%`
2761
- },
2762
- "aria-hidden": "true"
2763
- }
2764
- ),
2765
- /* @__PURE__ */ o(
2766
- "button",
2767
- {
2768
- ref: T,
2769
- id: `${f}-min`,
2770
- type: "button",
2771
- className: "range-thumb range-thumb-min",
2772
- style: { left: `${b}%` },
2773
- disabled: p,
2774
- onMouseDown: z("min"),
2775
- onTouchStart: C("min"),
2776
- onKeyDown: B("min"),
2777
- onFocus: () => L("min"),
2778
- onBlur: () => L(null),
2779
- "data-active": g === "min" || E === "min",
2780
- role: "slider",
2781
- "aria-label": u,
2782
- "aria-valuemin": s,
2783
- "aria-valuemax": R - i,
2784
- "aria-valuenow": y,
2785
- "aria-valuetext": `${y}${c ? ` ${c}` : ""}`,
2786
- "aria-orientation": "horizontal"
2787
- }
2788
- ),
2789
- /* @__PURE__ */ o(
2790
- "button",
2791
- {
2792
- ref: F,
2793
- id: `${f}-max`,
2794
- type: "button",
2795
- className: "range-thumb range-thumb-max",
2796
- style: { left: `${x}%` },
2797
- disabled: p,
2798
- onMouseDown: z("max"),
2799
- onTouchStart: C("max"),
2800
- onKeyDown: B("max"),
2801
- onFocus: () => L("max"),
2802
- onBlur: () => L(null),
2803
- "data-active": g === "max" || E === "max",
2804
- role: "slider",
2805
- "aria-label": d,
2806
- "aria-valuemin": y + i,
2807
- "aria-valuemax": l,
2808
- "aria-valuenow": R,
2809
- "aria-valuetext": `${R}${c ? ` ${c}` : ""}`,
2810
- "aria-orientation": "horizontal"
2811
- }
2812
- )
2813
- ]
2814
- }
2815
- )
2816
- }
2817
- );
2818
- };
2819
- ut.displayName = "DualThumbRange";
2820
- const ta = N.forwardRef(
2821
- ({
2822
- label: e,
2823
- value: t,
2824
- height: a,
2825
- suffix: r,
2826
- showOptimumMarker: c,
2827
- ariaLabel: n,
2828
- description: s,
2829
- min: l,
2830
- max: i,
2831
- low: u,
2832
- high: d,
2833
- optimum: f,
2834
- ...p
2835
- }, $) => {
2836
- const v = f ? (f - l) / (i - l) * 100 : 0, k = () => {
2837
- const y = (t - l) / (i - l) * 100;
2838
- let R;
2839
- return t <= u ? R = "Low" : t >= d ? R = "High" : R = "Normal", `Current value is ${t}${r || ""} (${y.toFixed(1)}%). Status: ${R}`;
2840
- }, { wrapperProps: m, inputProps: A } = ie(p);
2841
- return /* @__PURE__ */ I(
2842
- D,
2843
- {
2844
- as: "div",
2845
- role: "region",
2846
- "aria-label": n || "Meter indicator",
2847
- ...m,
2848
- children: [
2849
- e && /* @__PURE__ */ I(
2850
- D,
2851
- {
2852
- as: "div",
2853
- "data-meter-meta": !0,
2854
- id: `meter-label-${e.toLowerCase().replace(/\s+/g, "-")}`,
2855
- children: [
2856
- /* @__PURE__ */ o(J, { children: e }),
2857
- /* @__PURE__ */ I(J, { children: [
2858
- t,
2859
- r && r
2860
- ] })
2861
- ]
2862
- }
2863
- ),
2864
- /* @__PURE__ */ I(
2865
- "div",
2866
- {
2867
- className: "meter-wrapper",
2868
- role: "presentation",
2869
- children: [
2870
- /* @__PURE__ */ o(
2871
- D,
2872
- {
2873
- as: "meter",
2874
- "data-meter": !0,
2875
- ref: $,
2876
- value: t,
2877
- min: l,
2878
- max: i,
2879
- low: u,
2880
- high: d,
2881
- optimum: f,
2882
- ...A,
2883
- style: { height: a },
2884
- "aria-label": e || n || "Progress meter",
2885
- "aria-valuemin": l,
2886
- "aria-valuemax": i,
2887
- "aria-valuenow": t,
2888
- "aria-valuetext": k(),
2889
- "aria-describedby": s ? `meter-description-${e == null ? void 0 : e.toLowerCase().replace(/\s+/g, "-")}` : void 0
2890
- }
2891
- ),
2892
- c && f && /* @__PURE__ */ o(
2893
- "div",
2894
- {
2895
- className: "optimum-marker",
2896
- style: { left: `calc(${v}% - var(--meter-border-width))` },
2897
- title: `Optimum: ${f}`,
2898
- role: "presentation",
2899
- "aria-hidden": "true"
2900
- }
2901
- )
2902
- ]
2903
- }
2904
- ),
2905
- s && /* @__PURE__ */ o(
2906
- "div",
2907
- {
2908
- id: `meter-description-${e == null ? void 0 : e.toLowerCase().replace(/\s+/g, "-")}`,
2909
- className: "sr-only",
2910
- children: s
2911
- }
2912
- )
2913
- ]
2914
- }
2915
- );
2916
- }
2917
- );
2918
- ta.displayName = "Meter";
2919
- const aa = N.forwardRef(
2920
- ({
2921
- id: e,
2922
- children: t,
2923
- classNames: a = [],
2924
- isOpen: r = !1,
2925
- onClose: c,
2926
- isDismissible: n = !0,
2927
- showBackdrop: s,
2928
- blurBackdrop: l,
2929
- label: i,
2930
- description: u,
2931
- ...d
2932
- }, f) => {
2933
- const p = `${e}`, $ = u ? `${p}-description` : void 0;
2934
- return s && a.push("show-backdrop"), l && a.push("blur-backdrop"), U(() => {
2935
- const v = document.querySelector(`#${p}[data-modal]`);
2936
- if (!(!v || !(v instanceof HTMLElement)))
2937
- if (r) {
2938
- v.showPopover();
2939
- const k = v.querySelectorAll(
2940
- 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
2941
- );
2942
- k.length && k[0].focus();
2943
- } else
2944
- v.matches(":popover-open") && v.hidePopover();
2945
- }, [r, p]), U(() => {
2946
- const v = document.querySelector(`#${p}[data-modal]`);
2947
- if (!v || !(v instanceof HTMLElement)) return;
2948
- const k = (m) => {
2949
- m.newState === "closed" && r && c && c();
2950
- };
2951
- return v.addEventListener("toggle", k), () => v.removeEventListener("toggle", k);
2952
- }, [p, r, c]), /* @__PURE__ */ I(
2953
- D,
2954
- {
2955
- as: "dialog",
2956
- id: p,
2957
- "data-modal": !0,
2958
- popover: n ? "auto" : "manual",
2959
- ref: f,
2960
- classNames: a,
2961
- role: "dialog",
2962
- "aria-modal": "true",
2963
- "aria-label": i || "Modal dialog",
2964
- "aria-describedby": $,
2965
- ...d,
2966
- children: [
2967
- n && c && /* @__PURE__ */ o(
2968
- J,
2969
- {
2970
- className: "dismiss-button",
2971
- onClick: c,
2972
- "aria-label": "Close modal",
2973
- tabIndex: 0,
2974
- children: "×"
2975
- }
2976
- ),
2977
- u && /* @__PURE__ */ o("div", { id: $, className: "sr-only", children: u }),
2978
- /* @__PURE__ */ o("div", { role: "document", children: t })
2979
- ]
2980
- }
2981
- );
2982
- }
2983
- );
2984
- aa.displayName = "Modal";
2985
- const ft = N.forwardRef(
2986
- ({
2987
- position: e = "right",
2988
- anchor: t = "top",
2989
- order: a = "new-on-top",
2990
- kind: r = "list",
2991
- children: c,
2992
- label: n,
2993
- ...s
2994
- }, l) => {
2995
- let i = [];
2996
- return e && i.push(e), t && i.push(t), a && i.push(a), r && i.push(r), N.Children.count(c) === 0 ? null : /* @__PURE__ */ o(
2997
- D,
2998
- {
2999
- as: "section",
3000
- "data-notifications-wrapper": !0,
3001
- ref: l,
3002
- classNames: i,
3003
- "aria-label": n || "Notifications",
3004
- "aria-relevant": "additions removals",
3005
- role: "log",
3006
- ...s,
3007
- children: c
3008
- }
3009
- );
3010
- }
3011
- );
3012
- ft.displayName = "NotificationsWrapper";
3013
- const ra = {
3014
- generic: "status",
3015
- info: "status",
3016
- warning: "alert",
3017
- error: "alert",
3018
- success: "status"
3019
- }, pt = ({
3020
- id: e,
3021
- kind: t = "generic",
3022
- duration: a = 4,
3023
- isDismissible: r = !0,
3024
- onClose: c,
3025
- children: n
3026
- }) => {
3027
- const [s, l] = j(!1);
3028
- U(() => {
3029
- if (a === 0) return;
3030
- const p = setTimeout(() => {
3031
- l(!0);
3032
- }, a * 1e3);
3033
- return () => clearTimeout(p);
3034
- }, [a]), U(() => {
3035
- if (!s) return;
3036
- const p = setTimeout(() => {
3037
- c();
3038
- }, 500);
3039
- return () => clearTimeout(p);
3040
- }, [s, c]);
3041
- const i = (p) => {
3042
- p.preventDefault(), l(!0);
3043
- }, u = (p) => {
3044
- (p.key === "Enter" || p.key === " ") && (p.preventDefault(), l(!0));
3045
- }, d = () => {
3046
- s && c();
3047
- }, f = [t];
3048
- return r && f.push("dismissible"), s && f.push("dismissed"), /* @__PURE__ */ I(
3049
- D,
3050
- {
3051
- as: "div",
3052
- "data-notification-item": !0,
3053
- id: e,
3054
- classNames: f,
3055
- onTransitionEnd: d,
3056
- role: ra[t],
3057
- "aria-live": t === "error" || t === "warning" ? "assertive" : "polite",
3058
- "aria-atomic": "true",
3059
- children: [
3060
- /* @__PURE__ */ o("div", { className: "notification-content", children: n }),
3061
- r && /* @__PURE__ */ o(
3062
- K,
3063
- {
3064
- className: "dismiss-button",
3065
- onClick: i,
3066
- onKeyDown: u,
3067
- "aria-label": "Dismiss notification",
3068
- tabIndex: 0,
3069
- children: /* @__PURE__ */ o("span", { className: "sr-only", children: "Close notification" })
3070
- }
3071
- )
3072
- ]
3073
- }
3074
- );
3075
- };
3076
- pt.displayName = "NotificationItem";
3077
- const mt = Le(null), sa = ({
3078
- children: e,
3079
- position: t = "right",
3080
- anchor: a = "top",
3081
- order: r = "new-on-top",
3082
- kind: c = "list"
3083
- }) => {
3084
- const [n, s] = j([]), l = G((f) => {
3085
- s((p) => p.filter(($) => $.id !== f));
3086
- }, []), i = G((f, p = "generic", $ = 4, v = !0) => {
3087
- const k = `notification-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
3088
- return s((m) => [...m, {
3089
- id: k,
3090
- content: f,
3091
- kind: p,
3092
- duration: $,
3093
- isDismissible: v
3094
- }]), k;
3095
- }, []), u = G((f) => {
3096
- if (typeof f == "string") {
3097
- i(f);
3098
- return;
3099
- }
3100
- if (f !== null && typeof f == "object" && "content" in f) {
3101
- const p = f;
3102
- i(
3103
- p.content,
3104
- p.kind ?? "generic",
3105
- p.duration ?? 4,
3106
- p.isDismissible ?? !0
3107
- );
3108
- return;
3109
- }
3110
- i(f);
3111
- }, [i]), d = G(() => {
3112
- const f = u;
3113
- return f.success = (p) => {
3114
- i(p, "success");
3115
- }, f.error = (p) => {
3116
- i(p, "error");
3117
- }, f.warning = (p) => {
3118
- i(p, "warning");
3119
- }, f.info = (p) => {
3120
- i(p, "info");
3121
- }, f;
3122
- }, [u, i])();
3123
- return /* @__PURE__ */ I(mt.Provider, { value: { notify: d }, children: [
3124
- e,
3125
- /* @__PURE__ */ o(
3126
- ft,
3127
- {
3128
- position: t,
3129
- anchor: a,
3130
- order: r,
3131
- kind: c,
3132
- children: n.map(({ id: f, content: p, kind: $, duration: v, isDismissible: k }) => /* @__PURE__ */ o(
3133
- pt,
3134
- {
3135
- id: f,
3136
- kind: $,
3137
- duration: v,
3138
- isDismissible: k,
3139
- onClose: () => l(f),
3140
- children: typeof p == "function" ? p({ close: () => l(f) }) : p
3141
- },
3142
- f
3143
- ))
3144
- }
3145
- )
3146
- ] });
3147
- };
3148
- sa.displayName = "NotificationsProvider";
3149
- const qa = () => {
3150
- const e = Ne(mt);
3151
- if (!e)
3152
- throw new Error("useNotifications must be used within a NotificationsProvider");
3153
- return e.notify;
3154
- }, ht = N.forwardRef(
3155
- ({
3156
- size: e = "medium",
3157
- loadingText: t = "Loading...",
3158
- ...a
3159
- }, r) => {
3160
- let c = [];
3161
- return e && c.push(`size-${e}`), /* @__PURE__ */ o(
3162
- D,
3163
- {
3164
- as: "div",
3165
- "data-spinner": !0,
3166
- ref: r,
3167
- classNames: c,
3168
- role: "status",
3169
- "aria-busy": "true",
3170
- "aria-live": "polite",
3171
- "aria-label": t,
3172
- ...a
3173
- }
3174
- );
3175
- }
3176
- );
3177
- ht.displayName = "Spinner";
3178
- const Ye = (e, t) => {
3179
- const a = t - e + 1;
3180
- return Array.from({ length: a }, (r, c) => e + c);
3181
- }, na = ({
3182
- totalItems: e,
3183
- currentPage: t,
3184
- itemsToShowEachSide: a
3185
- }) => {
3186
- const r = e;
3187
- return {
3188
- items: (() => {
3189
- const n = a * 2 + 1;
3190
- let s = [];
3191
- if (r <= n)
3192
- s = Ye(1, r);
3193
- else {
3194
- const l = Math.min(t - 1, a), i = Math.min(r - t, a);
3195
- s.push(1), t - a > 2 && s.push("...");
3196
- const u = Math.max(2, t - l), d = Math.min(r - 1, t + i);
3197
- s.push(...Ye(u, d)), r - t > a + 1 && s.push("..."), d < r && s.push(r);
3198
- }
3199
- return s;
3200
- })(),
3201
- totalPages: r,
3202
- rangeStart: t,
3203
- rangeEnd: t,
3204
- hasPrevPage: t > 1,
3205
- hasNextPage: t < r
3206
- };
3207
- }, oa = ({
3208
- type: e,
3209
- page: t,
3210
- selected: a,
3211
- disabled: r,
3212
- onClick: c,
3213
- key: n,
3214
- ...s
3215
- }) => {
3216
- if (e === "ellipsis")
3217
- return /* @__PURE__ */ o(J, { className: "pagination-ellipsis", children: "..." });
3218
- const l = {
3219
- type: "button",
3220
- className: `pagination-item ${a ? "selected" : ""} ${r ? "disabled" : ""}`,
3221
- onClick: c,
3222
- disabled: r,
3223
- ...s
3224
- };
3225
- let i;
3226
- switch (e) {
3227
- case "first":
3228
- i = i = /* @__PURE__ */ I("svg", { viewBox: "0 0 24 24", children: [
3229
- /* @__PURE__ */ o("line", { x1: "5", y1: "18", x2: "5", y2: "6" }),
3230
- /* @__PURE__ */ o("polyline", { points: "14 18 9 12 14 6" }),
3231
- /* @__PURE__ */ o("line", { x1: "10", y1: "12", x2: "19", y2: "12" })
3232
- ] });
3233
- break;
3234
- case "previous":
3235
- i = /* @__PURE__ */ I("svg", { viewBox: "0 0 24 24", children: [
3236
- /* @__PURE__ */ o("polyline", { points: "12 18 7 12 12 6" }),
3237
- /* @__PURE__ */ o("line", { x1: "8", y1: "12", x2: "17", y2: "12" })
3238
- ] });
3239
- break;
3240
- case "next":
3241
- i = i = /* @__PURE__ */ I("svg", { viewBox: "0 0 24 24", children: [
3242
- /* @__PURE__ */ o("polyline", { points: "12 6 17 12 12 18" }),
3243
- /* @__PURE__ */ o("line", { x1: "16", y1: "12", x2: "7", y2: "12" })
3244
- ] });
3245
- break;
3246
- case "last":
3247
- i = i = /* @__PURE__ */ I("svg", { viewBox: "0 0 24 24", children: [
3248
- /* @__PURE__ */ o("polyline", { points: "10 6 15 12 10 18" }),
3249
- /* @__PURE__ */ o("line", { x1: "19", y1: "6", x2: "19", y2: "18" }),
3250
- /* @__PURE__ */ o("line", { x1: "14", y1: "12", x2: "5", y2: "12" })
3251
- ] });
3252
- break;
3253
- default:
3254
- i = t;
3255
- }
3256
- return /* @__PURE__ */ o(
3257
- He,
3258
- {
3259
- kind: "custom",
3260
- ...l,
3261
- children: i
3262
- }
3263
- );
3264
- }, ia = N.forwardRef(
3265
- ({
3266
- totalItems: e,
3267
- currentPage: t,
3268
- onPageChange: a,
3269
- itemsToShowEachSide: r = 1,
3270
- kind: c = "plain",
3271
- showGoToFirstItemButton: n = !0,
3272
- showGoToLastItemButton: s = !0,
3273
- showPreviousButton: l = !0,
3274
- showNextButton: i = !0,
3275
- showGoToInput: u = !1,
3276
- disabled: d = !1,
3277
- hideDisabledButtons: f = !1,
3278
- renderItem: p = oa,
3279
- isLoading: $ = !1,
3280
- loadingText: v,
3281
- emptyText: k,
3282
- itemDisplayText: m = "Page",
3283
- ...A
3284
- }, y) => {
3285
- const {
3286
- items: R,
3287
- totalPages: T,
3288
- rangeStart: F,
3289
- hasPrevPage: V,
3290
- hasNextPage: E
3291
- } = na({
3292
- totalItems: e,
3293
- currentPage: t,
3294
- itemsToShowEachSide: r
3295
- }), [P, g] = N.useState(""), L = (w) => {
3296
- g(w.target.value);
3297
- }, _ = (w) => {
3298
- if (w.key === "Enter") {
3299
- const z = parseInt(P);
3300
- !isNaN(z) && z >= 1 && z <= T && (a(z), g(""));
3301
- }
3302
- };
3303
- if (e === 0)
3304
- return /* @__PURE__ */ o(J, { className: "pagination-empty", children: k || "No items to display" });
3305
- let S = ["pagination"];
3306
- return c && S.push(c), d && S.push("disabled"), $ && S.push("loading"), /* @__PURE__ */ I(
3307
- D,
3308
- {
3309
- as: "nav",
3310
- "data-pagination": !0,
3311
- ref: y,
3312
- classNames: S,
3313
- role: "navigation",
3314
- "aria-label": "pagination",
3315
- ...A,
3316
- children: [
3317
- /* @__PURE__ */ I(K, { className: "pagination-controls", children: [
3318
- n && (!f || V) && p({
3319
- type: "first",
3320
- disabled: !V || d,
3321
- selected: !1,
3322
- onClick: () => a(1)
3323
- }),
3324
- l && (!f || V) && p({
3325
- type: "previous",
3326
- disabled: !V || d,
3327
- selected: !1,
3328
- onClick: () => a(t - 1)
3329
- }),
3330
- R.map((w, z) => {
3331
- const C = w === "..." ? {
3332
- key: `ellipsis-${z}`,
3333
- type: "ellipsis",
3334
- selected: !1,
3335
- disabled: !0
3336
- } : {
3337
- key: w.toString(),
3338
- type: "page",
3339
- page: w,
3340
- selected: w === t,
3341
- disabled: d,
3342
- "aria-current": w === t ? "page" : void 0,
3343
- onClick: () => a(w)
3344
- };
3345
- return p(C);
3346
- }),
3347
- i && (!f || E) && p({
3348
- type: "next",
3349
- disabled: !E || d,
3350
- selected: !1,
3351
- onClick: () => a(t + 1)
3352
- }),
3353
- s && (!f || E) && p({
3354
- type: "last",
3355
- disabled: !E || d,
3356
- selected: !1,
3357
- onClick: () => a(T)
3358
- }),
3359
- $ && /* @__PURE__ */ I(K, { className: "pagination-loading", children: [
3360
- /* @__PURE__ */ o(ht, {}),
3361
- v && /* @__PURE__ */ o(J, { size: "small", children: v })
3362
- ] })
3363
- ] }),
3364
- /* @__PURE__ */ I(K, { className: "pagination-info", children: [
3365
- /* @__PURE__ */ I(J, { size: "tiny", children: [
3366
- m,
3367
- " ",
3368
- F,
3369
- " of ",
3370
- e
3371
- ] }),
3372
- u && /* @__PURE__ */ o(K, { className: "pagination-go-to", children: /* @__PURE__ */ o(
3373
- "input",
3374
- {
3375
- type: "number",
3376
- min: 1,
3377
- max: T,
3378
- value: P,
3379
- onChange: L,
3380
- onKeyDown: _,
3381
- placeholder: `Go to ${m}`,
3382
- "aria-label": `Go to ${m}`,
3383
- disabled: d
3384
- }
3385
- ) })
3386
- ] })
3387
- ]
3388
- }
3389
- );
3390
- }
3391
- );
3392
- ia.displayName = "Pagination";
3393
- const la = N.forwardRef(
3394
- ({
3395
- label: e,
3396
- value: t,
3397
- height: a,
3398
- max: r = 100,
3399
- shape: c,
3400
- bgColor: n,
3401
- bgColour: s,
3402
- fillColor: l,
3403
- fillColour: i,
3404
- ...u
3405
- }, d) => {
3406
- const f = Math.max(0, Math.min(r, Number(t) || 0)), p = `${f}${u.suffix || ""}`, $ = s || n, v = i || l, k = {
3407
- height: a,
3408
- ...$ && { "--progress-bar-bg": `var(--${$})` },
3409
- ...v && { "--progress-bar-fill": `var(--${v})` }
3410
- };
3411
- return /* @__PURE__ */ I(Me, { children: [
3412
- e && /* @__PURE__ */ I(
3413
- D,
3414
- {
3415
- as: "div",
3416
- "data-progress-bar-meta": !0,
3417
- "aria-hidden": "true",
3418
- children: [
3419
- /* @__PURE__ */ o(J, { children: e }),
3420
- /* @__PURE__ */ o(J, { children: p })
3421
- ]
3422
- }
3423
- ),
3424
- /* @__PURE__ */ o(
3425
- D,
3426
- {
3427
- as: "progress",
3428
- "data-progress-bar": !0,
3429
- ref: d,
3430
- value: f,
3431
- max: r,
3432
- "aria-label": e,
3433
- "aria-valuemin": 0,
3434
- "aria-valuemax": r,
3435
- "aria-valuenow": f,
3436
- "aria-valuetext": `${e ? `${e}: ` : ""}${p}`,
3437
- shape: c,
3438
- ...u,
3439
- style: k
3440
- }
3441
- )
3442
- ] });
3443
- }
3444
- );
3445
- la.displayName = "ProgressBar";
3446
- const Oe = Le({
3447
- isSelected: () => !1,
3448
- toggleSelection: () => {
3449
- },
3450
- showTickIcon: !1,
3451
- tickPosition: "top-right",
3452
- selectAll: () => {
3453
- },
3454
- selectNone: () => {
3455
- },
3456
- selectInverse: () => {
3457
- },
3458
- registerOption: () => {
3459
- },
3460
- unregisterOption: () => {
3461
- }
3462
- }), ca = N.forwardRef(
3463
- ({
3464
- children: e,
3465
- allowMultipleSelections: t = !1,
3466
- showTickIcon: a,
3467
- onSelectionChange: r,
3468
- tickPosition: c = "top-right",
3469
- selectionLimit: n,
3470
- defaultSelectedIds: s,
3471
- selectedIds: l,
3472
- ...i
3473
- }, u) => {
3474
- const d = l !== void 0, [f, p] = j(
3475
- s ? new Set(s) : /* @__PURE__ */ new Set()
3476
- ), $ = Y(/* @__PURE__ */ new Map()), v = d ? l : f, k = G((P) => {
3477
- d || p(P), r == null || r(P);
3478
- }, [d, r]), m = G((P, g) => {
3479
- $.current.set(P, g);
3480
- }, []), A = G((P) => {
3481
- $.current.delete(P);
3482
- }, []), y = G((P) => {
3483
- const g = new Set(v);
3484
- if (t)
3485
- if (g.has(P))
3486
- g.delete(P);
3487
- else {
3488
- if (n && g.size >= n)
3489
- return;
3490
- g.add(P);
3491
- }
3492
- else
3493
- g.has(P) && v.size === 1 ? g.clear() : (g.clear(), g.add(P));
3494
- k(g);
3495
- }, [v, t, n, k]), R = G(() => {
3496
- if (!t) return;
3497
- const P = Array.from($.current.entries()).filter(([L, _]) => !_).map(([L]) => L), g = n ? P.slice(0, n) : P;
3498
- k(new Set(g));
3499
- }, [t, n, k]), T = G(() => {
3500
- k(/* @__PURE__ */ new Set());
3501
- }, [k]), F = G(() => {
3502
- if (!t) return;
3503
- const g = Array.from($.current.entries()).filter(([_, S]) => !S).map(([_]) => _).filter((_) => !v.has(_)), L = n ? g.slice(0, n) : g;
3504
- k(new Set(L));
3505
- }, [v, t, n, k]), V = G((P) => v.has(P), [v]);
3506
- N.useImperativeHandle(u, () => ({
3507
- selectAll: R,
3508
- selectNone: T,
3509
- selectInverse: F
3510
- }), [R, T, F]);
3511
- const E = {
3512
- isSelected: V,
3513
- toggleSelection: y,
3514
- showTickIcon: a,
3515
- tickPosition: c,
3516
- selectAll: R,
3517
- selectNone: T,
3518
- selectInverse: F,
3519
- registerOption: m,
3520
- unregisterOption: A
3521
- };
3522
- return /* @__PURE__ */ o(Oe.Provider, { value: E, children: /* @__PURE__ */ o(K, { "data-option-cards-group": !0, className: `tick-${c}`, children: e }) });
3523
- }
3524
- );
3525
- ca.displayName = "OptionCardsGroup";
3526
- const Ya = (e) => {
3527
- const t = Ne(Oe);
3528
- return {
3529
- isSelected: t.isSelected(e),
3530
- toggleSelection: () => t.toggleSelection(e),
3531
- showTickIcon: t.showTickIcon
3532
- };
3533
- }, Ja = () => {
3534
- const { selectAll: e, selectNone: t, selectInverse: a } = Ne(Oe);
3535
- return { selectAll: e, selectNone: t, selectInverse: a };
3536
- }, Za = ({ id: e, children: t, disabled: a = !1, ...r }) => {
3537
- const { isSelected: c, toggleSelection: n, showTickIcon: s, registerOption: l, unregisterOption: i } = Ne(Oe), [u, d] = j(!1), [f, p] = j(!0);
3538
- N.useEffect(() => (l(e, a), () => i(e)), [e, a, l, i]);
3539
- let $ = [];
3540
- c(e) && $.push("selected"), a && $.push("disabled"), u && $.push("show-deselect");
3541
- const v = () => {
3542
- c(e) && !f && d(!0);
3543
- }, k = () => {
3544
- d(!1), p(!1);
3545
- }, m = (y) => {
3546
- var R;
3547
- a || (p(!0), d(!1), n(e), (R = r.onClick) == null || R.call(r, y));
3548
- }, A = (y) => {
3549
- (y.key === "Enter" || y.key === " ") && !a && (y.preventDefault(), p(!0), d(!1), n(e));
3550
- };
3551
- return /* @__PURE__ */ I(
3552
- D,
3553
- {
3554
- as: tt,
3555
- "data-option-card": !0,
3556
- role: "button",
3557
- tabIndex: a ? -1 : 0,
3558
- "aria-disabled": a,
3559
- "aria-selected": c(e),
3560
- classNames: $,
3561
- onClick: m,
3562
- onKeyDown: A,
3563
- onMouseEnter: v,
3564
- onMouseLeave: k,
3565
- ...r,
3566
- children: [
3567
- s && /* @__PURE__ */ I(Me, { children: [
3568
- /* @__PURE__ */ I("svg", { viewBox: "0 0 24 24", className: "tick-icon", children: [
3569
- /* @__PURE__ */ o("circle", { cx: "12", cy: "12", r: "11" }),
3570
- /* @__PURE__ */ o("path", { d: "M8 13 L11 15 L16 9" })
3571
- ] }),
3572
- /* @__PURE__ */ I("svg", { viewBox: "0 0 24 24", className: "deselect-icon", children: [
3573
- /* @__PURE__ */ o("circle", { cx: "12", cy: "12", r: "11" }),
3574
- /* @__PURE__ */ o("path", { d: "M8 8 L16 16 M16 8 L8 16" })
3575
- ] })
3576
- ] }),
3577
- t
3578
- ]
3579
- }
3580
- );
3581
- }, da = N.forwardRef(
3582
- ({
3583
- collapsed: e,
3584
- closeOnClickOutside: t,
3585
- showMobileSidebar: a,
3586
- ...r
3587
- }, c) => {
3588
- const n = Y(null);
3589
- Qe(c, () => n.current), ze(n, () => {
3590
- typeof t == "function" && t();
3591
- });
3592
- let s = [];
3593
- return e && s.push("collapsed"), a && s.push("show-sidebar"), /* @__PURE__ */ o(
3594
- D,
3595
- {
3596
- as: "aside",
3597
- "data-sidebar-wrapper": !0,
3598
- ref: n,
3599
- classNames: s,
3600
- ...r
3601
- }
3602
- );
3603
- }
3604
- );
3605
- da.displayName = "SidebarWrapper";
3606
- const ua = N.forwardRef(
3607
- ({ label: e, ...t }, a) => /* @__PURE__ */ o(
3608
- D,
3609
- {
3610
- as: "main",
3611
- "data-content-wrapper": !0,
3612
- ref: a,
3613
- role: "main",
3614
- "aria-label": e || "Main content",
3615
- ...t
3616
- }
3617
- )
3618
- );
3619
- ua.displayName = "ContentWrapper";
3620
- const fa = N.forwardRef(
3621
- ({ isSticky: e, ...t }, a) => {
3622
- let r = [];
3623
- return e && r.push("is-sticky"), /* @__PURE__ */ o(
3624
- D,
3625
- {
3626
- as: "header",
3627
- "data-sidebar-header": !0,
3628
- ref: a,
3629
- classNames: r,
3630
- ...t
3631
- }
3632
- );
3633
- }
3634
- );
3635
- fa.displayName = "SidebarHeader";
3636
- const pa = N.forwardRef(
3637
- ({ hasAlert: e, hasEmptyIcon: t, hasNoIcon: a, children: r, ...c }, n) => {
3638
- let s = [];
3639
- return e && s.push("has-alert"), t ? s.push("has-empty-icon") : a && s.push("has-no-icon"), /* @__PURE__ */ I(
3640
- D,
3641
- {
3642
- as: "div",
3643
- "data-sidebar-item": !0,
3644
- ref: n,
3645
- classNames: s,
3646
- ...c,
3647
- children: [
3648
- t && /* @__PURE__ */ o(K, { className: "empty-icon-wrapper" }),
3649
- r
3650
- ]
3651
- }
3652
- );
3653
- }
3654
- );
3655
- pa.displayName = "SidebarItem";
3656
- const ma = N.forwardRef(
3657
- ({ isSticky: e, ...t }, a) => {
3658
- let r = [];
3659
- return e && r.push("is-sticky"), /* @__PURE__ */ o(
3660
- D,
3661
- {
3662
- as: "footer",
3663
- "data-sidebar-footer": !0,
3664
- ref: a,
3665
- classNames: r,
3666
- ...t
3667
- }
3668
- );
3669
- }
3670
- );
3671
- ma.displayName = "SidebarFooter";
3672
- const vt = Le({
3673
- effect: "wave",
3674
- animate: !0
3675
- }), ha = N.forwardRef(({
3676
- variant: e = "line",
3677
- width: t,
3678
- height: a,
3679
- shape: r,
3680
- effect: c,
3681
- loadingLabel: n,
3682
- ...s
3683
- }, l) => {
3684
- const i = Ne(vt), u = c || i.effect, d = n || i.loadingLabel || "Loading...";
3685
- let f = [];
3686
- e && f.push(`variant-${e}`), r && f.push(`shape-${r}`), u && f.push(`effect-${u}`);
3687
- const p = t || "100%", $ = e === "circle" ? (typeof t == "number" ? `${t}px` : t) || a || "100%" : a, v = {
3688
- width: p,
3689
- height: $,
3690
- aspectRatio: e === "circle" ? "1 / 1" : "auto",
3691
- ...s.style
3692
- };
3693
- return /* @__PURE__ */ o(
3694
- D,
3695
- {
3696
- as: "div",
3697
- "data-skeleton": !0,
3698
- ref: l,
3699
- classNames: f,
3700
- style: v,
3701
- role: "progressbar",
3702
- "aria-busy": "true",
3703
- "aria-valuemin": 0,
3704
- "aria-valuemax": 100,
3705
- "aria-valuetext": d,
3706
- "aria-label": d,
3707
- ...s
3708
- }
3709
- );
3710
- });
3711
- ha.displayName = "Skeleton";
3712
- const va = N.forwardRef(({
3713
- effect: e = "wave",
3714
- spacing: t = "small",
3715
- animate: a = !0,
3716
- repeat: r = 1,
3717
- direction: c = "vertical",
3718
- children: n,
3719
- classNames: s = [],
3720
- loadingLabel: l = "Loading content...",
3721
- ...i
3722
- }, u) => {
3723
- const d = [
3724
- `direction-${c}`,
3725
- e && `effect-${e}`,
3726
- ...s
3727
- ];
3728
- return t && d.push(`spacing-${t}`), /* @__PURE__ */ o(vt.Provider, { value: { effect: e, animate: a, loadingLabel: l }, children: /* @__PURE__ */ o(
3729
- D,
3730
- {
3731
- as: "div",
3732
- ref: u,
3733
- "data-skeleton-group": !0,
3734
- classNames: d,
3735
- role: "alert",
3736
- "aria-busy": "true",
3737
- "aria-label": l,
3738
- ...i,
3739
- children: Array(r).fill(n).map((f, p) => N.cloneElement(f, {
3740
- key: p
3741
- }))
3742
- }
3743
- ) });
3744
- });
3745
- va.displayName = "SkeletonGroup";
3746
- const ya = N.forwardRef(
3747
- ({
3748
- bordersFor: e,
3749
- isStriped: t,
3750
- highlightRowOnHover: a,
3751
- isFullWidth: r,
3752
- alignText: c,
3753
- caption: n,
3754
- summary: s,
3755
- hasColSpan: l,
3756
- children: i,
3757
- ...u
3758
- }, d) => {
3759
- let f = [];
3760
- e && f.push(`bordered-${e}`), t && f.push("striped"), a && f.push("hoverable"), r && f.push("full-width"), c && f.push(`align-text-${c}`);
3761
- const p = N.Children.count(i);
3762
- return /* @__PURE__ */ I(
3763
- D,
3764
- {
3765
- as: "table",
3766
- classNames: f,
3767
- ref: d,
3768
- role: "table",
3769
- "aria-rowcount": p || void 0,
3770
- "aria-colcount": l ? void 0 : (() => {
3771
- if (!i || !N.isValidElement(i)) return;
3772
- const v = N.Children.toArray(i)[0];
3773
- if (N.isValidElement(v)) {
3774
- const k = v.props;
3775
- if (k.children)
3776
- return N.Children.count(k.children);
3777
- }
3778
- })(),
3779
- summary: s,
3780
- ...u,
3781
- children: [
3782
- n && /* @__PURE__ */ o("caption", { children: n }),
3783
- i
3784
- ]
3785
- }
3786
- );
3787
- }
3788
- );
3789
- ya.displayName = "Table";
3790
- const wa = N.forwardRef(
3791
- ({ tabs: e, additionalNavContentWrapper: t, defaultActiveTab: a, align: r = "left", isFullWidth: c, ...n }, s) => {
3792
- const l = e.findIndex((m) => m.key === a), i = l > -1 ? l : 0, [u, d] = N.useState(
3793
- e.length > 0 ? e[i] : void 0
3794
- ), [f, p] = N.useState(!1), $ = Y([]), v = G((m) => {
3795
- (u == null ? void 0 : u.key) !== m.key && (p(!0), setTimeout(() => {
3796
- d(m), p(!1);
3797
- }, 150));
3798
- }, [u == null ? void 0 : u.key]);
3799
- U(() => {
3800
- e.length > 0 ? e.find((A) => A.key === (u == null ? void 0 : u.key)) || d(e[i]) : d(void 0);
3801
- }, [e, i, u == null ? void 0 : u.key]);
3802
- const k = G((m, A) => {
3803
- var T;
3804
- let y = A;
3805
- if (m.key === "ArrowRight")
3806
- y = (A + 1) % e.length;
3807
- else if (m.key === "ArrowLeft")
3808
- y = (A - 1 + e.length) % e.length;
3809
- else if (m.key === "Home")
3810
- y = 0;
3811
- else if (m.key === "End")
3812
- y = e.length - 1;
3813
- else
3814
- return;
3815
- m.preventDefault();
3816
- const R = e[y];
3817
- R && (v(R), (T = $.current[y]) == null || T.focus());
3818
- }, [e, v]);
3819
- return u ? /* @__PURE__ */ I(
3820
- D,
3821
- {
3822
- as: "div",
3823
- "data-tabs": !0,
3824
- ref: s,
3825
- "data-align": r,
3826
- "data-full-width": c,
3827
- ...n,
3828
- children: [
3829
- /* @__PURE__ */ o(It, { "data-tabs-nav": !0, role: "tablist", "aria-label": "Tab Navigation", children: /* @__PURE__ */ I("ul", { className: "tab-labels-list", children: [
3830
- e.map((m, A) => /* @__PURE__ */ o("li", { children: /* @__PURE__ */ o(
3831
- D,
3832
- {
3833
- as: "button",
3834
- ref: (y) => $.current[A] = y,
3835
- id: `tab-${m.key}`,
3836
- role: "tab",
3837
- "aria-selected": u.key === m.key,
3838
- "aria-controls": `tab-panel-${m.key}`,
3839
- tabIndex: u.key === m.key ? 0 : -1,
3840
- "data-tab-label": !0,
3841
- "data-active": u.key === m.key,
3842
- "data-alert": m.hasAlert,
3843
- onClick: () => v(m),
3844
- onKeyDown: (y) => k(y, A),
3845
- className: `tab-button ${u.key === m.key ? "is-active" : ""}`,
3846
- marginBottom: "nano",
3847
- children: /* @__PURE__ */ o(
3848
- J,
3849
- {
3850
- className: `tab-label ${u.key === m.key ? "is-active" : ""} ${m.hasAlert ? "has-alert" : ""}`,
3851
- children: m.label
3852
- }
3853
- )
3854
- }
3855
- ) }, m.key)),
3856
- t
3857
- ] }) }),
3858
- /* @__PURE__ */ o(at, { kind: "tertiary", marginTop: "none", marginBottom: "micro" }),
3859
- e.map((m) => /* @__PURE__ */ o(
3860
- K,
3861
- {
3862
- id: `tab-panel-${m.key}`,
3863
- role: "tabpanel",
3864
- "aria-labelledby": `tab-${m.key}`,
3865
- tabIndex: u.key === m.key ? 0 : -1,
3866
- "data-tab-content": !0,
3867
- "data-active": u.key === m.key,
3868
- "data-exiting": u.key === m.key && f,
3869
- hidden: u.key !== m.key,
3870
- children: m.content
3871
- },
3872
- m.key
3873
- ))
3874
- ]
3875
- }
3876
- ) : null;
3877
- }
3878
- );
3879
- wa.displayName = "Tabs";
3880
- const Te = () => {
3881
- if (typeof window < "u") {
3882
- const e = window.location.hostname, t = window.location.port;
3883
- let a = e.replace(/\./g, "-");
3884
- return t && (a += `-${t}`), `${a}-theme`;
3885
- }
3886
- return "fictoan-theme";
3887
- }, ga = ["", (e) => {
3888
- }], yt = N.createContext(void 0), Qa = () => {
3889
- const e = N.useContext(yt);
3890
- return e === void 0 ? ga : e;
3891
- }, Je = (e, t) => {
3892
- let a;
3893
- try {
3894
- a = localStorage.getItem(e) || void 0;
3895
- } catch {
3896
- }
3897
- return a || t;
3898
- }, ba = N.forwardRef(
3899
- ({ currentTheme: e, themeList: t, children: a, ...r }, c) => {
3900
- const [n, s] = j(!1), [l, i] = j(() => Je(Te()) || e), u = G(
3901
- (d) => {
3902
- const f = typeof d == "function" ? d(l) : d;
3903
- if (!t.includes(f)) {
3904
- const p = t[0];
3905
- i(p), document.documentElement.className = "", document.documentElement.classList.add(p);
3906
- try {
3907
- localStorage.setItem(Te(), p);
3908
- } catch {
3909
- }
3910
- return;
3911
- }
3912
- i(f), document.documentElement.className = "", document.documentElement.classList.add(f), n || s(!0);
3913
- try {
3914
- localStorage.setItem(Te(), f);
3915
- } catch {
3916
- }
3917
- },
3918
- [l, t]
3919
- );
3920
- return U(() => {
3921
- const d = Je(Te());
3922
- u(d || e);
3923
- }, [e, u]), /* @__PURE__ */ o(yt.Provider, { value: [l, u], children: /* @__PURE__ */ o(D, { as: "div", "data-theme-provider": !0, ref: c, ...r, children: n && a }) });
3924
- }
3925
- );
3926
- ba.displayName = "ThemeProvider";
3927
- const wt = N.forwardRef(
3928
- ({
3929
- anchor: e = "top",
3930
- children: t,
3931
- ...a
3932
- }, r) => N.Children.count(t) === 0 ? null : /* @__PURE__ */ o(
3933
- D,
3934
- {
3935
- as: "section",
3936
- "data-toasts-wrapper": !0,
3937
- ref: r,
3938
- classNames: [e],
3939
- "aria-label": "Toasts",
3940
- "aria-relevant": "additions removals",
3941
- role: "log",
3942
- ...a,
3943
- children: t
3944
- }
3945
- )
3946
- );
3947
- wt.displayName = "ToastsWrapper";
3948
- const gt = ({
3949
- id: e,
3950
- duration: t = 4,
3951
- onClose: a,
3952
- children: r
3953
- }) => {
3954
- const [c, n] = j(!1);
3955
- return U(() => {
3956
- if (t === 0) return;
3957
- const l = setTimeout(() => {
3958
- n(!0);
3959
- }, t * 1e3);
3960
- return () => clearTimeout(l);
3961
- }, [t]), U(() => {
3962
- if (!c) return;
3963
- const l = setTimeout(() => {
3964
- a();
3965
- }, 500);
3966
- return () => clearTimeout(l);
3967
- }, [c, a]), /* @__PURE__ */ o(
3968
- D,
3969
- {
3970
- as: "div",
3971
- "data-toast-item": !0,
3972
- id: e,
3973
- classNames: c ? ["dismissed"] : [],
3974
- onTransitionEnd: () => {
3975
- c && a();
3976
- },
3977
- role: "status",
3978
- "aria-live": "polite",
3979
- "aria-atomic": "true",
3980
- shadow: "soft",
3981
- children: r
3982
- }
3983
- );
3984
- };
3985
- gt.displayName = "ToastItem";
3986
- const bt = Le(null), Na = ({
3987
- children: e,
3988
- anchor: t = "top"
3989
- }) => {
3990
- const [a, r] = j([]), c = G((s) => {
3991
- r((l) => l.filter((i) => i.id !== s));
3992
- }, []), n = G((s, l = 4) => {
3993
- const i = `toast-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
3994
- r((u) => [...u, {
3995
- id: i,
3996
- message: s,
3997
- duration: l
3998
- }]);
3999
- }, []);
4000
- return /* @__PURE__ */ I(bt.Provider, { value: { toast: n }, children: [
4001
- e,
4002
- /* @__PURE__ */ o(wt, { anchor: t, children: a.map(({ id: s, message: l, duration: i }) => /* @__PURE__ */ o(
4003
- gt,
4004
- {
4005
- id: s,
4006
- duration: i,
4007
- onClose: () => c(s),
4008
- children: l
4009
- },
4010
- s
4011
- )) })
4012
- ] });
4013
- };
4014
- Na.displayName = "ToastsProvider";
4015
- const er = () => {
4016
- const e = Ne(bt);
4017
- if (!e)
4018
- throw new Error("useToasts must be used within a ToastsProvider");
4019
- return e.toast;
4020
- }, fe = 8, ne = 16;
4021
- let oe = null, pe = null, We = !1, ce = null, ve = null;
4022
- const me = /* @__PURE__ */ new Map(), ka = (e, t, a) => {
4023
- const r = e.getBoundingClientRect(), c = t.getBoundingClientRect(), n = window.innerHeight, s = window.innerWidth;
4024
- let l, i;
4025
- switch (a) {
4026
- case "top":
4027
- l = c.top - r.height - fe, i = c.left + (c.width - r.width) / 2, l < ne && (l = c.bottom + fe);
4028
- break;
4029
- case "bottom":
4030
- l = c.bottom + fe, i = c.left + (c.width - r.width) / 2, l + r.height > n - ne && (l = c.top - r.height - fe);
4031
- break;
4032
- case "left":
4033
- l = c.top + (c.height - r.height) / 2, i = c.left - r.width - fe, i < ne && (i = c.right + fe);
4034
- break;
4035
- case "right":
4036
- l = c.top + (c.height - r.height) / 2, i = c.right + fe, i + r.width > s - ne && (i = c.left - r.width - fe);
4037
- break;
4038
- default:
4039
- l = c.top - r.height - fe, i = c.left + (c.width - r.width) / 2;
4040
- }
4041
- return i < ne ? i = ne : i + r.width > s - ne && (i = s - r.width - ne), l < ne ? l = ne : l + r.height > n - ne && (l = n - r.height - ne), { top: l, left: i };
4042
- }, De = ({ content: e, isVisible: t, position: a, zIndex: r }) => /* @__PURE__ */ o(
4043
- "div",
4044
- {
4045
- "data-tooltip": !0,
4046
- className: t ? "visible" : "",
4047
- role: "tooltip",
4048
- style: {
4049
- position: "fixed",
4050
- zIndex: r,
4051
- top: `${a.top}px`,
4052
- left: `${a.left}px`
4053
- },
4054
- children: e
4055
- }
4056
- ), Re = (e, t) => {
4057
- if (!(!pe || !oe)) {
4058
- if (!e || !t) {
4059
- pe.render(
4060
- /* @__PURE__ */ o(De, { content: null, isVisible: !1, position: { top: -9999, left: -9999 }, zIndex: 1e5 })
4061
- );
4062
- return;
4063
- }
4064
- pe.render(
4065
- /* @__PURE__ */ o(De, { content: e.content, isVisible: !1, position: { top: -9999, left: -9999 }, zIndex: e.zIndex })
4066
- ), requestAnimationFrame(() => {
4067
- if (!oe || !t) return;
4068
- const a = oe.firstElementChild;
4069
- if (!a) return;
4070
- const { top: r, left: c } = ka(a, t, e.position);
4071
- pe == null || pe.render(
4072
- /* @__PURE__ */ o(De, { content: e.content, isVisible: !0, position: { top: r, left: c }, zIndex: e.zIndex })
4073
- );
4074
- });
4075
- }
4076
- }, Ze = () => {
4077
- if (!ce || !ve) return;
4078
- const e = me.get(ce);
4079
- e && Re(e, ve);
4080
- }, Nt = (e, t) => {
4081
- const a = me.get(e);
4082
- a && (ce = e, ve = t, Re(a, t));
4083
- }, Ae = (e) => {
4084
- e && ce !== e || (ce = null, ve = null, Re(null, null));
4085
- }, $a = (e) => {
4086
- const t = e.target.closest("[id]");
4087
- if (!(t != null && t.id)) return;
4088
- const a = me.get(t.id);
4089
- (a == null ? void 0 : a.showOn) === "hover" && Nt(t.id, t);
4090
- }, xa = (e) => {
4091
- const t = e.target.closest("[id]");
4092
- if (!(t != null && t.id)) return;
4093
- const a = me.get(t.id);
4094
- (a == null ? void 0 : a.showOn) === "hover" && Ae(t.id);
4095
- }, Ra = (e) => {
4096
- if (oe != null && oe.contains(e.target))
4097
- return;
4098
- const t = e.target.closest("[id]");
4099
- if (t != null && t.id) {
4100
- const a = me.get(t.id);
4101
- if ((a == null ? void 0 : a.showOn) === "click") {
4102
- ce === t.id ? Ae() : Nt(t.id, t);
4103
- return;
4104
- }
4105
- }
4106
- if (ce) {
4107
- const a = me.get(ce);
4108
- (a == null ? void 0 : a.showOn) === "click" && Ae();
4109
- }
4110
- }, Ma = () => {
4111
- if (typeof document > "u") return;
4112
- const e = document.getElementById("fictoan-tooltip-singleton");
4113
- if (e && We) {
4114
- oe = e;
4115
- return;
4116
- }
4117
- We = !1, oe = null, pe = null, oe = document.createElement("div"), oe.id = "fictoan-tooltip-singleton", document.body.appendChild(oe), pe = Pt(oe), pe.render(
4118
- /* @__PURE__ */ o(De, { content: null, isVisible: !1, position: { top: -9999, left: -9999 }, zIndex: 1e5 })
4119
- ), document.addEventListener("mouseover", $a), document.addEventListener("mouseout", xa), document.addEventListener("click", Ra), window.addEventListener("scroll", Ze, !0), window.addEventListener("resize", Ze), We = !0;
4120
- }, tr = ({
4121
- children: e,
4122
- isTooltipFor: t,
4123
- showOn: a = "hover",
4124
- position: r = "top",
4125
- zIndex: c = 1e5
4126
- }) => {
4127
- const n = Y({ content: e, position: r, showOn: a, zIndex: c });
4128
- return n.current = { content: e, position: r, showOn: a, zIndex: c }, U(() => (Ma(), me.set(t, n.current), ce === t && ve && Re(n.current, ve), () => {
4129
- me.delete(t), ce === t && Ae();
4130
- }), [t]), U(() => {
4131
- me.set(t, n.current), ce === t && ve && Re(n.current, ve);
4132
- }, [e, r, a, c, t]), null;
4133
- }, ke = N.forwardRef(
4134
- ({ fontStyle: e = "sans-serif", weight: t, align: a, ...r }, c) => {
4135
- let n = [];
4136
- return t && n.push(`weight-${t}`), e && n.push(`font-${e}`), a && n.push(`text-${a}`), /* @__PURE__ */ o(D, { ref: c, classNames: n, ...r });
4137
- }
4138
- ), Ea = N.forwardRef((e, t) => /* @__PURE__ */ o(ke, { as: "h1", ref: t, ...e }));
4139
- Ea.displayName = "Heading1";
4140
- const Pa = N.forwardRef((e, t) => /* @__PURE__ */ o(ke, { as: "h2", ref: t, ...e }));
4141
- Pa.displayName = "Heading2";
4142
- const Sa = N.forwardRef((e, t) => /* @__PURE__ */ o(ke, { as: "h3", ref: t, ...e }));
4143
- Sa.displayName = "Heading3";
4144
- const Ia = N.forwardRef((e, t) => /* @__PURE__ */ o(ke, { as: "h4", ref: t, ...e }));
4145
- Ia.displayName = "Heading4";
4146
- const Ta = N.forwardRef((e, t) => /* @__PURE__ */ o(ke, { as: "h5", ref: t, ...e }));
4147
- Ta.displayName = "Heading5";
4148
- const Da = N.forwardRef((e, t) => /* @__PURE__ */ o(ke, { as: "h6", ref: t, ...e }));
4149
- Da.displayName = "Heading6";
4150
- const Aa = N.forwardRef(
4151
- ({ summary: e, children: t, isOpen: a = !1, ...r }, c) => /* @__PURE__ */ I(
4152
- D,
4153
- {
4154
- as: "details",
4155
- "data-expandable-content": !0,
4156
- ref: c,
4157
- ...r,
4158
- open: a,
4159
- role: "region",
4160
- "aria-labelledby": "accordion-summary",
4161
- children: [
4162
- /* @__PURE__ */ o(
4163
- "summary",
4164
- {
4165
- role: "button",
4166
- tabIndex: 0,
4167
- "aria-controls": "accordion-content",
4168
- "aria-expanded": a,
4169
- children: typeof e == "string" ? /* @__PURE__ */ o(J, { margin: "none", children: e }) : e
4170
- }
4171
- ),
4172
- t
4173
- ]
4174
- }
4175
- )
4176
- );
4177
- Aa.displayName = "Accordion";
4178
- export {
4179
- ua as $,
4180
- Aa as A,
4181
- Be as B,
4182
- et as C,
4183
- Dt as D,
4184
- D as E,
4185
- _a as F,
4186
- aa as G,
4187
- Ga as H,
4188
- Pe as I,
4189
- sa as J,
4190
- qa as K,
4191
- Yt as L,
4192
- Ka as M,
4193
- It as N,
4194
- ia as O,
4195
- Jt as P,
4196
- st as Q,
4197
- nt as R,
4198
- ja as S,
4199
- ct as T,
4200
- la as U,
4201
- it as V,
4202
- Za as W,
4203
- Ya as X,
4204
- Ja as Y,
4205
- ca as Z,
4206
- da as _,
4207
- He as a,
4208
- fa as a0,
4209
- pa as a1,
4210
- ma as a2,
4211
- ha as a3,
4212
- va as a4,
4213
- ht as a5,
4214
- ya as a6,
4215
- wa as a7,
4216
- ba as a8,
4217
- Qa as a9,
4218
- Na as aa,
4219
- er as ab,
4220
- tr as ac,
4221
- Ea as ad,
4222
- Pa as ae,
4223
- Sa as af,
4224
- Ia as ag,
4225
- Ta as ah,
4226
- Da as ai,
4227
- J as aj,
4228
- At as b,
4229
- Bt as c,
4230
- tt as d,
4231
- Ot as e,
4232
- at as f,
4233
- K as g,
4234
- Wa as h,
4235
- za as i,
4236
- Ha as j,
4237
- Xa as k,
4238
- Ua as l,
4239
- _e as m,
4240
- Vt as n,
4241
- rt as o,
4242
- Gt as p,
4243
- ee as q,
4244
- Kt as r,
4245
- Ee as s,
4246
- ot as t,
4247
- Zt as u,
4248
- ea as v,
4249
- lt as w,
4250
- Ge as x,
4251
- Wt as y,
4252
- ta as z
4253
- };
4254
- //# sourceMappingURL=Accordion-CeGNgNW8.js.map