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