@iabbb/bds-react 0.40.0-beta.2 → 0.40.0-beta.21
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/ErrorSummary/ErrorSummary.d.ts +1 -0
- package/ErrorSummary/index.cjs +567 -4
- package/ErrorSummary/index.cjs.map +1 -1
- package/ErrorSummary/index.mjs +566 -3
- package/ErrorSummary/index.mjs.map +1 -1
- package/ErrorSummary/package.json +1 -4
- package/domShim.d.ts +6 -0
- package/index.cjs +566 -2
- package/index.cjs.map +1 -1
- package/index.mjs +566 -2
- package/index.mjs.map +1 -1
- package/package.json +8 -12
package/index.cjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var ErrorSummary = require('@iabbb/bds/ErrorSummary');
|
|
5
4
|
|
|
6
5
|
function _interopNamespaceDefault(e) {
|
|
7
6
|
var n = Object.create(null);
|
|
@@ -70,6 +69,28 @@ function _objectSpread2(e) {
|
|
|
70
69
|
}
|
|
71
70
|
return e;
|
|
72
71
|
}
|
|
72
|
+
function _classCallCheck(instance, Constructor) {
|
|
73
|
+
if (!(instance instanceof Constructor)) {
|
|
74
|
+
throw new TypeError("Cannot call a class as a function");
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function _defineProperties(target, props) {
|
|
78
|
+
for (var i = 0; i < props.length; i++) {
|
|
79
|
+
var descriptor = props[i];
|
|
80
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
81
|
+
descriptor.configurable = true;
|
|
82
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
83
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
87
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
88
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
89
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
90
|
+
writable: false
|
|
91
|
+
});
|
|
92
|
+
return Constructor;
|
|
93
|
+
}
|
|
73
94
|
function _defineProperty(obj, key, value) {
|
|
74
95
|
key = _toPropertyKey(key);
|
|
75
96
|
if (key in obj) {
|
|
@@ -98,6 +119,90 @@ function _extends() {
|
|
|
98
119
|
};
|
|
99
120
|
return _extends.apply(this, arguments);
|
|
100
121
|
}
|
|
122
|
+
function _inherits(subClass, superClass) {
|
|
123
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
124
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
125
|
+
}
|
|
126
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
127
|
+
constructor: {
|
|
128
|
+
value: subClass,
|
|
129
|
+
writable: true,
|
|
130
|
+
configurable: true
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
Object.defineProperty(subClass, "prototype", {
|
|
134
|
+
writable: false
|
|
135
|
+
});
|
|
136
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
137
|
+
}
|
|
138
|
+
function _getPrototypeOf(o) {
|
|
139
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
140
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
141
|
+
};
|
|
142
|
+
return _getPrototypeOf(o);
|
|
143
|
+
}
|
|
144
|
+
function _setPrototypeOf(o, p) {
|
|
145
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
146
|
+
o.__proto__ = p;
|
|
147
|
+
return o;
|
|
148
|
+
};
|
|
149
|
+
return _setPrototypeOf(o, p);
|
|
150
|
+
}
|
|
151
|
+
function _isNativeReflectConstruct() {
|
|
152
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
153
|
+
if (Reflect.construct.sham) return false;
|
|
154
|
+
if (typeof Proxy === "function") return true;
|
|
155
|
+
try {
|
|
156
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
157
|
+
return true;
|
|
158
|
+
} catch (e) {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function _construct(Parent, args, Class) {
|
|
163
|
+
if (_isNativeReflectConstruct()) {
|
|
164
|
+
_construct = Reflect.construct.bind();
|
|
165
|
+
} else {
|
|
166
|
+
_construct = function _construct(Parent, args, Class) {
|
|
167
|
+
var a = [null];
|
|
168
|
+
a.push.apply(a, args);
|
|
169
|
+
var Constructor = Function.bind.apply(Parent, a);
|
|
170
|
+
var instance = new Constructor();
|
|
171
|
+
if (Class) _setPrototypeOf(instance, Class.prototype);
|
|
172
|
+
return instance;
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
return _construct.apply(null, arguments);
|
|
176
|
+
}
|
|
177
|
+
function _isNativeFunction(fn) {
|
|
178
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
179
|
+
}
|
|
180
|
+
function _wrapNativeSuper(Class) {
|
|
181
|
+
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
182
|
+
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
|
183
|
+
if (Class === null || !_isNativeFunction(Class)) return Class;
|
|
184
|
+
if (typeof Class !== "function") {
|
|
185
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
186
|
+
}
|
|
187
|
+
if (typeof _cache !== "undefined") {
|
|
188
|
+
if (_cache.has(Class)) return _cache.get(Class);
|
|
189
|
+
_cache.set(Class, Wrapper);
|
|
190
|
+
}
|
|
191
|
+
function Wrapper() {
|
|
192
|
+
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
|
193
|
+
}
|
|
194
|
+
Wrapper.prototype = Object.create(Class.prototype, {
|
|
195
|
+
constructor: {
|
|
196
|
+
value: Wrapper,
|
|
197
|
+
enumerable: false,
|
|
198
|
+
writable: true,
|
|
199
|
+
configurable: true
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
return _setPrototypeOf(Wrapper, Class);
|
|
203
|
+
};
|
|
204
|
+
return _wrapNativeSuper(Class);
|
|
205
|
+
}
|
|
101
206
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
102
207
|
if (source == null) return {};
|
|
103
208
|
var target = {};
|
|
@@ -125,6 +230,34 @@ function _objectWithoutProperties(source, excluded) {
|
|
|
125
230
|
}
|
|
126
231
|
return target;
|
|
127
232
|
}
|
|
233
|
+
function _assertThisInitialized(self) {
|
|
234
|
+
if (self === void 0) {
|
|
235
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
236
|
+
}
|
|
237
|
+
return self;
|
|
238
|
+
}
|
|
239
|
+
function _possibleConstructorReturn(self, call) {
|
|
240
|
+
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
241
|
+
return call;
|
|
242
|
+
} else if (call !== void 0) {
|
|
243
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
244
|
+
}
|
|
245
|
+
return _assertThisInitialized(self);
|
|
246
|
+
}
|
|
247
|
+
function _createSuper(Derived) {
|
|
248
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
249
|
+
return function _createSuperInternal() {
|
|
250
|
+
var Super = _getPrototypeOf(Derived),
|
|
251
|
+
result;
|
|
252
|
+
if (hasNativeReflectConstruct) {
|
|
253
|
+
var NewTarget = _getPrototypeOf(this).constructor;
|
|
254
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
255
|
+
} else {
|
|
256
|
+
result = Super.apply(this, arguments);
|
|
257
|
+
}
|
|
258
|
+
return _possibleConstructorReturn(this, result);
|
|
259
|
+
};
|
|
260
|
+
}
|
|
128
261
|
function _slicedToArray(arr, i) {
|
|
129
262
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
130
263
|
}
|
|
@@ -173,6 +306,21 @@ function _toPropertyKey(arg) {
|
|
|
173
306
|
var key = _toPrimitive(arg, "string");
|
|
174
307
|
return typeof key === "symbol" ? key : String(key);
|
|
175
308
|
}
|
|
309
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) {
|
|
310
|
+
if (!privateSet.has(receiver)) {
|
|
311
|
+
throw new TypeError("attempted to get private field on non-instance");
|
|
312
|
+
}
|
|
313
|
+
return fn;
|
|
314
|
+
}
|
|
315
|
+
function _checkPrivateRedeclaration(obj, privateCollection) {
|
|
316
|
+
if (privateCollection.has(obj)) {
|
|
317
|
+
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
function _classPrivateMethodInitSpec(obj, privateSet) {
|
|
321
|
+
_checkPrivateRedeclaration(obj, privateSet);
|
|
322
|
+
privateSet.add(obj);
|
|
323
|
+
}
|
|
176
324
|
|
|
177
325
|
var _excluded$5 = ["children", "className", "onClick", "preventDoubleClick", "variant"];
|
|
178
326
|
var DEBOUNCE_TIMEOUT_IN_SECONDS = 1;
|
|
@@ -238,6 +386,422 @@ var CallToAction = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref)
|
|
|
238
386
|
}, props), children);
|
|
239
387
|
});
|
|
240
388
|
|
|
389
|
+
// Shim the global element internals object
|
|
390
|
+
// Methods should be fine as noops and properties can generally
|
|
391
|
+
// be while on the server.
|
|
392
|
+
var ElementInternalsShim = /*#__PURE__*/function () {
|
|
393
|
+
function ElementInternals(_host) {
|
|
394
|
+
_classCallCheck(this, ElementInternals);
|
|
395
|
+
this.ariaAtomic = '';
|
|
396
|
+
this.ariaAutoComplete = '';
|
|
397
|
+
this.ariaBraileLabel = '';
|
|
398
|
+
this.ariaBraileRoleDescription = '';
|
|
399
|
+
this.ariaBusy = '';
|
|
400
|
+
this.ariaChecked = '';
|
|
401
|
+
this.ariaColCount = '';
|
|
402
|
+
this.ariaColIndex = '';
|
|
403
|
+
this.ariaColSpan = '';
|
|
404
|
+
this.ariaCurrent = '';
|
|
405
|
+
this.ariaDescription = '';
|
|
406
|
+
this.ariaDisabled = '';
|
|
407
|
+
this.ariaExpanded = '';
|
|
408
|
+
this.ariaHasPopup = '';
|
|
409
|
+
this.ariaHidden = '';
|
|
410
|
+
this.ariaInvalid = '';
|
|
411
|
+
this.ariaKeyShortcuts = '';
|
|
412
|
+
this.ariaLabel = '';
|
|
413
|
+
this.ariaLevel = '';
|
|
414
|
+
this.ariaLive = '';
|
|
415
|
+
this.ariaModal = '';
|
|
416
|
+
this.ariaMultiLine = '';
|
|
417
|
+
this.ariaMultiSelectable = '';
|
|
418
|
+
this.ariaOrientation = '';
|
|
419
|
+
this.ariaPlaceholder = '';
|
|
420
|
+
this.ariaPosInSet = '';
|
|
421
|
+
this.ariaPressed = '';
|
|
422
|
+
this.ariaReadOnly = '';
|
|
423
|
+
this.ariaRequired = '';
|
|
424
|
+
this.ariaRoleDescription = '';
|
|
425
|
+
this.ariaRowCount = '';
|
|
426
|
+
this.ariaRowIndex = '';
|
|
427
|
+
this.ariaRowSpan = '';
|
|
428
|
+
this.ariaSelected = '';
|
|
429
|
+
this.ariaSetSize = '';
|
|
430
|
+
this.ariaSort = '';
|
|
431
|
+
this.ariaValueMax = '';
|
|
432
|
+
this.ariaValueMin = '';
|
|
433
|
+
this.ariaValueNow = '';
|
|
434
|
+
this.ariaValueText = '';
|
|
435
|
+
this.role = '';
|
|
436
|
+
this.form = null;
|
|
437
|
+
this.labels = [];
|
|
438
|
+
this.states = new Set();
|
|
439
|
+
this.validationMessage = '';
|
|
440
|
+
this.validity = {};
|
|
441
|
+
this.willValidate = true;
|
|
442
|
+
this.__host = _host;
|
|
443
|
+
}
|
|
444
|
+
_createClass(ElementInternals, [{
|
|
445
|
+
key: "shadowRoot",
|
|
446
|
+
get: function get() {
|
|
447
|
+
// Grab the shadow root instance from the Element shim
|
|
448
|
+
// to ensure that the shadow root is always available
|
|
449
|
+
// to the internals instance even if the mode is 'closed'
|
|
450
|
+
return this.__host.__shadowRoot;
|
|
451
|
+
}
|
|
452
|
+
}, {
|
|
453
|
+
key: "checkValidity",
|
|
454
|
+
value: function checkValidity() {
|
|
455
|
+
// TODO(augustjk) Consider actually implementing logic.
|
|
456
|
+
// See https://github.com/lit/lit/issues/3740
|
|
457
|
+
console.warn('`ElementInternals.checkValidity()` was called on the server.' + 'This method always returns true.');
|
|
458
|
+
return true;
|
|
459
|
+
}
|
|
460
|
+
}, {
|
|
461
|
+
key: "reportValidity",
|
|
462
|
+
value: function reportValidity() {
|
|
463
|
+
return true;
|
|
464
|
+
}
|
|
465
|
+
}, {
|
|
466
|
+
key: "setFormValue",
|
|
467
|
+
value: function setFormValue() {}
|
|
468
|
+
}, {
|
|
469
|
+
key: "setValidity",
|
|
470
|
+
value: function setValidity() {}
|
|
471
|
+
}]);
|
|
472
|
+
return ElementInternals;
|
|
473
|
+
}();
|
|
474
|
+
|
|
475
|
+
var attributes = new WeakMap();
|
|
476
|
+
var attributesForElement = function attributesForElement(element) {
|
|
477
|
+
var attrs = attributes.get(element);
|
|
478
|
+
if (attrs === undefined) {
|
|
479
|
+
attributes.set(element, attrs = new Map());
|
|
480
|
+
}
|
|
481
|
+
return attrs;
|
|
482
|
+
};
|
|
483
|
+
// The typings around the exports below are a little funky:
|
|
484
|
+
//
|
|
485
|
+
// 1. We want the `name` of the shim classes to match the real ones at runtime,
|
|
486
|
+
// hence e.g. `class Element`.
|
|
487
|
+
// 2. We can't shadow the global types with a simple class declaration, because
|
|
488
|
+
// then we can't reference the global types for casting, hence e.g.
|
|
489
|
+
// `const ElementShim = class Element`.
|
|
490
|
+
// 3. We want to export the classes typed as the real ones, hence e.g.
|
|
491
|
+
// `const ElementShimWithRealType = ElementShim as object as typeof Element;`.
|
|
492
|
+
// 4. We want the exported names to match the real ones, hence e.g.
|
|
493
|
+
// `export {ElementShimWithRealType as Element}`.
|
|
494
|
+
var ElementShim = /*#__PURE__*/function () {
|
|
495
|
+
function Element() {
|
|
496
|
+
_classCallCheck(this, Element);
|
|
497
|
+
this.__shadowRootMode = null;
|
|
498
|
+
this.__shadowRoot = null;
|
|
499
|
+
this.__internals = null;
|
|
500
|
+
}
|
|
501
|
+
_createClass(Element, [{
|
|
502
|
+
key: "attributes",
|
|
503
|
+
get: function get() {
|
|
504
|
+
return Array.from(attributesForElement(this)).map(function (_ref) {
|
|
505
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
506
|
+
name = _ref2[0],
|
|
507
|
+
value = _ref2[1];
|
|
508
|
+
return {
|
|
509
|
+
name: name,
|
|
510
|
+
value: value
|
|
511
|
+
};
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
}, {
|
|
515
|
+
key: "shadowRoot",
|
|
516
|
+
get: function get() {
|
|
517
|
+
if (this.__shadowRootMode === 'closed') {
|
|
518
|
+
return null;
|
|
519
|
+
}
|
|
520
|
+
return this.__shadowRoot;
|
|
521
|
+
}
|
|
522
|
+
}, {
|
|
523
|
+
key: "setAttribute",
|
|
524
|
+
value: function setAttribute(name, value) {
|
|
525
|
+
// Emulate browser behavior that silently casts all values to string. E.g.
|
|
526
|
+
// `42` becomes `"42"` and `{}` becomes `"[object Object]""`.
|
|
527
|
+
attributesForElement(this).set(name, String(value));
|
|
528
|
+
}
|
|
529
|
+
}, {
|
|
530
|
+
key: "removeAttribute",
|
|
531
|
+
value: function removeAttribute(name) {
|
|
532
|
+
attributesForElement(this)["delete"](name);
|
|
533
|
+
}
|
|
534
|
+
}, {
|
|
535
|
+
key: "hasAttribute",
|
|
536
|
+
value: function hasAttribute(name) {
|
|
537
|
+
return attributesForElement(this).has(name);
|
|
538
|
+
}
|
|
539
|
+
}, {
|
|
540
|
+
key: "attachShadow",
|
|
541
|
+
value: function attachShadow(init) {
|
|
542
|
+
var shadowRoot = {
|
|
543
|
+
host: this
|
|
544
|
+
};
|
|
545
|
+
this.__shadowRootMode = init.mode;
|
|
546
|
+
if (init && init.mode === 'open') {
|
|
547
|
+
this.__shadowRoot = shadowRoot;
|
|
548
|
+
}
|
|
549
|
+
return shadowRoot;
|
|
550
|
+
}
|
|
551
|
+
}, {
|
|
552
|
+
key: "attachInternals",
|
|
553
|
+
value: function attachInternals() {
|
|
554
|
+
if (this.__internals !== null) {
|
|
555
|
+
throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': " + "ElementInternals for the specified element was already attached.");
|
|
556
|
+
}
|
|
557
|
+
var internals = new ElementInternalsShim(this);
|
|
558
|
+
this.__internals = internals;
|
|
559
|
+
return internals;
|
|
560
|
+
}
|
|
561
|
+
}, {
|
|
562
|
+
key: "getAttribute",
|
|
563
|
+
value: function getAttribute(name) {
|
|
564
|
+
var value = attributesForElement(this).get(name);
|
|
565
|
+
return value !== null && value !== void 0 ? value : null;
|
|
566
|
+
}
|
|
567
|
+
}]);
|
|
568
|
+
return Element;
|
|
569
|
+
}();
|
|
570
|
+
var ElementShimWithRealType = ElementShim;
|
|
571
|
+
var HTMLElementShim = /*#__PURE__*/function (_ElementShim) {
|
|
572
|
+
_inherits(HTMLElement, _ElementShim);
|
|
573
|
+
var _super = _createSuper(HTMLElement);
|
|
574
|
+
function HTMLElement() {
|
|
575
|
+
_classCallCheck(this, HTMLElement);
|
|
576
|
+
return _super.apply(this, arguments);
|
|
577
|
+
}
|
|
578
|
+
return _createClass(HTMLElement);
|
|
579
|
+
}(ElementShim);
|
|
580
|
+
var HTMLElementShimWithRealType = HTMLElementShim;
|
|
581
|
+
var CustomElementRegistryShim = /*#__PURE__*/function () {
|
|
582
|
+
function CustomElementRegistry() {
|
|
583
|
+
_classCallCheck(this, CustomElementRegistry);
|
|
584
|
+
this.__definitions = new Map();
|
|
585
|
+
}
|
|
586
|
+
_createClass(CustomElementRegistry, [{
|
|
587
|
+
key: "define",
|
|
588
|
+
value: function define(name, ctor) {
|
|
589
|
+
var _ctor$observedAttribu;
|
|
590
|
+
if (this.__definitions.has(name)) {
|
|
591
|
+
if (process.env.NODE_ENV === 'development') {
|
|
592
|
+
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.");
|
|
593
|
+
} else {
|
|
594
|
+
throw new Error("Failed to execute 'define' on 'CustomElementRegistry': " + "the name \"".concat(name, "\" has already been used with this registry"));
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
this.__definitions.set(name, {
|
|
598
|
+
ctor: ctor,
|
|
599
|
+
// Note it's important we read `observedAttributes` in case it is a getter
|
|
600
|
+
// with side-effects, as is the case in Lit, where it triggers class
|
|
601
|
+
// finalization.
|
|
602
|
+
//
|
|
603
|
+
// TODO(aomarks) To be spec compliant, we should also capture the
|
|
604
|
+
// registration-time lifecycle methods like `connectedCallback`. For them
|
|
605
|
+
// to be actually accessible to e.g. the Lit SSR element renderer, though,
|
|
606
|
+
// we'd need to introduce a new API for accessing them (since `get` only
|
|
607
|
+
// returns the constructor).
|
|
608
|
+
observedAttributes: (_ctor$observedAttribu = ctor.observedAttributes) !== null && _ctor$observedAttribu !== void 0 ? _ctor$observedAttribu : []
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
}, {
|
|
612
|
+
key: "get",
|
|
613
|
+
value: function get(name) {
|
|
614
|
+
var definition = this.__definitions.get(name);
|
|
615
|
+
return definition === null || definition === void 0 ? void 0 : definition.ctor;
|
|
616
|
+
}
|
|
617
|
+
}]);
|
|
618
|
+
return CustomElementRegistry;
|
|
619
|
+
}();
|
|
620
|
+
var CustomElementRegistryShimWithRealType = CustomElementRegistryShim;
|
|
621
|
+
new CustomElementRegistryShimWithRealType();
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Constructs a fresh instance of the "window" vm context to use for evaluating
|
|
625
|
+
* user SSR code. Includes a minimal shim of DOM APIs.
|
|
626
|
+
*
|
|
627
|
+
* @param includeJSBuiltIns Whether certain standard JS context globals like
|
|
628
|
+
* `console` and `setTimeout` should also be added to the global. Should
|
|
629
|
+
* generally only be true when adding window to a fresh VM context that
|
|
630
|
+
* starts with nothing.
|
|
631
|
+
* @param props Additional properties to add to the window global
|
|
632
|
+
*/
|
|
633
|
+
var getWindow = function getWindow(_ref) {
|
|
634
|
+
var _ref$includeJSBuiltIn = _ref.includeJSBuiltIns,
|
|
635
|
+
includeJSBuiltIns = _ref$includeJSBuiltIn === void 0 ? false : _ref$includeJSBuiltIn,
|
|
636
|
+
_ref$props = _ref.props,
|
|
637
|
+
props = _ref$props === void 0 ? {} : _ref$props;
|
|
638
|
+
var ShadowRoot = /*#__PURE__*/_createClass(function ShadowRoot() {
|
|
639
|
+
_classCallCheck(this, ShadowRoot);
|
|
640
|
+
});
|
|
641
|
+
var Document = /*#__PURE__*/function () {
|
|
642
|
+
function Document() {
|
|
643
|
+
_classCallCheck(this, Document);
|
|
644
|
+
}
|
|
645
|
+
_createClass(Document, [{
|
|
646
|
+
key: "adoptedStyleSheets",
|
|
647
|
+
get: function get() {
|
|
648
|
+
return [];
|
|
649
|
+
}
|
|
650
|
+
}, {
|
|
651
|
+
key: "createTreeWalker",
|
|
652
|
+
value: function createTreeWalker() {
|
|
653
|
+
return {};
|
|
654
|
+
}
|
|
655
|
+
}, {
|
|
656
|
+
key: "createTextNode",
|
|
657
|
+
value: function createTextNode() {
|
|
658
|
+
return {};
|
|
659
|
+
}
|
|
660
|
+
}, {
|
|
661
|
+
key: "createElement",
|
|
662
|
+
value: function createElement() {
|
|
663
|
+
return {};
|
|
664
|
+
}
|
|
665
|
+
}]);
|
|
666
|
+
return Document;
|
|
667
|
+
}();
|
|
668
|
+
var CSSStyleSheet = /*#__PURE__*/function () {
|
|
669
|
+
function CSSStyleSheet() {
|
|
670
|
+
_classCallCheck(this, CSSStyleSheet);
|
|
671
|
+
}
|
|
672
|
+
_createClass(CSSStyleSheet, [{
|
|
673
|
+
key: "replace",
|
|
674
|
+
value: function replace() {}
|
|
675
|
+
}]);
|
|
676
|
+
return CSSStyleSheet;
|
|
677
|
+
}();
|
|
678
|
+
var window = _objectSpread2({
|
|
679
|
+
Element: ElementShimWithRealType,
|
|
680
|
+
HTMLElement: HTMLElementShimWithRealType,
|
|
681
|
+
Document: Document,
|
|
682
|
+
document: new Document(),
|
|
683
|
+
CSSStyleSheet: CSSStyleSheet,
|
|
684
|
+
ShadowRoot: ShadowRoot,
|
|
685
|
+
CustomElementRegistry: CustomElementRegistryShimWithRealType,
|
|
686
|
+
customElements: new CustomElementRegistryShimWithRealType(),
|
|
687
|
+
btoa: function btoa(s) {
|
|
688
|
+
return Buffer.from(s, 'binary').toString('base64');
|
|
689
|
+
},
|
|
690
|
+
location: new URL('http://localhost'),
|
|
691
|
+
MutationObserver: /*#__PURE__*/function () {
|
|
692
|
+
function MutationObserver() {
|
|
693
|
+
_classCallCheck(this, MutationObserver);
|
|
694
|
+
}
|
|
695
|
+
_createClass(MutationObserver, [{
|
|
696
|
+
key: "observe",
|
|
697
|
+
value: function observe() {}
|
|
698
|
+
}]);
|
|
699
|
+
return MutationObserver;
|
|
700
|
+
}(),
|
|
701
|
+
// No-op any async tasks
|
|
702
|
+
requestAnimationFrame: function requestAnimationFrame() {},
|
|
703
|
+
// Set below
|
|
704
|
+
window: undefined
|
|
705
|
+
}, props);
|
|
706
|
+
if (includeJSBuiltIns) {
|
|
707
|
+
Object.assign(window, {
|
|
708
|
+
// No-op any async tasks
|
|
709
|
+
setTimeout: function setTimeout() {},
|
|
710
|
+
clearTimeout: function clearTimeout() {},
|
|
711
|
+
// Required for node-fetch
|
|
712
|
+
Buffer: Buffer,
|
|
713
|
+
URL: URL,
|
|
714
|
+
URLSearchParams: URLSearchParams,
|
|
715
|
+
console: {
|
|
716
|
+
log: function log() {
|
|
717
|
+
var _console;
|
|
718
|
+
(_console = console).log.apply(_console, arguments);
|
|
719
|
+
},
|
|
720
|
+
info: function info() {
|
|
721
|
+
var _console2;
|
|
722
|
+
(_console2 = console).info.apply(_console2, arguments);
|
|
723
|
+
},
|
|
724
|
+
warn: function warn() {
|
|
725
|
+
var _console3;
|
|
726
|
+
(_console3 = console).warn.apply(_console3, arguments);
|
|
727
|
+
},
|
|
728
|
+
debug: function debug() {
|
|
729
|
+
var _console4;
|
|
730
|
+
(_console4 = console).debug.apply(_console4, arguments);
|
|
731
|
+
},
|
|
732
|
+
error: function error() {
|
|
733
|
+
var _console5;
|
|
734
|
+
(_console5 = console).error.apply(_console5, arguments);
|
|
735
|
+
},
|
|
736
|
+
assert: function assert(bool, msg) {
|
|
737
|
+
if (!bool) {
|
|
738
|
+
throw new Error(msg);
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
return window;
|
|
745
|
+
};
|
|
746
|
+
var installWindowOnGlobal = function installWindowOnGlobal() {
|
|
747
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
748
|
+
// Avoid installing the DOM shim if one already exists
|
|
749
|
+
if (globalThis.window === undefined) {
|
|
750
|
+
var window = getWindow({
|
|
751
|
+
props: props
|
|
752
|
+
});
|
|
753
|
+
// Copy initial window globals to node global
|
|
754
|
+
Object.assign(globalThis, window);
|
|
755
|
+
}
|
|
756
|
+
};
|
|
757
|
+
installWindowOnGlobal();
|
|
758
|
+
|
|
759
|
+
var _e = /*#__PURE__*/new WeakSet();
|
|
760
|
+
var _t = /*#__PURE__*/new WeakSet();
|
|
761
|
+
var e$1 = /*#__PURE__*/function (_HTMLElement) {
|
|
762
|
+
_inherits(e, _HTMLElement);
|
|
763
|
+
var _super = _createSuper(e);
|
|
764
|
+
function e() {
|
|
765
|
+
var _this;
|
|
766
|
+
_classCallCheck(this, e);
|
|
767
|
+
(_this = _super.call(this), _classPrivateMethodInitSpec(_assertThisInitialized(_this), _t), _classPrivateMethodInitSpec(_assertThisInitialized(_this), _e)), _this.addEventListener("click", function (_e5) {
|
|
768
|
+
var t = _e5.target.closest("a");
|
|
769
|
+
if (!t) return;
|
|
770
|
+
var n = _classPrivateMethodGet(_assertThisInitialized(_this), _e, _e2).call(_assertThisInitialized(_this), t.href);
|
|
771
|
+
if (!n) return;
|
|
772
|
+
var r = document.getElementById(n);
|
|
773
|
+
if (!r) return;
|
|
774
|
+
var o = _classPrivateMethodGet(_assertThisInitialized(_this), _t, _t2).call(_assertThisInitialized(_this), r);
|
|
775
|
+
o && (_e5.preventDefault(), o.scrollIntoView(), r.focus({
|
|
776
|
+
preventScroll: !0
|
|
777
|
+
}));
|
|
778
|
+
});
|
|
779
|
+
return _this;
|
|
780
|
+
}
|
|
781
|
+
return _createClass(e);
|
|
782
|
+
}( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
|
|
783
|
+
function _e2(_e3) {
|
|
784
|
+
return _e3.includes("#") ? _e3.split("#").pop() : void 0;
|
|
785
|
+
}
|
|
786
|
+
function _t2(_e4) {
|
|
787
|
+
var _document$querySelect;
|
|
788
|
+
var t = _e4.closest("fieldset");
|
|
789
|
+
if (t) {
|
|
790
|
+
var n = t.getElementsByTagName("legend");
|
|
791
|
+
if (n.length) {
|
|
792
|
+
var _t3 = n[0];
|
|
793
|
+
if (_e4 instanceof HTMLInputElement && ("checkbox" === _e4.type || "radio" === _e4.type)) return _t3;
|
|
794
|
+
var r = _t3.getBoundingClientRect().top,
|
|
795
|
+
o = _e4.getBoundingClientRect();
|
|
796
|
+
if (o.height && window.innerHeight) {
|
|
797
|
+
if (o.top + o.height - r < window.innerHeight / 2) return _t3;
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
return (_document$querySelect = document.querySelector("label[for='".concat(_e4.getAttribute("id"), "']"))) !== null && _document$querySelect !== void 0 ? _document$querySelect : _e4.closest("label");
|
|
802
|
+
}
|
|
803
|
+
window && "customElements" in window && customElements.define("bds-error-summary", e$1);
|
|
804
|
+
|
|
241
805
|
/**
|
|
242
806
|
* @license
|
|
243
807
|
* Copyright 2018 Google LLC
|
|
@@ -294,7 +858,7 @@ var e = new Set(["children", "localName", "ref", "style", "className"]),
|
|
|
294
858
|
var _excluded$3 = ["className", "errors", "mapNameToId"];
|
|
295
859
|
var ReactErrorSummary = t({
|
|
296
860
|
tagName: 'bds-error-summary',
|
|
297
|
-
elementClass:
|
|
861
|
+
elementClass: e$1,
|
|
298
862
|
react: React__namespace
|
|
299
863
|
});
|
|
300
864
|
var FormErrorKey = '_form';
|