@linzjs/step-ag-grid 8.4.2 → 9.0.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.
Files changed (51) hide show
  1. package/README.md +4 -4
  2. package/dist/index.css +3 -0
  3. package/dist/src/components/gridForm/GridFormMultiSelect.d.ts +5 -4
  4. package/dist/src/lui/TextAreaInput.d.ts +1 -0
  5. package/dist/src/lui/TextInputFormatted.d.ts +1 -0
  6. package/dist/src/react-menu3/components/FocusableItem.d.ts +1 -1
  7. package/dist/src/react-menu3/components/MenuItem.d.ts +3 -1
  8. package/dist/src/react-menu3/components/SubMenu.d.ts +1 -1
  9. package/dist/src/react-menu3/utils/withHovering.d.ts +2 -2
  10. package/dist/src/utils/textMatcher.d.ts +1 -1
  11. package/dist/src/utils/textMatcher.test.d.ts +1 -0
  12. package/dist/step-ag-grid.esm.js +502 -735
  13. package/dist/step-ag-grid.esm.js.map +1 -1
  14. package/package.json +42 -42
  15. package/src/components/Grid.tsx +29 -27
  16. package/src/components/gridForm/GridFormDropDown.tsx +12 -14
  17. package/src/components/gridForm/GridFormMultiSelect.tsx +31 -29
  18. package/src/components/gridForm/GridFormPopoverMenu.tsx +18 -22
  19. package/src/components/gridForm/GridFormSubComponentTextArea.tsx +1 -1
  20. package/src/components/gridForm/GridFormSubComponentTextInput.tsx +1 -1
  21. package/src/components/gridForm/GridFormTextArea.tsx +1 -1
  22. package/src/components/gridForm/GridFormTextInput.tsx +1 -1
  23. package/src/lui/TextAreaInput.tsx +3 -1
  24. package/src/lui/TextInputFormatted.tsx +3 -1
  25. package/src/react-menu3/components/ControlledMenu.tsx +19 -6
  26. package/src/react-menu3/components/MenuItem.tsx +1 -1
  27. package/src/react-menu3/utils/withHovering.tsx +3 -3
  28. package/src/stories/grid/GridKeyboardInteractions.stories.tsx +261 -0
  29. package/src/stories/grid/{GridPopoutBearing.stories.tsx → GridPopoverEditBearing.stories.tsx} +4 -4
  30. package/src/stories/grid/{GridPopoutEditDropDown.stories.tsx → GridPopoverEditDropDown.stories.tsx} +10 -2
  31. package/src/stories/grid/{GridPopoutEditMultiSelect.stories.tsx → GridPopoverEditMultiSelect.stories.tsx} +0 -0
  32. package/src/stories/grid/gridFormInteraction/GridFormDropDownInteraction.stories.tsx +137 -0
  33. package/src/stories/grid/gridFormInteraction/GridFormEditBearingCorrectionInteraction.stories.tsx +92 -0
  34. package/src/stories/grid/gridFormInteraction/GridFormEditBearingInteraction.stories.tsx +91 -0
  35. package/src/stories/grid/gridFormInteraction/GridFormMultiSelectInteraction.stories.tsx +153 -0
  36. package/src/stories/grid/gridFormInteraction/GridFormPopoverMenuInteraction.stories.tsx +171 -0
  37. package/src/stories/grid/gridFormInteraction/GridFormTextAreaInteraction.stories.tsx +78 -0
  38. package/src/stories/grid/gridFormInteraction/GridFormTextInputInteraction.stories.tsx +85 -0
  39. package/src/stories/grid/{gridForm → gridFormStatic}/GridFormDropDown.stories.tsx +1 -1
  40. package/src/stories/grid/{gridForm → gridFormStatic}/GridFormEditBearing.stories.tsx +1 -1
  41. package/src/stories/grid/{gridForm → gridFormStatic}/GridFormEditBearingCorrection.stories.tsx +1 -1
  42. package/src/stories/grid/{gridForm → gridFormStatic}/GridFormMessage.stories.tsx +1 -1
  43. package/src/stories/grid/{gridForm → gridFormStatic}/GridFormMultiSelect.stories.tsx +1 -1
  44. package/src/stories/grid/{gridForm → gridFormStatic}/GridFormPopoverMenu.stories.tsx +1 -1
  45. package/src/stories/grid/{gridForm → gridFormStatic}/GridFormTextArea.stories.tsx +1 -1
  46. package/src/stories/grid/{gridForm → gridFormStatic}/GridFormTextInput.stories.tsx +1 -1
  47. package/src/stories/react-menu/ReactMenu.stories.tsx +66 -3
  48. package/src/styles/Grid.scss +3 -0
  49. package/src/utils/testUtil.ts +1 -0
  50. package/src/utils/textMatcher.test.ts +38 -0
  51. package/src/utils/textMatcher.ts +9 -2
@@ -1416,6 +1416,26 @@ var ControlledMenuFr = function (_a, externalRef) {
1416
1416
  ev.stopPropagation();
1417
1417
  return;
1418
1418
  }
1419
+ var invokeSave = function (reason) {
1420
+ var _a, _b;
1421
+ if (!(saveButtonRef === null || saveButtonRef === void 0 ? void 0 : saveButtonRef.current))
1422
+ return;
1423
+ (_a = saveButtonRef.current) === null || _a === void 0 ? void 0 : _a.setAttribute("data-reason", reason);
1424
+ (_b = saveButtonRef === null || saveButtonRef === void 0 ? void 0 : saveButtonRef.current) === null || _b === void 0 ? void 0 : _b.click();
1425
+ };
1426
+ var allowTabToSave = activeElement.getAttribute("data-allowtabtosave") == "true";
1427
+ if (allowTabToSave) {
1428
+ if (isDown) {
1429
+ ev.preventDefault();
1430
+ ev.stopPropagation();
1431
+ lastTabDownEl.current = activeElement;
1432
+ }
1433
+ else {
1434
+ lastTabDownEl.current == activeElement &&
1435
+ invokeSave(ev.shiftKey ? CloseReason.TAB_BACKWARD : CloseReason.TAB_FORWARD);
1436
+ }
1437
+ return;
1438
+ }
1419
1439
  var inputElsIterator = thisDocument.querySelectorAll(".szh-menu--state-open input,textarea");
1420
1440
  var inputEls = [];
1421
1441
  inputElsIterator.forEach(function (el) { return inputEls.push(el); });
@@ -1428,14 +1448,6 @@ var ControlledMenuFr = function (_a, externalRef) {
1428
1448
  return;
1429
1449
  var isTextArea = activeElement.nodeName === "TEXTAREA";
1430
1450
  var suppressEnterAutoSave = activeElement.getAttribute("data-disableenterautosave") == "true" || isTextArea;
1431
- var allowTabToSave = activeElement.getAttribute("data-allowtabtosave") == "true";
1432
- var invokeSave = function (reason) {
1433
- var _a, _b;
1434
- if (!(saveButtonRef === null || saveButtonRef === void 0 ? void 0 : saveButtonRef.current))
1435
- return;
1436
- (_a = saveButtonRef.current) === null || _a === void 0 ? void 0 : _a.setAttribute("data-reason", reason);
1437
- (_b = saveButtonRef === null || saveButtonRef === void 0 ? void 0 : saveButtonRef.current) === null || _b === void 0 ? void 0 : _b.click();
1438
- };
1439
1451
  switch (activeElement.nodeName) {
1440
1452
  case "TEXTAREA":
1441
1453
  case "INPUT": {
@@ -1858,7 +1870,7 @@ var MenuItemFr = function (_a) {
1858
1870
  }
1859
1871
  };
1860
1872
  /**
1861
- * Keyboard events are triggered on up, otherwise sub-components get spaces and enters typed in them
1873
+ * Keyboard events are triggered on up, otherwise subcomponents get spaces and enters typed in them
1862
1874
  */
1863
1875
  var handleKeyUp = function (e) {
1864
1876
  if (!isHovering)
@@ -2968,7 +2980,7 @@ var Grid = function (params) {
2968
2980
  }, [columnDefs === null || columnDefs === void 0 ? void 0 : columnDefs.length, sizeColumnsToFit]);
2969
2981
  return (jsxs("div", __assign({ "data-testid": params["data-testid"], className: clsx("Grid-container", "ag-theme-alpine", staleGrid && "Grid-sortIsStale", gridReady && params.rowData && "Grid-ready") }, { children: [params.quickFilter && (jsx("div", __assign({ className: "Grid-quickFilter" }, { children: jsx("input", { "aria-label": "Search", className: "lui-margin-top-xxs lui-margin-bottom-xxs Grid-quickFilterBox", type: "text", placeholder: (_a = params.quickFilterPlaceholder) !== null && _a !== void 0 ? _a : "Search...", value: internalQuickFilter, onChange: function (event) {
2970
2982
  setInternalQuickFilter(event.target.value);
2971
- } }) }))), jsx(AgGridReact, { animateRows: params.animateRows, rowClassRules: params.rowClassRules, defaultColDef: params.defaultColDef, getRowId: function (params) { return "".concat(params.data.id); }, suppressRowClickSelection: true, rowSelection: (_b = params.rowSelection) !== null && _b !== void 0 ? _b : "multiple", suppressBrowserResizeObserver: true, colResizeDefault: "shift", onFirstDataRendered: sizeColumnsToFit, onGridSizeChanged: sizeColumnsToFit, suppressClickEdit: true, onCellKeyPress: onCellKeyPress, onCellClicked: onCellClicked, onCellDoubleClicked: onCellDoubleClick, onCellEditingStarted: refreshSelectedRows, domLayout: params.domLayout, columnDefs: columnDefs, rowData: params.rowData, noRowsOverlayComponent: noRowsOverlayComponent, onGridReady: onGridReady, onSortChanged: ensureSelectedRowIsVisible, postSortRows: (_c = params.postSortRows) !== null && _c !== void 0 ? _c : postSortRows, onSelectionChanged: synchroniseExternalStateToGridSelection, onColumnMoved: params.onColumnMoved, alwaysShowVerticalScroll: params.alwaysShowVerticalScroll })] })));
2983
+ } }) }))), jsx("div", __assign({ style: { flex: 1 } }, { children: jsx(AgGridReact, { animateRows: params.animateRows, rowClassRules: params.rowClassRules, defaultColDef: params.defaultColDef, getRowId: function (params) { return "".concat(params.data.id); }, suppressRowClickSelection: true, rowSelection: (_b = params.rowSelection) !== null && _b !== void 0 ? _b : "multiple", suppressBrowserResizeObserver: true, colResizeDefault: "shift", onFirstDataRendered: sizeColumnsToFit, onGridSizeChanged: sizeColumnsToFit, suppressClickEdit: true, onCellKeyPress: onCellKeyPress, onCellClicked: onCellClicked, onCellDoubleClicked: onCellDoubleClick, onCellEditingStarted: refreshSelectedRows, domLayout: params.domLayout, columnDefs: columnDefs, rowData: params.rowData, noRowsOverlayComponent: noRowsOverlayComponent, onGridReady: onGridReady, onSortChanged: ensureSelectedRowIsVisible, postSortRows: (_c = params.postSortRows) !== null && _c !== void 0 ? _c : postSortRows, onSelectionChanged: synchroniseExternalStateToGridSelection, onColumnMoved: params.onColumnMoved, alwaysShowVerticalScroll: params.alwaysShowVerticalScroll }) }))] })));
2972
2984
  };
2973
2985
 
2974
2986
  var GridCellMultiSelectClassRules = {
@@ -3199,9 +3211,16 @@ function getDefaultExportFromCjs (x) {
3199
3211
  }
3200
3212
 
3201
3213
  function getAugmentedNamespace(n) {
3214
+ if (n.__esModule) return n;
3202
3215
  var f = n.default;
3203
3216
  if (typeof f == "function") {
3204
- var a = function () {
3217
+ var a = function a () {
3218
+ if (this instanceof a) {
3219
+ var args = [null];
3220
+ args.push.apply(args, arguments);
3221
+ var Ctor = Function.bind.apply(f, args);
3222
+ return new Ctor();
3223
+ }
3205
3224
  return f.apply(this, arguments);
3206
3225
  };
3207
3226
  a.prototype = f.prototype;
@@ -3324,6 +3343,163 @@ var FormError = function (props) {
3324
3343
  return (jsxs(Fragment$1, { children: [props.error && (jsx("span", __assign({ className: "LuiTextInput-error", style: { paddingLeft: 0 } }, { children: props.error }))), props.helpText && !props.error && jsx("span", __assign({ className: "helpText" }, { children: props.helpText }))] }));
3325
3344
  };
3326
3345
 
3346
+ function escapeStringRegexp(string) {
3347
+ if (typeof string !== 'string') {
3348
+ throw new TypeError('Expected a string');
3349
+ }
3350
+
3351
+ // Escape characters with special meaning either inside or outside character sets.
3352
+ // Use a simple backslash escape when it’s always valid, and a `\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
3353
+ return string
3354
+ .replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
3355
+ .replace(/-/g, '\\x2d');
3356
+ }
3357
+
3358
+ const regexpCache = new Map();
3359
+
3360
+ const sanitizeArray = (input, inputName) => {
3361
+ if (!Array.isArray(input)) {
3362
+ switch (typeof input) {
3363
+ case 'string':
3364
+ input = [input];
3365
+ break;
3366
+ case 'undefined':
3367
+ input = [];
3368
+ break;
3369
+ default:
3370
+ throw new TypeError(`Expected '${inputName}' to be a string or an array, but got a type of '${typeof input}'`);
3371
+ }
3372
+ }
3373
+
3374
+ return input.filter(string => {
3375
+ if (typeof string !== 'string') {
3376
+ if (typeof string === 'undefined') {
3377
+ return false;
3378
+ }
3379
+
3380
+ throw new TypeError(`Expected '${inputName}' to be an array of strings, but found a type of '${typeof string}' in the array`);
3381
+ }
3382
+
3383
+ return true;
3384
+ });
3385
+ };
3386
+
3387
+ const makeRegexp = (pattern, options) => {
3388
+ options = {
3389
+ caseSensitive: false,
3390
+ ...options,
3391
+ };
3392
+
3393
+ const cacheKey = pattern + JSON.stringify(options);
3394
+
3395
+ if (regexpCache.has(cacheKey)) {
3396
+ return regexpCache.get(cacheKey);
3397
+ }
3398
+
3399
+ const negated = pattern[0] === '!';
3400
+
3401
+ if (negated) {
3402
+ pattern = pattern.slice(1);
3403
+ }
3404
+
3405
+ pattern = escapeStringRegexp(pattern).replace(/\\\*/g, '[\\s\\S]*');
3406
+
3407
+ const regexp = new RegExp(`^${pattern}$`, options.caseSensitive ? '' : 'i');
3408
+ regexp.negated = negated;
3409
+ regexpCache.set(cacheKey, regexp);
3410
+
3411
+ return regexp;
3412
+ };
3413
+
3414
+ const baseMatcher = (inputs, patterns, options, firstMatchOnly) => {
3415
+ inputs = sanitizeArray(inputs, 'inputs');
3416
+ patterns = sanitizeArray(patterns, 'patterns');
3417
+
3418
+ if (patterns.length === 0) {
3419
+ return [];
3420
+ }
3421
+
3422
+ patterns = patterns.map(pattern => makeRegexp(pattern, options));
3423
+
3424
+ const {allPatterns} = options || {};
3425
+ const result = [];
3426
+
3427
+ for (const input of inputs) {
3428
+ // String is included only if it matches at least one non-negated pattern supplied.
3429
+ // Note: the `allPatterns` option requires every non-negated pattern to be matched once.
3430
+ // Matching a negated pattern excludes the string.
3431
+ let matches;
3432
+ const didFit = [...patterns].fill(false);
3433
+
3434
+ for (const [index, pattern] of patterns.entries()) {
3435
+ if (pattern.test(input)) {
3436
+ didFit[index] = true;
3437
+ matches = !pattern.negated;
3438
+
3439
+ if (!matches) {
3440
+ break;
3441
+ }
3442
+ }
3443
+ }
3444
+
3445
+ if (
3446
+ !(
3447
+ matches === false
3448
+ || (matches === undefined && patterns.some(pattern => !pattern.negated))
3449
+ || (allPatterns && didFit.some((yes, index) => !yes && !patterns[index].negated))
3450
+ )
3451
+ ) {
3452
+ result.push(input);
3453
+
3454
+ if (firstMatchOnly) {
3455
+ break;
3456
+ }
3457
+ }
3458
+ }
3459
+
3460
+ return result;
3461
+ };
3462
+
3463
+ function isMatch(inputs, patterns, options) {
3464
+ return baseMatcher(inputs, patterns, options, true).length > 0;
3465
+ }
3466
+
3467
+ /**
3468
+ * Text matching with wildcards and multiple matchers.
3469
+ *
3470
+ * "L" => L*
3471
+ * "=L" => L
3472
+ * "*L*" => *L*
3473
+ * "*L" => *L
3474
+ * "A B" => A* and B*
3475
+ * "A B, C" => (A* and B*) or C*
3476
+ * "!A" => all values must not match A
3477
+ * Returns true if there's a text match.
3478
+ */
3479
+ var textMatch = function (text, filter) {
3480
+ if (text == null)
3481
+ return true;
3482
+ var superFilters = filter
3483
+ .split(",")
3484
+ .map(function (sf) { return sf.trim(); })
3485
+ .filter(function (sf) { return sf; })
3486
+ .map(function (r) {
3487
+ return r
3488
+ .split(/\s+/)
3489
+ .map(function (f) { return (f.startsWith("=") ? f.slice(1) : f + "*"); })
3490
+ .join(" ");
3491
+ });
3492
+ var _a = partition(superFilters, function (superFilters) { return superFilters.startsWith("!"); }), negativeFilters = _a[0], positiveFilters = _a[1];
3493
+ var values = text.replaceAll(",", " ").trim().split(/\s+/);
3494
+ return ((isEmpty(positiveFilters) || // Not filtered
3495
+ positiveFilters.some(function (superFilter) {
3496
+ var subFilters = superFilter.split(/\s+/).map(function (s) { return s.replaceAll(/([!?])/g, "\\$1"); });
3497
+ return subFilters.every(function (subFilter) { return values.some(function (value) { return isMatch(value, subFilter); }); });
3498
+ })) &&
3499
+ (isEmpty(negativeFilters) ||
3500
+ negativeFilters.every(function (superFilter) { return values.every(function (value) { return isMatch(value, superFilter); }); })));
3501
+ };
3502
+
3327
3503
  var MenuSeparatorString = "_____MENU_SEPARATOR_____";
3328
3504
  var MenuSeparator = Object.freeze({ value: MenuSeparatorString });
3329
3505
  var MenuHeaderString = "_____MENU_HEADER_____";
@@ -3417,8 +3593,7 @@ var GridFormDropDown = function (props) {
3417
3593
  console.error("Cannot filter non-string labels", option);
3418
3594
  return undefined;
3419
3595
  }
3420
- var str = option.label || "";
3421
- return str.toLowerCase().indexOf(filter.toLowerCase()) !== -1 ? option : undefined;
3596
+ return textMatch(option.label || "", filter) ? option : undefined;
3422
3597
  })
3423
3598
  .filter(function (r) { return r !== undefined; }));
3424
3599
  }
