@pingux/astro 2.113.0 → 2.114.0-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.
@@ -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,
@@ -263,8 +264,8 @@ var CondensedMultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (pr
263
264
  var allItemNames = (0, _flatMap["default"])(arrayItems).call(arrayItems, function (obj) {
264
265
  var _context2;
265
266
  return obj.children ? (0, _map["default"])(_context2 = obj.children).call(_context2, function (child) {
266
- return child.name;
267
- }) : obj.name;
267
+ return child.key;
268
+ }) : obj.key;
268
269
  });
269
270
  selectionManager.setSelectedKeys(allItemNames);
270
271
  setSelectionState('Deselect All');
@@ -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",
@@ -298,7 +299,7 @@ var CondensedMultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (pr
298
299
  id: "selectedKeysState"
299
300
  }, "Selected options:", (0, _from["default"])(selectionManager.selectedKeys).join(' '));
300
301
 
301
- // the reason we are using two different visually hiddens, rather than one that updates it's value
302
+ // the reason we are using two different visually hiddens, rather than one that updates its value
302
303
  // is because there are tests that break if an empty visually hidden is rendered in the TextField
303
304
  var EmptyVisuallyHidden = function EmptyVisuallyHidden() {
304
305
  return (0, _react2.jsx)(_visuallyHidden.VisuallyHidden, {
@@ -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: {
@@ -268,25 +273,33 @@ var withSection = [{
268
273
  name: 'Animals',
269
274
  key: 'Animals',
270
275
  children: [{
271
- name: 'Option A1'
276
+ name: 'Option A1',
277
+ key: 'Option A1'
272
278
  }, {
273
- name: 'Option A2'
279
+ name: 'Option A2',
280
+ key: 'Option A2'
274
281
  }, {
275
- name: 'Option A3'
282
+ name: 'Option A3',
283
+ key: 'Option A3'
276
284
  }, {
277
- name: 'Option A4'
285
+ name: 'Option A4',
286
+ key: 'Option A4'
278
287
  }, {
279
- name: 'Option A5'
288
+ name: 'Option A5',
289
+ key: 'Option A5'
280
290
  }]
281
291
  }, {
282
292
  name: 'People',
283
293
  key: 'People',
284
294
  children: [{
285
- name: 'Option B1'
295
+ name: 'Option B1',
296
+ key: 'Option B1'
286
297
  }, {
287
- name: 'Option B2'
298
+ name: 'Option B2',
299
+ key: 'Option B2'
288
300
  }, {
289
- name: 'Option B3'
301
+ name: 'Option B3',
302
+ key: 'Option B3'
290
303
  }]
291
304
  }];
292
305
  var itemsWithSlots = [{
@@ -48,19 +48,24 @@ var withSection = [{
48
48
  name: 'Animals',
49
49
  key: 'Animals',
50
50
  children: [{
51
- name: 'Option A1'
51
+ name: 'Option A1',
52
+ key: 'Option A1'
52
53
  }, {
53
- name: 'Option A2'
54
+ name: 'Option A2',
55
+ key: 'Option A2'
54
56
  }]
55
57
  }, {
56
58
  name: 'People',
57
59
  key: 'People',
58
60
  children: [{
59
- name: 'Option B1'
61
+ name: 'Option B1',
62
+ key: 'Option B1'
60
63
  }, {
61
- name: 'Option B2'
64
+ name: 'Option B2',
65
+ key: 'Option B2'
62
66
  }, {
63
- name: 'Option B3'
67
+ name: 'Option B3',
68
+ key: 'Option B3'
64
69
  }]
65
70
  }];
66
71
  var defaultProps = {
@@ -885,6 +890,16 @@ test('in non-restrictive mode the partial string values should be accepted', fun
885
890
  expect(input).not.toHaveValue('');
886
891
  expect(input).toHaveValue(value);
887
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
+ });
888
903
  test('in condensed mode selects and deselects ', function () {
889
904
  getComponent({
890
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,
@@ -251,8 +252,8 @@ var CondensedMultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
251
252
  var allItemNames = _flatMapInstanceProperty(arrayItems).call(arrayItems, function (obj) {
252
253
  var _context2;
253
254
  return obj.children ? _mapInstanceProperty(_context2 = obj.children).call(_context2, function (child) {
254
- return child.name;
255
- }) : obj.name;
255
+ return child.key;
256
+ }) : obj.key;
256
257
  });
257
258
  selectionManager.setSelectedKeys(allItemNames);
258
259
  setSelectionState('Deselect All');
@@ -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",
@@ -286,7 +287,7 @@ var CondensedMultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
286
287
  id: "selectedKeysState"
287
288
  }, "Selected options:", _Array$from(selectionManager.selectedKeys).join(' '));
288
289
 
289
- // the reason we are using two different visually hiddens, rather than one that updates it's value
290
+ // the reason we are using two different visually hiddens, rather than one that updates its value
290
291
  // is because there are tests that break if an empty visually hidden is rendered in the TextField
291
292
  var EmptyVisuallyHidden = function EmptyVisuallyHidden() {
292
293
  return ___EmotionJSX(VisuallyHidden, {
@@ -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. */
@@ -72,6 +72,11 @@ export default {
72
72
  control: {
73
73
  type: 'text'
74
74
  }
75
+ },
76
+ hasNoSelectAll: {
77
+ control: {
78
+ tyle: 'boolean'
79
+ }
75
80
  }
76
81
  }, statusArgTypes), ariaAttributeBaseArgTypes), inputFieldAttributeBaseArgTypes),
77
82
  args: {
@@ -256,25 +261,33 @@ var withSection = [{
256
261
  name: 'Animals',
257
262
  key: 'Animals',
258
263
  children: [{
259
- name: 'Option A1'
264
+ name: 'Option A1',
265
+ key: 'Option A1'
260
266
  }, {
261
- name: 'Option A2'
267
+ name: 'Option A2',
268
+ key: 'Option A2'
262
269
  }, {
263
- name: 'Option A3'
270
+ name: 'Option A3',
271
+ key: 'Option A3'
264
272
  }, {
265
- name: 'Option A4'
273
+ name: 'Option A4',
274
+ key: 'Option A4'
266
275
  }, {
267
- name: 'Option A5'
276
+ name: 'Option A5',
277
+ key: 'Option A5'
268
278
  }]
269
279
  }, {
270
280
  name: 'People',
271
281
  key: 'People',
272
282
  children: [{
273
- name: 'Option B1'
283
+ name: 'Option B1',
284
+ key: 'Option B1'
274
285
  }, {
275
- name: 'Option B2'
286
+ name: 'Option B2',
287
+ key: 'Option B2'
276
288
  }, {
277
- name: 'Option B3'
289
+ name: 'Option B3',
290
+ key: 'Option B3'
278
291
  }]
279
292
  }];
280
293
  var itemsWithSlots = [{
@@ -40,19 +40,24 @@ var withSection = [{
40
40
  name: 'Animals',
41
41
  key: 'Animals',
42
42
  children: [{
43
- name: 'Option A1'
43
+ name: 'Option A1',
44
+ key: 'Option A1'
44
45
  }, {
45
- name: 'Option A2'
46
+ name: 'Option A2',
47
+ key: 'Option A2'
46
48
  }]
47
49
  }, {
48
50
  name: 'People',
49
51
  key: 'People',
50
52
  children: [{
51
- name: 'Option B1'
53
+ name: 'Option B1',
54
+ key: 'Option B1'
52
55
  }, {
53
- name: 'Option B2'
56
+ name: 'Option B2',
57
+ key: 'Option B2'
54
58
  }, {
55
- name: 'Option B3'
59
+ name: 'Option B3',
60
+ key: 'Option B3'
56
61
  }]
57
62
  }];
58
63
  var defaultProps = {
@@ -877,6 +882,16 @@ test('in non-restrictive mode the partial string values should be accepted', fun
877
882
  expect(input).not.toHaveValue('');
878
883
  expect(input).toHaveValue(value);
879
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
+ });
880
895
  test('in condensed mode selects and deselects ', function () {
881
896
  getComponent({
882
897
  mode: 'condensed'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "2.113.0",
3
+ "version": "2.114.0-alpha.0",
4
4
  "description": "React component library for Ping Identity's design system",
5
5
  "repository": {
6
6
  "type": "git",