dropdowns-js 1.1.7 → 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.
@@ -1,1036 +1,204 @@
1
- import { jsxs as ee, jsx as Y } from "react/jsx-runtime";
2
- import { useId as ce, useState as Q, useMemo as te, useEffect as le } from "react";
3
- function _e(n) {
4
- return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
1
+ import { jsxs as v, jsx as l } from "react/jsx-runtime";
2
+ import { useId as Q, useState as j, useMemo as E, useEffect as W } from "react";
3
+ function G(t) {
4
+ return t === null || typeof t != "object" || Object.prototype.toString.call(t) !== "[object Object]" ? !1 : t.constructor === Object;
5
5
  }
6
- var se = { exports: {} }, ae = { exports: {} }, F = {};
7
- var ve;
8
- function Ie() {
9
- if (ve) return F;
10
- ve = 1;
11
- var n = typeof Symbol == "function" && Symbol.for, T = n ? /* @__PURE__ */ Symbol.for("react.element") : 60103, A = n ? /* @__PURE__ */ Symbol.for("react.portal") : 60106, w = n ? /* @__PURE__ */ Symbol.for("react.fragment") : 60107, O = n ? /* @__PURE__ */ Symbol.for("react.strict_mode") : 60108, p = n ? /* @__PURE__ */ Symbol.for("react.profiler") : 60114, S = n ? /* @__PURE__ */ Symbol.for("react.provider") : 60109, g = n ? /* @__PURE__ */ Symbol.for("react.context") : 60110, E = n ? /* @__PURE__ */ Symbol.for("react.async_mode") : 60111, C = n ? /* @__PURE__ */ Symbol.for("react.concurrent_mode") : 60111, v = n ? /* @__PURE__ */ Symbol.for("react.forward_ref") : 60112, m = n ? /* @__PURE__ */ Symbol.for("react.suspense") : 60113, q = n ? /* @__PURE__ */ Symbol.for("react.suspense_list") : 60120, x = n ? /* @__PURE__ */ Symbol.for("react.memo") : 60115, U = n ? /* @__PURE__ */ Symbol.for("react.lazy") : 60116, _ = n ? /* @__PURE__ */ Symbol.for("react.block") : 60121, D = n ? /* @__PURE__ */ Symbol.for("react.fundamental") : 60117, W = n ? /* @__PURE__ */ Symbol.for("react.responder") : 60118, H = n ? /* @__PURE__ */ Symbol.for("react.scope") : 60119;
12
- function Z(o) {
13
- if (typeof o == "object" && o !== null) {
14
- var K = o.$$typeof;
15
- switch (K) {
16
- case T:
17
- switch (o = o.type, o) {
18
- case E:
19
- case C:
20
- case w:
21
- case p:
22
- case O:
23
- case m:
24
- return o;
25
- default:
26
- switch (o = o && o.$$typeof, o) {
27
- case g:
28
- case v:
29
- case U:
30
- case x:
31
- case S:
32
- return o;
33
- default:
34
- return K;
35
- }
36
- }
37
- case A:
38
- return K;
39
- }
40
- }
41
- }
42
- function M(o) {
43
- return Z(o) === C;
44
- }
45
- return F.AsyncMode = E, F.ConcurrentMode = C, F.ContextConsumer = g, F.ContextProvider = S, F.Element = T, F.ForwardRef = v, F.Fragment = w, F.Lazy = U, F.Memo = x, F.Portal = A, F.Profiler = p, F.StrictMode = O, F.Suspense = m, F.isAsyncMode = function(o) {
46
- return M(o) || Z(o) === E;
47
- }, F.isConcurrentMode = M, F.isContextConsumer = function(o) {
48
- return Z(o) === g;
49
- }, F.isContextProvider = function(o) {
50
- return Z(o) === S;
51
- }, F.isElement = function(o) {
52
- return typeof o == "object" && o !== null && o.$$typeof === T;
53
- }, F.isForwardRef = function(o) {
54
- return Z(o) === v;
55
- }, F.isFragment = function(o) {
56
- return Z(o) === w;
57
- }, F.isLazy = function(o) {
58
- return Z(o) === U;
59
- }, F.isMemo = function(o) {
60
- return Z(o) === x;
61
- }, F.isPortal = function(o) {
62
- return Z(o) === A;
63
- }, F.isProfiler = function(o) {
64
- return Z(o) === p;
65
- }, F.isStrictMode = function(o) {
66
- return Z(o) === O;
67
- }, F.isSuspense = function(o) {
68
- return Z(o) === m;
69
- }, F.isValidElementType = function(o) {
70
- return typeof o == "string" || typeof o == "function" || o === w || o === C || o === p || o === O || o === m || o === q || typeof o == "object" && o !== null && (o.$$typeof === U || o.$$typeof === x || o.$$typeof === S || o.$$typeof === g || o.$$typeof === v || o.$$typeof === D || o.$$typeof === W || o.$$typeof === H || o.$$typeof === _);
71
- }, F.typeOf = Z, F;
72
- }
73
- var V = {};
74
- var be;
75
- function De() {
76
- return be || (be = 1, process.env.NODE_ENV !== "production" && (function() {
77
- var n = typeof Symbol == "function" && Symbol.for, T = n ? /* @__PURE__ */ Symbol.for("react.element") : 60103, A = n ? /* @__PURE__ */ Symbol.for("react.portal") : 60106, w = n ? /* @__PURE__ */ Symbol.for("react.fragment") : 60107, O = n ? /* @__PURE__ */ Symbol.for("react.strict_mode") : 60108, p = n ? /* @__PURE__ */ Symbol.for("react.profiler") : 60114, S = n ? /* @__PURE__ */ Symbol.for("react.provider") : 60109, g = n ? /* @__PURE__ */ Symbol.for("react.context") : 60110, E = n ? /* @__PURE__ */ Symbol.for("react.async_mode") : 60111, C = n ? /* @__PURE__ */ Symbol.for("react.concurrent_mode") : 60111, v = n ? /* @__PURE__ */ Symbol.for("react.forward_ref") : 60112, m = n ? /* @__PURE__ */ Symbol.for("react.suspense") : 60113, q = n ? /* @__PURE__ */ Symbol.for("react.suspense_list") : 60120, x = n ? /* @__PURE__ */ Symbol.for("react.memo") : 60115, U = n ? /* @__PURE__ */ Symbol.for("react.lazy") : 60116, _ = n ? /* @__PURE__ */ Symbol.for("react.block") : 60121, D = n ? /* @__PURE__ */ Symbol.for("react.fundamental") : 60117, W = n ? /* @__PURE__ */ Symbol.for("react.responder") : 60118, H = n ? /* @__PURE__ */ Symbol.for("react.scope") : 60119;
78
- function Z(u) {
79
- return typeof u == "string" || typeof u == "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
80
- u === w || u === C || u === p || u === O || u === m || u === q || typeof u == "object" && u !== null && (u.$$typeof === U || u.$$typeof === x || u.$$typeof === S || u.$$typeof === g || u.$$typeof === v || u.$$typeof === D || u.$$typeof === W || u.$$typeof === H || u.$$typeof === _);
81
- }
82
- function M(u) {
83
- if (typeof u == "object" && u !== null) {
84
- var oe = u.$$typeof;
85
- switch (oe) {
86
- case T:
87
- var ie = u.type;
88
- switch (ie) {
89
- case E:
90
- case C:
91
- case w:
92
- case p:
93
- case O:
94
- case m:
95
- return ie;
96
- default:
97
- var me = ie && ie.$$typeof;
98
- switch (me) {
99
- case g:
100
- case v:
101
- case U:
102
- case x:
103
- case S:
104
- return me;
105
- default:
106
- return oe;
107
- }
108
- }
109
- case A:
110
- return oe;
111
- }
112
- }
113
- }
114
- var o = E, K = C, G = g, X = S, r = T, i = v, d = w, t = U, a = x, h = A, f = p, j = O, l = m, y = !1;
115
- function P(u) {
116
- return y || (y = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), e(u) || M(u) === E;
117
- }
118
- function e(u) {
119
- return M(u) === C;
120
- }
121
- function s(u) {
122
- return M(u) === g;
123
- }
124
- function b(u) {
125
- return M(u) === S;
126
- }
127
- function $(u) {
128
- return typeof u == "object" && u !== null && u.$$typeof === T;
129
- }
130
- function R(u) {
131
- return M(u) === v;
132
- }
133
- function z(u) {
134
- return M(u) === w;
135
- }
136
- function I(u) {
137
- return M(u) === U;
138
- }
139
- function k(u) {
140
- return M(u) === x;
141
- }
142
- function L(u) {
143
- return M(u) === A;
144
- }
145
- function J(u) {
146
- return M(u) === p;
147
- }
148
- function N(u) {
149
- return M(u) === O;
150
- }
151
- function re(u) {
152
- return M(u) === m;
153
- }
154
- V.AsyncMode = o, V.ConcurrentMode = K, V.ContextConsumer = G, V.ContextProvider = X, V.Element = r, V.ForwardRef = i, V.Fragment = d, V.Lazy = t, V.Memo = a, V.Portal = h, V.Profiler = f, V.StrictMode = j, V.Suspense = l, V.isAsyncMode = P, V.isConcurrentMode = e, V.isContextConsumer = s, V.isContextProvider = b, V.isElement = $, V.isForwardRef = R, V.isFragment = z, V.isLazy = I, V.isMemo = k, V.isPortal = L, V.isProfiler = J, V.isStrictMode = N, V.isSuspense = re, V.isValidElementType = Z, V.typeOf = M;
155
- })()), V;
156
- }
157
- var we;
158
- function Re() {
159
- return we || (we = 1, process.env.NODE_ENV === "production" ? ae.exports = Ie() : ae.exports = De()), ae.exports;
160
- }
161
- var ue, Se;
162
- function ke() {
163
- if (Se) return ue;
164
- Se = 1;
165
- var n = Object.getOwnPropertySymbols, T = Object.prototype.hasOwnProperty, A = Object.prototype.propertyIsEnumerable;
166
- function w(p) {
167
- if (p == null)
168
- throw new TypeError("Object.assign cannot be called with null or undefined");
169
- return Object(p);
170
- }
171
- function O() {
172
- try {
173
- if (!Object.assign)
174
- return !1;
175
- var p = new String("abc");
176
- if (p[5] = "de", Object.getOwnPropertyNames(p)[0] === "5")
177
- return !1;
178
- for (var S = {}, g = 0; g < 10; g++)
179
- S["_" + String.fromCharCode(g)] = g;
180
- var E = Object.getOwnPropertyNames(S).map(function(v) {
181
- return S[v];
182
- });
183
- if (E.join("") !== "0123456789")
184
- return !1;
185
- var C = {};
186
- return "abcdefghijklmnopqrst".split("").forEach(function(v) {
187
- C[v] = v;
188
- }), Object.keys(Object.assign({}, C)).join("") === "abcdefghijklmnopqrst";
189
- } catch {
190
- return !1;
191
- }
192
- }
193
- return ue = O() ? Object.assign : function(p, S) {
194
- for (var g, E = w(p), C, v = 1; v < arguments.length; v++) {
195
- g = Object(arguments[v]);
196
- for (var m in g)
197
- T.call(g, m) && (E[m] = g[m]);
198
- if (n) {
199
- C = n(g);
200
- for (var q = 0; q < C.length; q++)
201
- A.call(g, C[q]) && (E[C[q]] = g[C[q]]);
202
- }
203
- }
204
- return E;
205
- }, ue;
206
- }
207
- var de, Ce;
208
- function ge() {
209
- if (Ce) return de;
210
- Ce = 1;
211
- var n = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
212
- return de = n, de;
213
- }
214
- var fe, Te;
215
- function Pe() {
216
- return Te || (Te = 1, fe = Function.call.bind(Object.prototype.hasOwnProperty)), fe;
217
- }
218
- var pe, Ee;
219
- function qe() {
220
- if (Ee) return pe;
221
- Ee = 1;
222
- var n = function() {
223
- };
224
- if (process.env.NODE_ENV !== "production") {
225
- var T = /* @__PURE__ */ ge(), A = {}, w = /* @__PURE__ */ Pe();
226
- n = function(p) {
227
- var S = "Warning: " + p;
228
- typeof console < "u" && console.error(S);
229
- try {
230
- throw new Error(S);
231
- } catch {
6
+ function X(t) {
7
+ if (!G(t))
8
+ return [];
9
+ const r = [{ value: t }];
10
+ let u = 0;
11
+ for (; u < r.length; ) {
12
+ const d = r[u];
13
+ if (G(d.value)) {
14
+ for (const c in d.value) {
15
+ let s = d.path ? d.path + "." + c : c;
16
+ r.push(
17
+ { value: d.value[c], path: s }
18
+ );
232
19
  }
233
- };
234
- }
235
- function O(p, S, g, E, C) {
236
- if (process.env.NODE_ENV !== "production") {
237
- for (var v in p)
238
- if (w(p, v)) {
239
- var m;
240
- try {
241
- if (typeof p[v] != "function") {
242
- var q = Error(
243
- (E || "React class") + ": " + g + " type `" + v + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof p[v] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
244
- );
245
- throw q.name = "Invariant Violation", q;
246
- }
247
- m = p[v](S, v, E, g, null, T);
248
- } catch (U) {
249
- m = U;
250
- }
251
- if (m && !(m instanceof Error) && n(
252
- (E || "React class") + ": type specification of " + g + " `" + v + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof m + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
253
- ), m instanceof Error && !(m.message in A)) {
254
- A[m.message] = !0;
255
- var x = C ? C() : "";
256
- n(
257
- "Failed " + g + " type: " + m.message + (x ?? "")
258
- );
259
- }
260
- }
261
- }
262
- }
263
- return O.resetWarningCache = function() {
264
- process.env.NODE_ENV !== "production" && (A = {});
265
- }, pe = O, pe;
266
- }
267
- var he, je;
268
- function Me() {
269
- if (je) return he;
270
- je = 1;
271
- var n = Re(), T = ke(), A = /* @__PURE__ */ ge(), w = /* @__PURE__ */ Pe(), O = /* @__PURE__ */ qe(), p = function() {
272
- };
273
- process.env.NODE_ENV !== "production" && (p = function(g) {
274
- var E = "Warning: " + g;
275
- typeof console < "u" && console.error(E);
276
- try {
277
- throw new Error(E);
278
- } catch {
20
+ d.remove = !0;
279
21
  }
280
- });
281
- function S() {
282
- return null;
22
+ u++;
283
23
  }
284
- return he = function(g, E) {
285
- var C = typeof Symbol == "function" && Symbol.iterator, v = "@@iterator";
286
- function m(e) {
287
- var s = e && (C && e[C] || e[v]);
288
- if (typeof s == "function")
289
- return s;
290
- }
291
- var q = "<<anonymous>>", x = {
292
- array: W("array"),
293
- bigint: W("bigint"),
294
- bool: W("boolean"),
295
- func: W("function"),
296
- number: W("number"),
297
- object: W("object"),
298
- string: W("string"),
299
- symbol: W("symbol"),
300
- any: H(),
301
- arrayOf: Z,
302
- element: M(),
303
- elementType: o(),
304
- instanceOf: K,
305
- node: i(),
306
- objectOf: X,
307
- oneOf: G,
308
- oneOfType: r,
309
- shape: t,
310
- exact: a
311
- };
312
- function U(e, s) {
313
- return e === s ? e !== 0 || 1 / e === 1 / s : e !== e && s !== s;
314
- }
315
- function _(e, s) {
316
- this.message = e, this.data = s && typeof s == "object" ? s : {}, this.stack = "";
317
- }
318
- _.prototype = Error.prototype;
319
- function D(e) {
320
- if (process.env.NODE_ENV !== "production")
321
- var s = {}, b = 0;
322
- function $(z, I, k, L, J, N, re) {
323
- if (L = L || q, N = N || k, re !== A) {
324
- if (E) {
325
- var u = new Error(
326
- "Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
327
- );
328
- throw u.name = "Invariant Violation", u;
329
- } else if (process.env.NODE_ENV !== "production" && typeof console < "u") {
330
- var oe = L + ":" + k;
331
- !s[oe] && // Avoid spamming the console because they are often not actionable except for lib authors
332
- b < 3 && (p(
333
- "You are manually calling a React.PropTypes validation function for the `" + N + "` prop on `" + L + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
334
- ), s[oe] = !0, b++);
335
- }
336
- }
337
- return I[k] == null ? z ? I[k] === null ? new _("The " + J + " `" + N + "` is marked as required " + ("in `" + L + "`, but its value is `null`.")) : new _("The " + J + " `" + N + "` is marked as required in " + ("`" + L + "`, but its value is `undefined`.")) : null : e(I, k, L, J, N);
338
- }
339
- var R = $.bind(null, !1);
340
- return R.isRequired = $.bind(null, !0), R;
341
- }
342
- function W(e) {
343
- function s(b, $, R, z, I, k) {
344
- var L = b[$], J = j(L);
345
- if (J !== e) {
346
- var N = l(L);
347
- return new _(
348
- "Invalid " + z + " `" + I + "` of type " + ("`" + N + "` supplied to `" + R + "`, expected ") + ("`" + e + "`."),
349
- { expectedType: e }
350
- );
351
- }
352
- return null;
353
- }
354
- return D(s);
355
- }
356
- function H() {
357
- return D(S);
358
- }
359
- function Z(e) {
360
- function s(b, $, R, z, I) {
361
- if (typeof e != "function")
362
- return new _("Property `" + I + "` of component `" + R + "` has invalid PropType notation inside arrayOf.");
363
- var k = b[$];
364
- if (!Array.isArray(k)) {
365
- var L = j(k);
366
- return new _("Invalid " + z + " `" + I + "` of type " + ("`" + L + "` supplied to `" + R + "`, expected an array."));
367
- }
368
- for (var J = 0; J < k.length; J++) {
369
- var N = e(k, J, R, z, I + "[" + J + "]", A);
370
- if (N instanceof Error)
371
- return N;
372
- }
373
- return null;
374
- }
375
- return D(s);
376
- }
377
- function M() {
378
- function e(s, b, $, R, z) {
379
- var I = s[b];
380
- if (!g(I)) {
381
- var k = j(I);
382
- return new _("Invalid " + R + " `" + z + "` of type " + ("`" + k + "` supplied to `" + $ + "`, expected a single ReactElement."));
383
- }
384
- return null;
385
- }
386
- return D(e);
387
- }
388
- function o() {
389
- function e(s, b, $, R, z) {
390
- var I = s[b];
391
- if (!n.isValidElementType(I)) {
392
- var k = j(I);
393
- return new _("Invalid " + R + " `" + z + "` of type " + ("`" + k + "` supplied to `" + $ + "`, expected a single ReactElement type."));
394
- }
395
- return null;
396
- }
397
- return D(e);
398
- }
399
- function K(e) {
400
- function s(b, $, R, z, I) {
401
- if (!(b[$] instanceof e)) {
402
- var k = e.name || q, L = P(b[$]);
403
- return new _("Invalid " + z + " `" + I + "` of type " + ("`" + L + "` supplied to `" + R + "`, expected ") + ("instance of `" + k + "`."));
404
- }
405
- return null;
406
- }
407
- return D(s);
408
- }
409
- function G(e) {
410
- if (!Array.isArray(e))
411
- return process.env.NODE_ENV !== "production" && (arguments.length > 1 ? p(
412
- "Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
413
- ) : p("Invalid argument supplied to oneOf, expected an array.")), S;
414
- function s(b, $, R, z, I) {
415
- for (var k = b[$], L = 0; L < e.length; L++)
416
- if (U(k, e[L]))
417
- return null;
418
- var J = JSON.stringify(e, function(re, u) {
419
- var oe = l(u);
420
- return oe === "symbol" ? String(u) : u;
421
- });
422
- return new _("Invalid " + z + " `" + I + "` of value `" + String(k) + "` " + ("supplied to `" + R + "`, expected one of " + J + "."));
423
- }
424
- return D(s);
425
- }
426
- function X(e) {
427
- function s(b, $, R, z, I) {
428
- if (typeof e != "function")
429
- return new _("Property `" + I + "` of component `" + R + "` has invalid PropType notation inside objectOf.");
430
- var k = b[$], L = j(k);
431
- if (L !== "object")
432
- return new _("Invalid " + z + " `" + I + "` of type " + ("`" + L + "` supplied to `" + R + "`, expected an object."));
433
- for (var J in k)
434
- if (w(k, J)) {
435
- var N = e(k, J, R, z, I + "." + J, A);
436
- if (N instanceof Error)
437
- return N;
438
- }
439
- return null;
440
- }
441
- return D(s);
442
- }
443
- function r(e) {
444
- if (!Array.isArray(e))
445
- return process.env.NODE_ENV !== "production" && p("Invalid argument supplied to oneOfType, expected an instance of array."), S;
446
- for (var s = 0; s < e.length; s++) {
447
- var b = e[s];
448
- if (typeof b != "function")
449
- return p(
450
- "Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + y(b) + " at index " + s + "."
451
- ), S;
452
- }
453
- function $(R, z, I, k, L) {
454
- for (var J = [], N = 0; N < e.length; N++) {
455
- var re = e[N], u = re(R, z, I, k, L, A);
456
- if (u == null)
457
- return null;
458
- u.data && w(u.data, "expectedType") && J.push(u.data.expectedType);
459
- }
460
- var oe = J.length > 0 ? ", expected one of type [" + J.join(", ") + "]" : "";
461
- return new _("Invalid " + k + " `" + L + "` supplied to " + ("`" + I + "`" + oe + "."));
462
- }
463
- return D($);
464
- }
465
- function i() {
466
- function e(s, b, $, R, z) {
467
- return h(s[b]) ? null : new _("Invalid " + R + " `" + z + "` supplied to " + ("`" + $ + "`, expected a ReactNode."));
468
- }
469
- return D(e);
470
- }
471
- function d(e, s, b, $, R) {
472
- return new _(
473
- (e || "React class") + ": " + s + " type `" + b + "." + $ + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + R + "`."
474
- );
475
- }
476
- function t(e) {
477
- function s(b, $, R, z, I) {
478
- var k = b[$], L = j(k);
479
- if (L !== "object")
480
- return new _("Invalid " + z + " `" + I + "` of type `" + L + "` " + ("supplied to `" + R + "`, expected `object`."));
481
- for (var J in e) {
482
- var N = e[J];
483
- if (typeof N != "function")
484
- return d(R, z, I, J, l(N));
485
- var re = N(k, J, R, z, I + "." + J, A);
486
- if (re)
487
- return re;
488
- }
489
- return null;
490
- }
491
- return D(s);
492
- }
493
- function a(e) {
494
- function s(b, $, R, z, I) {
495
- var k = b[$], L = j(k);
496
- if (L !== "object")
497
- return new _("Invalid " + z + " `" + I + "` of type `" + L + "` " + ("supplied to `" + R + "`, expected `object`."));
498
- var J = T({}, b[$], e);
499
- for (var N in J) {
500
- var re = e[N];
501
- if (w(e, N) && typeof re != "function")
502
- return d(R, z, I, N, l(re));
503
- if (!re)
504
- return new _(
505
- "Invalid " + z + " `" + I + "` key `" + N + "` supplied to `" + R + "`.\nBad object: " + JSON.stringify(b[$], null, " ") + `
506
- Valid keys: ` + JSON.stringify(Object.keys(e), null, " ")
507
- );
508
- var u = re(k, N, R, z, I + "." + N, A);
509
- if (u)
510
- return u;
511
- }
512
- return null;
513
- }
514
- return D(s);
515
- }
516
- function h(e) {
517
- switch (typeof e) {
518
- case "number":
519
- case "string":
520
- case "undefined":
521
- return !0;
522
- case "boolean":
523
- return !e;
524
- case "object":
525
- if (Array.isArray(e))
526
- return e.every(h);
527
- if (e === null || g(e))
528
- return !0;
529
- var s = m(e);
530
- if (s) {
531
- var b = s.call(e), $;
532
- if (s !== e.entries) {
533
- for (; !($ = b.next()).done; )
534
- if (!h($.value))
535
- return !1;
536
- } else
537
- for (; !($ = b.next()).done; ) {
538
- var R = $.value;
539
- if (R && !h(R[1]))
540
- return !1;
541
- }
542
- } else
543
- return !1;
544
- return !0;
545
- default:
546
- return !1;
547
- }
548
- }
549
- function f(e, s) {
550
- return e === "symbol" ? !0 : s ? s["@@toStringTag"] === "Symbol" || typeof Symbol == "function" && s instanceof Symbol : !1;
551
- }
552
- function j(e) {
553
- var s = typeof e;
554
- return Array.isArray(e) ? "array" : e instanceof RegExp ? "object" : f(s, e) ? "symbol" : s;
555
- }
556
- function l(e) {
557
- if (typeof e > "u" || e === null)
558
- return "" + e;
559
- var s = j(e);
560
- if (s === "object") {
561
- if (e instanceof Date)
562
- return "date";
563
- if (e instanceof RegExp)
564
- return "regexp";
565
- }
566
- return s;
567
- }
568
- function y(e) {
569
- var s = l(e);
570
- switch (s) {
571
- case "array":
572
- case "object":
573
- return "an " + s;
574
- case "boolean":
575
- case "date":
576
- case "regexp":
577
- return "a " + s;
578
- default:
579
- return s;
580
- }
581
- }
582
- function P(e) {
583
- return !e.constructor || !e.constructor.name ? q : e.constructor.name;
584
- }
585
- return x.checkPropTypes = O, x.resetWarningCache = O.resetWarningCache, x.PropTypes = x, x;
586
- }, he;
24
+ return r.filter((d) => !d.remove).map((d) => d.path);
587
25
  }
588
- var ye, xe;
589
- function Ae() {
590
- if (xe) return ye;
591
- xe = 1;
592
- var n = /* @__PURE__ */ ge();
593
- function T() {
594
- }
595
- function A() {
596
- }
597
- return A.resetWarningCache = T, ye = function() {
598
- function w(S, g, E, C, v, m) {
599
- if (m !== n) {
600
- var q = new Error(
601
- "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
602
- );
603
- throw q.name = "Invariant Violation", q;
604
- }
605
- }
606
- w.isRequired = w;
607
- function O() {
608
- return w;
609
- }
610
- var p = {
611
- array: w,
612
- bigint: w,
613
- bool: w,
614
- func: w,
615
- number: w,
616
- object: w,
617
- string: w,
618
- symbol: w,
619
- any: w,
620
- arrayOf: O,
621
- element: w,
622
- elementType: w,
623
- instanceOf: O,
624
- node: w,
625
- objectOf: O,
626
- oneOf: O,
627
- oneOfType: O,
628
- shape: O,
629
- exact: O,
630
- checkPropTypes: A,
631
- resetWarningCache: T
632
- };
633
- return p.PropTypes = p, p;
634
- }, ye;
26
+ function J(t, r, u = void 0) {
27
+ if (!G(t))
28
+ return;
29
+ let d = r.split("."), c = t;
30
+ for (let s = 0; s < d.length; s++) {
31
+ let a = d[s];
32
+ if (!(a in c) || (c = c[a], c === void 0))
33
+ return u;
34
+ }
35
+ return d.length === 0 ? u : c;
635
36
  }
636
- var Oe;
637
- function ze() {
638
- if (Oe) return se.exports;
639
- if (Oe = 1, process.env.NODE_ENV !== "production") {
640
- var n = Re(), T = !0;
641
- se.exports = /* @__PURE__ */ Me()(n.isElement, T);
642
- } else
643
- se.exports = /* @__PURE__ */ Ae()();
644
- return se.exports;
37
+ function Y(t, r, u = "asc") {
38
+ if (!["asc", "desc"].includes(u))
39
+ throw new Error(`sortDir must be one of ${u}`);
40
+ const d = u === "desc" ? -1 : 1;
41
+ return t > r ? d : t < r ? -d : 0;
645
42
  }
646
- var Le = /* @__PURE__ */ ze();
647
- const c = /* @__PURE__ */ _e(Le);
648
- var B = {}, $e;
649
- function Ne() {
650
- if ($e) return B;
651
- $e = 1;
652
- function n(r) {
653
- return r ? /^[a-zA-Z][a-zA-Z0-9_-]{2,50}$/.test(r) : !1;
654
- }
655
- B.isValidUserName = n;
656
- function T(r) {
657
- return r ? /^[A-Za-z' -]{2,50}$/.test(r) : !1;
658
- }
659
- B.isValidName = T;
660
- function A(r) {
661
- return r ? /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(r) : !1;
662
- }
663
- B.isValidEmail = A;
664
- function w(r) {
665
- return r ? /^[0-9]{10,15}$/g.test(r) : !1;
666
- }
667
- B.isValidPhoneNum = w;
668
- function O(r) {
669
- return r ? /^[a-zA-Z0-9.\-\(\) ]{2,}$/.test(r) : !1;
670
- }
671
- B.isValidOrganisationName = O;
672
- function p(r) {
673
- return !(!r || r.length < 6 || /[A-Z]/.test(r) === !1 || /[a-z]/.test(r) === !1 || /[0-9]/.test(r) === !1 || /[\s]/.test(r) || /[\][!"#$%&'()*+,./:;<=>?@^\\_`{|}~-]/.test(r) === !1);
674
- }
675
- B.isValidPassword = p;
676
- function S(r) {
677
- let i = r.getFullYear(), d = r.getMonth() + 1;
678
- d = E(d, 2);
679
- let t = r.getDate();
680
- return t = E(t, 2), `${i}-${d}-${t}`;
681
- }
682
- B.timeStampYyyyMmDd = S;
683
- function g(r) {
684
- let i = E(r.getHours(), 2), d = E(r.getMinutes(), 2), t = E(r.getSeconds(), 2), a = E(r.getMilliseconds(), 3);
685
- return `${S(r)}T${i}:${d}:${t}.${a}`;
686
- }
687
- B.timeStampString = g;
688
- function E(r, i) {
689
- let d = r + "";
690
- const t = i - d.length;
691
- for (let a = 1; a <= t; a++)
692
- d = "0" + d;
693
- return d;
694
- }
695
- B.addLeadingZeros = E;
696
- function C(r) {
697
- return new Intl.NumberFormat("en-US", { style: "currency", currency: "ZAR" }).format(r).replace(/ZAR/gi, "R");
698
- }
699
- B.toZarCurrencyFormat = C;
700
- function v(r) {
701
- if (Object.prototype.toString.call(r) !== "[object Object]") return r instanceof Date ? new Date(r) : (["string", "number", "boolean"].includes(typeof r), r);
702
- const i = [{ ...r }];
703
- let d = 0;
704
- for (; d < i.length; ) {
705
- let t = i[d];
706
- if (Object.prototype.toString.call(t) === "[object Object]")
707
- for (let a in t)
708
- t[a] instanceof Date ? t[a] = new Date(t[a]) : Object.prototype.toString.call(t[a]) === "[object Object]" && (t[a] = { ...t[a] }), i.push(t[a]);
709
- d++;
710
- }
711
- return i[0];
712
- }
713
- B.deepClone = v;
714
- function m(r) {
715
- const i = [{ value: r }];
716
- let d = 0;
717
- for (; d < i.length; ) {
718
- const t = i[d];
719
- if (Object.prototype.toString.call(t.value) === "[object Object]") {
720
- for (const a in t.value) {
721
- let h = t.path ? t.path + "." + a : a;
722
- i.push(
723
- { value: t.value[a], path: h }
724
- );
725
- }
726
- t.remove = !0;
727
- }
728
- d++;
729
- }
730
- return i.filter((t) => !t.remove).map((t) => t.path);
731
- }
732
- B.getPaths = m;
733
- function q(r) {
734
- let i = v(r), d = 0;
735
- const t = m(i).toSorted();
736
- sortedObj = {};
737
- for (d in t) {
738
- const a = t[d], h = x(i, a);
739
- U(sortedObj, a, h);
740
- }
741
- return sortedObj;
742
- }
743
- B.getSortedObject = q;
744
- function x(r, i, d = void 0) {
745
- let t = i.split("."), a = r;
746
- for (let h in t) {
747
- let f = t[h];
748
- if (a[f] === void 0 || (a = a[f], a === void 0))
749
- return d;
750
- }
751
- return a;
752
- }
753
- B.get = x;
754
- function U(r, i, d) {
755
- let t = r, a = i.split(".");
756
- for (let h in a) {
757
- let f = a[h];
758
- h < a.length - 1 ? (f in t || (t[f] = {}), t = t[f]) : t[f] = d;
759
- }
760
- }
761
- B.set = U;
762
- function _(r, i) {
763
- let d = i.split("."), t = r;
764
- for (let a in d) {
765
- let h = d[a];
766
- if (Object.prototype.toString.call(t) !== "[object Object]" || t[h] === void 0)
767
- return;
768
- a < d.length - 1 ? t = t[h] : delete t[h];
769
- }
770
- }
771
- B.unset = _;
772
- function D(r, ...i) {
773
- if (!i || !i.length)
774
- throw new Error("fields must be specified");
775
- const d = m(r);
776
- let t = 0;
777
- for (const a in d) {
778
- const h = d[a];
779
- if (i.includes(h))
780
- t++;
781
- else
782
- return !1;
783
- }
784
- return t > 0;
785
- }
786
- B.hasOnly = D;
787
- function W(r, ...i) {
788
- if (!i || !i.length)
789
- throw new Error("fields must be specified");
790
- const d = m(r);
791
- let t = 0;
792
- for (const a in i) {
793
- const h = i[a];
794
- if (d.includes(h))
795
- t++;
796
- else
797
- return !1;
798
- }
799
- return t === i.length;
800
- }
801
- B.hasAll = W;
802
- function H(r, ...i) {
803
- return D(r, ...i) && W(r, ...i);
804
- }
805
- B.hasOnlyAll = H;
806
- function Z(r, i, d = 0, t = "asc") {
807
- const a = ["asc", "desc"];
808
- if (!["asc", "desc"].includes(t))
809
- throw new Error(`arraySortDir must be one of ${a}`);
810
- if (r.length === 0)
811
- return -1;
812
- let h = d, f = r.length - 1;
813
- for (; h < f; ) {
814
- if (M(r[h], i) === 0)
815
- return h;
816
- if (M(r[f], i) === 0)
817
- return f;
818
- const j = Math.trunc((h + f) / 2), l = M(r[j], i, t);
819
- if (l < 0)
820
- h = j + 1;
821
- else if (l > 0)
822
- f = j - 1;
823
- else
824
- return j;
825
- }
826
- return h;
827
- }
828
- B.binarySearch = Z;
829
- function M(r, i, d = "asc") {
830
- if (!["asc", "desc"].includes(d))
831
- throw new Error(`sortDir must be one of ${d}`);
832
- const t = d === "desc" ? -1 : 1;
833
- return r > i ? t : r < i ? -t : 0;
834
- }
835
- B.compare = M;
836
- function o(r, i, d = 0, ...t) {
837
- if (r.length === 0)
838
- return -1;
839
- let a = d, h = r.length - 1;
840
- for (; a < h; ) {
841
- if (X(r[a], i, ...t) === 0)
842
- return a;
843
- if (X(r[h], i, ...t) === 0)
844
- return h;
845
- let f = Math.trunc((a + h) / 2);
846
- if (X(r[f], i, ...t) < 0)
847
- a = f + 1;
848
- else if (X(r[f], i, ...t) > 0)
849
- h = f - 1;
850
- else
851
- return f;
852
- }
853
- return a;
854
- }
855
- B.binarySearchObj = o;
856
- function K(r, i, d, ...t) {
857
- let a = d, h = r.length - 1;
858
- if (a >= r.length)
859
- throw new Error("startFrom is outside the bounds of the array.");
860
- if (X(i, r[a], ...t) > 0)
861
- throw new Error("targetObj is to the right ('greater than') objArray[startFrom].");
862
- for (; a < h; ) {
863
- let f = Math.trunc((a + h) / 2);
864
- X(i, r[f], ...t) === 0 ? a = f + 1 : X(i, r[f], ...t) < 0 && (h = f);
865
- }
866
- return X(i, r[a], ...t) === 0 ? -1 : a;
867
- }
868
- B.getNextDifferent = K;
869
- function G(r, i, ...d) {
870
- if (r.length <= 1)
871
- return [...r];
872
- if (typeof i != "boolean")
873
- throw new Error("firstOfDuplicates must be boolean true or false.");
874
- const t = [];
875
- let a = 0;
876
- for (; a < r.length - 1 && (i && t.push(r[a]), a = K(r, r[a], a + 1, ...d), !(a < 0)); ) {
877
- let h = a - 1;
878
- i || t.push(r[h]);
879
- }
880
- return t.length === 0 ? i ? t.push(r[0]) : t.push(r[r.length - 1]) : X(t[t.length - 1], r[r.length - 1], ...d) !== 0 && t.push(r[r.length - 1]), t;
881
- }
882
- B.getObjArrayWithNoDuplicates = G;
883
- function X(r, i, ...d) {
884
- if (d.length === 0)
885
- throw new Error("comparisonFields not supplied!");
886
- const t = ["", "asc", "desc"];
887
- for (const a in d) {
888
- const h = d[a].split(" "), f = h[0];
889
- let j = "";
890
- if (h.length === 2 && (j = h[1]), !t.includes(j))
891
- throw new Error("Sort direction must be one of " + t.toString());
892
- const l = x(r, f), y = x(i, f), P = j === "desc" ? -1 : 1;
893
- if (l > y)
894
- return P;
895
- if (l < y)
896
- return -P;
897
- }
898
- return 0;
899
- }
900
- return B.objCompare = X, B;
43
+ function M(t, r, ...u) {
44
+ if (!u || !u.length)
45
+ throw new Error("comparisonFields not supplied!");
46
+ if (!G(t) || !G(r))
47
+ throw new Error("Both obj1 and obj2 must be plain objects.");
48
+ const d = ["", "asc", "desc"];
49
+ for (let c = 0; c < u.length; c++) {
50
+ const s = u[c].split(" "), a = s[0];
51
+ let h = "";
52
+ if (s.length > 2)
53
+ throw new Error("Each comparison field must be of the form 'fieldName sortDirection' or 'fieldName'.");
54
+ if (s.length === 2 && (h = s[1]), !d.includes(h))
55
+ throw new Error("Sort direction must be one of " + d.toString());
56
+ const C = J(t, a), m = J(r, a), w = ["string", "number", "bigint", "boolean"];
57
+ if (!(w.includes(typeof C) || w.includes(typeof m) || C instanceof Date || m instanceof Date))
58
+ throw new Error("Comparison values must be primitive type or Date instance");
59
+ if (typeof C != typeof m)
60
+ throw new Error("Comparison values must be of the same type");
61
+ const b = h === "desc" ? -1 : 1;
62
+ if (C > m)
63
+ return b;
64
+ if (C < m)
65
+ return -b;
66
+ }
67
+ return 0;
901
68
  }
902
- var ne = Ne();
903
- function Ye({
904
- label: n,
69
+ function R({
70
+ label: t,
905
71
  // label with which to describe the dropdown.
906
- data: T,
72
+ data: r,
907
73
  // Primitive type array.
908
- sortOrder: A = "asc",
909
- onItemSelected: w = null,
74
+ sortOrder: u = "asc",
75
+ onItemSelected: d,
910
76
  // Function to pass on the value of the selected item to the parent component
911
- selected: O = null,
77
+ selected: c,
912
78
  // Initial selected item.
913
- selReset: p = !1,
914
- dropdownStyle: S,
79
+ selReset: s = !1,
80
+ // If true, selected item via parent component.
81
+ dropdownStyle: a,
915
82
  // Styling object with fields {color, backgroundColor, borderColor (optional), fontSize}.
916
- isDisabled: g = !1
83
+ isDisabled: h = !1
917
84
  }) {
918
- const E = ce(), [C, v] = Q(!1), [m, q] = Q(""), x = te(() => T.toSorted(X), [T]), U = te(() => {
919
- if (m.length === 0)
920
- return x;
921
- const f = m.toUpperCase();
922
- return x.filter((j) => j.toUpperCase().includes(f));
923
- }, [x, m]), [_, D] = Q(""), [W, H] = Q(null), Z = te(() => {
924
- let f = "", j;
925
- return W && p === !1 ? (j = T.findIndex((l) => l === W), j >= 0 && (f = T[j])) : O && (j = T.findIndex((l) => l === O), j >= 0 && (f = T[j])), D(f), f;
926
- }, [p, O, W]), [M, o] = Q(0);
927
- le(() => {
928
- M > 0 && W && w && w(Z);
929
- }, [M]);
930
- const K = (() => {
931
- const f = {
932
- backgroundColor: S?.backgroundColor,
933
- color: S?.color
85
+ const C = ["number", "string", "boolean", "bigint"];
86
+ if (r.length > 0 && r.some((i) => i === null || !C.includes(typeof i)))
87
+ throw new Error(`Dropdown items must be one of ${C}`);
88
+ const m = Q(), [w, b] = j(!1), [S, y] = j(""), D = E(() => r.toSorted(I), [r]), $ = E(() => {
89
+ if (S.length === 0)
90
+ return D;
91
+ const i = S.toUpperCase();
92
+ return D.filter((p) => p.toUpperCase().includes(i));
93
+ }, [D, S]), [z, k] = j(""), [x, L] = j(), V = E(() => {
94
+ let i, p = -1;
95
+ return x && s === !1 ? (p = r.findIndex((e) => e === x), p >= 0 && (i = r[p])) : c && (p = r.findIndex((e) => e === c), p >= 0 && (i = r[p])), p >= 0 ? k(i) : k(""), i;
96
+ }, [s, c, x]), [T, U] = j(0);
97
+ W(() => {
98
+ T > 0 && x && d && d(V);
99
+ }, [T]);
100
+ const g = (() => {
101
+ const i = {
102
+ backgroundColor: a?.backgroundColor,
103
+ color: a?.color
934
104
  };
935
- return S?.fontSize && (f.fontSize = S?.fontSize), f;
936
- })(), G = S?.borderColor;
937
- function X(f, j) {
938
- return ne.compare(f, j, A);
105
+ return a?.fontSize && (i.fontSize = a.fontSize), i;
106
+ })(), K = a?.borderColor;
107
+ function I(i, p) {
108
+ return Y(i, p, u);
939
109
  }
940
- function r(f) {
941
- q(f.target.value), D(f.target.value), a();
110
+ function F(i) {
111
+ y(i.target.value), k(i.target.value), P();
942
112
  }
943
- async function i(f) {
944
- p || (D(f), q(""), H(f), t(), o((j) => j + 1));
113
+ async function q(i) {
114
+ s || (k(i), y(""), L(i), A(), U((p) => p + 1));
945
115
  }
946
- function d() {
947
- C ? t() : a();
116
+ function B() {
117
+ h || (w ? A() : P());
948
118
  }
949
- function t() {
950
- v(!1);
119
+ function A() {
120
+ b(!1);
951
121
  }
952
- function a() {
953
- U.length > 0 && v(!0);
122
+ function P() {
123
+ $.length > 0 && b(!0);
954
124
  }
955
- const h = {
956
- dropdownSearch: `dropdownSearch-${E}`,
957
- dropdown: `dropdown-${E}`
125
+ const N = {
126
+ dropdownSearch: `dropdownSearch-${m}`,
127
+ dropdown: `dropdown-${m}`
958
128
  };
959
- return /* @__PURE__ */ ee(
129
+ return /* @__PURE__ */ v(
960
130
  "div",
961
131
  {
962
132
  className: `dropdown-js dropdown-js-rounded
963
- ${G && `dropdown-js-border ${G}`}`,
964
- style: { ...g ? { pointerEvents: "none" } : {} },
133
+ ${K && `dropdown-js-border ${K}`}`,
134
+ style: { ...h ? { pointerEvents: "none" } : {} },
965
135
  children: [
966
- /* @__PURE__ */ ee("div", { className: "dropdown-js-input-wrapper dropdown-js-rounded", style: K, children: [
967
- /* @__PURE__ */ Y(
136
+ /* @__PURE__ */ v("div", { className: "dropdown-js-input-wrapper dropdown-js-rounded", style: g, children: [
137
+ /* @__PURE__ */ l(
968
138
  "input",
969
139
  {
970
- id: h.dropdownSearch,
140
+ id: N.dropdownSearch,
971
141
  name: "dropdownSearch",
972
142
  className: "dropdown-js-input dropdown-js-rounded",
973
143
  autoComplete: "off",
974
144
  type: "text",
975
- style: K,
145
+ style: g,
976
146
  role: "combobox",
977
- "aria-placeholder": `Type to Search for ${n}`,
147
+ "aria-placeholder": `Type to Search for ${t}`,
978
148
  "aria-required": !0,
979
- "aria-controls": h.dropdown,
149
+ "aria-controls": N.dropdown,
980
150
  "aria-autocomplete": "list",
981
151
  "aria-haspopup": "listbox",
982
- "aria-expanded": C,
983
- onChange: (f) => r(f),
984
- disabled: g,
985
- placeholder: `Type to Search for ${n}`,
986
- value: _
152
+ "aria-expanded": w,
153
+ onChange: (i) => F(i),
154
+ disabled: h,
155
+ placeholder: `Type to Search for ${t}`,
156
+ value: z
987
157
  }
988
158
  ),
989
- /* @__PURE__ */ Y(
159
+ /* @__PURE__ */ l(
990
160
  "div",
991
161
  {
992
162
  className: "dropdown-js-arrow-container dropdown-js-padding dropdown-js-rounded",
993
- "aria-expanded": C,
163
+ "aria-expanded": w,
994
164
  "aria-controls": "multiSelectionDropdown",
995
- "aria-label": `${n} options`,
996
- onClick: (f) => d(),
997
- children: /* @__PURE__ */ Y(
165
+ "aria-label": `${t} options`,
166
+ onClick: () => B(),
167
+ children: /* @__PURE__ */ l(
998
168
  "span",
999
169
  {
1000
170
  className: "dropdown-js-arrow dropdown-js-padding",
1001
- "aria-label": `${n} options`,
1002
- "aria-expanded": C,
1003
- children: C ? "-" : "+"
171
+ "aria-label": `${t} options`,
172
+ "aria-expanded": w,
173
+ children: w ? "-" : "+"
1004
174
  }
1005
175
  )
1006
176
  }
1007
177
  )
1008
178
  ] }),
1009
- /* @__PURE__ */ Y(
1010
- "div",
179
+ /* @__PURE__ */ l(
180
+ "ul",
1011
181
  {
1012
- className: `dropdown-js-padding dropdown-js-menu ${!C && "dropdown-js-hide"}`,
1013
- id: h.dropdown,
1014
- name: "dropDown",
182
+ className: `dropdown-js-padding dropdown-js-menu ${!w && "dropdown-js-hide"}`,
183
+ id: N.dropdown,
1015
184
  role: "listbox",
1016
- "aria-expanded": C,
1017
- disabled: g,
1018
- "aria-label": n,
1019
- style: { ...K, marginTop: "3.5px" },
1020
- children: U.map((f, j) => /* @__PURE__ */ ee(
1021
- "div",
185
+ "aria-expanded": w,
186
+ "aria-disabled": h,
187
+ "aria-label": t,
188
+ style: { ...g, marginTop: "3.5px" },
189
+ children: $.map((i, p) => /* @__PURE__ */ v(
190
+ "li",
1022
191
  {
1023
- name: f,
1024
192
  role: "option",
1025
- "aria-label": f,
193
+ "aria-label": i,
1026
194
  style: { cursor: "pointer" },
1027
- onClick: (l) => i(f),
195
+ onClick: () => q(i),
1028
196
  children: [
1029
- f,
1030
- j < U.length - 1 && /* @__PURE__ */ Y("hr", { style: { borderColor: K.color } })
197
+ i,
198
+ p < $.length - 1 && /* @__PURE__ */ l("hr", { style: { borderColor: g.color } })
1031
199
  ]
1032
200
  },
1033
- `${j}#${f}`
201
+ `${p}#${i}`
1034
202
  ))
1035
203
  }
1036
204
  )
@@ -1038,152 +206,138 @@ function Ye({
1038
206
  }
1039
207
  );
1040
208
  }
1041
- Ye.propTypes = {
1042
- label: c.string.isRequired,
1043
- data: c.array.isRequired,
1044
- sortOrder: c.string,
1045
- selected: c.any,
1046
- selReset: c.bool,
1047
- isDisabled: c.bool,
1048
- onItemSelected: c.func,
1049
- dropdownStyle: c.shape({
1050
- color: c.string.isRequired,
1051
- // text color
1052
- backgroundColor: c.string.isRequired,
1053
- fontSize: c.string,
1054
- borderColor: c.string
1055
- }),
1056
- buttonStyle: c.shape({
1057
- color: c.string.isRequired,
1058
- // text color
1059
- backgroundColor: c.string.isRequired,
1060
- fontSize: c.string,
1061
- borderColor: c.string
1062
- })
1063
- };
1064
- function Ue({
1065
- label: n,
209
+ function ee({
210
+ label: t,
1066
211
  // label with which to describe the dropdown.
1067
- data: T,
1068
- sortFields: A,
1069
- selected: w = null,
1070
- selReset: O = !1,
1071
- displayName: p,
212
+ data: r,
213
+ sortFields: u,
214
+ selected: d = null,
215
+ selReset: c = !1,
216
+ displayName: s,
1072
217
  // the name of the field that will be used for displaying the list items to the user.
1073
- valueName: S,
218
+ valueName: a,
1074
219
  // the name of the field that will be used as the underlying unique value of each list item.
1075
- isDisabled: g = !1,
1076
- onItemSelected: E = null,
1077
- dropdownStyle: C
220
+ isDisabled: h = !1,
221
+ onItemSelected: C,
222
+ dropdownStyle: m
1078
223
  }) {
1079
- const v = ce(), [m, q] = Q(null), [x, U] = Q(""), _ = te(() => T.length > 0 ? ne.getPaths(T[0]) : [], [T]), D = te(() => T.toSorted(t), [T]), W = te(() => {
1080
- if (x.length === 0)
1081
- return D;
1082
- const y = x.toUpperCase();
1083
- return D.filter((P) => P[p].toUpperCase().toUpperCase().includes(y));
1084
- }, [x, D]), [H, Z] = Q(0);
1085
- le(() => {
1086
- H > 0 && K !== null && E && E(X);
1087
- }, [H]);
1088
- const [M, o] = Q(""), [K, G] = Q(null), X = te(() => {
1089
- let y = null, P;
1090
- return K && O === !1 ? (P = T.findIndex(
1091
- (e) => ne.objCompare(e, K, ..._) === 0
1092
- ), P >= 0 && (y = T[P])) : w && (P = T.findIndex(
1093
- (e) => ne.objCompare(e, w, ..._) === 0
1094
- ), P >= 0 && (y = T[P])), o(y ? y[p] : ""), y;
1095
- }, [w, K]), r = (() => {
1096
- const y = {
1097
- backgroundColor: C?.backgroundColor,
1098
- color: C?.color
224
+ j(
225
+ () => (r.forEach((e) => {
226
+ if (!G(e))
227
+ throw new Error("[Dropdowns-js] Non plain object found");
228
+ const n = Object.keys(e);
229
+ if (!n.includes(s))
230
+ throw new Error(`[Dropdowns-js] displayName field ${s} not found`);
231
+ if (!n.includes(a))
232
+ throw new Error(`[Dropdowns-js] valueName field ${a} not found`);
233
+ }), !0)
234
+ );
235
+ const w = Q(), [b, S] = j(!1), [y, D] = j(""), $ = E(() => r.length > 0 ? X(r[0]) : [], [r]), z = E(() => r.toSorted(B), [r]), k = E(() => {
236
+ if (y.length === 0)
237
+ return z;
238
+ const e = y.toUpperCase();
239
+ return z.filter((n) => n[s].toUpperCase().includes(e));
240
+ }, [y, z]), [x, L] = j(0);
241
+ W(() => {
242
+ x > 0 && U && C && C(K);
243
+ }, [x]);
244
+ const [V, T] = j(""), [U, g] = j(null), K = E(() => {
245
+ let e = null, n = -1;
246
+ return U && c === !1 ? (n = r.findIndex(
247
+ (o) => M(o, U, ...$) === 0
248
+ ), n >= 0 && (e = r[n])) : d && (n = r.findIndex(
249
+ (o) => M(o, d, ...$) === 0
250
+ ), n >= 0 && (e = r[n])), n >= 0 ? T(e[s]) : T(""), e;
251
+ }, [d, U]), I = (() => {
252
+ const e = {
253
+ backgroundColor: m?.backgroundColor,
254
+ color: m?.color
1099
255
  };
1100
- return C?.fontSize && (y.fontSize = C?.fontSize), y;
1101
- })(), i = C?.borderColor;
1102
- async function d(y) {
1103
- U(y.target.value), o(y.target.value), j();
256
+ return m?.fontSize && (e.fontSize = m?.fontSize), e;
257
+ })(), F = m?.borderColor;
258
+ async function q(e) {
259
+ D(e.target.value), T(e.target.value), i();
1104
260
  }
1105
- function t(y, P) {
1106
- return ne.objCompare(y, P, ...A);
261
+ function B(e, n) {
262
+ return M(e, n, ...u);
1107
263
  }
1108
- function a(y) {
1109
- O || (G({ ...y }), U(""), f(), Z((P) => P + 1));
264
+ function A(e) {
265
+ c || (g({ ...e }), D(""), N(), L((n) => n + 1));
1110
266
  }
1111
- function h() {
1112
- m ? f() : j();
267
+ function P() {
268
+ b ? N() : i();
1113
269
  }
1114
- function f() {
1115
- q(!1);
270
+ function N() {
271
+ S(!1);
1116
272
  }
1117
- function j() {
1118
- W.length > 0 && q(!0);
273
+ function i() {
274
+ k.length > 0 && S(!0);
1119
275
  }
1120
- const l = {
1121
- dropdownSearch: `dropdownObjSearch-${v}`,
1122
- dropdownObj: `dropdownObj-${v}`
276
+ const p = {
277
+ dropdownSearch: `dropdownObjSearch-${w}`,
278
+ dropdownObj: `dropdownObj-${w}`
1123
279
  };
1124
- return /* @__PURE__ */ ee(
280
+ return /* @__PURE__ */ v(
1125
281
  "div",
1126
282
  {
1127
283
  className: `dropdown-js dropdown-js-rounded
1128
- ${i && `dropdown-js-border ${i}`}`,
1129
- style: { ...g ? { pointerEvents: "none" } : {} },
284
+ ${F && `dropdown-js-border ${F}`}`,
285
+ style: { ...h ? { pointerEvents: "none" } : {} },
1130
286
  children: [
1131
- /* @__PURE__ */ ee("div", { className: "dropdown-js-input-wrapper dropdown-js-rounded", style: r, children: [
1132
- /* @__PURE__ */ Y(
287
+ /* @__PURE__ */ v("div", { className: "dropdown-js-input-wrapper dropdown-js-rounded", style: I, children: [
288
+ /* @__PURE__ */ l(
1133
289
  "input",
1134
290
  {
1135
- id: l.dropdownSearch,
291
+ id: p.dropdownSearch,
1136
292
  name: "dropdownObjSearch",
1137
293
  className: "dropdown-js-input dropdown-js-rounded",
1138
- style: r,
294
+ style: I,
1139
295
  type: "text",
1140
296
  autoComplete: "off",
1141
297
  role: "combobox",
1142
298
  "aria-autocomplete": "list",
1143
- "aria-controls": l.dropdownObj,
1144
- "aria-expanded": m,
1145
- "aria-placeholder": `Type to Search for ${n}`,
299
+ "aria-controls": p.dropdownObj,
300
+ "aria-expanded": b,
301
+ "aria-placeholder": `Type to Search for ${t}`,
1146
302
  "aria-required": !0,
1147
- onChange: (y) => d(y),
1148
- disabled: g,
1149
- placeholder: `Type to Search for ${n}`,
1150
- value: M
303
+ onChange: (e) => q(e),
304
+ disabled: h,
305
+ placeholder: `Type to Search for ${t}`,
306
+ value: V
1151
307
  }
1152
308
  ),
1153
- /* @__PURE__ */ Y(
309
+ /* @__PURE__ */ l(
1154
310
  "div",
1155
311
  {
1156
312
  className: "dropdown-js-arrow-container dropdown-js-padding dropdown-js-rounded",
1157
- "aria-label": `${n} options`,
1158
- "aria-expanded": m,
1159
- onClick: (y) => h(),
1160
- children: /* @__PURE__ */ Y("span", { className: "dropdown-js-arrow dropdown-js-padding", children: m ? "-" : "+" })
313
+ "aria-label": `${t} options`,
314
+ "aria-expanded": b,
315
+ onClick: () => P(),
316
+ children: /* @__PURE__ */ l("span", { className: "dropdown-js-arrow dropdown-js-padding", children: b ? "-" : "+" })
1161
317
  }
1162
318
  )
1163
319
  ] }),
1164
- /* @__PURE__ */ Y(
320
+ /* @__PURE__ */ l(
1165
321
  "div",
1166
322
  {
1167
- className: `dropdown-js-padding dropdown-js-menu ${!m && "dropdown-js-hide"}`,
1168
- id: l.dropdownObj,
1169
- name: "dropDownObj",
323
+ className: `dropdown-js-padding dropdown-js-menu ${!b && "dropdown-js-hide"}`,
324
+ id: p.dropdownObj,
1170
325
  role: "listbox",
1171
- "aria-expanded": m,
1172
- style: { ...r, marginTop: "3.5px" },
1173
- children: W.map((y, P) => /* @__PURE__ */ ee(
326
+ "aria-expanded": b,
327
+ style: { ...I, marginTop: "3.5px" },
328
+ children: k.map((e, n) => /* @__PURE__ */ v(
1174
329
  "div",
1175
330
  {
1176
- name: y[p],
1177
331
  role: "option",
1178
- "aria-label": y[p],
332
+ "aria-label": J(e, s),
1179
333
  style: { cursor: "pointer" },
1180
- onClick: (e) => a(y),
334
+ onClick: () => A(e),
1181
335
  children: [
1182
- y[p],
1183
- P < W.length - 1 && /* @__PURE__ */ Y("hr", { style: { borderColor: r.color } })
336
+ J(e, s),
337
+ n < k.length - 1 && /* @__PURE__ */ l("hr", { style: { borderColor: I.color } })
1184
338
  ]
1185
339
  },
1186
- `${y[S]}${P}`
340
+ `${J(e, a)}${n}`
1187
341
  ))
1188
342
  }
1189
343
  )
@@ -1191,203 +345,204 @@ function Ue({
1191
345
  }
1192
346
  );
1193
347
  }
1194
- Ue.propTypes = {
1195
- label: c.string.isRequired,
1196
- data: c.arrayOf(c.object).isRequired,
1197
- sortFields: c.arrayOf(c.string).isRequired,
1198
- selected: c.object,
1199
- tick: c.number,
1200
- displayName: c.string.isRequired,
1201
- valueName: c.string.isRequired,
1202
- isDisabled: c.bool,
1203
- onItemSelected: c.func,
1204
- dropdownStyle: c.shape({
1205
- color: c.string.isRequired,
1206
- // text color
1207
- backgroundColor: c.string.isRequired,
1208
- fontSize: c.string,
1209
- borderColor: c.string
1210
- })
1211
- };
1212
- function Fe({
1213
- label: n,
348
+ function oe({
349
+ label: t,
1214
350
  // label with which to describe the dropdown.
1215
- data: T,
1216
- sortFields: A,
1217
- selectedData: w = [],
1218
- selReset: O = !1,
1219
- maxNumSelections: p = null,
1220
- displayName: S,
351
+ data: r,
352
+ sortFields: u,
353
+ selectedData: d = [],
354
+ selReset: c = !1,
355
+ maxNumSelections: s,
356
+ displayName: a,
1221
357
  // the name of the field that will be used for displaying the list items to the user.
1222
- valueName: g,
358
+ valueName: h,
1223
359
  // the name of the field that will be used as the underlying unique value of each list item.
1224
- isDisabled: E = !1,
1225
- onItemsSelected: C = null,
1226
- dropdownStyle: v,
1227
- buttonStyle: m
360
+ isDisabled: C,
361
+ onItemsSelected: m,
362
+ dropdownStyle: w,
363
+ buttonStyle: b
1228
364
  }) {
1229
- const q = ce(), [x, U] = Q(!1), _ = te(() => T.length > 0 ? ne.getPaths(T[0]) : [], [T]), [D, W] = Q(""), H = te(() => T.toSorted(d), [T]), [Z, M] = Q(0), [o, K] = Q(null), G = te(() => {
1230
- let e = O === !1 && o ? [...o] : [...w];
1231
- return e = e.filter((s) => H.some(
1232
- (b) => ne.objCompare(s, b, ..._) === 0
1233
- )), p && e.length > p && (e = e.slice(0, p - 1)), e.toSorted(d);
1234
- }, [H, w, o]);
1235
- le(() => {
1236
- Z > 0 && o && C && C([...G]);
1237
- }, [Z]);
1238
- const X = te(() => {
1239
- const e = D.toUpperCase();
1240
- return e.length === 0 ? H : H.filter((s) => s[S].toUpperCase().includes(e));
1241
- }, [D, H]), r = (() => {
1242
- const e = {
1243
- backgroundColor: v?.backgroundColor,
1244
- color: v?.color
365
+ j(
366
+ () => (r.forEach((o) => {
367
+ if (!G(o))
368
+ throw new Error("[Dropdowns-js] Non plain object found");
369
+ const f = Object.keys(o);
370
+ if (!f.includes(a))
371
+ throw new Error(`[Dropdowns-js] displayName field ${a} not found`);
372
+ if (!f.includes(h))
373
+ throw new Error(`[Dropdowns-js] valueName field ${h} not found`);
374
+ }), !0)
375
+ );
376
+ const S = Q(), [y, D] = j(!1), $ = E(() => r.length > 0 ? X(r[0]) : [], [r]), [z, k] = j(""), x = E(() => r.toSorted(q), [r]), [L, V] = j(0), [T, U] = j([]), g = E(() => {
377
+ let o = c === !1 && T ? [...T] : [...d];
378
+ return o = o.filter((f) => x.some(
379
+ (O) => M(f, O, ...$) === 0
380
+ )), s && o.length > s && (o = o.slice(0, s - 1)), o.toSorted(q);
381
+ }, [x, d, T]);
382
+ W(() => {
383
+ L > 0 && T && m && m([...g]);
384
+ }, [L]);
385
+ const K = E(() => {
386
+ const o = z.toUpperCase();
387
+ return o.length === 0 ? x : x.filter((f) => f[a].toUpperCase().includes(o));
388
+ }, [z, x]), I = (() => {
389
+ const o = {
390
+ backgroundColor: w?.backgroundColor,
391
+ color: w?.color
1245
392
  };
1246
- return v?.fontSize && (e.fontSize = v?.fontSize), e;
1247
- })(), i = v?.borderColor;
1248
- function d(e, s) {
1249
- return ne.objCompare(e, s, ...A);
1250
- }
1251
- function t(e) {
1252
- W(e.target.value), y();
1253
- }
1254
- function a(e) {
1255
- O || K((s) => {
1256
- let b = s ? [...s] : [...G];
1257
- return b.some(
1258
- ($) => (
393
+ return w?.fontSize && (o.fontSize = w?.fontSize), o;
394
+ })(), F = w?.borderColor;
395
+ function q(o, f) {
396
+ return M(o, f, ...u);
397
+ }
398
+ function B(o) {
399
+ k(o.target.value), e();
400
+ }
401
+ function A(o) {
402
+ c || U((f) => {
403
+ let O = f ? [...f] : [...g];
404
+ return O.some(
405
+ (H) => (
1259
406
  // clicked item not found in the list of selected items.
1260
- ne.objCompare($, e, ..._) === 0
407
+ M(H, o, ...$) === 0
1261
408
  )
1262
- ) ? b = b.filter(($) => ne.objCompare($, e, ..._) !== 0) : (p === null || b.length < p) && b.push(e), b;
409
+ ) ? O = O.filter((H) => M(H, o, ...$) !== 0) : (s === null || s && O.length < s) && O.push(o), O;
1263
410
  });
1264
411
  }
1265
- function h(e) {
1266
- return G.some((s) => ne.objCompare(s, e, ..._) === 0);
412
+ function P(o) {
413
+ return g.some((f) => M(f, o, ...$) === 0);
1267
414
  }
1268
- function f(e) {
1269
- O || (K((s) => {
1270
- let b = s ? [...s] : [...G];
1271
- return b = b.filter(($) => ne.objCompare($, e, ..._) !== 0), b;
1272
- }), M((s) => s + 1));
415
+ function N(o) {
416
+ c || (U((f) => {
417
+ let O = f ? [...f] : [...g];
418
+ return O = O.filter((H) => M(H, o, ...$) !== 0), O;
419
+ }), V((f) => f + 1));
1273
420
  }
1274
- function j() {
1275
- x ? l() : y();
421
+ function i() {
422
+ y ? p() : e();
1276
423
  }
1277
- function l() {
1278
- U(!1), M((e) => e + 1);
424
+ function p() {
425
+ D(!1), V((o) => o + 1);
1279
426
  }
1280
- function y() {
1281
- X.length > 0 && U(!0);
427
+ function e() {
428
+ K.length > 0 && D(!0);
1282
429
  }
1283
- const P = {
1284
- multiSelectionDropdownObjSearch: `multiSelectionDropdownSearch-${q}`,
1285
- multiSelectionDropdownObj: `multiSelectionDropdown-${q}`,
1286
- selectedItems: `selectedItems-${q}`
430
+ const n = {
431
+ multiSelectionDropdownObjSearch: `multiSelectionDropdownSearch-${S}`,
432
+ multiSelectionDropdownObj: `multiSelectionDropdown-${S}`,
433
+ selectedItems: `selectedItems-${S}`
1287
434
  };
1288
- return /* @__PURE__ */ ee(
435
+ return /* @__PURE__ */ v(
1289
436
  "div",
1290
437
  {
1291
438
  className: `dropdown-js dropdown-js-rounded
1292
- ${i && `dropdown-js-border ${i}`}`,
1293
- style: { ...E ? { pointerEvents: "none" } : {} },
439
+ ${F && `dropdown-js-border ${F}`}`,
440
+ style: { ...C ? { pointerEvents: "none" } : {} },
1294
441
  children: [
1295
- /* @__PURE__ */ ee("div", { className: "dropdown-js-input-wrapper dropdown-js-rounded", style: r, children: [
1296
- /* @__PURE__ */ Y("div", { children: /* @__PURE__ */ Y(
442
+ /* @__PURE__ */ v("div", { className: "dropdown-js-input-wrapper dropdown-js-rounded", style: I, children: [
443
+ /* @__PURE__ */ l("div", { children: /* @__PURE__ */ l(
1297
444
  "input",
1298
445
  {
1299
- id: P.multiSelectionDropdownObjSearch,
446
+ id: n.multiSelectionDropdownObjSearch,
1300
447
  name: "multiSelectionDropdownObjSearch",
1301
448
  className: "dropdown-js-input dropdown-js-rounded",
1302
- style: r,
1303
- "aria-label": n,
449
+ style: I,
450
+ "aria-label": t,
1304
451
  "aria-autocomplete": "list",
1305
- "aria-controls": P.multiSelectionDropdownObj,
452
+ "aria-controls": n.multiSelectionDropdownObj,
1306
453
  role: "combobox",
1307
- "aria-expanded": x,
454
+ "aria-expanded": y,
1308
455
  "aria-haspopup": "listbox",
1309
456
  type: "text",
1310
457
  autoComplete: "off",
1311
- "aria-placeholder": `Type to Search for ${n}`,
1312
- onChange: (e) => t(e),
1313
- placeholder: `Type to Search for ${n}`,
1314
- value: D
458
+ "aria-placeholder": `Type to Search for ${t}`,
459
+ onChange: (o) => B(o),
460
+ placeholder: `Type to Search for ${t}`,
461
+ value: z
1315
462
  }
1316
463
  ) }),
1317
- /* @__PURE__ */ Y(
464
+ /* @__PURE__ */ l(
1318
465
  "div",
1319
466
  {
1320
467
  className: "dropdown-js-arrow-container dropdown-js-padding dropdown-js-rounded",
1321
- "aria-expanded": x,
468
+ "aria-expanded": y,
1322
469
  "aria-controls": "multiSelectionDropdownObj",
1323
- "aria-label": `${n} options`,
1324
- onClick: (e) => j(),
1325
- children: /* @__PURE__ */ Y("span", { className: "dropdown-js-arrow dropdown-js-padding", children: x ? "-" : "+" })
470
+ "aria-label": `${t} options`,
471
+ onClick: () => i(),
472
+ children: /* @__PURE__ */ l("span", { className: "dropdown-js-arrow dropdown-js-padding", children: y ? "-" : "+" })
1326
473
  }
1327
474
  )
1328
475
  ] }),
1329
- /* @__PURE__ */ Y("div", { className: "dropdown-js-padding dropdown-js-selected-wrapper dropdown-js-selected-container", children: /* @__PURE__ */ Y(
476
+ /* @__PURE__ */ l("div", { className: "dropdown-js-padding dropdown-js-selected-wrapper dropdown-js-selected-container", children: /* @__PURE__ */ l(
1330
477
  "div",
1331
478
  {
1332
- id: P.selectedItems,
479
+ id: n.selectedItems,
1333
480
  className: "dropdown-js-selected-items",
1334
- "aria-label": `Selected ${n} options`,
481
+ "aria-label": `Selected ${t} options`,
1335
482
  "aria-multiselectable": !0,
1336
483
  "aria-live": "polite",
1337
- children: G.map((e) => /* @__PURE__ */ ee(
484
+ children: g.map((o) => /* @__PURE__ */ v(
1338
485
  "span",
1339
486
  {
1340
487
  className: "dropdown-js-padding dropdown-js-rounded",
1341
- "aria-label": `${e[S]}`,
1342
- style: { ...r, margin: "3.5px", marginRight: "0px" },
488
+ "aria-label": `${o[a]}`,
489
+ style: { ...I, margin: "3.5px", marginRight: "0px" },
1343
490
  children: [
1344
- e[S],
491
+ o[a],
1345
492
  " ",
1346
- /* @__PURE__ */ Y("span", { className: "dropdown-js-padding", style: { cursor: "pointer" }, "aria-label": `Remove ${e[S]}`, onClick: (s) => f(e), children: "×" })
493
+ /* @__PURE__ */ l(
494
+ "span",
495
+ {
496
+ className: "dropdown-js-padding",
497
+ style: { cursor: "pointer" },
498
+ "aria-label": `Remove ${o[a]}`,
499
+ onClick: () => N(o),
500
+ children: "×"
501
+ }
502
+ )
1347
503
  ]
1348
504
  },
1349
- `${e[g]}${e[S]}`
505
+ `${o[h]}${o[a]}`
1350
506
  ))
1351
507
  }
1352
508
  ) }),
1353
- /* @__PURE__ */ ee(
509
+ /* @__PURE__ */ v(
1354
510
  "div",
1355
511
  {
1356
- className: `dropdown-js-padding dropdown-js-menu dropdown-js-rounded ${!x && "dropdown-js-hide"}`,
1357
- style: r,
1358
- id: P.multiSelectionDropdownObj,
1359
- name: "multiSelectionDropdownObj",
512
+ className: `dropdown-js-padding dropdown-js-menu dropdown-js-rounded ${!y && "dropdown-js-hide"}`,
513
+ style: I,
514
+ id: n.multiSelectionDropdownObj,
1360
515
  role: "listbox",
1361
516
  "aria-multiselectable": !0,
1362
- "aria-expanded": x,
517
+ "aria-expanded": y,
1363
518
  children: [
1364
- X.map((e) => /* @__PURE__ */ ee("div", { children: [
1365
- /* @__PURE__ */ Y(
519
+ K.map((o) => /* @__PURE__ */ v("div", { children: [
520
+ /* @__PURE__ */ l(
1366
521
  "input",
1367
522
  {
1368
- id: `${e[g]}Checkbox`,
523
+ id: `${o[h]}Checkbox`,
1369
524
  type: "checkbox",
1370
- name: `${e[S]}Checkbox`,
525
+ name: `${o[a]}Checkbox`,
1371
526
  role: "option",
1372
- "aria-label": `${e[S]}`,
1373
- "aria-checked": h(e),
527
+ "aria-label": `${o[a]}`,
528
+ "aria-checked": P(o),
1374
529
  style: { cursor: "pointer" },
1375
- checked: h(e),
1376
- onChange: (s) => a(e),
1377
- value: e[g]
530
+ checked: P(o),
531
+ onChange: () => A(o),
532
+ value: o[h]
1378
533
  }
1379
534
  ),
1380
- /* @__PURE__ */ Y("label", { style: { marginLeft: "5px" }, htmlFor: `${e[g]}`, children: e[S] }),
1381
- /* @__PURE__ */ Y("hr", { style: { backgroundColor: r.color, border: "none", height: "0.5px" } })
1382
- ] }, `${e[g]}${e[S]}`)),
1383
- /* @__PURE__ */ Y(
535
+ /* @__PURE__ */ l("label", { style: { marginLeft: "5px" }, htmlFor: `${o[h]}`, children: o[a] }),
536
+ /* @__PURE__ */ l("hr", { style: { backgroundColor: I.color, border: "none", height: "0.5px" } })
537
+ ] }, `${o[h]}${o[a]}`)),
538
+ /* @__PURE__ */ l(
1384
539
  "button",
1385
540
  {
1386
541
  className: "dropdown-js-padding dropdown-js-round",
1387
- style: m,
542
+ style: b,
1388
543
  title: "Done",
1389
- "aria-label": `Close ${n} options`,
1390
- onClick: (e) => l(),
544
+ "aria-label": `Close ${t} options`,
545
+ onClick: () => p(),
1391
546
  type: "button",
1392
547
  children: "Done"
1393
548
  }
@@ -1399,203 +554,173 @@ function Fe({
1399
554
  }
1400
555
  );
1401
556
  }
1402
- Fe.propTypes = {
1403
- label: c.string.isRequired,
1404
- data: c.arrayOf(c.object).isRequired,
1405
- sortFields: c.arrayOf(c.string).isRequired,
1406
- selectedData: c.arrayOf(c.object),
1407
- selReset: c.bool,
1408
- maxNumSelections: c.number,
1409
- displayName: c.string.isRequired,
1410
- valueName: c.string.isRequired,
1411
- isDisabled: c.bool,
1412
- onItemsSelected: c.func,
1413
- dropdownStyle: c.shape({
1414
- color: c.string.isRequired,
1415
- // text color
1416
- backgroundColor: c.string.isRequired,
1417
- fontSize: c.string,
1418
- borderColor: c.string
1419
- }),
1420
- buttonStyle: c.shape({
1421
- color: c.string.isRequired,
1422
- // text color
1423
- backgroundColor: c.string.isRequired,
1424
- fontSize: c.string,
1425
- borderColor: c.string
1426
- })
1427
- };
1428
- function Ve({
1429
- label: n,
557
+ function re({
558
+ label: t,
1430
559
  // label with which to describe the dropdown.
1431
- data: T,
1432
- sortOrder: A = "asc",
1433
- selectedData: w = [],
1434
- selReset: O = !1,
1435
- maxNumSelections: p = null,
1436
- isDisabled: S = !1,
1437
- onItemsSelected: g = null,
1438
- dropdownStyle: E,
560
+ data: r,
561
+ sortOrder: u = "asc",
562
+ selectedData: d = [],
563
+ selReset: c = !1,
564
+ maxNumSelections: s,
565
+ isDisabled: a = !1,
566
+ onItemsSelected: h,
567
+ dropdownStyle: C,
1439
568
  // Styling object with fields {color, backgroundColor, borderColor (optional), fontSize}.
1440
- buttonStyle: C
569
+ buttonStyle: m
1441
570
  // Styling for the DONE button
1442
571
  }) {
1443
- const v = ce(), [m, q] = Q(!1), x = te(() => T.toSorted(X), [T]), [U, _] = Q(""), [D, W] = Q(null), H = te(() => {
1444
- let l = O === !1 && D ? [...D] : [...w];
1445
- return l = l.filter(
1446
- (y) => x.some((P) => P === y)
1447
- ), p && l.length > p && (l = l.slice(0, p - 1)), l.toSorted(X);
1448
- }, [O, x, w, D]), [Z, M] = Q(0);
1449
- le(() => {
1450
- Z > 0 && g && D !== null && g([...H]);
1451
- }, [Z]);
1452
- const o = te(() => U.length === 0 ? x : x.filter(
1453
- (l) => l.toString().toUpperCase().includes(U.toUpperCase())
1454
- ), [U, x]), K = (() => {
1455
- const l = {
1456
- backgroundColor: E?.backgroundColor,
1457
- color: E?.color
1458
- };
1459
- return E?.fontSize && (l.fontSize = E?.fontSize), l;
1460
- })(), G = E?.borderColor;
1461
- function X(l, y) {
1462
- return ne.compare(l, y, A);
1463
- }
1464
- function r(l) {
1465
- const y = l.target.value;
1466
- _(y), f();
1467
- }
1468
- function i(l) {
1469
- O || W((y) => {
1470
- let P = y ? [...y] : [...H];
1471
- return P.some((e) => e === l) ? P = P.filter(
1472
- (e) => e !== l
1473
- ) : (p === null || P.length < p) && P.push(l), P;
572
+ const w = ["number", "string", "boolean", "bigint"];
573
+ if (r.length > 0 && r.some((e) => e === null && !w.includes(typeof e)))
574
+ throw new Error(`Dropdown items must be one of ${w}`);
575
+ const b = Q(), [S, y] = j(!1), D = E(() => r.toSorted(I), [r]), [$, z] = j(""), [k, x] = j([]), L = E(() => {
576
+ let e = [];
577
+ return c === !1 && k ? e = [...k] : e = [...d], e = e.filter(
578
+ (n) => D.some((o) => o === n)
579
+ ), s && e.length > s && (e = e.slice(0, s - 1)), e.toSorted(I);
580
+ }, [c, D, d, k]), [V, T] = j(0);
581
+ W(() => {
582
+ V > 0 && h && k !== null && h([...L]);
583
+ }, [V]);
584
+ const U = E(() => $.length === 0 ? D : D.filter(
585
+ (e) => e.toUpperCase().includes($.toUpperCase())
586
+ ), [$, D]), g = C, K = C?.borderColor;
587
+ function I(e, n) {
588
+ return Y(e, n, u);
589
+ }
590
+ function F(e) {
591
+ const n = e.target.value;
592
+ z(n), i();
593
+ }
594
+ function q(e) {
595
+ c || x((n) => {
596
+ let o = n ? [...n] : [...L];
597
+ return o.some((f) => f === e) ? o = o.filter(
598
+ (f) => f !== e
599
+ ) : (s === null || s && o.length < s) && o.push(e), o;
1474
600
  });
1475
601
  }
1476
- function d(l) {
1477
- return H.some((y) => y === l);
602
+ function B(e) {
603
+ return L.some((n) => n === e);
1478
604
  }
1479
- function t(l) {
1480
- O || (W(
1481
- (y) => (y ? [...y] : [...H]).filter((e) => e !== l)
1482
- ), M((y) => y + 1));
605
+ function A(e) {
606
+ c || (x(
607
+ (n) => (n ? [...n] : [...L]).filter((f) => f !== e)
608
+ ), T((n) => n + 1));
1483
609
  }
1484
- function a() {
1485
- m ? h() : f();
610
+ function P() {
611
+ S ? N() : i();
1486
612
  }
1487
- function h() {
1488
- q(!1), M((l) => l + 1);
613
+ function N() {
614
+ y(!1), T((e) => e + 1);
1489
615
  }
1490
- function f() {
1491
- o.length > 0 && q(!0);
616
+ function i() {
617
+ U.length > 0 && y(!0);
1492
618
  }
1493
- const j = {
1494
- multiSelectionDropdownSearch: `multiSelectionDropdown-${v}`,
1495
- multiSelectionDropdown: `multiSelectionDropdown-${v}`,
1496
- selectedItems: `selectedItems-${v}`
619
+ const p = {
620
+ multiSelectionDropdownSearch: `multiSelectionDropdown-${b}`,
621
+ multiSelectionDropdown: `multiSelectionDropdown-${b}`,
622
+ selectedItems: `selectedItems-${b}`
1497
623
  };
1498
- return /* @__PURE__ */ ee(
624
+ return /* @__PURE__ */ v(
1499
625
  "div",
1500
626
  {
1501
627
  className: `dropdown-js dropdown-js-rounded
1502
- ${G && `dropdown-js-border ${G}`}`,
1503
- style: { ...S ? { pointerEvents: "none" } : {} },
628
+ ${K && `dropdown-js-border ${K}`}`,
629
+ style: { ...a ? { pointerEvents: "none" } : {} },
1504
630
  children: [
1505
- /* @__PURE__ */ ee("div", { className: "dropdown-js-input-wrapper dropdown-js-rounded", style: K, children: [
1506
- /* @__PURE__ */ Y("div", { children: /* @__PURE__ */ Y(
631
+ /* @__PURE__ */ v("div", { className: "dropdown-js-input-wrapper dropdown-js-rounded", style: g, children: [
632
+ /* @__PURE__ */ l("div", { children: /* @__PURE__ */ l(
1507
633
  "input",
1508
634
  {
1509
635
  className: "dropdown-js-input dropdown-js-rounded",
1510
- id: j.multiSelectionDropdownSearch,
636
+ id: p.multiSelectionDropdownSearch,
1511
637
  name: "multiselectionDropdownSearch",
1512
- style: K,
638
+ style: g,
1513
639
  type: "text",
1514
640
  autoComplete: "off",
1515
641
  role: "combobox",
1516
- "aria-label": n,
1517
- "aria-placeholder": `Type to search for ${n}`,
642
+ "aria-label": t,
643
+ "aria-placeholder": `Type to search for ${t}`,
1518
644
  "aria-autocomplete": "list",
1519
- "aria-controls": j.multiSelectionDropdown,
1520
- "aria-expanded": m,
645
+ "aria-controls": p.multiSelectionDropdown,
646
+ "aria-expanded": S,
1521
647
  "aria-haspopup": "listbox",
1522
- onChange: (l) => r(l),
1523
- placeholder: `Type to Search for ${n}`,
1524
- value: U
648
+ onChange: F,
649
+ placeholder: `Type to Search for ${t}`,
650
+ value: $
1525
651
  }
1526
652
  ) }),
1527
- /* @__PURE__ */ Y(
653
+ /* @__PURE__ */ l(
1528
654
  "div",
1529
655
  {
1530
656
  className: "dropdown-js-arrow-container dropdown-js-padding dropdown-js-rounded",
1531
- "aria-expanded": m,
657
+ "aria-expanded": S,
1532
658
  "aria-controls": "multiSelectionDropdown",
1533
- "aria-label": `${n} options`,
1534
- onClick: (l) => a(),
1535
- children: /* @__PURE__ */ Y("span", { className: "dropdown-js-arrow dropdown-js-padding", children: m ? "-" : "+" })
659
+ "aria-label": `${t} options`,
660
+ onClick: () => P(),
661
+ children: /* @__PURE__ */ l("span", { className: "dropdown-js-arrow dropdown-js-padding", children: S ? "-" : "+" })
1536
662
  }
1537
663
  )
1538
664
  ] }),
1539
- /* @__PURE__ */ Y("div", { className: "dropdown-js-padding dropdown-js-selected-wrapper dropdown-js-selected-container", children: /* @__PURE__ */ Y(
665
+ /* @__PURE__ */ l("div", { className: "dropdown-js-padding dropdown-js-selected-wrapper dropdown-js-selected-container", children: /* @__PURE__ */ l(
1540
666
  "div",
1541
667
  {
1542
- id: j.selectedItems,
668
+ id: p.selectedItems,
1543
669
  className: "dropdown-js-selected-items",
1544
- "aria-label": `Selected ${n} options`,
670
+ "aria-label": `Selected ${t} options`,
1545
671
  "aria-live": "polite",
1546
- children: H.map((l) => /* @__PURE__ */ ee(
672
+ children: L.map((e) => /* @__PURE__ */ v(
1547
673
  "span",
1548
674
  {
1549
675
  className: "dropdown-js-padding dropdown-js-rounded",
1550
- "aria-label": `${l}`,
1551
- style: { ...K, margin: "3.5px", marginRight: "0px" },
676
+ "aria-label": `${e}`,
677
+ style: { ...g, margin: "3.5px", marginRight: "0px" },
1552
678
  children: [
1553
- l,
679
+ e,
1554
680
  " ",
1555
- /* @__PURE__ */ Y("span", { style: { cursor: "pointer" }, "aria-label": `Remove ${l}`, onClick: (y) => t(l), children: "×" })
681
+ /* @__PURE__ */ l("span", { style: { cursor: "pointer" }, "aria-label": `Remove ${e}`, onClick: () => A(e), children: "×" })
1556
682
  ]
1557
683
  },
1558
- `${l}`
684
+ `${e}`
1559
685
  ))
1560
686
  }
1561
687
  ) }),
1562
- /* @__PURE__ */ ee(
688
+ /* @__PURE__ */ v(
1563
689
  "div",
1564
690
  {
1565
- className: `dropdown-js-padding dropdown-js-menu dropdown-js-rounded ${!m && "dropdown-js-hide"}`,
1566
- style: K,
1567
- id: j.multiSelectionDropdown,
1568
- name: "multiSelectionDropdown",
691
+ className: `dropdown-js-padding dropdown-js-menu dropdown-js-rounded ${!S && "dropdown-js-hide"}`,
692
+ style: g,
693
+ id: p.multiSelectionDropdown,
1569
694
  role: "listbox",
1570
695
  "aria-multiselectable": !0,
1571
- "aria-expanded": m,
696
+ "aria-expanded": S,
1572
697
  children: [
1573
- o.map((l, y) => /* @__PURE__ */ ee("div", { children: [
1574
- /* @__PURE__ */ Y(
698
+ U.map((e, n) => /* @__PURE__ */ v("div", { children: [
699
+ /* @__PURE__ */ l(
1575
700
  "input",
1576
701
  {
1577
702
  type: "checkbox",
1578
- name: `${l}Checkbox`,
703
+ name: `${e}Checkbox`,
1579
704
  role: "option",
1580
- "aria-label": l,
1581
- "aria-checked": d(l),
705
+ "aria-label": e,
706
+ "aria-checked": B(e),
1582
707
  style: { cursor: "pointer" },
1583
- checked: d(l),
1584
- onChange: (P) => i(l),
1585
- value: l
708
+ checked: B(e),
709
+ onChange: () => q(e),
710
+ value: e
1586
711
  }
1587
712
  ),
1588
- /* @__PURE__ */ Y("label", { style: { marginLeft: "5px" }, htmlFor: `${l}`, children: l }),
1589
- /* @__PURE__ */ Y("hr", { style: { backgroundColor: K.color, border: "none", height: "0.5px" } })
1590
- ] }, `${y}#${l}`)),
1591
- /* @__PURE__ */ Y(
713
+ /* @__PURE__ */ l("label", { style: { marginLeft: "5px" }, htmlFor: `${e}`, children: e }),
714
+ /* @__PURE__ */ l("hr", { style: { backgroundColor: g.color, border: "none", height: "0.5px" } })
715
+ ] }, `${n}#${e}`)),
716
+ /* @__PURE__ */ l(
1592
717
  "button",
1593
718
  {
1594
719
  className: "dropdown-js-padding dropdown-js-round",
1595
- style: C,
1596
- "aria-label": `Click to collapse ${n} options`,
720
+ style: m,
721
+ "aria-label": `Click to collapse ${t} options`,
1597
722
  title: "Done",
1598
- onClick: (l) => h(),
723
+ onClick: () => N(),
1599
724
  type: "button",
1600
725
  children: "Done"
1601
726
  }
@@ -1607,33 +732,9 @@ function Ve({
1607
732
  }
1608
733
  );
1609
734
  }
1610
- Ve.propTypes = {
1611
- label: c.string.isRequired,
1612
- data: c.array.isRequired,
1613
- sortOrder: c.string,
1614
- selectedData: c.array,
1615
- selReset: c.bool,
1616
- maxNumSelections: c.number,
1617
- isDisabled: c.bool,
1618
- onItemsSelected: c.func,
1619
- dropdownStyle: c.shape({
1620
- color: c.string.isRequired,
1621
- // text color
1622
- backgroundColor: c.string.isRequired,
1623
- fontSize: c.string,
1624
- borderColor: c.string
1625
- }),
1626
- buttonStyle: c.shape({
1627
- color: c.string.isRequired,
1628
- // text color
1629
- backgroundColor: c.string.isRequired,
1630
- fontSize: c.string,
1631
- borderColor: c.string
1632
- })
1633
- };
1634
735
  export {
1635
- Ye as Dropdown,
1636
- Ue as DropdownObj,
1637
- Ve as MultiSelectionDropdown,
1638
- Fe as MultiSelectionDropdownObj
736
+ R as Dropdown,
737
+ ee as DropdownObj,
738
+ re as MultiSelectionDropdown,
739
+ oe as MultiSelectionDropdownObj
1639
740
  };