@pingux/astro 2.212.1 → 2.213.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/DatePicker/DatePicker.js +11 -18
- package/lib/cjs/components/DatePicker/DatePicker.test.js +1 -1
- package/lib/cjs/components/MultivaluesField/CondensedMultivaluesField.js +19 -34
- package/lib/cjs/components/MultivaluesField/DefaultMultivaluesField.js +17 -32
- package/lib/cjs/components/MultivaluesField/MultivaluesField.test.js +180 -2
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.js +5 -5
- package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +8 -6
- package/lib/cjs/styles/themes/next-gen/variants/button.d.ts +1 -0
- package/lib/cjs/styles/themes/next-gen/variants/button.js +1 -0
- package/lib/cjs/styles/themes/next-gen/variants/text.d.ts +1 -0
- package/lib/cjs/styles/themes/next-gen/variants/text.js +2 -1
- package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +6 -6
- package/lib/cjs/styles/themes/next-gen/variants/variants.js +8 -8
- package/lib/components/DatePicker/DatePicker.js +12 -19
- package/lib/components/DatePicker/DatePicker.test.js +1 -1
- package/lib/components/MultivaluesField/CondensedMultivaluesField.js +22 -37
- package/lib/components/MultivaluesField/DefaultMultivaluesField.js +19 -34
- package/lib/components/MultivaluesField/MultivaluesField.test.js +181 -3
- package/lib/styles/themeOverrides/nextGenDarkMode/variants/variants.js +5 -5
- package/lib/styles/themes/next-gen/variants/button.js +1 -0
- package/lib/styles/themes/next-gen/variants/text.js +2 -1
- package/lib/styles/themes/next-gen/variants/variants.js +8 -8
- package/package.json +1 -1
|
@@ -22,12 +22,12 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
22
22
|
var _date = require("@internationalized/date");
|
|
23
23
|
var _datepicker = require("@react-aria/datepicker");
|
|
24
24
|
var _focus = require("@react-aria/focus");
|
|
25
|
-
var _overlays = require("@react-aria/overlays");
|
|
26
25
|
var _utils = require("@react-aria/utils");
|
|
27
26
|
var _datepicker2 = require("@react-stately/datepicker");
|
|
28
27
|
var _object = require("lodash/object");
|
|
29
28
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
30
29
|
var _index = require("../../index");
|
|
30
|
+
var _Popover = _interopRequireDefault(require("../Popover/Popover"));
|
|
31
31
|
var _pendoID = require("../../utils/devUtils/constants/pendoID");
|
|
32
32
|
var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
|
|
33
33
|
var _isDateWithinRanges = require("../../utils/devUtils/props/isDateWithinRanges");
|
|
@@ -86,31 +86,24 @@ var DatePicker = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
86
86
|
fieldProps = _useDatePicker.fieldProps,
|
|
87
87
|
groupProps = _useDatePicker.groupProps,
|
|
88
88
|
labelProps = _useDatePicker.labelProps;
|
|
89
|
-
var
|
|
90
|
-
targetRef: groupRef,
|
|
91
|
-
overlayRef: popoverRef,
|
|
92
|
-
offset: 15,
|
|
93
|
-
crossOffset: 40,
|
|
94
|
-
isOpen: state.isOpen,
|
|
95
|
-
onClose: state.setOpen,
|
|
96
|
-
shouldUpdatePosition: true
|
|
97
|
-
}),
|
|
98
|
-
positionProps = _useOverlayPosition.overlayProps;
|
|
99
|
-
var calendar = !isReadOnly && (0, _react2.jsx)(_index.PopoverContainer, (0, _extends2["default"])({
|
|
89
|
+
var calendar = !isReadOnly && (0, _react2.jsx)(_Popover["default"], {
|
|
100
90
|
hasNoArrow: true,
|
|
101
91
|
isDismissable: true,
|
|
102
92
|
isNonModal: true,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
93
|
+
popoverRef: popoverRef,
|
|
94
|
+
triggerRef: groupRef,
|
|
95
|
+
state: state,
|
|
96
|
+
offset: 15,
|
|
97
|
+
crossOffset: 40,
|
|
98
|
+
"data-testid": "popover-container",
|
|
106
99
|
overflow: "auto"
|
|
107
|
-
}, (0,
|
|
100
|
+
}, (0, _react2.jsx)(_focus.FocusScope, {
|
|
108
101
|
autoFocus: true,
|
|
109
102
|
contain: true,
|
|
110
103
|
restoreFocus: true
|
|
111
|
-
}, (0, _react2.jsx)(_index.Calendar, (0, _extends2["default"])({}, calendarProps, {
|
|
104
|
+
}, (0, _react2.jsx)("div", dialogProps, (0, _react2.jsx)(_index.Calendar, (0, _extends2["default"])({}, calendarProps, {
|
|
112
105
|
calendarWrapperProps: calendarWrapperProps
|
|
113
|
-
}))));
|
|
106
|
+
})))));
|
|
114
107
|
return (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_DateField["default"], (0, _extends2["default"])({}, (0, _pendoID.getPendoID)('DatePicker'), props, {
|
|
115
108
|
ref: ref,
|
|
116
109
|
buttonProps: buttonProps,
|
|
@@ -219,7 +219,7 @@ test('should be able to select dates', /*#__PURE__*/(0, _asyncToGenerator2["defa
|
|
|
219
219
|
return _userEvent["default"].click(_testWrapper.screen.queryByRole('button'));
|
|
220
220
|
case 4:
|
|
221
221
|
dateButtons = _testWrapper.screen.queryAllByRole('button');
|
|
222
|
-
expect(dateButtons).toHaveLength(
|
|
222
|
+
expect(dateButtons).toHaveLength(38);
|
|
223
223
|
expect(dateButtons[5]).toHaveAttribute('aria-label', 'Monday, August 1, 2022');
|
|
224
224
|
_context4.next = 9;
|
|
225
225
|
return _userEvent["default"].click(dateButtons[5]);
|
|
@@ -43,6 +43,7 @@ var _ariaAttributes = require("../../utils/docUtils/ariaAttributes");
|
|
|
43
43
|
var _fieldAttributes = require("../../utils/docUtils/fieldAttributes");
|
|
44
44
|
var _statusProp = require("../../utils/docUtils/statusProp");
|
|
45
45
|
var _ListBox = _interopRequireDefault(require("../ListBox"));
|
|
46
|
+
var _Popover = _interopRequireDefault(require("../Popover/Popover"));
|
|
46
47
|
var _react2 = require("@emotion/react");
|
|
47
48
|
var _excluded = ["defaultSelectedKeys", "direction", "disabledKeys", "containerProps", "filter", "hasAutoFocus", "hasNoSelectAll", "hasNoStatusIndicator", "helperText", "inputProps", "isDisabled", "isFilteringDisabled", "isNotFlippable", "isReadOnly", "isRequired", "items", "label", "loadingState", "mode", "onBlur", "onFocus", "onInputChange", "onKeyDown", "onKeyUp", "onLoadMore", "onLoadPrev", "onOpenChange", "onSelectionChange", "placeholder", "selectedKeys", "selectedOptionText", "scrollBoxProps", "status"];
|
|
48
49
|
function _interopRequireWildcard(e, t) { if ("function" == typeof _WeakMap) var r = new _WeakMap(), n = new _WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
@@ -171,30 +172,6 @@ var CondensedMultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (pr
|
|
|
171
172
|
});
|
|
172
173
|
var listBoxRef = (0, _react.useRef)();
|
|
173
174
|
var popoverRef = (0, _react.useRef)();
|
|
174
|
-
var _useOverlayPosition = (0, _reactAria.useOverlayPosition)({
|
|
175
|
-
isOpen: isOpen,
|
|
176
|
-
onClose: close,
|
|
177
|
-
offset: 1,
|
|
178
|
-
overlayRef: popoverRef,
|
|
179
|
-
placement: "".concat(direction, " end"),
|
|
180
|
-
scrollRef: listBoxRef,
|
|
181
|
-
shouldFlip: !isNotFlippable,
|
|
182
|
-
targetRef: inputWrapperRef
|
|
183
|
-
}),
|
|
184
|
-
overlayProps = _useOverlayPosition.overlayProps,
|
|
185
|
-
placement = _useOverlayPosition.placement,
|
|
186
|
-
updatePosition = _useOverlayPosition.updatePosition;
|
|
187
|
-
|
|
188
|
-
// Update position once the ListBox has rendered. This ensures that
|
|
189
|
-
// it flips properly when it doesn't fit in the available space.
|
|
190
|
-
/* istanbul ignore next */
|
|
191
|
-
(0, _utils.useLayoutEffect)(function () {
|
|
192
|
-
if (isOpen) {
|
|
193
|
-
requestAnimationFrame(function () {
|
|
194
|
-
updatePosition();
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
}, [isOpen, selectionManager.selectedKeys, updatePosition]);
|
|
198
175
|
|
|
199
176
|
// Measure the width of the input to inform the width of the menu (below).
|
|
200
177
|
var _useState9 = (0, _react.useState)(null),
|
|
@@ -212,10 +189,16 @@ var CondensedMultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (pr
|
|
|
212
189
|
onResize: onResize
|
|
213
190
|
});
|
|
214
191
|
(0, _utils.useLayoutEffect)(onResize, [onResize]);
|
|
215
|
-
var
|
|
192
|
+
var menuWidthSx = {
|
|
216
193
|
width: menuWidth,
|
|
217
194
|
minWidth: menuWidth
|
|
218
|
-
}
|
|
195
|
+
};
|
|
196
|
+
var popoverState = (0, _react.useMemo)(function () {
|
|
197
|
+
return {
|
|
198
|
+
isOpen: !state.collection.size ? false : isOpen,
|
|
199
|
+
close: close
|
|
200
|
+
};
|
|
201
|
+
}, [state.collection.size, isOpen, close]);
|
|
219
202
|
(0, _react.useEffect)(function () {
|
|
220
203
|
if (defaultSelectedKeys) selectionManager.setSelectedKeys(defaultSelectedKeys);
|
|
221
204
|
}, []);
|
|
@@ -317,7 +300,7 @@ var CondensedMultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (pr
|
|
|
317
300
|
}
|
|
318
301
|
}, selectionState), (0, _react2.jsx)(_reactAria.DismissButton, {
|
|
319
302
|
onDismiss: close
|
|
320
|
-
}), (0, _react2.jsx)(_.ScrollBox, scrollBoxProps, (0, _react2.jsx)(_ListBox["default"],
|
|
303
|
+
}), (0, _react2.jsx)(_.ScrollBox, scrollBoxProps, (0, _react2.jsx)(_ListBox["default"], {
|
|
321
304
|
ref: listBoxRef,
|
|
322
305
|
hasAutoFocus: hasAutoFocus,
|
|
323
306
|
hasNoEmptySelection: true,
|
|
@@ -328,7 +311,7 @@ var CondensedMultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (pr
|
|
|
328
311
|
isLoading: loadingState === _loadingStates["default"].LOADING_MORE,
|
|
329
312
|
"aria-label": "List of options",
|
|
330
313
|
isCondensed: mode === 'condensed'
|
|
331
|
-
}
|
|
314
|
+
})), (0, _react2.jsx)(_reactAria.DismissButton, {
|
|
332
315
|
onDismiss: close
|
|
333
316
|
}));
|
|
334
317
|
var visuallyHidden = (0, _react2.jsx)(_visuallyHidden.VisuallyHidden, {
|
|
@@ -439,14 +422,16 @@ var CondensedMultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (pr
|
|
|
439
422
|
value: filterString,
|
|
440
423
|
helperText: helperText,
|
|
441
424
|
"aria-invalid": status === 'error' && true
|
|
442
|
-
}, (0, _pendoID.getPendoID)('MultivaluesField'), others, inputProps)), (0, _react2.jsx)(
|
|
425
|
+
}, (0, _pendoID.getPendoID)('MultivaluesField'), others, inputProps)), (0, _react2.jsx)(_Popover["default"], {
|
|
443
426
|
hasNoArrow: true,
|
|
444
427
|
isNonModal: true,
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
428
|
+
popoverRef: popoverRef,
|
|
429
|
+
triggerRef: inputWrapperRef,
|
|
430
|
+
state: popoverState,
|
|
431
|
+
placement: "".concat(direction, " end"),
|
|
432
|
+
shouldFlip: !isNotFlippable,
|
|
433
|
+
scrollRef: listBoxRef,
|
|
434
|
+
sx: menuWidthSx,
|
|
450
435
|
onBlur: function onBlur(e) {
|
|
451
436
|
return handleBlur(e);
|
|
452
437
|
}
|
|
@@ -45,6 +45,7 @@ var _ariaAttributes = require("../../utils/docUtils/ariaAttributes");
|
|
|
45
45
|
var _fieldAttributes = require("../../utils/docUtils/fieldAttributes");
|
|
46
46
|
var _statusProp = require("../../utils/docUtils/statusProp");
|
|
47
47
|
var _ListBox = _interopRequireDefault(require("../ListBox"));
|
|
48
|
+
var _Popover = _interopRequireDefault(require("../Popover/Popover"));
|
|
48
49
|
var _BadgeLabelTooltip = _interopRequireDefault(require("./BadgeLabelTooltip"));
|
|
49
50
|
var _react2 = require("@emotion/react");
|
|
50
51
|
var _excluded = ["items"],
|
|
@@ -172,30 +173,6 @@ var DefaultMultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (prop
|
|
|
172
173
|
});
|
|
173
174
|
var listBoxRef = (0, _react.useRef)();
|
|
174
175
|
var popoverRef = (0, _react.useRef)();
|
|
175
|
-
var _useOverlayPosition = (0, _reactAria.useOverlayPosition)({
|
|
176
|
-
isOpen: isOpen,
|
|
177
|
-
onClose: close,
|
|
178
|
-
offset: 1,
|
|
179
|
-
overlayRef: popoverRef,
|
|
180
|
-
placement: "".concat(direction, " end"),
|
|
181
|
-
scrollRef: listBoxRef,
|
|
182
|
-
shouldFlip: !isNotFlippable,
|
|
183
|
-
targetRef: inputWrapperRef
|
|
184
|
-
}),
|
|
185
|
-
overlayProps = _useOverlayPosition.overlayProps,
|
|
186
|
-
placement = _useOverlayPosition.placement,
|
|
187
|
-
updatePosition = _useOverlayPosition.updatePosition;
|
|
188
|
-
|
|
189
|
-
// Update position once the ListBox has rendered. This ensures that
|
|
190
|
-
// it flips properly when it doesn't fit in the available space.
|
|
191
|
-
/* istanbul ignore next */
|
|
192
|
-
(0, _utils.useLayoutEffect)(function () {
|
|
193
|
-
if (isOpen) {
|
|
194
|
-
requestAnimationFrame(function () {
|
|
195
|
-
updatePosition();
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
}, [isOpen, selectionManager.selectedKeys, updatePosition]);
|
|
199
176
|
|
|
200
177
|
// Measure the width of the input to inform the width of the menu (below).
|
|
201
178
|
var _useState1 = (0, _react.useState)(null),
|
|
@@ -213,10 +190,16 @@ var DefaultMultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (prop
|
|
|
213
190
|
onResize: onResize
|
|
214
191
|
});
|
|
215
192
|
(0, _utils.useLayoutEffect)(onResize, [onResize]);
|
|
216
|
-
var
|
|
193
|
+
var menuWidthSx = {
|
|
217
194
|
width: menuWidth,
|
|
218
195
|
minWidth: menuWidth
|
|
219
|
-
}
|
|
196
|
+
};
|
|
197
|
+
var popoverState = (0, _react.useMemo)(function () {
|
|
198
|
+
return {
|
|
199
|
+
isOpen: !state.collection.size ? false : isOpen,
|
|
200
|
+
close: close
|
|
201
|
+
};
|
|
202
|
+
}, [state.collection.size, isOpen, close]);
|
|
220
203
|
(0, _react.useEffect)(function () {
|
|
221
204
|
if (defaultSelectedKeys) {
|
|
222
205
|
selectionManager.setSelectedKeys(defaultSelectedKeys);
|
|
@@ -540,14 +523,16 @@ var DefaultMultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (prop
|
|
|
540
523
|
value: filterString,
|
|
541
524
|
helperText: helperText,
|
|
542
525
|
"aria-invalid": status === 'error' && true
|
|
543
|
-
}, (0, _pendoID.getPendoID)('MultivaluesField'), others, inputProps)), (0, _react2.jsx)(
|
|
526
|
+
}, (0, _pendoID.getPendoID)('MultivaluesField'), others, inputProps)), (0, _react2.jsx)(_Popover["default"], {
|
|
544
527
|
hasNoArrow: true,
|
|
545
528
|
isNonModal: true,
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
529
|
+
popoverRef: popoverRef,
|
|
530
|
+
triggerRef: inputWrapperRef,
|
|
531
|
+
state: popoverState,
|
|
532
|
+
placement: "".concat(direction, " end"),
|
|
533
|
+
shouldFlip: !isNotFlippable,
|
|
534
|
+
scrollRef: listBoxRef,
|
|
535
|
+
sx: menuWidthSx
|
|
551
536
|
}, listbox), (0, _react2.jsx)(EmptyVisuallyHidden, null)));
|
|
552
537
|
});
|
|
553
538
|
DefaultMultivaluesField.propTypes = _objectSpread(_objectSpread(_objectSpread({
|
|
@@ -24,6 +24,8 @@ var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable
|
|
|
24
24
|
var _fill = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/fill"));
|
|
25
25
|
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
26
26
|
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
27
|
+
var _from = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/from"));
|
|
28
|
+
var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
|
|
27
29
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
28
30
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
|
|
29
31
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
|
@@ -38,7 +40,7 @@ var _universalFormSubmitTest = require("../../utils/testUtils/universalFormSubmi
|
|
|
38
40
|
var _react2 = require("@emotion/react");
|
|
39
41
|
function _interopRequireWildcard(e, t) { if ("function" == typeof _WeakMap) var r = new _WeakMap(), n = new _WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
40
42
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
41
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
43
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context63, _context64; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty2(_context63 = ownKeys(Object(t), !0)).call(_context63, function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty2(_context64 = ownKeys(Object(t))).call(_context64, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
42
44
|
function _regeneratorRuntime() { "use strict"; var r = _regenerator(), e = r.m(_regeneratorRuntime), t = (_Object$getPrototypeOf ? _Object$getPrototypeOf(e) : e.__proto__).constructor; function n(r) { var e = "function" == typeof r && r.constructor; return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name)); } var o = { "throw": 1, "return": 2, "break": 3, "continue": 3 }; function a(r) { var e, t; return function (n) { e || (e = { stop: function stop() { return t(n.a, 2); }, "catch": function _catch() { return n.v; }, abrupt: function abrupt(r, e) { return t(n.a, o[r], e); }, delegateYield: function delegateYield(r, o, a) { return e.resultName = o, t(n.d, _regeneratorValues(r), a); }, finish: function finish(r) { return t(n.f, r); } }, t = function t(r, _t, o) { n.p = e.prev, n.n = e.next; try { return r(_t, o); } finally { e.next = n.n; } }), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n; try { return r.call(this, e); } finally { n.p = e.prev, n.n = e.next; } }; } return (_regeneratorRuntime = function _regeneratorRuntime() { return { wrap: function wrap(e, t, n, o) { return r.w(a(e), t, n, o && _reverseInstanceProperty(o).call(o)); }, isGeneratorFunction: n, mark: r.m, awrap: function awrap(r, e) { return new _OverloadYield(r, e); }, AsyncIterator: _regeneratorAsyncIterator, async: function async(r, e, t, o, u) { return (n(e) ? _regeneratorAsyncGen : _regeneratorAsync)(a(r), e, t, o, u); }, keys: _regeneratorKeys, values: _regeneratorValues }; })(); }
|
|
43
45
|
function _regeneratorValues(e) { if (null != e) { var t = e["function" == typeof _Symbol && _Symbol$iterator || "@@iterator"], r = 0; if (t) return t.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) return { next: function next() { return e && r >= e.length && (e = void 0), { value: e && e[r++], done: !e }; } }; } throw new TypeError(_typeof(e) + " is not iterable"); }
|
|
44
46
|
function _regeneratorKeys(e) { var n = Object(e), r = []; for (var t in n) r.unshift(t); return function e() { for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = !1, e; return e.done = !0, e; }; }
|
|
@@ -2084,4 +2086,180 @@ test('in condensed mode, arrow icon SVG has an empty title element so no tooltip
|
|
|
2084
2086
|
var titleElement = arrowIconSvg.querySelector('title');
|
|
2085
2087
|
expect(titleElement).toBeInTheDocument();
|
|
2086
2088
|
expect(titleElement).toHaveTextContent('');
|
|
2087
|
-
});
|
|
2089
|
+
});
|
|
2090
|
+
test('MultivaluesField and DatePicker popovers open correctly when inside a Modal (UXE-8666)', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee59() {
|
|
2091
|
+
var multivaluesFieldItems, ModalApp, combobox, listbox, node, datepickerPopover, dateButtons, firstAvailableDate;
|
|
2092
|
+
return _regeneratorRuntime().wrap(function _callee59$(_context62) {
|
|
2093
|
+
while (1) switch (_context62.prev = _context62.next) {
|
|
2094
|
+
case 0:
|
|
2095
|
+
multivaluesFieldItems = [{
|
|
2096
|
+
id: 1,
|
|
2097
|
+
key: 'Aardvark',
|
|
2098
|
+
name: 'Aardvark'
|
|
2099
|
+
}, {
|
|
2100
|
+
id: 2,
|
|
2101
|
+
key: 'Kangaroo',
|
|
2102
|
+
name: 'Kangaroo'
|
|
2103
|
+
}, {
|
|
2104
|
+
id: 3,
|
|
2105
|
+
key: 'Snake',
|
|
2106
|
+
name: 'Snake'
|
|
2107
|
+
}];
|
|
2108
|
+
ModalApp = function ModalApp() {
|
|
2109
|
+
var _useState3 = (0, _react.useState)(false),
|
|
2110
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
2111
|
+
isOpen = _useState4[0],
|
|
2112
|
+
setIsOpen = _useState4[1];
|
|
2113
|
+
var _useState5 = (0, _react.useState)([]),
|
|
2114
|
+
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
2115
|
+
selectedKeys = _useState6[0],
|
|
2116
|
+
setSelectedKeys = _useState6[1];
|
|
2117
|
+
var _useState7 = (0, _react.useState)(null),
|
|
2118
|
+
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
|
|
2119
|
+
selectedDate = _useState8[0],
|
|
2120
|
+
setSelectedDate = _useState8[1];
|
|
2121
|
+
return (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_index.Button, {
|
|
2122
|
+
onPress: function onPress() {
|
|
2123
|
+
return setIsOpen(true);
|
|
2124
|
+
}
|
|
2125
|
+
}, "Launch Modal"), isOpen && (0, _react2.jsx)(_index.Modal, {
|
|
2126
|
+
title: "test",
|
|
2127
|
+
isOpen: isOpen,
|
|
2128
|
+
onClose: function onClose() {
|
|
2129
|
+
return setIsOpen(false);
|
|
2130
|
+
},
|
|
2131
|
+
hasCloseButton: true,
|
|
2132
|
+
isDismissable: true
|
|
2133
|
+
}, (0, _react2.jsx)(_index.MultivaluesField, {
|
|
2134
|
+
label: "Test Multivalues",
|
|
2135
|
+
items: multivaluesFieldItems,
|
|
2136
|
+
selectedKeys: selectedKeys,
|
|
2137
|
+
onSelectionChange: function onSelectionChange(keys) {
|
|
2138
|
+
var _context57;
|
|
2139
|
+
return setSelectedKeys((0, _map["default"])(_context57 = (0, _from["default"])(keys)).call(_context57, function (k) {
|
|
2140
|
+
return k.toString();
|
|
2141
|
+
}));
|
|
2142
|
+
},
|
|
2143
|
+
mode: "non-restrictive"
|
|
2144
|
+
}, function (item) {
|
|
2145
|
+
return (0, _react2.jsx)(_index.Item, {
|
|
2146
|
+
key: item.key,
|
|
2147
|
+
"data-id": item.name,
|
|
2148
|
+
"aria-label": item.name
|
|
2149
|
+
}, item.name);
|
|
2150
|
+
}), (0, _react2.jsx)(_index.DatePicker, {
|
|
2151
|
+
label: "Select a date",
|
|
2152
|
+
value: selectedDate,
|
|
2153
|
+
onChange: setSelectedDate
|
|
2154
|
+
})));
|
|
2155
|
+
};
|
|
2156
|
+
(0, _testWrapper.render)((0, _react2.jsx)(_index.OverlayProvider, null, (0, _react2.jsx)(ModalApp, null)));
|
|
2157
|
+
_context62.next = 5;
|
|
2158
|
+
return _userEvent["default"].click(_testWrapper.screen.getByRole('button', {
|
|
2159
|
+
name: 'Launch Modal'
|
|
2160
|
+
}));
|
|
2161
|
+
case 5:
|
|
2162
|
+
expect(_testWrapper.screen.getByRole('dialog')).toBeInTheDocument();
|
|
2163
|
+
|
|
2164
|
+
// MultivaluesField: focus opens the listbox
|
|
2165
|
+
combobox = _testWrapper.screen.getByRole('combobox');
|
|
2166
|
+
_context62.next = 9;
|
|
2167
|
+
return (0, _testWrapper.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee55() {
|
|
2168
|
+
return _regeneratorRuntime().wrap(function _callee55$(_context58) {
|
|
2169
|
+
while (1) switch (_context58.prev = _context58.next) {
|
|
2170
|
+
case 0:
|
|
2171
|
+
combobox.focus();
|
|
2172
|
+
case 1:
|
|
2173
|
+
case "end":
|
|
2174
|
+
return _context58.stop();
|
|
2175
|
+
}
|
|
2176
|
+
}, _callee55);
|
|
2177
|
+
})));
|
|
2178
|
+
case 9:
|
|
2179
|
+
_context62.next = 11;
|
|
2180
|
+
return (0, _testWrapper.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee56() {
|
|
2181
|
+
return _regeneratorRuntime().wrap(function _callee56$(_context59) {
|
|
2182
|
+
while (1) switch (_context59.prev = _context59.next) {
|
|
2183
|
+
case 0:
|
|
2184
|
+
case "end":
|
|
2185
|
+
return _context59.stop();
|
|
2186
|
+
}
|
|
2187
|
+
}, _callee56);
|
|
2188
|
+
})));
|
|
2189
|
+
case 11:
|
|
2190
|
+
listbox = _testWrapper.screen.queryByRole('listbox');
|
|
2191
|
+
expect(listbox).toBeInTheDocument();
|
|
2192
|
+
|
|
2193
|
+
/* eslint-disable testing-library/no-node-access */
|
|
2194
|
+
node = listbox;
|
|
2195
|
+
while (node && node !== document.body) {
|
|
2196
|
+
expect(node).not.toHaveAttribute('aria-hidden', 'true');
|
|
2197
|
+
node = node.parentElement;
|
|
2198
|
+
}
|
|
2199
|
+
/* eslint-enable testing-library/no-node-access */
|
|
2200
|
+
|
|
2201
|
+
// Click an option — verify it is selectable (option disappears and a badge appears)
|
|
2202
|
+
_context62.next = 17;
|
|
2203
|
+
return _userEvent["default"].click(_testWrapper.screen.getByRole('option', {
|
|
2204
|
+
name: 'Aardvark'
|
|
2205
|
+
}));
|
|
2206
|
+
case 17:
|
|
2207
|
+
expect(_testWrapper.screen.getByText('Aardvark')).toBeInTheDocument();
|
|
2208
|
+
|
|
2209
|
+
// Close the listbox before opening DatePicker
|
|
2210
|
+
_context62.next = 20;
|
|
2211
|
+
return (0, _testWrapper.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee57() {
|
|
2212
|
+
return _regeneratorRuntime().wrap(function _callee57$(_context60) {
|
|
2213
|
+
while (1) switch (_context60.prev = _context60.next) {
|
|
2214
|
+
case 0:
|
|
2215
|
+
combobox.blur();
|
|
2216
|
+
case 1:
|
|
2217
|
+
case "end":
|
|
2218
|
+
return _context60.stop();
|
|
2219
|
+
}
|
|
2220
|
+
}, _callee57);
|
|
2221
|
+
})));
|
|
2222
|
+
case 20:
|
|
2223
|
+
_context62.next = 22;
|
|
2224
|
+
return _userEvent["default"].click(_testWrapper.screen.getByRole('button', {
|
|
2225
|
+
name: /calendar/i
|
|
2226
|
+
}));
|
|
2227
|
+
case 22:
|
|
2228
|
+
_context62.next = 24;
|
|
2229
|
+
return (0, _testWrapper.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee58() {
|
|
2230
|
+
return _regeneratorRuntime().wrap(function _callee58$(_context61) {
|
|
2231
|
+
while (1) switch (_context61.prev = _context61.next) {
|
|
2232
|
+
case 0:
|
|
2233
|
+
case "end":
|
|
2234
|
+
return _context61.stop();
|
|
2235
|
+
}
|
|
2236
|
+
}, _callee58);
|
|
2237
|
+
})));
|
|
2238
|
+
case 24:
|
|
2239
|
+
datepickerPopover = _testWrapper.screen.queryByTestId('popover-container');
|
|
2240
|
+
expect(datepickerPopover).toBeInTheDocument();
|
|
2241
|
+
|
|
2242
|
+
/* eslint-disable testing-library/no-node-access */
|
|
2243
|
+
node = datepickerPopover;
|
|
2244
|
+
while (node && node !== document.body) {
|
|
2245
|
+
expect(node).not.toHaveAttribute('aria-hidden', 'true');
|
|
2246
|
+
node = node.parentElement;
|
|
2247
|
+
}
|
|
2248
|
+
/* eslint-enable testing-library/no-node-access */
|
|
2249
|
+
|
|
2250
|
+
// Click a calendar date — verify the date field updates
|
|
2251
|
+
dateButtons = _testWrapper.screen.getAllByRole('button');
|
|
2252
|
+
firstAvailableDate = (0, _find["default"])(dateButtons).call(dateButtons, function (btn) {
|
|
2253
|
+
var _btn$getAttribute;
|
|
2254
|
+
return (_btn$getAttribute = btn.getAttribute('aria-label')) === null || _btn$getAttribute === void 0 ? void 0 : _btn$getAttribute.match(/\w+day,/);
|
|
2255
|
+
});
|
|
2256
|
+
_context62.next = 32;
|
|
2257
|
+
return _userEvent["default"].click(firstAvailableDate);
|
|
2258
|
+
case 32:
|
|
2259
|
+
expect(_testWrapper.screen.queryByTestId('date-field')).not.toHaveValue('');
|
|
2260
|
+
case 33:
|
|
2261
|
+
case "end":
|
|
2262
|
+
return _context62.stop();
|
|
2263
|
+
}
|
|
2264
|
+
}, _callee59);
|
|
2265
|
+
})));
|
|
@@ -24,16 +24,16 @@ var listBox = {
|
|
|
24
24
|
borderRadius: _onyxTokens.astroTokensDark.radius.md
|
|
25
25
|
},
|
|
26
26
|
option: {
|
|
27
|
-
color: _onyxTokens.astroTokensDark.color.
|
|
27
|
+
color: _onyxTokens.astroTokensDark.color.common.menu.item.text,
|
|
28
28
|
'&.is-focused': {
|
|
29
|
-
color: _onyxTokens.astroTokensDark.color.
|
|
29
|
+
color: _onyxTokens.astroTokensDark.color.common.menu.item.hover.text,
|
|
30
30
|
bg: '#2C323A'
|
|
31
31
|
},
|
|
32
32
|
'&.is-selected': {
|
|
33
|
-
color: _onyxTokens.astroTokensDark.color.
|
|
33
|
+
color: _onyxTokens.astroTokensDark.color.common.menu.item.selected.text,
|
|
34
34
|
bg: '#2C323A',
|
|
35
35
|
'&.is-focused': {
|
|
36
|
-
color: _onyxTokens.astroTokensDark.color.
|
|
36
|
+
color: _onyxTokens.astroTokensDark.color.common.menu.item.selected.text
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
'&.is-condensed': {
|
|
@@ -308,7 +308,7 @@ var _default = exports["default"] = {
|
|
|
308
308
|
color: 'text.fieldHelper'
|
|
309
309
|
},
|
|
310
310
|
'&.is-error': {
|
|
311
|
-
color: '
|
|
311
|
+
color: 'critical.bright'
|
|
312
312
|
},
|
|
313
313
|
'&.is-warning': {
|
|
314
314
|
color: 'warning.bright'
|
|
@@ -1804,6 +1804,7 @@ declare const _default: {
|
|
|
1804
1804
|
};
|
|
1805
1805
|
selectLink: {
|
|
1806
1806
|
textDecoration: string;
|
|
1807
|
+
fontWeight: number;
|
|
1807
1808
|
px: string;
|
|
1808
1809
|
'&.is-hovered': {
|
|
1809
1810
|
textDecoration: string;
|
|
@@ -3022,6 +3023,7 @@ declare const _default: {
|
|
|
3022
3023
|
};
|
|
3023
3024
|
linkSelectFieldLabel: {
|
|
3024
3025
|
color: any;
|
|
3026
|
+
fontWeight: number;
|
|
3025
3027
|
fontSize: any;
|
|
3026
3028
|
};
|
|
3027
3029
|
H1: {
|
|
@@ -5783,15 +5785,15 @@ declare const _default: {
|
|
|
5783
5785
|
p: any;
|
|
5784
5786
|
};
|
|
5785
5787
|
option: {
|
|
5786
|
-
py:
|
|
5787
|
-
pl:
|
|
5788
|
+
py: any;
|
|
5789
|
+
pl: any;
|
|
5788
5790
|
pr: any;
|
|
5789
5791
|
justifyContent: string;
|
|
5790
5792
|
borderRadius: any;
|
|
5791
5793
|
lineHeight: string;
|
|
5792
|
-
color:
|
|
5794
|
+
color: any;
|
|
5793
5795
|
'&.is-focused': {
|
|
5794
|
-
color:
|
|
5796
|
+
color: any;
|
|
5795
5797
|
bg: string;
|
|
5796
5798
|
borderRadius: any;
|
|
5797
5799
|
};
|
|
@@ -5801,13 +5803,13 @@ declare const _default: {
|
|
|
5801
5803
|
zIndex: number;
|
|
5802
5804
|
};
|
|
5803
5805
|
'&.is-selected': {
|
|
5806
|
+
color: any;
|
|
5804
5807
|
fontWeight: string;
|
|
5805
|
-
color: string;
|
|
5806
5808
|
bg: string;
|
|
5807
5809
|
pl: string;
|
|
5808
5810
|
borderRadius: any;
|
|
5809
5811
|
'&.is-focused': {
|
|
5810
|
-
color:
|
|
5812
|
+
color: any;
|
|
5811
5813
|
};
|
|
5812
5814
|
'&.is-focus-visible': {
|
|
5813
5815
|
bg: string;
|
|
@@ -270,6 +270,7 @@ var text = exports.text = _objectSpread(_objectSpread({
|
|
|
270
270
|
},
|
|
271
271
|
label: label,
|
|
272
272
|
linkSelectFieldLabel: _objectSpread(_objectSpread({}, label), {}, {
|
|
273
|
-
color: _onyxTokens.astroTokens.color.font.link
|
|
273
|
+
color: _onyxTokens.astroTokens.color.font.link,
|
|
274
|
+
fontWeight: 0
|
|
274
275
|
})
|
|
275
276
|
});
|
|
@@ -854,15 +854,15 @@ declare const _default: {
|
|
|
854
854
|
p: any;
|
|
855
855
|
};
|
|
856
856
|
option: {
|
|
857
|
-
py:
|
|
858
|
-
pl:
|
|
857
|
+
py: any;
|
|
858
|
+
pl: any;
|
|
859
859
|
pr: any;
|
|
860
860
|
justifyContent: string;
|
|
861
861
|
borderRadius: any;
|
|
862
862
|
lineHeight: string;
|
|
863
|
-
color:
|
|
863
|
+
color: any;
|
|
864
864
|
'&.is-focused': {
|
|
865
|
-
color:
|
|
865
|
+
color: any;
|
|
866
866
|
bg: string;
|
|
867
867
|
borderRadius: any;
|
|
868
868
|
};
|
|
@@ -872,13 +872,13 @@ declare const _default: {
|
|
|
872
872
|
zIndex: number;
|
|
873
873
|
};
|
|
874
874
|
'&.is-selected': {
|
|
875
|
+
color: any;
|
|
875
876
|
fontWeight: string;
|
|
876
|
-
color: string;
|
|
877
877
|
bg: string;
|
|
878
878
|
pl: string;
|
|
879
879
|
borderRadius: any;
|
|
880
880
|
'&.is-focused': {
|
|
881
|
-
color:
|
|
881
|
+
color: any;
|
|
882
882
|
};
|
|
883
883
|
'&.is-focus-visible': {
|
|
884
884
|
bg: string;
|
|
@@ -61,7 +61,7 @@ var fieldHelperText = {
|
|
|
61
61
|
color: 'text.fieldHelper'
|
|
62
62
|
},
|
|
63
63
|
'&.is-error': {
|
|
64
|
-
color: '
|
|
64
|
+
color: 'critical.bright'
|
|
65
65
|
},
|
|
66
66
|
'&.is-warning': {
|
|
67
67
|
color: 'warning.bright'
|
|
@@ -164,15 +164,15 @@ var listBox = {
|
|
|
164
164
|
p: _onyxTokens.astroTokens.spacing.sm
|
|
165
165
|
},
|
|
166
166
|
option: {
|
|
167
|
-
py:
|
|
168
|
-
pl:
|
|
167
|
+
py: _onyxTokens.astroTokens.spacing['md-s'],
|
|
168
|
+
pl: _onyxTokens.astroTokens.spacing['md-s'],
|
|
169
169
|
pr: _onyxTokens.astroTokens.spacing.md,
|
|
170
170
|
justifyContent: 'space-between',
|
|
171
171
|
borderRadius: _onyxTokens.astroTokens.radius.md,
|
|
172
172
|
lineHeight: 'body',
|
|
173
|
-
color:
|
|
173
|
+
color: _onyxTokens.astroTokens.color.common.menu.item.text,
|
|
174
174
|
'&.is-focused': {
|
|
175
|
-
color:
|
|
175
|
+
color: _onyxTokens.astroTokens.color.common.menu.item.hover.text,
|
|
176
176
|
bg: 'gray-100',
|
|
177
177
|
borderRadius: _onyxTokens.astroTokens.radius.md
|
|
178
178
|
},
|
|
@@ -182,13 +182,13 @@ var listBox = {
|
|
|
182
182
|
zIndex: 1
|
|
183
183
|
},
|
|
184
184
|
'&.is-selected': {
|
|
185
|
+
color: _onyxTokens.astroTokens.color.common.menu.item.selected.text,
|
|
185
186
|
fontWeight: '0',
|
|
186
|
-
color: 'black',
|
|
187
187
|
bg: 'lightblue',
|
|
188
188
|
pl: '.75rem',
|
|
189
189
|
borderRadius: _onyxTokens.astroTokens.radius.md,
|
|
190
190
|
'&.is-focused': {
|
|
191
|
-
color:
|
|
191
|
+
color: _onyxTokens.astroTokens.color.common.menu.item.selected.text
|
|
192
192
|
},
|
|
193
193
|
'&.is-focus-visible': {
|
|
194
194
|
bg: 'lightblue'
|
|
@@ -229,7 +229,7 @@ var listBox = {
|
|
|
229
229
|
var separator = {
|
|
230
230
|
base: {
|
|
231
231
|
bg: 'border.base',
|
|
232
|
-
my: '
|
|
232
|
+
my: 'md',
|
|
233
233
|
'&.is-vertical': {
|
|
234
234
|
m: '0'
|
|
235
235
|
}
|
|
@@ -15,12 +15,12 @@ import React, { forwardRef, useRef } from 'react';
|
|
|
15
15
|
import { parseDate } from '@internationalized/date';
|
|
16
16
|
import { useDatePicker } from '@react-aria/datepicker';
|
|
17
17
|
import { FocusScope } from '@react-aria/focus';
|
|
18
|
-
import { useOverlayPosition } from '@react-aria/overlays';
|
|
19
18
|
import { mergeProps } from '@react-aria/utils';
|
|
20
19
|
import { useDatePickerState } from '@react-stately/datepicker';
|
|
21
20
|
import { omit } from 'lodash/object';
|
|
22
21
|
import PropTypes from 'prop-types';
|
|
23
|
-
import { Calendar, FieldHelperText
|
|
22
|
+
import { Calendar, FieldHelperText } from '../../index';
|
|
23
|
+
import Popover from '../Popover/Popover';
|
|
24
24
|
import { getPendoID } from '../../utils/devUtils/constants/pendoID';
|
|
25
25
|
import statuses from '../../utils/devUtils/constants/statuses';
|
|
26
26
|
import { isDateWithinRanges } from '../../utils/devUtils/props/isDateWithinRanges';
|
|
@@ -78,31 +78,24 @@ var DatePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
78
78
|
fieldProps = _useDatePicker.fieldProps,
|
|
79
79
|
groupProps = _useDatePicker.groupProps,
|
|
80
80
|
labelProps = _useDatePicker.labelProps;
|
|
81
|
-
var
|
|
82
|
-
targetRef: groupRef,
|
|
83
|
-
overlayRef: popoverRef,
|
|
84
|
-
offset: 15,
|
|
85
|
-
crossOffset: 40,
|
|
86
|
-
isOpen: state.isOpen,
|
|
87
|
-
onClose: state.setOpen,
|
|
88
|
-
shouldUpdatePosition: true
|
|
89
|
-
}),
|
|
90
|
-
positionProps = _useOverlayPosition.overlayProps;
|
|
91
|
-
var calendar = !isReadOnly && ___EmotionJSX(PopoverContainer, _extends({
|
|
81
|
+
var calendar = !isReadOnly && ___EmotionJSX(Popover, {
|
|
92
82
|
hasNoArrow: true,
|
|
93
83
|
isDismissable: true,
|
|
94
84
|
isNonModal: true,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
85
|
+
popoverRef: popoverRef,
|
|
86
|
+
triggerRef: groupRef,
|
|
87
|
+
state: state,
|
|
88
|
+
offset: 15,
|
|
89
|
+
crossOffset: 40,
|
|
90
|
+
"data-testid": "popover-container",
|
|
98
91
|
overflow: "auto"
|
|
99
|
-
},
|
|
92
|
+
}, ___EmotionJSX(FocusScope, {
|
|
100
93
|
autoFocus: true,
|
|
101
94
|
contain: true,
|
|
102
95
|
restoreFocus: true
|
|
103
|
-
}, ___EmotionJSX(Calendar, _extends({}, calendarProps, {
|
|
96
|
+
}, ___EmotionJSX("div", dialogProps, ___EmotionJSX(Calendar, _extends({}, calendarProps, {
|
|
104
97
|
calendarWrapperProps: calendarWrapperProps
|
|
105
|
-
}))));
|
|
98
|
+
})))));
|
|
106
99
|
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(DateField, _extends({}, getPendoID('DatePicker'), props, {
|
|
107
100
|
ref: ref,
|
|
108
101
|
buttonProps: buttonProps,
|
|
@@ -213,7 +213,7 @@ test('should be able to select dates', /*#__PURE__*/_asyncToGenerator(/*#__PURE_
|
|
|
213
213
|
return userEvent.click(screen.queryByRole('button'));
|
|
214
214
|
case 4:
|
|
215
215
|
dateButtons = screen.queryAllByRole('button');
|
|
216
|
-
expect(dateButtons).toHaveLength(
|
|
216
|
+
expect(dateButtons).toHaveLength(38);
|
|
217
217
|
expect(dateButtons[5]).toHaveAttribute('aria-label', 'Monday, August 1, 2022');
|
|
218
218
|
_context4.next = 9;
|
|
219
219
|
return userEvent.click(dateButtons[5]);
|
|
@@ -18,15 +18,15 @@ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance
|
|
|
18
18
|
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
19
19
|
import _reduceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reduce";
|
|
20
20
|
import _flatMapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/flat-map";
|
|
21
|
-
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
22
|
-
import { DismissButton, FocusScope, mergeProps
|
|
21
|
+
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
22
|
+
import { DismissButton, FocusScope, mergeProps } from 'react-aria';
|
|
23
23
|
import { useFilter } from '@react-aria/i18n';
|
|
24
24
|
import { useFocusWithin } from '@react-aria/interactions';
|
|
25
25
|
import { useLayoutEffect, useResizeObserver } from '@react-aria/utils';
|
|
26
26
|
import { VisuallyHidden } from '@react-aria/visually-hidden';
|
|
27
27
|
import { useListState } from '@react-stately/list';
|
|
28
28
|
import PropTypes from 'prop-types';
|
|
29
|
-
import { Box, Button, Icon, Loader,
|
|
29
|
+
import { Box, Button, Icon, Loader, ScrollBox, Text, TextField } from '../..';
|
|
30
30
|
import { MultivaluesContext } from '../../context/MultivaluesContext';
|
|
31
31
|
import { useGetTheme, useInputLoader, usePropWarning } from '../../hooks';
|
|
32
32
|
import loadingStates from '../../utils/devUtils/constants/loadingStates';
|
|
@@ -36,6 +36,7 @@ import { ariaAttributesBasePropTypes } from '../../utils/docUtils/ariaAttributes
|
|
|
36
36
|
import { inputFieldAttributesBasePropTypes } from '../../utils/docUtils/fieldAttributes';
|
|
37
37
|
import { statusDefaultProp, statusPropTypes } from '../../utils/docUtils/statusProp';
|
|
38
38
|
import ListBox from '../ListBox';
|
|
39
|
+
import Popover from '../Popover/Popover';
|
|
39
40
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
40
41
|
var CondensedMultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
41
42
|
var _selectionManager$sta, _selectionManager$sta2, _selectionManager$sta3, _listBoxRef$current;
|
|
@@ -160,30 +161,6 @@ var CondensedMultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
160
161
|
});
|
|
161
162
|
var listBoxRef = useRef();
|
|
162
163
|
var popoverRef = useRef();
|
|
163
|
-
var _useOverlayPosition = useOverlayPosition({
|
|
164
|
-
isOpen: isOpen,
|
|
165
|
-
onClose: close,
|
|
166
|
-
offset: 1,
|
|
167
|
-
overlayRef: popoverRef,
|
|
168
|
-
placement: "".concat(direction, " end"),
|
|
169
|
-
scrollRef: listBoxRef,
|
|
170
|
-
shouldFlip: !isNotFlippable,
|
|
171
|
-
targetRef: inputWrapperRef
|
|
172
|
-
}),
|
|
173
|
-
overlayProps = _useOverlayPosition.overlayProps,
|
|
174
|
-
placement = _useOverlayPosition.placement,
|
|
175
|
-
updatePosition = _useOverlayPosition.updatePosition;
|
|
176
|
-
|
|
177
|
-
// Update position once the ListBox has rendered. This ensures that
|
|
178
|
-
// it flips properly when it doesn't fit in the available space.
|
|
179
|
-
/* istanbul ignore next */
|
|
180
|
-
useLayoutEffect(function () {
|
|
181
|
-
if (isOpen) {
|
|
182
|
-
requestAnimationFrame(function () {
|
|
183
|
-
updatePosition();
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
}, [isOpen, selectionManager.selectedKeys, updatePosition]);
|
|
187
164
|
|
|
188
165
|
// Measure the width of the input to inform the width of the menu (below).
|
|
189
166
|
var _useState9 = useState(null),
|
|
@@ -201,10 +178,16 @@ var CondensedMultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
201
178
|
onResize: onResize
|
|
202
179
|
});
|
|
203
180
|
useLayoutEffect(onResize, [onResize]);
|
|
204
|
-
var
|
|
181
|
+
var menuWidthSx = {
|
|
205
182
|
width: menuWidth,
|
|
206
183
|
minWidth: menuWidth
|
|
207
|
-
}
|
|
184
|
+
};
|
|
185
|
+
var popoverState = useMemo(function () {
|
|
186
|
+
return {
|
|
187
|
+
isOpen: !state.collection.size ? false : isOpen,
|
|
188
|
+
close: close
|
|
189
|
+
};
|
|
190
|
+
}, [state.collection.size, isOpen, close]);
|
|
208
191
|
useEffect(function () {
|
|
209
192
|
if (defaultSelectedKeys) selectionManager.setSelectedKeys(defaultSelectedKeys);
|
|
210
193
|
}, []);
|
|
@@ -306,7 +289,7 @@ var CondensedMultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
306
289
|
}
|
|
307
290
|
}, selectionState), ___EmotionJSX(DismissButton, {
|
|
308
291
|
onDismiss: close
|
|
309
|
-
}), ___EmotionJSX(ScrollBox, scrollBoxProps, ___EmotionJSX(ListBox,
|
|
292
|
+
}), ___EmotionJSX(ScrollBox, scrollBoxProps, ___EmotionJSX(ListBox, {
|
|
310
293
|
ref: listBoxRef,
|
|
311
294
|
hasAutoFocus: hasAutoFocus,
|
|
312
295
|
hasNoEmptySelection: true,
|
|
@@ -317,7 +300,7 @@ var CondensedMultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
317
300
|
isLoading: loadingState === loadingStates.LOADING_MORE,
|
|
318
301
|
"aria-label": "List of options",
|
|
319
302
|
isCondensed: mode === 'condensed'
|
|
320
|
-
}
|
|
303
|
+
})), ___EmotionJSX(DismissButton, {
|
|
321
304
|
onDismiss: close
|
|
322
305
|
}));
|
|
323
306
|
var visuallyHidden = ___EmotionJSX(VisuallyHidden, {
|
|
@@ -428,14 +411,16 @@ var CondensedMultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
428
411
|
value: filterString,
|
|
429
412
|
helperText: helperText,
|
|
430
413
|
"aria-invalid": status === 'error' && true
|
|
431
|
-
}, getPendoID('MultivaluesField'), others, inputProps)), ___EmotionJSX(
|
|
414
|
+
}, getPendoID('MultivaluesField'), others, inputProps)), ___EmotionJSX(Popover, {
|
|
432
415
|
hasNoArrow: true,
|
|
433
416
|
isNonModal: true,
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
417
|
+
popoverRef: popoverRef,
|
|
418
|
+
triggerRef: inputWrapperRef,
|
|
419
|
+
state: popoverState,
|
|
420
|
+
placement: "".concat(direction, " end"),
|
|
421
|
+
shouldFlip: !isNotFlippable,
|
|
422
|
+
scrollRef: listBoxRef,
|
|
423
|
+
sx: menuWidthSx,
|
|
439
424
|
onBlur: function onBlur(e) {
|
|
440
425
|
return handleBlur(e);
|
|
441
426
|
}
|
|
@@ -23,13 +23,13 @@ import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js-stable/in
|
|
|
23
23
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
24
24
|
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
|
25
25
|
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
26
|
-
import { DismissButton, FocusScope
|
|
26
|
+
import { DismissButton, FocusScope } from 'react-aria';
|
|
27
27
|
import { useFilter } from '@react-aria/i18n';
|
|
28
28
|
import { useLayoutEffect, useResizeObserver } from '@react-aria/utils';
|
|
29
29
|
import { VisuallyHidden } from '@react-aria/visually-hidden';
|
|
30
30
|
import { useListState } from '@react-stately/list';
|
|
31
31
|
import PropTypes from 'prop-types';
|
|
32
|
-
import { Badge, Box, Loader,
|
|
32
|
+
import { Badge, Box, Loader, ScrollBox, Text, TextField } from '../..';
|
|
33
33
|
import { MultivaluesContext } from '../../context/MultivaluesContext';
|
|
34
34
|
import { useGetTheme, useInputLoader, usePropWarning } from '../../hooks';
|
|
35
35
|
import loadingStates from '../../utils/devUtils/constants/loadingStates';
|
|
@@ -39,6 +39,7 @@ import { ariaAttributesBasePropTypes } from '../../utils/docUtils/ariaAttributes
|
|
|
39
39
|
import { inputFieldAttributesBasePropTypes } from '../../utils/docUtils/fieldAttributes';
|
|
40
40
|
import { statusDefaultProp, statusPropTypes } from '../../utils/docUtils/statusProp';
|
|
41
41
|
import ListBox from '../ListBox';
|
|
42
|
+
import Popover from '../Popover/Popover';
|
|
42
43
|
import BadgeLabelTooltip from './BadgeLabelTooltip';
|
|
43
44
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
44
45
|
var DefaultMultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
@@ -161,30 +162,6 @@ var DefaultMultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
161
162
|
});
|
|
162
163
|
var listBoxRef = useRef();
|
|
163
164
|
var popoverRef = useRef();
|
|
164
|
-
var _useOverlayPosition = useOverlayPosition({
|
|
165
|
-
isOpen: isOpen,
|
|
166
|
-
onClose: close,
|
|
167
|
-
offset: 1,
|
|
168
|
-
overlayRef: popoverRef,
|
|
169
|
-
placement: "".concat(direction, " end"),
|
|
170
|
-
scrollRef: listBoxRef,
|
|
171
|
-
shouldFlip: !isNotFlippable,
|
|
172
|
-
targetRef: inputWrapperRef
|
|
173
|
-
}),
|
|
174
|
-
overlayProps = _useOverlayPosition.overlayProps,
|
|
175
|
-
placement = _useOverlayPosition.placement,
|
|
176
|
-
updatePosition = _useOverlayPosition.updatePosition;
|
|
177
|
-
|
|
178
|
-
// Update position once the ListBox has rendered. This ensures that
|
|
179
|
-
// it flips properly when it doesn't fit in the available space.
|
|
180
|
-
/* istanbul ignore next */
|
|
181
|
-
useLayoutEffect(function () {
|
|
182
|
-
if (isOpen) {
|
|
183
|
-
requestAnimationFrame(function () {
|
|
184
|
-
updatePosition();
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
}, [isOpen, selectionManager.selectedKeys, updatePosition]);
|
|
188
165
|
|
|
189
166
|
// Measure the width of the input to inform the width of the menu (below).
|
|
190
167
|
var _useState1 = useState(null),
|
|
@@ -202,10 +179,16 @@ var DefaultMultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
202
179
|
onResize: onResize
|
|
203
180
|
});
|
|
204
181
|
useLayoutEffect(onResize, [onResize]);
|
|
205
|
-
var
|
|
182
|
+
var menuWidthSx = {
|
|
206
183
|
width: menuWidth,
|
|
207
184
|
minWidth: menuWidth
|
|
208
|
-
}
|
|
185
|
+
};
|
|
186
|
+
var popoverState = useMemo(function () {
|
|
187
|
+
return {
|
|
188
|
+
isOpen: !state.collection.size ? false : isOpen,
|
|
189
|
+
close: close
|
|
190
|
+
};
|
|
191
|
+
}, [state.collection.size, isOpen, close]);
|
|
209
192
|
useEffect(function () {
|
|
210
193
|
if (defaultSelectedKeys) {
|
|
211
194
|
selectionManager.setSelectedKeys(defaultSelectedKeys);
|
|
@@ -529,14 +512,16 @@ var DefaultMultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
529
512
|
value: filterString,
|
|
530
513
|
helperText: helperText,
|
|
531
514
|
"aria-invalid": status === 'error' && true
|
|
532
|
-
}, getPendoID('MultivaluesField'), others, inputProps)), ___EmotionJSX(
|
|
515
|
+
}, getPendoID('MultivaluesField'), others, inputProps)), ___EmotionJSX(Popover, {
|
|
533
516
|
hasNoArrow: true,
|
|
534
517
|
isNonModal: true,
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
518
|
+
popoverRef: popoverRef,
|
|
519
|
+
triggerRef: inputWrapperRef,
|
|
520
|
+
state: popoverState,
|
|
521
|
+
placement: "".concat(direction, " end"),
|
|
522
|
+
shouldFlip: !isNotFlippable,
|
|
523
|
+
scrollRef: listBoxRef,
|
|
524
|
+
sx: menuWidthSx
|
|
540
525
|
}, listbox), ___EmotionJSX(EmptyVisuallyHidden, null)));
|
|
541
526
|
});
|
|
542
527
|
DefaultMultivaluesField.propTypes = _objectSpread(_objectSpread(_objectSpread({
|
|
@@ -20,7 +20,7 @@ import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerat
|
|
|
20
20
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
21
21
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
22
22
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
23
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
23
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context63, _context64; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context63 = ownKeys(Object(t), !0)).call(_context63, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context64 = ownKeys(Object(t))).call(_context64, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
24
24
|
function _regeneratorRuntime() { "use strict"; var r = _regenerator(), e = r.m(_regeneratorRuntime), t = (_Object$getPrototypeOf ? _Object$getPrototypeOf(e) : e.__proto__).constructor; function n(r) { var e = "function" == typeof r && r.constructor; return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name)); } var o = { "throw": 1, "return": 2, "break": 3, "continue": 3 }; function a(r) { var e, t; return function (n) { e || (e = { stop: function stop() { return t(n.a, 2); }, "catch": function _catch() { return n.v; }, abrupt: function abrupt(r, e) { return t(n.a, o[r], e); }, delegateYield: function delegateYield(r, o, a) { return e.resultName = o, t(n.d, _regeneratorValues(r), a); }, finish: function finish(r) { return t(n.f, r); } }, t = function t(r, _t, o) { n.p = e.prev, n.n = e.next; try { return r(_t, o); } finally { e.next = n.n; } }), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n; try { return r.call(this, e); } finally { n.p = e.prev, n.n = e.next; } }; } return (_regeneratorRuntime = function _regeneratorRuntime() { return { wrap: function wrap(e, t, n, o) { return r.w(a(e), t, n, o && _reverseInstanceProperty(o).call(o)); }, isGeneratorFunction: n, mark: r.m, awrap: function awrap(r, e) { return new _OverloadYield(r, e); }, AsyncIterator: _regeneratorAsyncIterator, async: function async(r, e, t, o, u) { return (n(e) ? _regeneratorAsyncGen : _regeneratorAsync)(a(r), e, t, o, u); }, keys: _regeneratorKeys, values: _regeneratorValues }; })(); }
|
|
25
25
|
function _regeneratorValues(e) { if (null != e) { var t = e["function" == typeof _Symbol && _Symbol$iterator || "@@iterator"], r = 0; if (t) return t.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) return { next: function next() { return e && r >= e.length && (e = void 0), { value: e && e[r++], done: !e }; } }; } throw new TypeError(_typeof(e) + " is not iterable"); }
|
|
26
26
|
function _regeneratorKeys(e) { var n = Object(e), r = []; for (var t in n) r.unshift(t); return function e() { for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = !1, e; return e.done = !0, e; }; }
|
|
@@ -34,9 +34,11 @@ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance
|
|
|
34
34
|
import _fillInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/fill";
|
|
35
35
|
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
36
36
|
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
37
|
+
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
38
|
+
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
|
37
39
|
import React, { useState } from 'react';
|
|
38
40
|
import userEvent from '@testing-library/user-event';
|
|
39
|
-
import { Item, MultivaluesField, OverlayProvider, Section } from '../../index';
|
|
41
|
+
import { Button, DatePicker, Item, Modal, MultivaluesField, OverlayProvider, Section } from '../../index';
|
|
40
42
|
import statuses from '../../utils/devUtils/constants/statuses';
|
|
41
43
|
import { act, fireEvent, getDefaultNormalizer, render, screen, within } from '../../utils/testUtils/testWrapper';
|
|
42
44
|
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
|
@@ -2078,4 +2080,180 @@ test('in condensed mode, arrow icon SVG has an empty title element so no tooltip
|
|
|
2078
2080
|
var titleElement = arrowIconSvg.querySelector('title');
|
|
2079
2081
|
expect(titleElement).toBeInTheDocument();
|
|
2080
2082
|
expect(titleElement).toHaveTextContent('');
|
|
2081
|
-
});
|
|
2083
|
+
});
|
|
2084
|
+
test('MultivaluesField and DatePicker popovers open correctly when inside a Modal (UXE-8666)', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee59() {
|
|
2085
|
+
var multivaluesFieldItems, ModalApp, combobox, listbox, node, datepickerPopover, dateButtons, firstAvailableDate;
|
|
2086
|
+
return _regeneratorRuntime().wrap(function _callee59$(_context62) {
|
|
2087
|
+
while (1) switch (_context62.prev = _context62.next) {
|
|
2088
|
+
case 0:
|
|
2089
|
+
multivaluesFieldItems = [{
|
|
2090
|
+
id: 1,
|
|
2091
|
+
key: 'Aardvark',
|
|
2092
|
+
name: 'Aardvark'
|
|
2093
|
+
}, {
|
|
2094
|
+
id: 2,
|
|
2095
|
+
key: 'Kangaroo',
|
|
2096
|
+
name: 'Kangaroo'
|
|
2097
|
+
}, {
|
|
2098
|
+
id: 3,
|
|
2099
|
+
key: 'Snake',
|
|
2100
|
+
name: 'Snake'
|
|
2101
|
+
}];
|
|
2102
|
+
ModalApp = function ModalApp() {
|
|
2103
|
+
var _useState3 = useState(false),
|
|
2104
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
2105
|
+
isOpen = _useState4[0],
|
|
2106
|
+
setIsOpen = _useState4[1];
|
|
2107
|
+
var _useState5 = useState([]),
|
|
2108
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
2109
|
+
selectedKeys = _useState6[0],
|
|
2110
|
+
setSelectedKeys = _useState6[1];
|
|
2111
|
+
var _useState7 = useState(null),
|
|
2112
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
2113
|
+
selectedDate = _useState8[0],
|
|
2114
|
+
setSelectedDate = _useState8[1];
|
|
2115
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Button, {
|
|
2116
|
+
onPress: function onPress() {
|
|
2117
|
+
return setIsOpen(true);
|
|
2118
|
+
}
|
|
2119
|
+
}, "Launch Modal"), isOpen && ___EmotionJSX(Modal, {
|
|
2120
|
+
title: "test",
|
|
2121
|
+
isOpen: isOpen,
|
|
2122
|
+
onClose: function onClose() {
|
|
2123
|
+
return setIsOpen(false);
|
|
2124
|
+
},
|
|
2125
|
+
hasCloseButton: true,
|
|
2126
|
+
isDismissable: true
|
|
2127
|
+
}, ___EmotionJSX(MultivaluesField, {
|
|
2128
|
+
label: "Test Multivalues",
|
|
2129
|
+
items: multivaluesFieldItems,
|
|
2130
|
+
selectedKeys: selectedKeys,
|
|
2131
|
+
onSelectionChange: function onSelectionChange(keys) {
|
|
2132
|
+
var _context57;
|
|
2133
|
+
return setSelectedKeys(_mapInstanceProperty(_context57 = _Array$from(keys)).call(_context57, function (k) {
|
|
2134
|
+
return k.toString();
|
|
2135
|
+
}));
|
|
2136
|
+
},
|
|
2137
|
+
mode: "non-restrictive"
|
|
2138
|
+
}, function (item) {
|
|
2139
|
+
return ___EmotionJSX(Item, {
|
|
2140
|
+
key: item.key,
|
|
2141
|
+
"data-id": item.name,
|
|
2142
|
+
"aria-label": item.name
|
|
2143
|
+
}, item.name);
|
|
2144
|
+
}), ___EmotionJSX(DatePicker, {
|
|
2145
|
+
label: "Select a date",
|
|
2146
|
+
value: selectedDate,
|
|
2147
|
+
onChange: setSelectedDate
|
|
2148
|
+
})));
|
|
2149
|
+
};
|
|
2150
|
+
render(___EmotionJSX(OverlayProvider, null, ___EmotionJSX(ModalApp, null)));
|
|
2151
|
+
_context62.next = 5;
|
|
2152
|
+
return userEvent.click(screen.getByRole('button', {
|
|
2153
|
+
name: 'Launch Modal'
|
|
2154
|
+
}));
|
|
2155
|
+
case 5:
|
|
2156
|
+
expect(screen.getByRole('dialog')).toBeInTheDocument();
|
|
2157
|
+
|
|
2158
|
+
// MultivaluesField: focus opens the listbox
|
|
2159
|
+
combobox = screen.getByRole('combobox');
|
|
2160
|
+
_context62.next = 9;
|
|
2161
|
+
return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee55() {
|
|
2162
|
+
return _regeneratorRuntime().wrap(function _callee55$(_context58) {
|
|
2163
|
+
while (1) switch (_context58.prev = _context58.next) {
|
|
2164
|
+
case 0:
|
|
2165
|
+
combobox.focus();
|
|
2166
|
+
case 1:
|
|
2167
|
+
case "end":
|
|
2168
|
+
return _context58.stop();
|
|
2169
|
+
}
|
|
2170
|
+
}, _callee55);
|
|
2171
|
+
})));
|
|
2172
|
+
case 9:
|
|
2173
|
+
_context62.next = 11;
|
|
2174
|
+
return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee56() {
|
|
2175
|
+
return _regeneratorRuntime().wrap(function _callee56$(_context59) {
|
|
2176
|
+
while (1) switch (_context59.prev = _context59.next) {
|
|
2177
|
+
case 0:
|
|
2178
|
+
case "end":
|
|
2179
|
+
return _context59.stop();
|
|
2180
|
+
}
|
|
2181
|
+
}, _callee56);
|
|
2182
|
+
})));
|
|
2183
|
+
case 11:
|
|
2184
|
+
listbox = screen.queryByRole('listbox');
|
|
2185
|
+
expect(listbox).toBeInTheDocument();
|
|
2186
|
+
|
|
2187
|
+
/* eslint-disable testing-library/no-node-access */
|
|
2188
|
+
node = listbox;
|
|
2189
|
+
while (node && node !== document.body) {
|
|
2190
|
+
expect(node).not.toHaveAttribute('aria-hidden', 'true');
|
|
2191
|
+
node = node.parentElement;
|
|
2192
|
+
}
|
|
2193
|
+
/* eslint-enable testing-library/no-node-access */
|
|
2194
|
+
|
|
2195
|
+
// Click an option — verify it is selectable (option disappears and a badge appears)
|
|
2196
|
+
_context62.next = 17;
|
|
2197
|
+
return userEvent.click(screen.getByRole('option', {
|
|
2198
|
+
name: 'Aardvark'
|
|
2199
|
+
}));
|
|
2200
|
+
case 17:
|
|
2201
|
+
expect(screen.getByText('Aardvark')).toBeInTheDocument();
|
|
2202
|
+
|
|
2203
|
+
// Close the listbox before opening DatePicker
|
|
2204
|
+
_context62.next = 20;
|
|
2205
|
+
return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee57() {
|
|
2206
|
+
return _regeneratorRuntime().wrap(function _callee57$(_context60) {
|
|
2207
|
+
while (1) switch (_context60.prev = _context60.next) {
|
|
2208
|
+
case 0:
|
|
2209
|
+
combobox.blur();
|
|
2210
|
+
case 1:
|
|
2211
|
+
case "end":
|
|
2212
|
+
return _context60.stop();
|
|
2213
|
+
}
|
|
2214
|
+
}, _callee57);
|
|
2215
|
+
})));
|
|
2216
|
+
case 20:
|
|
2217
|
+
_context62.next = 22;
|
|
2218
|
+
return userEvent.click(screen.getByRole('button', {
|
|
2219
|
+
name: /calendar/i
|
|
2220
|
+
}));
|
|
2221
|
+
case 22:
|
|
2222
|
+
_context62.next = 24;
|
|
2223
|
+
return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee58() {
|
|
2224
|
+
return _regeneratorRuntime().wrap(function _callee58$(_context61) {
|
|
2225
|
+
while (1) switch (_context61.prev = _context61.next) {
|
|
2226
|
+
case 0:
|
|
2227
|
+
case "end":
|
|
2228
|
+
return _context61.stop();
|
|
2229
|
+
}
|
|
2230
|
+
}, _callee58);
|
|
2231
|
+
})));
|
|
2232
|
+
case 24:
|
|
2233
|
+
datepickerPopover = screen.queryByTestId('popover-container');
|
|
2234
|
+
expect(datepickerPopover).toBeInTheDocument();
|
|
2235
|
+
|
|
2236
|
+
/* eslint-disable testing-library/no-node-access */
|
|
2237
|
+
node = datepickerPopover;
|
|
2238
|
+
while (node && node !== document.body) {
|
|
2239
|
+
expect(node).not.toHaveAttribute('aria-hidden', 'true');
|
|
2240
|
+
node = node.parentElement;
|
|
2241
|
+
}
|
|
2242
|
+
/* eslint-enable testing-library/no-node-access */
|
|
2243
|
+
|
|
2244
|
+
// Click a calendar date — verify the date field updates
|
|
2245
|
+
dateButtons = screen.getAllByRole('button');
|
|
2246
|
+
firstAvailableDate = _findInstanceProperty(dateButtons).call(dateButtons, function (btn) {
|
|
2247
|
+
var _btn$getAttribute;
|
|
2248
|
+
return (_btn$getAttribute = btn.getAttribute('aria-label')) === null || _btn$getAttribute === void 0 ? void 0 : _btn$getAttribute.match(/\w+day,/);
|
|
2249
|
+
});
|
|
2250
|
+
_context62.next = 32;
|
|
2251
|
+
return userEvent.click(firstAvailableDate);
|
|
2252
|
+
case 32:
|
|
2253
|
+
expect(screen.queryByTestId('date-field')).not.toHaveValue('');
|
|
2254
|
+
case 33:
|
|
2255
|
+
case "end":
|
|
2256
|
+
return _context62.stop();
|
|
2257
|
+
}
|
|
2258
|
+
}, _callee59);
|
|
2259
|
+
})));
|
|
@@ -16,16 +16,16 @@ var listBox = {
|
|
|
16
16
|
borderRadius: astroTokensDark.radius.md
|
|
17
17
|
},
|
|
18
18
|
option: {
|
|
19
|
-
color: astroTokensDark.color.
|
|
19
|
+
color: astroTokensDark.color.common.menu.item.text,
|
|
20
20
|
'&.is-focused': {
|
|
21
|
-
color: astroTokensDark.color.
|
|
21
|
+
color: astroTokensDark.color.common.menu.item.hover.text,
|
|
22
22
|
bg: '#2C323A'
|
|
23
23
|
},
|
|
24
24
|
'&.is-selected': {
|
|
25
|
-
color: astroTokensDark.color.
|
|
25
|
+
color: astroTokensDark.color.common.menu.item.selected.text,
|
|
26
26
|
bg: '#2C323A',
|
|
27
27
|
'&.is-focused': {
|
|
28
|
-
color: astroTokensDark.color.
|
|
28
|
+
color: astroTokensDark.color.common.menu.item.selected.text
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
'&.is-condensed': {
|
|
@@ -300,7 +300,7 @@ export default {
|
|
|
300
300
|
color: 'text.fieldHelper'
|
|
301
301
|
},
|
|
302
302
|
'&.is-error': {
|
|
303
|
-
color: '
|
|
303
|
+
color: 'critical.bright'
|
|
304
304
|
},
|
|
305
305
|
'&.is-warning': {
|
|
306
306
|
color: 'warning.bright'
|
|
@@ -263,6 +263,7 @@ export var text = _objectSpread(_objectSpread({
|
|
|
263
263
|
},
|
|
264
264
|
label: label,
|
|
265
265
|
linkSelectFieldLabel: _objectSpread(_objectSpread({}, label), {}, {
|
|
266
|
-
color: astroTokens.color.font.link
|
|
266
|
+
color: astroTokens.color.font.link,
|
|
267
|
+
fontWeight: 0
|
|
267
268
|
})
|
|
268
269
|
});
|
|
@@ -51,7 +51,7 @@ var fieldHelperText = {
|
|
|
51
51
|
color: 'text.fieldHelper'
|
|
52
52
|
},
|
|
53
53
|
'&.is-error': {
|
|
54
|
-
color: '
|
|
54
|
+
color: 'critical.bright'
|
|
55
55
|
},
|
|
56
56
|
'&.is-warning': {
|
|
57
57
|
color: 'warning.bright'
|
|
@@ -154,15 +154,15 @@ var listBox = {
|
|
|
154
154
|
p: astroTokens.spacing.sm
|
|
155
155
|
},
|
|
156
156
|
option: {
|
|
157
|
-
py:
|
|
158
|
-
pl:
|
|
157
|
+
py: astroTokens.spacing['md-s'],
|
|
158
|
+
pl: astroTokens.spacing['md-s'],
|
|
159
159
|
pr: astroTokens.spacing.md,
|
|
160
160
|
justifyContent: 'space-between',
|
|
161
161
|
borderRadius: astroTokens.radius.md,
|
|
162
162
|
lineHeight: 'body',
|
|
163
|
-
color:
|
|
163
|
+
color: astroTokens.color.common.menu.item.text,
|
|
164
164
|
'&.is-focused': {
|
|
165
|
-
color:
|
|
165
|
+
color: astroTokens.color.common.menu.item.hover.text,
|
|
166
166
|
bg: 'gray-100',
|
|
167
167
|
borderRadius: astroTokens.radius.md
|
|
168
168
|
},
|
|
@@ -172,13 +172,13 @@ var listBox = {
|
|
|
172
172
|
zIndex: 1
|
|
173
173
|
},
|
|
174
174
|
'&.is-selected': {
|
|
175
|
+
color: astroTokens.color.common.menu.item.selected.text,
|
|
175
176
|
fontWeight: '0',
|
|
176
|
-
color: 'black',
|
|
177
177
|
bg: 'lightblue',
|
|
178
178
|
pl: '.75rem',
|
|
179
179
|
borderRadius: astroTokens.radius.md,
|
|
180
180
|
'&.is-focused': {
|
|
181
|
-
color:
|
|
181
|
+
color: astroTokens.color.common.menu.item.selected.text
|
|
182
182
|
},
|
|
183
183
|
'&.is-focus-visible': {
|
|
184
184
|
bg: 'lightblue'
|
|
@@ -219,7 +219,7 @@ var listBox = {
|
|
|
219
219
|
var separator = {
|
|
220
220
|
base: {
|
|
221
221
|
bg: 'border.base',
|
|
222
|
-
my: '
|
|
222
|
+
my: 'md',
|
|
223
223
|
'&.is-vertical': {
|
|
224
224
|
m: '0'
|
|
225
225
|
}
|