@@ -3490,206 +3665,51 @@ var GridFormDropDown = function (props) {
3490
3665
  } })), jsx(MenuDivider, {}, "$$divider_filter")] }))), jsx(ComponentLoadingWrapper, __assign({ loading: !options, className: "GridFormDropDown-options" }, { children: jsxs(Fragment$1, { children: [options && (isEmpty(options) || (filteredValues && isEmpty(filteredValues))) && (jsx(MenuItem, __assign({ className: "GridPopoverEditDropDown-noOptions", disabled: true }, { children: (_b = props.noOptionsMessage) !== null && _b !== void 0 ? _b : "No Options" }), "".concat(fieldToString(field), "-empty"))), options === null || options === void 0 ? void 0 : options.map(function (item, index) {
3491
3666
  var _a;
3492
3667
  showHeader = null;
3493
- if (item.value === MenuSeparatorString) {
3494
- return jsx(MenuDivider, {}, "$$divider_".concat(index));
3495
- }
3496
- else if (item.value === MenuHeaderString) {
3497
- lastHeader = jsx(MenuHeader, { children: item.label }, "$$header_".concat(index));
3498
- return jsx(Fragment$1, {});
3499
- }
3500
- else {
3501
- if (lastHeader) {
3502
- showHeader = lastHeader;
3503
- lastHeader = null;
3504
- }
3505
- }
3506
- return ((!filteredValues || filteredValues.includes(item)) && (jsxs(Fragment, { children: [showHeader, jsxs("div", { children: [jsxs(MenuItem, __assign({ disabled: !!item.disabled, title: item.disabled && typeof item.disabled !== "boolean" ? item.disabled : "", value: item.value, onFocus: function () {
3507
- setSelectedItem(item);
3508
- if (item.subComponent) {
3509
- subComponentIsValid.current = true;
3510
- subComponentInitialValue.current = null;
3511
- }
3512
- else {
3513
- setSubSelectedValue(null);
3514
- subComponentIsValid.current = true;
3515
- }
3516
- }, onClick: function (e) {
3517
- if (item.subComponent) {
3518
- e.keepOpen = true;
3519
- }
3520
- } }, { children: [(_a = item.label) !== null && _a !== void 0 ? _a : (item.value == null ? "<".concat(item.value, ">") : "".concat(item.value)), item.subComponent ? "..." : ""] }), "".concat(fieldToString(field), "-").concat(index)), item.subComponent && selectedItem === item && (jsx(FocusableItem, __assign({ className: "LuiDeprecatedForms" }, { children: function (ref) { return (jsx(GridSubComponentContext.Provider, __assign({ value: {
3521
- context: { options: options },
3522
- data: data,
3523
- value: subSelectedValue,
3524
- setValue: function (value) {
3525
- setSubSelectedValue(value);
3526
- if (subComponentInitialValue.current === null) {
3527
- // copy the default value of the subcomponent, so we can change detect on save
3528
- subComponentInitialValue.current = JSON.stringify(value);
3529
- }
3530
- },
3531
- setValid: function (valid) {
3532
- subComponentIsValid.current = valid;
3533
- },
3534
- triggerSave: function () { return __awaiter(void 0, void 0, void 0, function () {
3535
- return __generator(this, function (_a) {
3536
- ref.closeMenu();
3537
- return [2 /*return*/];
3538
- });
3539
- }); }
3540
- } }, { children: item.subComponent && (jsx("div", __assign({ className: "subComponent" }, { children: jsx(item.subComponent, {}, "".concat(fieldToString(field), "-").concat(index, "_subcomponent_inner")) }))) }))); } }), "".concat(item.label, "_subcomponent")))] }, "menu-wrapper-".concat(index))] }, "".concat(index))));
3541
- })] }) }))] }));
3542
- };
3543
-
3544
- function escapeStringRegexp(string) {
3545
- if (typeof string !== 'string') {
3546
- throw new TypeError('Expected a string');
3547
- }
3548
-
3549
- // Escape characters with special meaning either inside or outside character sets.
3550
- // Use a simple backslash escape when it’s always valid, and a `\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
3551
- return string
3552
- .replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
3553
- .replace(/-/g, '\\x2d');
3554
- }
3555
-
3556
- const regexpCache = new Map();
3557
-
3558
- const sanitizeArray = (input, inputName) => {
3559
- if (!Array.isArray(input)) {
3560
- switch (typeof input) {
3561
- case 'string':
3562
- input = [input];
3563
- break;
3564
- case 'undefined':
3565
- input = [];
3566
- break;
3567
- default:
3568
- throw new TypeError(`Expected '${inputName}' to be a string or an array, but got a type of '${typeof input}'`);
3569
- }
3570
- }
3571
-
3572
- return input.filter(string => {
3573
- if (typeof string !== 'string') {
3574
- if (typeof string === 'undefined') {
3575
- return false;
3576
- }
3577
-
3578
- throw new TypeError(`Expected '${inputName}' to be an array of strings, but found a type of '${typeof string}' in the array`);
3579
- }
3580
-
3581
- return true;
3582
- });
3583
- };
3584
-
3585
- const makeRegexp = (pattern, options) => {
3586
- options = {
3587
- caseSensitive: false,
3588
- ...options,
3589
- };
3590
-
3591
- const cacheKey = pattern + JSON.stringify(options);
3592
-
3593
- if (regexpCache.has(cacheKey)) {
3594
- return regexpCache.get(cacheKey);
3595
- }
3596
-
3597
- const negated = pattern[0] === '!';
3598
-
3599
- if (negated) {
3600
- pattern = pattern.slice(1);
3601
- }
3602
-
3603
- pattern = escapeStringRegexp(pattern).replace(/\\\*/g, '[\\s\\S]*');
3604
-
3605
- const regexp = new RegExp(`^${pattern}$`, options.caseSensitive ? '' : 'i');
3606
- regexp.negated = negated;
3607
- regexpCache.set(cacheKey, regexp);
3608
-
3609
- return regexp;
3610
- };
3611
-
3612
- const baseMatcher = (inputs, patterns, options, firstMatchOnly) => {
3613
- inputs = sanitizeArray(inputs, 'inputs');
3614
- patterns = sanitizeArray(patterns, 'patterns');
3615
-
3616
- if (patterns.length === 0) {
3617
- return [];
3618
- }
3619
-
3620
- patterns = patterns.map(pattern => makeRegexp(pattern, options));
3621
-
3622
- const {allPatterns} = options || {};
3623
- const result = [];
3624
-
3625
- for (const input of inputs) {
3626
- // String is included only if it matches at least one non-negated pattern supplied.
3627
- // Note: the `allPatterns` option requires every non-negated pattern to be matched once.
3628
- // Matching a negated pattern excludes the string.
3629
- let matches;
3630
- const didFit = [...patterns].fill(false);
3631
-
3632
- for (const [index, pattern] of patterns.entries()) {
3633
- if (pattern.test(input)) {
3634
- didFit[index] = true;
3635
- matches = !pattern.negated;
3636
-
3637
- if (!matches) {
3638
- break;
3639
- }
3640
- }
3641
- }
3642
-
3643
- if (
3644
- !(
3645
- matches === false
3646
- || (matches === undefined && patterns.some(pattern => !pattern.negated))
3647
- || (allPatterns && didFit.some((yes, index) => !yes && !patterns[index].negated))
3648
- )
3649
- ) {
3650
- result.push(input);
3651
-
3652
- if (firstMatchOnly) {
3653
- break;
3654
- }
3655
- }
3656
- }
3657
-
3658
- return result;
3659
- };
3660
-
3661
- function isMatch(inputs, patterns, options) {
3662
- return baseMatcher(inputs, patterns, options, true).length > 0;
3663
- }
3664
-
3665
- /**
3666
- * Text matching with wildcards and multiple matchers.
3667
- *
3668
- * "L" => L*
3669
- * "L*" => L*
3670
- * "*L*" => *L*
3671
- * "*L" => *L
3672
- * "A B" => A* and B*
3673
- * "A B, C" => (A* and B*) or C*
3674
- * "!A" => all values must not match A
3675
- * Returns true if there's a text match.
3676
- */
3677
- var textMatch = function (text, filter) {
3678
- if (text == null)
3679
- return true;
3680
- var superFilters = filter
3681
- .split(",")
3682
- .map(function (sf) { return sf.trim(); })
3683
- .filter(function (sf) { return sf; });
3684
- var _a = partition(superFilters, function (superFilters) { return superFilters.startsWith("!"); }), negativeFilters = _a[0], positiveFilters = _a[1];
3685
- var values = text.replaceAll(",", " ").trim().split(/\s+/);
3686
- return ((isEmpty(positiveFilters) || // Not filtered
3687
- positiveFilters.some(function (superFilter) {
3688
- var subFilters = superFilter.split(/\s+/).map(function (s) { return s.replaceAll(/([!?])/g, "\\$1"); });
3689
- return subFilters.every(function (subFilter) { return values.some(function (value) { return isMatch(value, subFilter); }); });
3690
- })) &&
3691
- (isEmpty(negativeFilters) ||
3692
- negativeFilters.every(function (superFilter) { return values.every(function (value) { return isMatch(value, superFilter); }); })));
3668
+ if (item.value === MenuSeparatorString) {
3669
+ return jsx(MenuDivider, {}, "$$divider_".concat(index));
3670
+ }
3671
+ else if (item.value === MenuHeaderString) {
3672
+ lastHeader = jsx(MenuHeader, { children: item.label }, "$$header_".concat(index));
3673
+ return jsx(Fragment$1, {});
3674
+ }
3675
+ else {
3676
+ if (lastHeader) {
3677
+ showHeader = lastHeader;
3678
+ lastHeader = null;
3679
+ }
3680
+ }
3681
+ return ((!filteredValues || filteredValues.includes(item)) && (jsxs(Fragment, { children: [showHeader, jsxs("div", { children: [jsxs(MenuItem, __assign({ disabled: !!item.disabled, title: item.disabled && typeof item.disabled !== "boolean" ? item.disabled : "", value: item.value, onFocus: function () {
3682
+ if (selectedItem !== item) {
3683
+ setSelectedItem(item);
3684
+ setSubSelectedValue(null);
3685
+ subComponentIsValid.current = true;
3686
+ if (item.subComponent) {
3687
+ subComponentInitialValue.current = null;
3688
+ }
3689
+ }
3690
+ }, onClick: function (e) {
3691
+ e.keepOpen = !!item.subComponent;
3692
+ } }, { children: [(_a = item.label) !== null && _a !== void 0 ? _a : (item.value == null ? "<".concat(item.value, ">") : "".concat(item.value)), item.subComponent ? "..." : ""] }), "".concat(fieldToString(field), "-").concat(index)), item.subComponent && selectedItem === item && (jsx(FocusableItem, __assign({ className: "LuiDeprecatedForms" }, { children: function () { return (jsx(GridSubComponentContext.Provider, __assign({ value: {
3693
+ context: { options: options },
3694
+ data: data,
3695
+ value: subSelectedValue,
3696
+ setValue: function (value) {
3697
+ setSubSelectedValue(value);
3698
+ if (subComponentInitialValue.current === null) {
3699
+ // copy the default value of the subcomponent, so we can change detect on save
3700
+ subComponentInitialValue.current = JSON.stringify(value);
3701
+ }
3702
+ },
3703
+ setValid: function (valid) {
3704
+ subComponentIsValid.current = valid;
3705
+ },
3706
+ triggerSave: function () { return __awaiter(void 0, void 0, void 0, function () {
3707
+ return __generator(this, function (_a) {
3708
+ return [2 /*return*/];
3709
+ });
3710
+ }); }
3711
+ } }, { children: item.subComponent && (jsx("div", __assign({ className: "subComponent" }, { children: jsx(item.subComponent, {}) }))) }))); } }), "".concat(item.label, "_subcomponent")))] }, "menu-wrapper-".concat(index))] }, "".concat(index))));
3712
+ })] }) }))] }));
3693
3713
  };
3694
3714
 
3695
3715
  var GridFormMultiSelect = function (props) {
@@ -3788,10 +3808,11 @@ var GridFormMultiSelect = function (props) {
3788
3808
  invalid: invalid,
3789
3809
  save: save
3790
3810
  }), popoverWrapper = _f.popoverWrapper, triggerSave = _f.triggerSave;
