@viasat/beam-shared 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/README.md +108 -0
  2. package/chunks/SegmentedControl.B9dLCFSF.js +9 -0
  3. package/chunks/SegmentedControl.D0l_8a7O.js +1 -0
  4. package/chunks/accordion.C1LkPYXv.js +1 -0
  5. package/chunks/accordion.CCM7ddD5.js +11 -0
  6. package/chunks/actionList.LFHBSlrg.js +1 -0
  7. package/chunks/actionList.X99uHmXK.js +26 -0
  8. package/chunks/alert.B4q5-o6H.js +1 -0
  9. package/chunks/alert.BZ4L-6bC.js +32 -0
  10. package/chunks/avatar.BbM_sNXk.js +63 -0
  11. package/chunks/avatar.VNzxbOMa.js +1 -0
  12. package/chunks/badge.B_k2GBe6.js +1 -0
  13. package/chunks/badge.DZN0yrZh.js +44 -0
  14. package/chunks/badgeDot.ClhZtqzd.js +25 -0
  15. package/chunks/badgeDot.Dkqfk3zg.js +1 -0
  16. package/chunks/box.CsO__7hu.js +1 -0
  17. package/chunks/box._mFtvgTp.js +82 -0
  18. package/chunks/button.Bbz_mfWv.js +1 -0
  19. package/chunks/button.Dz8Zhr7J.js +51 -0
  20. package/chunks/card.CG-SDcm1.js +27 -0
  21. package/chunks/card.CLwQAceo.js +1 -0
  22. package/chunks/chips.DKEagIsp.js +1 -0
  23. package/chunks/chips.GU9UVEOU.js +13 -0
  24. package/chunks/closeButton.C1A3p88y.js +1 -0
  25. package/chunks/closeButton.g8_iRoUg.js +15 -0
  26. package/chunks/dialog.BTq-pLBf.js +28 -0
  27. package/chunks/dialog.DnkeApRr.js +1 -0
  28. package/chunks/divider.BYMLu6Wp.js +1 -0
  29. package/chunks/divider.DgP7kpLb.js +35 -0
  30. package/chunks/fileUpload.BbSIsjJv.js +240 -0
  31. package/chunks/fileUpload.C-l2YXzO.js +1 -0
  32. package/chunks/form.BRWIo59c.js +154 -0
  33. package/chunks/form.CIzlawbr.js +1 -0
  34. package/chunks/helperText.C-apoW8Z.js +1 -0
  35. package/chunks/helperText.CS5sun4r.js +16 -0
  36. package/chunks/icon.SiHuIfL8.js +1 -0
  37. package/chunks/icon.tCAxaKQh.js +28 -0
  38. package/chunks/inputChoiceGroup.BSousduj.js +1 -0
  39. package/chunks/inputChoiceGroup.DkDdA57f.js +10 -0
  40. package/chunks/link.DxTb3yhm.js +16 -0
  41. package/chunks/link.VyBRMFxS.js +1 -0
  42. package/chunks/list.CCq0lIzm.js +29 -0
  43. package/chunks/list.D6NIx1OS.js +1 -0
  44. package/chunks/logo.CLQZSaVN.js +1 -0
  45. package/chunks/logo.Cl29Chxj.js +11 -0
  46. package/chunks/nativeSelect.D9HZm9uJ.js +28 -0
  47. package/chunks/nativeSelect.Lz45VyQX.js +1 -0
  48. package/chunks/pageHeader.CbDGb6ot.js +1 -0
  49. package/chunks/pageHeader.fsTiHDRc.js +12 -0
  50. package/chunks/pagination.Br7vTt5b.js +1 -0
  51. package/chunks/pagination.DinViL55.js +38 -0
  52. package/chunks/progressBar.84w2qF8R.js +42 -0
  53. package/chunks/progressBar.DcG-X-RY.js +1 -0
  54. package/chunks/spinner.B6R6yphw.js +1 -0
  55. package/chunks/spinner.oNNLX64f.js +105 -0
  56. package/chunks/stepper.ByKqsxhz.js +1 -0
  57. package/chunks/stepper.FT6nDHjL.js +18 -0
  58. package/chunks/switch.Dalf8ccu.js +1 -0
  59. package/chunks/switch.hUukrKTd.js +11 -0
  60. package/chunks/tabs.C7SBQq_R.js +1 -0
  61. package/chunks/tabs.CIfcdjPn.js +13 -0
  62. package/chunks/text.CW-ftgoP.js +1 -0
  63. package/chunks/text.DpbJhMDB.js +152 -0
  64. package/chunks/textArea.CmtmGm_y.js +22 -0
  65. package/chunks/textArea.DF76BVU5.js +1 -0
  66. package/chunks/toast.Bs1t4Urq.js +36 -0
  67. package/chunks/toast.C-h1RUq_.js +1 -0
  68. package/chunks/tooltip.D1fCHa9d.js +16 -0
  69. package/chunks/tooltip.DZTJP5dS.js +1 -0
  70. package/index.cjs.js +1 -0
  71. package/index.d.ts +3 -0
  72. package/index.es.js +164 -0
  73. package/lib/components/SegmentedControl.cjs.js +1 -0
  74. package/lib/components/SegmentedControl.d.ts +2 -0
  75. package/lib/components/SegmentedControl.es.js +5 -0
  76. package/lib/components/accordion.cjs.js +1 -0
  77. package/lib/components/accordion.d.ts +3 -0
  78. package/lib/components/accordion.es.js +6 -0
  79. package/lib/components/actionList.cjs.js +1 -0
  80. package/lib/components/actionList.d.ts +15 -0
  81. package/lib/components/actionList.es.js +13 -0
  82. package/lib/components/alert.cjs.js +1 -0
  83. package/lib/components/alert.d.ts +17 -0
  84. package/lib/components/alert.es.js +11 -0
  85. package/lib/components/aspectRatio.cjs.js +1 -0
  86. package/lib/components/aspectRatio.d.ts +16 -0
  87. package/lib/components/aspectRatio.es.js +14 -0
  88. package/lib/components/avatar.cjs.js +1 -0
  89. package/lib/components/avatar.d.ts +17 -0
  90. package/lib/components/avatar.es.js +23 -0
  91. package/lib/components/badge.cjs.js +1 -0
  92. package/lib/components/badge.d.ts +17 -0
  93. package/lib/components/badge.es.js +15 -0
  94. package/lib/components/badgeDot.cjs.js +1 -0
  95. package/lib/components/badgeDot.d.ts +6 -0
  96. package/lib/components/badgeDot.es.js +7 -0
  97. package/lib/components/box.cjs.js +1 -0
  98. package/lib/components/box.d.ts +82 -0
  99. package/lib/components/box.es.js +8 -0
  100. package/lib/components/button.cjs.js +1 -0
  101. package/lib/components/button.d.ts +36 -0
  102. package/lib/components/button.es.js +16 -0
  103. package/lib/components/card.cjs.js +1 -0
  104. package/lib/components/card.d.ts +22 -0
  105. package/lib/components/card.es.js +7 -0
  106. package/lib/components/chips.cjs.js +1 -0
  107. package/lib/components/chips.d.ts +5 -0
  108. package/lib/components/chips.es.js +7 -0
  109. package/lib/components/closeButton.cjs.js +1 -0
  110. package/lib/components/closeButton.d.ts +2 -0
  111. package/lib/components/closeButton.es.js +5 -0
  112. package/lib/components/dialog.cjs.js +1 -0
  113. package/lib/components/dialog.d.ts +5 -0
  114. package/lib/components/dialog.es.js +7 -0
  115. package/lib/components/divider.cjs.js +1 -0
  116. package/lib/components/divider.d.ts +30 -0
  117. package/lib/components/divider.es.js +9 -0
  118. package/lib/components/fileUpload.cjs.js +1 -0
  119. package/lib/components/fileUpload.d.ts +90 -0
  120. package/lib/components/fileUpload.es.js +22 -0
  121. package/lib/components/floatingui.cjs.js +1 -0
  122. package/lib/components/floatingui.d.ts +71 -0
  123. package/lib/components/floatingui.es.js +608 -0
  124. package/lib/components/form.cjs.js +1 -0
  125. package/lib/components/form.d.ts +69 -0
  126. package/lib/components/form.es.js +9 -0
  127. package/lib/components/helperText.cjs.js +1 -0
  128. package/lib/components/helperText.d.ts +4 -0
  129. package/lib/components/helperText.es.js +6 -0
  130. package/lib/components/icon.cjs.js +1 -0
  131. package/lib/components/icon.d.ts +6 -0
  132. package/lib/components/icon.es.js +7 -0
  133. package/lib/components/index.cjs.js +1 -0
  134. package/lib/components/index.d.ts +34 -0
  135. package/lib/components/index.es.js +70 -0
  136. package/lib/components/inputChoiceGroup.cjs.js +1 -0
  137. package/lib/components/inputChoiceGroup.d.ts +10 -0
  138. package/lib/components/inputChoiceGroup.es.js +5 -0
  139. package/lib/components/link.cjs.js +1 -0
  140. package/lib/components/link.d.ts +4 -0
  141. package/lib/components/link.es.js +6 -0
  142. package/lib/components/list.cjs.js +1 -0
  143. package/lib/components/list.d.ts +14 -0
  144. package/lib/components/list.es.js +10 -0
  145. package/lib/components/logo.cjs.js +1 -0
  146. package/lib/components/logo.d.ts +5 -0
  147. package/lib/components/logo.es.js +6 -0
  148. package/lib/components/nativeSelect.cjs.js +1 -0
  149. package/lib/components/nativeSelect.d.ts +5 -0
  150. package/lib/components/nativeSelect.es.js +7 -0
  151. package/lib/components/pageHeader.cjs.js +1 -0
  152. package/lib/components/pageHeader.d.ts +5 -0
  153. package/lib/components/pageHeader.es.js +5 -0
  154. package/lib/components/pagination.cjs.js +1 -0
  155. package/lib/components/pagination.d.ts +69 -0
  156. package/lib/components/pagination.es.js +13 -0
  157. package/lib/components/progressBar.cjs.js +1 -0
  158. package/lib/components/progressBar.d.ts +14 -0
  159. package/lib/components/progressBar.es.js +11 -0
  160. package/lib/components/spinner.cjs.js +1 -0
  161. package/lib/components/spinner.d.ts +82 -0
  162. package/lib/components/spinner.es.js +19 -0
  163. package/lib/components/stepper.cjs.js +1 -0
  164. package/lib/components/stepper.d.ts +12 -0
  165. package/lib/components/stepper.es.js +5 -0
  166. package/lib/components/switch.cjs.js +1 -0
  167. package/lib/components/switch.d.ts +3 -0
  168. package/lib/components/switch.es.js +6 -0
  169. package/lib/components/tabs.cjs.js +1 -0
  170. package/lib/components/tabs.d.ts +6 -0
  171. package/lib/components/tabs.es.js +7 -0
  172. package/lib/components/text.cjs.js +1 -0
  173. package/lib/components/text.d.ts +15 -0
  174. package/lib/components/text.es.js +13 -0
  175. package/lib/components/textArea.cjs.js +1 -0
  176. package/lib/components/textArea.d.ts +2 -0
  177. package/lib/components/textArea.es.js +4 -0
  178. package/lib/components/toast.cjs.js +1 -0
  179. package/lib/components/toast.d.ts +14 -0
  180. package/lib/components/toast.es.js +9 -0
  181. package/lib/components/tooltip.cjs.js +1 -0
  182. package/lib/components/tooltip.d.ts +2 -0
  183. package/lib/components/tooltip.es.js +5 -0
  184. package/lib/shared.cjs.js +1 -0
  185. package/lib/shared.d.ts +4 -0
  186. package/lib/shared.es.js +6 -0
  187. package/lib/utils/CSSLookup.cjs.js +1 -0
  188. package/lib/utils/CSSLookup.d.ts +84 -0
  189. package/lib/utils/CSSLookup.es.js +110 -0
  190. package/lib/utils/classNames.cjs.js +1 -0
  191. package/lib/utils/classNames.d.ts +9 -0
  192. package/lib/utils/classNames.es.js +18 -0
  193. package/lib/utils/constants.cjs.js +1 -0
  194. package/lib/utils/constants.d.ts +174 -0
  195. package/lib/utils/constants.es.js +151 -0
  196. package/lib/utils/dom.cjs.js +1 -0
  197. package/lib/utils/dom.d.ts +18 -0
  198. package/lib/utils/dom.es.js +34 -0
  199. package/lib/utils/helpers.cjs.js +1 -0
  200. package/lib/utils/helpers.d.ts +66 -0
  201. package/lib/utils/helpers.es.js +154 -0
  202. package/lib/utils/index.cjs.js +1 -0
  203. package/lib/utils/index.d.ts +7 -0
  204. package/lib/utils/index.es.js +94 -0
  205. package/lib/utils/overflow.cjs.js +1 -0
  206. package/lib/utils/overflow.d.ts +34 -0
  207. package/lib/utils/overflow.es.js +34 -0
  208. package/lib/utils/raf.cjs.js +1 -0
  209. package/lib/utils/raf.d.ts +8 -0
  210. package/lib/utils/raf.es.js +14 -0
  211. package/lib/utils/styles.cjs.js +1 -0
  212. package/lib/utils/styles.d.ts +1 -0
  213. package/lib/utils/styles.es.js +5 -0
  214. package/lib/utils/types.cjs.js +1 -0
  215. package/lib/utils/types.d.ts +6 -0
  216. package/lib/utils/types.es.js +1 -0
  217. package/package.json +60 -0
