@iabbb/bds-react 0.40.0-beta.21 → 0.40.0-beta.22

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.
@@ -23,53 +23,336 @@ function _interopNamespaceDefault(e) {
23
23
 
24
24
  var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
25
25
 
26
- function _iterableToArrayLimit(r, l) {
27
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
28
- if (null != t) {
29
- var e,
30
- n,
31
- i,
32
- u,
33
- a = [],
34
- f = !0,
35
- o = !1;
26
+ function _regeneratorRuntime() {
27
+ _regeneratorRuntime = function () {
28
+ return e;
29
+ };
30
+ var t,
31
+ e = {},
32
+ r = Object.prototype,
33
+ n = r.hasOwnProperty,
34
+ o = Object.defineProperty || function (t, e, r) {
35
+ t[e] = r.value;
36
+ },
37
+ i = "function" == typeof Symbol ? Symbol : {},
38
+ a = i.iterator || "@@iterator",
39
+ c = i.asyncIterator || "@@asyncIterator",
40
+ u = i.toStringTag || "@@toStringTag";
41
+ function define(t, e, r) {
42
+ return Object.defineProperty(t, e, {
43
+ value: r,
44
+ enumerable: !0,
45
+ configurable: !0,
46
+ writable: !0
47
+ }), t[e];
48
+ }
49
+ try {
50
+ define({}, "");
51
+ } catch (t) {
52
+ define = function (t, e, r) {
53
+ return t[e] = r;
54
+ };
55
+ }
56
+ function wrap(t, e, r, n) {
57
+ var i = e && e.prototype instanceof Generator ? e : Generator,
58
+ a = Object.create(i.prototype),
59
+ c = new Context(n || []);
60
+ return o(a, "_invoke", {
61
+ value: makeInvokeMethod(t, r, c)
62
+ }), a;
63
+ }
64
+ function tryCatch(t, e, r) {
36
65
  try {
37
- if (i = (t = t.call(r)).next, 0 === l) {
38
- if (Object(t) !== t) return;
39
- f = !1;
40
- } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
41
- } catch (r) {
42
- o = !0, n = r;
43
- } finally {
44
- try {
45
- if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
46
- } finally {
47
- if (o) throw n;
66
+ return {
67
+ type: "normal",
68
+ arg: t.call(e, r)
69
+ };
70
+ } catch (t) {
71
+ return {
72
+ type: "throw",
73
+ arg: t
74
+ };
75
+ }
76
+ }
77
+ e.wrap = wrap;
78
+ var h = "suspendedStart",
79
+ l = "suspendedYield",
80
+ f = "executing",
81
+ s = "completed",
82
+ y = {};
83
+ function Generator() {}
84
+ function GeneratorFunction() {}
85
+ function GeneratorFunctionPrototype() {}
86
+ var p = {};
87
+ define(p, a, function () {
88
+ return this;
89
+ });
90
+ var d = Object.getPrototypeOf,
91
+ v = d && d(d(values([])));
92
+ v && v !== r && n.call(v, a) && (p = v);
93
+ var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
94
+ function defineIteratorMethods(t) {
95
+ ["next", "throw", "return"].forEach(function (e) {
96
+ define(t, e, function (t) {
97
+ return this._invoke(e, t);
98
+ });
99
+ });
100
+ }
101
+ function AsyncIterator(t, e) {
102
+ function invoke(r, o, i, a) {
103
+ var c = tryCatch(t[r], t, o);
104
+ if ("throw" !== c.type) {
105
+ var u = c.arg,
106
+ h = u.value;
107
+ return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
108
+ invoke("next", t, i, a);
109
+ }, function (t) {
110
+ invoke("throw", t, i, a);
111
+ }) : e.resolve(h).then(function (t) {
112
+ u.value = t, i(u);
113
+ }, function (t) {
114
+ return invoke("throw", t, i, a);
115
+ });
116
+ }
117
+ a(c.arg);
118
+ }
119
+ var r;
120
+ o(this, "_invoke", {
121
+ value: function (t, n) {
122
+ function callInvokeWithMethodAndArg() {
123
+ return new e(function (e, r) {
124
+ invoke(t, n, e, r);
125
+ });
126
+ }
127
+ return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
128
+ }
129
+ });
130
+ }
131
+ function makeInvokeMethod(e, r, n) {
132
+ var o = h;
133
+ return function (i, a) {
134
+ if (o === f) throw new Error("Generator is already running");
135
+ if (o === s) {
136
+ if ("throw" === i) throw a;
137
+ return {
138
+ value: t,
139
+ done: !0
140
+ };
141
+ }
142
+ for (n.method = i, n.arg = a;;) {
143
+ var c = n.delegate;
144
+ if (c) {
145
+ var u = maybeInvokeDelegate(c, n);
146
+ if (u) {
147
+ if (u === y) continue;
148
+ return u;
149
+ }
150
+ }
151
+ if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
152
+ if (o === h) throw o = s, n.arg;
153
+ n.dispatchException(n.arg);
154
+ } else "return" === n.method && n.abrupt("return", n.arg);
155
+ o = f;
156
+ var p = tryCatch(e, r, n);
157
+ if ("normal" === p.type) {
158
+ if (o = n.done ? s : l, p.arg === y) continue;
159
+ return {
160
+ value: p.arg,
161
+ done: n.done
162
+ };
163
+ }
164
+ "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
165
+ }
166
+ };
167
+ }
168
+ function maybeInvokeDelegate(e, r) {
169
+ var n = r.method,
170
+ o = e.iterator[n];
171
+ if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
172
+ var i = tryCatch(o, e.iterator, r.arg);
173
+ if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
174
+ var a = i.arg;
175
+ return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
176
+ }
177
+ function pushTryEntry(t) {
178
+ var e = {
179
+ tryLoc: t[0]
180
+ };
181
+ 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
182
+ }
183
+ function resetTryEntry(t) {
184
+ var e = t.completion || {};
185
+ e.type = "normal", delete e.arg, t.completion = e;
186
+ }
187
+ function Context(t) {
188
+ this.tryEntries = [{
189
+ tryLoc: "root"
190
+ }], t.forEach(pushTryEntry, this), this.reset(!0);
191
+ }
192
+ function values(e) {
193
+ if (e || "" === e) {
194
+ var r = e[a];
195
+ if (r) return r.call(e);
196
+ if ("function" == typeof e.next) return e;
197
+ if (!isNaN(e.length)) {
198
+ var o = -1,
199
+ i = function next() {
200
+ for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
201
+ return next.value = t, next.done = !0, next;
202
+ };
203
+ return i.next = i;
48
204
  }
49
205
  }
50
- return a;
206
+ throw new TypeError(typeof e + " is not iterable");
51
207
  }
208
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
209
+ value: GeneratorFunctionPrototype,
210
+ configurable: !0
211
+ }), o(GeneratorFunctionPrototype, "constructor", {
212
+ value: GeneratorFunction,
213
+ configurable: !0
214
+ }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
215
+ var e = "function" == typeof t && t.constructor;
216
+ return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
217
+ }, e.mark = function (t) {
218
+ return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
219
+ }, e.awrap = function (t) {
220
+ return {
221
+ __await: t
222
+ };
223
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
224
+ return this;
225
+ }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
226
+ void 0 === i && (i = Promise);
227
+ var a = new AsyncIterator(wrap(t, r, n, o), i);
228
+ return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
229
+ return t.done ? t.value : a.next();
230
+ });
231
+ }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
232
+ return this;
233
+ }), define(g, "toString", function () {
234
+ return "[object Generator]";
235
+ }), e.keys = function (t) {
236
+ var e = Object(t),
237
+ r = [];
238
+ for (var n in e) r.push(n);
239
+ return r.reverse(), function next() {
240
+ for (; r.length;) {
241
+ var t = r.pop();
242
+ if (t in e) return next.value = t, next.done = !1, next;
243
+ }
244
+ return next.done = !0, next;
245
+ };
246
+ }, e.values = values, Context.prototype = {
247
+ constructor: Context,
248
+ reset: function (e) {
249
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
250
+ },
251
+ stop: function () {
252
+ this.done = !0;
253
+ var t = this.tryEntries[0].completion;
254
+ if ("throw" === t.type) throw t.arg;
255
+ return this.rval;
256
+ },
257
+ dispatchException: function (e) {
258
+ if (this.done) throw e;
259
+ var r = this;
260
+ function handle(n, o) {
261
+ return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
262
+ }
263
+ for (var o = this.tryEntries.length - 1; o >= 0; --o) {
264
+ var i = this.tryEntries[o],
265
+ a = i.completion;
266
+ if ("root" === i.tryLoc) return handle("end");
267
+ if (i.tryLoc <= this.prev) {
268
+ var c = n.call(i, "catchLoc"),
269
+ u = n.call(i, "finallyLoc");
270
+ if (c && u) {
271
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
272
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
273
+ } else if (c) {
274
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
275
+ } else {
276
+ if (!u) throw new Error("try statement without catch or finally");
277
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
278
+ }
279
+ }
280
+ }
281
+ },
282
+ abrupt: function (t, e) {
283
+ for (var r = this.tryEntries.length - 1; r >= 0; --r) {
284
+ var o = this.tryEntries[r];
285
+ if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
286
+ var i = o;
287
+ break;
288
+ }
289
+ }
290
+ i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
291
+ var a = i ? i.completion : {};
292
+ return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
293
+ },
294
+ complete: function (t, e) {
295
+ if ("throw" === t.type) throw t.arg;
296
+ return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
297
+ },
298
+ finish: function (t) {
299
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
300
+ var r = this.tryEntries[e];
301
+ if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
302
+ }
303
+ },
304
+ catch: function (t) {
305
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
306
+ var r = this.tryEntries[e];
307
+ if (r.tryLoc === t) {
308
+ var n = r.completion;
309
+ if ("throw" === n.type) {
310
+ var o = n.arg;
311
+ resetTryEntry(r);
312
+ }
313
+ return o;
314
+ }
315
+ }
316
+ throw new Error("illegal catch attempt");
317
+ },
318
+ delegateYield: function (e, r, n) {
319
+ return this.delegate = {
320
+ iterator: values(e),
321
+ resultName: r,
322
+ nextLoc: n
323
+ }, "next" === this.method && (this.arg = t), y;
324
+ }
325
+ }, e;
52
326
  }
