@sebgroup/green-react 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +61 -0
  2. package/index.d.ts +13 -0
  3. package/index.esm.js +3235 -0
  4. package/index.umd.js +3269 -0
  5. package/lib/accordion/accordion-item.d.ts +17 -0
  6. package/lib/accordion/accordion.d.ts +6 -0
  7. package/lib/alert-ribbon/alert-ribbon.d.ts +16 -0
  8. package/lib/badge/badge.d.ts +12 -0
  9. package/lib/card/card.d.ts +8 -0
  10. package/lib/datepicker/datepicker.d.ts +2 -0
  11. package/lib/datepicker/hook.d.ts +12 -0
  12. package/lib/dropdown/dropdown.d.ts +6 -0
  13. package/lib/dropdown/hooks.d.ts +29 -0
  14. package/lib/form/button/button.d.ts +13 -0
  15. package/lib/form/buttonGroup/buttonGroup.d.ts +10 -0
  16. package/lib/form/form.d.ts +10 -0
  17. package/lib/form/formContext.d.ts +13 -0
  18. package/lib/form/formItems.d.ts +9 -0
  19. package/lib/form/group/group.d.ts +9 -0
  20. package/lib/form/index.d.ts +8 -0
  21. package/lib/form/input/input.d.ts +11 -0
  22. package/lib/form/radioButton/radioGroup.d.ts +13 -0
  23. package/lib/form/text/text.d.ts +6 -0
  24. package/lib/form/types.d.ts +23 -0
  25. package/lib/form/useInput.d.ts +5 -0
  26. package/lib/form/validateInput.d.ts +9 -0
  27. package/lib/icons/check.d.ts +1 -0
  28. package/lib/icons/index.d.ts +3 -0
  29. package/lib/icons/square-exclamation.d.ts +1 -0
  30. package/lib/icons/square-info.d.ts +1 -0
  31. package/lib/layout/flexbox/flexbox.d.ts +13 -0
  32. package/lib/layout/flexbox/types.d.ts +5 -0
  33. package/lib/layout/index.d.ts +1 -0
  34. package/lib/link/link.d.ts +7 -0
  35. package/lib/list/list.d.ts +14 -0
  36. package/lib/list/listItem.d.ts +10 -0
  37. package/lib/modal/modal.d.ts +17 -0
  38. package/lib/navbar/navbar.d.ts +12 -0
  39. package/lib/stepper/hook.d.ts +3 -0
  40. package/lib/stepper/stepper.d.ts +9 -0
  41. package/lib/tabs/tabs.d.ts +13 -0
  42. package/package.json +31 -0
