@iabbb/bds-react 0.40.0-beta.9 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Button/Button.d.ts +7 -7
- package/Button/index.cjs.map +1 -1
- package/Button/index.d.ts +2 -2
- package/Button/index.mjs.map +1 -1
- package/CallToAction/CallToAction.d.ts +6 -6
- package/CallToAction/index.cjs.map +1 -1
- package/CallToAction/index.d.ts +2 -2
- package/CallToAction/index.mjs.map +1 -1
- package/ErrorSummary/ErrorSummary.d.ts +14 -15
- package/ErrorSummary/index.cjs +54 -357
- package/ErrorSummary/index.cjs.map +1 -1
- package/ErrorSummary/index.d.ts +2 -2
- package/ErrorSummary/index.mjs +54 -357
- package/ErrorSummary/index.mjs.map +1 -1
- package/ErrorSummary/package.json +1 -4
- package/ErrorSummary/utils.d.ts +2 -2
- package/FieldTextInput/FieldTextInput.d.ts +10 -10
- package/FieldTextInput/index.cjs.map +1 -1
- package/FieldTextInput/index.d.ts +1 -1
- package/FieldTextInput/index.mjs.map +1 -1
- package/Pagination/Pagination.d.ts +8 -8
- package/Pagination/index.cjs.map +1 -1
- package/Pagination/index.d.ts +1 -1
- package/Pagination/index.mjs.map +1 -1
- package/README.md +17 -17
- package/Typography/Typography.d.ts +7 -7
- package/Typography/index.cjs.map +1 -1
- package/Typography/index.d.ts +1 -1
- package/Typography/index.mjs.map +1 -1
- package/index.cjs +52 -574
- package/index.cjs.map +1 -1
- package/index.d.ts +6 -6
- package/index.mjs +52 -574
- package/index.mjs.map +1 -1
- package/package.json +35 -40
- package/dom-shim.d.ts +0 -1
package/index.cjs
CHANGED
|
@@ -21,90 +21,6 @@ function _interopNamespaceDefault(e) {
|
|
|
21
21
|
|
|
22
22
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
23
23
|
|
|
24
|
-
function _iterableToArrayLimit(r, l) {
|
|
25
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
26
|
-
if (null != t) {
|
|
27
|
-
var e,
|
|
28
|
-
n,
|
|
29
|
-
i,
|
|
30
|
-
u,
|
|
31
|
-
a = [],
|
|
32
|
-
f = !0,
|
|
33
|
-
o = !1;
|
|
34
|
-
try {
|
|
35
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
36
|
-
if (Object(t) !== t) return;
|
|
37
|
-
f = !1;
|
|
38
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
39
|
-
} catch (r) {
|
|
40
|
-
o = !0, n = r;
|
|
41
|
-
} finally {
|
|
42
|
-
try {
|
|
43
|
-
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
44
|
-
} finally {
|
|
45
|
-
if (o) throw n;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return a;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
function ownKeys(e, r) {
|
|
52
|
-
var t = Object.keys(e);
|
|
53
|
-
if (Object.getOwnPropertySymbols) {
|
|
54
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
55
|
-
r && (o = o.filter(function (r) {
|
|
56
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
57
|
-
})), t.push.apply(t, o);
|
|
58
|
-
}
|
|
59
|
-
return t;
|
|
60
|
-
}
|
|
61
|
-
function _objectSpread2(e) {
|
|
62
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
63
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
64
|
-
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
65
|
-
_defineProperty(e, r, t[r]);
|
|
66
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
67
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
return e;
|
|
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
|
-
}
|
|
94
|
-
function _defineProperty(obj, key, value) {
|
|
95
|
-
key = _toPropertyKey(key);
|
|
96
|
-
if (key in obj) {
|
|
97
|
-
Object.defineProperty(obj, key, {
|
|
98
|
-
value: value,
|
|
99
|
-
enumerable: true,
|
|
100
|
-
configurable: true,
|
|
101
|
-
writable: true
|
|
102
|
-
});
|
|
103
|
-
} else {
|
|
104
|
-
obj[key] = value;
|
|
105
|
-
}
|
|
106
|
-
return obj;
|
|
107
|
-
}
|
|
108
24
|
function _extends() {
|
|
109
25
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
110
26
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -119,90 +35,6 @@ function _extends() {
|
|
|
119
35
|
};
|
|
120
36
|
return _extends.apply(this, arguments);
|
|
121
37
|
}
|
|
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
|
-
}
|
|
206
38
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
207
39
|
if (source == null) return {};
|
|
208
40
|
var target = {};
|
|
@@ -230,46 +62,12 @@ function _objectWithoutProperties(source, excluded) {
|
|
|
230
62
|
}
|
|
231
63
|
return target;
|
|
232
64
|
}
|
|
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
|
-
}
|
|
261
|
-
function _slicedToArray(arr, i) {
|
|
262
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
263
|
-
}
|
|
264
65
|
function _toConsumableArray(arr) {
|
|
265
66
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
266
67
|
}
|
|
267
68
|
function _arrayWithoutHoles(arr) {
|
|
268
69
|
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
269
70
|
}
|
|
270
|
-
function _arrayWithHoles(arr) {
|
|
271
|
-
if (Array.isArray(arr)) return arr;
|
|
272
|
-
}
|
|
273
71
|
function _iterableToArray(iter) {
|
|
274
72
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
275
73
|
}
|
|
@@ -289,38 +87,6 @@ function _arrayLikeToArray(arr, len) {
|
|
|
289
87
|
function _nonIterableSpread() {
|
|
290
88
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
291
89
|
}
|
|
292
|
-
function _nonIterableRest() {
|
|
293
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
294
|
-
}
|
|
295
|
-
function _toPrimitive(input, hint) {
|
|
296
|
-
if (typeof input !== "object" || input === null) return input;
|
|
297
|
-
var prim = input[Symbol.toPrimitive];
|
|
298
|
-
if (prim !== undefined) {
|
|
299
|
-
var res = prim.call(input, hint || "default");
|
|
300
|
-
if (typeof res !== "object") return res;
|
|
301
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
302
|
-
}
|
|
303
|
-
return (hint === "string" ? String : Number)(input);
|
|
304
|
-
}
|
|
305
|
-
function _toPropertyKey(arg) {
|
|
306
|
-
var key = _toPrimitive(arg, "string");
|
|
307
|
-
return typeof key === "symbol" ? key : String(key);
|
|
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
|
-
}
|
|
324
90
|
|
|
325
91
|
var _excluded$5 = ["children", "className", "onClick", "preventDoubleClick", "variant"];
|
|
326
92
|
var DEBOUNCE_TIMEOUT_IN_SECONDS = 1;
|
|
@@ -386,354 +152,46 @@ var CallToAction = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref)
|
|
|
386
152
|
}, props), children);
|
|
387
153
|
});
|
|
388
154
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
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
|
-
}();
|
|
155
|
+
function getFragmentFromUrl(url) {
|
|
156
|
+
return url.includes('#') ? url.split('#').pop() : undefined;
|
|
157
|
+
}
|
|
158
|
+
function getAssociatedLegendOrLabel(input) {
|
|
159
|
+
var _document$querySelect;
|
|
160
|
+
var fieldset = input.closest('fieldset');
|
|
161
|
+
if (fieldset) {
|
|
162
|
+
var legends = fieldset.getElementsByTagName('legend');
|
|
163
|
+
if (legends.length) {
|
|
164
|
+
var candidateLegend = legends[0];
|
|
474
165
|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
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;
|
|
166
|
+
// If the input type is radio or checkbox, always use the legend if there
|
|
167
|
+
// is one.
|
|
168
|
+
if (input instanceof HTMLInputElement && (input.type === 'checkbox' || input.type === 'radio')) {
|
|
169
|
+
return candidateLegend;
|
|
519
170
|
}
|
|
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 HTMLElementShim = /*#__PURE__*/function (_ElementShim) {
|
|
571
|
-
_inherits(HTMLElement, _ElementShim);
|
|
572
|
-
var _super = _createSuper(HTMLElement);
|
|
573
|
-
function HTMLElement() {
|
|
574
|
-
_classCallCheck(this, HTMLElement);
|
|
575
|
-
return _super.apply(this, arguments);
|
|
576
|
-
}
|
|
577
|
-
return _createClass(HTMLElement);
|
|
578
|
-
}(ElementShim);
|
|
579
|
-
var HTMLElementShimWithRealType = HTMLElementShim;
|
|
580
|
-
var CustomElementRegistryShim = /*#__PURE__*/function () {
|
|
581
|
-
function CustomElementRegistry() {
|
|
582
|
-
_classCallCheck(this, CustomElementRegistry);
|
|
583
|
-
this.__definitions = new Map();
|
|
584
|
-
}
|
|
585
|
-
_createClass(CustomElementRegistry, [{
|
|
586
|
-
key: "define",
|
|
587
|
-
value: function define(name, ctor) {
|
|
588
|
-
var _ctor$observedAttribu;
|
|
589
|
-
if (this.__definitions.has(name)) {
|
|
590
|
-
if (process.env.NODE_ENV === 'development') {
|
|
591
|
-
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.");
|
|
592
|
-
} else {
|
|
593
|
-
throw new Error("Failed to execute 'define' on 'CustomElementRegistry': " + "the name \"".concat(name, "\" has already been used with this registry"));
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
this.__definitions.set(name, {
|
|
597
|
-
ctor: ctor,
|
|
598
|
-
// Note it's important we read `observedAttributes` in case it is a getter
|
|
599
|
-
// with side-effects, as is the case in Lit, where it triggers class
|
|
600
|
-
// finalization.
|
|
601
|
-
//
|
|
602
|
-
// TODO(aomarks) To be spec compliant, we should also capture the
|
|
603
|
-
// registration-time lifecycle methods like `connectedCallback`. For them
|
|
604
|
-
// to be actually accessible to e.g. the Lit SSR element renderer, though,
|
|
605
|
-
// we'd need to introduce a new API for accessing them (since `get` only
|
|
606
|
-
// returns the constructor).
|
|
607
|
-
observedAttributes: (_ctor$observedAttribu = ctor.observedAttributes) !== null && _ctor$observedAttribu !== void 0 ? _ctor$observedAttribu : []
|
|
608
|
-
});
|
|
609
|
-
}
|
|
610
|
-
}, {
|
|
611
|
-
key: "get",
|
|
612
|
-
value: function get(name) {
|
|
613
|
-
var definition = this.__definitions.get(name);
|
|
614
|
-
return definition === null || definition === void 0 ? void 0 : definition.ctor;
|
|
615
|
-
}
|
|
616
|
-
}]);
|
|
617
|
-
return CustomElementRegistry;
|
|
618
|
-
}();
|
|
619
|
-
var CustomElementRegistryShimWithRealType = CustomElementRegistryShim;
|
|
620
|
-
var customElements$1 = new CustomElementRegistryShimWithRealType();
|
|
621
171
|
|
|
622
|
-
//
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
}
|
|
172
|
+
// For other input types, only scroll to the fieldset’s legend (instead of
|
|
173
|
+
// the label associated with the input) if the input would end up in the
|
|
174
|
+
// top half of the screen.
|
|
175
|
+
//
|
|
176
|
+
// This should avoid situations where the input either ends up off the
|
|
177
|
+
// screen, or obscured by a software keyboard.
|
|
178
|
+
var legendTop = candidateLegend.getBoundingClientRect().top;
|
|
179
|
+
var inputRect = input.getBoundingClientRect();
|
|
631
180
|
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
_classCallCheck(this, e);
|
|
640
|
-
(_this = _super.call(this), _classPrivateMethodInitSpec(_assertThisInitialized(_this), _t), _classPrivateMethodInitSpec(_assertThisInitialized(_this), _e)), _this.addEventListener("click", function (_e5) {
|
|
641
|
-
var t = _e5.target.closest("a");
|
|
642
|
-
if (!t) return;
|
|
643
|
-
var n = _classPrivateMethodGet(_assertThisInitialized(_this), _e, _e2).call(_assertThisInitialized(_this), t.href);
|
|
644
|
-
if (!n) return;
|
|
645
|
-
var r = document.getElementById(n);
|
|
646
|
-
if (!r) return;
|
|
647
|
-
var o = _classPrivateMethodGet(_assertThisInitialized(_this), _t, _t2).call(_assertThisInitialized(_this), r);
|
|
648
|
-
o && (_e5.preventDefault(), o.scrollIntoView(), r.focus({
|
|
649
|
-
preventScroll: !0
|
|
650
|
-
}));
|
|
651
|
-
});
|
|
652
|
-
return _this;
|
|
653
|
-
}
|
|
654
|
-
return _createClass(e);
|
|
655
|
-
}( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
|
|
656
|
-
function _e2(_e3) {
|
|
657
|
-
return _e3.includes("#") ? _e3.split("#").pop() : void 0;
|
|
658
|
-
}
|
|
659
|
-
function _t2(_e4) {
|
|
660
|
-
var _document$querySelect;
|
|
661
|
-
var t = _e4.closest("fieldset");
|
|
662
|
-
if (t) {
|
|
663
|
-
var n = t.getElementsByTagName("legend");
|
|
664
|
-
if (n.length) {
|
|
665
|
-
var _t3 = n[0];
|
|
666
|
-
if (_e4 instanceof HTMLInputElement && ("checkbox" === _e4.type || "radio" === _e4.type)) return _t3;
|
|
667
|
-
var r = _t3.getBoundingClientRect().top,
|
|
668
|
-
o = _e4.getBoundingClientRect();
|
|
669
|
-
if (o.height && window.innerHeight) {
|
|
670
|
-
if (o.top + o.height - r < window.innerHeight / 2) return _t3;
|
|
181
|
+
// If the browser doesn't support Element.getBoundingClientRect().height
|
|
182
|
+
// or window.innerHeight (like IE8), bail and just link to the label.
|
|
183
|
+
if (inputRect.height && window.innerHeight) {
|
|
184
|
+
var inputBottom = inputRect.top + inputRect.height;
|
|
185
|
+
if (inputBottom - legendTop < window.innerHeight / 2) {
|
|
186
|
+
return candidateLegend;
|
|
187
|
+
}
|
|
671
188
|
}
|
|
672
189
|
}
|
|
673
190
|
}
|
|
674
|
-
return (_document$querySelect = document.querySelector("label[for='".concat(
|
|
191
|
+
return (_document$querySelect = document.querySelector("label[for='".concat(input.getAttribute('id'), "']"))) !== null && _document$querySelect !== void 0 ? _document$querySelect : input.closest('label');
|
|
675
192
|
}
|
|
676
|
-
"customElements" in window && customElements.define("bds-error-summary", e$1);
|
|
677
|
-
|
|
678
|
-
/**
|
|
679
|
-
* @license
|
|
680
|
-
* Copyright 2018 Google LLC
|
|
681
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
682
|
-
*/
|
|
683
|
-
var e = new Set(["children", "localName", "ref", "style", "className"]),
|
|
684
|
-
n = new WeakMap(),
|
|
685
|
-
l = function l(e, _l, t, o, a) {
|
|
686
|
-
var i = null == a ? void 0 : a[_l];
|
|
687
|
-
void 0 === i || t === o ? (e[_l] = t, null == t && _l in HTMLElement.prototype && e.removeAttribute(_l)) : function (e, l, t) {
|
|
688
|
-
var o = n.get(e);
|
|
689
|
-
void 0 === o && n.set(e, o = new Map());
|
|
690
|
-
var a = o.get(l);
|
|
691
|
-
void 0 !== t ? void 0 === a ? (o.set(l, a = {
|
|
692
|
-
handleEvent: t
|
|
693
|
-
}), e.addEventListener(l, a)) : a.handleEvent = t : void 0 !== a && (o["delete"](l), e.removeEventListener(l, a));
|
|
694
|
-
}(e, i, t);
|
|
695
|
-
},
|
|
696
|
-
t = function t(_ref) {
|
|
697
|
-
var n = _ref.react,
|
|
698
|
-
t = _ref.tagName,
|
|
699
|
-
o = _ref.elementClass,
|
|
700
|
-
a = _ref.events,
|
|
701
|
-
i = _ref.displayName;
|
|
702
|
-
var s = new Set(Object.keys(null != a ? a : {})),
|
|
703
|
-
c = n.forwardRef(function (i, c) {
|
|
704
|
-
var r = n.useRef(null),
|
|
705
|
-
d = n.useRef(null),
|
|
706
|
-
u = {},
|
|
707
|
-
v = {};
|
|
708
|
-
for (var _i = 0, _Object$entries = Object.entries(i); _i < _Object$entries.length; _i++) {
|
|
709
|
-
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
710
|
-
_n = _Object$entries$_i[0],
|
|
711
|
-
_l2 = _Object$entries$_i[1];
|
|
712
|
-
e.has(_n) ? u["className" === _n ? "class" : _n] = _l2 : s.has(_n) || _n in o.prototype ? v[_n] = _l2 : u[_n] = _l2;
|
|
713
|
-
}
|
|
714
|
-
return n.useLayoutEffect(function () {
|
|
715
|
-
if (null !== d.current) {
|
|
716
|
-
for (var _e in v) l(d.current, _e, i[_e], r.current ? r.current[_e] : void 0, a);
|
|
717
|
-
r.current = i;
|
|
718
|
-
}
|
|
719
|
-
}), n.useLayoutEffect(function () {
|
|
720
|
-
var e;
|
|
721
|
-
null === (e = d.current) || void 0 === e || e.removeAttribute("defer-hydration");
|
|
722
|
-
}, []), u.suppressHydrationWarning = !0, n.createElement(t, _objectSpread2(_objectSpread2({}, u), {}, {
|
|
723
|
-
ref: function ref(e) {
|
|
724
|
-
d.current = e, "function" == typeof c ? c(e) : null !== c && (c.current = e);
|
|
725
|
-
}
|
|
726
|
-
}));
|
|
727
|
-
});
|
|
728
|
-
return c.displayName = null != i ? i : o.name, c;
|
|
729
|
-
};
|
|
730
193
|
|
|
731
194
|
var _excluded$3 = ["className", "errors", "mapNameToId"];
|
|
732
|
-
var ReactErrorSummary = t({
|
|
733
|
-
tagName: 'bds-error-summary',
|
|
734
|
-
elementClass: e$1,
|
|
735
|
-
react: React__namespace
|
|
736
|
-
});
|
|
737
195
|
var FormErrorKey = '_form';
|
|
738
196
|
var FINAL_FORM_ERROR = 'FINAL_FORM/form-error';
|
|
739
197
|
function BdsErrorSummary(_ref) {
|
|
@@ -752,7 +210,26 @@ function BdsErrorSummary(_ref) {
|
|
|
752
210
|
groupRef.current.focus();
|
|
753
211
|
}, [errors]);
|
|
754
212
|
if (!errors || Object.keys(errors).length === 0) return null;
|
|
755
|
-
|
|
213
|
+
var handleLinkClick = function handleLinkClick(e) {
|
|
214
|
+
var inputId = getFragmentFromUrl(e.currentTarget.href);
|
|
215
|
+
if (!inputId) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
var input = document.getElementById(inputId);
|
|
219
|
+
if (!input) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
var legendOrLabel = getAssociatedLegendOrLabel(input);
|
|
223
|
+
if (!legendOrLabel) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
e.preventDefault();
|
|
227
|
+
legendOrLabel.scrollIntoView();
|
|
228
|
+
input.focus({
|
|
229
|
+
preventScroll: true
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
return /*#__PURE__*/React__namespace.createElement("bds-error-summary", _extends({
|
|
756
233
|
className: ['stack', className].filter(function (x) {
|
|
757
234
|
return x;
|
|
758
235
|
}).join(' '),
|
|
@@ -792,7 +269,8 @@ function BdsErrorSummary(_ref) {
|
|
|
792
269
|
return /*#__PURE__*/React__namespace.createElement("li", {
|
|
793
270
|
key: inputId
|
|
794
271
|
}, /*#__PURE__*/React__namespace.createElement("a", {
|
|
795
|
-
href: "#".concat(inputId)
|
|
272
|
+
href: "#".concat(inputId),
|
|
273
|
+
onClick: handleLinkClick
|
|
796
274
|
}, fieldMessage, messages.length > 1 ? " (".concat(index + 1, " of ").concat(messages.length, ")") : undefined));
|
|
797
275
|
}));
|
|
798
276
|
})));
|