53
- function ownKeys(e, r) {
54
- var t = Object.keys(e);
55
- if (Object.getOwnPropertySymbols) {
56
- var o = Object.getOwnPropertySymbols(e);
57
- r && (o = o.filter(function (r) {
58
- return Object.getOwnPropertyDescriptor(e, r).enumerable;
59
- })), t.push.apply(t, o);
327
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
328
+ try {
329
+ var info = gen[key](arg);
330
+ var value = info.value;
331
+ } catch (error) {
332
+ reject(error);
333
+ return;
334
+ }
335
+ if (info.done) {
336
+ resolve(value);
337
+ } else {
338
+ Promise.resolve(value).then(_next, _throw);
60
339
  }
61
- return t;
62
340
  }
63
- function _objectSpread2(e) {
64
- for (var r = 1; r < arguments.length; r++) {
65
- var t = null != arguments[r] ? arguments[r] : {};
66
- r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
67
- _defineProperty(e, r, t[r]);
68
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
69
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
341
+ function _asyncToGenerator(fn) {
342
+ return function () {
343
+ var self = this,
344
+ args = arguments;
345
+ return new Promise(function (resolve, reject) {
346
+ var gen = fn.apply(self, args);
347
+ function _next(value) {
348
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
349
+ }
350
+ function _throw(err) {
351
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
352
+ }
353
+ _next(undefined);
70
354
  });
71
- }
72
- return e;
355
+ };
73
356
  }
74
357
  function _classCallCheck(instance, Constructor) {
75
358
  if (!(instance instanceof Constructor)) {
@@ -93,20 +376,6 @@ function _createClass(Constructor, protoProps, staticProps) {
93
376
  });
94
377
  return Constructor;
95
378
  }
96
- function _defineProperty(obj, key, value) {
97
- key = _toPropertyKey(key);
98
- if (key in obj) {
99
- Object.defineProperty(obj, key, {
100
- value: value,
101
- enumerable: true,
102
- configurable: true,
103
- writable: true
104
- });
105
- } else {
106
- obj[key] = value;
107
- }
108
- return obj;
109
- }
110
379
  function _extends() {
111
380
  _extends = Object.assign ? Object.assign.bind() : function (target) {
112
381
  for (var i = 1; i < arguments.length; i++) {
@@ -260,28 +529,6 @@ function _createSuper(Derived) {
260
529
  return _possibleConstructorReturn(this, result);
261
530
  };
262
531
  }
263
- function _slicedToArray(arr, i) {
264
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
265
- }
266
- function _arrayWithHoles(arr) {
267
- if (Array.isArray(arr)) return arr;
268
- }
269
- function _unsupportedIterableToArray(o, minLen) {
270
- if (!o) return;
271
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
272
- var n = Object.prototype.toString.call(o).slice(8, -1);
273
- if (n === "Object" && o.constructor) n = o.constructor.name;
274
- if (n === "Map" || n === "Set") return Array.from(o);
275
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
276
- }
277
- function _arrayLikeToArray(arr, len) {
278
- if (len == null || len > arr.length) len = arr.length;
279
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
280
- return arr2;
281
- }
282
- function _nonIterableRest() {
283
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
284
- }
285
532
  function _toPrimitive(input, hint) {
286
533
  if (typeof input !== "object" || input === null) return input;
287
534
  var prim = input[Symbol.toPrimitive];
@@ -312,481 +559,7 @@ function _classPrivateMethodInitSpec(obj, privateSet) {
312
559
  privateSet.add(obj);
313
560
  }
314
561
 
315
- // Shim the global element internals object
316
- // Methods should be fine as noops and properties can generally
317
- // be while on the server.
318
- var ElementInternalsShim = /*#__PURE__*/function () {
319
- function ElementInternals(_host) {
320
- _classCallCheck(this, ElementInternals);
321
- this.ariaAtomic = '';
322
- this.ariaAutoComplete = '';
323
- this.ariaBraileLabel = '';
324
- this.ariaBraileRoleDescription = '';
325
- this.ariaBusy = '';
326
- this.ariaChecked = '';
327
- this.ariaColCount = '';
328
- this.ariaColIndex = '';
329
- this.ariaColSpan = '';
330
- this.ariaCurrent = '';
331
- this.ariaDescription = '';
332
- this.ariaDisabled = '';
333
- this.ariaExpanded = '';
334
- this.ariaHasPopup = '';
335
- this.ariaHidden = '';
336
- this.ariaInvalid = '';
337
- this.ariaKeyShortcuts = '';
338
- this.ariaLabel = '';
339
- this.ariaLevel = '';
340
- this.ariaLive = '';
341
- this.ariaModal = '';
342
- this.ariaMultiLine = '';
343
- this.ariaMultiSelectable = '';
344
- this.ariaOrientation = '';
345
- this.ariaPlaceholder = '';
346
- this.ariaPosInSet = '';
347
- this.ariaPressed = '';
348
- this.ariaReadOnly = '';
349
- this.ariaRequired = '';
350
- this.ariaRoleDescription = '';
351
- this.ariaRowCount = '';
352
- this.ariaRowIndex = '';
353
- this.ariaRowSpan = '';
354
- this.ariaSelected = '';
355
- this.ariaSetSize = '';
356
- this.ariaSort = '';
357
- this.ariaValueMax = '';
358
- this.ariaValueMin = '';
359
- this.ariaValueNow = '';
360
- this.ariaValueText = '';
361
- this.role = '';
362
- this.form = null;
363
- this.labels = [];
364
- this.states = new Set();
365
- this.validationMessage = '';
366
- this.validity = {};
367
- this.willValidate = true;
368
- this.__host = _host;
369
- }
370
- _createClass(ElementInternals, [{
371
- key: "shadowRoot",
372
- get: function get() {
373
- // Grab the shadow root instance from the Element shim
374
- // to ensure that the shadow root is always available
375
- // to the internals instance even if the mode is 'closed'
376
- return this.__host.__shadowRoot;
377
- }
378
- }, {
379
- key: "checkValidity",
380
- value: function checkValidity() {
381
- // TODO(augustjk) Consider actually implementing logic.
382
- // See https://github.com/lit/lit/issues/3740
383
- console.warn('`ElementInternals.checkValidity()` was called on the server.' + 'This method always returns true.');
384
- return true;
385
- }
386
- }, {
387
- key: "reportValidity",
388
- value: function reportValidity() {
389
- return true;
390
- }
391
- }, {
392
- key: "setFormValue",
393
- value: function setFormValue() {}
394
- }, {
395
- key: "setValidity",
396
- value: function setValidity() {}
397
- }]);
398
- return ElementInternals;
399
- }();
400
-
401
- var attributes = new WeakMap();
402
- var attributesForElement = function attributesForElement(element) {
403
- var attrs = attributes.get(element);
404
- if (attrs === undefined) {
405
- attributes.set(element, attrs = new Map());
406
- }
407
- return attrs;
408
- };
409
- // The typings around the exports below are a little funky:
410
- //
411
- // 1. We want the `name` of the shim classes to match the real ones at runtime,
412
- // hence e.g. `class Element`.
413
- // 2. We can't shadow the global types with a simple class declaration, because
414
- // then we can't reference the global types for casting, hence e.g.
415
- // `const ElementShim = class Element`.
416
- // 3. We want to export the classes typed as the real ones, hence e.g.
417
- // `const ElementShimWithRealType = ElementShim as object as typeof Element;`.
418
- // 4. We want the exported names to match the real ones, hence e.g.
419
- // `export {ElementShimWithRealType as Element}`.
420
- var ElementShim = /*#__PURE__*/function () {
421
- function Element() {
422
- _classCallCheck(this, Element);
423
- this.__shadowRootMode = null;
424
- this.__shadowRoot = null;
425
- this.__internals = null;
426
- }
427
- _createClass(Element, [{
428
- key: "attributes",
429
- get: function get() {
430
- return Array.from(attributesForElement(this)).map(function (_ref) {
431
- var _ref2 = _slicedToArray(_ref, 2),
432
- name = _ref2[0],
433
- value = _ref2[1];
434
- return {
435
- name: name,
436
- value: value
437
- };
438
- });
439
- }
440
- }, {
441
- key: "shadowRoot",
442
- get: function get() {
443
- if (this.__shadowRootMode === 'closed') {
444
- return null;
445
- }
446
- return this.__shadowRoot;
447
- }
448
- }, {
449
- key: "setAttribute",
450
- value: function setAttribute(name, value) {
451
- // Emulate browser behavior that silently casts all values to string. E.g.
452
- // `42` becomes `"42"` and `{}` becomes `"[object Object]""`.
453
- attributesForElement(this).set(name, String(value));
454
- }
455
- }, {
456
- key: "removeAttribute",
457
- value: function removeAttribute(name) {
458
- attributesForElement(this)["delete"](name);
459
- }
460
- }, {
461
- key: "hasAttribute",
462
- value: function hasAttribute(name) {
463
- return attributesForElement(this).has(name);
464
- }
465
- }, {
466
- key: "attachShadow",
467
- value: function attachShadow(init) {
468
- var shadowRoot = {
469
- host: this
470
- };
471
- this.__shadowRootMode = init.mode;
472
- if (init && init.mode === 'open') {
473
- this.__shadowRoot = shadowRoot;
474
- }
475
- return shadowRoot;
476
- }
477
- }, {
478
- key: "attachInternals",
479
- value: function attachInternals() {
480
- if (this.__internals !== null) {
481
- throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': " + "ElementInternals for the specified element was already attached.");
482
- }
483
- var internals = new ElementInternalsShim(this);
484
- this.__internals = internals;
485
- return internals;
486
- }
487
- }, {
488
- key: "getAttribute",
489
- value: function getAttribute(name) {
490
- var value = attributesForElement(this).get(name);
491
- return value !== null && value !== void 0 ? value : null;
492
- }
493
- }]);
494
- return Element;
495
- }();
496
- var ElementShimWithRealType = ElementShim;
497
- var HTMLElementShim = /*#__PURE__*/function (_ElementShim) {
498
- _inherits(HTMLElement, _ElementShim);
499
- var _super = _createSuper(HTMLElement);
500
- function HTMLElement() {
501
- _classCallCheck(this, HTMLElement);
502
- return _super.apply(this, arguments);
503
- }
504
- return _createClass(HTMLElement);
505
- }(ElementShim);
506
- var HTMLElementShimWithRealType = HTMLElementShim;
507
- var CustomElementRegistryShim = /*#__PURE__*/function () {
508
- function CustomElementRegistry() {
509
- _classCallCheck(this, CustomElementRegistry);
510
- this.__definitions = new Map();
511
- }
512
- _createClass(CustomElementRegistry, [{
513
- key: "define",
514
- value: function define(name, ctor) {
515
- var _ctor$observedAttribu;
516
- if (this.__definitions.has(name)) {
517
- if (process.env.NODE_ENV === 'development') {
518
- console.warn("'CustomElementRegistry' already has \"".concat(name, "\" defined. ") + "This may have been caused by live reload or hot module " + "replacement in which case it can be safely ignored.\n" + "Make sure to test your application with a production build as " + "repeat registrations will throw in production.");
519
- } else {
520
- throw new Error("Failed to execute 'define' on 'CustomElementRegistry': " + "the name \"".concat(name, "\" has already been used with this registry"));
521
- }
522
- }
523
- this.__definitions.set(name, {
524
- ctor: ctor,
525
- // Note it's important we read `observedAttributes` in case it is a getter
526
- // with side-effects, as is the case in Lit, where it triggers class
527
- // finalization.
528
- //
529
- // TODO(aomarks) To be spec compliant, we should also capture the
530
- // registration-time lifecycle methods like `connectedCallback`. For them
531
- // to be actually accessible to e.g. the Lit SSR element renderer, though,
532
- // we'd need to introduce a new API for accessing them (since `get` only
533
- // returns the constructor).
534
- observedAttributes: (_ctor$observedAttribu = ctor.observedAttributes) !== null && _ctor$observedAttribu !== void 0 ? _ctor$observedAttribu : []
535
- });
536
- }
537
- }, {
538
- key: "get",
539
- value: function get(name) {
540
- var definition = this.__definitions.get(name);
541
- return definition === null || definition === void 0 ? void 0 : definition.ctor;
542
- }
543
- }]);
544
- return CustomElementRegistry;
545
- }();
546
- var CustomElementRegistryShimWithRealType = CustomElementRegistryShim;
547
- new CustomElementRegistryShimWithRealType();
548
-
549
- /**
550
- * Constructs a fresh instance of the "window" vm context to use for evaluating
551
- * user SSR code. Includes a minimal shim of DOM APIs.
552
- *
553
- * @param includeJSBuiltIns Whether certain standard JS context globals like
554
- * `console` and `setTimeout` should also be added to the global. Should
555
- * generally only be true when adding window to a fresh VM context that
556
- * starts with nothing.
557
- * @param props Additional properties to add to the window global
558
- */
559
- var getWindow = function getWindow(_ref) {
560
- var _ref$includeJSBuiltIn = _ref.includeJSBuiltIns,
561
- includeJSBuiltIns = _ref$includeJSBuiltIn === void 0 ? false : _ref$includeJSBuiltIn,
562
- _ref$props = _ref.props,
563
- props = _ref$props === void 0 ? {} : _ref$props;
564
- var ShadowRoot = /*#__PURE__*/_createClass(function ShadowRoot() {
565
- _classCallCheck(this, ShadowRoot);
566
- });
567
- var Document = /*#__PURE__*/function () {
568
- function Document() {
569
- _classCallCheck(this, Document);
570
- }
571
- _createClass(Document, [{
572
- key: "adoptedStyleSheets",
573
- get: function get() {
574
- return [];
575
- }
576
- }, {
577
- key: "createTreeWalker",
578
- value: function createTreeWalker() {
579
- return {};
580
- }
581
- }, {
582
- key: "createTextNode",
583
- value: function createTextNode() {
584
- return {};
585
- }
586
- }, {
587
- key: "createElement",
588
- value: function createElement() {
589
- return {};
590
- }
591
- }]);
592
- return Document;
593
- }();
594
- var CSSStyleSheet = /*#__PURE__*/function () {
595
- function CSSStyleSheet() {
596
- _classCallCheck(this, CSSStyleSheet);
597
- }
598
- _createClass(CSSStyleSheet, [{
599
- key: "replace",
600
- value: function replace() {}
601
- }]);
602
- return CSSStyleSheet;
603
- }();
604
- var window = _objectSpread2({
605
- Element: ElementShimWithRealType,
606
- HTMLElement: HTMLElementShimWithRealType,
607
- Document: Document,
608
- document: new Document(),
609
- CSSStyleSheet: CSSStyleSheet,
610
- ShadowRoot: ShadowRoot,
611
- CustomElementRegistry: CustomElementRegistryShimWithRealType,
612
- customElements: new CustomElementRegistryShimWithRealType(),
613
- btoa: function btoa(s) {
614
- return Buffer.from(s, 'binary').toString('base64');
615
- },
616
- location: new URL('http://localhost'),
617
- MutationObserver: /*#__PURE__*/function () {
618
- function MutationObserver() {
619
- _classCallCheck(this, MutationObserver);
620
- }
621
- _createClass(MutationObserver, [{
622
- key: "observe",
623
- value: function observe() {}
624
- }]);
625
- return MutationObserver;
626
- }(),
627
- // No-op any async tasks
628
- requestAnimationFrame: function requestAnimationFrame() {},
629
- // Set below
630
- window: undefined
631
- }, props);
632
- if (includeJSBuiltIns) {
633
- Object.assign(window, {
634
- // No-op any async tasks
635
- setTimeout: function setTimeout() {},
636
- clearTimeout: function clearTimeout() {},
637
- // Required for node-fetch
638
- Buffer: Buffer,
639
- URL: URL,
640
- URLSearchParams: URLSearchParams,
641
- console: {
642
- log: function log() {
643
- var _console;
644
- (_console = console).log.apply(_console, arguments);
645
- },
646
- info: function info() {
647
- var _console2;
648
- (_console2 = console).info.apply(_console2, arguments);
649
- },
650
- warn: function warn() {
651
- var _console3;
652
- (_console3 = console).warn.apply(_console3, arguments);
653
- },
654
- debug: function debug() {
655
- var _console4;
656
- (_console4 = console).debug.apply(_console4, arguments);
657
- },
658
- error: function error() {
659
- var _console5;
660
- (_console5 = console).error.apply(_console5, arguments);
661
- },
662
- assert: function assert(bool, msg) {
663
- if (!bool) {
664
- throw new Error(msg);
665
- }
666
- }
667
- }
668
- });
669
- }
670
- return window;
671
- };
672
- var installWindowOnGlobal = function installWindowOnGlobal() {
673
- var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
674
- // Avoid installing the DOM shim if one already exists
675
- if (globalThis.window === undefined) {
676
- var window = getWindow({
677
- props: props
678
- });
679
- // Copy initial window globals to node global
680
- Object.assign(globalThis, window);
681
- }
682
- };
683
- installWindowOnGlobal();
684
-
685
- var _e = /*#__PURE__*/new WeakSet();
686
- var _t = /*#__PURE__*/new WeakSet();
687
- var e$1 = /*#__PURE__*/function (_HTMLElement) {
688
- _inherits(e, _HTMLElement);
689
- var _super = _createSuper(e);
690
- function e() {
691
- var _this;
692
- _classCallCheck(this, e);
693
- (_this = _super.call(this), _classPrivateMethodInitSpec(_assertThisInitialized(_this), _t), _classPrivateMethodInitSpec(_assertThisInitialized(_this), _e)), _this.addEventListener("click", function (_e5) {
694
- var t = _e5.target.closest("a");
695
- if (!t) return;
696
- var n = _classPrivateMethodGet(_assertThisInitialized(_this), _e, _e2).call(_assertThisInitialized(_this), t.href);
697
- if (!n) return;
698
- var r = document.getElementById(n);
699
- if (!r) return;
700
- var o = _classPrivateMethodGet(_assertThisInitialized(_this), _t, _t2).call(_assertThisInitialized(_this), r);
701
- o && (_e5.preventDefault(), o.scrollIntoView(), r.focus({
702
- preventScroll: !0
703
- }));
704
- });
705
- return _this;
706
- }
707
- return _createClass(e);
708
- }( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
709
- function _e2(_e3) {
710
- return _e3.includes("#") ? _e3.split("#").pop() : void 0;
711
- }
712
- function _t2(_e4) {
713
- var _document$querySelect;
714
- var t = _e4.closest("fieldset");
715
- if (t) {
716
- var n = t.getElementsByTagName("legend");
717
- if (n.length) {
718
- var _t3 = n[0];
719
- if (_e4 instanceof HTMLInputElement && ("checkbox" === _e4.type || "radio" === _e4.type)) return _t3;
720
- var r = _t3.getBoundingClientRect().top,
721
- o = _e4.getBoundingClientRect();
722
- if (o.height && window.innerHeight) {
723
- if (o.top + o.height - r < window.innerHeight / 2) return _t3;
724
- }
725
- }
726
- }
727
- return (_document$querySelect = document.querySelector("label[for='".concat(_e4.getAttribute("id"), "']"))) !== null && _document$querySelect !== void 0 ? _document$querySelect : _e4.closest("label");
728
- }
729
- window && "customElements" in window && customElements.define("bds-error-summary", e$1);
730
-
731
- /**
732
- * @license
733
- * Copyright 2018 Google LLC
734
- * SPDX-License-Identifier: BSD-3-Clause
735
- */
736
- var e = new Set(["children", "localName", "ref", "style", "className"]),
737
- n = new WeakMap(),
738
- l = function l(e, _l, t, o, a) {
739
- var i = null == a ? void 0 : a[_l];
740
- void 0 === i || t === o ? (e[_l] = t, null == t && _l in HTMLElement.prototype && e.removeAttribute(_l)) : function (e, l, t) {
741
- var o = n.get(e);
742
- void 0 === o && n.set(e, o = new Map());
743
- var a = o.get(l);
744
- void 0 !== t ? void 0 === a ? (o.set(l, a = {
745
- handleEvent: t
746
- }), e.addEventListener(l, a)) : a.handleEvent = t : void 0 !== a && (o["delete"](l), e.removeEventListener(l, a));
747
- }(e, i, t);
748
- },
749
- t = function t(_ref) {
750
- var n = _ref.react,
751
- t = _ref.tagName,
752
- o = _ref.elementClass,
753
- a = _ref.events,
754
- i = _ref.displayName;
755
- var s = new Set(Object.keys(null != a ? a : {})),
756
- c = n.forwardRef(function (i, c) {
757
- var r = n.useRef(null),
758
- d = n.useRef(null),
759
- u = {},
760
- v = {};
761
- for (var _i = 0, _Object$entries = Object.entries(i); _i < _Object$entries.length; _i++) {
762
- var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
763
- _n = _Object$entries$_i[0],
764
- _l2 = _Object$entries$_i[1];
765
- e.has(_n) ? u["className" === _n ? "class" : _n] = _l2 : s.has(_n) || _n in o.prototype ? v[_n] = _l2 : u[_n] = _l2;
766
- }
767
- return n.useLayoutEffect(function () {
768
- if (null !== d.current) {
769
- for (var _e in v) l(d.current, _e, i[_e], r.current ? r.current[_e] : void 0, a);
770
- r.current = i;
771
- }
772
- }), n.useLayoutEffect(function () {
773
- var e;
774
- null === (e = d.current) || void 0 === e || e.removeAttribute("defer-hydration");
775
- }, []), u.suppressHydrationWarning = !0, n.createElement(t, _objectSpread2(_objectSpread2({}, u), {}, {
776
- ref: function ref(e) {
777
- d.current = e, "function" == typeof c ? c(e) : null !== c && (c.current = e);
778
- }
779
- }));
780
- });
781
- return c.displayName = null != i ? i : o.name, c;
782
- };
783
-
784
562
  var _excluded = ["className", "errors", "mapNameToId"];
785
- var ReactErrorSummary = t({
786
- tagName: 'bds-error-summary',
787
- elementClass: e$1,
788
- react: React__namespace
789
- });
790
563
  var FormErrorKey = '_form';
791
564
  var FINAL_FORM_ERROR = 'FINAL_FORM/form-error';
792
565
  function BdsErrorSummary(_ref) {
@@ -799,13 +572,33 @@ function BdsErrorSummary(_ref) {
799
572
  props = _objectWithoutProperties(_ref, _excluded);
800
573
  var headingId = React__namespace.useId();
801
574
  var groupRef = React__namespace.useRef(null);
575
+ React__namespace.useEffect(function () {
576
+ var loadWebComponent = /*#__PURE__*/function () {
577
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
578
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
579
+ while (1) switch (_context.prev = _context.next) {
580
+ case 0:
581
+ _context.next = 2;
582
+ return Promise.resolve().then(function () { return index; });
583
+ case 2:
584
+ case "end":
585
+ return _context.stop();
586
+ }
587
+ }, _callee);
588
+ }));
589
+ return function loadWebComponent() {
590
+ return _ref2.apply(this, arguments);
591
+ };
592
+ }();
593
+ loadWebComponent();
594
+ });
802
595
  React__namespace.useEffect(function () {
803
596
  if (!errors || Object.keys(errors).length === 0) return;
804
597
  if (!groupRef.current) return;
805
598
  groupRef.current.focus();
806
599
  }, [errors]);
807
600
  if (!errors || Object.keys(errors).length === 0) return null;
808
- return /*#__PURE__*/React__namespace.createElement(ReactErrorSummary, _extends({
601
+ return /*#__PURE__*/React__namespace.createElement("bds-error-summary", _extends({
809
602
  className: ['stack', className].filter(function (x) {
810
603
  return x;
811
604
  }).join(' '),
@@ -851,6 +644,57 @@ function BdsErrorSummary(_ref) {
851
644
  })));
852
645
  }
853
646
 
647
+ var _e = /*#__PURE__*/new WeakSet();
648
+ var _t = /*#__PURE__*/new WeakSet();
649
+ var e = /*#__PURE__*/function (_HTMLElement) {
650
+ _inherits(e, _HTMLElement);
651
+ var _super = _createSuper(e);
652
+ function e() {
653
+ var _this;
654
+ _classCallCheck(this, e);
655
+ (_this = _super.call(this), _classPrivateMethodInitSpec(_assertThisInitialized(_this), _t), _classPrivateMethodInitSpec(_assertThisInitialized(_this), _e)), _this.addEventListener("click", function (_e5) {
656
+ var t = _e5.target.closest("a");
657
+ if (!t) return;
658
+ var n = _classPrivateMethodGet(_assertThisInitialized(_this), _e, _e2).call(_assertThisInitialized(_this), t.href);
659
+ if (!n) return;
660
+ var r = document.getElementById(n);
661
+ if (!r) return;
662
+ var o = _classPrivateMethodGet(_assertThisInitialized(_this), _t, _t2).call(_assertThisInitialized(_this), r);
663
+ o && (_e5.preventDefault(), o.scrollIntoView(), r.focus({
664
+ preventScroll: !0
665
+ }));
666
+ });
667
+ return _this;
668
+ }
669
+ return _createClass(e);
670
+ }( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
671
+ function _e2(_e3) {
672
+ return _e3.includes("#") ? _e3.split("#").pop() : void 0;
673
+ }
674
+ function _t2(_e4) {
675
+ var _document$querySelect;
676
+ var t = _e4.closest("fieldset");
677
+ if (t) {
678
+ var n = t.getElementsByTagName("legend");
679
+ if (n.length) {
680
+ var _t3 = n[0];
681
+ if (_e4 instanceof HTMLInputElement && ("checkbox" === _e4.type || "radio" === _e4.type)) return _t3;
682
+ var r = _t3.getBoundingClientRect().top,
683
+ o = _e4.getBoundingClientRect();
684
+ if (o.height && window.innerHeight) {
685
+ if (o.top + o.height - r < window.innerHeight / 2) return _t3;
686
+ }
687
+ }
688
+ }
689
+ return (_document$querySelect = document.querySelector("label[for='".concat(_e4.getAttribute("id"), "']"))) !== null && _document$querySelect !== void 0 ? _document$querySelect : _e4.closest("label");
690
+ }
691
+ window && "customElements" in window && customElements.define("bds-error-summary", e);
692
+
693
+ var index = /*#__PURE__*/Object.freeze({
694
+ __proto__: null,
695
+ default: e
696
+ });
697
+
854
698
  exports.FormErrorKey = FormErrorKey;
855
699
  exports.default = BdsErrorSummary;
856
700
  //# sourceMappingURL=index.cjs.map