@sebgroup/green-react 1.2.0 → 1.3.0

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