@sebgroup/green-react 1.0.0-beta.4 → 1.0.0-beta.7

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.
package/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { ModalRole, randomId } from '@sebgroup/extract';
3
- import React, { useState, useEffect, useMemo, useRef } from 'react';
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import React, { useState, useLayoutEffect, useEffect, useMemo, useRef } from 'react';
3
+ import { randomId, validateClassName } from '@sebgroup/extract';
4
4
 
5
5
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
6
6
 
@@ -21,7 +21,7 @@ var global$r =
21
21
 
22
22
  var objectGetOwnPropertyDescriptor = {};
23
23
 
24
- var fails$9 = function (exec) {
24
+ var fails$a = function (exec) {
25
25
  try {
26
26
  return !!exec();
27
27
  } catch (error) {
@@ -29,17 +29,27 @@ var fails$9 = function (exec) {
29
29
  }
30
30
  };
31
31
 
32
- var fails$8 = fails$9;
32
+ var fails$9 = fails$a;
33
33
 
34
34
  // Detect IE8's incomplete defineProperty implementation
35
- var descriptors = !fails$8(function () {
35
+ var descriptors = !fails$9(function () {
36
36
  // eslint-disable-next-line es/no-object-defineproperty -- required for testing
37
37
  return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
38
38
  });
39
39
 
40
+ var fails$8 = fails$a;
41
+
42
+ var functionBindNative = !fails$8(function () {
43
+ var test = (function () { /* empty */ }).bind();
44
+ // eslint-disable-next-line no-prototype-builtins -- safe
45
+ return typeof test != 'function' || test.hasOwnProperty('prototype');
46
+ });
47
+
48
+ var NATIVE_BIND$1 = functionBindNative;
49
+
40
50
  var call$6 = Function.prototype.call;
41
51
 
42
- var functionCall = call$6.bind ? call$6.bind(call$6) : function () {
52
+ var functionCall = NATIVE_BIND$1 ? call$6.bind(call$6) : function () {
43
53
  return call$6.apply(call$6, arguments);
44
54
  };
45
55
 
@@ -68,35 +78,37 @@ var createPropertyDescriptor$3 = function (bitmap, value) {
68
78
  };
69
79
  };
70
80
 
81
+ var NATIVE_BIND = functionBindNative;
82
+
71
83
  var FunctionPrototype$1 = Function.prototype;
72
84
  var bind = FunctionPrototype$1.bind;
73
85
  var call$5 = FunctionPrototype$1.call;
74
- var callBind = bind && bind.bind(call$5);
86
+ var uncurryThis$c = NATIVE_BIND && bind.bind(call$5, call$5);
75
87
 
76
- var functionUncurryThis = bind ? function (fn) {
77
- return fn && callBind(call$5, fn);
88
+ var functionUncurryThis = NATIVE_BIND ? function (fn) {
89
+ return fn && uncurryThis$c(fn);
78
90
  } : function (fn) {
79
91
  return fn && function () {
80
92
  return call$5.apply(fn, arguments);
81
93
  };
82
94
  };
83
95
 
84
- var uncurryThis$c = functionUncurryThis;
96
+ var uncurryThis$b = functionUncurryThis;
85
97
 
86
- var toString$4 = uncurryThis$c({}.toString);
87
- var stringSlice = uncurryThis$c(''.slice);
98
+ var toString$3 = uncurryThis$b({}.toString);
99
+ var stringSlice$1 = uncurryThis$b(''.slice);
88
100
 
89
101
  var classofRaw$1 = function (it) {
90
- return stringSlice(toString$4(it), 8, -1);
102
+ return stringSlice$1(toString$3(it), 8, -1);
91
103
  };
92
104
 
93
105
  var global$q = global$r;
94
- var uncurryThis$b = functionUncurryThis;
95
- var fails$7 = fails$9;
106
+ var uncurryThis$a = functionUncurryThis;
107
+ var fails$7 = fails$a;
96
108
  var classof$2 = classofRaw$1;
97
109
 
98
110
  var Object$5 = global$q.Object;
99
- var split = uncurryThis$b(''.split);
111
+ var split = uncurryThis$a(''.split);
100
112
 
101
113
  // fallback for non-array-like ES3 and non-enumerable old V8 strings
102
114
  var indexedObject = fails$7(function () {
@@ -113,45 +125,45 @@ var TypeError$8 = global$p.TypeError;
113
125
 
114
126
  // `RequireObjectCoercible` abstract operation
115
127
  // https://tc39.es/ecma262/#sec-requireobjectcoercible
116
- var requireObjectCoercible$3 = function (it) {
128
+ var requireObjectCoercible$2 = function (it) {
117
129
  if (it == undefined) throw TypeError$8("Can't call method on " + it);
118
130
  return it;
119
131
  };
120
132
 
121
133
  // toObject with fallback for non-array-like ES3 strings
122
134
  var IndexedObject$1 = indexedObject;
123
- var requireObjectCoercible$2 = requireObjectCoercible$3;
135
+ var requireObjectCoercible$1 = requireObjectCoercible$2;
124
136
 
125
137
  var toIndexedObject$5 = function (it) {
126
- return IndexedObject$1(requireObjectCoercible$2(it));
138
+ return IndexedObject$1(requireObjectCoercible$1(it));
127
139
  };
128
140
 
129
141
  // `IsCallable` abstract operation
130
142
  // https://tc39.es/ecma262/#sec-iscallable
131
- var isCallable$e = function (argument) {
143
+ var isCallable$f = function (argument) {
132
144
  return typeof argument == 'function';
133
145
  };
134
146
 
135
- var isCallable$d = isCallable$e;
147
+ var isCallable$e = isCallable$f;
136
148
 
137
149
  var isObject$5 = function (it) {
138
- return typeof it == 'object' ? it !== null : isCallable$d(it);
150
+ return typeof it == 'object' ? it !== null : isCallable$e(it);
139
151
  };
140
152
 
141
153
  var global$o = global$r;
142
- var isCallable$c = isCallable$e;
154
+ var isCallable$d = isCallable$f;
143
155
 
144
156
  var aFunction = function (argument) {
145
- return isCallable$c(argument) ? argument : undefined;
157
+ return isCallable$d(argument) ? argument : undefined;
146
158
  };
147
159
 
148
160
  var getBuiltIn$4 = function (namespace, method) {
149
161
  return arguments.length < 2 ? aFunction(global$o[namespace]) : global$o[namespace] && global$o[namespace][method];
150
162
  };
151
163
 
152
- var uncurryThis$a = functionUncurryThis;
164
+ var uncurryThis$9 = functionUncurryThis;
153
165
 
154
- var objectIsPrototypeOf = uncurryThis$a({}.isPrototypeOf);
166
+ var objectIsPrototypeOf = uncurryThis$9({}.isPrototypeOf);
155
167
 
156
168
  var getBuiltIn$3 = getBuiltIn$4;
157
169
 
@@ -188,7 +200,7 @@ var engineV8Version = version;
188
200
  /* eslint-disable es/no-symbol -- required for testing */
189
201
 
190
202
  var V8_VERSION = engineV8Version;
191
- var fails$6 = fails$9;
203
+ var fails$6 = fails$a;
192
204
 
193
205
  // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
194
206
  var nativeSymbol = !!Object.getOwnPropertySymbols && !fails$6(function () {
@@ -202,16 +214,16 @@ var nativeSymbol = !!Object.getOwnPropertySymbols && !fails$6(function () {
202
214
 
203
215
  /* eslint-disable es/no-symbol -- required for testing */
204
216
 
205
- var NATIVE_SYMBOL$1 = nativeSymbol;
217
+ var NATIVE_SYMBOL$2 = nativeSymbol;
206
218
 
207
- var useSymbolAsUid = NATIVE_SYMBOL$1
219
+ var useSymbolAsUid = NATIVE_SYMBOL$2
208
220
  && !Symbol.sham
209
221
  && typeof Symbol.iterator == 'symbol';
210
222
 
211
223
  var global$m = global$r;
212
224
  var getBuiltIn$2 = getBuiltIn$4;
213
- var isCallable$b = isCallable$e;
214
- var isPrototypeOf = objectIsPrototypeOf;
225
+ var isCallable$c = isCallable$f;
226
+ var isPrototypeOf$1 = objectIsPrototypeOf;
215
227
  var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
216
228
 
217
229
  var Object$4 = global$m.Object;
@@ -220,7 +232,7 @@ var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
220
232
  return typeof it == 'symbol';
221
233
  } : function (it) {
222
234
  var $Symbol = getBuiltIn$2('Symbol');
223
- return isCallable$b($Symbol) && isPrototypeOf($Symbol.prototype, Object$4(it));
235
+ return isCallable$c($Symbol) && isPrototypeOf$1($Symbol.prototype, Object$4(it));
224
236
  };
225
237
 
226
238
  var global$l = global$r;
@@ -236,14 +248,14 @@ var tryToString$1 = function (argument) {
236
248
  };
237
249
 
238
250
  var global$k = global$r;
239
- var isCallable$a = isCallable$e;
251
+ var isCallable$b = isCallable$f;
240
252
  var tryToString = tryToString$1;
241
253
 
242
254
  var TypeError$7 = global$k.TypeError;
243
255
 
244
256
  // `Assert: IsCallable(argument) is true`
245
257
  var aCallable$1 = function (argument) {
246
- if (isCallable$a(argument)) return argument;
258
+ if (isCallable$b(argument)) return argument;
247
259
  throw TypeError$7(tryToString(argument) + ' is not a function');
248
260
  };
249
261
 
@@ -258,7 +270,7 @@ var getMethod$1 = function (V, P) {
258
270
 
259
271
  var global$j = global$r;
260
272
  var call$4 = functionCall;
261
- var isCallable$9 = isCallable$e;
273
+ var isCallable$a = isCallable$f;
262
274
  var isObject$4 = isObject$5;
263
275
 
264
276
  var TypeError$6 = global$j.TypeError;
@@ -267,9 +279,9 @@ var TypeError$6 = global$j.TypeError;
267
279
  // https://tc39.es/ecma262/#sec-ordinarytoprimitive
268
280
  var ordinaryToPrimitive$1 = function (input, pref) {
269
281
  var fn, val;
270
- if (pref === 'string' && isCallable$9(fn = input.toString) && !isObject$4(val = call$4(fn, input))) return val;
271
- if (isCallable$9(fn = input.valueOf) && !isObject$4(val = call$4(fn, input))) return val;
272
- if (pref !== 'string' && isCallable$9(fn = input.toString) && !isObject$4(val = call$4(fn, input))) return val;
282
+ if (pref === 'string' && isCallable$a(fn = input.toString) && !isObject$4(val = call$4(fn, input))) return val;
283
+ if (isCallable$a(fn = input.valueOf) && !isObject$4(val = call$4(fn, input))) return val;
284
+ if (pref !== 'string' && isCallable$a(fn = input.toString) && !isObject$4(val = call$4(fn, input))) return val;
273
285
  throw TypeError$6("Can't convert object to primitive value");
274
286
  };
275
287
 
@@ -278,11 +290,11 @@ var shared$3 = {exports: {}};
278
290
  var global$i = global$r;
279
291
 
280
292
  // eslint-disable-next-line es/no-object-defineproperty -- safe
281
- var defineProperty$2 = Object.defineProperty;
293
+ var defineProperty$4 = Object.defineProperty;
282
294
 
283
295
  var setGlobal$3 = function (key, value) {
284
296
  try {
285
- defineProperty$2(global$i, key, { value: value, configurable: true, writable: true });
297
+ defineProperty$4(global$i, key, { value: value, configurable: true, writable: true });
286
298
  } catch (error) {
287
299
  global$i[key] = value;
288
300
  } return value;
@@ -301,26 +313,28 @@ var store$2 = sharedStore;
301
313
  (shared$3.exports = function (key, value) {
302
314
  return store$2[key] || (store$2[key] = value !== undefined ? value : {});
303
315
  })('versions', []).push({
304
- version: '3.19.3',
316
+ version: '3.21.1',
305
317
  mode: 'global',
306
- copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
318
+ copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
319
+ license: 'https://github.com/zloirock/core-js/blob/v3.21.1/LICENSE',
320
+ source: 'https://github.com/zloirock/core-js'
307
321
  });
308
322
 
309
323
  var global$g = global$r;
310
- var requireObjectCoercible$1 = requireObjectCoercible$3;
324
+ var requireObjectCoercible = requireObjectCoercible$2;
311
325
 
312
326
  var Object$3 = global$g.Object;
313
327
 
314
328
  // `ToObject` abstract operation
315
329
  // https://tc39.es/ecma262/#sec-toobject
316
330
  var toObject$3 = function (argument) {
317
- return Object$3(requireObjectCoercible$1(argument));
331
+ return Object$3(requireObjectCoercible(argument));
318
332
  };
319
333
 
320
- var uncurryThis$9 = functionUncurryThis;
334
+ var uncurryThis$8 = functionUncurryThis;
321
335
  var toObject$2 = toObject$3;
322
336
 
323
- var hasOwnProperty = uncurryThis$9({}.hasOwnProperty);
337
+ var hasOwnProperty = uncurryThis$8({}.hasOwnProperty);
324
338
 
325
339
  // `HasOwnProperty` abstract operation
326
340
  // https://tc39.es/ecma262/#sec-hasownproperty
@@ -328,33 +342,33 @@ var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
328
342
  return hasOwnProperty(toObject$2(it), key);
329
343
  };
330
344
 
331
- var uncurryThis$8 = functionUncurryThis;
345
+ var uncurryThis$7 = functionUncurryThis;
332
346
 
333
347
  var id = 0;
334
348
  var postfix = Math.random();
335
- var toString$3 = uncurryThis$8(1.0.toString);
349
+ var toString$2 = uncurryThis$7(1.0.toString);
336
350
 
337
351
  var uid$2 = function (key) {
338
- return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$3(++id + postfix, 36);
352
+ return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$2(++id + postfix, 36);
339
353
  };
340
354
 
341
355
  var global$f = global$r;
342
356
  var shared$2 = shared$3.exports;
343
- var hasOwn$8 = hasOwnProperty_1;
357
+ var hasOwn$9 = hasOwnProperty_1;
344
358
  var uid$1 = uid$2;
345
- var NATIVE_SYMBOL = nativeSymbol;
359
+ var NATIVE_SYMBOL$1 = nativeSymbol;
346
360
  var USE_SYMBOL_AS_UID = useSymbolAsUid;
347
361
 
348
362
  var WellKnownSymbolsStore = shared$2('wks');
349
- var Symbol$2 = global$f.Symbol;
350
- var symbolFor = Symbol$2 && Symbol$2['for'];
351
- var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$2 : Symbol$2 && Symbol$2.withoutSetter || uid$1;
363
+ var Symbol$1 = global$f.Symbol;
364
+ var symbolFor = Symbol$1 && Symbol$1['for'];
365
+ var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
352
366
 
353
367
  var wellKnownSymbol$8 = function (name) {
354
- if (!hasOwn$8(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
368
+ if (!hasOwn$9(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL$1 || typeof WellKnownSymbolsStore[name] == 'string')) {
355
369
  var description = 'Symbol.' + name;
356
- if (NATIVE_SYMBOL && hasOwn$8(Symbol$2, name)) {
357
- WellKnownSymbolsStore[name] = Symbol$2[name];
370
+ if (NATIVE_SYMBOL$1 && hasOwn$9(Symbol$1, name)) {
371
+ WellKnownSymbolsStore[name] = Symbol$1[name];
358
372
  } else if (USE_SYMBOL_AS_UID && symbolFor) {
359
373
  WellKnownSymbolsStore[name] = symbolFor(description);
360
374
  } else {
@@ -411,43 +425,56 @@ var documentCreateElement$2 = function (it) {
411
425
  return EXISTS$1 ? document$1.createElement(it) : {};
412
426
  };
413
427
 
414
- var DESCRIPTORS$6 = descriptors;
415
- var fails$5 = fails$9;
428
+ var DESCRIPTORS$9 = descriptors;
429
+ var fails$5 = fails$a;
416
430
  var createElement = documentCreateElement$2;
417
431
 
418
- // Thank's IE8 for his funny defineProperty
419
- var ie8DomDefine = !DESCRIPTORS$6 && !fails$5(function () {
420
- // eslint-disable-next-line es/no-object-defineproperty -- requied for testing
432
+ // Thanks to IE8 for its funny defineProperty
433
+ var ie8DomDefine = !DESCRIPTORS$9 && !fails$5(function () {
434
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
421
435
  return Object.defineProperty(createElement('div'), 'a', {
422
436
  get: function () { return 7; }
423
437
  }).a != 7;
424
438
  });
425
439
 
426
- var DESCRIPTORS$5 = descriptors;
440
+ var DESCRIPTORS$8 = descriptors;
427
441
  var call$2 = functionCall;
428
442
  var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable;
429
443
  var createPropertyDescriptor$2 = createPropertyDescriptor$3;
430
444
  var toIndexedObject$4 = toIndexedObject$5;
431
445
  var toPropertyKey$1 = toPropertyKey$2;
432
- var hasOwn$7 = hasOwnProperty_1;
446
+ var hasOwn$8 = hasOwnProperty_1;
433
447
  var IE8_DOM_DEFINE$1 = ie8DomDefine;
434
448
 
435
449
  // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
436
- var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
450
+ var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
437
451
 
438
452
  // `Object.getOwnPropertyDescriptor` method
439
453
  // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
440
- objectGetOwnPropertyDescriptor.f = DESCRIPTORS$5 ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
454
+ objectGetOwnPropertyDescriptor.f = DESCRIPTORS$8 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
441
455
  O = toIndexedObject$4(O);
442
456
  P = toPropertyKey$1(P);
443
457
  if (IE8_DOM_DEFINE$1) try {
444
- return $getOwnPropertyDescriptor(O, P);
458
+ return $getOwnPropertyDescriptor$1(O, P);
445
459
  } catch (error) { /* empty */ }
446
- if (hasOwn$7(O, P)) return createPropertyDescriptor$2(!call$2(propertyIsEnumerableModule$1.f, O, P), O[P]);
460
+ if (hasOwn$8(O, P)) return createPropertyDescriptor$2(!call$2(propertyIsEnumerableModule$1.f, O, P), O[P]);
447
461
  };
448
462
 
449
463
  var objectDefineProperty = {};
450
464
 
465
+ var DESCRIPTORS$7 = descriptors;
466
+ var fails$4 = fails$a;
467
+
468
+ // V8 ~ Chrome 36-
469
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3334
470
+ var v8PrototypeDefineBug = DESCRIPTORS$7 && fails$4(function () {
471
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
472
+ return Object.defineProperty(function () { /* empty */ }, 'prototype', {
473
+ value: 42,
474
+ writable: false
475
+ }).prototype != 42;
476
+ });
477
+
451
478
  var global$c = global$r;
452
479
  var isObject$1 = isObject$5;
453
480
 
@@ -461,18 +488,39 @@ var anObject$5 = function (argument) {
461
488
  };
462
489
 
463
490
  var global$b = global$r;
464
- var DESCRIPTORS$4 = descriptors;
491
+ var DESCRIPTORS$6 = descriptors;
465
492
  var IE8_DOM_DEFINE = ie8DomDefine;
493
+ var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
466
494
  var anObject$4 = anObject$5;
467
495
  var toPropertyKey = toPropertyKey$2;
468
496
 
469
497
  var TypeError$3 = global$b.TypeError;
470
498
  // eslint-disable-next-line es/no-object-defineproperty -- safe
471
499
  var $defineProperty = Object.defineProperty;
500
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
501
+ var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
502
+ var ENUMERABLE = 'enumerable';
503
+ var CONFIGURABLE$1 = 'configurable';
504
+ var WRITABLE = 'writable';
472
505
 
473
506
  // `Object.defineProperty` method
474
507
  // https://tc39.es/ecma262/#sec-object.defineproperty
475
- objectDefineProperty.f = DESCRIPTORS$4 ? $defineProperty : function defineProperty(O, P, Attributes) {
508
+ objectDefineProperty.f = DESCRIPTORS$6 ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
509
+ anObject$4(O);
510
+ P = toPropertyKey(P);
511
+ anObject$4(Attributes);
512
+ if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
513
+ var current = $getOwnPropertyDescriptor(O, P);
514
+ if (current && current[WRITABLE]) {
515
+ O[P] = Attributes.value;
516
+ Attributes = {
517
+ configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
518
+ enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
519
+ writable: false
520
+ };
521
+ }
522
+ } return $defineProperty(O, P, Attributes);
523
+ } : $defineProperty : function defineProperty(O, P, Attributes) {
476
524
  anObject$4(O);
477
525
  P = toPropertyKey(P);
478
526
  anObject$4(Attributes);
@@ -484,11 +532,11 @@ objectDefineProperty.f = DESCRIPTORS$4 ? $defineProperty : function defineProper
484
532
  return O;
485
533
  };
486
534
 
487
- var DESCRIPTORS$3 = descriptors;
535
+ var DESCRIPTORS$5 = descriptors;
488
536
  var definePropertyModule$3 = objectDefineProperty;
489
537
  var createPropertyDescriptor$1 = createPropertyDescriptor$3;
490
538
 
491
- var createNonEnumerableProperty$5 = DESCRIPTORS$3 ? function (object, key, value) {
539
+ var createNonEnumerableProperty$5 = DESCRIPTORS$5 ? function (object, key, value) {
492
540
  return definePropertyModule$3.f(object, key, createPropertyDescriptor$1(1, value));
493
541
  } : function (object, key, value) {
494
542
  object[key] = value;
@@ -497,14 +545,14 @@ var createNonEnumerableProperty$5 = DESCRIPTORS$3 ? function (object, key, value
497
545
 
498
546
  var redefine$3 = {exports: {}};
499
547
 
500
- var uncurryThis$7 = functionUncurryThis;
501
- var isCallable$8 = isCallable$e;
548
+ var uncurryThis$6 = functionUncurryThis;
549
+ var isCallable$9 = isCallable$f;
502
550
  var store$1 = sharedStore;
503
551
 
504
- var functionToString = uncurryThis$7(Function.toString);
552
+ var functionToString = uncurryThis$6(Function.toString);
505
553
 
506
554
  // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
507
- if (!isCallable$8(store$1.inspectSource)) {
555
+ if (!isCallable$9(store$1.inspectSource)) {
508
556
  store$1.inspectSource = function (it) {
509
557
  return functionToString(it);
510
558
  };
@@ -513,12 +561,12 @@ if (!isCallable$8(store$1.inspectSource)) {
513
561
  var inspectSource$2 = store$1.inspectSource;
514
562
 
515
563
  var global$a = global$r;
516
- var isCallable$7 = isCallable$e;
564
+ var isCallable$8 = isCallable$f;
517
565
  var inspectSource$1 = inspectSource$2;
518
566
 
519
567
  var WeakMap$1 = global$a.WeakMap;
520
568
 
521
- var nativeWeakMap = isCallable$7(WeakMap$1) && /native code/.test(inspectSource$1(WeakMap$1));
569
+ var nativeWeakMap = isCallable$8(WeakMap$1) && /native code/.test(inspectSource$1(WeakMap$1));
522
570
 
523
571
  var shared$1 = shared$3.exports;
524
572
  var uid = uid$2;
@@ -533,10 +581,10 @@ var hiddenKeys$4 = {};
533
581
 
534
582
  var NATIVE_WEAK_MAP = nativeWeakMap;
535
583
  var global$9 = global$r;
536
- var uncurryThis$6 = functionUncurryThis;
584
+ var uncurryThis$5 = functionUncurryThis;
537
585
  var isObject = isObject$5;
538
586
  var createNonEnumerableProperty$4 = createNonEnumerableProperty$5;
539
- var hasOwn$6 = hasOwnProperty_1;
587
+ var hasOwn$7 = hasOwnProperty_1;
540
588
  var shared = sharedStore;
541
589
  var sharedKey$2 = sharedKey$3;
542
590
  var hiddenKeys$3 = hiddenKeys$4;
@@ -561,9 +609,9 @@ var getterFor = function (TYPE) {
561
609
 
562
610
  if (NATIVE_WEAK_MAP || shared.state) {
563
611
  var store = shared.state || (shared.state = new WeakMap());
564
- var wmget = uncurryThis$6(store.get);
565
- var wmhas = uncurryThis$6(store.has);
566
- var wmset = uncurryThis$6(store.set);
612
+ var wmget = uncurryThis$5(store.get);
613
+ var wmhas = uncurryThis$5(store.has);
614
+ var wmset = uncurryThis$5(store.set);
567
615
  set = function (it, metadata) {
568
616
  if (wmhas(store, it)) throw new TypeError$2(OBJECT_ALREADY_INITIALIZED);
569
617
  metadata.facade = it;
@@ -580,16 +628,16 @@ if (NATIVE_WEAK_MAP || shared.state) {
580
628
  var STATE = sharedKey$2('state');
581
629
  hiddenKeys$3[STATE] = true;
582
630
  set = function (it, metadata) {
583
- if (hasOwn$6(it, STATE)) throw new TypeError$2(OBJECT_ALREADY_INITIALIZED);
631
+ if (hasOwn$7(it, STATE)) throw new TypeError$2(OBJECT_ALREADY_INITIALIZED);
584
632
  metadata.facade = it;
585
633
  createNonEnumerableProperty$4(it, STATE, metadata);
586
634
  return metadata;
587
635
  };
588
636
  get = function (it) {
589
- return hasOwn$6(it, STATE) ? it[STATE] : {};
637
+ return hasOwn$7(it, STATE) ? it[STATE] : {};
590
638
  };
591
639
  has = function (it) {
592
- return hasOwn$6(it, STATE);
640
+ return hasOwn$7(it, STATE);
593
641
  };
594
642
  }
595
643
 
@@ -601,17 +649,17 @@ var internalState = {
601
649
  getterFor: getterFor
602
650
  };
603
651
 
604
- var DESCRIPTORS$2 = descriptors;
605
- var hasOwn$5 = hasOwnProperty_1;
652
+ var DESCRIPTORS$4 = descriptors;
653
+ var hasOwn$6 = hasOwnProperty_1;
606
654
 
607
655
  var FunctionPrototype = Function.prototype;
608
656
  // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
609
- var getDescriptor = DESCRIPTORS$2 && Object.getOwnPropertyDescriptor;
657
+ var getDescriptor = DESCRIPTORS$4 && Object.getOwnPropertyDescriptor;
610
658
 
611
- var EXISTS = hasOwn$5(FunctionPrototype, 'name');
659
+ var EXISTS = hasOwn$6(FunctionPrototype, 'name');
612
660
  // additional protection from minified / mangled / dropped function names
613
661
  var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
614
- var CONFIGURABLE = EXISTS && (!DESCRIPTORS$2 || (DESCRIPTORS$2 && getDescriptor(FunctionPrototype, 'name').configurable));
662
+ var CONFIGURABLE = EXISTS && (!DESCRIPTORS$4 || (DESCRIPTORS$4 && getDescriptor(FunctionPrototype, 'name').configurable));
615
663
 
616
664
  var functionName = {
617
665
  EXISTS: EXISTS,
@@ -620,8 +668,8 @@ var functionName = {
620
668
  };
621
669
 
622
670
  var global$8 = global$r;
623
- var isCallable$6 = isCallable$e;
624
- var hasOwn$4 = hasOwnProperty_1;
671
+ var isCallable$7 = isCallable$f;
672
+ var hasOwn$5 = hasOwnProperty_1;
625
673
  var createNonEnumerableProperty$3 = createNonEnumerableProperty$5;
626
674
  var setGlobal$1 = setGlobal$3;
627
675
  var inspectSource = inspectSource$2;
@@ -638,11 +686,11 @@ var TEMPLATE = String(String).split('String');
638
686
  var noTargetGet = options ? !!options.noTargetGet : false;
639
687
  var name = options && options.name !== undefined ? options.name : key;
640
688
  var state;
641
- if (isCallable$6(value)) {
689
+ if (isCallable$7(value)) {
642
690
  if (String(name).slice(0, 7) === 'Symbol(') {
643
691
  name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
644
692
  }
645
- if (!hasOwn$4(value, 'name') || (CONFIGURABLE_FUNCTION_NAME$1 && value.name !== name)) {
693
+ if (!hasOwn$5(value, 'name') || (CONFIGURABLE_FUNCTION_NAME$1 && value.name !== name)) {
646
694
  createNonEnumerableProperty$3(value, 'name', name);
647
695
  }
648
696
  state = enforceInternalState(value);
@@ -663,7 +711,7 @@ var TEMPLATE = String(String).split('String');
663
711
  else createNonEnumerableProperty$3(O, key, value);
664
712
  // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
665
713
  })(Function.prototype, 'toString', function toString() {
666
- return isCallable$6(this) && getInternalState$1(this).source || inspectSource(this);
714
+ return isCallable$7(this) && getInternalState$1(this).source || inspectSource(this);
667
715
  });
668
716
 
669
717
  var objectGetOwnPropertyNames = {};
@@ -715,7 +763,7 @@ var toAbsoluteIndex = toAbsoluteIndex$1;
715
763
  var lengthOfArrayLike = lengthOfArrayLike$1;
716
764
 
717
765
  // `Array.prototype.{ indexOf, includes }` methods implementation
718
- var createMethod$1 = function (IS_INCLUDES) {
766
+ var createMethod = function (IS_INCLUDES) {
719
767
  return function ($this, el, fromIndex) {
720
768
  var O = toIndexedObject$3($this);
721
769
  var length = lengthOfArrayLike(O);
@@ -737,28 +785,28 @@ var createMethod$1 = function (IS_INCLUDES) {
737
785
  var arrayIncludes = {
738
786
  // `Array.prototype.includes` method
739
787
  // https://tc39.es/ecma262/#sec-array.prototype.includes
740
- includes: createMethod$1(true),
788
+ includes: createMethod(true),
741
789
  // `Array.prototype.indexOf` method
742
790
  // https://tc39.es/ecma262/#sec-array.prototype.indexof
743
- indexOf: createMethod$1(false)
791
+ indexOf: createMethod(false)
744
792
  };
745
793
 
746
- var uncurryThis$5 = functionUncurryThis;
747
- var hasOwn$3 = hasOwnProperty_1;
794
+ var uncurryThis$4 = functionUncurryThis;
795
+ var hasOwn$4 = hasOwnProperty_1;
748
796
  var toIndexedObject$2 = toIndexedObject$5;
749
797
  var indexOf = arrayIncludes.indexOf;
750
798
  var hiddenKeys$2 = hiddenKeys$4;
751
799
 
752
- var push = uncurryThis$5([].push);
800
+ var push = uncurryThis$4([].push);
753
801
 
754
802
  var objectKeysInternal = function (object, names) {
755
803
  var O = toIndexedObject$2(object);
756
804
  var i = 0;
757
805
  var result = [];
758
806
  var key;
759
- for (key in O) !hasOwn$3(hiddenKeys$2, key) && hasOwn$3(O, key) && push(result, key);
807
+ for (key in O) !hasOwn$4(hiddenKeys$2, key) && hasOwn$4(O, key) && push(result, key);
760
808
  // Don't enum bug & hidden keys
761
- while (names.length > i) if (hasOwn$3(O, key = names[i++])) {
809
+ while (names.length > i) if (hasOwn$4(O, key = names[i++])) {
762
810
  ~indexOf(result, key) || push(result, key);
763
811
  }
764
812
  return result;
@@ -793,12 +841,12 @@ var objectGetOwnPropertySymbols = {};
793
841
  objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
794
842
 
795
843
  var getBuiltIn$1 = getBuiltIn$4;
796
- var uncurryThis$4 = functionUncurryThis;
844
+ var uncurryThis$3 = functionUncurryThis;
797
845
  var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
798
846
  var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
799
847
  var anObject$3 = anObject$5;
800
848
 
801
- var concat$1 = uncurryThis$4([].concat);
849
+ var concat$1 = uncurryThis$3([].concat);
802
850
 
803
851
  // all object keys, includes non-enumerable and symbols
804
852
  var ownKeys$1 = getBuiltIn$1('Reflect', 'ownKeys') || function ownKeys(it) {
@@ -807,23 +855,25 @@ var ownKeys$1 = getBuiltIn$1('Reflect', 'ownKeys') || function ownKeys(it) {
807
855
  return getOwnPropertySymbols ? concat$1(keys, getOwnPropertySymbols(it)) : keys;
808
856
  };
809
857
 
810
- var hasOwn$2 = hasOwnProperty_1;
858
+ var hasOwn$3 = hasOwnProperty_1;
811
859
  var ownKeys = ownKeys$1;
812
860
  var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
813
861
  var definePropertyModule$2 = objectDefineProperty;
814
862
 
815
- var copyConstructorProperties$1 = function (target, source) {
863
+ var copyConstructorProperties$2 = function (target, source, exceptions) {
816
864
  var keys = ownKeys(source);
817
865
  var defineProperty = definePropertyModule$2.f;
818
866
  var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
819
867
  for (var i = 0; i < keys.length; i++) {
820
868
  var key = keys[i];
821
- if (!hasOwn$2(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
869
+ if (!hasOwn$3(target, key) && !(exceptions && hasOwn$3(exceptions, key))) {
870
+ defineProperty(target, key, getOwnPropertyDescriptor(source, key));
871
+ }
822
872
  }
823
873
  };
824
874
 
825
- var fails$4 = fails$9;
826
- var isCallable$5 = isCallable$e;
875
+ var fails$3 = fails$a;
876
+ var isCallable$6 = isCallable$f;
827
877
 
828
878
  var replacement = /#|\.prototype\./;
829
879
 
@@ -831,7 +881,7 @@ var isForced$1 = function (feature, detection) {
831
881
  var value = data[normalize(feature)];
832
882
  return value == POLYFILL ? true
833
883
  : value == NATIVE ? false
834
- : isCallable$5(detection) ? fails$4(detection)
884
+ : isCallable$6(detection) ? fails$3(detection)
835
885
  : !!detection;
836
886
  };
837
887
 
@@ -850,7 +900,7 @@ var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
850
900
  var createNonEnumerableProperty$2 = createNonEnumerableProperty$5;
851
901
  var redefine$2 = redefine$3.exports;
852
902
  var setGlobal = setGlobal$3;
853
- var copyConstructorProperties = copyConstructorProperties$1;
903
+ var copyConstructorProperties$1 = copyConstructorProperties$2;
854
904
  var isForced = isForced_1;
855
905
 
856
906
  /*
@@ -890,7 +940,7 @@ var _export = function (options, source) {
890
940
  // contained in target
891
941
  if (!FORCED && targetProperty !== undefined) {
892
942
  if (typeof sourceProperty == typeof targetProperty) continue;
893
- copyConstructorProperties(sourceProperty, targetProperty);
943
+ copyConstructorProperties$1(sourceProperty, targetProperty);
894
944
  }
895
945
  // add a flag to not completely full polyfills
896
946
  if (options.sham || (targetProperty && targetProperty.sham)) {
@@ -911,10 +961,10 @@ var objectKeys$2 = Object.keys || function keys(O) {
911
961
  return internalObjectKeys(O, enumBugKeys$1);
912
962
  };
913
963
 
914
- var DESCRIPTORS$1 = descriptors;
915
- var uncurryThis$3 = functionUncurryThis;
964
+ var DESCRIPTORS$3 = descriptors;
965
+ var uncurryThis$2 = functionUncurryThis;
916
966
  var call$1 = functionCall;
917
- var fails$3 = fails$9;
967
+ var fails$2 = fails$a;
918
968
  var objectKeys$1 = objectKeys$2;
919
969
  var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
920
970
  var propertyIsEnumerableModule = objectPropertyIsEnumerable;
@@ -924,17 +974,17 @@ var IndexedObject = indexedObject;
924
974
  // eslint-disable-next-line es/no-object-assign -- safe
925
975
  var $assign = Object.assign;
926
976
  // eslint-disable-next-line es/no-object-defineproperty -- required for testing
927
- var defineProperty$1 = Object.defineProperty;
928
- var concat = uncurryThis$3([].concat);
977
+ var defineProperty$3 = Object.defineProperty;
978
+ var concat = uncurryThis$2([].concat);
929
979
 
930
980
  // `Object.assign` method
931
981
  // https://tc39.es/ecma262/#sec-object.assign
932
- var objectAssign = !$assign || fails$3(function () {
982
+ var objectAssign = !$assign || fails$2(function () {
933
983
  // should have correct order of operations (Edge bug)
934
- if (DESCRIPTORS$1 && $assign({ b: 1 }, $assign(defineProperty$1({}, 'a', {
984
+ if (DESCRIPTORS$3 && $assign({ b: 1 }, $assign(defineProperty$3({}, 'a', {
935
985
  enumerable: true,
936
986
  get: function () {
937
- defineProperty$1(this, 'b', {
987
+ defineProperty$3(this, 'b', {
938
988
  value: 3,
939
989
  enumerable: false
940
990
  });
@@ -963,7 +1013,7 @@ var objectAssign = !$assign || fails$3(function () {
963
1013
  var key;
964
1014
  while (length > j) {
965
1015
  key = keys[j++];
966
- if (!DESCRIPTORS$1 || call$1(propertyIsEnumerable, S, key)) T[key] = S[key];
1016
+ if (!DESCRIPTORS$3 || call$1(propertyIsEnumerable, S, key)) T[key] = S[key];
967
1017
  }
968
1018
  } return T;
969
1019
  } : $assign;
@@ -1102,14 +1152,44 @@ const Modal = _a => {
1102
1152
  } = _a,
1103
1153
  props = __rest(_a, ["type", "isOpen"]);
1104
1154
 
1105
- return isOpen ? jsxs("section", Object.assign({
1106
- role: ModalRole[type]
1107
- }, {
1108
- children: [jsx(ModalHeader, Object.assign({}, props), void 0), jsx(ModalBody, Object.assign({}, props), void 0), jsx(ModalFooter, Object.assign({}, props), void 0)]
1109
- }), void 0) : null;
1155
+ const modalContent = () => {
1156
+ switch (type) {
1157
+ case 'slideout':
1158
+ {
1159
+ return jsxs("aside", Object.assign({
1160
+ role: "dialog"
1161
+ }, {
1162
+ children: [jsx(ModalHeader, Object.assign({}, props), void 0), jsx(ModalBody, Object.assign({}, props), void 0), jsx(ModalFooter, Object.assign({}, props), void 0)]
1163
+ }), void 0);
1164
+ }
1165
+
1166
+ case 'takeover':
1167
+ {
1168
+ return jsxs("main", Object.assign({
1169
+ role: "dialog"
1170
+ }, {
1171
+ children: [jsx(ModalHeader, Object.assign({}, props), void 0), jsx(ModalBody, Object.assign({}, props), void 0), jsx(ModalFooter, Object.assign({}, props), void 0)]
1172
+ }), void 0);
1173
+ }
1174
+
1175
+ default:
1176
+ {
1177
+ return jsxs("section", Object.assign({
1178
+ role: "dialog"
1179
+ }, {
1180
+ children: [jsx(ModalHeader, Object.assign({}, props), void 0), jsx(ModalBody, Object.assign({}, props), void 0), jsx(ModalFooter, Object.assign({}, props), void 0)]
1181
+ }), void 0);
1182
+ }
1183
+ }
1184
+ };
1185
+
1186
+ return isOpen ? modalContent() : null;
1110
1187
  };
1111
1188
 
1112
- var DESCRIPTORS = descriptors;
1189
+ var objectDefineProperties = {};
1190
+
1191
+ var DESCRIPTORS$2 = descriptors;
1192
+ var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
1113
1193
  var definePropertyModule$1 = objectDefineProperty;
1114
1194
  var anObject$2 = anObject$5;
1115
1195
  var toIndexedObject$1 = toIndexedObject$5;
@@ -1118,7 +1198,7 @@ var objectKeys = objectKeys$2;
1118
1198
  // `Object.defineProperties` method
1119
1199
  // https://tc39.es/ecma262/#sec-object.defineproperties
1120
1200
  // eslint-disable-next-line es/no-object-defineproperties -- safe
1121
- var objectDefineProperties = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {
1201
+ objectDefineProperties.f = DESCRIPTORS$2 && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
1122
1202
  anObject$2(O);
1123
1203
  var props = toIndexedObject$1(Properties);
1124
1204
  var keys = objectKeys(Properties);
@@ -1136,7 +1216,7 @@ var html$1 = getBuiltIn('document', 'documentElement');
1136
1216
  /* global ActiveXObject -- old IE, WSH */
1137
1217
 
1138
1218
  var anObject$1 = anObject$5;
1139
- var defineProperties = objectDefineProperties;
1219
+ var definePropertiesModule = objectDefineProperties;
1140
1220
  var enumBugKeys = enumBugKeys$3;
1141
1221
  var hiddenKeys = hiddenKeys$4;
1142
1222
  var html = html$1;
@@ -1214,7 +1294,7 @@ var objectCreate = Object.create || function create(O, Properties) {
1214
1294
  // add "__proto__" for Object.getPrototypeOf polyfill
1215
1295
  result[IE_PROTO$1] = O;
1216
1296
  } else result = NullProtoObject();
1217
- return Properties === undefined ? result : defineProperties(result, Properties);
1297
+ return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
1218
1298
  };
1219
1299
 
1220
1300
  var wellKnownSymbol$6 = wellKnownSymbol$8;
@@ -1240,9 +1320,9 @@ var addToUnscopables$1 = function (key) {
1240
1320
 
1241
1321
  var iterators = {};
1242
1322
 
1243
- var fails$2 = fails$9;
1323
+ var fails$1 = fails$a;
1244
1324
 
1245
- var correctPrototypeGetter = !fails$2(function () {
1325
+ var correctPrototypeGetter = !fails$1(function () {
1246
1326
  function F() { /* empty */ }
1247
1327
  F.prototype.constructor = null;
1248
1328
  // eslint-disable-next-line es/no-object-getprototypeof -- required for testing
@@ -1250,8 +1330,8 @@ var correctPrototypeGetter = !fails$2(function () {
1250
1330
  });
1251
1331
 
1252
1332
  var global$6 = global$r;
1253
- var hasOwn$1 = hasOwnProperty_1;
1254
- var isCallable$4 = isCallable$e;
1333
+ var hasOwn$2 = hasOwnProperty_1;
1334
+ var isCallable$5 = isCallable$f;
1255
1335
  var toObject = toObject$3;
1256
1336
  var sharedKey = sharedKey$3;
1257
1337
  var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter;
@@ -1264,20 +1344,20 @@ var ObjectPrototype = Object$2.prototype;
1264
1344
  // https://tc39.es/ecma262/#sec-object.getprototypeof
1265
1345
  var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? Object$2.getPrototypeOf : function (O) {
1266
1346
  var object = toObject(O);
1267
- if (hasOwn$1(object, IE_PROTO)) return object[IE_PROTO];
1347
+ if (hasOwn$2(object, IE_PROTO)) return object[IE_PROTO];
1268
1348
  var constructor = object.constructor;
1269
- if (isCallable$4(constructor) && object instanceof constructor) {
1349
+ if (isCallable$5(constructor) && object instanceof constructor) {
1270
1350
  return constructor.prototype;
1271
1351
  } return object instanceof Object$2 ? ObjectPrototype : null;
1272
1352
  };
1273
1353
 
1274
- var fails$1 = fails$9;
1275
- var isCallable$3 = isCallable$e;
1354
+ var fails = fails$a;
1355
+ var isCallable$4 = isCallable$f;
1276
1356
  var getPrototypeOf$1 = objectGetPrototypeOf;
1277
1357
  var redefine$1 = redefine$3.exports;
1278
1358
  var wellKnownSymbol$5 = wellKnownSymbol$8;
1279
1359
 
1280
- var ITERATOR$3 = wellKnownSymbol$5('iterator');
1360
+ var ITERATOR$2 = wellKnownSymbol$5('iterator');
1281
1361
  var BUGGY_SAFARI_ITERATORS$1 = false;
1282
1362
 
1283
1363
  // `%IteratorPrototype%` object
@@ -1295,18 +1375,18 @@ if ([].keys) {
1295
1375
  }
1296
1376
  }
1297
1377
 
1298
- var NEW_ITERATOR_PROTOTYPE = IteratorPrototype$2 == undefined || fails$1(function () {
1378
+ var NEW_ITERATOR_PROTOTYPE = IteratorPrototype$2 == undefined || fails(function () {
1299
1379
  var test = {};
1300
1380
  // FF44- legacy iterators case
1301
- return IteratorPrototype$2[ITERATOR$3].call(test) !== test;
1381
+ return IteratorPrototype$2[ITERATOR$2].call(test) !== test;
1302
1382
  });
1303
1383
 
1304
1384
  if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
1305
1385
 
1306
1386
  // `%IteratorPrototype%[@@iterator]()` method
1307
1387
  // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
1308
- if (!isCallable$3(IteratorPrototype$2[ITERATOR$3])) {
1309
- redefine$1(IteratorPrototype$2, ITERATOR$3, function () {
1388
+ if (!isCallable$4(IteratorPrototype$2[ITERATOR$2])) {
1389
+ redefine$1(IteratorPrototype$2, ITERATOR$2, function () {
1310
1390
  return this;
1311
1391
  });
1312
1392
  }
@@ -1316,15 +1396,16 @@ var iteratorsCore = {
1316
1396
  BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
1317
1397
  };
1318
1398
 
1319
- var defineProperty = objectDefineProperty.f;
1320
- var hasOwn = hasOwnProperty_1;
1399
+ var defineProperty$2 = objectDefineProperty.f;
1400
+ var hasOwn$1 = hasOwnProperty_1;
1321
1401
  var wellKnownSymbol$4 = wellKnownSymbol$8;
1322
1402
 
1323
1403
  var TO_STRING_TAG$3 = wellKnownSymbol$4('toStringTag');
1324
1404
 
1325
- var setToStringTag$2 = function (it, TAG, STATIC) {
1326
- if (it && !hasOwn(it = STATIC ? it : it.prototype, TO_STRING_TAG$3)) {
1327
- defineProperty(it, TO_STRING_TAG$3, { configurable: true, value: TAG });
1405
+ var setToStringTag$2 = function (target, TAG, STATIC) {
1406
+ if (target && !STATIC) target = target.prototype;
1407
+ if (target && !hasOwn$1(target, TO_STRING_TAG$3)) {
1408
+ defineProperty$2(target, TO_STRING_TAG$3, { configurable: true, value: TAG });
1328
1409
  }
1329
1410
  };
1330
1411
 
@@ -1345,19 +1426,19 @@ var createIteratorConstructor$1 = function (IteratorConstructor, NAME, next, ENU
1345
1426
  };
1346
1427
 
1347
1428
  var global$5 = global$r;
1348
- var isCallable$2 = isCallable$e;
1429
+ var isCallable$3 = isCallable$f;
1349
1430
 
1350
1431
  var String$2 = global$5.String;
1351
1432
  var TypeError$1 = global$5.TypeError;
1352
1433
 
1353
1434
  var aPossiblePrototype$1 = function (argument) {
1354
- if (typeof argument == 'object' || isCallable$2(argument)) return argument;
1435
+ if (typeof argument == 'object' || isCallable$3(argument)) return argument;
1355
1436
  throw TypeError$1("Can't set " + String$2(argument) + ' as a prototype');
1356
1437
  };
1357
1438
 
1358
1439
  /* eslint-disable no-proto -- safe */
1359
1440
 
1360
- var uncurryThis$2 = functionUncurryThis;
1441
+ var uncurryThis$1 = functionUncurryThis;
1361
1442
  var anObject = anObject$5;
1362
1443
  var aPossiblePrototype = aPossiblePrototype$1;
1363
1444
 
@@ -1371,7 +1452,7 @@ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? functio
1371
1452
  var setter;
1372
1453
  try {
1373
1454
  // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1374
- setter = uncurryThis$2(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
1455
+ setter = uncurryThis$1(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
1375
1456
  setter(test, []);
1376
1457
  CORRECT_SETTER = test instanceof Array;
1377
1458
  } catch (error) { /* empty */ }
@@ -1387,7 +1468,7 @@ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? functio
1387
1468
  var $$1 = _export;
1388
1469
  var call = functionCall;
1389
1470
  var FunctionName = functionName;
1390
- var isCallable$1 = isCallable$e;
1471
+ var isCallable$2 = isCallable$f;
1391
1472
  var createIteratorConstructor = createIteratorConstructor$1;
1392
1473
  var getPrototypeOf = objectGetPrototypeOf;
1393
1474
  var setPrototypeOf = objectSetPrototypeOf;
@@ -1402,7 +1483,7 @@ var PROPER_FUNCTION_NAME = FunctionName.PROPER;
1402
1483
  var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
1403
1484
  var IteratorPrototype = IteratorsCore.IteratorPrototype;
1404
1485
  var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
1405
- var ITERATOR$2 = wellKnownSymbol$3('iterator');
1486
+ var ITERATOR$1 = wellKnownSymbol$3('iterator');
1406
1487
  var KEYS = 'keys';
1407
1488
  var VALUES = 'values';
1408
1489
  var ENTRIES = 'entries';
@@ -1425,7 +1506,7 @@ var defineIterator$1 = function (Iterable, NAME, IteratorConstructor, next, DEFA
1425
1506
  var TO_STRING_TAG = NAME + ' Iterator';
1426
1507
  var INCORRECT_VALUES_NAME = false;
1427
1508
  var IterablePrototype = Iterable.prototype;
1428
- var nativeIterator = IterablePrototype[ITERATOR$2]
1509
+ var nativeIterator = IterablePrototype[ITERATOR$1]
1429
1510
  || IterablePrototype['@@iterator']
1430
1511
  || DEFAULT && IterablePrototype[DEFAULT];
1431
1512
  var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
@@ -1439,8 +1520,8 @@ var defineIterator$1 = function (Iterable, NAME, IteratorConstructor, next, DEFA
1439
1520
  if (getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
1440
1521
  if (setPrototypeOf) {
1441
1522
  setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
1442
- } else if (!isCallable$1(CurrentIteratorPrototype[ITERATOR$2])) {
1443
- redefine(CurrentIteratorPrototype, ITERATOR$2, returnThis);
1523
+ } else if (!isCallable$2(CurrentIteratorPrototype[ITERATOR$1])) {
1524
+ redefine(CurrentIteratorPrototype, ITERATOR$1, returnThis);
1444
1525
  }
1445
1526
  }
1446
1527
  // Set @@toStringTag to native iterators
@@ -1473,8 +1554,8 @@ var defineIterator$1 = function (Iterable, NAME, IteratorConstructor, next, DEFA
1473
1554
  }
1474
1555
 
1475
1556
  // define iterator
1476
- if (IterablePrototype[ITERATOR$2] !== defaultIterator) {
1477
- redefine(IterablePrototype, ITERATOR$2, defaultIterator, { name: DEFAULT });
1557
+ if (IterablePrototype[ITERATOR$1] !== defaultIterator) {
1558
+ redefine(IterablePrototype, ITERATOR$1, defaultIterator, { name: DEFAULT });
1478
1559
  }
1479
1560
  Iterators$1[NAME] = defaultIterator;
1480
1561
 
@@ -1485,7 +1566,9 @@ var toIndexedObject = toIndexedObject$5;
1485
1566
  var addToUnscopables = addToUnscopables$1;
1486
1567
  var Iterators = iterators;
1487
1568
  var InternalStateModule = internalState;
1569
+ var defineProperty$1 = objectDefineProperty.f;
1488
1570
  var defineIterator = defineIterator$1;
1571
+ var DESCRIPTORS$1 = descriptors;
1489
1572
 
1490
1573
  var ARRAY_ITERATOR = 'Array Iterator';
1491
1574
  var setInternalState = InternalStateModule.set;
@@ -1527,13 +1610,18 @@ var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind)
1527
1610
  // argumentsList[@@iterator] is %ArrayProto_values%
1528
1611
  // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
1529
1612
  // https://tc39.es/ecma262/#sec-createmappedargumentsobject
1530
- Iterators.Arguments = Iterators.Array;
1613
+ var values = Iterators.Arguments = Iterators.Array;
1531
1614
 
1532
1615
  // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1533
1616
  addToUnscopables('keys');
1534
1617
  addToUnscopables('values');
1535
1618
  addToUnscopables('entries');
1536
1619
 
1620
+ // V8 ~ Chrome 45- bug
1621
+ if (DESCRIPTORS$1 && values.name !== 'values') try {
1622
+ defineProperty$1(values, 'name', { value: 'values' });
1623
+ } catch (error) { /* empty */ }
1624
+
1537
1625
  // iterable DOM collections
1538
1626
  // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
1539
1627
  var domIterables = {
@@ -1585,17 +1673,17 @@ var ArrayIteratorMethods = es_array_iterator;
1585
1673
  var createNonEnumerableProperty = createNonEnumerableProperty$5;
1586
1674
  var wellKnownSymbol$2 = wellKnownSymbol$8;
1587
1675
 
1588
- var ITERATOR$1 = wellKnownSymbol$2('iterator');
1676
+ var ITERATOR = wellKnownSymbol$2('iterator');
1589
1677
  var TO_STRING_TAG$2 = wellKnownSymbol$2('toStringTag');
1590
1678
  var ArrayValues = ArrayIteratorMethods.values;
1591
1679
 
1592
1680
  var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
1593
1681
  if (CollectionPrototype) {
1594
1682
  // some Chrome versions have non-configurable methods on DOMTokenList
1595
- if (CollectionPrototype[ITERATOR$1] !== ArrayValues) try {
1596
- createNonEnumerableProperty(CollectionPrototype, ITERATOR$1, ArrayValues);
1683
+ if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
1684
+ createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);
1597
1685
  } catch (error) {
1598
- CollectionPrototype[ITERATOR$1] = ArrayValues;
1686
+ CollectionPrototype[ITERATOR] = ArrayValues;
1599
1687
  }
1600
1688
  if (!CollectionPrototype[TO_STRING_TAG$2]) {
1601
1689
  createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG$2, COLLECTION_NAME);
@@ -1617,46 +1705,45 @@ for (var COLLECTION_NAME in DOMIterables) {
1617
1705
 
1618
1706
  handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
1619
1707
 
1620
- const Flexbox = ({
1621
- alignContent,
1622
- alignItems,
1623
- alignSelf,
1624
- children,
1625
- justifyContent
1626
- }) => {
1708
+ const Flexbox = _a => {
1709
+ var {
1710
+ alignContent,
1711
+ alignItems,
1712
+ alignSelf,
1713
+ children,
1714
+ justifyContent,
1715
+ flexDirection,
1716
+ flexWrap,
1717
+ className
1718
+ } = _a,
1719
+ props = __rest(_a, ["alignContent", "alignItems", "alignSelf", "children", "justifyContent", "flexDirection", "flexWrap", "className"]);
1720
+
1627
1721
  const [classes, setClasses] = useState(['d-flex']);
1628
- const [className, setClassName] = useState('d-flex'); // update className when classes change
1722
+ const [flexClassName, setFlexClassName] = useState('d-flex'); // // update className when classes change
1629
1723
 
1630
- useEffect(() => {
1724
+ useLayoutEffect(() => {
1631
1725
  const newClassName = classes.join(' ');
1632
- if (newClassName !== className) setClassName(newClassName);
1633
- }, [classes, className]); // update classes when props change
1726
+ if (newClassName !== flexClassName) setFlexClassName(newClassName);
1727
+ }, [classes, flexClassName]); // // update classes when props change
1634
1728
 
1635
- useEffect(() => {
1729
+ useLayoutEffect(() => {
1636
1730
  const newClasses = ['d-flex'];
1637
- if (alignItems) newClasses.push(`align-items-${alignItems}`);
1638
- if (alignContent) newClasses.push(`align-content-${alignContent}`);
1639
- if (alignSelf) newClasses.push(`align-content-${alignSelf}`);
1640
- if (justifyContent) newClasses.push(`justify-content-${justifyContent}`);
1731
+ alignItems && newClasses.push(`align-items-${alignItems}`);
1732
+ alignContent && newClasses.push(`align-content-${alignContent}`);
1733
+ alignSelf && newClasses.push(`align-self-${alignSelf}`);
1734
+ justifyContent && newClasses.push(`justify-content-${justifyContent}`);
1735
+ flexDirection && newClasses.push(`flex-${flexDirection}`);
1736
+ flexWrap && newClasses.push(`flex-${flexWrap}`);
1737
+ className && newClasses.push(className);
1641
1738
  setClasses(newClasses);
1642
- }, [alignContent, alignItems, alignSelf, justifyContent]);
1739
+ }, [alignContent, alignItems, alignSelf, justifyContent, flexDirection, flexWrap, className]);
1643
1740
  return jsx("div", Object.assign({
1644
- className: className
1645
- }, {
1741
+ className: flexClassName
1742
+ }, props, {
1646
1743
  children: children
1647
1744
  }), void 0);
1648
1745
  };
1649
1746
 
1650
- function Group({
1651
- children
1652
- }) {
1653
- return jsx("div", Object.assign({
1654
- className: "group"
1655
- }, {
1656
- children: children
1657
- }), void 0);
1658
- }
1659
-
1660
1747
  function Card({
1661
1748
  children,
1662
1749
  header,
@@ -1745,146 +1832,247 @@ const ButtonGroup = ({
1745
1832
  }, void 0);
1746
1833
  };
1747
1834
 
1748
- function Form({
1749
- children,
1750
- direction = 'vertical',
1751
- formSize = 'md'
1752
- }) {
1753
- return jsx("form", Object.assign({
1754
- className: [direction, `size-${formSize}`].join(' ')
1755
- }, {
1756
- children: children
1757
- }), void 0);
1758
- }
1835
+ const validateInputValue = (target, rules, setError) => {
1836
+ const errorMessage = validateInputValueErrors(rules, target);
1837
+ errorMessage ? setErrorInsert(setError, target.name) : setErrorRemove(setError, target.name);
1838
+ return errorMessage;
1839
+ };
1759
1840
 
1760
- var wellKnownSymbol$1 = wellKnownSymbol$8;
1841
+ const validateInputValueErrors = (rules, target) => {
1842
+ const {
1843
+ value,
1844
+ type,
1845
+ checked
1846
+ } = target;
1761
1847
 
1762
- var TO_STRING_TAG$1 = wellKnownSymbol$1('toStringTag');
1763
- var test = {};
1848
+ if ((rules === null || rules === void 0 ? void 0 : rules.custom) instanceof Function) {
1849
+ return rules === null || rules === void 0 ? void 0 : rules.custom();
1850
+ }
1764
1851
 
1765
- test[TO_STRING_TAG$1] = 'z';
1852
+ switch (type) {
1853
+ case 'text':
1854
+ case 'email':
1855
+ case 'number':
1856
+ return validateTextInputValues(value, rules);
1766
1857
 
1767
- var toStringTagSupport = String(test) === '[object z]';
1858
+ case 'checkbox':
1859
+ return validateCheckBoxInput(checked);
1768
1860
 
1769
- var global$3 = global$r;
1770
- var TO_STRING_TAG_SUPPORT = toStringTagSupport;
1771
- var isCallable = isCallable$e;
1772
- var classofRaw = classofRaw$1;
1773
- var wellKnownSymbol = wellKnownSymbol$8;
1774
-
1775
- var TO_STRING_TAG = wellKnownSymbol('toStringTag');
1776
- var Object$1 = global$3.Object;
1861
+ default:
1862
+ return validateTextInputValues(value, rules);
1863
+ }
1864
+ };
1777
1865
 
1778
- // ES3 wrong here
1779
- var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
1866
+ const setErrorInsert = (setError, name) => {
1867
+ setError(errors => {
1868
+ return Object.assign(Object.assign({}, errors), {
1869
+ [name]: true
1870
+ });
1871
+ });
1872
+ };
1780
1873
 
1781
- // fallback for IE11 Script Access Denied error
1782
- var tryGet = function (it, key) {
1783
- try {
1784
- return it[key];
1785
- } catch (error) { /* empty */ }
1874
+ const setErrorRemove = (setError, name) => {
1875
+ setError(errors => {
1876
+ const newError = Object.assign({}, errors);
1877
+ delete newError[name];
1878
+ return newError;
1879
+ });
1786
1880
  };
1787
1881
 
1788
- // getting tag from ES6+ `Object.prototype.toString`
1789
- var classof$1 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
1790
- var O, tag, result;
1791
- return it === undefined ? 'Undefined' : it === null ? 'Null'
1792
- // @@toStringTag case
1793
- : typeof (tag = tryGet(O = Object$1(it), TO_STRING_TAG)) == 'string' ? tag
1794
- // builtinTag case
1795
- : CORRECT_ARGUMENTS ? classofRaw(O)
1796
- // ES3 arguments fallback
1797
- : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
1882
+ const validateTextInputValues = (value, rules) => {
1883
+ switch (rules === null || rules === void 0 ? void 0 : rules.type) {
1884
+ case 'Required':
1885
+ {
1886
+ return value === '' || value === undefined || value === null ? 'error' : null;
1887
+ }
1888
+
1889
+ default:
1890
+ {
1891
+ return;
1892
+ }
1893
+ }
1798
1894
  };
1799
1895
 
1800
- var global$2 = global$r;
1801
- var classof = classof$1;
1896
+ const validateCheckBoxInput = checked => {
1897
+ if (!checked) {
1898
+ return 'error';
1899
+ }
1802
1900
 
1803
- var String$1 = global$2.String;
1901
+ return null;
1902
+ };
1804
1903
 
1805
- var toString$2 = function (argument) {
1806
- if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
1807
- return String$1(argument);
1904
+ const FormContext = /*#__PURE__*/React.createContext({});
1905
+ const useFormContext = () => {
1906
+ return React.useContext(FormContext);
1808
1907
  };
1908
+ const FormProvider = _a => {
1909
+ var {
1910
+ children,
1911
+ direction = 'vertical',
1912
+ formSize = 'md',
1913
+ onSubmit,
1914
+ onFormSubmit
1915
+ } = _a,
1916
+ props = __rest(_a, ["children", "direction", "formSize", "onSubmit", "onFormSubmit"]);
1917
+
1918
+ const [values, setValues] = React.useState();
1919
+ const [errors, setErrors] = React.useState();
1920
+ const [fields, setFields] = React.useState({});
1921
+
1922
+ const formSubmit = event => {
1923
+ let hasError = false;
1924
+ event.preventDefault();
1925
+ Object.keys(fields).forEach(key => {
1926
+ const errorMessage = validateInputValue({
1927
+ name: key,
1928
+ value: values === null || values === void 0 ? void 0 : values[key]
1929
+ }, fields[key], setErrors);
1930
+ hasError = hasError || !!errorMessage;
1931
+ });
1809
1932
 
1810
- // a string of all valid unicode whitespaces
1811
- var whitespaces$2 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
1812
- '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
1933
+ if (!hasError) {
1934
+ onFormSubmit && onFormSubmit(values);
1935
+ }
1936
+ };
1813
1937
 
1814
- var uncurryThis$1 = functionUncurryThis;
1815
- var requireObjectCoercible = requireObjectCoercible$3;
1816
- var toString$1 = toString$2;
1817
- var whitespaces$1 = whitespaces$2;
1818
-
1819
- var replace = uncurryThis$1(''.replace);
1820
- var whitespace = '[' + whitespaces$1 + ']';
1821
- var ltrim = RegExp('^' + whitespace + whitespace + '*');
1822
- var rtrim = RegExp(whitespace + whitespace + '*$');
1823
-
1824
- // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
1825
- var createMethod = function (TYPE) {
1826
- return function ($this) {
1827
- var string = toString$1(requireObjectCoercible($this));
1828
- if (TYPE & 1) string = replace(string, ltrim, '');
1829
- if (TYPE & 2) string = replace(string, rtrim, '');
1830
- return string;
1938
+ const resetForm = () => {
1939
+ setValues({});
1940
+ setErrors({});
1831
1941
  };
1942
+
1943
+ return jsx(FormContext.Provider, Object.assign({
1944
+ value: {
1945
+ setValues,
1946
+ setErrors,
1947
+ setFields,
1948
+ errors,
1949
+ values
1950
+ }
1951
+ }, {
1952
+ children: jsx("form", Object.assign({
1953
+ className: [direction, `size-${formSize}`].join(' '),
1954
+ onSubmit: formSubmit
1955
+ }, props, {
1956
+ onReset: resetForm
1957
+ }, {
1958
+ children: children
1959
+ }), void 0)
1960
+ }), void 0);
1832
1961
  };
1833
1962
 
1834
- var stringTrim = {
1835
- // `String.prototype.{ trimLeft, trimStart }` methods
1836
- // https://tc39.es/ecma262/#sec-string.prototype.trimstart
1837
- start: createMethod(1),
1838
- // `String.prototype.{ trimRight, trimEnd }` methods
1839
- // https://tc39.es/ecma262/#sec-string.prototype.trimend
1840
- end: createMethod(2),
1841
- // `String.prototype.trim` method
1842
- // https://tc39.es/ecma262/#sec-string.prototype.trim
1843
- trim: createMethod(3)
1963
+ const Form = props => {
1964
+ return jsx(FormProvider, Object.assign({}, props), void 0);
1844
1965
  };
1845
1966
 
1846
- var global$1 = global$r;
1847
- var fails = fails$9;
1848
- var uncurryThis = functionUncurryThis;
1849
- var toString = toString$2;
1850
- var trim = stringTrim.trim;
1851
- var whitespaces = whitespaces$2;
1852
-
1853
- var $parseInt$1 = global$1.parseInt;
1854
- var Symbol$1 = global$1.Symbol;
1855
- var ITERATOR = Symbol$1 && Symbol$1.iterator;
1856
- var hex = /^[+-]?0x/i;
1857
- var exec = uncurryThis(hex.exec);
1858
- var FORCED = $parseInt$1(whitespaces + '08') !== 8 || $parseInt$1(whitespaces + '0x16') !== 22
1859
- // MS Edge 18- broken with boxed symbols
1860
- || (ITERATOR && !fails(function () { $parseInt$1(Object(ITERATOR)); }));
1861
-
1862
- // `parseInt` method
1863
- // https://tc39.es/ecma262/#sec-parseint-string-radix
1864
- var numberParseInt = FORCED ? function parseInt(string, radix) {
1865
- var S = trim(toString(string));
1866
- return $parseInt$1(S, (radix >>> 0) || (exec(hex, S) ? 16 : 10));
1867
- } : $parseInt$1;
1967
+ const FormItems = ({
1968
+ children,
1969
+ validate,
1970
+ name
1971
+ }) => {
1972
+ const {
1973
+ setValues,
1974
+ setErrors,
1975
+ setFields,
1976
+ errors
1977
+ } = useFormContext();
1978
+ React.useEffect(() => {
1979
+ setFields(fields => Object.assign(Object.assign({}, fields), {
1980
+ [name]: validate === null || validate === void 0 ? void 0 : validate.rules
1981
+ }));
1982
+
1983
+ const removeValues = values => {
1984
+ const newValues = Object.assign({}, values);
1985
+ delete newValues[name];
1986
+ return newValues;
1987
+ };
1868
1988
 
1869
- var $ = _export;
1870
- var $parseInt = numberParseInt;
1989
+ return () => {
1990
+ setFields(fields => removeValues(fields));
1991
+ setValues(values => removeValues(values));
1992
+ setErrors(errors => removeValues(errors));
1993
+ };
1994
+ }, []);
1871
1995
 
1872
- // `parseInt` method
1873
- // https://tc39.es/ecma262/#sec-parseint-string-radix
1874
- $({ global: true, forced: parseInt != $parseInt }, {
1875
- parseInt: $parseInt
1876
- });
1996
+ const onChange = event => {
1997
+ const {
1998
+ value,
1999
+ name,
2000
+ type,
2001
+ checked
2002
+ } = event.target;
2003
+
2004
+ if (type === 'checkbox') {
2005
+ if (checked) {
2006
+ setValues(values => {
2007
+ return Object.assign(Object.assign({}, values), {
2008
+ [name]: {
2009
+ value,
2010
+ checked
2011
+ }
2012
+ });
2013
+ });
2014
+ } else {
2015
+ setValues(values => {
2016
+ return Object.assign(Object.assign({}, values), {
2017
+ [name]: null
2018
+ });
2019
+ });
2020
+ }
2021
+ } else {
2022
+ setValues(values => {
2023
+ return Object.assign(Object.assign({}, values), {
2024
+ [name]: value
2025
+ });
2026
+ });
2027
+ }
1877
2028
 
1878
- const useInput = (props, evaluator, notify) => {
2029
+ validateInputValue({
2030
+ value,
2031
+ name,
2032
+ type,
2033
+ checked
2034
+ }, validate === null || validate === void 0 ? void 0 : validate.rules, setErrors);
2035
+ };
2036
+
2037
+ return /*#__PURE__*/React.cloneElement(children, {
2038
+ validator: (errors === null || errors === void 0 ? void 0 : errors[name]) && validate,
2039
+ name,
2040
+ onChange
2041
+ });
2042
+ };
2043
+
2044
+ function Group({
2045
+ children,
2046
+ error,
2047
+ groupBorder = false
2048
+ }) {
2049
+ const groupClassName = `group ${groupBorder ? 'group-border' : ''} ${error ? 'is-invalid' : ''}`;
2050
+ const errorMessage = error ? error.message || error : '';
2051
+ return jsxs("div", Object.assign({
2052
+ className: "form-group"
2053
+ }, {
2054
+ children: [jsx("div", Object.assign({
2055
+ className: groupClassName
2056
+ }, {
2057
+ children: children
2058
+ }), void 0), error && jsx("span", Object.assign({
2059
+ className: "form-info"
2060
+ }, {
2061
+ children: errorMessage
2062
+ }), void 0)]
2063
+ }), void 0);
2064
+ }
2065
+
2066
+ const useInput = (props, onChanges, onChangeInput) => {
1879
2067
  const id = useMemo(() => props.id || randomId(), [props.id]);
1880
2068
  const ref = useRef(null);
1881
- const [value, setValue] = useState(props.value);
1882
- const [checked, setChecked] = useState(props.checked);
2069
+ const [value, setValue] = useState(props.value ? props.value : '');
2070
+ const [checked, setChecked] = useState(props.checked ? props.checked : false);
1883
2071
  useEffect(() => {
1884
2072
  if (ref.current && ref.current.form) {
1885
2073
  const resetListener = () => {
1886
- setValue(props.value);
1887
- setChecked(props.checked);
2074
+ setValue(props.value ? props.value : '');
2075
+ setChecked(props.checked ? props.checked : false);
1888
2076
  };
1889
2077
 
1890
2078
  const form = ref.current.form;
@@ -1898,8 +2086,9 @@ const useInput = (props, evaluator, notify) => {
1898
2086
 
1899
2087
  const onChange = event => {
1900
2088
  setValue(event.target.value);
1901
- setChecked(event.target.checked);
1902
- if (notify) notify(evaluator(event.target));
2089
+ setChecked(event.currentTarget.checked);
2090
+ onChanges && onChanges(event);
2091
+ onChangeInput && onChangeInput(event.target.value);
1903
2092
  };
1904
2093
 
1905
2094
  return Object.assign(Object.assign({}, props), {
@@ -1911,8 +2100,8 @@ const useInput = (props, evaluator, notify) => {
1911
2100
  });
1912
2101
  };
1913
2102
 
1914
- const RenderInput = (type, props, evaluator, label, info, listener) => {
1915
- const _a = useInput(props, evaluator, listener),
2103
+ const RenderInput = (type, props, onChange, onChangeInput, label, info, validator) => {
2104
+ const _a = useInput(props, onChange, onChangeInput),
1916
2105
  {
1917
2106
  value
1918
2107
  } = _a,
@@ -1920,9 +2109,14 @@ const RenderInput = (type, props, evaluator, label, info, listener) => {
1920
2109
 
1921
2110
  const propsWithDescription = info ? Object.assign(Object.assign({}, inputProps), {
1922
2111
  'aria-describedby': `${inputProps.id}_info`
1923
- }) : inputProps;
2112
+ }) : inputProps; // Render naked
2113
+
2114
+ if (!label && !info) return jsx("input", Object.assign({
2115
+ type: type,
2116
+ value: value
2117
+ }, propsWithDescription), void 0);
1924
2118
  return jsxs("div", Object.assign({
1925
- className: "form-field"
2119
+ className: "form-group"
1926
2120
  }, {
1927
2121
  children: [label && jsx("label", Object.assign({
1928
2122
  htmlFor: inputProps.id
@@ -1930,61 +2124,104 @@ const RenderInput = (type, props, evaluator, label, info, listener) => {
1930
2124
  children: label
1931
2125
  }), void 0), info && jsx("span", Object.assign({
1932
2126
  className: "form-info",
1933
- id: "{inputProps.id}_info"
2127
+ id: `${inputProps.id}_info`
1934
2128
  }, {
1935
2129
  children: info
1936
2130
  }), void 0), jsx("input", Object.assign({
1937
2131
  type: type,
1938
2132
  value: value
1939
- }, propsWithDescription), void 0)]
2133
+ }, propsWithDescription, {
2134
+ className: validator && validateClassName(validator === null || validator === void 0 ? void 0 : validator.indicator)
2135
+ }), void 0), validator && jsx("span", Object.assign({
2136
+ className: "form-info"
2137
+ }, {
2138
+ children: validator.message
2139
+ }), void 0)]
1940
2140
  }), void 0);
1941
2141
  };
1942
-
1943
2142
  const TextInput = _a => {
1944
2143
  var {
1945
2144
  label,
1946
2145
  info,
1947
- onChangeText
2146
+ onChange,
2147
+ onChangeInput,
2148
+ validator
1948
2149
  } = _a,
1949
- props = __rest(_a, ["label", "info", "onChangeText"]);
2150
+ props = __rest(_a, ["label", "info", "onChange", "onChangeInput", "validator"]);
1950
2151
 
1951
- return RenderInput('text', props, e => e.value, label, info, onChangeText);
2152
+ return RenderInput('text', props, onChange, onChangeInput, label, info, validator);
1952
2153
  };
1953
2154
  const EmailInput = _a => {
1954
2155
  var {
1955
2156
  label,
1956
2157
  info,
1957
- onChangeText
2158
+ onChange,
2159
+ onChangeInput,
2160
+ validator
1958
2161
  } = _a,
1959
- props = __rest(_a, ["label", "info", "onChangeText"]);
2162
+ props = __rest(_a, ["label", "info", "onChange", "onChangeInput", "validator"]);
1960
2163
 
1961
- return RenderInput('email', props, e => e.value, label, info, onChangeText);
2164
+ return RenderInput('email', props, onChange, onChangeInput, label, info, validator);
1962
2165
  };
1963
2166
  const NumberInput = _a => {
1964
2167
  var {
1965
2168
  label,
1966
2169
  info,
1967
- onChangeText
2170
+ onChange,
2171
+ onChangeInput,
2172
+ validator
1968
2173
  } = _a,
1969
- props = __rest(_a, ["label", "info", "onChangeText"]);
2174
+ props = __rest(_a, ["label", "info", "onChange", "onChangeInput", "validator"]);
1970
2175
 
1971
- return RenderInput('number', props, e => e.value.length ? parseInt(e.value, 10) : undefined, label, info, onChangeText);
2176
+ return RenderInput('number', props, onChange, onChangeInput, label, info, validator);
1972
2177
  };
1973
2178
  const Checkbox = _a => {
1974
2179
  var {
1975
2180
  label,
1976
- onChecked
2181
+ onChange,
2182
+ validator
1977
2183
  } = _a,
1978
- props = __rest(_a, ["label", "onChecked"]);
2184
+ props = __rest(_a, ["label", "onChange", "validator"]);
2185
+
2186
+ const inputProps = useInput(props, onChange);
2187
+ const validatorClassName = validateClassName(validator === null || validator === void 0 ? void 0 : validator.indicator);
2188
+ return jsxs(Fragment, {
2189
+ children: [jsxs("label", Object.assign({
2190
+ htmlFor: inputProps.id,
2191
+ className: `form-control ${validatorClassName}`
2192
+ }, {
2193
+ children: [label, jsx("input", Object.assign({
2194
+ type: "checkbox"
2195
+ }, inputProps), void 0), jsx("span", {}, void 0), jsx("i", {}, void 0)]
2196
+ }), void 0), validator && jsx("span", Object.assign({
2197
+ className: "form-info"
2198
+ }, {
2199
+ children: validator.message
2200
+ }), void 0)]
2201
+ }, void 0);
2202
+ };
2203
+ const RadioButton = _a => {
2204
+ var {
2205
+ label,
2206
+ validator
2207
+ } = _a,
2208
+ props = __rest(_a, ["label", "validator"]);
1979
2209
 
1980
- const inputProps = useInput(props, e => e.checked, onChecked);
2210
+ const {
2211
+ id
2212
+ } = useInput(props);
1981
2213
  return jsxs("label", Object.assign({
1982
- htmlFor: inputProps.id,
2214
+ htmlFor: id,
1983
2215
  className: "form-control"
1984
2216
  }, {
1985
- children: [label, jsx("input", Object.assign({
1986
- type: "checkbox"
1987
- }, inputProps), void 0), jsx("span", {}, void 0)]
2217
+ children: [jsx("input", Object.assign({
2218
+ id: id,
2219
+ type: "radio"
2220
+ }, props, {
2221
+ className: validator
2222
+ }), void 0), jsx("span", {
2223
+ children: label
2224
+ }, void 0), jsx("i", {}, void 0)]
1988
2225
  }), void 0);
1989
2226
  };
1990
2227
 
@@ -1996,6 +2233,155 @@ const Text = ({
1996
2233
  children: children
1997
2234
  }), void 0);
1998
2235
 
2236
+ var wellKnownSymbol$1 = wellKnownSymbol$8;
2237
+
2238
+ var TO_STRING_TAG$1 = wellKnownSymbol$1('toStringTag');
2239
+ var test = {};
2240
+
2241
+ test[TO_STRING_TAG$1] = 'z';
2242
+
2243
+ var toStringTagSupport = String(test) === '[object z]';
2244
+
2245
+ var global$3 = global$r;
2246
+ var TO_STRING_TAG_SUPPORT = toStringTagSupport;
2247
+ var isCallable$1 = isCallable$f;
2248
+ var classofRaw = classofRaw$1;
2249
+ var wellKnownSymbol = wellKnownSymbol$8;
2250
+
2251
+ var TO_STRING_TAG = wellKnownSymbol('toStringTag');
2252
+ var Object$1 = global$3.Object;
2253
+
2254
+ // ES3 wrong here
2255
+ var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
2256
+
2257
+ // fallback for IE11 Script Access Denied error
2258
+ var tryGet = function (it, key) {
2259
+ try {
2260
+ return it[key];
2261
+ } catch (error) { /* empty */ }
2262
+ };
2263
+
2264
+ // getting tag from ES6+ `Object.prototype.toString`
2265
+ var classof$1 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
2266
+ var O, tag, result;
2267
+ return it === undefined ? 'Undefined' : it === null ? 'Null'
2268
+ // @@toStringTag case
2269
+ : typeof (tag = tryGet(O = Object$1(it), TO_STRING_TAG)) == 'string' ? tag
2270
+ // builtinTag case
2271
+ : CORRECT_ARGUMENTS ? classofRaw(O)
2272
+ // ES3 arguments fallback
2273
+ : (result = classofRaw(O)) == 'Object' && isCallable$1(O.callee) ? 'Arguments' : result;
2274
+ };
2275
+
2276
+ var global$2 = global$r;
2277
+ var classof = classof$1;
2278
+
2279
+ var String$1 = global$2.String;
2280
+
2281
+ var toString$1 = function (argument) {
2282
+ if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
2283
+ return String$1(argument);
2284
+ };
2285
+
2286
+ var $ = _export;
2287
+ var DESCRIPTORS = descriptors;
2288
+ var global$1 = global$r;
2289
+ var uncurryThis = functionUncurryThis;
2290
+ var hasOwn = hasOwnProperty_1;
2291
+ var isCallable = isCallable$f;
2292
+ var isPrototypeOf = objectIsPrototypeOf;
2293
+ var toString = toString$1;
2294
+ var defineProperty = objectDefineProperty.f;
2295
+ var copyConstructorProperties = copyConstructorProperties$2;
2296
+
2297
+ var NativeSymbol = global$1.Symbol;
2298
+ var SymbolPrototype = NativeSymbol && NativeSymbol.prototype;
2299
+
2300
+ if (DESCRIPTORS && isCallable(NativeSymbol) && (!('description' in SymbolPrototype) ||
2301
+ // Safari 12 bug
2302
+ NativeSymbol().description !== undefined
2303
+ )) {
2304
+ var EmptyStringDescriptionStore = {};
2305
+ // wrap Symbol constructor for correct work with undefined description
2306
+ var SymbolWrapper = function Symbol() {
2307
+ var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString(arguments[0]);
2308
+ var result = isPrototypeOf(SymbolPrototype, this)
2309
+ ? new NativeSymbol(description)
2310
+ // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
2311
+ : description === undefined ? NativeSymbol() : NativeSymbol(description);
2312
+ if (description === '') EmptyStringDescriptionStore[result] = true;
2313
+ return result;
2314
+ };
2315
+
2316
+ copyConstructorProperties(SymbolWrapper, NativeSymbol);
2317
+ SymbolWrapper.prototype = SymbolPrototype;
2318
+ SymbolPrototype.constructor = SymbolWrapper;
2319
+
2320
+ var NATIVE_SYMBOL = String(NativeSymbol('test')) == 'Symbol(test)';
2321
+ var symbolToString = uncurryThis(SymbolPrototype.toString);
2322
+ var symbolValueOf = uncurryThis(SymbolPrototype.valueOf);
2323
+ var regexp = /^Symbol\((.*)\)[^)]+$/;
2324
+ var replace = uncurryThis(''.replace);
2325
+ var stringSlice = uncurryThis(''.slice);
2326
+
2327
+ defineProperty(SymbolPrototype, 'description', {
2328
+ configurable: true,
2329
+ get: function description() {
2330
+ var symbol = symbolValueOf(this);
2331
+ var string = symbolToString(symbol);
2332
+ if (hasOwn(EmptyStringDescriptionStore, symbol)) return '';
2333
+ var desc = NATIVE_SYMBOL ? stringSlice(string, 7, -1) : replace(string, regexp, '$1');
2334
+ return desc === '' ? undefined : desc;
2335
+ }
2336
+ });
2337
+
2338
+ $({ global: true, forced: true }, {
2339
+ Symbol: SymbolWrapper
2340
+ });
2341
+ }
2342
+
2343
+ const RadioGroup = ({
2344
+ description,
2345
+ title,
2346
+ validator,
2347
+ onChangeRadio,
2348
+ children
2349
+ }) => {
2350
+ const [checked, setChecked] = React.useState();
2351
+ const validatorClassName = validateClassName(validator === null || validator === void 0 ? void 0 : validator.indicator);
2352
+
2353
+ const onChange = event => {
2354
+ setChecked(event.target.value);
2355
+ onChangeRadio && onChangeRadio(event.target.value);
2356
+ };
2357
+
2358
+ return jsxs("div", Object.assign({
2359
+ className: "form-group"
2360
+ }, {
2361
+ children: [jsxs("fieldset", Object.assign({
2362
+ className: validatorClassName
2363
+ }, {
2364
+ children: [jsx("legend", {
2365
+ children: title
2366
+ }, void 0), jsx("span", Object.assign({
2367
+ className: "form-info"
2368
+ }, {
2369
+ children: description
2370
+ }), void 0), React.Children.map(children, Child => {
2371
+ return /*#__PURE__*/React.isValidElement(Child) ? /*#__PURE__*/React.cloneElement(Child, {
2372
+ validator: validatorClassName,
2373
+ onChange,
2374
+ checked: checked === Child.props.value
2375
+ }) : Child;
2376
+ })]
2377
+ }), void 0), (validator === null || validator === void 0 ? void 0 : validator.message) && jsx("span", Object.assign({
2378
+ className: "form-info"
2379
+ }, {
2380
+ children: validator === null || validator === void 0 ? void 0 : validator.message
2381
+ }), void 0)]
2382
+ }), void 0);
2383
+ };
2384
+
1999
2385
  const ListItem = _a => {
2000
2386
  var {
2001
2387
  listType,
@@ -2138,4 +2524,4 @@ const Navbar = ({
2138
2524
  }), void 0);
2139
2525
  };
2140
2526
 
2141
- export { Alert, Button, ButtonGroup, Card, Checkbox, EmailInput, Flexbox, Form, Group, Link, List, Modal, Navbar, NumberInput, Text, TextInput };
2527
+ export { Alert, Button, ButtonGroup, Card, Checkbox, EmailInput, Flexbox, Form, FormItems, Group, Link, List, Modal, Navbar, NumberInput, RadioButton, RadioGroup, RenderInput, Text, TextInput };