3791
- return popoverWrapper(jsx(ComponentLoadingWrapper, __assign({ loading: !options, className: "GridFormMultiSelect-container" }, { children: options && (jsxs(Fragment$1, { children: [props.filtered && (jsx(FilterInput, __assign({}, { headerGroups: headerGroups, options: options, setOptions: setOptions, filter: filter, setFilter: setFilter, triggerSave: triggerSave }, { filterHelpText: props.filterHelpText, onSelectFilter: props.onSelectFilter, filterPlaceholder: props.filterPlaceholder }))), headerGroups && (isEmpty(headerGroups) || !toPairs(headerGroups).some(function (_a) {
3792
- _a[0]; var options = _a[1];
3793
- return !isEmpty(options);
3794
- })) && (jsx(MenuItem, __assign({ className: "GridMultiSelect-noOptions", disabled: true }, { children: (_a = props.noOptionsMessage) !== null && _a !== void 0 ? _a : "No Options" }), "noOptions")), headerGroups && !isEmpty(headerGroups) && (jsx("div", __assign({ className: "GridFormMultiSelect-options" }, { children: headers.map(function (header, index) {
3811
+ return popoverWrapper(jsx(ComponentLoadingWrapper, __assign({ loading: !options, className: "GridFormMultiSelect-container" }, { children: options && (jsxs(Fragment$1, { children: [props.filtered && (jsx(FilterInput, __assign({}, { headerGroups: headerGroups, options: options, setOptions: setOptions, filter: filter, setFilter: setFilter, triggerSave: triggerSave }, { filterHelpText: props.filterHelpText, onSelectFilter: props.onSelectFilter, filterPlaceholder: props.filterPlaceholder }))), headerGroups &&
3812
+ (isEmpty(headerGroups) || !toPairs(headerGroups).some(function (_a) {
3813
+ _a[0]; var options = _a[1];
3814
+ return !isEmpty(options);
3815
+ })) && (jsx(MenuItem, __assign({ className: "GridMultiSelect-noOptions", disabled: true }, { children: (_a = props.noOptionsMessage) !== null && _a !== void 0 ? _a : "No Options" }), "noOptions")), headerGroups && !isEmpty(headerGroups) && (jsx("div", __assign({ className: "GridFormMultiSelect-options" }, { children: headers.map(function (header, index) {
3795
3816
  var subOptions = headerGroups["".concat(header.filter)];
3796
3817
  return (!isEmpty(subOptions) && (jsxs(Fragment, { children: [header.header && jsx(MenuHeader, { children: header.header }), subOptions.map(function (item, index) {
3797
3818
  return item.value === MenuSeparatorString ? (jsx(MenuDivider, {}, "div_".concat(index))) : (jsxs(Fragment, { children: [jsx(MenuRadioItem, { item: item, options: options, setOptions: setOptions }), item.checked && item.subComponent && (jsx(MenuSubComponent, __assign({}, { item: item, options: options, setOptions: setOptions, data: data, triggerSave: triggerSave }, { subComponentIsValid: subComponentIsValidRef.current })))] }, "val_".concat(item.value)));
@@ -3899,21 +3920,19 @@ var MenuRadioItem = function (props) {
3899
3920
  };
3900
3921
  var MenuSubComponent = function (props) {
3901
3922
  var data = props.data, item = props.item, options = props.options, setOptions = props.setOptions, subComponentIsValid = props.subComponentIsValid, triggerSave = props.triggerSave;
3902
- return (jsx(FocusableItem, __assign({ className: "LuiDeprecatedForms" }, { children: function (_) {
3903
- return item.subComponent && (jsx(GridSubComponentContext.Provider, __assign({ value: {
3904
- context: { options: options },
3905
- data: data,
3906
- value: item.subValue,
3907
- setValue: function (value) {
3908
- item.subValue = value;
3909
- setOptions(__spreadArray([], options, true));
3910
- },
3911
- setValid: function (valid) {
3912
- subComponentIsValid["".concat(item.value)] = valid;
3913
- },
3914
- triggerSave: triggerSave
3915
- } }, { children: jsx("div", __assign({ className: "subComponent" }, { children: jsx(item.subComponent, {}) })) })));
3916
- } }), "".concat(item.value, "_subcomponent")));
3923
+ return (jsx(FocusableItem, __assign({ className: "LuiDeprecatedForms" }, { children: function () { return (jsx(GridSubComponentContext.Provider, __assign({ value: {
3924
+ context: { options: options },
3925
+ data: data,
3926
+ value: item.subValue,
3927
+ setValue: function (value) {
3928
+ item.subValue = value;
3929
+ setOptions(__spreadArray([], options, true));
3930
+ },
3931
+ setValid: function (valid) {
3932
+ subComponentIsValid["".concat(item.value)] = valid;
3933
+ },
3934
+ triggerSave: triggerSave
3935
+ } }, { children: jsx("div", __assign({ className: "subComponent" }, { children: item.subComponent && jsx(item.subComponent, {}) })) }))); } }), "".concat(item.value, "_subcomponent")));
3917
3936
  };
3918
3937
 
3919
3938
  var GridPopoutEditMultiSelect = function (colDef, props) {
@@ -4047,20 +4066,18 @@ var GridFormPopoverMenu = function (props) {
4047
4066
  save: save
4048
4067
  }), popoverWrapper = _e.popoverWrapper, triggerSave = _e.triggerSave;
4049
4068
  return popoverWrapper(jsx(ComponentLoadingWrapper, __assign({ loading: !options, className: "GridFormPopupMenu" }, { children: jsx(Fragment$1, { children: (options === null || options === void 0 ? void 0 : options.length) === 0 ? (jsx(MenuItem, __assign({ className: "GridPopoverMenu-noOptions", disabled: true }, { children: "No actions" }), "GridPopoverMenu-empty")) : (options === null || options === void 0 ? void 0 : options.map(function (item, index) {
4050
- return item.label === "__isMenuSeparator__" ? (jsx(MenuDivider, {}, "$$divider_".concat(index))) : (!item.hidden && (jsxs(Fragment, { children: [jsx(MenuItem, __assign({ onClick: function (e) { return onMenuItemClick(e, item); }, disabled: !!item.disabled, title: item.disabled && typeof item.disabled !== "boolean" ? item.disabled : "" }, { children: item.label }), "".concat(item.label)), item.subComponent && subComponentSelected === item && (jsx(FocusableItem, __assign({ className: "LuiDeprecatedForms" }, { children: function (_) {
4051
- return item.subComponent && (jsx(GridSubComponentContext.Provider, __assign({ value: {
4052
- context: {},
4053
- data: data,
4054
- value: subSelectedValue,
4055
- setValue: function (value) {
4056
- setSubSelectedValue(value);
4057
- },
4058
- setValid: function (valid) {
4059
- subComponentIsValid.current = valid;
4060
- },
4061
- triggerSave: triggerSave
4062
- } }, { children: jsx("div", __assign({ className: "subComponent" }, { children: jsx(item.subComponent, {}) })) })));
4063
- } }), "".concat(item.label, "_subcomponent")))] }, "".concat(item.label))));
4069
+ return item.label === "__isMenuSeparator__" ? (jsx(MenuDivider, {}, "$$divider_".concat(index))) : (!item.hidden && (jsxs(Fragment, { children: [jsx(MenuItem, __assign({ onClick: function (e) { return onMenuItemClick(e, item); }, disabled: !!item.disabled, title: item.disabled && typeof item.disabled !== "boolean" ? item.disabled : "" }, { children: item.label }), "".concat(item.label)), item.subComponent && subComponentSelected === item && (jsx(FocusableItem, __assign({ className: "LuiDeprecatedForms" }, { children: function () { return (jsx(GridSubComponentContext.Provider, __assign({ value: {
4070
+ context: {},
4071
+ data: data,
4072
+ value: subSelectedValue,
4073
+ setValue: function (value) {
4074
+ setSubSelectedValue(value);
4075
+ },
4076
+ setValid: function (valid) {
4077
+ subComponentIsValid.current = valid;
4078
+ },
4079
+ triggerSave: triggerSave
4080
+ } }, { children: jsx("div", __assign({ className: "subComponent" }, { children: item.subComponent && jsx(item.subComponent, {}) })) }))); } }), "".concat(item.label, "_subcomponent")))] }, "".concat(item.label))));
4064
4081
  })) }) })));
4065
4082
  };
4066
4083
 
@@ -4174,10 +4191,10 @@ var css_248z$1 = ".LuiTextInput{margin-bottom:0}.LuiTextInput-formatted{color:#b
4174
4191
  styleInject(css_248z$1);
4175
4192
 
4176
4193
  var TextInputFormatted = function (props) {
4177
- return (jsxs("div", __assign({ className: clsx("LuiTextInput Grid-popoverContainer", props.error && "hasError", props.className) }, { children: [jsxs("span", __assign({ className: "LuiTextInput-inputWrapper" }, { children: [jsx("input", __assign({ type: "text", spellCheck: true, defaultValue: props.value }, omit(props, ["error", "value", "helpText", "formatted", "className"]), { className: "LuiTextInput-input", onMouseEnter: function (e) {
4194
+ return (jsxs("div", __assign({ className: clsx("LuiTextInput Grid-popoverContainer", props.error && "hasError", props.className) }, { children: [jsxs("span", __assign({ className: "LuiTextInput-inputWrapper" }, { children: [jsx("input", __assign({ type: "text", spellCheck: true, defaultValue: props.value }, omit(props, ["error", "value", "helpText", "formatted", "className", "allowTabToSave"]), { className: "LuiTextInput-input", onMouseEnter: function (e) {
4178
4195
  e.currentTarget.focus();
4179
4196
  props.onMouseEnter && props.onMouseEnter(e);
4180
- } })), jsx("span", __assign({ className: "LuiTextInput-formatted" }, { children: props.formatted }))] })), jsx(FormError, { error: props.error, helpText: props.helpText })] })));
4197
+ }, "data-allowtabtosave": props.allowTabToSave })), jsx("span", __assign({ className: "LuiTextInput-formatted" }, { children: props.formatted }))] })), jsx(FormError, { error: props.error, helpText: props.helpText })] })));
4181
4198
  };
4182
4199
 
4183
4200
  var GridFormEditBearing = function (props) {
@@ -4355,13 +4372,13 @@ var useGenerateOrDefaultId = function (idFromProps) {
4355
4372
  var TextAreaInput = function (props) {
4356
4373
  var _a;
4357
4374
  var id = useGenerateOrDefaultId(props === null || props === void 0 ? void 0 : props.id);
4358
- return (jsxs("div", __assign({ className: clsx("LuiTextAreaInput Grid-popoverContainer", props.disabled ? "isDisabled" : "", props.error ? "hasError" : "", props.className) }, { children: [jsxs("label", __assign({ htmlFor: id }, { children: [props.mandatory != null && jsx("span", __assign({ className: "LuiTextAreaInput-mandatory" }, { children: "*" })), props.label != null && jsx("span", __assign({ className: "LuiTextAreaInput-label" }, { children: props.label })), jsx("div", __assign({ className: "LuiTextAreaInput-wrapper" }, { children: jsx("textarea", __assign({ rows: 5 }, omit(props, ["error", "value", "helpText", "formatted", "className"]), { id: id, value: (_a = props.value) !== null && _a !== void 0 ? _a : "", spellCheck: true, onMouseEnter: function (e) {
4375
+ return (jsxs("div", __assign({ className: clsx("LuiTextAreaInput Grid-popoverContainer", props.disabled ? "isDisabled" : "", props.error ? "hasError" : "", props.className) }, { children: [jsxs("label", __assign({ htmlFor: id }, { children: [props.mandatory != null && jsx("span", __assign({ className: "LuiTextAreaInput-mandatory" }, { children: "*" })), props.label != null && jsx("span", __assign({ className: "LuiTextAreaInput-label" }, { children: props.label })), jsx("div", __assign({ className: "LuiTextAreaInput-wrapper" }, { children: jsx("textarea", __assign({ rows: 5 }, omit(props, ["error", "value", "helpText", "formatted", "className", "allowTabToSave"]), { id: id, value: (_a = props.value) !== null && _a !== void 0 ? _a : "", spellCheck: true, onMouseEnter: function (e) {
4359
4376
  if (document.activeElement != e.currentTarget) {
4360
4377
  e.currentTarget.focus();
4361
4378
  e.currentTarget.selectionStart = e.currentTarget.value.length;
4362
4379
  }
4363
4380
  props.onMouseEnter && props.onMouseEnter(e);
4364
- } }, { children: props.value })) }))] })), jsx(FormError, { error: props.error, helpText: props.helpText })] })));
4381
+ }, "data-allowtabtosave": props.allowTabToSave }, { children: props.value })) }))] })), jsx(FormError, { error: props.error, helpText: props.helpText })] })));
4365
4382
  };
4366
4383
 
4367
4384
  var TextInputValidator = function (props, value, data, context) {
@@ -4418,10 +4435,10 @@ var TextInputValidator = function (props, value, data, context) {
4418
4435
  };
4419
4436
 
4420
4437
  var GridFormTextArea = function (props) {
4421
- var _a, _b;
4422
- var _c = useGridPopoverContext(), field = _c.field, initialVale = _c.value, data = _c.data;
4438
+ var _a, _b, _c;
4439
+ var _d = useGridPopoverContext(), field = _d.field, initialVale = _d.value, data = _d.data;
4423
4440
  var initValue = useMemo(function () { return (initialVale == null ? "" : "".concat(initialVale)); }, [initialVale]);
4424
- var _d = useState(initValue), value = _d[0], setValue = _d[1];
4441
+ var _e = useState(initValue), value = _e[0], setValue = _e[1];
4425
4442
  var helpText = (_a = props.helpText) !== null && _a !== void 0 ? _a : "Press tab to save";
4426
4443
  var invalid = useCallback(function () { return TextInputValidator(props, value, data, {}); }, [props, value, data]);
4427
4444
  var save = useCallback(function (selectedRows) { return __awaiter(void 0, void 0, void 0, function () {
@@ -4449,17 +4466,17 @@ var GridFormTextArea = function (props) {
4449
4466
  invalid: invalid,
4450
4467
  save: save
4451
4468
  }).popoverWrapper;
4452
- return popoverWrapper(jsx("div", __assign({ className: "subComponent", style: { display: "flex", flexDirection: "row", width: (_b = props.width) !== null && _b !== void 0 ? _b : 240 } }, { children: jsx(TextAreaInput, { value: value, onChange: function (e) { return setValue(e.target.value); }, error: invalid(), placeholder: props.placeholder, helpText: helpText }) })));
4469
+ return popoverWrapper(jsx("div", __assign({ className: "subComponent", style: { display: "flex", flexDirection: "row", width: (_b = props.width) !== null && _b !== void 0 ? _b : 240 } }, { children: jsx(TextAreaInput, { value: value, onChange: function (e) { return setValue(e.target.value); }, error: invalid(), placeholder: (_c = props.placeholder) !== null && _c !== void 0 ? _c : "Type here", helpText: helpText }) })));
4453
4470
  };
4454
4471
 
4455
4472
  var GridPopoverTextArea = function (colDef, params) { return GridCell(colDef, __assign({ editor: GridFormTextArea }, params)); };
4456
4473
 
4457
4474
  var GridFormTextInput = function (props) {
4458
- var _a, _b;
4459
- var _c = useGridPopoverContext(), field = _c.field, initialVale = _c.value, data = _c.data;
4475
+ var _a, _b, _c;
4476
+ var _d = useGridPopoverContext(), field = _d.field, initialVale = _d.value, data = _d.data;
4460
4477
  var helpText = (_a = props.helpText) !== null && _a !== void 0 ? _a : "Press enter or tab to save";
4461
4478
  var initValue = useMemo(function () { return (initialVale == null ? "" : "".concat(initialVale)); }, [initialVale]);
4462
- var _d = useState(initValue), value = _d[0], setValue = _d[1];
4479
+ var _e = useState(initValue), value = _e[0], setValue = _e[1];
4463
4480
  var invalid = useCallback(function () { return TextInputValidator(props, value, data, {}); }, [data, props, value]);
4464
4481
  var save = useCallback(function (selectedRows) { return __awaiter(void 0, void 0, void 0, function () {
4465
4482
  var trimmedValue;
@@ -4486,7 +4503,7 @@ var GridFormTextInput = function (props) {
4486
4503
  invalid: invalid,
4487
4504
  save: save
4488
4505
  }).popoverWrapper;
4489
- return popoverWrapper(jsx("div", __assign({ style: { display: "flex", flexDirection: "row" }, className: "FormTest subComponent" }, { children: jsx(TextInputFormatted, { value: value, onChange: function (e) { return setValue(e.target.value); }, error: invalid(), formatted: props.units, style: { width: (_b = props.width) !== null && _b !== void 0 ? _b : 240 }, placeholder: props.placeholder, helpText: helpText }) })));
4506
+ return popoverWrapper(jsx("div", __assign({ style: { display: "flex", flexDirection: "row" }, className: "FormTest subComponent" }, { children: jsx(TextInputFormatted, { value: value, onChange: function (e) { return setValue(e.target.value); }, error: invalid(), formatted: props.units, style: { width: (_b = props.width) !== null && _b !== void 0 ? _b : 240 }, placeholder: (_c = props.placeholder) !== null && _c !== void 0 ? _c : "Type here", helpText: helpText }) })));
4490
4507
  };
4491
4508
 
4492
4509
  var GridPopoverTextInput = function (colDef, params) {
@@ -4506,7 +4523,7 @@ var GridFormSubComponentTextInput = function (props) {
4506
4523
  useEffect(function () {
4507
4524
  setValid(value != null && invalid() == null);
4508
4525
  }, [setValid, invalid, value]);
4509
- return (jsx(TextInputFormatted, { value: value, error: invalid(), onChange: function (e) { return setValue(e.target.value); }, helpText: helpText, autoFocus: true, placeholder: props.placeholder, style: { width: "100%" } }));
4526
+ return (jsx(TextInputFormatted, { value: value, error: invalid(), onChange: function (e) { return setValue(e.target.value); }, helpText: helpText, placeholder: props.placeholder, style: { width: "100%" }, allowTabToSave: true }));
4510
4527
  };
4511
4528
 
4512
4529
  var GridFormSubComponentTextArea = function (props) {
@@ -4522,7 +4539,7 @@ var GridFormSubComponentTextArea = function (props) {
4522
4539
  useEffect(function () {
4523
4540
  setValid(value != null && invalid() == null);
4524
4541
  }, [setValid, invalid, value]);
4525
- return (jsx("div", __assign({ className: clsx("FreeTextInput", props.className) }, { children: jsx(TextAreaInput, { className: "free-text-input", value: value, onChange: function (e) { return setValue(e.target.value); }, error: invalid(), helpText: helpText, autoFocus: true, placeholder: props.placeholder }) })));
4542
+ return (jsx("div", __assign({ className: clsx("FreeTextInput", props.className) }, { children: jsx(TextAreaInput, { className: "free-text-input", value: value, onChange: function (e) { return setValue(e.target.value); }, error: invalid(), helpText: helpText, placeholder: props.placeholder, allowTabToSave: true }) })));
4526
4543
  };
4527
4544
 
4528
4545
  var css_248z = ".ActionButton{align-items:center;display:flex}.ActionButton-minimal.lui-button-lg.lui-button-icon-right{padding-right:38px}.ActionButton.lui-button-lg.lui-button-icon-right:not(.ActionButton-tight) .LuiIcon{margin:0 4px}.ActionButton.ActionButton-tight.lui-button-lg.lui-button-icon-right .LuiIcon{margin:0}.ActionButton-iconOnly.lui-button-lg.lui-button-icon-right:not(.ActionButton-tight){padding:8px 5px}.ActionButton-iconOnly.lui-button-lg.lui-button-icon-right.ActionButton-tight{padding:0}.ActionButton-minimalArea{position:relative}.ActionButton-minimalAreaDisplay{position:absolute}.ActionButton-minimalAreaExpand{visibility:hidden}.ActionButton-inProgress.lui-button-lg.lui-button-icon-right{background-color:#e2f3f7;color:#007198;cursor:progress}.ActionButton-inProgress.lui-button-lg.lui-button-icon-right svg *{fill:#0000}.ActionButton-fill{justify-content:center;width:100%}";
@@ -4713,9 +4730,17 @@ function _asyncToGenerator(fn) {
4713
4730
  };
4714
4731
  }
4715
4732
 
4716
- var regeneratorRuntime$1 = {exports: {}};
4733
+ var regeneratorRuntimeExports = {};
4734
+ var regeneratorRuntime$1 = {
4735
+ get exports(){ return regeneratorRuntimeExports; },
4736
+ set exports(v){ regeneratorRuntimeExports = v; },
4737
+ };
4717
4738
 
4718
- var _typeof$1 = {exports: {}};
4739
+ var _typeofExports = {};
4740
+ var _typeof$1 = {
4741
+ get exports(){ return _typeofExports; },
4742
+ set exports(v){ _typeofExports = v; },
4743
+ };
4719
4744
 
4720
4745
  (function (module) {
4721
4746
  function _typeof(obj) {
@@ -4731,7 +4756,7 @@ var _typeof$1 = {exports: {}};
4731
4756
  } (_typeof$1));
4732
4757
 
4733
4758
  (function (module) {
4734
- var _typeof = _typeof$1.exports["default"];
4759
+ var _typeof = _typeofExports["default"];
4735
4760
  function _regeneratorRuntime() {
4736
4761
  module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
4737
4762
  return exports;
@@ -4867,14 +4892,9 @@ var _typeof$1 = {exports: {}};
4867
4892
  };
4868
4893
  }
4869
4894
  function maybeInvokeDelegate(delegate, context) {
4870
- var method = delegate.iterator[context.method];
4871
- if (undefined === method) {
4872
- if (context.delegate = null, "throw" === context.method) {
4873
- if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
4874
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
4875
- }
4876
- return ContinueSentinel;
4877
- }
4895
+ var methodName = context.method,
4896
+ method = delegate.iterator[methodName];
4897
+ if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
4878
4898
  var record = tryCatch(method, delegate.iterator, context.arg);
4879
4899
  if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
4880
4900
  var info = record.arg;
@@ -4903,9 +4923,7 @@ var _typeof$1 = {exports: {}};
4903
4923
  if (!isNaN(iterable.length)) {
4904
4924
  var i = -1,
4905
4925
  next = function next() {
4906
- for (; ++i < iterable.length;) {
4907
- if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
4908
- }
4926
+ for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
4909
4927
  return next.value = undefined, next.done = !0, next;
4910
4928
  };
4911
4929
  return next.next = next;
@@ -4951,9 +4969,7 @@ var _typeof$1 = {exports: {}};
4951
4969
  }), exports.keys = function (val) {
4952
4970
  var object = Object(val),
4953
4971
  keys = [];
4954
- for (var key in object) {
4955
- keys.push(key);
4956
- }
4972
+ for (var key in object) keys.push(key);
4957
4973
  return keys.reverse(), function next() {
4958
4974
  for (; keys.length;) {
4959
4975
  var key = keys.pop();
@@ -4964,9 +4980,7 @@ var _typeof$1 = {exports: {}};
4964
4980
  }, exports.values = values, Context.prototype = {
4965
4981
  constructor: Context,
4966
4982
  reset: function reset(skipTempReset) {
4967
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) {
4968
- "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
4969
- }
4983
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
4970
4984
  },
4971
4985
  stop: function stop() {
4972
4986
  this.done = !0;
@@ -5049,7 +5063,7 @@ var _typeof$1 = {exports: {}};
5049
5063
 
5050
5064
  // TODO(Babel 8): Remove this file.
5051
5065
 
5052
- var runtime = regeneratorRuntime$1.exports();
5066
+ var runtime = regeneratorRuntimeExports();
5053
5067
  var regenerator = runtime;
5054
5068
 
5055
5069
  // Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
@@ -5065,7 +5079,11 @@ try {
5065
5079
 
5066
5080
  var build$1 = {};
5067
5081
 
5068
- var ansiStyles = {exports: {}};
5082
+ var ansiStylesExports = {};
5083
+ var ansiStyles = {
5084
+ get exports(){ return ansiStylesExports; },
5085
+ set exports(v){ ansiStylesExports = v; },
5086
+ };
5069
5087
 
5070
5088
  (function (module) {
5071
5089
 
@@ -5557,7 +5575,7 @@ ConvertAnsi.test = ConvertAnsi.serialize = ConvertAnsi.default = void 0;
5557
5575
 
5558
5576
  var _ansiRegex = _interopRequireDefault$d(ansiRegex);
5559
5577
 
5560
- var _ansiStyles$1 = _interopRequireDefault$d(ansiStyles.exports);
5578
+ var _ansiStyles$1 = _interopRequireDefault$d(ansiStylesExports);
5561
5579
 
5562
5580
  function _interopRequireDefault$d(obj) {
5563
5581
  return obj && obj.__esModule ? obj : {default: obj};
@@ -6276,7 +6294,11 @@ Immutable.default = _default$2l;
6276
6294
 
6277
6295
  var ReactElement = {};
6278
6296
 
6279
- var reactIs = {exports: {}};
6297
+ var reactIsExports = {};
6298
+ var reactIs = {
6299
+ get exports(){ return reactIsExports; },
6300
+ set exports(v){ reactIsExports = v; },
6301
+ };
6280
6302
 
6281
6303
  var reactIs_production_min = {};
6282
6304
 
@@ -6548,7 +6570,7 @@ Object.defineProperty(ReactElement, '__esModule', {
6548
6570
  });
6549
6571
  ReactElement.test = ReactElement.serialize = ReactElement.default = void 0;
6550
6572
 
6551
- var ReactIs = _interopRequireWildcard$2(reactIs.exports);
6573
+ var ReactIs = _interopRequireWildcard$2(reactIsExports);
6552
6574
 
6553
6575
  var _markup$1 = markup;
6554
6576
 
@@ -6795,7 +6817,7 @@ var default_1 = build$1.default = DEFAULT_OPTIONS_1 = build$1.DEFAULT_OPTIONS =
6795
6817
  var format_1 = build$1.format = format;
6796
6818
  var plugins_1 = build$1.plugins = void 0;
6797
6819
 
6798
- var _ansiStyles = _interopRequireDefault$b(ansiStyles.exports);
6820
+ var _ansiStyles = _interopRequireDefault$b(ansiStylesExports);
6799
6821
 
6800
6822
  var _collections = collections;
6801
6823
 
@@ -7387,9 +7409,9 @@ default_1 = build$1.default = _default$2i;
7387
7409
  var index = /*#__PURE__*/_mergeNamespaces({
7388
7410
  __proto__: null,
7389
7411
  get DEFAULT_OPTIONS () { return DEFAULT_OPTIONS_1; },
7412
+ get default () { return default_1; },
7390
7413
  format: format_1,
7391
- get plugins () { return plugins_1; },
7392
- get default () { return default_1; }
7414
+ get plugins () { return plugins_1; }
7393
7415
  }, [build$1]);
7394
7416
 
7395
7417
  /**
@@ -14768,7 +14790,11 @@ var getIntrinsic = function GetIntrinsic(name, allowMissing) {
14768
14790
  return value;
14769
14791
  };
14770
14792
 
14771
- var callBind$4 = {exports: {}};
14793
+ var callBindExports = {};
14794
+ var callBind$4 = {
14795
+ get exports(){ return callBindExports; },
14796
+ set exports(v){ callBindExports = v; },
14797
+ };
14772
14798
 
14773
14799
  (function (module) {
14774
14800
 
@@ -14821,7 +14847,7 @@ var callBind$4 = {exports: {}};
14821
14847
 
14822
14848
  var GetIntrinsic$5 = getIntrinsic;
14823
14849
 
14824
- var callBind$3 = callBind$4.exports;
14850
+ var callBind$3 = callBindExports;
14825
14851
 
14826
14852
  var $indexOf = callBind$3(GetIntrinsic$5('String.prototype.indexOf'));
14827
14853
 
@@ -14980,7 +15006,7 @@ var shim$5 = function shimObjectIs() {
14980
15006
  };
14981
15007
 
14982
15008
  var define$2 = defineProperties_1;
14983
- var callBind$2 = callBind$4.exports;
15009
+ var callBind$2 = callBindExports;
14984
15010
 
14985
15011
  var implementation$6 = implementation$8;
14986
15012
  var getPolyfill$4 = polyfill$4;
@@ -15053,7 +15079,11 @@ var isRegex$1 = hasToStringTag$6
15053
15079
  return $toString$2(value) === regexClass;
15054
15080
  };
15055
15081
 
15056
- var implementation$5 = {exports: {}};
15082
+ var implementationExports = {};
15083
+ var implementation$5 = {
15084
+ get exports(){ return implementationExports; },
15085
+ set exports(v){ implementationExports = v; },
15086
+ };
15057
15087
 
15058
15088
  var functionsHaveNames = function functionsHaveNames() {
15059
15089
  return typeof function f() {}.name === 'string';
@@ -15126,7 +15156,7 @@ var functionsHaveNames_1 = functionsHaveNames;
15126
15156
  }
15127
15157
  } (implementation$5));
15128
15158
 
15129
- var implementation$4 = implementation$5.exports;
15159
+ var implementation$4 = implementationExports;
15130
15160
 
15131
15161
  var supportsDescriptors$1 = defineProperties_1.supportsDescriptors;
15132
15162
  var $gOPD$1 = Object.getOwnPropertyDescriptor;
@@ -15187,9 +15217,9 @@ var shim$3 = function shimFlags() {
15187
15217
  };
15188
15218
 
15189
15219
  var define$1 = defineProperties_1;
15190
- var callBind$1 = callBind$4.exports;
15220
+ var callBind$1 = callBindExports;
15191
15221
 
15192
- var implementation$3 = implementation$5.exports;
15222
+ var implementation$3 = implementationExports;
15193
15223
  var getPolyfill$2 = polyfill$2;
15194
15224
  var shim$2 = shim$3;
15195
15225
 
@@ -15301,7 +15331,11 @@ var isBooleanObject = function isBoolean(value) {
15301
15331
  return hasToStringTag$2 && Symbol.toStringTag in value ? tryBooleanObject(value) : $toString$1(value) === boolClass;
15302
15332
  };
15303
15333
 
15304
- var isSymbol$2 = {exports: {}};
15334
+ var isSymbolExports = {};
15335
+ var isSymbol$2 = {
15336
+ get exports(){ return isSymbolExports; },
15337
+ set exports(v){ isSymbolExports = v; },
15338
+ };
15305
15339
 
15306
15340
  var toStr$3 = Object.prototype.toString;
15307
15341
  var hasSymbols$1 = hasSymbols$4();
@@ -15337,7 +15371,11 @@ if (hasSymbols$1) {
15337
15371
  };
15338
15372
  }
15339
15373
 
15340
- var isBigint = {exports: {}};
15374
+ var isBigintExports = {};
15375
+ var isBigint = {
15376
+ get exports(){ return isBigintExports; },
15377
+ set exports(v){ isBigintExports = v; },
15378
+ };
15341
15379
 
15342
15380
  var $BigInt = typeof BigInt !== 'undefined' && BigInt;
15343
15381
 
@@ -15388,8 +15426,8 @@ if (hasBigInts) {
15388
15426
  var isString$1 = isString$2;
15389
15427
  var isNumber$1 = isNumberObject;
15390
15428
  var isBoolean$1 = isBooleanObject;
15391
- var isSymbol$1 = isSymbol$2.exports;
15392
- var isBigInt$1 = isBigint.exports;
15429
+ var isSymbol$1 = isSymbolExports;
15430
+ var isBigInt$1 = isBigintExports;
15393
15431
 
15394
15432
  // eslint-disable-next-line consistent-return
15395
15433
  var whichBoxedPrimitive$1 = function whichBoxedPrimitive(value) {
@@ -15537,7 +15575,11 @@ var isWeakmap = exported || function isWeakMap(x) {
15537
15575
  return false;
15538
15576
  };
15539
15577
 
15540
- var isWeakset = {exports: {}};
15578
+ var isWeaksetExports = {};
15579
+ var isWeakset = {
15580
+ get exports(){ return isWeaksetExports; },
15581
+ set exports(v){ isWeaksetExports = v; },
15582
+ };
15541
15583
 
15542
15584
  var GetIntrinsic$3 = getIntrinsic;
15543
15585
  var callBound$4 = callBound$8;
@@ -15577,7 +15619,7 @@ if ($setHas$1) {
15577
15619
  var isMap$1 = isMap$2;
15578
15620
  var isSet$1 = isSet$2;
15579
15621
  var isWeakMap$1 = isWeakmap;
15580
- var isWeakSet$1 = isWeakset.exports;
15622
+ var isWeakSet$1 = isWeaksetExports;
15581
15623
 
15582
15624
  var whichCollection$1 = function whichCollection(value) {
15583
15625
  if (value && typeof value === 'object') {
@@ -16683,7 +16725,7 @@ var shim$1 = function shimAssign() {
16683
16725
  };
16684
16726
 
16685
16727
  var defineProperties = defineProperties_1;
16686
- var callBind = callBind$4.exports;
16728
+ var callBind = callBindExports;
16687
16729
 
16688
16730
  var implementation = implementation$2;
16689
16731
  var getPolyfill = polyfill$1;
@@ -17307,7 +17349,11 @@ var elementRoles_1 = lib.elementRoles = elementRoles;
17307
17349
  var roleElements = _roleElementMap.default;
17308
17350
  var roleElements_1 = lib.roleElements = roleElements;
17309
17351
 
17310
- var lzString$1 = {exports: {}};
17352
+ var lzStringExports = {};
17353
+ var lzString$1 = {
17354
+ get exports(){ return lzStringExports; },
17355
+ set exports(v){ lzStringExports = v; },
17356
+ };
17311
17357
 
17312
17358
  (function (module) {
17313
17359
  // Copyright (c) 2013 Pieroxy <pieroxy@pieroxy.net>
@@ -17810,83 +17856,72 @@ var lzString$1 = {exports: {}};
17810
17856
  }
17811
17857
  } (lzString$1));
17812
17858
 
17813
- var lzString = lzString$1.exports;
17859
+ var lzString = lzStringExports;
17814
17860
 
17815
17861
  /**
17816
17862
  * Source: https://github.com/facebook/jest/blob/e7bb6a1e26ffab90611b2593912df15b69315611/packages/pretty-format/src/plugins/DOMElement.ts
17817
17863
  */
17818
-
17819
17864
  /* eslint-disable -- trying to stay as close to the original as possible */
17820
-
17821
17865
  /* istanbul ignore file */
17866
+
17822
17867
  function escapeHTML(str) {
17823
17868
  return str.replace(/</g, '&lt;').replace(/>/g, '&gt;');
17824
- } // Return empty string if keys is empty.
17825
-
17826
-
17869
+ }
17870
+ // Return empty string if keys is empty.
17827
17871
  const printProps = (keys, props, config, indentation, depth, refs, printer) => {
17828
17872
  const indentationNext = indentation + config.indent;
17829
17873
  const colors = config.colors;
17830
17874
  return keys.map(key => {
17831
17875
  const value = props[key];
17832
17876
  let printed = printer(value, config, indentationNext, depth, refs);
17833
-
17834
17877
  if (typeof value !== 'string') {
17835
17878
  if (printed.indexOf('\n') !== -1) {
17836
17879
  printed = config.spacingOuter + indentationNext + printed + config.spacingOuter + indentation;
17837
17880
  }
17838
-
17839
17881
  printed = '{' + printed + '}';
17840
17882
  }
17841
-
17842
17883
  return config.spacingInner + indentation + colors.prop.open + key + colors.prop.close + '=' + colors.value.open + printed + colors.value.close;
17843
17884
  }).join('');
17844
- }; // https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType#node_type_constants
17845
-
17885
+ };
17846
17886
 
17847
- const NodeTypeTextNode = 3; // Return empty string if children is empty.
17887
+ // https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType#node_type_constants
17888
+ const NodeTypeTextNode = 3;
17848
17889
 
17890
+ // Return empty string if children is empty.
17849
17891
  const printChildren = (children, config, indentation, depth, refs, printer) => children.map(child => {
17850
17892
  const printedChild = typeof child === 'string' ? printText(child, config) : printer(child, config, indentation, depth, refs);
17851
-
17852
17893
  if (printedChild === '' && typeof child === 'object' && child !== null && child.nodeType !== NodeTypeTextNode) {
17853
17894
  // A plugin serialized this Node to '' meaning we should ignore it.
17854
17895
  return '';
17855
17896
  }
17856
-
17857
17897
  return config.spacingOuter + indentation + printedChild;
17858
17898
  }).join('');
17859
-
17860
17899
  const printText = (text, config) => {
17861
17900
  const contentColor = config.colors.content;
17862
17901
  return contentColor.open + escapeHTML(text) + contentColor.close;
17863
17902
  };
17864
-
17865
17903
  const printComment = (comment, config) => {
17866
17904
  const commentColor = config.colors.comment;
17867
17905
  return commentColor.open + '<!--' + escapeHTML(comment) + '-->' + commentColor.close;
17868
- }; // Separate the functions to format props, children, and element,
17906
+ };
17907
+
17908
+ // Separate the functions to format props, children, and element,
17869
17909
  // so a plugin could override a particular function, if needed.
17870
17910
  // Too bad, so sad: the traditional (but unnecessary) space
17871
17911
  // in a self-closing tagColor requires a second test of printedProps.
17872
-
17873
-
17874
17912
  const printElement = (type, printedProps, printedChildren, config, indentation) => {
17875
17913
  const tagColor = config.colors.tag;
17876
17914
  return tagColor.open + '<' + type + (printedProps && tagColor.close + printedProps + config.spacingOuter + indentation + tagColor.open) + (printedChildren ? '>' + tagColor.close + printedChildren + config.spacingOuter + indentation + tagColor.open + '</' + type : (printedProps && !config.min ? '' : ' ') + '/') + '>' + tagColor.close;
17877
17915
  };
17878
-
17879
17916
  const printElementAsLeaf = (type, config) => {
17880
17917
  const tagColor = config.colors.tag;
17881
17918
  return tagColor.open + '<' + type + tagColor.close + ' …' + tagColor.open + ' />' + tagColor.close;
17882
17919
  };
17883
-
17884
17920
  const ELEMENT_NODE$1 = 1;
17885
17921
  const TEXT_NODE$1 = 3;
17886
17922
  const COMMENT_NODE$1 = 8;
17887
17923
  const FRAGMENT_NODE = 11;
17888
17924
  const ELEMENT_REGEXP = /^((HTML|SVG)\w*)?Element$/;
17889
-
17890
17925
  const testNode = val => {
17891
17926
  const constructorName = val.constructor.name;
17892
17927
  const {
@@ -17896,41 +17931,32 @@ const testNode = val => {
17896
17931
  const isCustomElement = typeof tagName === 'string' && tagName.includes('-') || typeof val.hasAttribute === 'function' && val.hasAttribute('is');
17897
17932
  return nodeType === ELEMENT_NODE$1 && (ELEMENT_REGEXP.test(constructorName) || isCustomElement) || nodeType === TEXT_NODE$1 && constructorName === 'Text' || nodeType === COMMENT_NODE$1 && constructorName === 'Comment' || nodeType === FRAGMENT_NODE && constructorName === 'DocumentFragment';
17898
17933
  };
17899
-
17900
17934
  function nodeIsText(node) {
17901
17935
  return node.nodeType === TEXT_NODE$1;
17902
17936
  }
17903
-
17904
17937
  function nodeIsComment(node) {
17905
17938
  return node.nodeType === COMMENT_NODE$1;
17906
17939
  }
17907
-
17908
17940
  function nodeIsFragment(node) {
17909
17941
  return node.nodeType === FRAGMENT_NODE;
17910
17942
  }
17911
-
17912
17943
  function createDOMElementFilter(filterNode) {
17913
17944
  return {
17914
17945
  test: val => {
17915
17946
  var _val$constructor2;
17916
-
17917
17947
  return (val == null ? void 0 : (_val$constructor2 = val.constructor) == null ? void 0 : _val$constructor2.name) && testNode(val);
17918
17948
  },
17919
17949
  serialize: (node, config, indentation, depth, refs, printer) => {
17920
17950
  if (nodeIsText(node)) {
17921
17951
  return printText(node.data, config);
17922
17952
  }
17923
-
17924
17953
  if (nodeIsComment(node)) {
17925
17954
  return printComment(node.data, config);
17926
17955
  }
17927
-
17928
17956
  const type = nodeIsFragment(node) ? "DocumentFragment" : node.tagName.toLowerCase();
17929
-
17930
17957
  if (++depth > config.maxDepth) {
17931
17958
  return printElementAsLeaf(type, config);
17932
17959
  }
17933
-
17934
17960
  return printElement(type, printProps(nodeIsFragment(node) ? [] : Array.from(node.attributes).map(attr => attr.name).sort(), nodeIsFragment(node) ? {} : Array.from(node.attributes).reduce((props, attribute) => {
17935
17961
  props[attribute.name] = attribute.value;
17936
17962
  return props;
@@ -17943,16 +17969,16 @@ function createDOMElementFilter(filterNode) {
17943
17969
  let chalk = null;
17944
17970
  let readFileSync = null;
17945
17971
  let codeFrameColumns = null;
17946
-
17947
17972
  try {
17948
17973
  const nodeRequire = module && module.require;
17949
17974
  readFileSync = nodeRequire.call(module, 'fs').readFileSync;
17950
17975
  codeFrameColumns = nodeRequire.call(module, '@babel/code-frame').codeFrameColumns;
17951
17976
  chalk = nodeRequire.call(module, 'chalk');
17952
- } catch {// We're in a browser environment
17953
- } // frame has the form "at myMethod (location/to/my/file.js:10:2)"
17954
-
17977
+ } catch {
17978
+ // We're in a browser environment
17979
+ }
17955
17980
 
17981
+ // frame has the form "at myMethod (location/to/my/file.js:10:2)"
17956
17982
  function getCodeFrame(frame) {
17957
17983
  const locationStart = frame.indexOf('(') + 1;
17958
17984
  const locationEnd = frame.indexOf(')');
@@ -17960,13 +17986,11 @@ function getCodeFrame(frame) {
17960
17986
  const frameLocationElements = frameLocation.split(':');
17961
17987
  const [filename, line, column] = [frameLocationElements[0], parseInt(frameLocationElements[1], 10), parseInt(frameLocationElements[2], 10)];
17962
17988
  let rawFileContents = '';
17963
-
17964
17989
  try {
17965
17990
  rawFileContents = readFileSync(filename, 'utf-8');
17966
17991
  } catch {
17967
17992
  return '';
17968
17993
  }
17969
-
17970
17994
  const codeFrame = codeFrameColumns(rawFileContents, {
17971
17995
  start: {
17972
17996
  line,
@@ -17978,15 +18002,12 @@ function getCodeFrame(frame) {
17978
18002
  });
17979
18003
  return chalk.dim(frameLocation) + "\n" + codeFrame + "\n";
17980
18004
  }
17981
-
17982
18005
  function getUserCodeFrame() {
17983
18006
  // If we couldn't load dependencies, we can't generate the user trace
17984
-
17985
18007
  /* istanbul ignore next */
17986
18008
  if (!readFileSync || !codeFrameColumns) {
17987
18009
  return '';
17988
18010
  }
17989
-
17990
18011
  const err = new Error();
17991
18012
  const firstClientCodeFrame = err.stack.split('\n').slice(1) // Remove first line which has the form "Error: TypeError"
17992
18013
  .find(frame => !frame.includes('node_modules/')); // Ignore frames from 3rd party libraries
@@ -17997,30 +18018,27 @@ function getUserCodeFrame() {
17997
18018
  // Constant node.nodeType for text nodes, see:
17998
18019
  // https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType#Node_type_constants
17999
18020
  const TEXT_NODE$2 = 3;
18000
-
18001
18021
  function jestFakeTimersAreEnabled$1() {
18002
18022
  /* istanbul ignore else */
18003
18023
  // eslint-disable-next-line
18004
18024
  if (typeof jest !== 'undefined' && jest !== null) {
18005
- return (// legacy timers
18006
- setTimeout._isMockFunction === true || // modern timers
18025
+ return (
18026
+ // legacy timers
18027
+ setTimeout._isMockFunction === true ||
18028
+ // modern timers
18007
18029
  Object.prototype.hasOwnProperty.call(setTimeout, 'clock')
18008
18030
  );
18009
- } // istanbul ignore next
18010
-
18011
-
18031
+ }
18032
+ // istanbul ignore next
18012
18033
  return false;
18013
18034
  }
18014
-
18015
18035
  function getDocument$1() {
18016
18036
  /* istanbul ignore if */
18017
18037
  if (typeof window === 'undefined') {
18018
18038
  throw new Error('Could not find default container');
18019
18039
  }
18020
-
18021
18040
  return window.document;
18022
18041
  }
18023
-
18024
18042
  function getWindowFromNode$1(node) {
18025
18043
  if (node.defaultView) {
18026
18044
  // node is document
@@ -18044,32 +18062,27 @@ function getWindowFromNode$1(node) {
18044
18062
  throw new Error("The given node is not an Element, the node type is: " + typeof node + ".");
18045
18063
  }
18046
18064
  }
18047
-
18048
18065
  function checkContainerType$1(container) {
18049
18066
  if (!container || !(typeof container.querySelector === 'function') || !(typeof container.querySelectorAll === 'function')) {
18050
18067
  throw new TypeError("Expected container to be an Element, a Document or a DocumentFragment but got " + getTypeName(container) + ".");
18051
18068
  }
18052
-
18053
18069
  function getTypeName(object) {
18054
18070
  if (typeof object === 'object') {
18055
18071
  return object === null ? 'null' : object.constructor.name;
18056
18072
  }
18057
-
18058
18073
  return typeof object;
18059
18074
  }
18060
18075
  }
18061
18076
 
18062
18077
  const shouldHighlight = () => {
18063
18078
  let colors;
18064
-
18065
18079
  try {
18066
18080
  var _process, _process$env;
18067
-
18068
18081
  colors = JSON.parse((_process = process) == null ? void 0 : (_process$env = _process.env) == null ? void 0 : _process$env.COLORS);
18069
- } catch (e) {// If this throws, process?.env?.COLORS wasn't parsable. Since we only
18082
+ } catch (e) {
18083
+ // If this throws, process?.env?.COLORS wasn't parsable. Since we only
18070
18084
  // care about `true` or `false`, we can safely ignore the error.
18071
18085
  }
18072
-
18073
18086
  if (typeof colors === 'boolean') {
18074
18087
  // If `colors` is set explicitly (both `true` and `false`), use that value.
18075
18088
  return colors;
@@ -18078,52 +18091,44 @@ const shouldHighlight = () => {
18078
18091
  return typeof process !== 'undefined' && process.versions !== undefined && process.versions.node !== undefined;
18079
18092
  }
18080
18093
  };
18081
-
18082
18094
  const {
18083
18095
  DOMCollection
18084
- } = plugins_1; // https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType#node_type_constants
18096
+ } = plugins_1;
18085
18097
 
18098
+ // https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType#node_type_constants
18086
18099
  const ELEMENT_NODE = 1;
18087
- const COMMENT_NODE = 8; // https://github.com/facebook/jest/blob/615084195ae1ae61ddd56162c62bbdda17587569/packages/pretty-format/src/plugins/DOMElement.ts#L50
18100
+ const COMMENT_NODE = 8;
18088
18101
 
18102
+ // https://github.com/facebook/jest/blob/615084195ae1ae61ddd56162c62bbdda17587569/packages/pretty-format/src/plugins/DOMElement.ts#L50
18089
18103
  function filterCommentsAndDefaultIgnoreTagsTags(value) {
18090
18104
  return value.nodeType !== COMMENT_NODE && (value.nodeType !== ELEMENT_NODE || !value.matches(getConfig().defaultIgnore));
18091
18105
  }
18092
-
18093
18106
  function prettyDOM(dom, maxLength, options) {
18094
18107
  if (options === void 0) {
18095
18108
  options = {};
18096
18109
  }
18097
-
18098
18110
  if (!dom) {
18099
18111
  dom = getDocument$1().body;
18100
18112
  }
18101
-
18102
18113
  if (typeof maxLength !== 'number') {
18103
18114
  maxLength = typeof process !== 'undefined' && process.env.DEBUG_PRINT_LIMIT || 7000;
18104
18115
  }
18105
-
18106
18116
  if (maxLength === 0) {
18107
18117
  return '';
18108
18118
  }
18109
-
18110
18119
  if (dom.documentElement) {
18111
18120
  dom = dom.documentElement;
18112
18121
  }
18113
-
18114
18122
  let domTypeName = typeof dom;
18115
-
18116
18123
  if (domTypeName === 'object') {
18117
18124
  domTypeName = dom.constructor.name;
18118
18125
  } else {
18119
18126
  // To don't fall with `in` operator
18120
18127
  dom = {};
18121
18128
  }
18122
-
18123
18129
  if (!('outerHTML' in dom)) {
18124
18130
  throw new TypeError("Expected an element or document but got " + domTypeName);
18125
18131
  }
18126
-
18127
18132
  const {
18128
18133
  filterNode = filterCommentsAndDefaultIgnoreTagsTags,
18129
18134
  ...prettyFormatOptions
@@ -18136,10 +18141,8 @@ function prettyDOM(dom, maxLength, options) {
18136
18141
  });
18137
18142
  return maxLength !== undefined && dom.outerHTML.length > maxLength ? debugContent.slice(0, maxLength) + "..." : debugContent;
18138
18143
  }
18139
-
18140
18144
  const logDOM = function () {
18141
18145
  const userCodeFrame = getUserCodeFrame();
18142
-
18143
18146
  if (userCodeFrame) {
18144
18147
  console.log(prettyDOM(...arguments) + "\n\n" + userCodeFrame);
18145
18148
  } else {
@@ -18171,7 +18174,6 @@ let config = {
18171
18174
  showOriginalStackTrace: false,
18172
18175
  // throw errors w/ suggestions for better queries. Opt in so off by default.
18173
18176
  throwSuggestions: false,
18174
-
18175
18177
  // called when getBy* queries fail. (message, container) => Error
18176
18178
  getElementError(message, container) {
18177
18179
  const prettifiedDOM = prettyDOM(container);
@@ -18179,7 +18181,6 @@ let config = {
18179
18181
  error.name = 'TestingLibraryElementError';
18180
18182
  return error;
18181
18183
  },
18182
-
18183
18184
  _disableExpensiveErrorDiagnostics: false,
18184
18185
  computedStyleSupportsPseudoElements: false
18185
18186
  };
@@ -18196,10 +18197,11 @@ function configure(newConfig) {
18196
18197
  // Pass the existing config out to the provided function
18197
18198
  // and accept a delta in return
18198
18199
  newConfig = newConfig(config);
18199
- } // Merge the incoming config delta
18200
-
18200
+ }
18201
18201
 
18202
- config = { ...config,
18202
+ // Merge the incoming config delta
18203
+ config = {
18204
+ ...config,
18203
18205
  ...newConfig
18204
18206
  };
18205
18207
  }
@@ -18208,46 +18210,37 @@ function getConfig() {
18208
18210
  }
18209
18211
 
18210
18212
  const labelledNodeNames = ['button', 'meter', 'output', 'progress', 'select', 'textarea', 'input'];
18211
-
18212
18213
  function getTextContent(node) {
18213
18214
  if (labelledNodeNames.includes(node.nodeName.toLowerCase())) {
18214
18215
  return '';
18215
18216
  }
18216
-
18217
18217
  if (node.nodeType === TEXT_NODE$2) return node.textContent;
18218
18218
  return Array.from(node.childNodes).map(childNode => getTextContent(childNode)).join('');
18219
18219
  }
18220
-
18221
18220
  function getLabelContent(element) {
18222
18221
  let textContent;
18223
-
18224
18222
  if (element.tagName.toLowerCase() === 'label') {
18225
18223
  textContent = getTextContent(element);
18226
18224
  } else {
18227
18225
  textContent = element.value || element.textContent;
18228
18226
  }
18229
-
18230
18227
  return textContent;
18231
- } // Based on https://github.com/eps1lon/dom-accessibility-api/pull/352
18232
-
18228
+ }
18233
18229
 
18230
+ // Based on https://github.com/eps1lon/dom-accessibility-api/pull/352
18234
18231
  function getRealLabels(element) {
18235
18232
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- types are not aware of older browsers that don't implement `labels`
18236
18233
  if (element.labels !== undefined) {
18237
18234
  var _labels;
18238
-
18239
18235
  return (_labels = element.labels) != null ? _labels : [];
18240
18236
  }
18241
-
18242
18237
  if (!isLabelable(element)) return [];
18243
18238
  const labels = element.ownerDocument.querySelectorAll('label');
18244
18239
  return Array.from(labels).filter(label => label.control === element);
18245
18240
  }
18246
-
18247
18241
  function isLabelable(element) {
18248
18242
  return /BUTTON|METER|OUTPUT|PROGRESS|SELECT|TEXTAREA/.test(element.tagName) || element.tagName === 'INPUT' && element.getAttribute('type') !== 'hidden';
18249
18243
  }
18250
-
18251
18244
  function getLabels(container, element, _temp) {
18252
18245
  let {
18253
18246
  selector = '*'
@@ -18280,15 +18273,12 @@ function assertNotNullOrUndefined(matcher) {
18280
18273
  "It looks like " + matcher + " was passed instead of a matcher. Did you do something like getByText(" + matcher + ")?");
18281
18274
  }
18282
18275
  }
18283
-
18284
18276
  function fuzzyMatches(textToMatch, node, matcher, normalizer) {
18285
18277
  if (typeof textToMatch !== 'string') {
18286
18278
  return false;
18287
18279
  }
18288
-
18289
18280
  assertNotNullOrUndefined(matcher);
18290
18281
  const normalizedText = normalizer(textToMatch);
18291
-
18292
18282
  if (typeof matcher === 'string' || typeof matcher === 'number') {
18293
18283
  return normalizedText.toLowerCase().includes(matcher.toString().toLowerCase());
18294
18284
  } else if (typeof matcher === 'function') {
@@ -18297,15 +18287,12 @@ function fuzzyMatches(textToMatch, node, matcher, normalizer) {
18297
18287
  return matchRegExp(matcher, normalizedText);
18298
18288
  }
18299
18289
  }
18300
-
18301
18290
  function matches(textToMatch, node, matcher, normalizer) {
18302
18291
  if (typeof textToMatch !== 'string') {
18303
18292
  return false;
18304
18293
  }
18305
-
18306
18294
  assertNotNullOrUndefined(matcher);
18307
18295
  const normalizedText = normalizer(textToMatch);
18308
-
18309
18296
  if (matcher instanceof Function) {
18310
18297
  return matcher(normalizedText, node);
18311
18298
  } else if (matcher instanceof RegExp) {
@@ -18314,7 +18301,6 @@ function matches(textToMatch, node, matcher, normalizer) {
18314
18301
  return normalizedText === String(matcher);
18315
18302
  }
18316
18303
  }
18317
-
18318
18304
  function getDefaultNormalizer(_temp) {
18319
18305
  let {
18320
18306
  trim = true,
@@ -18327,6 +18313,7 @@ function getDefaultNormalizer(_temp) {
18327
18313
  return normalizedText;
18328
18314
  };
18329
18315
  }
18316
+
18330
18317
  /**
18331
18318
  * Constructs a normalizer to pass to functions in matches.js
18332
18319
  * @param {boolean|undefined} trim The user-specified value for `trim`, without
@@ -18337,14 +18324,12 @@ function getDefaultNormalizer(_temp) {
18337
18324
  * @returns {Function} A normalizer
18338
18325
  */
18339
18326
 
18340
-
18341
18327
  function makeNormalizer(_ref) {
18342
18328
  let {
18343
18329
  trim,
18344
18330
  collapseWhitespace,
18345
18331
  normalizer
18346
18332
  } = _ref;
18347
-
18348
18333
  if (!normalizer) {
18349
18334
  // No custom normalizer specified. Just use default.
18350
18335
  return getDefaultNormalizer({
@@ -18352,23 +18337,18 @@ function makeNormalizer(_ref) {
18352
18337
  collapseWhitespace
18353
18338
  });
18354
18339
  }
18355
-
18356
18340
  if (typeof trim !== 'undefined' || typeof collapseWhitespace !== 'undefined') {
18357
18341
  // They've also specified a value for trim or collapseWhitespace
18358
18342
  throw new Error('trim and collapseWhitespace are not supported with a normalizer. ' + 'If you want to use the default trim and collapseWhitespace logic in your normalizer, ' + 'use "getDefaultNormalizer({trim, collapseWhitespace})" and compose that into your normalizer');
18359
18343
  }
18360
-
18361
18344
  return normalizer;
18362
18345
  }
18363
-
18364
18346
  function matchRegExp(matcher, text) {
18365
18347
  const match = matcher.test(text);
18366
-
18367
18348
  if (matcher.global && matcher.lastIndex !== 0) {
18368
18349
  console.warn("To match all elements we had to reset the lastIndex of the RegExp because the global flag is enabled. We encourage to remove the global flag from the RegExp.");
18369
18350
  matcher.lastIndex = 0;
18370
18351
  }
18371
-
18372
18352
  return match;
18373
18353
  }
18374
18354
 
@@ -18376,33 +18356,29 @@ function getNodeText(node) {
18376
18356
  if (node.matches('input[type=submit], input[type=button], input[type=reset]')) {
18377
18357
  return node.value;
18378
18358
  }
18379
-
18380
18359
  return Array.from(node.childNodes).filter(child => child.nodeType === TEXT_NODE$2 && Boolean(child.textContent)).map(c => c.textContent).join('');
18381
18360
  }
18382
18361
 
18383
18362
  const elementRoleList = buildElementRoleList(elementRoles_1);
18363
+
18384
18364
  /**
18385
18365
  * @param {Element} element -
18386
18366
  * @returns {boolean} - `true` if `element` and its subtree are inaccessible
18387
18367
  */
18388
-
18389
18368
  function isSubtreeInaccessible(element) {
18390
18369
  if (element.hidden === true) {
18391
18370
  return true;
18392
18371
  }
18393
-
18394
18372
  if (element.getAttribute('aria-hidden') === 'true') {
18395
18373
  return true;
18396
18374
  }
18397
-
18398
18375
  const window = element.ownerDocument.defaultView;
18399
-
18400
18376
  if (window.getComputedStyle(element).display === 'none') {
18401
18377
  return true;
18402
18378
  }
18403
-
18404
18379
  return false;
18405
18380
  }
18381
+
18406
18382
  /**
18407
18383
  * Partial implementation https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion
18408
18384
  * which should only be used for elements with a non-presentational role i.e.
@@ -18417,35 +18393,27 @@ function isSubtreeInaccessible(element) {
18417
18393
  * can be used to return cached results from previous isSubtreeInaccessible calls
18418
18394
  * @returns {boolean} true if excluded, otherwise false
18419
18395
  */
18420
-
18421
-
18422
18396
  function isInaccessible(element, options) {
18423
18397
  if (options === void 0) {
18424
18398
  options = {};
18425
18399
  }
18426
-
18427
18400
  const {
18428
18401
  isSubtreeInaccessible: isSubtreeInaccessibleImpl = isSubtreeInaccessible
18429
18402
  } = options;
18430
- const window = element.ownerDocument.defaultView; // since visibility is inherited we can exit early
18431
-
18403
+ const window = element.ownerDocument.defaultView;
18404
+ // since visibility is inherited we can exit early
18432
18405
  if (window.getComputedStyle(element).visibility === 'hidden') {
18433
18406
  return true;
18434
18407
  }
18435
-
18436
18408
  let currentElement = element;
18437
-
18438
18409
  while (currentElement) {
18439
18410
  if (isSubtreeInaccessibleImpl(currentElement)) {
18440
18411
  return true;
18441
18412
  }
18442
-
18443
18413
  currentElement = currentElement.parentElement;
18444
18414
  }
18445
-
18446
18415
  return false;
18447
18416
  }
18448
-
18449
18417
  function getImplicitAriaRoles(currentNode) {
18450
18418
  // eslint bug here:
18451
18419
  // eslint-disable-next-line no-unused-vars
@@ -18457,10 +18425,8 @@ function getImplicitAriaRoles(currentNode) {
18457
18425
  return [...roles];
18458
18426
  }
18459
18427
  }
18460
-
18461
18428
  return [];
18462
18429
  }
18463
-
18464
18430
  function buildElementRoleList(elementRolesMap) {
18465
18431
  function makeElementSelector(_ref) {
18466
18432
  let {
@@ -18474,7 +18440,6 @@ function buildElementRoleList(elementRolesMap) {
18474
18440
  constraints = []
18475
18441
  } = _ref2;
18476
18442
  const shouldNotExist = constraints.indexOf('undefined') !== -1;
18477
-
18478
18443
  if (shouldNotExist) {
18479
18444
  return ":not([" + attributeName + "])";
18480
18445
  } else if (value) {
@@ -18484,14 +18449,12 @@ function buildElementRoleList(elementRolesMap) {
18484
18449
  }
18485
18450
  }).join('');
18486
18451
  }
18487
-
18488
18452
  function getSelectorSpecificity(_ref3) {
18489
18453
  let {
18490
18454
  attributes = []
18491
18455
  } = _ref3;
18492
18456
  return attributes.length;
18493
18457
  }
18494
-
18495
18458
  function bySelectorSpecificity(_ref4, _ref5) {
18496
18459
  let {
18497
18460
  specificity: leftSpecificity
@@ -18501,34 +18464,32 @@ function buildElementRoleList(elementRolesMap) {
18501
18464
  } = _ref5;
18502
18465
  return rightSpecificity - leftSpecificity;
18503
18466
  }
18504
-
18505
18467
  function match(element) {
18506
18468
  let {
18507
18469
  attributes = []
18508
- } = element; // https://github.com/testing-library/dom-testing-library/issues/814
18470
+ } = element;
18509
18471
 
18472
+ // https://github.com/testing-library/dom-testing-library/issues/814
18510
18473
  const typeTextIndex = attributes.findIndex(attribute => attribute.value && attribute.name === 'type' && attribute.value === 'text');
18511
-
18512
18474
  if (typeTextIndex >= 0) {
18513
18475
  // not using splice to not mutate the attributes array
18514
18476
  attributes = [...attributes.slice(0, typeTextIndex), ...attributes.slice(typeTextIndex + 1)];
18515
18477
  }
18516
-
18517
- const selector = makeElementSelector({ ...element,
18478
+ const selector = makeElementSelector({
18479
+ ...element,
18518
18480
  attributes
18519
18481
  });
18520
18482
  return node => {
18521
18483
  if (typeTextIndex >= 0 && node.type !== 'text') {
18522
18484
  return false;
18523
18485
  }
18524
-
18525
18486
  return node.matches(selector);
18526
18487
  };
18527
18488
  }
18489
+ let result = [];
18528
18490
 
18529
- let result = []; // eslint bug here:
18491
+ // eslint bug here:
18530
18492
  // eslint-disable-next-line no-unused-vars
18531
-
18532
18493
  for (const [element, roles] of elementRolesMap.entries()) {
18533
18494
  result = [...result, {
18534
18495
  match: match(element),
@@ -18536,38 +18497,34 @@ function buildElementRoleList(elementRolesMap) {
18536
18497
  specificity: getSelectorSpecificity(element)
18537
18498
  }];
18538
18499
  }
18539
-
18540
18500
  return result.sort(bySelectorSpecificity);
18541
18501
  }
18542
-
18543
18502
  function getRoles(container, _temp) {
18544
18503
  let {
18545
18504
  hidden = false
18546
18505
  } = _temp === void 0 ? {} : _temp;
18547
-
18548
18506
  function flattenDOM(node) {
18549
18507
  return [node, ...Array.from(node.children).reduce((acc, child) => [...acc, ...flattenDOM(child)], [])];
18550
18508
  }
18551
-
18552
18509
  return flattenDOM(container).filter(element => {
18553
18510
  return hidden === false ? isInaccessible(element) === false : true;
18554
18511
  }).reduce((acc, node) => {
18555
- let roles = []; // TODO: This violates html-aria which does not allow any role on every element
18556
-
18512
+ let roles = [];
18513
+ // TODO: This violates html-aria which does not allow any role on every element
18557
18514
  if (node.hasAttribute('role')) {
18558
18515
  roles = node.getAttribute('role').split(' ').slice(0, 1);
18559
18516
  } else {
18560
18517
  roles = getImplicitAriaRoles(node);
18561
18518
  }
18562
-
18563
- return roles.reduce((rolesAcc, role) => Array.isArray(rolesAcc[role]) ? { ...rolesAcc,
18519
+ return roles.reduce((rolesAcc, role) => Array.isArray(rolesAcc[role]) ? {
18520
+ ...rolesAcc,
18564
18521
  [role]: [...rolesAcc[role], node]
18565
- } : { ...rolesAcc,
18522
+ } : {
18523
+ ...rolesAcc,
18566
18524
  [role]: [node]
18567
18525
  }, acc);
18568
18526
  }, {});
18569
18527
  }
18570
-
18571
18528
  function prettyRoles(dom, _ref6) {
18572
18529
  let {
18573
18530
  hidden,
@@ -18575,8 +18532,8 @@ function prettyRoles(dom, _ref6) {
18575
18532
  } = _ref6;
18576
18533
  const roles = getRoles(dom, {
18577
18534
  hidden
18578
- }); // We prefer to skip generic role, we don't recommend it
18579
-
18535
+ });
18536
+ // We prefer to skip generic role, we don't recommend it
18580
18537
  return Object.entries(roles).filter(_ref7 => {
18581
18538
  let [role] = _ref7;
18582
18539
  return role !== 'generic';
@@ -18588,20 +18545,17 @@ function prettyRoles(dom, _ref6) {
18588
18545
  computedStyleSupportsPseudoElements: getConfig().computedStyleSupportsPseudoElements
18589
18546
  }) + "\":\n";
18590
18547
  const domString = prettyDOM(el.cloneNode(false));
18591
-
18592
18548
  if (includeDescription) {
18593
18549
  const descriptionString = "Description \"" + computeAccessibleDescription(el, {
18594
18550
  computedStyleSupportsPseudoElements: getConfig().computedStyleSupportsPseudoElements
18595
18551
  }) + "\":\n";
18596
18552
  return "" + nameString + descriptionString + domString;
18597
18553
  }
18598
-
18599
18554
  return "" + nameString + domString;
18600
18555
  }).join('\n\n');
18601
18556
  return role + ":\n\n" + elementsString + "\n\n" + delimiterBar;
18602
18557
  }).join('\n');
18603
18558
  }
18604
-
18605
18559
  const logRoles = function (dom, _temp2) {
18606
18560
  let {
18607
18561
  hidden = false
@@ -18610,28 +18564,26 @@ const logRoles = function (dom, _temp2) {
18610
18564
  hidden
18611
18565
  }));
18612
18566
  };
18567
+
18613
18568
  /**
18614
18569
  * @param {Element} element -
18615
18570
  * @returns {boolean | undefined} - false/true if (not)selected, undefined if not selectable
18616
18571
  */
18617
-
18618
-
18619
18572
  function computeAriaSelected(element) {
18620
18573
  // implicit value from html-aam mappings: https://www.w3.org/TR/html-aam-1.0/#html-attribute-state-and-property-mappings
18621
18574
  // https://www.w3.org/TR/html-aam-1.0/#details-id-97
18622
18575
  if (element.tagName === 'OPTION') {
18623
18576
  return element.selected;
18624
- } // explicit value
18625
-
18577
+ }
18626
18578
 
18579
+ // explicit value
18627
18580
  return checkBooleanAttribute(element, 'aria-selected');
18628
18581
  }
18582
+
18629
18583
  /**
18630
18584
  * @param {Element} element -
18631
18585
  * @returns {boolean | undefined} - false/true if (not)checked, undefined if not checked-able
18632
18586
  */
18633
-
18634
-
18635
18587
  function computeAriaChecked(element) {
18636
18588
  // implicit value from html-aam mappings: https://www.w3.org/TR/html-aam-1.0/#html-attribute-state-and-property-mappings
18637
18589
  // https://www.w3.org/TR/html-aam-1.0/#details-id-56
@@ -18639,66 +18591,56 @@ function computeAriaChecked(element) {
18639
18591
  if ('indeterminate' in element && element.indeterminate) {
18640
18592
  return undefined;
18641
18593
  }
18642
-
18643
18594
  if ('checked' in element) {
18644
18595
  return element.checked;
18645
- } // explicit value
18646
-
18596
+ }
18647
18597
 
18598
+ // explicit value
18648
18599
  return checkBooleanAttribute(element, 'aria-checked');
18649
18600
  }
18601
+
18650
18602
  /**
18651
18603
  * @param {Element} element -
18652
18604
  * @returns {boolean | undefined} - false/true if (not)pressed, undefined if not press-able
18653
18605
  */
18654
-
18655
-
18656
18606
  function computeAriaPressed(element) {
18657
18607
  // https://www.w3.org/TR/wai-aria-1.1/#aria-pressed
18658
18608
  return checkBooleanAttribute(element, 'aria-pressed');
18659
18609
  }
18610
+
18660
18611
  /**
18661
18612
  * @param {Element} element -
18662
18613
  * @returns {boolean | string | null} -
18663
18614
  */
18664
-
18665
-
18666
18615
  function computeAriaCurrent(element) {
18667
18616
  var _ref9, _checkBooleanAttribut;
18668
-
18669
18617
  // https://www.w3.org/TR/wai-aria-1.1/#aria-current
18670
18618
  return (_ref9 = (_checkBooleanAttribut = checkBooleanAttribute(element, 'aria-current')) != null ? _checkBooleanAttribut : element.getAttribute('aria-current')) != null ? _ref9 : false;
18671
18619
  }
18620
+
18672
18621
  /**
18673
18622
  * @param {Element} element -
18674
18623
  * @returns {boolean | undefined} - false/true if (not)expanded, undefined if not expand-able
18675
18624
  */
18676
-
18677
-
18678
18625
  function computeAriaExpanded(element) {
18679
18626
  // https://www.w3.org/TR/wai-aria-1.1/#aria-expanded
18680
18627
  return checkBooleanAttribute(element, 'aria-expanded');
18681
18628
  }
18682
-
18683
18629
  function checkBooleanAttribute(element, attribute) {
18684
18630
  const attributeValue = element.getAttribute(attribute);
18685
-
18686
18631
  if (attributeValue === 'true') {
18687
18632
  return true;
18688
18633
  }
18689
-
18690
18634
  if (attributeValue === 'false') {
18691
18635
  return false;
18692
18636
  }
18693
-
18694
18637
  return undefined;
18695
18638
  }
18639
+
18696
18640
  /**
18697
18641
  * @param {Element} element -
18698
18642
  * @returns {number | undefined} - number if implicit heading or aria-level present, otherwise undefined
18699
18643
  */
18700
-
18701
-
18702
18644
  function computeHeadingLevel(element) {
18703
18645
  // https://w3c.github.io/html-aam/#el-h1-h6
18704
18646
  // https://w3c.github.io/html-aam/#el-h1-h6
@@ -18709,15 +18651,14 @@ function computeHeadingLevel(element) {
18709
18651
  H4: 4,
18710
18652
  H5: 5,
18711
18653
  H6: 6
18712
- }; // explicit aria-level value
18654
+ };
18655
+ // explicit aria-level value
18713
18656
  // https://www.w3.org/TR/wai-aria-1.2/#aria-level
18714
-
18715
18657
  const ariaLevelAttribute = element.getAttribute('aria-level') && Number(element.getAttribute('aria-level'));
18716
18658
  return ariaLevelAttribute || implicitHeadingLevels[element.tagName];
18717
18659
  }
18718
18660
 
18719
18661
  const normalize = getDefaultNormalizer();
18720
-
18721
18662
  function escapeRegExp(string) {
18722
18663
  return string.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
18723
18664
  }
@@ -18725,7 +18666,6 @@ function escapeRegExp(string) {
18725
18666
  function getRegExpMatcher(string) {
18726
18667
  return new RegExp(escapeRegExp(string.toLowerCase()), 'i');
18727
18668
  }
18728
-
18729
18669
  function makeSuggestion(queryName, element, content, _ref) {
18730
18670
  let {
18731
18671
  variant,
@@ -18734,20 +18674,16 @@ function makeSuggestion(queryName, element, content, _ref) {
18734
18674
  let warning = '';
18735
18675
  const queryOptions = {};
18736
18676
  const queryArgs = [['Role', 'TestId'].includes(queryName) ? content : getRegExpMatcher(content)];
18737
-
18738
18677
  if (name) {
18739
18678
  queryOptions.name = getRegExpMatcher(name);
18740
18679
  }
18741
-
18742
18680
  if (queryName === 'Role' && isInaccessible(element)) {
18743
18681
  queryOptions.hidden = true;
18744
18682
  warning = "Element is inaccessible. This means that the element and all its children are invisible to screen readers.\n If you are using the aria-hidden prop, make sure this is the right choice for your case.\n ";
18745
18683
  }
18746
-
18747
18684
  if (Object.keys(queryOptions).length > 0) {
18748
18685
  queryArgs.push(queryOptions);
18749
18686
  }
18750
-
18751
18687
  const queryMethod = variant + "By" + queryName;
18752
18688
  return {
18753
18689
  queryName,
@@ -18755,12 +18691,10 @@ function makeSuggestion(queryName, element, content, _ref) {
18755
18691
  queryArgs,
18756
18692
  variant,
18757
18693
  warning,
18758
-
18759
18694
  toString() {
18760
18695
  if (warning) {
18761
18696
  console.warn(warning);
18762
18697
  }
18763
-
18764
18698
  let [text, options] = queryArgs;
18765
18699
  text = typeof text === 'string' ? "'" + text + "'" : text;
18766
18700
  options = options ? ", { " + Object.entries(options).map(_ref2 => {
@@ -18769,29 +18703,23 @@ function makeSuggestion(queryName, element, content, _ref) {
18769
18703
  }).join(', ') + " }" : '';
18770
18704
  return queryMethod + "(" + text + options + ")";
18771
18705
  }
18772
-
18773
18706
  };
18774
18707
  }
18775
-
18776
18708
  function canSuggest(currentMethod, requestedMethod, data) {
18777
18709
  return data && (!requestedMethod || requestedMethod.toLowerCase() === currentMethod.toLowerCase());
18778
18710
  }
18779
-
18780
18711
  function getSuggestedQuery(element, variant, method) {
18781
18712
  var _element$getAttribute, _getImplicitAriaRoles;
18782
-
18783
18713
  if (variant === void 0) {
18784
18714
  variant = 'get';
18785
18715
  }
18786
-
18787
18716
  // don't create suggestions for script and style elements
18788
18717
  if (element.matches(getConfig().defaultIgnore)) {
18789
18718
  return undefined;
18790
- } //We prefer to suggest something else if the role is generic
18791
-
18719
+ }
18792
18720
 
18721
+ //We prefer to suggest something else if the role is generic
18793
18722
  const role = (_element$getAttribute = element.getAttribute('role')) != null ? _element$getAttribute : (_getImplicitAriaRoles = getImplicitAriaRoles(element)) == null ? void 0 : _getImplicitAriaRoles[0];
18794
-
18795
18723
  if (role !== 'generic' && canSuggest('Role', method, role)) {
18796
18724
  return makeSuggestion('Role', element, role, {
18797
18725
  variant,
@@ -18800,70 +18728,55 @@ function getSuggestedQuery(element, variant, method) {
18800
18728
  })
18801
18729
  });
18802
18730
  }
18803
-
18804
18731
  const labelText = getLabels(document, element).map(label => label.content).join(' ');
18805
-
18806
18732
  if (canSuggest('LabelText', method, labelText)) {
18807
18733
  return makeSuggestion('LabelText', element, labelText, {
18808
18734
  variant
18809
18735
  });
18810
18736
  }
18811
-
18812
18737
  const placeholderText = element.getAttribute('placeholder');
18813
-
18814
18738
  if (canSuggest('PlaceholderText', method, placeholderText)) {
18815
18739
  return makeSuggestion('PlaceholderText', element, placeholderText, {
18816
18740
  variant
18817
18741
  });
18818
18742
  }
18819
-
18820
18743
  const textContent = normalize(getNodeText(element));
18821
-
18822
18744
  if (canSuggest('Text', method, textContent)) {
18823
18745
  return makeSuggestion('Text', element, textContent, {
18824
18746
  variant
18825
18747
  });
18826
18748
  }
18827
-
18828
18749
  if (canSuggest('DisplayValue', method, element.value)) {
18829
18750
  return makeSuggestion('DisplayValue', element, normalize(element.value), {
18830
18751
  variant
18831
18752
  });
18832
18753
  }
18833
-
18834
18754
  const alt = element.getAttribute('alt');
18835
-
18836
18755
  if (canSuggest('AltText', method, alt)) {
18837
18756
  return makeSuggestion('AltText', element, alt, {
18838
18757
  variant
18839
18758
  });
18840
18759
  }
18841
-
18842
18760
  const title = element.getAttribute('title');
18843
-
18844
18761
  if (canSuggest('Title', method, title)) {
18845
18762
  return makeSuggestion('Title', element, title, {
18846
18763
  variant
18847
18764
  });
18848
18765
  }
18849
-
18850
18766
  const testId = element.getAttribute(getConfig().testIdAttribute);
18851
-
18852
18767
  if (canSuggest('TestId', method, testId)) {
18853
18768
  return makeSuggestion('TestId', element, testId, {
18854
18769
  variant
18855
18770
  });
18856
18771
  }
18857
-
18858
18772
  return undefined;
18859
18773
  }
18860
18774
 
18775
+ // This is so the stack trace the developer sees is one that's
18861
18776
  // closer to their code (because async stack traces are hard to follow).
18862
-
18863
18777
  function copyStackTrace(target, source) {
18864
18778
  target.stack = source.stack.replace(source.message, target.message);
18865
18779
  }
18866
-
18867
18780
  function waitFor(callback, _ref) {
18868
18781
  let {
18869
18782
  container = getDocument$1(),
@@ -18882,59 +18795,55 @@ function waitFor(callback, _ref) {
18882
18795
  characterData: true
18883
18796
  }
18884
18797
  } = _ref;
18885
-
18886
18798
  if (typeof callback !== 'function') {
18887
18799
  throw new TypeError('Received `callback` arg must be a function');
18888
18800
  }
18889
-
18890
18801
  return new Promise(async (resolve, reject) => {
18891
18802
  let lastError, intervalId, observer;
18892
18803
  let finished = false;
18893
18804
  let promiseStatus = 'idle';
18894
18805
  const overallTimeoutTimer = setTimeout(handleTimeout, timeout);
18895
18806
  const usingJestFakeTimers = jestFakeTimersAreEnabled$1();
18896
-
18897
18807
  if (usingJestFakeTimers) {
18898
18808
  const {
18899
18809
  unstable_advanceTimersWrapper: advanceTimersWrapper
18900
18810
  } = getConfig();
18901
- checkCallback(); // this is a dangerous rule to disable because it could lead to an
18811
+ checkCallback();
18812
+ // this is a dangerous rule to disable because it could lead to an
18902
18813
  // infinite loop. However, eslint isn't smart enough to know that we're
18903
18814
  // setting finished inside `onDone` which will be called when we're done
18904
18815
  // waiting or when we've timed out.
18905
18816
  // eslint-disable-next-line no-unmodified-loop-condition
18906
-
18907
18817
  while (!finished) {
18908
18818
  if (!jestFakeTimersAreEnabled$1()) {
18909
18819
  const error = new Error("Changed from using fake timers to real timers while using waitFor. This is not allowed and will result in very strange behavior. Please ensure you're awaiting all async things your test is doing before changing to real timers. For more info, please go to https://github.com/testing-library/dom-testing-library/issues/830");
18910
18820
  if (!showOriginalStackTrace) copyStackTrace(error, stackTraceError);
18911
18821
  reject(error);
18912
18822
  return;
18913
- } // we *could* (maybe should?) use `advanceTimersToNextTimer` but it's
18823
+ }
18824
+ // we *could* (maybe should?) use `advanceTimersToNextTimer` but it's
18914
18825
  // possible that could make this loop go on forever if someone is using
18915
18826
  // third party code that's setting up recursive timers so rapidly that
18916
18827
  // the user's timer's don't get a chance to resolve. So we'll advance
18917
18828
  // by an interval instead. (We have a test for this case).
18918
-
18919
-
18920
18829
  advanceTimersWrapper(() => {
18921
18830
  jest.advanceTimersByTime(interval);
18922
- }); // It's really important that checkCallback is run *before* we flush
18831
+ });
18832
+
18833
+ // It's really important that checkCallback is run *before* we flush
18923
18834
  // in-flight promises. To be honest, I'm not sure why, and I can't quite
18924
18835
  // think of a way to reproduce the problem in a test, but I spent
18925
18836
  // an entire day banging my head against a wall on this.
18926
-
18927
18837
  checkCallback();
18928
-
18929
18838
  if (finished) {
18930
18839
  break;
18931
- } // In this rare case, we *need* to wait for in-flight promises
18840
+ }
18841
+
18842
+ // In this rare case, we *need* to wait for in-flight promises
18932
18843
  // to resolve before continuing. We don't need to take advantage
18933
18844
  // of parallelization so we're fine.
18934
18845
  // https://stackoverflow.com/a/59243586/971592
18935
18846
  // eslint-disable-next-line no-await-in-loop
18936
-
18937
-
18938
18847
  await advanceTimersWrapper(async () => {
18939
18848
  await new Promise(r => {
18940
18849
  setTimeout(r, 0);
@@ -18949,7 +18858,6 @@ function waitFor(callback, _ref) {
18949
18858
  reject(e);
18950
18859
  return;
18951
18860
  }
18952
-
18953
18861
  intervalId = setInterval(checkRealTimersCallback, interval);
18954
18862
  const {
18955
18863
  MutationObserver
@@ -18958,23 +18866,19 @@ function waitFor(callback, _ref) {
18958
18866
  observer.observe(container, mutationObserverOptions);
18959
18867
  checkCallback();
18960
18868
  }
18961
-
18962
18869
  function onDone(error, result) {
18963
18870
  finished = true;
18964
18871
  clearTimeout(overallTimeoutTimer);
18965
-
18966
18872
  if (!usingJestFakeTimers) {
18967
18873
  clearInterval(intervalId);
18968
18874
  observer.disconnect();
18969
18875
  }
18970
-
18971
18876
  if (error) {
18972
18877
  reject(error);
18973
18878
  } else {
18974
18879
  resolve(result);
18975
18880
  }
18976
18881
  }
18977
-
18978
18882
  function checkRealTimersCallback() {
18979
18883
  if (jestFakeTimersAreEnabled$1()) {
18980
18884
  const error = new Error("Changed from using real timers to fake timers while using waitFor. This is not allowed and will result in very strange behavior. Please ensure you're awaiting all async things your test is doing before changing to fake timers. For more info, please go to https://github.com/testing-library/dom-testing-library/issues/830");
@@ -18984,13 +18888,10 @@ function waitFor(callback, _ref) {
18984
18888
  return checkCallback();
18985
18889
  }
18986
18890
  }
18987
-
18988
18891
  function checkCallback() {
18989
18892
  if (promiseStatus === 'pending') return;
18990
-
18991
18893
  try {
18992
18894
  const result = runWithExpensiveErrorDiagnosticsDisabled(callback);
18993
-
18994
18895
  if (typeof (result == null ? void 0 : result.then) === 'function') {
18995
18896
  promiseStatus = 'pending';
18996
18897
  result.then(resolvedValue => {
@@ -19002,36 +18903,30 @@ function waitFor(callback, _ref) {
19002
18903
  });
19003
18904
  } else {
19004
18905
  onDone(null, result);
19005
- } // If `callback` throws, wait for the next mutation, interval, or timeout.
19006
-
18906
+ }
18907
+ // If `callback` throws, wait for the next mutation, interval, or timeout.
19007
18908
  } catch (error) {
19008
18909
  // Save the most recent callback error to reject the promise with it in the event of a timeout
19009
18910
  lastError = error;
19010
18911
  }
19011
18912
  }
19012
-
19013
18913
  function handleTimeout() {
19014
18914
  let error;
19015
-
19016
18915
  if (lastError) {
19017
18916
  error = lastError;
19018
-
19019
18917
  if (!showOriginalStackTrace && error.name === 'TestingLibraryElementError') {
19020
18918
  copyStackTrace(error, stackTraceError);
19021
18919
  }
19022
18920
  } else {
19023
18921
  error = new Error('Timed out in waitFor.');
19024
-
19025
18922
  if (!showOriginalStackTrace) {
19026
18923
  copyStackTrace(error, stackTraceError);
19027
18924
  }
19028
18925
  }
19029
-
19030
18926
  onDone(onTimeout(error), null);
19031
18927
  }
19032
18928
  });
19033
18929
  }
19034
-
19035
18930
  function waitForWrapper(callback, options) {
19036
18931
  // create the error here so its stack trace is as close to the
19037
18932
  // calling code as possible
@@ -19041,6 +18936,7 @@ function waitForWrapper(callback, options) {
19041
18936
  ...options
19042
18937
  }));
19043
18938
  }
18939
+
19044
18940
  /*
19045
18941
  eslint
19046
18942
  max-lines-per-function: ["error", {"max": 200}],
@@ -19049,11 +18945,9 @@ eslint
19049
18945
  function getElementError(message, container) {
19050
18946
  return getConfig().getElementError(message, container);
19051
18947
  }
19052
-
19053
18948
  function getMultipleElementsFoundError(message, container) {
19054
18949
  return getElementError(message + "\n\n(If this is intentional, then use the `*AllBy*` variant of the query (like `queryAllByText`, `getAllByText`, or `findAllByText`)).", container);
19055
18950
  }
19056
-
19057
18951
  function queryAllByAttribute(attribute, container, text, _temp) {
19058
18952
  let {
19059
18953
  exact = true,
@@ -19069,61 +18963,51 @@ function queryAllByAttribute(attribute, container, text, _temp) {
19069
18963
  });
19070
18964
  return Array.from(container.querySelectorAll("[" + attribute + "]")).filter(node => matcher(node.getAttribute(attribute), node, text, matchNormalizer));
19071
18965
  }
19072
-
19073
18966
  function queryByAttribute(attribute, container, text, options) {
19074
18967
  const els = queryAllByAttribute(attribute, container, text, options);
19075
-
19076
18968
  if (els.length > 1) {
19077
18969
  throw getMultipleElementsFoundError("Found multiple elements by [" + attribute + "=" + text + "]", container);
19078
18970
  }
19079
-
19080
18971
  return els[0] || null;
19081
- } // this accepts a query function and returns a function which throws an error
18972
+ }
18973
+
18974
+ // this accepts a query function and returns a function which throws an error
19082
18975
  // if more than one elements is returned, otherwise it returns the first
19083
18976
  // element or null
19084
-
19085
-
19086
18977
  function makeSingleQuery(allQuery, getMultipleError) {
19087
18978
  return function (container) {
19088
18979
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
19089
18980
  args[_key - 1] = arguments[_key];
19090
18981
  }
19091
-
19092
18982
  const els = allQuery(container, ...args);
19093
-
19094
18983
  if (els.length > 1) {
19095
18984
  const elementStrings = els.map(element => getElementError(null, element).message).join('\n\n');
19096
18985
  throw getMultipleElementsFoundError(getMultipleError(container, ...args) + "\n\nHere are the matching elements:\n\n" + elementStrings, container);
19097
18986
  }
19098
-
19099
18987
  return els[0] || null;
19100
18988
  };
19101
18989
  }
19102
-
19103
18990
  function getSuggestionError(suggestion, container) {
19104
18991
  return getConfig().getElementError("A better query is available, try this:\n" + suggestion.toString() + "\n", container);
19105
- } // this accepts a query function and returns a function which throws an error
19106
- // if an empty list of elements is returned
19107
-
18992
+ }
19108
18993
 
18994
+ // this accepts a query function and returns a function which throws an error
18995
+ // if an empty list of elements is returned
19109
18996
  function makeGetAllQuery(allQuery, getMissingError) {
19110
18997
  return function (container) {
19111
18998
  for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
19112
18999
  args[_key2 - 1] = arguments[_key2];
19113
19000
  }
19114
-
19115
19001
  const els = allQuery(container, ...args);
19116
-
19117
19002
  if (!els.length) {
19118
19003
  throw getConfig().getElementError(getMissingError(container, ...args), container);
19119
19004
  }
19120
-
19121
19005
  return els;
19122
19006
  };
19123
- } // this accepts a getter query function and returns a function which calls
19124
- // waitFor and passing a function which invokes the getter.
19125
-
19007
+ }
19126
19008
 
19009
+ // this accepts a getter query function and returns a function which calls
19010
+ // waitFor and passing a function which invokes the getter.
19127
19011
  function makeFindQuery(getter) {
19128
19012
  return (container, text, options, waitForOptions) => {
19129
19013
  return waitForWrapper(() => {
@@ -19134,60 +19018,51 @@ function makeFindQuery(getter) {
19134
19018
  });
19135
19019
  };
19136
19020
  }
19137
-
19138
19021
  const wrapSingleQueryWithSuggestion = (query, queryAllByName, variant) => function (container) {
19139
19022
  for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
19140
19023
  args[_key3 - 1] = arguments[_key3];
19141
19024
  }
19142
-
19143
19025
  const element = query(container, ...args);
19144
19026
  const [{
19145
19027
  suggest = getConfig().throwSuggestions
19146
19028
  } = {}] = args.slice(-1);
19147
-
19148
19029
  if (element && suggest) {
19149
19030
  const suggestion = getSuggestedQuery(element, variant);
19150
-
19151
19031
  if (suggestion && !queryAllByName.endsWith(suggestion.queryName)) {
19152
19032
  throw getSuggestionError(suggestion.toString(), container);
19153
19033
  }
19154
19034
  }
19155
-
19156
19035
  return element;
19157
19036
  };
19158
-
19159
19037
  const wrapAllByQueryWithSuggestion = (query, queryAllByName, variant) => function (container) {
19160
19038
  for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
19161
19039
  args[_key4 - 1] = arguments[_key4];
19162
19040
  }
19163
-
19164
19041
  const els = query(container, ...args);
19165
19042
  const [{
19166
19043
  suggest = getConfig().throwSuggestions
19167
19044
  } = {}] = args.slice(-1);
19168
-
19169
19045
  if (els.length && suggest) {
19170
19046
  // get a unique list of all suggestion messages. We are only going to make a suggestion if
19171
19047
  // all the suggestions are the same
19172
19048
  const uniqueSuggestionMessages = [...new Set(els.map(element => {
19173
19049
  var _getSuggestedQuery;
19174
-
19175
19050
  return (_getSuggestedQuery = getSuggestedQuery(element, variant)) == null ? void 0 : _getSuggestedQuery.toString();
19176
19051
  }))];
19177
-
19178
- if ( // only want to suggest if all the els have the same suggestion.
19179
- uniqueSuggestionMessages.length === 1 && !queryAllByName.endsWith( // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- TODO: Can this be null at runtime?
19052
+ if (
19053
+ // only want to suggest if all the els have the same suggestion.
19054
+ uniqueSuggestionMessages.length === 1 && !queryAllByName.endsWith(
19055
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- TODO: Can this be null at runtime?
19180
19056
  getSuggestedQuery(els[0], variant).queryName)) {
19181
19057
  throw getSuggestionError(uniqueSuggestionMessages[0], container);
19182
19058
  }
19183
19059
  }
19184
-
19185
19060
  return els;
19186
- }; // TODO: This deviates from the published declarations
19061
+ };
19062
+
19063
+ // TODO: This deviates from the published declarations
19187
19064
  // However, the implementation always required a dyadic (after `container`) not variadic `queryAllBy` considering the implementation of `makeFindQuery`
19188
19065
  // This is at least statically true and can be verified by accepting `QueryMethod<Arguments, HTMLElement[]>`
19189
-
19190
-
19191
19066
  function buildQueries(queryAllBy, getMultipleError, getMissingError) {
19192
19067
  const queryBy = wrapSingleQueryWithSuggestion(makeSingleQuery(queryAllBy, getMultipleError), queryAllBy.name, 'query');
19193
19068
  const getAllBy = makeGetAllQuery(queryAllBy, getMissingError);
@@ -19226,7 +19101,6 @@ function queryAllLabels(container) {
19226
19101
  return textToMatch !== null;
19227
19102
  });
19228
19103
  }
19229
-
19230
19104
  const queryAllLabelsByText = function (container, text, _temp) {
19231
19105
  let {
19232
19106
  exact = true,
@@ -19254,7 +19128,6 @@ const queryAllLabelsByText = function (container, text, _temp) {
19254
19128
  return node;
19255
19129
  });
19256
19130
  };
19257
-
19258
19131
  const queryAllByLabelText = function (container, text, _temp2) {
19259
19132
  let {
19260
19133
  selector = '*',
@@ -19281,47 +19154,40 @@ const queryAllByLabelText = function (container, text, _temp2) {
19281
19154
  });
19282
19155
  const labelsValue = labelList.filter(label => Boolean(label.content)).map(label => label.content);
19283
19156
  if (matcher(labelsValue.join(' '), labelledElement, text, matchNormalizer)) labelledElements.push(labelledElement);
19284
-
19285
19157
  if (labelsValue.length > 1) {
19286
19158
  labelsValue.forEach((labelValue, index) => {
19287
19159
  if (matcher(labelValue, labelledElement, text, matchNormalizer)) labelledElements.push(labelledElement);
19288
19160
  const labelsFiltered = [...labelsValue];
19289
19161
  labelsFiltered.splice(index, 1);
19290
-
19291
19162
  if (labelsFiltered.length > 1) {
19292
19163
  if (matcher(labelsFiltered.join(' '), labelledElement, text, matchNormalizer)) labelledElements.push(labelledElement);
19293
19164
  }
19294
19165
  });
19295
19166
  }
19296
-
19297
19167
  return labelledElements;
19298
19168
  }, []).concat(queryAllByAttribute('aria-label', container, text, {
19299
19169
  exact,
19300
19170
  normalizer: matchNormalizer
19301
19171
  }));
19302
19172
  return Array.from(new Set(matchingLabelledElements)).filter(element => element.matches(selector));
19303
- }; // the getAll* query would normally look like this:
19173
+ };
19174
+
19175
+ // the getAll* query would normally look like this:
19304
19176
  // const getAllByLabelText = makeGetAllQuery(
19305
19177
  // queryAllByLabelText,
19306
19178
  // (c, text) => `Unable to find a label with the text of: ${text}`,
19307
19179
  // )
19308
19180
  // however, we can give a more helpful error message than the generic one,
19309
19181
  // so we're writing this one out by hand.
19310
-
19311
-
19312
19182
  const getAllByLabelText = function (container, text) {
19313
19183
  for (var _len = arguments.length, rest = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
19314
19184
  rest[_key - 2] = arguments[_key];
19315
19185
  }
19316
-
19317
19186
  const els = queryAllByLabelText(container, text, ...rest);
19318
-
19319
19187
  if (!els.length) {
19320
19188
  const labels = queryAllLabelsByText(container, text, ...rest);
19321
-
19322
19189
  if (labels.length) {
19323
19190
  const tagNames = labels.map(label => getTagNameOfElementAssociatedWithLabelViaFor(container, label)).filter(tagName => !!tagName);
19324
-
19325
19191
  if (tagNames.length) {
19326
19192
  throw getConfig().getElementError(tagNames.map(tagName => "Found a label with the text of: " + text + ", however the element associated with this label (<" + tagName + " />) is non-labellable [https://html.spec.whatwg.org/multipage/forms.html#category-label]. If you really need to label a <" + tagName + " />, you can use aria-label or aria-labelledby instead.").join('\n\n'), container);
19327
19193
  } else {
@@ -19331,24 +19197,19 @@ const getAllByLabelText = function (container, text) {
19331
19197
  throw getConfig().getElementError("Unable to find a label with the text of: " + text, container);
19332
19198
  }
19333
19199
  }
19334
-
19335
19200
  return els;
19336
19201
  };
19337
-
19338
19202
  function getTagNameOfElementAssociatedWithLabelViaFor(container, label) {
19339
19203
  const htmlFor = label.getAttribute('for');
19340
-
19341
19204
  if (!htmlFor) {
19342
19205
  return null;
19343
19206
  }
19344
-
19345
19207
  const element = container.querySelector("[id=\"" + htmlFor + "\"]");
19346
19208
  return element ? element.tagName.toLowerCase() : null;
19347
- } // the reason mentioned above is the same reason we're not using buildQueries
19348
-
19209
+ }
19349
19210
 
19211
+ // the reason mentioned above is the same reason we're not using buildQueries
19350
19212
  const getMultipleError$7 = (c, text) => "Found multiple elements with the text of: " + text;
19351
-
19352
19213
  const queryByLabelText = wrapSingleQueryWithSuggestion(makeSingleQuery(queryAllByLabelText, getMultipleError$7), queryAllByLabelText.name, 'query');
19353
19214
  const getByLabelText = makeSingleQuery(getAllByLabelText, getMultipleError$7);
19354
19215
  const findAllByLabelText = makeFindQuery(wrapAllByQueryWithSuggestion(getAllByLabelText, getAllByLabelText.name, 'findAll'));
@@ -19361,15 +19222,11 @@ const queryAllByPlaceholderText = function () {
19361
19222
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
19362
19223
  args[_key] = arguments[_key];
19363
19224
  }
19364
-
19365
19225
  checkContainerType$1(args[0]);
19366
19226
  return queryAllByAttribute('placeholder', ...args);
19367
19227
  };
19368
-
19369
19228
  const getMultipleError$6 = (c, text) => "Found multiple elements with the placeholder text of: " + text;
19370
-
19371
19229
  const getMissingError$6 = (c, text) => "Unable to find an element with the placeholder text of: " + text;
19372
-
19373
19230
  const queryAllByPlaceholderTextWithSuggestions = wrapAllByQueryWithSuggestion(queryAllByPlaceholderText, queryAllByPlaceholderText.name, 'queryAll');
19374
19231
  const [queryByPlaceholderText, getAllByPlaceholderText, getByPlaceholderText, findAllByPlaceholderText, findByPlaceholderText] = buildQueries(queryAllByPlaceholderText, getMultipleError$6, getMissingError$6);
19375
19232
 
@@ -19390,22 +19247,18 @@ const queryAllByText = function (container, text, _temp) {
19390
19247
  normalizer
19391
19248
  });
19392
19249
  let baseArray = [];
19393
-
19394
19250
  if (typeof container.matches === 'function' && container.matches(selector)) {
19395
19251
  baseArray = [container];
19396
19252
  }
19397
-
19398
- return [...baseArray, ...Array.from(container.querySelectorAll(selector))] // TODO: `matches` according lib.dom.d.ts can get only `string` but according our code it can handle also boolean :)
19253
+ return [...baseArray, ...Array.from(container.querySelectorAll(selector))]
19254
+ // TODO: `matches` according lib.dom.d.ts can get only `string` but according our code it can handle also boolean :)
19399
19255
  .filter(node => !ignore || !node.matches(ignore)).filter(node => matcher(getNodeText(node), node, text, matchNormalizer));
19400
19256
  };
19401
-
19402
19257
  const getMultipleError$5 = (c, text) => "Found multiple elements with the text: " + text;
19403
-
19404
19258
  const getMissingError$5 = function (c, text, options) {
19405
19259
  if (options === void 0) {
19406
19260
  options = {};
19407
19261
  }
19408
-
19409
19262
  const {
19410
19263
  collapseWhitespace,
19411
19264
  trim,
@@ -19422,7 +19275,6 @@ const getMissingError$5 = function (c, text, options) {
19422
19275
  const isCustomSelector = (selector != null ? selector : '*') !== '*';
19423
19276
  return "Unable to find an element with the text: " + (isNormalizedDifferent ? normalizedText + " (normalized from '" + text + "')" : text) + (isCustomSelector ? ", which matches selector '" + selector + "'" : '') + ". This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.";
19424
19277
  };
19425
-
19426
19278
  const queryAllByTextWithSuggestions = wrapAllByQueryWithSuggestion(queryAllByText, queryAllByText.name, 'queryAll');
19427
19279
  const [queryByText, getAllByText, getByText, findAllByText, findByText] = buildQueries(queryAllByText, getMultipleError$5, getMissingError$5);
19428
19280
 
@@ -19449,38 +19301,29 @@ const queryAllByDisplayValue = function (container, value, _temp) {
19449
19301
  }
19450
19302
  });
19451
19303
  };
19452
-
19453
19304
  const getMultipleError$4 = (c, value) => "Found multiple elements with the display value: " + value + ".";
19454
-
19455
19305
  const getMissingError$4 = (c, value) => "Unable to find an element with the display value: " + value + ".";
19456
-
19457
19306
  const queryAllByDisplayValueWithSuggestions = wrapAllByQueryWithSuggestion(queryAllByDisplayValue, queryAllByDisplayValue.name, 'queryAll');
19458
19307
  const [queryByDisplayValue, getAllByDisplayValue, getByDisplayValue, findAllByDisplayValue, findByDisplayValue] = buildQueries(queryAllByDisplayValue, getMultipleError$4, getMissingError$4);
19459
19308
 
19309
+ // Valid tags are img, input, area and custom elements
19460
19310
  const VALID_TAG_REGEXP = /^(img|input|area|.+-.+)$/i;
19461
-
19462
19311
  const queryAllByAltText = function (container, alt, options) {
19463
19312
  if (options === void 0) {
19464
19313
  options = {};
19465
19314
  }
19466
-
19467
19315
  checkContainerType$1(container);
19468
19316
  return queryAllByAttribute('alt', container, alt, options).filter(node => VALID_TAG_REGEXP.test(node.tagName));
19469
19317
  };
19470
-
19471
19318
  const getMultipleError$3 = (c, alt) => "Found multiple elements with the alt text: " + alt;
19472
-
19473
19319
  const getMissingError$3 = (c, alt) => "Unable to find an element with the alt text: " + alt;
19474
-
19475
19320
  const queryAllByAltTextWithSuggestions = wrapAllByQueryWithSuggestion(queryAllByAltText, queryAllByAltText.name, 'queryAll');
19476
19321
  const [queryByAltText, getAllByAltText, getByAltText, findAllByAltText, findByAltText] = buildQueries(queryAllByAltText, getMultipleError$3, getMissingError$3);
19477
19322
 
19478
19323
  const isSvgTitle = node => {
19479
19324
  var _node$parentElement;
19480
-
19481
19325
  return node.tagName.toLowerCase() === 'title' && ((_node$parentElement = node.parentElement) == null ? void 0 : _node$parentElement.tagName.toLowerCase()) === 'svg';
19482
19326
  };
19483
-
19484
19327
  const queryAllByTitle = function (container, text, _temp) {
19485
19328
  let {
19486
19329
  exact = true,
@@ -19497,11 +19340,8 @@ const queryAllByTitle = function (container, text, _temp) {
19497
19340
  });
19498
19341
  return Array.from(container.querySelectorAll('[title], svg > title')).filter(node => matcher(node.getAttribute('title'), node, text, matchNormalizer) || isSvgTitle(node) && matcher(getNodeText(node), node, text, matchNormalizer));
19499
19342
  };
19500
-
19501
19343
  const getMultipleError$2 = (c, title) => "Found multiple elements with the title: " + title + ".";
19502
-
19503
19344
  const getMissingError$2 = (c, title) => "Unable to find an element with the title: " + title + ".";
19504
-
19505
19345
  const queryAllByTitleWithSuggestions = wrapAllByQueryWithSuggestion(queryAllByTitle, queryAllByTitle.name, 'queryAll');
19506
19346
  const [queryByTitle, getAllByTitle, getByTitle, findAllByTitle, findByTitle] = buildQueries(queryAllByTitle, getMultipleError$2, getMissingError$2);
19507
19347
 
@@ -19529,37 +19369,29 @@ function queryAllByRole(container, role, _temp) {
19529
19369
  trim,
19530
19370
  normalizer
19531
19371
  });
19532
-
19533
19372
  if (selected !== undefined) {
19534
19373
  var _allRoles$get;
19535
-
19536
19374
  // guard against unknown roles
19537
19375
  if (((_allRoles$get = roles_1.get(role)) == null ? void 0 : _allRoles$get.props['aria-selected']) === undefined) {
19538
19376
  throw new Error("\"aria-selected\" is not supported on role \"" + role + "\".");
19539
19377
  }
19540
19378
  }
19541
-
19542
19379
  if (checked !== undefined) {
19543
19380
  var _allRoles$get2;
19544
-
19545
19381
  // guard against unknown roles
19546
19382
  if (((_allRoles$get2 = roles_1.get(role)) == null ? void 0 : _allRoles$get2.props['aria-checked']) === undefined) {
19547
19383
  throw new Error("\"aria-checked\" is not supported on role \"" + role + "\".");
19548
19384
  }
19549
19385
  }
19550
-
19551
19386
  if (pressed !== undefined) {
19552
19387
  var _allRoles$get3;
19553
-
19554
19388
  // guard against unknown roles
19555
19389
  if (((_allRoles$get3 = roles_1.get(role)) == null ? void 0 : _allRoles$get3.props['aria-pressed']) === undefined) {
19556
19390
  throw new Error("\"aria-pressed\" is not supported on role \"" + role + "\".");
19557
19391
  }
19558
19392
  }
19559
-
19560
19393
  if (current !== undefined) {
19561
19394
  var _allRoles$get4;
19562
-
19563
19395
  /* istanbul ignore next */
19564
19396
  // guard against unknown roles
19565
19397
  // All currently released ARIA versions support `aria-current` on all roles.
@@ -19568,89 +19400,71 @@ function queryAllByRole(container, role, _temp) {
19568
19400
  throw new Error("\"aria-current\" is not supported on role \"" + role + "\".");
19569
19401
  }
19570
19402
  }
19571
-
19572
19403
  if (level !== undefined) {
19573
19404
  // guard against using `level` option with any role other than `heading`
19574
19405
  if (role !== 'heading') {
19575
19406
  throw new Error("Role \"" + role + "\" cannot have \"level\" property.");
19576
19407
  }
19577
19408
  }
19578
-
19579
19409
  if (expanded !== undefined) {
19580
19410
  var _allRoles$get5;
19581
-
19582
19411
  // guard against unknown roles
19583
19412
  if (((_allRoles$get5 = roles_1.get(role)) == null ? void 0 : _allRoles$get5.props['aria-expanded']) === undefined) {
19584
19413
  throw new Error("\"aria-expanded\" is not supported on role \"" + role + "\".");
19585
19414
  }
19586
19415
  }
19587
-
19588
19416
  const subtreeIsInaccessibleCache = new WeakMap();
19589
-
19590
19417
  function cachedIsSubtreeInaccessible(element) {
19591
19418
  if (!subtreeIsInaccessibleCache.has(element)) {
19592
19419
  subtreeIsInaccessibleCache.set(element, isSubtreeInaccessible(element));
19593
19420
  }
19594
-
19595
19421
  return subtreeIsInaccessibleCache.get(element);
19596
19422
  }
19597
-
19598
- return Array.from(container.querySelectorAll( // Only query elements that can be matched by the following filters
19423
+ return Array.from(container.querySelectorAll(
19424
+ // Only query elements that can be matched by the following filters
19599
19425
  makeRoleSelector(role, exact, normalizer ? matchNormalizer : undefined))).filter(node => {
19600
19426
  const isRoleSpecifiedExplicitly = node.hasAttribute('role');
19601
-
19602
19427
  if (isRoleSpecifiedExplicitly) {
19603
19428
  const roleValue = node.getAttribute('role');
19604
-
19605
19429
  if (queryFallbacks) {
19606
19430
  return roleValue.split(' ').filter(Boolean).some(text => matcher(text, node, role, matchNormalizer));
19607
- } // if a custom normalizer is passed then let normalizer handle the role value
19608
-
19609
-
19431
+ }
19432
+ // if a custom normalizer is passed then let normalizer handle the role value
19610
19433
  if (normalizer) {
19611
19434
  return matcher(roleValue, node, role, matchNormalizer);
19612
- } // other wise only send the first word to match
19613
-
19614
-
19435
+ }
19436
+ // other wise only send the first word to match
19615
19437
  const [firstWord] = roleValue.split(' ');
19616
19438
  return matcher(firstWord, node, role, matchNormalizer);
19617
19439
  }
19618
-
19619
19440
  const implicitRoles = getImplicitAriaRoles(node);
19620
19441
  return implicitRoles.some(implicitRole => matcher(implicitRole, node, role, matchNormalizer));
19621
19442
  }).filter(element => {
19622
19443
  if (selected !== undefined) {
19623
19444
  return selected === computeAriaSelected(element);
19624
19445
  }
19625
-
19626
19446
  if (checked !== undefined) {
19627
19447
  return checked === computeAriaChecked(element);
19628
19448
  }
19629
-
19630
19449
  if (pressed !== undefined) {
19631
19450
  return pressed === computeAriaPressed(element);
19632
19451
  }
19633
-
19634
19452
  if (current !== undefined) {
19635
19453
  return current === computeAriaCurrent(element);
19636
19454
  }
19637
-
19638
19455
  if (expanded !== undefined) {
19639
19456
  return expanded === computeAriaExpanded(element);
19640
19457
  }
19641
-
19642
19458
  if (level !== undefined) {
19643
19459
  return level === computeHeadingLevel(element);
19644
- } // don't care if aria attributes are unspecified
19645
-
19646
-
19460
+ }
19461
+ // don't care if aria attributes are unspecified
19647
19462
  return true;
19648
19463
  }).filter(element => {
19649
19464
  if (name === undefined) {
19650
19465
  // Don't care
19651
19466
  return true;
19652
19467
  }
19653
-
19654
19468
  return matches(computeAccessibleName(element, {
19655
19469
  computedStyleSupportsPseudoElements: getConfig().computedStyleSupportsPseudoElements
19656
19470
  }), element, name, text => text);
@@ -19659,7 +19473,6 @@ function queryAllByRole(container, role, _temp) {
19659
19473
  // Don't care
19660
19474
  return true;
19661
19475
  }
19662
-
19663
19476
  return matches(computeAccessibleDescription(element, {
19664
19477
  computedStyleSupportsPseudoElements: getConfig().computedStyleSupportsPseudoElements
19665
19478
  }), element, description, text => text);
@@ -19669,15 +19482,12 @@ function queryAllByRole(container, role, _temp) {
19669
19482
  }) === false : true;
19670
19483
  });
19671
19484
  }
19672
-
19673
19485
  function makeRoleSelector(role, exact, customNormalizer) {
19674
19486
  var _roleElements$get;
19675
-
19676
19487
  if (typeof role !== 'string') {
19677
19488
  // For non-string role parameters we can not determine the implicitRoleSelectors.
19678
19489
  return '*';
19679
19490
  }
19680
-
19681
19491
  const explicitRoleSelector = exact && !customNormalizer ? "*[role~=\"" + role + "\"]" : '*[role]';
19682
19492
  const roleRelations = (_roleElements$get = roleElements_1.get(role)) != null ? _roleElements$get : new Set();
19683
19493
  const implicitRoleSelectors = new Set(Array.from(roleRelations).map(_ref => {
@@ -19685,16 +19495,15 @@ function makeRoleSelector(role, exact, customNormalizer) {
19685
19495
  name
19686
19496
  } = _ref;
19687
19497
  return name;
19688
- })); // Current transpilation config sometimes assumes `...` is always applied to arrays.
19498
+ }));
19499
+
19500
+ // Current transpilation config sometimes assumes `...` is always applied to arrays.
19689
19501
  // `...` is equivalent to `Array.prototype.concat` for arrays.
19690
19502
  // If you replace this code with `[explicitRoleSelector, ...implicitRoleSelectors]`, make sure every transpilation target retains the `...` in favor of `Array.prototype.concat`.
19691
-
19692
19503
  return [explicitRoleSelector].concat(Array.from(implicitRoleSelectors)).join(',');
19693
19504
  }
19694
-
19695
19505
  const getNameHint = name => {
19696
19506
  let nameHint = '';
19697
-
19698
19507
  if (name === undefined) {
19699
19508
  nameHint = '';
19700
19509
  } else if (typeof name === 'string') {
@@ -19702,28 +19511,23 @@ const getNameHint = name => {
19702
19511
  } else {
19703
19512
  nameHint = " and name `" + name + "`";
19704
19513
  }
19705
-
19706
19514
  return nameHint;
19707
19515
  };
19708
-
19709
19516
  const getMultipleError$1 = function (c, role, _temp2) {
19710
19517
  let {
19711
19518
  name
19712
19519
  } = _temp2 === void 0 ? {} : _temp2;
19713
19520
  return "Found multiple elements with the role \"" + role + "\"" + getNameHint(name);
19714
19521
  };
19715
-
19716
19522
  const getMissingError$1 = function (container, role, _temp3) {
19717
19523
  let {
19718
19524
  hidden = getConfig().defaultHidden,
19719
19525
  name,
19720
19526
  description
19721
19527
  } = _temp3 === void 0 ? {} : _temp3;
19722
-
19723
19528
  if (getConfig()._disableExpensiveErrorDiagnostics) {
19724
19529
  return "Unable to find role=\"" + role + "\"" + getNameHint(name);
19725
19530
  }
19726
-
19727
19531
  let roles = '';
19728
19532
  Array.from(container.children).forEach(childElement => {
19729
19533
  roles += prettyRoles(childElement, {
@@ -19732,7 +19536,6 @@ const getMissingError$1 = function (container, role, _temp3) {
19732
19536
  });
19733
19537
  });
19734
19538
  let roleMessage;
19735
-
19736
19539
  if (roles.length === 0) {
19737
19540
  if (hidden === false) {
19738
19541
  roleMessage = 'There are no accessible roles. But there might be some inaccessible roles. ' + 'If you wish to access them, then set the `hidden` option to `true`. ' + 'Learn more about this here: https://testing-library.com/docs/dom-testing-library/api-queries#byrole';
@@ -19742,9 +19545,7 @@ const getMissingError$1 = function (container, role, _temp3) {
19742
19545
  } else {
19743
19546
  roleMessage = ("\nHere are the " + (hidden === false ? 'accessible' : 'available') + " roles:\n\n " + roles.replace(/\n/g, '\n ').replace(/\n\s\s\n/g, '\n\n') + "\n").trim();
19744
19547
  }
19745
-
19746
19548
  let nameHint = '';
19747
-
19748
19549
  if (name === undefined) {
19749
19550
  nameHint = '';
19750
19551
  } else if (typeof name === 'string') {
@@ -19752,9 +19553,7 @@ const getMissingError$1 = function (container, role, _temp3) {
19752
19553
  } else {
19753
19554
  nameHint = " and name `" + name + "`";
19754
19555
  }
19755
-
19756
19556
  let descriptionHint = '';
19757
-
19758
19557
  if (description === undefined) {
19759
19558
  descriptionHint = '';
19760
19559
  } else if (typeof description === 'string') {
@@ -19762,28 +19561,21 @@ const getMissingError$1 = function (container, role, _temp3) {
19762
19561
  } else {
19763
19562
  descriptionHint = " and description `" + description + "`";
19764
19563
  }
19765
-
19766
19564
  return ("\nUnable to find an " + (hidden === false ? 'accessible ' : '') + "element with the role \"" + role + "\"" + nameHint + descriptionHint + "\n\n" + roleMessage).trim();
19767
19565
  };
19768
-
19769
19566
  const queryAllByRoleWithSuggestions = wrapAllByQueryWithSuggestion(queryAllByRole, queryAllByRole.name, 'queryAll');
19770
19567
  const [queryByRole, getAllByRole, getByRole, findAllByRole, findByRole] = buildQueries(queryAllByRole, getMultipleError$1, getMissingError$1);
19771
19568
 
19772
19569
  const getTestIdAttribute = () => getConfig().testIdAttribute;
19773
-
19774
19570
  const queryAllByTestId = function () {
19775
19571
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
19776
19572
  args[_key] = arguments[_key];
19777
19573
  }
19778
-
19779
19574
  checkContainerType$1(args[0]);
19780
19575
  return queryAllByAttribute(getTestIdAttribute(), ...args);
19781
19576
  };
19782
-
19783
19577
  const getMultipleError = (c, id) => "Found multiple elements by: [" + getTestIdAttribute() + "=\"" + id + "\"]";
19784
-
19785
19578
  const getMissingError = (c, id) => "Unable to find an element by: [" + getTestIdAttribute() + "=\"" + id + "\"]";
19786
-
19787
19579
  const queryAllByTestIdWithSuggestions = wrapAllByQueryWithSuggestion(queryAllByTestId, queryAllByTestId.name, 'queryAll');
19788
19580
  const [queryByTestId, getAllByTestId, getByTestId, findAllByTestId, findByTestId] = buildQueries(queryAllByTestId, getMultipleError, getMissingError);
19789
19581
 
@@ -19849,16 +19641,13 @@ var queries = /*#__PURE__*/Object.freeze({
19849
19641
  * @param {Object} initialValue for reducer
19850
19642
  * @returns {FuncMap} returns object of functions bound to container
19851
19643
  */
19852
-
19853
19644
  function getQueriesForElement(element, queries$1, initialValue) {
19854
19645
  if (queries$1 === void 0) {
19855
19646
  queries$1 = queries;
19856
19647
  }
19857
-
19858
19648
  if (initialValue === void 0) {
19859
19649
  initialValue = {};
19860
19650
  }
19861
-
19862
19651
  return Object.keys(queries$1).reduce((helpers, key) => {
19863
19652
  const fn = queries$1[key];
19864
19653
  helpers[key] = fn.bind(null, element);
@@ -19866,56 +19655,47 @@ function getQueriesForElement(element, queries$1, initialValue) {
19866
19655
  }, initialValue);
19867
19656
  }
19868
19657
 
19869
- const isRemoved = result => !result || Array.isArray(result) && !result.length; // Check if the element is not present.
19870
- // As the name implies, waitForElementToBeRemoved should check `present` --> `removed`
19871
-
19658
+ const isRemoved = result => !result || Array.isArray(result) && !result.length;
19872
19659
 
19660
+ // Check if the element is not present.
19661
+ // As the name implies, waitForElementToBeRemoved should check `present` --> `removed`
19873
19662
  function initialCheck(elements) {
19874
19663
  if (isRemoved(elements)) {
19875
19664
  throw new Error('The element(s) given to waitForElementToBeRemoved are already removed. waitForElementToBeRemoved requires that the element(s) exist(s) before waiting for removal.');
19876
19665
  }
19877
19666
  }
19878
-
19879
19667
  async function waitForElementToBeRemoved(callback, options) {
19880
19668
  // created here so we get a nice stacktrace
19881
19669
  const timeoutError = new Error('Timed out in waitForElementToBeRemoved.');
19882
-
19883
19670
  if (typeof callback !== 'function') {
19884
19671
  initialCheck(callback);
19885
19672
  const elements = Array.isArray(callback) ? callback : [callback];
19886
19673
  const getRemainingElements = elements.map(element => {
19887
19674
  let parent = element.parentElement;
19888
19675
  if (parent === null) return () => null;
19889
-
19890
19676
  while (parent.parentElement) parent = parent.parentElement;
19891
-
19892
19677
  return () => parent.contains(element) ? element : null;
19893
19678
  });
19894
-
19895
19679
  callback = () => getRemainingElements.map(c => c()).filter(Boolean);
19896
19680
  }
19897
-
19898
19681
  initialCheck(callback());
19899
19682
  return waitForWrapper(() => {
19900
19683
  let result;
19901
-
19902
19684
  try {
19903
19685
  result = callback();
19904
19686
  } catch (error) {
19905
19687
  if (error.name === 'TestingLibraryElementError') {
19906
19688
  return undefined;
19907
19689
  }
19908
-
19909
19690
  throw error;
19910
19691
  }
19911
-
19912
19692
  if (!isRemoved(result)) {
19913
19693
  throw timeoutError;
19914
19694
  }
19915
-
19916
19695
  return undefined;
19917
19696
  }, options);
19918
19697
  }
19698
+
19919
19699
  /*
19920
19700
  eslint
19921
19701
  require-await: "off"
@@ -20439,7 +20219,7 @@ const eventMap = {
20439
20219
  // Events
20440
20220
  load: {
20441
20221
  // TODO: load events can be UIEvent or Event depending on what generated them
20442
- // This is were this abstraction breaks down.
20222
+ // This is where this abstraction breaks down.
20443
20223
  // But the common targets are <img />, <script /> and window.
20444
20224
  // Neither of these targets receive a UIEvent
20445
20225
  EventType: 'Event',
@@ -20592,6 +20372,21 @@ const eventMap = {
20592
20372
  bubbles: true,
20593
20373
  cancelable: false
20594
20374
  }
20375
+ },
20376
+ // window events
20377
+ offline: {
20378
+ EventType: 'Event',
20379
+ defaultInit: {
20380
+ bubbles: false,
20381
+ cancelable: false
20382
+ }
20383
+ },
20384
+ online: {
20385
+ EventType: 'Event',
20386
+ defaultInit: {
20387
+ bubbles: false,
20388
+ cancelable: false
20389
+ }
20595
20390
  }
20596
20391
  };
20597
20392
  const eventAliasMap = {
@@ -20603,26 +20398,22 @@ function fireEvent(element, event) {
20603
20398
  if (!event) {
20604
20399
  throw new Error("Unable to fire an event - please provide an event object.");
20605
20400
  }
20606
-
20607
20401
  if (!element) {
20608
20402
  throw new Error("Unable to fire a \"" + event.type + "\" event - please provide a DOM element.");
20609
20403
  }
20610
-
20611
20404
  return element.dispatchEvent(event);
20612
20405
  });
20613
20406
  }
20614
-
20615
20407
  function createEvent(eventName, node, init, _temp) {
20616
20408
  let {
20617
20409
  EventType = 'Event',
20618
20410
  defaultInit = {}
20619
20411
  } = _temp === void 0 ? {} : _temp;
20620
-
20621
20412
  if (!node) {
20622
20413
  throw new Error("Unable to fire a \"" + eventName + "\" event - please provide a DOM element.");
20623
20414
  }
20624
-
20625
- const eventInit = { ...defaultInit,
20415
+ const eventInit = {
20416
+ ...defaultInit,
20626
20417
  ...init
20627
20418
  };
20628
20419
  const {
@@ -20632,11 +20423,9 @@ function createEvent(eventName, node, init, _temp) {
20632
20423
  ...targetProperties
20633
20424
  } = {}
20634
20425
  } = eventInit;
20635
-
20636
20426
  if (value !== undefined) {
20637
20427
  setNativeValue(node, value);
20638
20428
  }
20639
-
20640
20429
  if (files !== undefined) {
20641
20430
  // input.files is a read-only property so this is not allowed:
20642
20431
  // input.files = [file]
@@ -20648,13 +20437,11 @@ function createEvent(eventName, node, init, _temp) {
20648
20437
  value: files
20649
20438
  });
20650
20439
  }
20651
-
20652
20440
  Object.assign(node, targetProperties);
20653
20441
  const window = getWindowFromNode$1(node);
20654
20442
  const EventConstructor = window[EventType] || window.Event;
20655
20443
  let event;
20656
20444
  /* istanbul ignore else */
20657
-
20658
20445
  if (typeof EventConstructor === 'function') {
20659
20446
  event = new EventConstructor(eventName, eventInit);
20660
20447
  } else {
@@ -20670,13 +20457,12 @@ function createEvent(eventName, node, init, _temp) {
20670
20457
  Object.keys(otherInit).forEach(eventKey => {
20671
20458
  event[eventKey] = otherInit[eventKey];
20672
20459
  });
20673
- } // DataTransfer is not supported in jsdom: https://github.com/jsdom/jsdom/issues/1568
20674
-
20460
+ }
20675
20461
 
20462
+ // DataTransfer is not supported in jsdom: https://github.com/jsdom/jsdom/issues/1568
20676
20463
  const dataTransferProperties = ['dataTransfer', 'clipboardData'];
20677
20464
  dataTransferProperties.forEach(dataTransferKey => {
20678
20465
  const dataTransferValue = eventInit[dataTransferKey];
20679
-
20680
20466
  if (typeof dataTransferValue === 'object') {
20681
20467
  /* istanbul ignore if */
20682
20468
  if (typeof window.DataTransfer === 'function') {
@@ -20697,23 +20483,21 @@ function createEvent(eventName, node, init, _temp) {
20697
20483
  });
20698
20484
  return event;
20699
20485
  }
20700
-
20701
20486
  Object.keys(eventMap).forEach(key => {
20702
20487
  const {
20703
20488
  EventType,
20704
20489
  defaultInit
20705
20490
  } = eventMap[key];
20706
20491
  const eventName = key.toLowerCase();
20707
-
20708
20492
  createEvent[key] = (node, init) => createEvent(eventName, node, init, {
20709
20493
  EventType,
20710
20494
  defaultInit
20711
20495
  });
20712
-
20713
20496
  fireEvent[key] = (node, init) => fireEvent(node, createEvent[key](node, init));
20714
- }); // function written after some investigation here:
20715
- // https://github.com/facebook/react/issues/10135#issuecomment-401496776
20497
+ });
20716
20498
 
20499
+ // function written after some investigation here:
20500
+ // https://github.com/facebook/react/issues/10135#issuecomment-401496776
20717
20501
  function setNativeValue(element, value) {
20718
20502
  const {
20719
20503
  set: valueSetter
@@ -20722,7 +20506,6 @@ function setNativeValue(element, value) {
20722
20506
  const {
20723
20507
  set: prototypeValueSetter
20724
20508
  } = Object.getOwnPropertyDescriptor(prototype, 'value') || {};
20725
-
20726
20509
  if (prototypeValueSetter && valueSetter !== prototypeValueSetter) {
20727
20510
  prototypeValueSetter.call(element, value);
20728
20511
  } else {
@@ -20735,56 +20518,46 @@ function setNativeValue(element, value) {
20735
20518
  }
20736
20519
  }
20737
20520
  }
20738
-
20739
20521
  Object.keys(eventAliasMap).forEach(aliasKey => {
20740
20522
  const key = eventAliasMap[aliasKey];
20741
-
20742
20523
  fireEvent[aliasKey] = function () {
20743
20524
  return fireEvent[key](...arguments);
20744
20525
  };
20745
20526
  });
20527
+
20746
20528
  /* eslint complexity:["error", 9] */
20747
20529
 
20748
20530
  // WARNING: `lz-string` only has a default export but statically we assume named exports are allowd
20749
-
20750
20531
  function unindent(string) {
20751
20532
  // remove white spaces first, to save a few bytes.
20752
20533
  // testing-playground will reformat on load any ways.
20753
20534
  return string.replace(/[ \t]*[\n][ \t]*/g, '\n');
20754
20535
  }
20755
-
20756
20536
  function encode(value) {
20757
20537
  return lzString.compressToEncodedURIComponent(unindent(value));
20758
20538
  }
20759
-
20760
20539
  function getPlaygroundUrl(markup) {
20761
20540
  return "https://testing-playground.com/#markup=" + encode(markup);
20762
20541
  }
20763
-
20764
20542
  const debug = (element, maxLength, options) => Array.isArray(element) ? element.forEach(el => logDOM(el, maxLength, options)) : logDOM(element, maxLength, options);
20765
-
20766
20543
  const logTestingPlaygroundURL = function (element) {
20767
20544
  if (element === void 0) {
20768
20545
  element = getDocument$1().body;
20769
20546
  }
20770
-
20771
20547
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
20772
20548
  if (!element || !('innerHTML' in element)) {
20773
20549
  console.log("The element you're providing isn't a valid DOM element.");
20774
20550
  return;
20775
- } // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
20776
-
20777
-
20551
+ }
20552
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
20778
20553
  if (!element.innerHTML) {
20779
20554
  console.log("The provided element doesn't have any children.");
20780
20555
  return;
20781
20556
  }
20782
-
20783
20557
  const playgroundUrl = getPlaygroundUrl(element.innerHTML);
20784
20558
  console.log("Open this URL in your browser\n\n" + playgroundUrl);
20785
20559
  return playgroundUrl;
20786
20560
  };
20787
-
20788
20561
  const initialValue = {
20789
20562
  debug,
20790
20563
  logTestingPlaygroundURL
@@ -20797,13 +20570,11 @@ const screen = typeof document !== 'undefined' && document.body // eslint-disabl
20797
20570
  helpers[key] = () => {
20798
20571
  throw new TypeError('For queries bound to document.body a global document has to be available... Learn more: https://testing-library.com/s/screen-global-error');
20799
20572
  };
20800
-
20801
20573
  return helpers;
20802
20574
  }, initialValue);
20803
20575
 
20804
20576
  var dom_esm = /*#__PURE__*/Object.freeze({
20805
20577
  __proto__: null,
20806
- prettyFormat: index,
20807
20578
  buildQueries: buildQueries,
20808
20579
  configure: configure,
20809
20580
  createEvent: createEvent,
@@ -20855,6 +20626,7 @@ var dom_esm = /*#__PURE__*/Object.freeze({
20855
20626
  makeGetAllQuery: makeGetAllQuery,
20856
20627
  makeSingleQuery: makeSingleQuery,
20857
20628
  prettyDOM: prettyDOM,
20629
+ prettyFormat: index,
20858
20630
  queries: queries,
20859
20631
  queryAllByAltText: queryAllByAltTextWithSuggestions,
20860
20632
  queryAllByAttribute: queryAllByAttribute,
@@ -21746,30 +21518,27 @@ helpers.jestFakeTimersAreEnabled = jestFakeTimersAreEnabled;
21746
21518
  // https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType#Node_type_constants
21747
21519
  const TEXT_NODE = 3;
21748
21520
  helpers.TEXT_NODE = TEXT_NODE;
21749
-
21750
21521
  function jestFakeTimersAreEnabled() {
21751
21522
  /* istanbul ignore else */
21752
21523
  // eslint-disable-next-line
21753
21524
  if (typeof jest !== 'undefined' && jest !== null) {
21754
- return (// legacy timers
21755
- setTimeout._isMockFunction === true || // modern timers
21525
+ return (
21526
+ // legacy timers
21527
+ setTimeout._isMockFunction === true ||
21528
+ // modern timers
21756
21529
  Object.prototype.hasOwnProperty.call(setTimeout, 'clock')
21757
21530
  );
21758
- } // istanbul ignore next
21759
-
21760
-
21531
+ }
21532
+ // istanbul ignore next
21761
21533
  return false;
21762
21534
  }
21763
-
21764
21535
  function getDocument() {
21765
21536
  /* istanbul ignore if */
21766
21537
  if (typeof window === 'undefined') {
21767
21538
  throw new Error('Could not find default container');
21768
21539
  }
21769
-
21770
21540
  return window.document;
21771
21541
  }
21772
-
21773
21542
  function getWindowFromNode(node) {
21774
21543
  if (node.defaultView) {
21775
21544
  // node is document
@@ -21793,17 +21562,14 @@ function getWindowFromNode(node) {
21793
21562
  throw new Error(`The given node is not an Element, the node type is: ${typeof node}.`);
21794
21563
  }
21795
21564
  }
21796
-
21797
21565
  function checkContainerType(container) {
21798
21566
  if (!container || !(typeof container.querySelector === 'function') || !(typeof container.querySelectorAll === 'function')) {
21799
21567
  throw new TypeError(`Expected container to be an Element, a Document or a DocumentFragment but got ${getTypeName(container)}.`);
21800
21568
  }
21801
-
21802
21569
  function getTypeName(object) {
21803
21570
  if (typeof object === 'object') {
21804
21571
  return object === null ? 'null' : object.constructor.name;
21805
21572
  }
21806
-
21807
21573
  return typeof object;
21808
21574
  }
21809
21575
  }
@@ -24836,6 +24602,7 @@ var clickMenuOption = function (menuOptionText) { return __awaiter(void 0, void
24836
24602
  case 0: return [4 /*yield*/, findMenuOption(menuOptionText)];
24837
24603
  case 1:
24838
24604
  menuOption = _a.sent();
24605
+ // eslint-disable-next-line testing-library/await-async-utils
24839
24606
  userEvent.click(menuOption);
24840
24607
  return [2 /*return*/];
24841
24608
  }