package/index.esm.js ADDED
@@ -0,0 +1,3235 @@
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import React, { useState, useLayoutEffect, useEffect, useMemo, useRef } from 'react';
3
+ import { randomId, validateClassName, createStepper, createDropdown, dropdownValues, createDatepicker, months, years } from '@sebgroup/extract';
4
+
5
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
6
+
7
+ var check = function (it) {
8
+ return it && it.Math == Math && it;
9
+ };
10
+
11
+ // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
12
+ var global$r =
13
+ // eslint-disable-next-line es-x/no-global-this -- safe
14
+ check(typeof globalThis == 'object' && globalThis) ||
15
+ check(typeof window == 'object' && window) ||
16
+ // eslint-disable-next-line no-restricted-globals -- safe
17
+ check(typeof self == 'object' && self) ||
18
+ check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
19
+ // eslint-disable-next-line no-new-func -- fallback
20
+ (function () { return this; })() || Function('return this')();
21
+
22
+ var objectGetOwnPropertyDescriptor = {};
23
+
24
+ var fails$a = function (exec) {
25
+ try {
26
+ return !!exec();
27
+ } catch (error) {
28
+ return true;
29
+ }
30
+ };
31
+
32
+ var fails$9 = fails$a;
33
+
34
+ // Detect IE8's incomplete defineProperty implementation
35
+ var descriptors = !fails$9(function () {
36
+ // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
37
+ return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
38
+ });
39
+
40
+ var fails$8 = fails$a;
41
+
42
+ var functionBindNative = !fails$8(function () {
43
+ // eslint-disable-next-line es-x/no-function-prototype-bind -- safe
44
+ var test = (function () { /* empty */ }).bind();
45
+ // eslint-disable-next-line no-prototype-builtins -- safe
46
+ return typeof test != 'function' || test.hasOwnProperty('prototype');
47
+ });
48
+
49
+ var NATIVE_BIND$1 = functionBindNative;
50
+
51
+ var call$6 = Function.prototype.call;
52
+
53
+ var functionCall = NATIVE_BIND$1 ? call$6.bind(call$6) : function () {
54
+ return call$6.apply(call$6, arguments);
55
+ };
56
+
57
+ var objectPropertyIsEnumerable = {};
58
+
59
+ var $propertyIsEnumerable = {}.propertyIsEnumerable;
60
+ // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
61
+ var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
62
+
63
+ // Nashorn ~ JDK8 bug
64
+ var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
65
+
66
+ // `Object.prototype.propertyIsEnumerable` method implementation
67
+ // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
68
+ objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
69
+ var descriptor = getOwnPropertyDescriptor$1(this, V);
70
+ return !!descriptor && descriptor.enumerable;
71
+ } : $propertyIsEnumerable;
72
+
73
+ var createPropertyDescriptor$3 = function (bitmap, value) {
74
+ return {
75
+ enumerable: !(bitmap & 1),
76
+ configurable: !(bitmap & 2),
77
+ writable: !(bitmap & 4),
78
+ value: value
79
+ };
80
+ };
81
+
82
+ var NATIVE_BIND = functionBindNative;
83
+
84
+ var FunctionPrototype$1 = Function.prototype;
85
+ var bind = FunctionPrototype$1.bind;
86
+ var call$5 = FunctionPrototype$1.call;
87
+ var uncurryThis$c = NATIVE_BIND && bind.bind(call$5, call$5);
88
+
89
+ var functionUncurryThis = NATIVE_BIND ? function (fn) {
90
+ return fn && uncurryThis$c(fn);
91
+ } : function (fn) {
92
+ return fn && function () {
93
+ return call$5.apply(fn, arguments);
94
+ };
95
+ };
96
+
97
+ var uncurryThis$b = functionUncurryThis;
98
+
99
+ var toString$3 = uncurryThis$b({}.toString);
100
+ var stringSlice$1 = uncurryThis$b(''.slice);
101
+
102
+ var classofRaw$1 = function (it) {
103
+ return stringSlice$1(toString$3(it), 8, -1);
104
+ };
105
+
106
+ var global$q = global$r;
107
+ var uncurryThis$a = functionUncurryThis;
108
+ var fails$7 = fails$a;
109
+ var classof$2 = classofRaw$1;
110
+
111
+ var Object$5 = global$q.Object;
112
+ var split = uncurryThis$a(''.split);
113
+
114
+ // fallback for non-array-like ES3 and non-enumerable old V8 strings
115
+ var indexedObject = fails$7(function () {
116
+ // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
117
+ // eslint-disable-next-line no-prototype-builtins -- safe
118
+ return !Object$5('z').propertyIsEnumerable(0);
119
+ }) ? function (it) {
120
+ return classof$2(it) == 'String' ? split(it, '') : Object$5(it);
121
+ } : Object$5;
122
+
123
+ var global$p = global$r;
124
+
125
+ var TypeError$8 = global$p.TypeError;
126
+
127
+ // `RequireObjectCoercible` abstract operation
128
+ // https://tc39.es/ecma262/#sec-requireobjectcoercible
129
+ var requireObjectCoercible$2 = function (it) {
130
+ if (it == undefined) throw TypeError$8("Can't call method on " + it);
131
+ return it;
132
+ };
133
+
134
+ // toObject with fallback for non-array-like ES3 strings
135
+ var IndexedObject$1 = indexedObject;
136
+ var requireObjectCoercible$1 = requireObjectCoercible$2;
137
+
138
+ var toIndexedObject$5 = function (it) {
139
+ return IndexedObject$1(requireObjectCoercible$1(it));
140
+ };
141
+
142
+ // `IsCallable` abstract operation
143
+ // https://tc39.es/ecma262/#sec-iscallable
144
+ var isCallable$f = function (argument) {
145
+ return typeof argument == 'function';
146
+ };
147
+
148
+ var isCallable$e = isCallable$f;
149
+
150
+ var isObject$5 = function (it) {
151
+ return typeof it == 'object' ? it !== null : isCallable$e(it);
152
+ };
153
+
154
+ var global$o = global$r;
155
+ var isCallable$d = isCallable$f;
156
+
157
+ var aFunction = function (argument) {
158
+ return isCallable$d(argument) ? argument : undefined;
159
+ };
160
+
161
+ var getBuiltIn$4 = function (namespace, method) {
162
+ return arguments.length < 2 ? aFunction(global$o[namespace]) : global$o[namespace] && global$o[namespace][method];
163
+ };
164
+
165
+ var uncurryThis$9 = functionUncurryThis;
166
+
167
+ var objectIsPrototypeOf = uncurryThis$9({}.isPrototypeOf);
168
+
169
+ var getBuiltIn$3 = getBuiltIn$4;
170
+
171
+ var engineUserAgent = getBuiltIn$3('navigator', 'userAgent') || '';
172
+
173
+ var global$n = global$r;
174
+ var userAgent = engineUserAgent;
175
+
176
+ var process = global$n.process;
177
+ var Deno = global$n.Deno;
178
+ var versions = process && process.versions || Deno && Deno.version;
179
+ var v8 = versions && versions.v8;
180
+ var match, version;
181
+
182
+ if (v8) {
183
+ match = v8.split('.');
184
+ // in old Chrome, versions of V8 isn't V8 = Chrome / 10
185
+ // but their correct versions are not interesting for us
186
+ version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
187
+ }
188
+
189
+ // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
190
+ // so check `userAgent` even if `.v8` exists, but 0
191
+ if (!version && userAgent) {
192
+ match = userAgent.match(/Edge\/(\d+)/);
193
+ if (!match || match[1] >= 74) {
194
+ match = userAgent.match(/Chrome\/(\d+)/);
195
+ if (match) version = +match[1];
196
+ }
197
+ }
198
+
199
+ var engineV8Version = version;
200
+
201
+ /* eslint-disable es-x/no-symbol -- required for testing */
202
+
203
+ var V8_VERSION = engineV8Version;
204
+ var fails$6 = fails$a;
205
+
206
+ // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
207
+ var nativeSymbol = !!Object.getOwnPropertySymbols && !fails$6(function () {
208
+ var symbol = Symbol();
209
+ // Chrome 38 Symbol has incorrect toString conversion
210
+ // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
211
+ return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
212
+ // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
213
+ !Symbol.sham && V8_VERSION && V8_VERSION < 41;
214
+ });
215
+
216
+ /* eslint-disable es-x/no-symbol -- required for testing */
217
+
218
+ var NATIVE_SYMBOL$2 = nativeSymbol;
219
+
220
+ var useSymbolAsUid = NATIVE_SYMBOL$2
221
+ && !Symbol.sham
222
+ && typeof Symbol.iterator == 'symbol';
223
+
224
+ var global$m = global$r;
225
+ var getBuiltIn$2 = getBuiltIn$4;
226
+ var isCallable$c = isCallable$f;
227
+ var isPrototypeOf$1 = objectIsPrototypeOf;
228
+ var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
229
+
230
+ var Object$4 = global$m.Object;
231
+
232
+ var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
233
+ return typeof it == 'symbol';
234
+ } : function (it) {
235
+ var $Symbol = getBuiltIn$2('Symbol');
236
+ return isCallable$c($Symbol) && isPrototypeOf$1($Symbol.prototype, Object$4(it));
237
+ };
238
+
239
+ var global$l = global$r;
240
+
241
+ var String$4 = global$l.String;
242
+
243
+ var tryToString$1 = function (argument) {
244
+ try {
245
+ return String$4(argument);
246
+ } catch (error) {
247
+ return 'Object';
248
+ }
249
+ };
250
+
251
+ var global$k = global$r;
252
+ var isCallable$b = isCallable$f;
253
+ var tryToString = tryToString$1;
254
+
255
+ var TypeError$7 = global$k.TypeError;
256
+
257
+ // `Assert: IsCallable(argument) is true`
258
+ var aCallable$1 = function (argument) {
259
+ if (isCallable$b(argument)) return argument;
260
+ throw TypeError$7(tryToString(argument) + ' is not a function');
261
+ };
262
+
263
+ var aCallable = aCallable$1;
264
+
265
+ // `GetMethod` abstract operation
266
+ // https://tc39.es/ecma262/#sec-getmethod
267
+ var getMethod$1 = function (V, P) {
268
+ var func = V[P];
269
+ return func == null ? undefined : aCallable(func);
270
+ };
271
+
272
+ var global$j = global$r;
273
+ var call$4 = functionCall;
274
+ var isCallable$a = isCallable$f;
275
+ var isObject$4 = isObject$5;
276
+
277
+ var TypeError$6 = global$j.TypeError;
278
+
279
+ // `OrdinaryToPrimitive` abstract operation
280
+ // https://tc39.es/ecma262/#sec-ordinarytoprimitive
281
+ var ordinaryToPrimitive$1 = function (input, pref) {
282
+ var fn, val;
283
+ if (pref === 'string' && isCallable$a(fn = input.toString) && !isObject$4(val = call$4(fn, input))) return val;
284
+ if (isCallable$a(fn = input.valueOf) && !isObject$4(val = call$4(fn, input))) return val;
285
+ if (pref !== 'string' && isCallable$a(fn = input.toString) && !isObject$4(val = call$4(fn, input))) return val;
286
+ throw TypeError$6("Can't convert object to primitive value");
287
+ };
288
+
289
+ var shared$3 = {exports: {}};
290
+
291
+ var global$i = global$r;
292
+
293
+ // eslint-disable-next-line es-x/no-object-defineproperty -- safe
294
+ var defineProperty$4 = Object.defineProperty;
295
+
296
+ var setGlobal$3 = function (key, value) {
297
+ try {
298
+ defineProperty$4(global$i, key, { value: value, configurable: true, writable: true });
299
+ } catch (error) {
300
+ global$i[key] = value;
301
+ } return value;
302
+ };
303
+
304
+ var global$h = global$r;
305
+ var setGlobal$2 = setGlobal$3;
306
+
307
+ var SHARED = '__core-js_shared__';
308
+ var store$3 = global$h[SHARED] || setGlobal$2(SHARED, {});
309
+
310
+ var sharedStore = store$3;
311
+
312
+ var store$2 = sharedStore;
313
+
314
+ (shared$3.exports = function (key, value) {
315
+ return store$2[key] || (store$2[key] = value !== undefined ? value : {});
316
+ })('versions', []).push({
317
+ version: '3.22.2',
318
+ mode: 'global',
319
+ copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
320
+ license: 'https://github.com/zloirock/core-js/blob/v3.22.2/LICENSE',
321
+ source: 'https://github.com/zloirock/core-js'
322
+ });
323
+
324
+ var global$g = global$r;
325
+ var requireObjectCoercible = requireObjectCoercible$2;
326
+
327
+ var Object$3 = global$g.Object;
328
+
329
+ // `ToObject` abstract operation
330
+ // https://tc39.es/ecma262/#sec-toobject
331
+ var toObject$3 = function (argument) {
332
+ return Object$3(requireObjectCoercible(argument));
333
+ };
334
+
335
+ var uncurryThis$8 = functionUncurryThis;
336
+ var toObject$2 = toObject$3;
337
+
338
+ var hasOwnProperty = uncurryThis$8({}.hasOwnProperty);
339
+
340
+ // `HasOwnProperty` abstract operation
341
+ // https://tc39.es/ecma262/#sec-hasownproperty
342
+ // eslint-disable-next-line es-x/no-object-hasown -- safe
343
+ var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
344
+ return hasOwnProperty(toObject$2(it), key);
345
+ };
346
+
347
+ var uncurryThis$7 = functionUncurryThis;
348
+
349
+ var id = 0;
350
+ var postfix = Math.random();
351
+ var toString$2 = uncurryThis$7(1.0.toString);
352
+
353
+ var uid$2 = function (key) {
354
+ return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$2(++id + postfix, 36);
355
+ };
356
+
357
+ var global$f = global$r;
358
+ var shared$2 = shared$3.exports;
359
+ var hasOwn$9 = hasOwnProperty_1;
360
+ var uid$1 = uid$2;
361
+ var NATIVE_SYMBOL$1 = nativeSymbol;
362
+ var USE_SYMBOL_AS_UID = useSymbolAsUid;
363
+
364
+ var WellKnownSymbolsStore = shared$2('wks');
365
+ var Symbol$1 = global$f.Symbol;
366
+ var symbolFor = Symbol$1 && Symbol$1['for'];
367
+ var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
368
+
369
+ var wellKnownSymbol$8 = function (name) {
370
+ if (!hasOwn$9(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL$1 || typeof WellKnownSymbolsStore[name] == 'string')) {
371
+ var description = 'Symbol.' + name;
372
+ if (NATIVE_SYMBOL$1 && hasOwn$9(Symbol$1, name)) {
373
+ WellKnownSymbolsStore[name] = Symbol$1[name];
374
+ } else if (USE_SYMBOL_AS_UID && symbolFor) {
375
+ WellKnownSymbolsStore[name] = symbolFor(description);
376
+ } else {
377
+ WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
378
+ }
379
+ } return WellKnownSymbolsStore[name];
380
+ };
381
+
382
+ var global$e = global$r;
383
+ var call$3 = functionCall;
384
+ var isObject$3 = isObject$5;
385
+ var isSymbol$1 = isSymbol$2;
386
+ var getMethod = getMethod$1;
387
+ var ordinaryToPrimitive = ordinaryToPrimitive$1;
388
+ var wellKnownSymbol$7 = wellKnownSymbol$8;
389
+
390
+ var TypeError$5 = global$e.TypeError;
391
+ var TO_PRIMITIVE = wellKnownSymbol$7('toPrimitive');
392
+
393
+ // `ToPrimitive` abstract operation
394
+ // https://tc39.es/ecma262/#sec-toprimitive
395
+ var toPrimitive$1 = function (input, pref) {
396
+ if (!isObject$3(input) || isSymbol$1(input)) return input;
397
+ var exoticToPrim = getMethod(input, TO_PRIMITIVE);
398
+ var result;
399
+ if (exoticToPrim) {
400
+ if (pref === undefined) pref = 'default';
401
+ result = call$3(exoticToPrim, input, pref);
402
+ if (!isObject$3(result) || isSymbol$1(result)) return result;
403
+ throw TypeError$5("Can't convert object to primitive value");
404
+ }
405
+ if (pref === undefined) pref = 'number';
406
+ return ordinaryToPrimitive(input, pref);
407
+ };
408
+
409
+ var toPrimitive = toPrimitive$1;
410
+ var isSymbol = isSymbol$2;
411
+
412
+ // `ToPropertyKey` abstract operation
413
+ // https://tc39.es/ecma262/#sec-topropertykey
414
+ var toPropertyKey$2 = function (argument) {
415
+ var key = toPrimitive(argument, 'string');
416
+ return isSymbol(key) ? key : key + '';
417
+ };
418
+
419
+ var global$d = global$r;
420
+ var isObject$2 = isObject$5;
421
+
422
+ var document$1 = global$d.document;
423
+ // typeof document.createElement is 'object' in old IE
424
+ var EXISTS$1 = isObject$2(document$1) && isObject$2(document$1.createElement);
425
+
426
+ var documentCreateElement$2 = function (it) {
427
+ return EXISTS$1 ? document$1.createElement(it) : {};
428
+ };
429
+
430
+ var DESCRIPTORS$9 = descriptors;
431
+ var fails$5 = fails$a;
432
+ var createElement = documentCreateElement$2;
433
+
434
+ // Thanks to IE8 for its funny defineProperty
435
+ var ie8DomDefine = !DESCRIPTORS$9 && !fails$5(function () {
436
+ // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
437
+ return Object.defineProperty(createElement('div'), 'a', {
438
+ get: function () { return 7; }
439
+ }).a != 7;
440
+ });
441
+
442
+ var DESCRIPTORS$8 = descriptors;
443
+ var call$2 = functionCall;
444
+ var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable;
445
+ var createPropertyDescriptor$2 = createPropertyDescriptor$3;
446
+ var toIndexedObject$4 = toIndexedObject$5;
447
+ var toPropertyKey$1 = toPropertyKey$2;
448
+ var hasOwn$8 = hasOwnProperty_1;
449
+ var IE8_DOM_DEFINE$1 = ie8DomDefine;
450
+
451
+ // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
452
+ var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
453
+
454
+ // `Object.getOwnPropertyDescriptor` method
455
+ // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
456
+ objectGetOwnPropertyDescriptor.f = DESCRIPTORS$8 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
457
+ O = toIndexedObject$4(O);
458
+ P = toPropertyKey$1(P);
459
+ if (IE8_DOM_DEFINE$1) try {
460
+ return $getOwnPropertyDescriptor$1(O, P);
461
+ } catch (error) { /* empty */ }
462
+ if (hasOwn$8(O, P)) return createPropertyDescriptor$2(!call$2(propertyIsEnumerableModule$1.f, O, P), O[P]);
463
+ };
464
+
465
+ var objectDefineProperty = {};
466
+
467
+ var DESCRIPTORS$7 = descriptors;
468
+ var fails$4 = fails$a;
469
+
470
+ // V8 ~ Chrome 36-
471
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3334
472
+ var v8PrototypeDefineBug = DESCRIPTORS$7 && fails$4(function () {
473
+ // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
474
+ return Object.defineProperty(function () { /* empty */ }, 'prototype', {
475
+ value: 42,
476
+ writable: false
477
+ }).prototype != 42;
478
+ });
479
+
480
+ var global$c = global$r;
481
+ var isObject$1 = isObject$5;
482
+
483
+ var String$3 = global$c.String;
484
+ var TypeError$4 = global$c.TypeError;
485
+
486
+ // `Assert: Type(argument) is Object`
487
+ var anObject$5 = function (argument) {
488
+ if (isObject$1(argument)) return argument;
489
+ throw TypeError$4(String$3(argument) + ' is not an object');
490
+ };
491
+
492
+ var global$b = global$r;
493
+ var DESCRIPTORS$6 = descriptors;
494
+ var IE8_DOM_DEFINE = ie8DomDefine;
495
+ var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
496
+ var anObject$4 = anObject$5;
497
+ var toPropertyKey = toPropertyKey$2;
498
+
499
+ var TypeError$3 = global$b.TypeError;
500
+ // eslint-disable-next-line es-x/no-object-defineproperty -- safe
501
+ var $defineProperty = Object.defineProperty;
502
+ // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
503
+ var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
504
+ var ENUMERABLE = 'enumerable';
505
+ var CONFIGURABLE$1 = 'configurable';
506
+ var WRITABLE = 'writable';
507
+
508
+ // `Object.defineProperty` method
509
+ // https://tc39.es/ecma262/#sec-object.defineproperty
510
+ objectDefineProperty.f = DESCRIPTORS$6 ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
511
+ anObject$4(O);
512
+ P = toPropertyKey(P);
513
+ anObject$4(Attributes);
514
+ if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
515
+ var current = $getOwnPropertyDescriptor(O, P);
516
+ if (current && current[WRITABLE]) {
517
+ O[P] = Attributes.value;
518
+ Attributes = {
519
+ configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
520
+ enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
521
+ writable: false
522
+ };
523
+ }
524
+ } return $defineProperty(O, P, Attributes);
525
+ } : $defineProperty : function defineProperty(O, P, Attributes) {
526
+ anObject$4(O);
527
+ P = toPropertyKey(P);
528
+ anObject$4(Attributes);
529
+ if (IE8_DOM_DEFINE) try {
530
+ return $defineProperty(O, P, Attributes);
531
+ } catch (error) { /* empty */ }
532
+ if ('get' in Attributes || 'set' in Attributes) throw TypeError$3('Accessors not supported');
533
+ if ('value' in Attributes) O[P] = Attributes.value;
534
+ return O;
535
+ };
536
+
537
+ var DESCRIPTORS$5 = descriptors;
538
+ var definePropertyModule$3 = objectDefineProperty;
539
+ var createPropertyDescriptor$1 = createPropertyDescriptor$3;
540
+
541
+ var createNonEnumerableProperty$5 = DESCRIPTORS$5 ? function (object, key, value) {
542
+ return definePropertyModule$3.f(object, key, createPropertyDescriptor$1(1, value));
543
+ } : function (object, key, value) {
544
+ object[key] = value;
545
+ return object;
546
+ };
547
+
548
+ var redefine$3 = {exports: {}};
549
+
550
+ var uncurryThis$6 = functionUncurryThis;
551
+ var isCallable$9 = isCallable$f;
552
+ var store$1 = sharedStore;
553
+
554
+ var functionToString = uncurryThis$6(Function.toString);
555
+
556
+ // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
557
+ if (!isCallable$9(store$1.inspectSource)) {
558
+ store$1.inspectSource = function (it) {
559
+ return functionToString(it);
560
+ };
561
+ }
562
+
563
+ var inspectSource$2 = store$1.inspectSource;
564
+
565
+ var global$a = global$r;
566
+ var isCallable$8 = isCallable$f;
567
+ var inspectSource$1 = inspectSource$2;
568
+
569
+ var WeakMap$1 = global$a.WeakMap;
570
+
571
+ var nativeWeakMap = isCallable$8(WeakMap$1) && /native code/.test(inspectSource$1(WeakMap$1));
572
+
573
+ var shared$1 = shared$3.exports;
574
+ var uid = uid$2;
575
+
576
+ var keys = shared$1('keys');
577
+
578
+ var sharedKey$3 = function (key) {
579
+ return keys[key] || (keys[key] = uid(key));
580
+ };
581
+
582
+ var hiddenKeys$4 = {};
583
+
584
+ var NATIVE_WEAK_MAP = nativeWeakMap;
585
+ var global$9 = global$r;
586
+ var uncurryThis$5 = functionUncurryThis;
587
+ var isObject = isObject$5;
588
+ var createNonEnumerableProperty$4 = createNonEnumerableProperty$5;
589
+ var hasOwn$7 = hasOwnProperty_1;
590
+ var shared = sharedStore;
591
+ var sharedKey$2 = sharedKey$3;
592
+ var hiddenKeys$3 = hiddenKeys$4;
593
+
594
+ var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
595
+ var TypeError$2 = global$9.TypeError;
596
+ var WeakMap = global$9.WeakMap;
597
+ var set, get, has;
598
+
599
+ var enforce = function (it) {
600
+ return has(it) ? get(it) : set(it, {});
601
+ };
602
+
603
+ var getterFor = function (TYPE) {
604
+ return function (it) {
605
+ var state;
606
+ if (!isObject(it) || (state = get(it)).type !== TYPE) {
607
+ throw TypeError$2('Incompatible receiver, ' + TYPE + ' required');
608
+ } return state;
609
+ };
610
+ };
611
+
612
+ if (NATIVE_WEAK_MAP || shared.state) {
613
+ var store = shared.state || (shared.state = new WeakMap());
614
+ var wmget = uncurryThis$5(store.get);
615
+ var wmhas = uncurryThis$5(store.has);
616
+ var wmset = uncurryThis$5(store.set);
617
+ set = function (it, metadata) {
618
+ if (wmhas(store, it)) throw new TypeError$2(OBJECT_ALREADY_INITIALIZED);
619
+ metadata.facade = it;
620
+ wmset(store, it, metadata);
621
+ return metadata;
622
+ };
623
+ get = function (it) {
624
+ return wmget(store, it) || {};
625
+ };
626
+ has = function (it) {
627
+ return wmhas(store, it);
628
+ };
629
+ } else {
630
+ var STATE = sharedKey$2('state');
631
+ hiddenKeys$3[STATE] = true;
632
+ set = function (it, metadata) {
633
+ if (hasOwn$7(it, STATE)) throw new TypeError$2(OBJECT_ALREADY_INITIALIZED);
634
+ metadata.facade = it;
635
+ createNonEnumerableProperty$4(it, STATE, metadata);
636
+ return metadata;
637
+ };
638
+ get = function (it) {
639
+ return hasOwn$7(it, STATE) ? it[STATE] : {};
640
+ };
641
+ has = function (it) {
642
+ return hasOwn$7(it, STATE);
643
+ };
644
+ }
645
+
646
+ var internalState = {
647
+ set: set,
648
+ get: get,
649
+ has: has,
650
+ enforce: enforce,
651
+ getterFor: getterFor
652
+ };
653
+
654
+ var DESCRIPTORS$4 = descriptors;
655
+ var hasOwn$6 = hasOwnProperty_1;
656
+
657
+ var FunctionPrototype = Function.prototype;
658
+ // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
659
+ var getDescriptor = DESCRIPTORS$4 && Object.getOwnPropertyDescriptor;
660
+
661
+ var EXISTS = hasOwn$6(FunctionPrototype, 'name');
662
+ // additional protection from minified / mangled / dropped function names
663
+ var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
664
+ var CONFIGURABLE = EXISTS && (!DESCRIPTORS$4 || (DESCRIPTORS$4 && getDescriptor(FunctionPrototype, 'name').configurable));
665
+
666
+ var functionName = {
667
+ EXISTS: EXISTS,
668
+ PROPER: PROPER,
669
+ CONFIGURABLE: CONFIGURABLE
670
+ };
671
+
672
+ var global$8 = global$r;
673
+ var isCallable$7 = isCallable$f;
674
+ var hasOwn$5 = hasOwnProperty_1;
675
+ var createNonEnumerableProperty$3 = createNonEnumerableProperty$5;
676
+ var setGlobal$1 = setGlobal$3;
677
+ var inspectSource = inspectSource$2;
678
+ var InternalStateModule$1 = internalState;
679
+ var CONFIGURABLE_FUNCTION_NAME$1 = functionName.CONFIGURABLE;
680
+
681
+ var getInternalState$1 = InternalStateModule$1.get;
682
+ var enforceInternalState = InternalStateModule$1.enforce;
683
+ var TEMPLATE = String(String).split('String');
684
+
685
+ (redefine$3.exports = function (O, key, value, options) {
686
+ var unsafe = options ? !!options.unsafe : false;
687
+ var simple = options ? !!options.enumerable : false;
688
+ var noTargetGet = options ? !!options.noTargetGet : false;
689
+ var name = options && options.name !== undefined ? options.name : key;
690
+ var state;
691
+ if (isCallable$7(value)) {
692
+ if (String(name).slice(0, 7) === 'Symbol(') {
693
+ name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
694
+ }
695
+ if (!hasOwn$5(value, 'name') || (CONFIGURABLE_FUNCTION_NAME$1 && value.name !== name)) {
696
+ createNonEnumerableProperty$3(value, 'name', name);
697
+ }
698
+ state = enforceInternalState(value);
699
+ if (!state.source) {
700
+ state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
701
+ }
702
+ }
703
+ if (O === global$8) {
704
+ if (simple) O[key] = value;
705
+ else setGlobal$1(key, value);
706
+ return;
707
+ } else if (!unsafe) {
708
+ delete O[key];
709
+ } else if (!noTargetGet && O[key]) {
710
+ simple = true;
711
+ }
712
+ if (simple) O[key] = value;
713
+ else createNonEnumerableProperty$3(O, key, value);
714
+ // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
715
+ })(Function.prototype, 'toString', function toString() {
716
+ return isCallable$7(this) && getInternalState$1(this).source || inspectSource(this);
717
+ });
718
+
719
+ var objectGetOwnPropertyNames = {};
720
+
721
+ var ceil = Math.ceil;
722
+ var floor = Math.floor;
723
+
724
+ // `ToIntegerOrInfinity` abstract operation
725
+ // https://tc39.es/ecma262/#sec-tointegerorinfinity
726
+ var toIntegerOrInfinity$2 = function (argument) {
727
+ var number = +argument;
728
+ // eslint-disable-next-line no-self-compare -- safe
729
+ return number !== number || number === 0 ? 0 : (number > 0 ? floor : ceil)(number);
730
+ };
731
+
732
+ var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
733
+
734
+ var max = Math.max;
735
+ var min$1 = Math.min;
736
+
737
+ // Helper for a popular repeating case of the spec:
738
+ // Let integer be ? ToInteger(index).
739
+ // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
740
+ var toAbsoluteIndex$1 = function (index, length) {
741
+ var integer = toIntegerOrInfinity$1(index);
742
+ return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
743
+ };
744
+
745
+ var toIntegerOrInfinity = toIntegerOrInfinity$2;
746
+
747
+ var min = Math.min;
748
+
749
+ // `ToLength` abstract operation
750
+ // https://tc39.es/ecma262/#sec-tolength
751
+ var toLength$1 = function (argument) {
752
+ return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
753
+ };
754
+
755
+ var toLength = toLength$1;
756
+
757
+ // `LengthOfArrayLike` abstract operation
758
+ // https://tc39.es/ecma262/#sec-lengthofarraylike
759
+ var lengthOfArrayLike$1 = function (obj) {
760
+ return toLength(obj.length);
761
+ };
762
+
763
+ var toIndexedObject$3 = toIndexedObject$5;
764
+ var toAbsoluteIndex = toAbsoluteIndex$1;
765
+ var lengthOfArrayLike = lengthOfArrayLike$1;
766
+
767
+ // `Array.prototype.{ indexOf, includes }` methods implementation
768
+ var createMethod = function (IS_INCLUDES) {
769
+ return function ($this, el, fromIndex) {
770
+ var O = toIndexedObject$3($this);
771
+ var length = lengthOfArrayLike(O);
772
+ var index = toAbsoluteIndex(fromIndex, length);
773
+ var value;
774
+ // Array#includes uses SameValueZero equality algorithm
775
+ // eslint-disable-next-line no-self-compare -- NaN check
776
+ if (IS_INCLUDES && el != el) while (length > index) {
777
+ value = O[index++];
778
+ // eslint-disable-next-line no-self-compare -- NaN check
779
+ if (value != value) return true;
780
+ // Array#indexOf ignores holes, Array#includes - not
781
+ } else for (;length > index; index++) {
782
+ if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
783
+ } return !IS_INCLUDES && -1;
784
+ };
785
+ };
786
+
787
+ var arrayIncludes = {
788
+ // `Array.prototype.includes` method
789
+ // https://tc39.es/ecma262/#sec-array.prototype.includes
790
+ includes: createMethod(true),
791
+ // `Array.prototype.indexOf` method
792
+ // https://tc39.es/ecma262/#sec-array.prototype.indexof
793
+ indexOf: createMethod(false)
794
+ };
795
+
796
+ var uncurryThis$4 = functionUncurryThis;
797
+ var hasOwn$4 = hasOwnProperty_1;
798
+ var toIndexedObject$2 = toIndexedObject$5;
799
+ var indexOf = arrayIncludes.indexOf;
800
+ var hiddenKeys$2 = hiddenKeys$4;
801
+
802
+ var push = uncurryThis$4([].push);
803
+
804
+ var objectKeysInternal = function (object, names) {
805
+ var O = toIndexedObject$2(object);
806
+ var i = 0;
807
+ var result = [];
808
+ var key;
809
+ for (key in O) !hasOwn$4(hiddenKeys$2, key) && hasOwn$4(O, key) && push(result, key);
810
+ // Don't enum bug & hidden keys
811
+ while (names.length > i) if (hasOwn$4(O, key = names[i++])) {
812
+ ~indexOf(result, key) || push(result, key);
813
+ }
814
+ return result;
815
+ };
816
+
817
+ // IE8- don't enum bug keys
818
+ var enumBugKeys$3 = [
819
+ 'constructor',
820
+ 'hasOwnProperty',
821
+ 'isPrototypeOf',
822
+ 'propertyIsEnumerable',
823
+ 'toLocaleString',
824
+ 'toString',
825
+ 'valueOf'
826
+ ];
827
+
828
+ var internalObjectKeys$1 = objectKeysInternal;
829
+ var enumBugKeys$2 = enumBugKeys$3;
830
+
831
+ var hiddenKeys$1 = enumBugKeys$2.concat('length', 'prototype');
832
+
833
+ // `Object.getOwnPropertyNames` method
834
+ // https://tc39.es/ecma262/#sec-object.getownpropertynames
835
+ // eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
836
+ objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
837
+ return internalObjectKeys$1(O, hiddenKeys$1);
838
+ };
839
+
840
+ var objectGetOwnPropertySymbols = {};
841
+
842
+ // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe
843
+ objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
844
+
845
+ var getBuiltIn$1 = getBuiltIn$4;
846
+ var uncurryThis$3 = functionUncurryThis;
847
+ var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
848
+ var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
849
+ var anObject$3 = anObject$5;
850
+
851
+ var concat$1 = uncurryThis$3([].concat);
852
+
853
+ // all object keys, includes non-enumerable and symbols
854
+ var ownKeys$1 = getBuiltIn$1('Reflect', 'ownKeys') || function ownKeys(it) {
855
+ var keys = getOwnPropertyNamesModule.f(anObject$3(it));
856
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f;
857
+ return getOwnPropertySymbols ? concat$1(keys, getOwnPropertySymbols(it)) : keys;
858
+ };
859
+
860
+ var hasOwn$3 = hasOwnProperty_1;
861
+ var ownKeys = ownKeys$1;
862
+ var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
863
+ var definePropertyModule$2 = objectDefineProperty;
864
+
865
+ var copyConstructorProperties$2 = function (target, source, exceptions) {
866
+ var keys = ownKeys(source);
867
+ var defineProperty = definePropertyModule$2.f;
868
+ var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
869
+ for (var i = 0; i < keys.length; i++) {
870
+ var key = keys[i];
871
+ if (!hasOwn$3(target, key) && !(exceptions && hasOwn$3(exceptions, key))) {
872
+ defineProperty(target, key, getOwnPropertyDescriptor(source, key));
873
+ }
874
+ }
875
+ };
876
+
877
+ var fails$3 = fails$a;
878
+ var isCallable$6 = isCallable$f;
879
+
880
+ var replacement = /#|\.prototype\./;
881
+
882
+ var isForced$1 = function (feature, detection) {
883
+ var value = data[normalize(feature)];
884
+ return value == POLYFILL ? true
885
+ : value == NATIVE ? false
886
+ : isCallable$6(detection) ? fails$3(detection)
887
+ : !!detection;
888
+ };
889
+
890
+ var normalize = isForced$1.normalize = function (string) {
891
+ return String(string).replace(replacement, '.').toLowerCase();
892
+ };
893
+
894
+ var data = isForced$1.data = {};
895
+ var NATIVE = isForced$1.NATIVE = 'N';
896
+ var POLYFILL = isForced$1.POLYFILL = 'P';
897
+
898
+ var isForced_1 = isForced$1;
899
+
900
+ var global$7 = global$r;
901
+ var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
902
+ var createNonEnumerableProperty$2 = createNonEnumerableProperty$5;
903
+ var redefine$2 = redefine$3.exports;
904
+ var setGlobal = setGlobal$3;
905
+ var copyConstructorProperties$1 = copyConstructorProperties$2;
906
+ var isForced = isForced_1;
907
+
908
+ /*
909
+ options.target - name of the target object
910
+ options.global - target is the global object
911
+ options.stat - export as static methods of target
912
+ options.proto - export as prototype methods of target
913
+ options.real - real prototype method for the `pure` version
914
+ options.forced - export even if the native feature is available
915
+ options.bind - bind methods to the target, required for the `pure` version
916
+ options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
917
+ options.unsafe - use the simple assignment of property instead of delete + defineProperty
918
+ options.sham - add a flag to not completely full polyfills
919
+ options.enumerable - export as enumerable property
920
+ options.noTargetGet - prevent calling a getter on target
921
+ options.name - the .name of the function if it does not match the key
922
+ */
923
+ var _export = function (options, source) {
924
+ var TARGET = options.target;
925
+ var GLOBAL = options.global;
926
+ var STATIC = options.stat;
927
+ var FORCED, target, key, targetProperty, sourceProperty, descriptor;
928
+ if (GLOBAL) {
929
+ target = global$7;
930
+ } else if (STATIC) {
931
+ target = global$7[TARGET] || setGlobal(TARGET, {});
932
+ } else {
933
+ target = (global$7[TARGET] || {}).prototype;
934
+ }
935
+ if (target) for (key in source) {
936
+ sourceProperty = source[key];
937
+ if (options.noTargetGet) {
938
+ descriptor = getOwnPropertyDescriptor(target, key);
939
+ targetProperty = descriptor && descriptor.value;
940
+ } else targetProperty = target[key];
941
+ FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
942
+ // contained in target
943
+ if (!FORCED && targetProperty !== undefined) {
944
+ if (typeof sourceProperty == typeof targetProperty) continue;
945
+ copyConstructorProperties$1(sourceProperty, targetProperty);
946
+ }
947
+ // add a flag to not completely full polyfills
948
+ if (options.sham || (targetProperty && targetProperty.sham)) {
949
+ createNonEnumerableProperty$2(sourceProperty, 'sham', true);
950
+ }
951
+ // extend global
952
+ redefine$2(target, key, sourceProperty, options);
953
+ }
954
+ };
955
+
956
+ var internalObjectKeys = objectKeysInternal;
957
+ var enumBugKeys$1 = enumBugKeys$3;
958
+
959
+ // `Object.keys` method
960
+ // https://tc39.es/ecma262/#sec-object.keys
961
+ // eslint-disable-next-line es-x/no-object-keys -- safe
962
+ var objectKeys$2 = Object.keys || function keys(O) {
963
+ return internalObjectKeys(O, enumBugKeys$1);
964
+ };
965
+
966
+ var DESCRIPTORS$3 = descriptors;
967
+ var uncurryThis$2 = functionUncurryThis;
968
+ var call$1 = functionCall;
969
+ var fails$2 = fails$a;
970
+ var objectKeys$1 = objectKeys$2;
971
+ var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
972
+ var propertyIsEnumerableModule = objectPropertyIsEnumerable;
973
+ var toObject$1 = toObject$3;
974
+ var IndexedObject = indexedObject;
975
+
976
+ // eslint-disable-next-line es-x/no-object-assign -- safe
977
+ var $assign = Object.assign;
978
+ // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
979
+ var defineProperty$3 = Object.defineProperty;
980
+ var concat = uncurryThis$2([].concat);
981
+
982
+ // `Object.assign` method
983
+ // https://tc39.es/ecma262/#sec-object.assign
984
+ var objectAssign = !$assign || fails$2(function () {
985
+ // should have correct order of operations (Edge bug)
986
+ if (DESCRIPTORS$3 && $assign({ b: 1 }, $assign(defineProperty$3({}, 'a', {
987
+ enumerable: true,
988
+ get: function () {
989
+ defineProperty$3(this, 'b', {
990
+ value: 3,
991
+ enumerable: false
992
+ });
993
+ }
994
+ }), { b: 2 })).b !== 1) return true;
995
+ // should work with symbols and should have deterministic property order (V8 bug)
996
+ var A = {};
997
+ var B = {};
998
+ // eslint-disable-next-line es-x/no-symbol -- safe
999
+ var symbol = Symbol();
1000
+ var alphabet = 'abcdefghijklmnopqrst';
1001
+ A[symbol] = 7;
1002
+ alphabet.split('').forEach(function (chr) { B[chr] = chr; });
1003
+ return $assign({}, A)[symbol] != 7 || objectKeys$1($assign({}, B)).join('') != alphabet;
1004
+ }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
1005
+ var T = toObject$1(target);
1006
+ var argumentsLength = arguments.length;
1007
+ var index = 1;
1008
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
1009
+ var propertyIsEnumerable = propertyIsEnumerableModule.f;
1010
+ while (argumentsLength > index) {
1011
+ var S = IndexedObject(arguments[index++]);
1012
+ var keys = getOwnPropertySymbols ? concat(objectKeys$1(S), getOwnPropertySymbols(S)) : objectKeys$1(S);
1013
+ var length = keys.length;
1014
+ var j = 0;
1015
+ var key;
1016
+ while (length > j) {
1017
+ key = keys[j++];
1018
+ if (!DESCRIPTORS$3 || call$1(propertyIsEnumerable, S, key)) T[key] = S[key];
1019
+ }
1020
+ } return T;
1021
+ } : $assign;
1022
+
1023
+ var $$2 = _export;
1024
+ var assign = objectAssign;
1025
+
1026
+ // `Object.assign` method
1027
+ // https://tc39.es/ecma262/#sec-object.assign
1028
+ // eslint-disable-next-line es-x/no-object-assign -- required for testing
1029
+ $$2({ target: 'Object', stat: true, forced: Object.assign !== assign }, {
1030
+ assign: assign
1031
+ });
1032
+
1033
+ /******************************************************************************
1034
+ Copyright (c) Microsoft Corporation.
1035
+
1036
+ Permission to use, copy, modify, and/or distribute this software for any
1037
+ purpose with or without fee is hereby granted.
1038
+
1039
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1040
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1041
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1042
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1043
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1044
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1045
+ PERFORMANCE OF THIS SOFTWARE.
1046
+ ***************************************************************************** */
1047
+
1048
+ function __rest(s, e) {
1049
+ var t = {};
1050
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
1051
+ t[p] = s[p];
1052
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
1053
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1054
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
1055
+ t[p[i]] = s[p[i]];
1056
+ }
1057
+ return t;
1058
+ }
1059
+
1060
+ function Button({
1061
+ children,
1062
+ variant,
1063
+ onClick,
1064
+ disabled,
1065
+ active = false,
1066
+ type = 'button',
1067
+ size
1068
+ }) {
1069
+ const props = {
1070
+ type,
1071
+ disabled
1072
+ };
1073
+ const classNames = [];
1074
+ if (variant) classNames.push(variant);
1075
+ if (active) classNames.push('active');
1076
+ if (size) classNames.push(size);
1077
+ if (classNames.length) props.className = classNames.join(' ');
1078
+ if (onClick) props.onClick = onClick;
1079
+ return jsx("button", Object.assign({}, props, {
1080
+ children: children
1081
+ }));
1082
+ }
1083
+
1084
+ const ModalHeader = ({
1085
+ header: _header = '',
1086
+ onClose
1087
+ }) => {
1088
+ const handleClose = event => {
1089
+ if (onClose) onClose(event);
1090
+ };
1091
+
1092
+ return jsxs("div", Object.assign({
1093
+ className: "header"
1094
+ }, {
1095
+ children: [jsx("h3", {
1096
+ children: _header
1097
+ }), jsxs("button", Object.assign({
1098
+ className: "close",
1099
+ onClick: handleClose
1100
+ }, {
1101
+ children: [jsx("span", Object.assign({
1102
+ className: "sr-only"
1103
+ }, {
1104
+ children: "Close"
1105
+ })), jsx("i", {})]
1106
+ }))]
1107
+ }));
1108
+ };
1109
+
1110
+ const ModalBody = ({
1111
+ children
1112
+ }) => {
1113
+ return jsx("div", Object.assign({
1114
+ className: "body"
1115
+ }, {
1116
+ children: children
1117
+ }));
1118
+ };
1119
+
1120
+ const ModalFooter = ({
1121
+ confirm,
1122
+ dismiss,
1123
+ onClose,
1124
+ onConfirm,
1125
+ onDismiss
1126
+ }) => {
1127
+ const handleConfirm = event => {
1128
+ if (onConfirm) onConfirm(event);
1129
+ if (onClose) onClose(event);
1130
+ };
1131
+
1132
+ const handleDismiss = event => {
1133
+ if (onDismiss) onDismiss(event);
1134
+ if (onClose) onClose(event);
1135
+ };
1136
+
1137
+ return jsxs("div", Object.assign({
1138
+ className: "footer"
1139
+ }, {
1140
+ children: [dismiss && jsx(Button, Object.assign({
1141
+ variant: "secondary",
1142
+ onClick: handleDismiss
1143
+ }, {
1144
+ children: dismiss
1145
+ })), confirm && jsx(Button, Object.assign({
1146
+ variant: "primary",
1147
+ onClick: handleConfirm
1148
+ }, {
1149
+ children: confirm
1150
+ }))]
1151
+ }));
1152
+ };
1153
+
1154
+ const Modal = _a => {
1155
+ var {
1156
+ type = 'default',
1157
+ isOpen
1158
+ } = _a,
1159
+ props = __rest(_a, ["type", "isOpen"]);
1160
+
1161
+ const modalContent = () => {
1162
+ switch (type) {
1163
+ case 'slideout':
1164
+ {
1165
+ return jsxs("aside", Object.assign({
1166
+ role: "dialog"
1167
+ }, {
1168
+ children: [jsx(ModalHeader, Object.assign({}, props)), jsx(ModalBody, Object.assign({}, props)), jsx(ModalFooter, Object.assign({}, props))]
1169
+ }));
1170
+ }
1171
+
1172
+ case 'takeover':
1173
+ {
1174
+ return jsxs("main", Object.assign({
1175
+ role: "dialog"
1176
+ }, {
1177
+ children: [jsx(ModalHeader, Object.assign({}, props)), jsx(ModalBody, Object.assign({}, props)), jsx(ModalFooter, Object.assign({}, props))]
1178
+ }));
1179
+ }
1180
+
1181
+ default:
1182
+ {
1183
+ return jsxs("section", Object.assign({
1184
+ role: "dialog"
1185
+ }, {
1186
+ children: [jsx(ModalHeader, Object.assign({}, props)), jsx(ModalBody, Object.assign({}, props)), jsx(ModalFooter, Object.assign({}, props))]
1187
+ }));
1188
+ }
1189
+ }
1190
+ };
1191
+
1192
+ return isOpen ? modalContent() : null;
1193
+ };
1194
+
1195
+ var objectDefineProperties = {};
1196
+
1197
+ var DESCRIPTORS$2 = descriptors;
1198
+ var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
1199
+ var definePropertyModule$1 = objectDefineProperty;
1200
+ var anObject$2 = anObject$5;
1201
+ var toIndexedObject$1 = toIndexedObject$5;
1202
+ var objectKeys = objectKeys$2;
1203
+
1204
+ // `Object.defineProperties` method
1205
+ // https://tc39.es/ecma262/#sec-object.defineproperties
1206
+ // eslint-disable-next-line es-x/no-object-defineproperties -- safe
1207
+ objectDefineProperties.f = DESCRIPTORS$2 && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
1208
+ anObject$2(O);
1209
+ var props = toIndexedObject$1(Properties);
1210
+ var keys = objectKeys(Properties);
1211
+ var length = keys.length;
1212
+ var index = 0;
1213
+ var key;
1214
+ while (length > index) definePropertyModule$1.f(O, key = keys[index++], props[key]);
1215
+ return O;
1216
+ };
1217
+
1218
+ var getBuiltIn = getBuiltIn$4;
1219
+
1220
+ var html$1 = getBuiltIn('document', 'documentElement');
1221
+
1222
+ /* global ActiveXObject -- old IE, WSH */
1223
+
1224
+ var anObject$1 = anObject$5;
1225
+ var definePropertiesModule = objectDefineProperties;
1226
+ var enumBugKeys = enumBugKeys$3;
1227
+ var hiddenKeys = hiddenKeys$4;
1228
+ var html = html$1;
1229
+ var documentCreateElement$1 = documentCreateElement$2;
1230
+ var sharedKey$1 = sharedKey$3;
1231
+
1232
+ var GT = '>';
1233
+ var LT = '<';
1234
+ var PROTOTYPE = 'prototype';
1235
+ var SCRIPT = 'script';
1236
+ var IE_PROTO$1 = sharedKey$1('IE_PROTO');
1237
+
1238
+ var EmptyConstructor = function () { /* empty */ };
1239
+
1240
+ var scriptTag = function (content) {
1241
+ return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
1242
+ };
1243
+
1244
+ // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
1245
+ var NullProtoObjectViaActiveX = function (activeXDocument) {
1246
+ activeXDocument.write(scriptTag(''));
1247
+ activeXDocument.close();
1248
+ var temp = activeXDocument.parentWindow.Object;
1249
+ activeXDocument = null; // avoid memory leak
1250
+ return temp;
1251
+ };
1252
+
1253
+ // Create object with fake `null` prototype: use iframe Object with cleared prototype
1254
+ var NullProtoObjectViaIFrame = function () {
1255
+ // Thrash, waste and sodomy: IE GC bug
1256
+ var iframe = documentCreateElement$1('iframe');
1257
+ var JS = 'java' + SCRIPT + ':';
1258
+ var iframeDocument;
1259
+ iframe.style.display = 'none';
1260
+ html.appendChild(iframe);
1261
+ // https://github.com/zloirock/core-js/issues/475
1262
+ iframe.src = String(JS);
1263
+ iframeDocument = iframe.contentWindow.document;
1264
+ iframeDocument.open();
1265
+ iframeDocument.write(scriptTag('document.F=Object'));
1266
+ iframeDocument.close();
1267
+ return iframeDocument.F;
1268
+ };
1269
+
1270
+ // Check for document.domain and active x support
1271
+ // No need to use active x approach when document.domain is not set
1272
+ // see https://github.com/es-shims/es5-shim/issues/150
1273
+ // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
1274
+ // avoid IE GC bug
1275
+ var activeXDocument;
1276
+ var NullProtoObject = function () {
1277
+ try {
1278
+ activeXDocument = new ActiveXObject('htmlfile');
1279
+ } catch (error) { /* ignore */ }
1280
+ NullProtoObject = typeof document != 'undefined'
1281
+ ? document.domain && activeXDocument
1282
+ ? NullProtoObjectViaActiveX(activeXDocument) // old IE
1283
+ : NullProtoObjectViaIFrame()
1284
+ : NullProtoObjectViaActiveX(activeXDocument); // WSH
1285
+ var length = enumBugKeys.length;
1286
+ while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
1287
+ return NullProtoObject();
1288
+ };
1289
+
1290
+ hiddenKeys[IE_PROTO$1] = true;
1291
+
1292
+ // `Object.create` method
1293
+ // https://tc39.es/ecma262/#sec-object.create
1294
+ // eslint-disable-next-line es-x/no-object-create -- safe
1295
+ var objectCreate = Object.create || function create(O, Properties) {
1296
+ var result;
1297
+ if (O !== null) {
1298
+ EmptyConstructor[PROTOTYPE] = anObject$1(O);
1299
+ result = new EmptyConstructor();
1300
+ EmptyConstructor[PROTOTYPE] = null;
1301
+ // add "__proto__" for Object.getPrototypeOf polyfill
1302
+ result[IE_PROTO$1] = O;
1303
+ } else result = NullProtoObject();
1304
+ return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
1305
+ };
1306
+
1307
+ var wellKnownSymbol$6 = wellKnownSymbol$8;
1308
+ var create$1 = objectCreate;
1309
+ var definePropertyModule = objectDefineProperty;
1310
+
1311
+ var UNSCOPABLES = wellKnownSymbol$6('unscopables');
1312
+ var ArrayPrototype = Array.prototype;
1313
+
1314
+ // Array.prototype[@@unscopables]
1315
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1316
+ if (ArrayPrototype[UNSCOPABLES] == undefined) {
1317
+ definePropertyModule.f(ArrayPrototype, UNSCOPABLES, {
1318
+ configurable: true,
1319
+ value: create$1(null)
1320
+ });
1321
+ }
1322
+
1323
+ // add a key to Array.prototype[@@unscopables]
1324
+ var addToUnscopables$1 = function (key) {
1325
+ ArrayPrototype[UNSCOPABLES][key] = true;
1326
+ };
1327
+
1328
+ var iterators = {};
1329
+
1330
+ var fails$1 = fails$a;
1331
+
1332
+ var correctPrototypeGetter = !fails$1(function () {
1333
+ function F() { /* empty */ }
1334
+ F.prototype.constructor = null;
1335
+ // eslint-disable-next-line es-x/no-object-getprototypeof -- required for testing
1336
+ return Object.getPrototypeOf(new F()) !== F.prototype;
1337
+ });
1338
+
1339
+ var global$6 = global$r;
1340
+ var hasOwn$2 = hasOwnProperty_1;
1341
+ var isCallable$5 = isCallable$f;
1342
+ var toObject = toObject$3;
1343
+ var sharedKey = sharedKey$3;
1344
+ var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter;
1345
+
1346
+ var IE_PROTO = sharedKey('IE_PROTO');
1347
+ var Object$2 = global$6.Object;
1348
+ var ObjectPrototype = Object$2.prototype;
1349
+
1350
+ // `Object.getPrototypeOf` method
1351
+ // https://tc39.es/ecma262/#sec-object.getprototypeof
1352
+ var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? Object$2.getPrototypeOf : function (O) {
1353
+ var object = toObject(O);
1354
+ if (hasOwn$2(object, IE_PROTO)) return object[IE_PROTO];
1355
+ var constructor = object.constructor;
1356
+ if (isCallable$5(constructor) && object instanceof constructor) {
1357
+ return constructor.prototype;
1358
+ } return object instanceof Object$2 ? ObjectPrototype : null;
1359
+ };
1360
+
1361
+ var fails = fails$a;
1362
+ var isCallable$4 = isCallable$f;
1363
+ var getPrototypeOf$1 = objectGetPrototypeOf;
1364
+ var redefine$1 = redefine$3.exports;
1365
+ var wellKnownSymbol$5 = wellKnownSymbol$8;
1366
+
1367
+ var ITERATOR$2 = wellKnownSymbol$5('iterator');
1368
+ var BUGGY_SAFARI_ITERATORS$1 = false;
1369
+
1370
+ // `%IteratorPrototype%` object
1371
+ // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
1372
+ var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
1373
+
1374
+ /* eslint-disable es-x/no-array-prototype-keys -- safe */
1375
+ if ([].keys) {
1376
+ arrayIterator = [].keys();
1377
+ // Safari 8 has buggy iterators w/o `next`
1378
+ if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;
1379
+ else {
1380
+ PrototypeOfArrayIteratorPrototype = getPrototypeOf$1(getPrototypeOf$1(arrayIterator));
1381
+ if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype;
1382
+ }
1383
+ }
1384
+
1385
+ var NEW_ITERATOR_PROTOTYPE = IteratorPrototype$2 == undefined || fails(function () {
1386
+ var test = {};
1387
+ // FF44- legacy iterators case
1388
+ return IteratorPrototype$2[ITERATOR$2].call(test) !== test;
1389
+ });
1390
+
1391
+ if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
1392
+
1393
+ // `%IteratorPrototype%[@@iterator]()` method
1394
+ // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
1395
+ if (!isCallable$4(IteratorPrototype$2[ITERATOR$2])) {
1396
+ redefine$1(IteratorPrototype$2, ITERATOR$2, function () {
1397
+ return this;
1398
+ });
1399
+ }
1400
+
1401
+ var iteratorsCore = {
1402
+ IteratorPrototype: IteratorPrototype$2,
1403
+ BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
1404
+ };
1405
+
1406
+ var defineProperty$2 = objectDefineProperty.f;
1407
+ var hasOwn$1 = hasOwnProperty_1;
1408
+ var wellKnownSymbol$4 = wellKnownSymbol$8;
1409
+
1410
+ var TO_STRING_TAG$3 = wellKnownSymbol$4('toStringTag');
1411
+
1412
+ var setToStringTag$2 = function (target, TAG, STATIC) {
1413
+ if (target && !STATIC) target = target.prototype;
1414
+ if (target && !hasOwn$1(target, TO_STRING_TAG$3)) {
1415
+ defineProperty$2(target, TO_STRING_TAG$3, { configurable: true, value: TAG });
1416
+ }
1417
+ };
1418
+
1419
+ var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
1420
+ var create = objectCreate;
1421
+ var createPropertyDescriptor = createPropertyDescriptor$3;
1422
+ var setToStringTag$1 = setToStringTag$2;
1423
+ var Iterators$2 = iterators;
1424
+
1425
+ var returnThis$1 = function () { return this; };
1426
+
1427
+ var createIteratorConstructor$1 = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
1428
+ var TO_STRING_TAG = NAME + ' Iterator';
1429
+ IteratorConstructor.prototype = create(IteratorPrototype$1, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
1430
+ setToStringTag$1(IteratorConstructor, TO_STRING_TAG, false);
1431
+ Iterators$2[TO_STRING_TAG] = returnThis$1;
1432
+ return IteratorConstructor;
1433
+ };
1434
+
1435
+ var global$5 = global$r;
1436
+ var isCallable$3 = isCallable$f;
1437
+
1438
+ var String$2 = global$5.String;
1439
+ var TypeError$1 = global$5.TypeError;
1440
+
1441
+ var aPossiblePrototype$1 = function (argument) {
1442
+ if (typeof argument == 'object' || isCallable$3(argument)) return argument;
1443
+ throw TypeError$1("Can't set " + String$2(argument) + ' as a prototype');
1444
+ };
1445
+
1446
+ /* eslint-disable no-proto -- safe */
1447
+
1448
+ var uncurryThis$1 = functionUncurryThis;
1449
+ var anObject = anObject$5;
1450
+ var aPossiblePrototype = aPossiblePrototype$1;
1451
+
1452
+ // `Object.setPrototypeOf` method
1453
+ // https://tc39.es/ecma262/#sec-object.setprototypeof
1454
+ // Works with __proto__ only. Old v8 can't work with null proto objects.
1455
+ // eslint-disable-next-line es-x/no-object-setprototypeof -- safe
1456
+ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
1457
+ var CORRECT_SETTER = false;
1458
+ var test = {};
1459
+ var setter;
1460
+ try {
1461
+ // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
1462
+ setter = uncurryThis$1(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
1463
+ setter(test, []);
1464
+ CORRECT_SETTER = test instanceof Array;
1465
+ } catch (error) { /* empty */ }
1466
+ return function setPrototypeOf(O, proto) {
1467
+ anObject(O);
1468
+ aPossiblePrototype(proto);
1469
+ if (CORRECT_SETTER) setter(O, proto);
1470
+ else O.__proto__ = proto;
1471
+ return O;
1472
+ };
1473
+ }() : undefined);
1474
+
1475
+ var $$1 = _export;
1476
+ var call = functionCall;
1477
+ var FunctionName = functionName;
1478
+ var isCallable$2 = isCallable$f;
1479
+ var createIteratorConstructor = createIteratorConstructor$1;
1480
+ var getPrototypeOf = objectGetPrototypeOf;
1481
+ var setPrototypeOf = objectSetPrototypeOf;
1482
+ var setToStringTag = setToStringTag$2;
1483
+ var createNonEnumerableProperty$1 = createNonEnumerableProperty$5;
1484
+ var redefine = redefine$3.exports;
1485
+ var wellKnownSymbol$3 = wellKnownSymbol$8;
1486
+ var Iterators$1 = iterators;
1487
+ var IteratorsCore = iteratorsCore;
1488
+
1489
+ var PROPER_FUNCTION_NAME = FunctionName.PROPER;
1490
+ var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
1491
+ var IteratorPrototype = IteratorsCore.IteratorPrototype;
1492
+ var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
1493
+ var ITERATOR$1 = wellKnownSymbol$3('iterator');
1494
+ var KEYS = 'keys';
1495
+ var VALUES = 'values';
1496
+ var ENTRIES = 'entries';
1497
+
1498
+ var returnThis = function () { return this; };
1499
+
1500
+ var defineIterator$1 = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
1501
+ createIteratorConstructor(IteratorConstructor, NAME, next);
1502
+
1503
+ var getIterationMethod = function (KIND) {
1504
+ if (KIND === DEFAULT && defaultIterator) return defaultIterator;
1505
+ if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
1506
+ switch (KIND) {
1507
+ case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
1508
+ case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
1509
+ case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
1510
+ } return function () { return new IteratorConstructor(this); };
1511
+ };
1512
+
1513
+ var TO_STRING_TAG = NAME + ' Iterator';
1514
+ var INCORRECT_VALUES_NAME = false;
1515
+ var IterablePrototype = Iterable.prototype;
1516
+ var nativeIterator = IterablePrototype[ITERATOR$1]
1517
+ || IterablePrototype['@@iterator']
1518
+ || DEFAULT && IterablePrototype[DEFAULT];
1519
+ var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
1520
+ var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
1521
+ var CurrentIteratorPrototype, methods, KEY;
1522
+
1523
+ // fix native
1524
+ if (anyNativeIterator) {
1525
+ CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
1526
+ if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
1527
+ if (getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
1528
+ if (setPrototypeOf) {
1529
+ setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
1530
+ } else if (!isCallable$2(CurrentIteratorPrototype[ITERATOR$1])) {
1531
+ redefine(CurrentIteratorPrototype, ITERATOR$1, returnThis);
1532
+ }
1533
+ }
1534
+ // Set @@toStringTag to native iterators
1535
+ setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true);
1536
+ }
1537
+ }
1538
+
1539
+ // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
1540
+ if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
1541
+ if (CONFIGURABLE_FUNCTION_NAME) {
1542
+ createNonEnumerableProperty$1(IterablePrototype, 'name', VALUES);
1543
+ } else {
1544
+ INCORRECT_VALUES_NAME = true;
1545
+ defaultIterator = function values() { return call(nativeIterator, this); };
1546
+ }
1547
+ }
1548
+
1549
+ // export additional methods
1550
+ if (DEFAULT) {
1551
+ methods = {
1552
+ values: getIterationMethod(VALUES),
1553
+ keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
1554
+ entries: getIterationMethod(ENTRIES)
1555
+ };
1556
+ if (FORCED) for (KEY in methods) {
1557
+ if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
1558
+ redefine(IterablePrototype, KEY, methods[KEY]);
1559
+ }
1560
+ } else $$1({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
1561
+ }
1562
+
1563
+ // define iterator
1564
+ if (IterablePrototype[ITERATOR$1] !== defaultIterator) {
1565
+ redefine(IterablePrototype, ITERATOR$1, defaultIterator, { name: DEFAULT });
1566
+ }
1567
+ Iterators$1[NAME] = defaultIterator;
1568
+
1569
+ return methods;
1570
+ };
1571
+
1572
+ var toIndexedObject = toIndexedObject$5;
1573
+ var addToUnscopables = addToUnscopables$1;
1574
+ var Iterators = iterators;
1575
+ var InternalStateModule = internalState;
1576
+ var defineProperty$1 = objectDefineProperty.f;
1577
+ var defineIterator = defineIterator$1;
1578
+ var DESCRIPTORS$1 = descriptors;
1579
+
1580
+ var ARRAY_ITERATOR = 'Array Iterator';
1581
+ var setInternalState = InternalStateModule.set;
1582
+ var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
1583
+
1584
+ // `Array.prototype.entries` method
1585
+ // https://tc39.es/ecma262/#sec-array.prototype.entries
1586
+ // `Array.prototype.keys` method
1587
+ // https://tc39.es/ecma262/#sec-array.prototype.keys
1588
+ // `Array.prototype.values` method
1589
+ // https://tc39.es/ecma262/#sec-array.prototype.values
1590
+ // `Array.prototype[@@iterator]` method
1591
+ // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
1592
+ // `CreateArrayIterator` internal method
1593
+ // https://tc39.es/ecma262/#sec-createarrayiterator
1594
+ var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
1595
+ setInternalState(this, {
1596
+ type: ARRAY_ITERATOR,
1597
+ target: toIndexedObject(iterated), // target
1598
+ index: 0, // next index
1599
+ kind: kind // kind
1600
+ });
1601
+ // `%ArrayIteratorPrototype%.next` method
1602
+ // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
1603
+ }, function () {
1604
+ var state = getInternalState(this);
1605
+ var target = state.target;
1606
+ var kind = state.kind;
1607
+ var index = state.index++;
1608
+ if (!target || index >= target.length) {
1609
+ state.target = undefined;
1610
+ return { value: undefined, done: true };
1611
+ }
1612
+ if (kind == 'keys') return { value: index, done: false };
1613
+ if (kind == 'values') return { value: target[index], done: false };
1614
+ return { value: [index, target[index]], done: false };
1615
+ }, 'values');
1616
+
1617
+ // argumentsList[@@iterator] is %ArrayProto_values%
1618
+ // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
1619
+ // https://tc39.es/ecma262/#sec-createmappedargumentsobject
1620
+ var values = Iterators.Arguments = Iterators.Array;
1621
+
1622
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1623
+ addToUnscopables('keys');
1624
+ addToUnscopables('values');
1625
+ addToUnscopables('entries');
1626
+
1627
+ // V8 ~ Chrome 45- bug
1628
+ if (DESCRIPTORS$1 && values.name !== 'values') try {
1629
+ defineProperty$1(values, 'name', { value: 'values' });
1630
+ } catch (error) { /* empty */ }
1631
+
1632
+ // iterable DOM collections
1633
+ // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
1634
+ var domIterables = {
1635
+ CSSRuleList: 0,
1636
+ CSSStyleDeclaration: 0,
1637
+ CSSValueList: 0,
1638
+ ClientRectList: 0,
1639
+ DOMRectList: 0,
1640
+ DOMStringList: 0,
1641
+ DOMTokenList: 1,
1642
+ DataTransferItemList: 0,
1643
+ FileList: 0,
1644
+ HTMLAllCollection: 0,
1645
+ HTMLCollection: 0,
1646
+ HTMLFormElement: 0,
1647
+ HTMLSelectElement: 0,
1648
+ MediaList: 0,
1649
+ MimeTypeArray: 0,
1650
+ NamedNodeMap: 0,
1651
+ NodeList: 1,
1652
+ PaintRequestList: 0,
1653
+ Plugin: 0,
1654
+ PluginArray: 0,
1655
+ SVGLengthList: 0,
1656
+ SVGNumberList: 0,
1657
+ SVGPathSegList: 0,
1658
+ SVGPointList: 0,
1659
+ SVGStringList: 0,
1660
+ SVGTransformList: 0,
1661
+ SourceBufferList: 0,
1662
+ StyleSheetList: 0,
1663
+ TextTrackCueList: 0,
1664
+ TextTrackList: 0,
1665
+ TouchList: 0
1666
+ };
1667
+
1668
+ // in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList`
1669
+ var documentCreateElement = documentCreateElement$2;
1670
+
1671
+ var classList = documentCreateElement('span').classList;
1672
+ var DOMTokenListPrototype$1 = classList && classList.constructor && classList.constructor.prototype;
1673
+
1674
+ var domTokenListPrototype = DOMTokenListPrototype$1 === Object.prototype ? undefined : DOMTokenListPrototype$1;
1675
+
1676
+ var global$4 = global$r;
1677
+ var DOMIterables = domIterables;
1678
+ var DOMTokenListPrototype = domTokenListPrototype;
1679
+ var ArrayIteratorMethods = es_array_iterator;
1680
+ var createNonEnumerableProperty = createNonEnumerableProperty$5;
1681
+ var wellKnownSymbol$2 = wellKnownSymbol$8;
1682
+
1683
+ var ITERATOR = wellKnownSymbol$2('iterator');
1684
+ var TO_STRING_TAG$2 = wellKnownSymbol$2('toStringTag');
1685
+ var ArrayValues = ArrayIteratorMethods.values;
1686
+
1687
+ var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
1688
+ if (CollectionPrototype) {
1689
+ // some Chrome versions have non-configurable methods on DOMTokenList
1690
+ if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
1691
+ createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);
1692
+ } catch (error) {
1693
+ CollectionPrototype[ITERATOR] = ArrayValues;
1694
+ }
1695
+ if (!CollectionPrototype[TO_STRING_TAG$2]) {
1696
+ createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG$2, COLLECTION_NAME);
1697
+ }
1698
+ if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
1699
+ // some Chrome versions have non-configurable methods on DOMTokenList
1700
+ if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {
1701
+ createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
1702
+ } catch (error) {
1703
+ CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
1704
+ }
1705
+ }
1706
+ }
1707
+ };
1708
+
1709
+ for (var COLLECTION_NAME in DOMIterables) {
1710
+ handlePrototype(global$4[COLLECTION_NAME] && global$4[COLLECTION_NAME].prototype, COLLECTION_NAME);
1711
+ }
1712
+
1713
+ handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
1714
+
1715
+ const Flexbox = _a => {
1716
+ var {
1717
+ alignContent,
1718
+ alignItems,
1719
+ alignSelf,
1720
+ children,
1721
+ justifyContent,
1722
+ flexDirection,
1723
+ flexWrap,
1724
+ className
1725
+ } = _a,
1726
+ props = __rest(_a, ["alignContent", "alignItems", "alignSelf", "children", "justifyContent", "flexDirection", "flexWrap", "className"]);
1727
+
1728
+ const [classes, setClasses] = useState(['d-flex']);
1729
+ const [flexClassName, setFlexClassName] = useState('d-flex'); // // update className when classes change
1730
+
1731
+ useLayoutEffect(() => {
1732
+ const newClassName = classes.join(' ');
1733
+ if (newClassName !== flexClassName) setFlexClassName(newClassName);
1734
+ }, [classes, flexClassName]); // // update classes when props change
1735
+
1736
+ useLayoutEffect(() => {
1737
+ const newClasses = ['d-flex'];
1738
+ alignItems && newClasses.push(`align-items-${alignItems}`);
1739
+ alignContent && newClasses.push(`align-content-${alignContent}`);
1740
+ alignSelf && newClasses.push(`align-self-${alignSelf}`);
1741
+ justifyContent && newClasses.push(`justify-content-${justifyContent}`);
1742
+ flexDirection && newClasses.push(`flex-${flexDirection}`);
1743
+ flexWrap && newClasses.push(`flex-${flexWrap}`);
1744
+ className && newClasses.push(className);
1745
+ setClasses(newClasses);
1746
+ }, [alignContent, alignItems, alignSelf, justifyContent, flexDirection, flexWrap, className]);
1747
+ return jsx("div", Object.assign({
1748
+ className: flexClassName
1749
+ }, props, {
1750
+ children: children
1751
+ }));
1752
+ };
1753
+
1754
+ function Card({
1755
+ children,
1756
+ header,
1757
+ footer
1758
+ }) {
1759
+ return jsxs("section", Object.assign({
1760
+ className: "card"
1761
+ }, {
1762
+ children: [jsx("header", {
1763
+ children: header
1764
+ }), children, jsx("footer", {
1765
+ children: footer
1766
+ })]
1767
+ }));
1768
+ }
1769
+
1770
+ const squareExclamationIcon = jsx("svg", Object.assign({
1771
+ viewBox: "0 0 24 24",
1772
+ fill: "none",
1773
+ xmlns: "http://www.w3.org/2000/svg",
1774
+ "aria-hidden": "true",
1775
+ focusable: "false"
1776
+ }, {
1777
+ children: jsx("path", {
1778
+ fillRule: "evenodd",
1779
+ clipRule: "evenodd",
1780
+ d: "M18.2857 4H5.71429C4.7675 4 4 4.7675 4 5.71429V18.2857C4 19.2325 4.7675 20 5.71429 20H18.2857C19.2325 20 20 19.2325 20 18.2857V5.71429C20 4.7675 19.2325 4 18.2857 4ZM10.8682 7.42857H13.1318C13.3777 7.42857 13.5731 7.635 13.5597 7.8805L13.2948 12.7376C13.2824 12.9649 13.0945 13.1429 12.8669 13.1429H11.1331C10.9055 13.1429 10.7176 12.9649 10.7052 12.7376L10.4402 7.8805C10.4269 7.635 10.6223 7.42857 10.8682 7.42857ZM12 17.0714C11.0927 17.0714 10.3571 16.3359 10.3571 15.4286C10.3571 14.5213 11.0927 13.7857 12 13.7857C12.9073 13.7857 13.6429 14.5213 13.6429 15.4286C13.6429 16.3359 12.9073 17.0714 12 17.0714Z",
1781
+ fill: "#333333"
1782
+ })
1783
+ }));
1784
+
1785
+ const squareInfoIcon = jsx("svg", Object.assign({
1786
+ viewBox: "0 0 24 24",
1787
+ fill: "none",
1788
+ xmlns: "http://www.w3.org/2000/svg"
1789
+ }, {
1790
+ children: jsx("path", {
1791
+ d: "M18.2857 4H5.71429C4.7675 4 4 4.7675 4 5.71429V18.2857C4 19.2325 4.7675 20 5.71429 20H18.2857C19.2325 20 20 19.2325 20 18.2857V5.71429C20 4.7675 19.2325 4 18.2857 4ZM12 7.07143C12.8284 7.07143 13.5 7.743 13.5 8.57143C13.5 9.39986 12.8284 10.0714 12 10.0714C11.1716 10.0714 10.5 9.39986 10.5 8.57143C10.5 7.743 11.1716 7.07143 12 7.07143ZM14 16.1429C14 16.3795 13.8081 16.5714 13.5714 16.5714H10.4286C10.1919 16.5714 10 16.3795 10 16.1429V15.2857C10 15.049 10.1919 14.8571 10.4286 14.8571H10.8571V12.5714H10.4286C10.1919 12.5714 10 12.3795 10 12.1429V11.2857C10 11.049 10.1919 10.8571 10.4286 10.8571H12.7143C12.951 10.8571 13.1429 11.049 13.1429 11.2857V14.8571H13.5714C13.8081 14.8571 14 15.049 14 15.2857V16.1429Z",
1792
+ fill: "#333333"
1793
+ })
1794
+ }));
1795
+
1796
+ const checkIcon = jsx("svg", Object.assign({
1797
+ width: "24",
1798
+ height: "24",
1799
+ viewBox: "0 0 24 24",
1800
+ fill: "none",
1801
+ xmlns: "http://www.w3.org/2000/svg"
1802
+ }, {
1803
+ children: jsx("path", {
1804
+ d: "M17.6203 6.60836L9.40014 14.8285L6.37976 11.8081C6.23332 11.6617 5.99588 11.6617 5.84942 11.8081L4.96554 12.692C4.8191 12.8384 4.8191 13.0759 4.96554 13.2223L9.13495 17.3917C9.28138 17.5382 9.51882 17.5382 9.66529 17.3917L19.0344 8.02258C19.1809 7.87614 19.1809 7.63871 19.0344 7.49224L18.1506 6.60836C18.0041 6.46193 17.7667 6.46193 17.6203 6.60836Z",
1805
+ fill: "white"
1806
+ })
1807
+ }));
1808
+
1809
+ function AlertRibbon({
1810
+ type,
1811
+ header,
1812
+ footer,
1813
+ children,
1814
+ closeText,
1815
+ isCloseable = true,
1816
+ onClose,
1817
+ role,
1818
+ "aria-live": ariaLive,
1819
+ closeAriaLabel
1820
+ }) {
1821
+ const [closeButton, setCloseButton] = useState();
1822
+ useEffect(() => {
1823
+ if (!isCloseable) {
1824
+ setCloseButton(null);
1825
+ } else {
1826
+ if (closeText) setCloseButton(jsxs("button", Object.assign({
1827
+ className: "close"
1828
+ }, {
1829
+ children: [jsx("span", Object.assign({
1830
+ className: "sr-only"
1831
+ }, {
1832
+ children: closeText
1833
+ })), jsx("i", {})]
1834
+ })));else setCloseButton(jsxs("button", Object.assign({
1835
+ className: "close"
1836
+ }, {
1837
+ children: [jsx("span", Object.assign({
1838
+ className: "sr-only"
1839
+ }, {
1840
+ children: "Close"
1841
+ })), jsx("i", {})]
1842
+ })));
1843
+ }
1844
+ }, [isCloseable, closeText]);
1845
+
1846
+ const renderIcon = () => {
1847
+ switch (type) {
1848
+ case "danger":
1849
+ case "warning":
1850
+ return squareExclamationIcon;
1851
+
1852
+ case "success":
1853
+ return checkIcon;
1854
+
1855
+ default:
1856
+ return squareInfoIcon;
1857
+ }
1858
+ };
1859
+
1860
+ return jsxs("div", Object.assign({
1861
+ className: `alert-ribbon ${type}`,
1862
+ role: role,
1863
+ "aria-live": ariaLive
1864
+ }, {
1865
+ children: [jsx("i", Object.assign({
1866
+ "aria-hidden": "true"
1867
+ }, {
1868
+ children: renderIcon()
1869
+ })), jsxs("div", Object.assign({
1870
+ className: "alert-ribbon__content"
1871
+ }, {
1872
+ children: [header && /*#__PURE__*/React.isValidElement(header) ? header : jsx("span", Object.assign({
1873
+ className: "header"
1874
+ }, {
1875
+ children: header
1876
+ })), jsx("p", {
1877
+ children: children
1878
+ })]
1879
+ })), closeButton && jsx("button", Object.assign({
1880
+ className: "close",
1881
+ type: "button",
1882
+ "aria-label": closeAriaLabel !== null && closeAriaLabel !== void 0 ? closeAriaLabel : "Close alert",
1883
+ onClick: event => {
1884
+ onClose && onClose(event);
1885
+ }
1886
+ }, {
1887
+ children: jsx("i", {})
1888
+ })), footer && jsxs("div", Object.assign({
1889
+ className: "alert-ribbon__footer"
1890
+ }, {
1891
+ children: [" ", footer, " "]
1892
+ }))]
1893
+ }));
1894
+ }
1895
+
1896
+ const ButtonGroup = ({
1897
+ children,
1898
+ selectedIndex,
1899
+ variant
1900
+ }) => {
1901
+ const [selected, setSelected] = useState(selectedIndex);
1902
+ const [buttons, setButtons] = useState([]);
1903
+ useEffect(() => {
1904
+ const buttonProps = (children instanceof Array ? children : [children]).filter(b => b && b.props).map((b, ix) => {
1905
+ const bp = b.props;
1906
+ const props = Object.assign(Object.assign({}, bp), {
1907
+ variant,
1908
+ key: bp.key || `btn_${ix}`,
1909
+ active: ix === selected,
1910
+ onClick: e => {
1911
+ setSelected(ix);
1912
+ if (bp.onClick) bp.onClick(e);
1913
+ }
1914
+ });
1915
+ return props;
1916
+ });
1917
+ setButtons(buttonProps);
1918
+ }, [children, selected, variant]);
1919
+ return jsx(Group, {
1920
+ children: buttons.map(props => jsx(Button, Object.assign({}, props), props.key))
1921
+ });
1922
+ };
1923
+
1924
+ /* eslint-disable-next-line */
1925
+ const validateInputValue = (target, rules, setError) => {
1926
+ const errorMessage = validateInputValueErrors(rules, target);
1927
+ errorMessage ? setErrorInsert(setError, target.name) : setErrorRemove(setError, target.name);
1928
+ return errorMessage;
1929
+ };
1930
+
1931
+ const validateInputValueErrors = (rules, target) => {
1932
+ const {
1933
+ value
1934
+ } = target;
1935
+
1936
+ if ((rules === null || rules === void 0 ? void 0 : rules.custom) instanceof Function) {
1937
+ return rules === null || rules === void 0 ? void 0 : rules.custom();
1938
+ }
1939
+
1940
+ return validateTextInputValues(value, rules);
1941
+ };
1942
+ /* eslint-disable-next-line */
1943
+
1944
+
1945
+ const setErrorInsert = (setError, name) => {
1946
+ /* eslint-disable-next-line */
1947
+ setError(errors => {
1948
+ return Object.assign(Object.assign({}, errors), {
1949
+ [name]: true
1950
+ });
1951
+ });
1952
+ };
1953
+ /* eslint-disable-next-line */
1954
+
1955
+
1956
+ const setErrorRemove = (setError, name) => {
1957
+ /* eslint-disable-next-line */
1958
+ setError(errors => {
1959
+ /* eslint-disable-next-line */
1960
+ const newError = Object.assign({}, errors);
1961
+ delete newError[name];
1962
+ return newError;
1963
+ });
1964
+ };
1965
+
1966
+ const validateTextInputValues = (value, rules) => {
1967
+ switch (rules === null || rules === void 0 ? void 0 : rules.type) {
1968
+ case 'Required':
1969
+ {
1970
+ return value === '' || value === undefined || value === null ? 'error' : null;
1971
+ }
1972
+
1973
+ default:
1974
+ {
1975
+ return;
1976
+ }
1977
+ }
1978
+ };
1979
+
1980
+ const FormContext = /*#__PURE__*/React.createContext({});
1981
+ const useFormContext = () => {
1982
+ return React.useContext(FormContext);
1983
+ };
1984
+ const FormProvider = _a => {
1985
+ var {
1986
+ children,
1987
+ direction = 'vertical',
1988
+ formSize = 'md',
1989
+ onSubmit,
1990
+ onFormSubmit
1991
+ } = _a,
1992
+ props = __rest(_a, ["children", "direction", "formSize", "onSubmit", "onFormSubmit"]);
1993
+ /* eslint-disable-next-line */
1994
+
1995
+
1996
+ const [values, setValues] = React.useState();
1997
+ /* eslint-disable-next-line */
1998
+
1999
+ const [errors, setErrors] = React.useState();
2000
+ /* eslint-disable-next-line */
2001
+
2002
+ const [fields, setFields] = React.useState({});
2003
+
2004
+ const formSubmit = event => {
2005
+ let hasError = false;
2006
+ event.preventDefault();
2007
+ Object.keys(fields).forEach(key => {
2008
+ const errorMessage = validateInputValue({
2009
+ name: key,
2010
+ value: values === null || values === void 0 ? void 0 : values[key]
2011
+ }, fields[key], setErrors);
2012
+ hasError = hasError || !!errorMessage;
2013
+ });
2014
+
2015
+ if (!hasError) {
2016
+ onFormSubmit && onFormSubmit(values);
2017
+ }
2018
+ };
2019
+
2020
+ const resetForm = () => {
2021
+ setValues({});
2022
+ setErrors({});
2023
+ };
2024
+
2025
+ return jsx(FormContext.Provider, Object.assign({
2026
+ value: {
2027
+ setValues,
2028
+ setErrors,
2029
+ setFields,
2030
+ errors,
2031
+ values
2032
+ }
2033
+ }, {
2034
+ children: jsx("form", Object.assign({
2035
+ className: [direction, `size-${formSize}`].join(' '),
2036
+ onSubmit: formSubmit
2037
+ }, props, {
2038
+ onReset: resetForm
2039
+ }, {
2040
+ children: children
2041
+ }))
2042
+ }));
2043
+ };
2044
+
2045
+ const Form = props => {
2046
+ return jsx(FormProvider, Object.assign({}, props));
2047
+ };
2048
+
2049
+ const FormItems = ({
2050
+ children,
2051
+ validate,
2052
+ name
2053
+ }) => {
2054
+ const {
2055
+ setValues,
2056
+ setErrors,
2057
+ setFields,
2058
+ errors
2059
+ } = useFormContext();
2060
+ React.useEffect(() => {
2061
+ /* eslint-disable-next-line */
2062
+ setFields(fields => Object.assign(Object.assign({}, fields), {
2063
+ [name]: validate === null || validate === void 0 ? void 0 : validate.rules
2064
+ }));
2065
+ /* eslint-disable-next-line */
2066
+
2067
+ const removeValues = values => {
2068
+ /* eslint-disable-next-line */
2069
+ const newValues = Object.assign({}, values);
2070
+ delete newValues[name];
2071
+ return newValues;
2072
+ };
2073
+
2074
+ return () => {
2075
+ /* eslint-disable-next-line */
2076
+ setFields(fields => removeValues(fields));
2077
+ /* eslint-disable-next-line */
2078
+
2079
+ setValues(values => removeValues(values));
2080
+ /* eslint-disable-next-line */
2081
+
2082
+ setErrors(errors => removeValues(errors));
2083
+ }; // eslint-disable-next-line react-hooks/exhaustive-deps
2084
+ }, []);
2085
+
2086
+ const onChange = event => {
2087
+ if (!event.target) return;
2088
+ const {
2089
+ value,
2090
+ name,
2091
+ type,
2092
+ checked
2093
+ } = event.target;
2094
+ let inputValue;
2095
+
2096
+ if (type === 'checkbox') {
2097
+ inputValue = checked ? value : null;
2098
+ /* eslint-disable-next-line */
2099
+
2100
+ checked ? setValues(values => Object.assign(Object.assign({}, values), {
2101
+ [name]: value
2102
+ })) : setValues(values => Object.assign(Object.assign({}, values), {
2103
+ [name]: null
2104
+ }));
2105
+ } else {
2106
+ inputValue = value;
2107
+ /* eslint-disable-next-line */
2108
+
2109
+ setValues(values => Object.assign(Object.assign({}, values), {
2110
+ [name]: value
2111
+ }));
2112
+ }
2113
+
2114
+ validateInputValue({
2115
+ value: inputValue,
2116
+ name,
2117
+ type,
2118
+ checked
2119
+ }, validate === null || validate === void 0 ? void 0 : validate.rules, setErrors);
2120
+ };
2121
+ /* eslint-disable-next-line */
2122
+
2123
+
2124
+ return /*#__PURE__*/React.cloneElement(children, {
2125
+ validator: (errors === null || errors === void 0 ? void 0 : errors[name]) && validate,
2126
+ name,
2127
+ onChange
2128
+ });
2129
+ };
2130
+
2131
+ function Group({
2132
+ children,
2133
+ error,
2134
+ groupBorder = false
2135
+ }) {
2136
+ const groupClassName = `group ${groupBorder ? 'group-border' : ''} ${error ? 'is-invalid' : ''}`;
2137
+ const errorMessage = error ? error.message || error : '';
2138
+ return jsxs("div", Object.assign({
2139
+ className: "form-group"
2140
+ }, {
2141
+ children: [jsx("div", Object.assign({
2142
+ className: groupClassName
2143
+ }, {
2144
+ children: children
2145
+ })), error && jsx("span", Object.assign({
2146
+ className: "form-info"
2147
+ }, {
2148
+ children: errorMessage
2149
+ }))]
2150
+ }));
2151
+ }
2152
+
2153
+ const useInput = (props, onChanges, onChangeInput) => {
2154
+ const id = useMemo(() => props.id || randomId(), [props.id]);
2155
+ const ref = useRef(null);
2156
+ const [value, setValue] = useState(props.value ? props.value : '');
2157
+ const [checked, setChecked] = useState(props.checked ? props.checked : false);
2158
+ useEffect(() => {
2159
+ if (ref.current && ref.current.form) {
2160
+ const resetListener = () => {
2161
+ setValue(props.value ? props.value : '');
2162
+ setChecked(props.checked ? props.checked : false);
2163
+ };
2164
+
2165
+ const form = ref.current.form;
2166
+ form.addEventListener('reset', resetListener);
2167
+ return () => form.removeEventListener('reset', resetListener);
2168
+ } else {
2169
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
2170
+ return () => {};
2171
+ }
2172
+ }, [props]);
2173
+
2174
+ const onChange = event => {
2175
+ setValue(event.target.value);
2176
+ setChecked(event.currentTarget.checked);
2177
+ onChanges && onChanges(event);
2178
+ onChangeInput && onChangeInput(event.target.value);
2179
+ };
2180
+
2181
+ return Object.assign(Object.assign({}, props), {
2182
+ id,
2183
+ ref,
2184
+ value,
2185
+ checked,
2186
+ onChange
2187
+ });
2188
+ };
2189
+
2190
+ const RenderInput = (type, props, onChange, onChangeInput, label, info, validator) => {
2191
+ const _a = useInput(props, onChange, onChangeInput),
2192
+ {
2193
+ value
2194
+ } = _a,
2195
+ inputProps = __rest(_a, ["value"]);
2196
+
2197
+ const propsWithDescription = info ? Object.assign(Object.assign({}, inputProps), {
2198
+ 'aria-describedby': `${inputProps.id}_info`
2199
+ }) : inputProps; // Render naked
2200
+
2201
+ if (!label && !info) return jsx("input", Object.assign({
2202
+ type: type,
2203
+ value: value
2204
+ }, propsWithDescription));
2205
+ return jsxs("div", Object.assign({
2206
+ className: "form-group"
2207
+ }, {
2208
+ children: [label && jsx("label", Object.assign({
2209
+ htmlFor: inputProps.id
2210
+ }, {
2211
+ children: label
2212
+ })), info && jsx("span", Object.assign({
2213
+ className: "form-info",
2214
+ id: `${inputProps.id}_info`
2215
+ }, {
2216
+ children: info
2217
+ })), jsx("input", Object.assign({
2218
+ type: type,
2219
+ value: value
2220
+ }, propsWithDescription, {
2221
+ className: validator && validateClassName(validator === null || validator === void 0 ? void 0 : validator.indicator)
2222
+ })), validator && jsx("span", Object.assign({
2223
+ className: "form-info"
2224
+ }, {
2225
+ children: validator.message
2226
+ }))]
2227
+ }));
2228
+ };
2229
+ const TextInput = _a => {
2230
+ var {
2231
+ label,
2232
+ info,
2233
+ onChange,
2234
+ onChangeInput,
2235
+ validator
2236
+ } = _a,
2237
+ props = __rest(_a, ["label", "info", "onChange", "onChangeInput", "validator"]);
2238
+
2239
+ return RenderInput('text', props, onChange, onChangeInput, label, info, validator);
2240
+ };
2241
+ const EmailInput = _a => {
2242
+ var {
2243
+ label,
2244
+ info,
2245
+ onChange,
2246
+ onChangeInput,
2247
+ validator
2248
+ } = _a,
2249
+ props = __rest(_a, ["label", "info", "onChange", "onChangeInput", "validator"]);
2250
+
2251
+ return RenderInput('email', props, onChange, onChangeInput, label, info, validator);
2252
+ };
2253
+ const NumberInput = _a => {
2254
+ var {
2255
+ label,
2256
+ info,
2257
+ onChange,
2258
+ onChangeInput,
2259
+ validator
2260
+ } = _a,
2261
+ props = __rest(_a, ["label", "info", "onChange", "onChangeInput", "validator"]);
2262
+
2263
+ return RenderInput('number', props, onChange, onChangeInput, label, info, validator);
2264
+ };
2265
+ const Checkbox = _a => {
2266
+ var {
2267
+ label,
2268
+ onChange,
2269
+ validator
2270
+ } = _a,
2271
+ props = __rest(_a, ["label", "onChange", "validator"]);
2272
+
2273
+ const inputProps = useInput(props, onChange);
2274
+ const validatorClassName = validateClassName(validator === null || validator === void 0 ? void 0 : validator.indicator);
2275
+ return jsxs("div", Object.assign({
2276
+ className: "form-group"
2277
+ }, {
2278
+ children: [jsxs("label", Object.assign({
2279
+ htmlFor: inputProps.id,
2280
+ className: `form-control ${validatorClassName}`
2281
+ }, {
2282
+ children: [label, jsx("input", Object.assign({
2283
+ type: "checkbox"
2284
+ }, inputProps, {
2285
+ className: validatorClassName
2286
+ })), jsx("i", {})]
2287
+ })), validator && jsx("span", Object.assign({
2288
+ className: "form-info"
2289
+ }, {
2290
+ children: validator.message
2291
+ }))]
2292
+ }));
2293
+ };
2294
+ const RadioButton = /*#__PURE__*/React.forwardRef((_a, ref) => {
2295
+ var {
2296
+ label,
2297
+ validator
2298
+ } = _a,
2299
+ props = __rest(_a, ["label", "validator"]);
2300
+
2301
+ const {
2302
+ id
2303
+ } = useInput(props);
2304
+ return jsxs("label", Object.assign({
2305
+ htmlFor: id,
2306
+ className: "form-control"
2307
+ }, {
2308
+ children: [jsx("input", Object.assign({
2309
+ id: id,
2310
+ type: "radio"
2311
+ }, props, {
2312
+ className: validator,
2313
+ ref: ref
2314
+ })), jsx("span", {
2315
+ children: label
2316
+ }), jsx("i", {})]
2317
+ }));
2318
+ });
2319
+
2320
+ const Text = ({
2321
+ children
2322
+ }) => jsx("span", Object.assign({
2323
+ className: "form-text"
2324
+ }, {
2325
+ children: children
2326
+ }));
2327
+
2328
+ var wellKnownSymbol$1 = wellKnownSymbol$8;
2329
+
2330
+ var TO_STRING_TAG$1 = wellKnownSymbol$1('toStringTag');
2331
+ var test = {};
2332
+
2333
+ test[TO_STRING_TAG$1] = 'z';
2334
+
2335
+ var toStringTagSupport = String(test) === '[object z]';
2336
+
2337
+ var global$3 = global$r;
2338
+ var TO_STRING_TAG_SUPPORT = toStringTagSupport;
2339
+ var isCallable$1 = isCallable$f;
2340
+ var classofRaw = classofRaw$1;
2341
+ var wellKnownSymbol = wellKnownSymbol$8;
2342
+
2343
+ var TO_STRING_TAG = wellKnownSymbol('toStringTag');
2344
+ var Object$1 = global$3.Object;
2345
+
2346
+ // ES3 wrong here
2347
+ var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
2348
+
2349
+ // fallback for IE11 Script Access Denied error
2350
+ var tryGet = function (it, key) {
2351
+ try {
2352
+ return it[key];
2353
+ } catch (error) { /* empty */ }
2354
+ };
2355
+
2356
+ // getting tag from ES6+ `Object.prototype.toString`
2357
+ var classof$1 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
2358
+ var O, tag, result;
2359
+ return it === undefined ? 'Undefined' : it === null ? 'Null'
2360
+ // @@toStringTag case
2361
+ : typeof (tag = tryGet(O = Object$1(it), TO_STRING_TAG)) == 'string' ? tag
2362
+ // builtinTag case
2363
+ : CORRECT_ARGUMENTS ? classofRaw(O)
2364
+ // ES3 arguments fallback
2365
+ : (result = classofRaw(O)) == 'Object' && isCallable$1(O.callee) ? 'Arguments' : result;
2366
+ };
2367
+
2368
+ var global$2 = global$r;
2369
+ var classof = classof$1;
2370
+
2371
+ var String$1 = global$2.String;
2372
+
2373
+ var toString$1 = function (argument) {
2374
+ if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
2375
+ return String$1(argument);
2376
+ };
2377
+
2378
+ var $ = _export;
2379
+ var DESCRIPTORS = descriptors;
2380
+ var global$1 = global$r;
2381
+ var uncurryThis = functionUncurryThis;
2382
+ var hasOwn = hasOwnProperty_1;
2383
+ var isCallable = isCallable$f;
2384
+ var isPrototypeOf = objectIsPrototypeOf;
2385
+ var toString = toString$1;
2386
+ var defineProperty = objectDefineProperty.f;
2387
+ var copyConstructorProperties = copyConstructorProperties$2;
2388
+
2389
+ var NativeSymbol = global$1.Symbol;
2390
+ var SymbolPrototype = NativeSymbol && NativeSymbol.prototype;
2391
+
2392
+ if (DESCRIPTORS && isCallable(NativeSymbol) && (!('description' in SymbolPrototype) ||
2393
+ // Safari 12 bug
2394
+ NativeSymbol().description !== undefined
2395
+ )) {
2396
+ var EmptyStringDescriptionStore = {};
2397
+ // wrap Symbol constructor for correct work with undefined description
2398
+ var SymbolWrapper = function Symbol() {
2399
+ var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString(arguments[0]);
2400
+ var result = isPrototypeOf(SymbolPrototype, this)
2401
+ ? new NativeSymbol(description)
2402
+ // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
2403
+ : description === undefined ? NativeSymbol() : NativeSymbol(description);
2404
+ if (description === '') EmptyStringDescriptionStore[result] = true;
2405
+ return result;
2406
+ };
2407
+
2408
+ copyConstructorProperties(SymbolWrapper, NativeSymbol);
2409
+ SymbolWrapper.prototype = SymbolPrototype;
2410
+ SymbolPrototype.constructor = SymbolWrapper;
2411
+
2412
+ var NATIVE_SYMBOL = String(NativeSymbol('test')) == 'Symbol(test)';
2413
+ var symbolToString = uncurryThis(SymbolPrototype.toString);
2414
+ var symbolValueOf = uncurryThis(SymbolPrototype.valueOf);
2415
+ var regexp = /^Symbol\((.*)\)[^)]+$/;
2416
+ var replace = uncurryThis(''.replace);
2417
+ var stringSlice = uncurryThis(''.slice);
2418
+
2419
+ defineProperty(SymbolPrototype, 'description', {
2420
+ configurable: true,
2421
+ get: function description() {
2422
+ var symbol = symbolValueOf(this);
2423
+ var string = symbolToString(symbol);
2424
+ if (hasOwn(EmptyStringDescriptionStore, symbol)) return '';
2425
+ var desc = NATIVE_SYMBOL ? stringSlice(string, 7, -1) : replace(string, regexp, '$1');
2426
+ return desc === '' ? undefined : desc;
2427
+ }
2428
+ });
2429
+
2430
+ $({ global: true, forced: true }, {
2431
+ Symbol: SymbolWrapper
2432
+ });
2433
+ }
2434
+
2435
+ const RadioGroup = ({
2436
+ defaultSelected,
2437
+ description,
2438
+ title,
2439
+ validator,
2440
+ onChangeRadio,
2441
+ onChange,
2442
+ name,
2443
+ children
2444
+ }) => {
2445
+ const [checked, setChecked] = React.useState();
2446
+ const validatorClassName = validateClassName(validator === null || validator === void 0 ? void 0 : validator.indicator);
2447
+
2448
+ const onChanges = event => {
2449
+ setChecked(event.target.value);
2450
+ onChangeRadio && onChangeRadio(event.target.value);
2451
+ onChange && onChange(event);
2452
+ };
2453
+
2454
+ const radioBtnRef = React.useRef(null);
2455
+ React.useEffect(() => {
2456
+ var _a;
2457
+
2458
+ if (radioBtnRef && radioBtnRef.current) {
2459
+ if (defaultSelected) setChecked(defaultSelected);
2460
+ const form = (_a = radioBtnRef === null || radioBtnRef === void 0 ? void 0 : radioBtnRef.current) === null || _a === void 0 ? void 0 : _a.form;
2461
+
2462
+ const resetListner = () => {
2463
+ setChecked(undefined);
2464
+ };
2465
+
2466
+ form === null || form === void 0 ? void 0 : form.addEventListener('reset', resetListner);
2467
+ return () => form === null || form === void 0 ? void 0 : form.removeEventListener('reset', resetListner);
2468
+ } else {
2469
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
2470
+ return () => {};
2471
+ } // eslint-disable-next-line react-hooks/exhaustive-deps
2472
+
2473
+ }, []);
2474
+ return jsxs("div", Object.assign({
2475
+ className: "form-group"
2476
+ }, {
2477
+ children: [jsxs("fieldset", Object.assign({
2478
+ className: validatorClassName
2479
+ }, {
2480
+ children: [title && jsx("legend", {
2481
+ children: title
2482
+ }), description && jsx("span", Object.assign({
2483
+ className: "form-info"
2484
+ }, {
2485
+ children: description
2486
+ })), jsx("div", {
2487
+ children: React.Children.map(children, Child => {
2488
+ return /*#__PURE__*/React.isValidElement(Child) ? /*#__PURE__*/React.cloneElement(Child, {
2489
+ validator: validatorClassName,
2490
+ onChange: onChanges,
2491
+ checked: checked === Child.props.value,
2492
+ name,
2493
+ ref: radioBtnRef
2494
+ }) : Child;
2495
+ })
2496
+ })]
2497
+ })), (validator === null || validator === void 0 ? void 0 : validator.message) && jsx("span", Object.assign({
2498
+ className: "form-info"
2499
+ }, {
2500
+ children: validator === null || validator === void 0 ? void 0 : validator.message
2501
+ }))]
2502
+ }));
2503
+ };
2504
+
2505
+ const ListItem = _a => {
2506
+ var {
2507
+ listType,
2508
+ tableRowData,
2509
+ children
2510
+ } = _a,
2511
+ props = __rest(_a, ["listType", "tableRowData", "children"]);
2512
+
2513
+ if (listType === 'table') {
2514
+ return jsx("dl", {
2515
+ children: jsxs("div", {
2516
+ children: [jsx("dt", {
2517
+ children: tableRowData === null || tableRowData === void 0 ? void 0 : tableRowData.title
2518
+ }), tableRowData === null || tableRowData === void 0 ? void 0 : tableRowData.definition.map((item, index) => jsx("dd", {
2519
+ children: item
2520
+ }, index))]
2521
+ })
2522
+ });
2523
+ } else {
2524
+ return jsx("li", Object.assign({}, props, {
2525
+ children: children
2526
+ }));
2527
+ }
2528
+ };
2529
+
2530
+ const List = _a => {
2531
+ var {
2532
+ listType,
2533
+ tableCaption,
2534
+ tableData,
2535
+ children
2536
+ } = _a,
2537
+ props = __rest(_a, ["listType", "tableCaption", "tableData", "children"]);
2538
+
2539
+ if (listType === 'ordered') {
2540
+ return jsx("ol", Object.assign({}, props, {
2541
+ children: children === null || children === void 0 ? void 0 : children.map((child, index) => jsx(ListItem, {
2542
+ children: child
2543
+ }, index))
2544
+ }));
2545
+ } else if (listType !== 'table') {
2546
+ return jsx("ul", Object.assign({}, props, {
2547
+ className: listType
2548
+ }, {
2549
+ children: children === null || children === void 0 ? void 0 : children.map((child, index) => jsx(ListItem, {
2550
+ children: child
2551
+ }, index))
2552
+ }));
2553
+ } else {
2554
+ return jsxs("figure", {
2555
+ children: [jsx("figcaption", Object.assign({
2556
+ className: "table-list-caption"
2557
+ }, {
2558
+ children: tableCaption
2559
+ })), jsx("dl", {
2560
+ children: tableData === null || tableData === void 0 ? void 0 : tableData.map((data, index) => jsx(ListItem, {
2561
+ listType: listType,
2562
+ tableRowData: data
2563
+ }, index))
2564
+ })]
2565
+ });
2566
+ }
2567
+ };
2568
+
2569
+ const Link = _a => {
2570
+ var {
2571
+ button,
2572
+ children
2573
+ } = _a,
2574
+ props = __rest(_a, ["button", "children"]);
2575
+
2576
+ const [anchorProps, setAnchorProps] = useState({});
2577
+ useEffect(() => {
2578
+ const className = button ? typeof button === 'string' ? `button ${button}` : 'button' : undefined;
2579
+ const newProps = Object.assign({
2580
+ role: button ? 'button' : undefined,
2581
+ className: className
2582
+ }, props);
2583
+ setAnchorProps(newProps); // eslint-disable-next-line react-hooks/exhaustive-deps
2584
+ }, [button]);
2585
+ return jsx("a", Object.assign({}, anchorProps, {
2586
+ children: children
2587
+ }));
2588
+ };
2589
+
2590
+ const Navbar = ({
2591
+ children,
2592
+ variant,
2593
+ title,
2594
+ titleLink,
2595
+ brandLink: _brandLink = 'https://www.seb.se',
2596
+ brandAriaLabel: _brandAriaLabel = 'Open seb.se in new tab'
2597
+ }) => {
2598
+ const [props, setProps] = useState({});
2599
+ useEffect(() => {
2600
+ const classNames = [];
2601
+ if (variant) classNames.push(variant);
2602
+ setProps(Object.assign(Object.assign({}, props), {
2603
+ className: classNames.join(' ')
2604
+ })); // eslint-disable-next-line react-hooks/exhaustive-deps
2605
+ }, [variant]);
2606
+ return jsxs("nav", Object.assign({
2607
+ role: "navigation"
2608
+ }, props, {
2609
+ children: [jsx(Link, {
2610
+ "aria-label": _brandAriaLabel,
2611
+ href: _brandLink,
2612
+ target: "_blank",
2613
+ className: "brand"
2614
+ }), jsx("div", Object.assign({
2615
+ className: "container-fluid"
2616
+ }, {
2617
+ children: jsxs("div", Object.assign({
2618
+ className: "row justify-content-between align-items-center"
2619
+ }, {
2620
+ children: [jsx("div", Object.assign({
2621
+ className: "col-auto"
2622
+ }, {
2623
+ children: titleLink ? jsx(Link, Object.assign({
2624
+ className: "mx-4",
2625
+ href: titleLink
2626
+ }, {
2627
+ children: jsx("h1", {
2628
+ children: title
2629
+ })
2630
+ })) : jsx("h1", {
2631
+ children: title
2632
+ })
2633
+ })), jsx("div", Object.assign({
2634
+ className: "col-auto"
2635
+ }, {
2636
+ children: jsx("div", Object.assign({
2637
+ className: "group size-sm"
2638
+ }, {
2639
+ children: children
2640
+ }))
2641
+ }))]
2642
+ }))
2643
+ }))]
2644
+ }));
2645
+ };
2646
+
2647
+ function Badge(_a) {
2648
+ var {
2649
+ children,
2650
+ badgeType,
2651
+ isCloseable,
2652
+ closeText,
2653
+ customColor,
2654
+ customBackgroundColor
2655
+ } = _a,
2656
+ props = __rest(_a, ["children", "badgeType", "isCloseable", "closeText", "customColor", "customBackgroundColor"]);
2657
+
2658
+ const [isClosed, setIsClosed] = React.useState(false);
2659
+ const [type, setType] = React.useState('');
2660
+ React.useEffect(() => {
2661
+ if (badgeType) {
2662
+ setType(badgeType);
2663
+ }
2664
+
2665
+ if (!!customColor || !!customBackgroundColor) {
2666
+ setType('');
2667
+ }
2668
+ }, [badgeType, customColor, customBackgroundColor]);
2669
+ return !isClosed ? jsxs("span", Object.assign({}, props, {
2670
+ className: `badge ${type}`,
2671
+ style: {
2672
+ color: customColor,
2673
+ backgroundColor: customBackgroundColor
2674
+ }
2675
+ }, {
2676
+ children: [jsx("strong", {
2677
+ children: children
2678
+ }), isCloseable && jsxs("button", Object.assign({
2679
+ type: "button",
2680
+ className: "close",
2681
+ onClick: () => setIsClosed(true)
2682
+ }, {
2683
+ children: [closeText, jsx("i", {})]
2684
+ }))]
2685
+ })) : null;
2686
+ }
2687
+
2688
+ const noop = () => {};
2689
+
2690
+ const useStepper = ({
2691
+ min,
2692
+ max,
2693
+ value: _value = 0,
2694
+ step: _step = 1,
2695
+ id: _id = randomId(),
2696
+ onChange
2697
+ }) => {
2698
+ const pStepper = {
2699
+ down: noop,
2700
+ setMax: noop,
2701
+ setMin: noop,
2702
+ setStep: noop,
2703
+ setValue: noop,
2704
+ up: noop
2705
+ };
2706
+ const [stepper, setStepper] = useState(pStepper);
2707
+ const [data, setData] = useState({
2708
+ id: _id,
2709
+ value: _value,
2710
+ min,
2711
+ max,
2712
+ step: _step
2713
+ }); // eslint-disable-next-line react-hooks/exhaustive-deps
2714
+
2715
+ useEffect(() => {
2716
+ if (max !== data.max) stepper.setMax(max);
2717
+ }, [stepper, max]); // eslint-disable-next-line react-hooks/exhaustive-deps
2718
+
2719
+ useEffect(() => {
2720
+ if (min !== data.min) stepper.setMin(min);
2721
+ }, [stepper, min]); // eslint-disable-next-line react-hooks/exhaustive-deps
2722
+
2723
+ useEffect(() => {
2724
+ if (_step !== data.step) stepper.setStep(_step || 1);
2725
+ }, [stepper, _step]); // eslint-disable-next-line react-hooks/exhaustive-deps
2726
+
2727
+ useEffect(() => {
2728
+ if (_value !== data.value) stepper.setValue(_value || 0, false);
2729
+ }, [stepper, _value]);
2730
+ useEffect(() => {
2731
+ setStepper(createStepper({
2732
+ id: _id,
2733
+ value: _value,
2734
+ min,
2735
+ max,
2736
+ step: _step,
2737
+ onChange
2738
+ }, setData)); // eslint-disable-next-line react-hooks/exhaustive-deps
2739
+ }, []);
2740
+ return [stepper, data];
2741
+ };
2742
+
2743
+ function Stepper(_a) {
2744
+ var {
2745
+ label,
2746
+ description,
2747
+ statusMessage,
2748
+ validator
2749
+ } = _a,
2750
+ stepperArgs = __rest(_a, ["label", "description", "statusMessage", "validator"]);
2751
+
2752
+ const [stepper, data] = useStepper(stepperArgs);
2753
+
2754
+ const onChangeEvent = e => {
2755
+ stepper.setValue(e.target.valueAsNumber);
2756
+ };
2757
+
2758
+ const PrimitiveStepper = jsxs("div", Object.assign({
2759
+ className: `group group-border group-stepper ${validator && validateClassName(validator === null || validator === void 0 ? void 0 : validator.indicator)}`
2760
+ }, {
2761
+ children: [jsx("button", Object.assign({
2762
+ onClick: () => stepper.down()
2763
+ }, {
2764
+ children: "-"
2765
+ })), jsx("input", {
2766
+ id: data.id,
2767
+ type: "number",
2768
+ onChange: onChangeEvent,
2769
+ onFocus: ({
2770
+ target
2771
+ }) => target.select(),
2772
+ placeholder: "0",
2773
+ value: data.value
2774
+ }), jsx("button", Object.assign({
2775
+ onClick: () => stepper.up()
2776
+ }, {
2777
+ children: "+"
2778
+ }))]
2779
+ }));
2780
+
2781
+ if (!label && !description && !statusMessage && !validator) return PrimitiveStepper;
2782
+ return jsxs("div", Object.assign({
2783
+ className: "form-group"
2784
+ }, {
2785
+ children: [label && jsx("label", Object.assign({
2786
+ htmlFor: data.id
2787
+ }, {
2788
+ children: label
2789
+ })), description && jsx("span", Object.assign({
2790
+ className: "form-info"
2791
+ }, {
2792
+ children: description
2793
+ })), jsxs("div", Object.assign({
2794
+ className: "stepper-wrapper"
2795
+ }, {
2796
+ children: [PrimitiveStepper, validator && jsx("span", Object.assign({
2797
+ className: "form-info"
2798
+ }, {
2799
+ children: validator.message
2800
+ }))]
2801
+ }))]
2802
+ }));
2803
+ }
2804
+
2805
+ const useDropdown = ({
2806
+ id,
2807
+ value,
2808
+ texts,
2809
+ options,
2810
+ loop,
2811
+ multiSelect,
2812
+ searchable,
2813
+ searchFilter,
2814
+ compareWith,
2815
+ useValue,
2816
+ display,
2817
+ togglerRef,
2818
+ listboxRef,
2819
+ onChange,
2820
+ validator
2821
+ }) => {
2822
+ const [handler, setHandler] = useState();
2823
+ const [dropdown, setDropdown] = useState();
2824
+ const [togglerProps, setTogglerProps] = useState({});
2825
+ const [listboxProps, setListboxProps] = useState({});
2826
+ const [listItems, setListItems] = useState([]);
2827
+ const [multiSelectProps, setMultiSelectProps] = useState({}); // When dropdown data changes
2828
+
2829
+ useEffect(() => {
2830
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
2831
+
2832
+ if (!dropdown) return;
2833
+ const {
2834
+ elements: {
2835
+ toggler,
2836
+ listbox
2837
+ }
2838
+ } = dropdown;
2839
+ const newToggleProps = Object.assign(Object.assign({}, toggler === null || toggler === void 0 ? void 0 : toggler.attributes), {
2840
+ className: (_a = toggler === null || toggler === void 0 ? void 0 : toggler.classes) === null || _a === void 0 ? void 0 : _a.join(' '),
2841
+ children: (_b = dropdown === null || dropdown === void 0 ? void 0 : dropdown.texts) === null || _b === void 0 ? void 0 : _b.select,
2842
+ onClick: () => handler === null || handler === void 0 ? void 0 : handler.toggle()
2843
+ });
2844
+ setTogglerProps(newToggleProps);
2845
+ const newListboxProps = Object.assign(Object.assign({}, listbox === null || listbox === void 0 ? void 0 : listbox.attributes), {
2846
+ className: (_c = listbox === null || listbox === void 0 ? void 0 : listbox.classes) === null || _c === void 0 ? void 0 : _c.join(' ')
2847
+ });
2848
+ setListboxProps(newListboxProps);
2849
+
2850
+ if (!dropdown.isMultiSelect) {
2851
+ const newListItems = dropdown.options.map(o => {
2852
+ var _a;
2853
+
2854
+ return Object.assign(Object.assign({}, o.attributes), {
2855
+ className: (_a = o.classes) === null || _a === void 0 ? void 0 : _a.join(' '),
2856
+ children: o[dropdown.display],
2857
+ selected: o.selected,
2858
+ onClick: () => handler === null || handler === void 0 ? void 0 : handler.select(o)
2859
+ });
2860
+ });
2861
+ setListItems(newListItems);
2862
+ } else {
2863
+ const checkboxes = dropdown.options.map(o => ({
2864
+ labelProps: Object.assign(Object.assign({}, o.attributes), {
2865
+ className: ['form-control', ...o.classes].join(' ')
2866
+ }),
2867
+ inputProps: {
2868
+ defaultChecked: o.selected,
2869
+ type: 'checkbox',
2870
+ onClick: () => handler === null || handler === void 0 ? void 0 : handler.select(o, false)
2871
+ },
2872
+ spanProps: {
2873
+ children: o[dropdown.display]
2874
+ }
2875
+ }));
2876
+ const newMultiselect = {
2877
+ fieldsetProps: {
2878
+ 'aria-describedby': (_f = (_e = (_d = dropdown === null || dropdown === void 0 ? void 0 : dropdown.elements) === null || _d === void 0 ? void 0 : _d.fieldset) === null || _e === void 0 ? void 0 : _e.attributes) === null || _f === void 0 ? void 0 : _f.id,
2879
+ 'aria-multiselectable': true,
2880
+ role: 'listbox',
2881
+ tabIndex: -1
2882
+ },
2883
+ legendProps: {
2884
+ className: 'sr-only',
2885
+ id: (_j = (_h = (_g = dropdown === null || dropdown === void 0 ? void 0 : dropdown.elements) === null || _g === void 0 ? void 0 : _g.fieldset) === null || _h === void 0 ? void 0 : _h.attributes) === null || _j === void 0 ? void 0 : _j.id,
2886
+ children: dropdown.texts.optionsDescription
2887
+ },
2888
+ checkboxes
2889
+ };
2890
+ setMultiSelectProps(newMultiselect);
2891
+ } // eslint-disable-next-line react-hooks/exhaustive-deps
2892
+
2893
+ }, [dropdown]); // When dropdown properties change
2894
+
2895
+ useEffect(() => {
2896
+ if (!dropdown) return;
2897
+ handler === null || handler === void 0 ? void 0 : handler.update({
2898
+ id,
2899
+ value,
2900
+ texts,
2901
+ options,
2902
+ loop,
2903
+ multiSelect,
2904
+ searchable,
2905
+ searchFilter,
2906
+ compareWith,
2907
+ useValue,
2908
+ display,
2909
+ validator
2910
+ }); // eslint-disable-next-line react-hooks/exhaustive-deps
2911
+ }, [id, texts, options, loop, multiSelect, searchable, searchFilter, compareWith, useValue, display]);
2912
+ useEffect(() => {
2913
+ if (!dropdown) return;
2914
+ handler === null || handler === void 0 ? void 0 : handler.selectByValue(value);
2915
+ console.log('new value'); // eslint-disable-next-line react-hooks/exhaustive-deps
2916
+ }, [value]); // When validator changes
2917
+
2918
+ useEffect(() => {
2919
+ if (!dropdown) return;
2920
+ if (validator) handler === null || handler === void 0 ? void 0 : handler.validate(validator); // eslint-disable-next-line react-hooks/exhaustive-deps
2921
+ }, [validator]); // Create dropdown handler
2922
+
2923
+ useEffect(() => {
2924
+ if (!handler && togglerRef.current && listboxRef.current) {
2925
+ setHandler(createDropdown({
2926
+ id,
2927
+ value,
2928
+ texts,
2929
+ options,
2930
+ loop,
2931
+ multiSelect,
2932
+ searchable,
2933
+ searchFilter,
2934
+ compareWith,
2935
+ useValue,
2936
+ display,
2937
+ validator
2938
+ }, togglerRef.current, listboxRef.current, listboxRef.current, dd => setDropdown(dd), value => onChange === null || onChange === void 0 ? void 0 : onChange(value)));
2939
+ }
2940
+
2941
+ return () => handler === null || handler === void 0 ? void 0 : handler.destroy(); // eslint-disable-next-line react-hooks/exhaustive-deps
2942
+ }, [togglerRef, listboxRef]);
2943
+ return {
2944
+ dropdown: handler,
2945
+ togglerProps,
2946
+ listboxProps,
2947
+ listItems,
2948
+ multiSelectProps
2949
+ };
2950
+ };
2951
+
2952
+ const Dropdown = ({
2953
+ compareWith,
2954
+ display,
2955
+ id,
2956
+ informationLabel,
2957
+ label,
2958
+ loop,
2959
+ multiSelect,
2960
+ onChange,
2961
+ options,
2962
+ searchFilter,
2963
+ searchable,
2964
+ texts,
2965
+ useValue,
2966
+ validator,
2967
+ value
2968
+ }) => {
2969
+ var _a;
2970
+
2971
+ const togglerRef = useRef(null);
2972
+ const listboxRef = useRef(null);
2973
+ const {
2974
+ dropdown,
2975
+ listboxProps,
2976
+ togglerProps,
2977
+ listItems,
2978
+ multiSelectProps
2979
+ } = useDropdown({
2980
+ id,
2981
+ value,
2982
+ options,
2983
+ loop,
2984
+ multiSelect,
2985
+ searchable,
2986
+ searchFilter,
2987
+ compareWith,
2988
+ useValue,
2989
+ display,
2990
+ togglerRef,
2991
+ listboxRef,
2992
+ texts,
2993
+ onChange,
2994
+ validator
2995
+ });
2996
+
2997
+ const getListBoxProps = props => {
2998
+ var _a, _b, _c;
2999
+
3000
+ if (Object.keys(props).length === 0) return {
3001
+ role: 'listbox',
3002
+ tabIndex: -1,
3003
+ className: (_c = (_b = (_a = dropdownValues().elements) === null || _a === void 0 ? void 0 : _a.listbox) === null || _b === void 0 ? void 0 : _b.classes) === null || _c === void 0 ? void 0 : _c.join(' ')
3004
+ };
3005
+ return props;
3006
+ };
3007
+
3008
+ return jsxs("div", Object.assign({
3009
+ className: "form-group"
3010
+ }, {
3011
+ children: [label && jsx("label", Object.assign({
3012
+ htmlFor: togglerProps.id
3013
+ }, {
3014
+ children: label
3015
+ })), informationLabel && jsx("div", Object.assign({
3016
+ className: "form-info"
3017
+ }, {
3018
+ children: informationLabel
3019
+ })), jsx("button", Object.assign({
3020
+ type: "button"
3021
+ }, togglerProps, {
3022
+ ref: togglerRef
3023
+ }, {
3024
+ children: jsx("span", {
3025
+ children: togglerProps.children
3026
+ })
3027
+ })), jsxs("div", Object.assign({}, getListBoxProps(listboxProps), {
3028
+ ref: listboxRef
3029
+ }, {
3030
+ children: [jsxs("button", Object.assign({
3031
+ type: "button",
3032
+ className: "close m-4 m-sm-2 d-block d-sm-none",
3033
+ onClick: dropdown === null || dropdown === void 0 ? void 0 : dropdown.close
3034
+ }, {
3035
+ children: [jsx("span", Object.assign({
3036
+ className: "sr-only"
3037
+ }, {
3038
+ children: dropdown === null || dropdown === void 0 ? void 0 : dropdown.dropdown.texts.close
3039
+ })), jsx("i", {})]
3040
+ })), (dropdown === null || dropdown === void 0 ? void 0 : dropdown.dropdown.isMultiSelect) ? jsx("div", Object.assign({
3041
+ className: "sg-fieldset-container"
3042
+ }, {
3043
+ children: jsxs("fieldset", Object.assign({}, multiSelectProps.fieldsetProps, {
3044
+ children: [jsx("legend", Object.assign({}, multiSelectProps.legendProps)), jsx("div", {
3045
+ children: (_a = multiSelectProps.checkboxes) === null || _a === void 0 ? void 0 : _a.map(checkboxItem => jsxs("label", Object.assign({}, checkboxItem.labelProps, {
3046
+ children: [jsx("input", Object.assign({}, checkboxItem.inputProps)), jsx("span", Object.assign({}, checkboxItem.spanProps)), jsx("i", {})]
3047
+ }), checkboxItem.labelProps.id))
3048
+ })]
3049
+ }))
3050
+ })) : jsx("ul", Object.assign({
3051
+ role: "listbox"
3052
+ }, {
3053
+ children: listItems.map(liProps => jsx("li", Object.assign({}, liProps), liProps.id))
3054
+ }))]
3055
+ })), validator && jsx("span", Object.assign({
3056
+ className: "form-info"
3057
+ }, {
3058
+ children: validator === null || validator === void 0 ? void 0 : validator.message
3059
+ }))]
3060
+ }));
3061
+ };
3062
+
3063
+ const useDatepicker = (datepickerRef, datepickerDialogRef, dateInputRef, datepickerTriggerRef, options = {}) => {
3064
+ const dataStub = {
3065
+ formattedSelectedDate: '',
3066
+ calendar: {
3067
+ headers: [],
3068
+ calendarGrid: []
3069
+ }
3070
+ };
3071
+ const [data, setData] = useState(dataStub);
3072
+ const [state, setState] = useState({
3073
+ isActive: false
3074
+ });
3075
+ const datepickerStub = {};
3076
+ const [datepicker, setDatepicker] = useState(datepickerStub);
3077
+ useEffect(() => {
3078
+ if (!datepicker.open && datepickerRef.current && datepickerDialogRef.current && dateInputRef.current && datepickerTriggerRef.current) {
3079
+ setDatepicker(createDatepicker((data, state) => {
3080
+ if (data) setData(data);
3081
+ if (state) setState(state);
3082
+ }, options, datepickerRef.current, datepickerDialogRef.current, dateInputRef.current, datepickerTriggerRef.current));
3083
+ }
3084
+ }, [datepicker, datepickerRef, datepickerDialogRef, dateInputRef, datepickerTriggerRef, options]);
3085
+ return {
3086
+ datepicker,
3087
+ data,
3088
+ state
3089
+ };
3090
+ };
3091
+
3092
+ const Datepicker = (options = {}) => {
3093
+ const [uuid] = useState(randomId());
3094
+ const id = `sgr-datepicker-${uuid}`;
3095
+ const datepickerRef = useRef(null);
3096
+ const datepickerTriggerRef = useRef(null);
3097
+ const datepickerDialogRef = useRef(null);
3098
+ const dateInputRef = useRef(null);
3099
+ const {
3100
+ datepicker,
3101
+ data,
3102
+ state
3103
+ } = useDatepicker(datepickerRef, datepickerDialogRef, dateInputRef, datepickerTriggerRef, options);
3104
+ useEffect(() => {
3105
+ var _a;
3106
+
3107
+ const selDateSub = (_a = datepicker.selectedDate$) === null || _a === void 0 ? void 0 : _a.subscribe(newDate => options.onChange && options.onChange(newDate));
3108
+ return () => selDateSub === null || selDateSub === void 0 ? void 0 : selDateSub.unsubscribe();
3109
+ }, [datepicker, options]);
3110
+
3111
+ const classNames = day => Object.entries({
3112
+ disabled: !day.currentMonth,
3113
+ 'sg-date-today': day.today // 'sg-date-holiday': day.holiday,
3114
+
3115
+ }).map(([className, add]) => add ? className : '').join(' ');
3116
+
3117
+ return jsxs(Fragment, {
3118
+ children: [jsxs("div", Object.assign({
3119
+ className: "form-group"
3120
+ }, {
3121
+ children: [jsx("label", Object.assign({
3122
+ htmlFor: id
3123
+ }, {
3124
+ children: "Date"
3125
+ })), jsxs("div", Object.assign({
3126
+ className: "group",
3127
+ ref: datepickerRef
3128
+ }, {
3129
+ children: [jsx("input", {
3130
+ ref: dateInputRef,
3131
+ id: id,
3132
+ type: "text",
3133
+ placeholder: "yyyy-mm-dd",
3134
+ value: data.formattedSelectedDate,
3135
+ onChange: e => datepicker.select(e.target.value)
3136
+ }), jsx("button", Object.assign({
3137
+ ref: datepickerTriggerRef,
3138
+ type: "button",
3139
+ className: "primary",
3140
+ onClick: () => datepicker.toggle()
3141
+ }, {
3142
+ children: jsx("i", Object.assign({
3143
+ className: "sg-icon sg-icon-calendar"
3144
+ }, {
3145
+ children: "Select date"
3146
+ }))
3147
+ }))]
3148
+ })), jsx("span", Object.assign({
3149
+ className: "form-info"
3150
+ }, {
3151
+ children: "Select a date"
3152
+ }))]
3153
+ })), jsx("div", Object.assign({
3154
+ ref: datepickerDialogRef,
3155
+ className: `popover popover-datepicker ${state.isActive ? 'active' : ''}`,
3156
+ role: "dialog",
3157
+ "aria-modal": "true",
3158
+ "aria-label": "Choose Date"
3159
+ }, {
3160
+ children: state.isActive && jsxs("div", Object.assign({
3161
+ className: "sg-date"
3162
+ }, {
3163
+ children: [jsxs("header", {
3164
+ children: [jsx("button", Object.assign({
3165
+ className: "link",
3166
+ onClick: () => datepicker.sub(1, 'months')
3167
+ }, {
3168
+ children: jsx("i", Object.assign({
3169
+ className: "sg-icon sg-icon-previous"
3170
+ }, {
3171
+ children: "Previous month"
3172
+ }))
3173
+ })), jsx(Dropdown, {
3174
+ options: months({}),
3175
+ texts: {
3176
+ placeholder: data.monthName
3177
+ }
3178
+ }), jsx(Dropdown, {
3179
+ options: years({}),
3180
+ texts: {
3181
+ placeholder: data.year + ''
3182
+ }
3183
+ }), jsx("button", Object.assign({
3184
+ className: "link",
3185
+ onClick: () => datepicker.add(1, 'months')
3186
+ }, {
3187
+ children: jsx("i", Object.assign({
3188
+ className: "sg-icon sg-icon-next"
3189
+ }, {
3190
+ children: "Next month"
3191
+ }))
3192
+ }))]
3193
+ }), jsx("main", {
3194
+ children: jsxs("table", Object.assign({
3195
+ role: "grid"
3196
+ }, {
3197
+ children: [jsx("thead", {
3198
+ children: jsx("tr", {
3199
+ children: data.calendar.headers.map((header, ix) => jsx("th", Object.assign({
3200
+ scope: "col",
3201
+ abbr: header.abbr,
3202
+ className: header.type === 'week' ? 'sg-week-header' : 'sg-day-header'
3203
+ }, {
3204
+ children: header.displayText
3205
+ }), `week_${ix}`))
3206
+ })
3207
+ }), jsx("tbody", {
3208
+ children: data.calendar.calendarGrid.map((week, ix) => jsxs("tr", {
3209
+ children: [data.calendar.weekNumbers ? jsx("th", Object.assign({
3210
+ className: "sg-week-number"
3211
+ }, {
3212
+ children: data.calendar.weekNumbers[ix]
3213
+ })) : '', week.map(day => jsx("td", Object.assign({
3214
+ "data-date": day.formattedDate,
3215
+ className: classNames(day),
3216
+ title: day.today ? 'Today' : '',
3217
+ tabIndex: day.highlighted || day.selected && !(data === null || data === void 0 ? void 0 : data.highlightedDate) || day.today && !(data === null || data === void 0 ? void 0 : data.highlightedDate) && !(data === null || data === void 0 ? void 0 : data.selectedDate) ? 0 : -1,
3218
+ role: day.selected ? 'gridcell' : undefined,
3219
+ "aria-selected": day.selected && !(data === null || data === void 0 ? void 0 : data.highlightedDate) ? true : undefined,
3220
+ onClick: () => {
3221
+ day.currentMonth && datepicker.select(day.date);
3222
+ }
3223
+ }, {
3224
+ children: day.day
3225
+ }), day.day))]
3226
+ }, `week_${ix}`))
3227
+ })]
3228
+ }))
3229
+ })]
3230
+ }))
3231
+ }))]
3232
+ });
3233
+ };
3234
+
3235
+ export { AlertRibbon as Alert, AlertRibbon, Badge, Button, ButtonGroup, Card, Checkbox, Datepicker, Dropdown, EmailInput, Flexbox, Form, FormItems, Group, Link, List, Modal, Navbar, NumberInput, RadioButton, RadioGroup, RenderInput, Stepper, Text, TextInput };