@pingux/astro 2.113.1-alpha.0 → 2.114.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/MultivaluesField/CondensedMultivaluesField.js +5 -2
- package/lib/cjs/components/MultivaluesField/MultivaluesField.stories.js +5 -0
- package/lib/cjs/components/MultivaluesField/MultivaluesField.test.js +10 -0
- package/lib/components/MultivaluesField/CondensedMultivaluesField.js +5 -2
- package/lib/components/MultivaluesField/MultivaluesField.stories.js +5 -0
- package/lib/components/MultivaluesField/MultivaluesField.test.js +10 -0
- package/package.json +1 -1
@@ -44,7 +44,7 @@ var _fieldAttributes = require("../../utils/docUtils/fieldAttributes");
|
|
44
44
|
var _statusProp = require("../../utils/docUtils/statusProp");
|
45
45
|
var _ListBox = _interopRequireDefault(require("../ListBox"));
|
46
46
|
var _react2 = require("@emotion/react");
|
47
|
-
var _excluded = ["defaultSelectedKeys", "direction", "disabledKeys", "containerProps", "hasAutoFocus", "hasNoStatusIndicator", "helperText", "inputProps", "isDisabled", "isNotFlippable", "isReadOnly", "isRequired", "items", "label", "mode", "onBlur", "onFocus", "onInputChange", "onKeyDown", "onKeyUp", "onOpenChange", "onSelectionChange", "placeholder", "selectedKeys", "scrollBoxProps", "status"];
|
47
|
+
var _excluded = ["defaultSelectedKeys", "direction", "disabledKeys", "containerProps", "hasAutoFocus", "hasNoSelectAll", "hasNoStatusIndicator", "helperText", "inputProps", "isDisabled", "isNotFlippable", "isReadOnly", "isRequired", "items", "label", "mode", "onBlur", "onFocus", "onInputChange", "onKeyDown", "onKeyUp", "onOpenChange", "onSelectionChange", "placeholder", "selectedKeys", "scrollBoxProps", "status"];
|
48
48
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
49
49
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
50
50
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty2(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
@@ -57,6 +57,7 @@ var CondensedMultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (pr
|
|
57
57
|
disabledKeys = _props$disabledKeys === void 0 ? [] : _props$disabledKeys,
|
58
58
|
containerProps = props.containerProps,
|
59
59
|
hasAutoFocus = props.hasAutoFocus,
|
60
|
+
hasNoSelectAll = props.hasNoSelectAll,
|
60
61
|
hasNoStatusIndicator = props.hasNoStatusIndicator,
|
61
62
|
helperText = props.helperText,
|
62
63
|
customInputProps = props.inputProps,
|
@@ -273,7 +274,7 @@ var CondensedMultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (pr
|
|
273
274
|
setSelectionState('Select All');
|
274
275
|
}
|
275
276
|
};
|
276
|
-
var listbox = (0, _react2.jsx)(_reactAria.FocusScope, null, filterString === '' && (0, _react2.jsx)(_.Button, {
|
277
|
+
var listbox = (0, _react2.jsx)(_reactAria.FocusScope, null, filterString === '' && !hasNoSelectAll && (0, _react2.jsx)(_.Button, {
|
277
278
|
onPress: handleSelection,
|
278
279
|
ref: buttonRef,
|
279
280
|
variant: "link",
|
@@ -411,6 +412,8 @@ CondensedMultivaluesField.propTypes = _objectSpread(_objectSpread(_objectSpread(
|
|
411
412
|
disabledKeys: _isIterable.isIterableProp,
|
412
413
|
/** Whether the element should receive focus on render. */
|
413
414
|
hasAutoFocus: _propTypes["default"].bool,
|
415
|
+
/** Whether the field has the select all button. */
|
416
|
+
hasNoSelectAll: _propTypes["default"].bool,
|
414
417
|
/** Whether the field has a status indicator. */
|
415
418
|
hasNoStatusIndicator: _propTypes["default"].bool,
|
416
419
|
/** Text rendered below the input. */
|
@@ -83,6 +83,11 @@ var _default = {
|
|
83
83
|
control: {
|
84
84
|
type: 'text'
|
85
85
|
}
|
86
|
+
},
|
87
|
+
hasNoSelectAll: {
|
88
|
+
control: {
|
89
|
+
tyle: 'boolean'
|
90
|
+
}
|
86
91
|
}
|
87
92
|
}, _statusProp.statusArgTypes), _ariaAttributes.ariaAttributeBaseArgTypes), _fieldAttributes.inputFieldAttributeBaseArgTypes),
|
88
93
|
args: {
|
@@ -890,6 +890,16 @@ test('in non-restrictive mode the partial string values should be accepted', fun
|
|
890
890
|
expect(input).not.toHaveValue('');
|
891
891
|
expect(input).toHaveValue(value);
|
892
892
|
});
|
893
|
+
test('in condensed mode, hasNoSelectAll hides the select all button', function () {
|
894
|
+
getComponent({
|
895
|
+
mode: 'condensed',
|
896
|
+
hasNoSelectAll: true
|
897
|
+
});
|
898
|
+
_userEvent["default"].tab();
|
899
|
+
var buttons = _testWrapper.screen.getAllByRole('button');
|
900
|
+
var button = buttons[1];
|
901
|
+
expect(button).not.toHaveTextContent('Select All');
|
902
|
+
});
|
893
903
|
test('in condensed mode selects and deselects ', function () {
|
894
904
|
getComponent({
|
895
905
|
mode: 'condensed'
|
@@ -9,7 +9,7 @@ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
9
9
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
10
10
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
11
11
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
12
|
-
var _excluded = ["defaultSelectedKeys", "direction", "disabledKeys", "containerProps", "hasAutoFocus", "hasNoStatusIndicator", "helperText", "inputProps", "isDisabled", "isNotFlippable", "isReadOnly", "isRequired", "items", "label", "mode", "onBlur", "onFocus", "onInputChange", "onKeyDown", "onKeyUp", "onOpenChange", "onSelectionChange", "placeholder", "selectedKeys", "scrollBoxProps", "status"];
|
12
|
+
var _excluded = ["defaultSelectedKeys", "direction", "disabledKeys", "containerProps", "hasAutoFocus", "hasNoSelectAll", "hasNoStatusIndicator", "helperText", "inputProps", "isDisabled", "isNotFlippable", "isReadOnly", "isRequired", "items", "label", "mode", "onBlur", "onFocus", "onInputChange", "onKeyDown", "onKeyUp", "onOpenChange", "onSelectionChange", "placeholder", "selectedKeys", "scrollBoxProps", "status"];
|
13
13
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
14
14
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context3 = ownKeys(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
15
15
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
@@ -45,6 +45,7 @@ var CondensedMultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
45
45
|
disabledKeys = _props$disabledKeys === void 0 ? [] : _props$disabledKeys,
|
46
46
|
containerProps = props.containerProps,
|
47
47
|
hasAutoFocus = props.hasAutoFocus,
|
48
|
+
hasNoSelectAll = props.hasNoSelectAll,
|
48
49
|
hasNoStatusIndicator = props.hasNoStatusIndicator,
|
49
50
|
helperText = props.helperText,
|
50
51
|
customInputProps = props.inputProps,
|
@@ -261,7 +262,7 @@ var CondensedMultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
261
262
|
setSelectionState('Select All');
|
262
263
|
}
|
263
264
|
};
|
264
|
-
var listbox = ___EmotionJSX(FocusScope, null, filterString === '' && ___EmotionJSX(Button, {
|
265
|
+
var listbox = ___EmotionJSX(FocusScope, null, filterString === '' && !hasNoSelectAll && ___EmotionJSX(Button, {
|
265
266
|
onPress: handleSelection,
|
266
267
|
ref: buttonRef,
|
267
268
|
variant: "link",
|
@@ -399,6 +400,8 @@ CondensedMultivaluesField.propTypes = _objectSpread(_objectSpread(_objectSpread(
|
|
399
400
|
disabledKeys: isIterableProp,
|
400
401
|
/** Whether the element should receive focus on render. */
|
401
402
|
hasAutoFocus: PropTypes.bool,
|
403
|
+
/** Whether the field has the select all button. */
|
404
|
+
hasNoSelectAll: PropTypes.bool,
|
402
405
|
/** Whether the field has a status indicator. */
|
403
406
|
hasNoStatusIndicator: PropTypes.bool,
|
404
407
|
/** Text rendered below the input. */
|
@@ -882,6 +882,16 @@ test('in non-restrictive mode the partial string values should be accepted', fun
|
|
882
882
|
expect(input).not.toHaveValue('');
|
883
883
|
expect(input).toHaveValue(value);
|
884
884
|
});
|
885
|
+
test('in condensed mode, hasNoSelectAll hides the select all button', function () {
|
886
|
+
getComponent({
|
887
|
+
mode: 'condensed',
|
888
|
+
hasNoSelectAll: true
|
889
|
+
});
|
890
|
+
userEvent.tab();
|
891
|
+
var buttons = screen.getAllByRole('button');
|
892
|
+
var button = buttons[1];
|
893
|
+
expect(button).not.toHaveTextContent('Select All');
|
894
|
+
});
|
885
895
|
test('in condensed mode selects and deselects ', function () {
|
886
896
|
getComponent({
|
887
897
|
mode: 'condensed'
|