@@ -0,0 +1,608 @@
1
+ const et = ["top", "right", "bottom", "left"], K = ["start", "end"], N = /* @__PURE__ */ et.reduce((t, e) => t.concat(e, e + "-" + K[0], e + "-" + K[1]), []), W = Math.min, lt = Math.max, at = {
2
+ left: "right",
3
+ right: "left",
4
+ bottom: "top",
5
+ top: "bottom"
6
+ }, ft = {
7
+ start: "end",
8
+ end: "start"
9
+ };
10
+ function Y(t, e, s) {
11
+ return lt(t, W(e, s));
12
+ }
13
+ function H(t, e) {
14
+ return typeof t == "function" ? t(e) : t;
15
+ }
16
+ function C(t) {
17
+ return t.split("-")[0];
18
+ }
19
+ function M(t) {
20
+ return t.split("-")[1];
21
+ }
22
+ function q(t) {
23
+ return t === "x" ? "y" : "x";
24
+ }
25
+ function nt(t) {
26
+ return t === "y" ? "height" : "width";
27
+ }
28
+ function V(t) {
29
+ return ["top", "bottom"].includes(C(t)) ? "y" : "x";
30
+ }
31
+ function ot(t) {
32
+ return q(V(t));
33
+ }
34
+ function it(t, e, s) {
35
+ s === void 0 && (s = !1);
36
+ const r = M(t), i = ot(t), n = nt(i);
37
+ let o = i === "x" ? r === (s ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
38
+ return e.reference[n] > e.floating[n] && (o = _(o)), [o, _(o)];
39
+ }
40
+ function ut(t) {
41
+ const e = _(t);
42
+ return [z(t), e, z(e)];
43
+ }
44
+ function z(t) {
45
+ return t.replace(/start|end/g, (e) => ft[e]);
46
+ }
47
+ function dt(t, e, s) {
48
+ const r = ["left", "right"], i = ["right", "left"], n = ["top", "bottom"], o = ["bottom", "top"];
49
+ switch (t) {
50
+ case "top":
51
+ case "bottom":
52
+ return s ? e ? i : r : e ? r : i;
53
+ case "left":
54
+ case "right":
55
+ return e ? n : o;
56
+ default:
57
+ return [];
58
+ }
59
+ }
60
+ function mt(t, e, s, r) {
61
+ const i = M(t);
62
+ let n = dt(C(t), s === "start", r);
63
+ return i && (n = n.map((o) => o + "-" + i), e && (n = n.concat(n.map(z)))), n;
64
+ }
65
+ function _(t) {
66
+ return t.replace(/left|right|bottom|top/g, (e) => at[e]);
67
+ }
68
+ function gt(t) {
69
+ return {
70
+ top: 0,
71
+ right: 0,
72
+ bottom: 0,
73
+ left: 0,
74
+ ...t
75
+ };
76
+ }
77
+ function st(t) {
78
+ return typeof t != "number" ? gt(t) : {
79
+ top: t,
80
+ right: t,
81
+ bottom: t,
82
+ left: t
83
+ };
84
+ }
85
+ function Q(t) {
86
+ const {
87
+ x: e,
88
+ y: s,
89
+ width: r,
90
+ height: i
91
+ } = t;
92
+ return {
93
+ width: r,
94
+ height: i,
95
+ top: s,
96
+ left: e,
97
+ right: e + r,
98
+ bottom: s + i,
99
+ x: e,
100
+ y: s
101
+ };
102
+ }
103
+ async function I(t, e) {
104
+ var s;
105
+ e === void 0 && (e = {});
106
+ const {
107
+ x: r,
108
+ y: i,
109
+ platform: n,
110
+ rects: o,
111
+ elements: c,
112
+ strategy: u
113
+ } = t, {
114
+ boundary: w = "clippingAncestors",
115
+ rootBoundary: p = "viewport",
116
+ elementContext: l = "floating",
117
+ altBoundary: d = !1,
118
+ padding: a = 0
119
+ } = H(e, t), m = st(a), f = c[d ? l === "floating" ? "reference" : "floating" : l], g = Q(await n.getClippingRect({
120
+ element: (s = await (n.isElement == null ? void 0 : n.isElement(f))) == null || s ? f : f.contextElement || await (n.getDocumentElement == null ? void 0 : n.getDocumentElement(c.floating)),
121
+ boundary: w,
122
+ rootBoundary: p,
123
+ strategy: u
124
+ })), h = l === "floating" ? {
125
+ x: r,
126
+ y: i,
127
+ width: o.floating.width,
128
+ height: o.floating.height
129
+ } : o.reference, y = await (n.getOffsetParent == null ? void 0 : n.getOffsetParent(c.floating)), b = await (n.isElement == null ? void 0 : n.isElement(y)) ? await (n.getScale == null ? void 0 : n.getScale(y)) || {
130
+ x: 1,
131
+ y: 1
132
+ } : {
133
+ x: 1,
134
+ y: 1
135
+ }, A = Q(n.convertOffsetParentRelativeRectToViewportRelativeRect ? await n.convertOffsetParentRelativeRectToViewportRelativeRect({
136
+ elements: c,
137
+ rect: h,
138
+ offsetParent: y,
139
+ strategy: u
140
+ }) : h);
141
+ return {
142
+ top: (g.top - A.top + m.top) / b.y,
143
+ bottom: (A.bottom - g.bottom + m.bottom) / b.y,
144
+ left: (g.left - A.left + m.left) / b.x,
145
+ right: (A.right - g.right + m.right) / b.x
146
+ };
147
+ }
148
+ function pt(t, e, s) {
149
+ return (t ? [...s.filter((i) => M(i) === t), ...s.filter((i) => M(i) !== t)] : s.filter((i) => C(i) === i)).filter((i) => t ? M(i) === t || (e ? z(i) !== i : !1) : !0);
150
+ }
151
+ const xt = function(t) {
152
+ return t === void 0 && (t = {}), {
153
+ name: "autoPlacement",
154
+ options: t,
155
+ async fn(e) {
156
+ var s, r, i;
157
+ const {
158
+ rects: n,
159
+ middlewareData: o,
160
+ placement: c,
161
+ platform: u,
162
+ elements: w
163
+ } = e, {
164
+ crossAxis: p = !1,
165
+ alignment: l,
166
+ allowedPlacements: d = N,
167
+ autoAlignment: a = !0,
168
+ ...m
169
+ } = H(t, e), v = l !== void 0 || d === N ? pt(l || null, a, d) : d, f = await I(e, m), g = ((s = o.autoPlacement) == null ? void 0 : s.index) || 0, h = v[g];
170
+ if (h == null)
171
+ return {};
172
+ const y = it(h, n, await (u.isRTL == null ? void 0 : u.isRTL(w.floating)));
173
+ if (c !== h)
174
+ return {
175
+ reset: {
176
+ placement: v[0]
177
+ }
178
+ };
179
+ const b = [f[C(h)], f[y[0]], f[y[1]]], A = [...((r = o.autoPlacement) == null ? void 0 : r.overflows) || [], {
180
+ placement: h,
181
+ overflows: b
182
+ }], B = v[g + 1];
183
+ if (B)
184
+ return {
185
+ data: {
186
+ index: g + 1,
187
+ overflows: A
188
+ },
189
+ reset: {
190
+ placement: B
191
+ }
192
+ };
193
+ const F = A.map((x) => {
194
+ const P = M(x.placement);
195
+ return [x.placement, P && p ? (
196
+ // Check along the mainAxis and main crossAxis side.
197
+ x.overflows.slice(0, 2).reduce((j, T) => j + T, 0)
198
+ ) : (
199
+ // Check only the mainAxis.
200
+ x.overflows[0]
201
+ ), x.overflows];
202
+ }).sort((x, P) => x[1] - P[1]), D = ((i = F.filter((x) => x[2].slice(
203
+ 0,
204
+ // Aligned placements should not check their opposite crossAxis
205
+ // side.
206
+ M(x[0]) ? 2 : 3
207
+ ).every((P) => P <= 0))[0]) == null ? void 0 : i[0]) || F[0][0];
208
+ return D !== c ? {
209
+ data: {
210
+ index: g + 1,
211
+ overflows: A
212
+ },
213
+ reset: {
214
+ placement: D
215
+ }
216
+ } : {};
217
+ }
218
+ };
219
+ }, ht = function(t) {
220
+ return t === void 0 && (t = {}), {
221
+ name: "flip",
222
+ options: t,
223
+ async fn(e) {
224
+ var s, r;
225
+ const {
226
+ placement: i,
227
+ middlewareData: n,
228
+ rects: o,
229
+ initialPlacement: c,
230
+ platform: u,
231
+ elements: w
232
+ } = e, {
233
+ mainAxis: p = !0,
234
+ crossAxis: l = !0,
235
+ fallbackPlacements: d,
236
+ fallbackStrategy: a = "bestFit",
237
+ fallbackAxisSideDirection: m = "none",
238
+ flipAlignment: v = !0,
239
+ ...f
240
+ } = H(t, e);
241
+ if ((s = n.arrow) != null && s.alignmentOffset)
242
+ return {};
243
+ const g = C(i), h = V(c), y = C(c) === c, b = await (u.isRTL == null ? void 0 : u.isRTL(w.floating)), A = d || (y || !v ? [_(c)] : ut(c)), B = m !== "none";
244
+ !d && B && A.push(...mt(c, v, m, b));
245
+ const F = [c, ...A], S = await I(e, f), D = [];
246
+ let x = ((r = n.flip) == null ? void 0 : r.overflows) || [];
247
+ if (p && D.push(S[g]), l) {
248
+ const R = it(i, o, b);
249
+ D.push(S[R[0]], S[R[1]]);
250
+ }
251
+ if (x = [...x, {
252
+ placement: i,
253
+ overflows: D
254
+ }], !D.every((R) => R <= 0)) {
255
+ var P, j;
256
+ const R = (((P = n.flip) == null ? void 0 : P.index) || 0) + 1, E = F[R];
257
+ if (E)
258
+ return {
259
+ data: {
260
+ index: R,
261
+ overflows: x
262
+ },
263
+ reset: {
264
+ placement: E
265
+ }
266
+ };
267
+ let L = (j = x.filter((k) => k.overflows[0] <= 0).sort((k, $) => k.overflows[1] - $.overflows[1])[0]) == null ? void 0 : j.placement;
268
+ if (!L)
269
+ switch (a) {
270
+ case "bestFit": {
271
+ var T;
272
+ const k = (T = x.filter(($) => {
273
+ if (B) {
274
+ const O = V($.placement);
275
+ return O === h || // Create a bias to the `y` side axis due to horizontal
276
+ // reading directions favoring greater width.
277
+ O === "y";
278
+ }
279
+ return !0;
280
+ }).map(($) => [$.placement, $.overflows.filter((O) => O > 0).reduce((O, U) => O + U, 0)]).sort(($, O) => $[1] - O[1])[0]) == null ? void 0 : T[0];
281
+ k && (L = k);
282
+ break;
283
+ }
284
+ case "initialPlacement":
285
+ L = c;
286
+ break;
287
+ }
288
+ if (i !== L)
289
+ return {
290
+ reset: {
291
+ placement: L
292
+ }
293
+ };
294
+ }
295
+ return {};
296
+ }
297
+ };
298
+ };
299
+ function Z(t, e) {
300
+ return {
301
+ top: t.top - e.height,
302
+ right: t.right - e.width,
303
+ bottom: t.bottom - e.height,
304
+ left: t.left - e.width
305
+ };
306
+ }
307
+ function tt(t) {
308
+ return et.some((e) => t[e] >= 0);
309
+ }
310
+ const wt = function(t) {
311
+ return t === void 0 && (t = {}), {
312
+ name: "hide",
313
+ options: t,
314
+ async fn(e) {
315
+ const {
316
+ rects: s
317
+ } = e, {
318
+ strategy: r = "referenceHidden",
319
+ ...i
320
+ } = H(t, e);
321
+ switch (r) {
322
+ case "referenceHidden": {
323
+ const n = await I(e, {
324
+ ...i,
325
+ elementContext: "reference"
326
+ }), o = Z(n, s.reference);
327
+ return {
328
+ data: {
329
+ referenceHiddenOffsets: o,
330
+ referenceHidden: tt(o)
331
+ }
332
+ };
333
+ }
334
+ case "escaped": {
335
+ const n = await I(e, {
336
+ ...i,
337
+ altBoundary: !0
338
+ }), o = Z(n, s.floating);
339
+ return {
340
+ data: {
341
+ escapedOffsets: o,
342
+ escaped: tt(o)
343
+ }
344
+ };
345
+ }
346
+ default:
347
+ return {};
348
+ }
349
+ }
350
+ };
351
+ };
352
+ async function vt(t, e) {
353
+ const {
354
+ placement: s,
355
+ platform: r,
356
+ elements: i
357
+ } = t, n = await (r.isRTL == null ? void 0 : r.isRTL(i.floating)), o = C(s), c = M(s), u = V(s) === "y", w = ["left", "top"].includes(o) ? -1 : 1, p = n && u ? -1 : 1, l = H(e, t);
358
+ let {
359
+ mainAxis: d,
360
+ crossAxis: a,
361
+ alignmentAxis: m
362
+ } = typeof l == "number" ? {
363
+ mainAxis: l,
364
+ crossAxis: 0,
365
+ alignmentAxis: null
366
+ } : {
367
+ mainAxis: l.mainAxis || 0,
368
+ crossAxis: l.crossAxis || 0,
369
+ alignmentAxis: l.alignmentAxis
370
+ };
371
+ return c && typeof m == "number" && (a = c === "end" ? m * -1 : m), u ? {
372
+ x: a * p,
373
+ y: d * w
374
+ } : {
375
+ x: d * w,
376
+ y: a * p
377
+ };
378
+ }
379
+ const yt = function(t) {
380
+ return t === void 0 && (t = 0), {
381
+ name: "offset",
382
+ options: t,
383
+ async fn(e) {
384
+ var s, r;
385
+ const {
386
+ x: i,
387
+ y: n,
388
+ placement: o,
389
+ middlewareData: c
390
+ } = e, u = await vt(e, t);
391
+ return o === ((s = c.offset) == null ? void 0 : s.placement) && (r = c.arrow) != null && r.alignmentOffset ? {} : {
392
+ x: i + u.x,
393
+ y: n + u.y,
394
+ data: {
395
+ ...u,
396
+ placement: o
397
+ }
398
+ };
399
+ }
400
+ };
401
+ }, At = function(t) {
402
+ return t === void 0 && (t = {}), {
403
+ name: "shift",
404
+ options: t,
405
+ async fn(e) {
406
+ const {
407
+ x: s,
408
+ y: r,
409
+ placement: i
410
+ } = e, {
411
+ mainAxis: n = !0,
412
+ crossAxis: o = !1,
413
+ limiter: c = {
414
+ fn: (f) => {
415
+ let {
416
+ x: g,
417
+ y: h
418
+ } = f;
419
+ return {
420
+ x: g,
421
+ y: h
422
+ };
423
+ }
424
+ },
425
+ ...u
426
+ } = H(t, e), w = {
427
+ x: s,
428
+ y: r
429
+ }, p = await I(e, u), l = V(C(i)), d = q(l);
430
+ let a = w[d], m = w[l];
431
+ if (n) {
432
+ const f = d === "y" ? "top" : "left", g = d === "y" ? "bottom" : "right", h = a + p[f], y = a - p[g];
433
+ a = Y(h, a, y);
434
+ }
435
+ if (o) {
436
+ const f = l === "y" ? "top" : "left", g = l === "y" ? "bottom" : "right", h = m + p[f], y = m - p[g];
437
+ m = Y(h, m, y);
438
+ }
439
+ const v = c.fn({
440
+ ...e,
441
+ [d]: a,
442
+ [l]: m
443
+ });
444
+ return {
445
+ ...v,
446
+ data: {
447
+ x: v.x - s,
448
+ y: v.y - r,
449
+ enabled: {
450
+ [d]: n,
451
+ [l]: o
452
+ }
453
+ }
454
+ };
455
+ }
456
+ };
457
+ }, bt = yt, Pt = xt, Ot = At, St = ht, Rt = wt, Dt = (t) => {
458
+ var e;
459
+ return {
460
+ visibility: (e = t.hide) != null && e.referenceHidden ? "hidden" : "visible"
461
+ };
462
+ }, $t = (t) => ({
463
+ name: "arrowStyles",
464
+ options: t,
465
+ async fn(e) {
466
+ var G, J;
467
+ const { x: s, y: r, placement: i, rects: n, platform: o, elements: c, middlewareData: u } = e, { element: w, padding: p = 0 } = H(t, e) || {};
468
+ if (w == null)
469
+ return {};
470
+ const l = st(p), d = { x: s, y: r }, a = ot(i), m = q(a), v = nt(a), f = await o.getDimensions(w), g = a === "y", h = g ? "top" : "left", y = g ? "bottom" : "right", b = g ? "clientHeight" : "clientWidth", A = n.reference[v] + n.reference[a] - d[a] - n.floating[v], B = d[a] - n.reference[a], F = await ((G = o.getOffsetParent) == null ? void 0 : G.call(o, w));
471
+ let S = F ? F[b] : 0;
472
+ (!S || !await ((J = o.isElement) == null ? void 0 : J.call(o, F))) && (S = c.floating[b] || n.floating[v]);
473
+ const D = A / 2 - B / 2, x = S / 2 - f.width / 2 - 1, P = W(l[h], x), j = W(l[y], x), T = P, R = S - f.width - j, E = S / 2 - f.width / 2 + D, L = Y(T, E, R), k = !u.arrow && M(i) != null && E !== L && n.reference[v] / 2 - (E < T ? P : j) - f.width / 2 < 0, $ = k ? E < T ? E - T : E - R : 0, O = C(i), U = ["top", "left"].includes(O) ? -1 : 1, rt = f.height * U, ct = Ct({
474
+ placement: O,
475
+ arrowHeight: f.height,
476
+ arrowWidth: f.width,
477
+ // pass arrow middleware
478
+ [a]: L
479
+ // for posterity, this is what the floating-ui arrow middleware returns
480
+ // centerOffset: center - offset - alignmentOffset,
481
+ // ...(shouldAddOffset && { alignmentOffset }),
482
+ });
483
+ return {
484
+ [a]: d[a] + $,
485
+ [m]: d[m] + rt,
486
+ data: ct,
487
+ reset: k
488
+ };
489
+ }
490
+ }), X = (t, e, s, r) => {
491
+ if (r) {
492
+ const i = r === !0 ? s() : s(r);
493
+ t[e](i);
494
+ }
495
+ }, Tt = ({
496
+ baseConfig: t,
497
+ middleware: e,
498
+ offset: s,
499
+ arrow: r,
500
+ placement: i = "top"
501
+ }) => {
502
+ const n = { ...t, placement: i };
503
+ let o = [];
504
+ if (typeof e.overrides != "object") {
505
+ o.push(bt(s));
506
+ let c = e.flip ?? !0;
507
+ e.autoPlacement && (c = !1), X(
508
+ o,
509
+ "unshift",
510
+ Pt,
511
+ e.autoPlacement
512
+ ), X(o, "push", Ot, e.shift ?? !0), X(o, "unshift", St, c), X(o, "push", Rt, e.hide ?? !0);
513
+ } else
514
+ o.push(...e.overrides);
515
+ return r.hide || o.push($t(r.options)), typeof e.overrides == "function" && (o = e.overrides(o)), n.middleware = o, n;
516
+ }, Ct = ({
517
+ placement: t,
518
+ arrowHeight: e,
519
+ arrowWidth: s,
520
+ x: r,
521
+ y: i
522
+ }) => {
523
+ const n = C(t), o = s / 2 - e, c = {
524
+ /* since the default orientation is pointing down, we don't need to rotate the arrow
525
+ if the tooltip is on top of the reference element
526
+ */
527
+ top: "rotate(0deg)",
528
+ // since the default orientation is pointing down, we don't need to translate the arrow
529
+ bottom: "rotate(180deg)",
530
+ /* For an arrow with non-equal width and height, once we rotate the arrow 90 degrees
531
+ for left and right positions, the top-left corner of the arrow will not be the same
532
+ as the top-left corner of the original downward-pointing arrow. Thus, top:0 for
533
+ example will not place the arrow at the top of the tooltip.
534
+
535
+ To fix this, we need to translate the arrow along the x-axis by the difference between
536
+ the arrow's width and height.
537
+
538
+ * Example: note that the transformation origin is always bottom-center
539
+ *
540
+ * default, downward pointing position rotated 90 degrees, offset from edge
541
+ * |________ => | |\ <- the top is slightly higher!
542
+ * | .. | | *
543
+ * | | |/
544
+
545
+ We use translate X to move it along vertical axis as translations are applied before
546
+ rotation transformations. In both situations, the overall effect is sliding the
547
+ arrow downwards.
548
+ */
549
+ left: `rotate(-90deg) translateX(${-o}px)`,
550
+ right: `rotate(90deg) translateX(${o}px)`
551
+ }[n], u = -s / 2 - e, w = {
552
+ /*
553
+ * If the tooltip is at the top of the anchor, place the arrow at the bottom of
554
+ * the tooltip with bottom: 0. The bottom of the arrow will be flush with the bottom
555
+ * of the tooltip. Result:
556
+ * v (arrow)
557
+ * --- (bottom of tooltip)
558
+ *
559
+ * Then, shift it down by its height so the flat, top side of the arrow is
560
+ * flush with the bottom of the tooltip.
561
+ *
562
+ * --- (bottom of tooltip)
563
+ * v (arrow)
564
+ */
565
+ top: `${-e}px`,
566
+ /*
567
+ * Place the arrow at the top of the tooltip with top: 0. The arrow will be rotated
568
+ * to point downwards by default. When it's then rotated by 180 deg with
569
+ * transform-origin as bottom center, we need to shift the arrow up by its height
570
+ * so it's still flush with the top.
571
+ *
572
+ * Then, we need to shift the arrow up by its height again so its bottom edge is
573
+ * flush with the top of the tooltip.
574
+ *
575
+ * In summary the arrow is shifted up by 2 * arrowHeight, or top: -2 * arrowHeight
576
+ */
577
+ bottom: `${-e * 2}px`,
578
+ /*
579
+ * Place the arrow at the right of the tooltip with right: 0. When we rotate
580
+ * the arrow 90 degrees clockwise about the bottom center, there will now be
581
+ * space between the right edge of the tooltip and the arrow. To fix this, we
582
+ * need to shift the arrow left by the difference between half of the
583
+ * arrow's width and the arrow's height (the two lengths on the horizontal axis)
584
+ *
585
+ * Example: note that the transformation origin is always bottom-center
586
+ *
587
+ * default, downward pointing position rotated 90 degrees, offset from edge
588
+ * | |
589
+ * |-------- => | |\
590
+ * | .. | | *
591
+ * | | |/
592
+ */
593
+ left: `${u}px`,
594
+ // similarly for the right side
595
+ right: `${u}px`
596
+ }[n], p = {
597
+ transform: c
598
+ };
599
+ p.left = r != null ? `${r}px` : "", p.top = i != null ? `${i}px` : "";
600
+ const l = _(n);
601
+ return p[l] = w, p;
602
+ };
603
+ export {
604
+ $t as arrowMiddleware,
605
+ Ct as arrowStyles,
606
+ Tt as buildFloatingUIConfig,
607
+ Dt as visibilityHandler
608
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/form.CIzlawbr.js");exports.getCheckBoxGroupMeta=e.getCheckBoxGroupMeta;exports.getMultiSelectMeta=e.getMultiSelectMeta;exports.isGroupBlurEvent=e.isGroupBlurEvent;exports.validateFormField=e.validateFormField;exports.validationModes=e.validationModes;exports.validators=e.validators;
@@ -0,0 +1,69 @@
1
+ import { Optional } from '../utils/types';
2
+ export type FormValue = string | boolean | number | Array<string | number> | FormData;
3
+ export declare const validationModes: readonly ["onChange", "onBlur", "onSubmit"];
4
+ export type ValidationMode = typeof validationModes[number];
5
+ export type FieldType = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | NodeListOf<HTMLElement>;
6
+ export interface ValidationResult {
7
+ error: boolean;
8
+ message?: string;
9
+ }
10
+ export interface FieldMeta<FT = FieldType> {
11
+ field: FT;
12
+ initializer: () => void;
13
+ validators: Array<FormValidator<FT>>;
14
+ errorSetter: (errors: Array<Optional<string>>) => void;
15
+ }
16
+ export interface FormValidator<FT = FieldType> {
17
+ name: keyof typeof validators;
18
+ validator: (element: FT) => ValidationResult | Promise<ValidationResult>;
19
+ }
20
+ export declare const validateFormField: <FT = FieldType>(field: FT, validators: Array<FormValidator<FT>>) => Promise<Array<Optional<string>>>;
21
+ export declare const isGroupBlurEvent: (event: FocusEvent) => {
22
+ groupBlur: boolean;
23
+ };
24
+ export declare const getCheckBoxGroupMeta: (checkboxGroup: NodeListOf<HTMLInputElement>) => {
25
+ isCheckBoxGroup: boolean;
26
+ selectedBoxes: Array<HTMLInputElement>;
27
+ };
28
+ export declare const getMultiSelectMeta: (element: HTMLSelectElement) => {
29
+ isMultiSelect: boolean;
30
+ selectedOptions: Array<HTMLOptionElement>;
31
+ };
32
+ declare const min: (params: {
33
+ value: number;
34
+ message?: string;
35
+ }) => FormValidator;
36
+ declare const max: (params: {
37
+ value: number;
38
+ message?: string;
39
+ }) => FormValidator;
40
+ declare const email: (params?: {
41
+ message?: string;
42
+ }) => FormValidator;
43
+ declare const pattern: (params: {
44
+ pattern: string | RegExp;
45
+ message?: string;
46
+ }) => FormValidator;
47
+ declare const required: (params?: {
48
+ message?: string;
49
+ }) => FormValidator;
50
+ declare const minLength: (params: {
51
+ length: number;
52
+ message?: string;
53
+ }) => FormValidator;
54
+ declare const maxLength: (params: {
55
+ length: number;
56
+ message?: string;
57
+ }) => FormValidator;
58
+ declare const define: (callback: FormValidator["validator"]) => FormValidator;
59
+ export declare const validators: {
60
+ min: typeof min;
61
+ max: typeof max;
62
+ email: typeof email;
63
+ define: typeof define;
64
+ pattern: typeof pattern;
65
+ required: typeof required;
66
+ minLength: typeof minLength;
67
+ maxLength: typeof maxLength;
68
+ };
69
+ export {};
@@ -0,0 +1,9 @@
1
+ import { g as t, b as o, i as s, a as i, v as l, c as r } from "../../chunks/form.BRWIo59c.js";
2
+ export {
3
+ t as getCheckBoxGroupMeta,
4
+ o as getMultiSelectMeta,
5
+ s as isGroupBlurEvent,
6
+ i as validateFormField,
7
+ l as validationModes,
8
+ r as validators
9
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../utils/constants.cjs.js");const e=require("../../chunks/helperText.C-apoW8Z.js");exports.sizes=e.sizes;exports.states=e.states;
@@ -0,0 +1,4 @@
1
+ export declare const sizes: readonly ["sm", "md"];
2
+ export declare const states: readonly ["info", "warning", "positive", "negative"];
3
+ export type HelperTextSize = typeof sizes[number];
4
+ export type HelperTextAppearance = typeof states[number];
@@ -0,0 +1,6 @@
1
+ import "../utils/constants.es.js";
2
+ import { s as e, a as o } from "../../chunks/helperText.CS5sun4r.js";
3
+ export {
4
+ e as sizes,
5
+ o as states
6
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../utils/constants.cjs.js");const o=require("../../chunks/icon.SiHuIfL8.js");exports.iconColors=o.iconColors;exports.iconSizes=o.iconSizes;exports.roles=o.roles;