@pingux/astro 1.16.0-alpha.4 → 1.17.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/lib/cjs/components/ArrayField/ArrayField.js +5 -1
  3. package/lib/cjs/components/ArrayField/ArrayField.stories.js +1 -0
  4. package/lib/cjs/components/Button/Button.js +5 -0
  5. package/lib/cjs/components/ComboBoxField/ComboBoxField.js +40 -7
  6. package/lib/cjs/components/ComboBoxField/ComboBoxField.stories.js +58 -2
  7. package/lib/cjs/components/ComboBoxField/ComboBoxField.test.js +123 -25
  8. package/lib/cjs/components/Link/Link.js +5 -0
  9. package/lib/cjs/components/ListView/ListView.js +6 -0
  10. package/lib/cjs/components/Messages/Messages.js +4 -0
  11. package/lib/cjs/components/Modal/Modal.js +5 -0
  12. package/lib/cjs/components/NavBar/NavBar.stories.js +1 -1
  13. package/lib/cjs/components/OverlayPanel/OverlayPanel.js +3 -0
  14. package/lib/cjs/components/RequirementsList/RequirementsList.js +4 -0
  15. package/lib/cjs/components/ScrollBox/ScrollBox.js +5 -2
  16. package/lib/cjs/components/Stepper/Stepper.js +6 -0
  17. package/lib/cjs/components/Tab/Tab.js +4 -0
  18. package/lib/cjs/components/Tabs/Tabs.js +4 -0
  19. package/lib/components/ArrayField/ArrayField.js +6 -1
  20. package/lib/components/ArrayField/ArrayField.stories.js +1 -0
  21. package/lib/components/Button/Button.js +6 -0
  22. package/lib/components/ComboBoxField/ComboBoxField.js +40 -8
  23. package/lib/components/ComboBoxField/ComboBoxField.stories.js +51 -0
  24. package/lib/components/ComboBoxField/ComboBoxField.test.js +106 -25
  25. package/lib/components/Link/Link.js +6 -0
  26. package/lib/components/ListView/ListView.js +6 -0
  27. package/lib/components/Messages/Messages.js +5 -0
  28. package/lib/components/Modal/Modal.js +6 -0
  29. package/lib/components/NavBar/NavBar.stories.js +1 -1
  30. package/lib/components/OverlayPanel/OverlayPanel.js +4 -0
  31. package/lib/components/RequirementsList/RequirementsList.js +5 -0
  32. package/lib/components/ScrollBox/ScrollBox.js +6 -2
  33. package/lib/components/Stepper/Stepper.js +6 -0
  34. package/lib/components/Tab/Tab.js +5 -0
  35. package/lib/components/Tabs/Tabs.js +4 -0
  36. package/package.json +1 -1
@@ -52,6 +52,10 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "functi
52
52
 
53
53
  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; }
54
54
 
55
+ /**
56
+ * Tab control for dividing up closely-related content.
57
+ * Typically used as a child of the Tabs component.
58
+ */
55
59
  var CollectionTab = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
56
60
  var className = props.className,
57
61
  item = props.item,
@@ -73,6 +73,10 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
73
73
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context6, _context7; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty2(_context6 = ownKeys(Object(source), !0)).call(_context6, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty2(_context7 = ownKeys(Object(source))).call(_context7, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
74
74
 
75
75
  var TabsContext = /*#__PURE__*/_react["default"].createContext({});
76
+ /**
77
+ * Tabs are used to divide content, navigate to other views, and indicate work progress.
78
+ */
79
+
76
80
 
77
81
  exports.TabsContext = TabsContext;
78
82
  var Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
@@ -32,6 +32,11 @@ import Text from '../Text';
32
32
  import Label from '../Label';
33
33
  import statuses from '../../utils/devUtils/constants/statuses';
34
34
  import isValidPositiveInt from '../../utils/devUtils/props/isValidPositiveInt';
35
+ /**
36
+ * Displays array collections providing useful functions and
37
+ * optimizations for arrays.
38
+ */
39
+
35
40
  import { jsx as ___EmotionJSX } from "@emotion/react";
36
41
 
37
42
  var ArrayField = function ArrayField(props) {
@@ -77,7 +82,7 @@ var ArrayField = function ArrayField(props) {
77
82
  });
78
83
  }, []);
79
84
  var onFieldValueChange = useCallback(function (event, fieldId) {
80
- var tempValue = event; // Checks if value receieved is a key or event
85
+ var tempValue = event; // Checks if value received is a key or event
81
86
 
82
87
  if (typeof event !== 'string') {
83
88
  tempValue = event.target.value;
@@ -9,6 +9,7 @@ import { ArrayField, ArrayFieldDeleteButton, Item, SelectField, TextField } from
9
9
  import { jsx as ___EmotionJSX } from "@emotion/react";
10
10
  export default {
11
11
  title: 'Form/ArrayField',
12
+ component: ArrayField,
12
13
  parameters: {
13
14
  actions: {
14
15
  argTypesRegex: '^on.*'
@@ -24,6 +24,12 @@ import { useFocusRing } from '@react-aria/focus';
24
24
  import { mergeProps } from '@react-aria/utils';
25
25
  import { useStatusClasses, usePropWarning, useAriaLabelWarning, useDeprecationWarning } from '../../hooks';
26
26
  import Loader from '../Loader';
27
+ /**
28
+ * Buttons are used to trigger actions or events.
29
+ * This component is based on the [Button - Theme-UI](https://theme-ui.com/components/button/)
30
+ * and includes a variety of styles, such as primary action, secondary action, or warning.
31
+ */
32
+
27
33
  import { jsx as ___EmotionJSX } from "@emotion/react";
28
34
  var Button = /*#__PURE__*/forwardRef(function (props, ref) {
29
35
  var className = props.className,
@@ -11,13 +11,14 @@ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
11
11
  import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
12
12
  import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
13
13
  import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
14
+ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
14
15
  var _excluded = ["shouldFocusOnHover", "shouldSelectOnPressUp"];
15
16
 
16
17
  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; }
17
18
 
18
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
19
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
19
20
 
20
- import React, { useCallback, useRef, useState, forwardRef, useImperativeHandle } from 'react';
21
+ import React, { useCallback, useRef, useState, forwardRef, useImperativeHandle, useEffect } from 'react';
21
22
  import PropTypes from 'prop-types';
22
23
  import { DismissButton, useOverlayPosition } from '@react-aria/overlays';
23
24
  import { useComboBox } from '@react-aria/combobox';
@@ -57,13 +58,14 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
57
58
  onFocusChange = props.onFocusChange,
58
59
  onKeyDown = props.onKeyDown,
59
60
  onKeyUp = props.onKeyUp,
61
+ hasAddOption = props.hasAddOption,
60
62
  hasCustomValue = props.hasCustomValue,
61
63
  hasNoEmptySelection = props.hasNoEmptySelection,
62
64
  defaultSelectedKey = props.defaultSelectedKey,
63
65
  selectedKey = props.selectedKey,
64
66
  onSelectionChange = props.onSelectionChange,
65
- defaultItems = props.defaultItems,
66
- items = props.items,
67
+ initialDefaultItems = props.defaultItems,
68
+ initialItems = props.items,
67
69
  onOpenChange = props.onOpenChange,
68
70
  loadingState = props.loadingState,
69
71
  onLoadMore = props.onLoadMore,
@@ -91,13 +93,11 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
91
93
  onFocusChange: onFocusChange,
92
94
  onKeyDown: onKeyDown,
93
95
  onKeyUp: onKeyUp,
94
- allowsCustomValue: hasCustomValue,
96
+ allowsCustomValue: hasAddOption || hasCustomValue,
95
97
  disallowEmptySelection: hasNoEmptySelection,
96
98
  defaultSelectedKey: defaultSelectedKey,
97
99
  selectedKey: selectedKey,
98
100
  onSelectionChange: onSelectionChange,
99
- defaultItems: defaultItems,
100
- items: items,
101
101
  onOpenChange: onOpenChange,
102
102
  loadingState: loadingState,
103
103
  onLoadMore: onLoadMore,
@@ -123,18 +123,47 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
123
123
 
124
124
  var onSelectionChangeHandler = function onSelectionChangeHandler(key) {
125
125
  var newVal = key || selectedKey || '';
126
+
127
+ if (hasAddOption && selectedKey !== inputValue) {
128
+ newVal = inputValue;
129
+ }
130
+
126
131
  if (onSelectionChange) onSelectionChange(newVal);
127
132
  };
128
133
 
134
+ var shouldShowAddOption = hasAddOption && inputValue && selectedKey !== inputValue;
135
+ var addOption = "ADD: ".concat(inputValue);
136
+
137
+ var getItemsArr = function getItemsArr(initialArr) {
138
+ if (initialArr && shouldShowAddOption) {
139
+ var _context;
140
+
141
+ return _concatInstanceProperty(_context = []).call(_context, initialArr, [{
142
+ name: addOption,
143
+ key: addOption
144
+ }]);
145
+ }
146
+
147
+ return initialArr;
148
+ };
149
+
150
+ var defaultItems = getItemsArr(initialDefaultItems);
151
+ var items = getItemsArr(initialItems);
152
+
129
153
  var _useFilter = useFilter({
130
154
  sensitivity: 'base'
131
155
  }),
132
156
  contains = _useFilter.contains;
133
157
 
134
158
  var state = useComboBoxState(_objectSpread(_objectSpread({}, comboBoxOptions), {}, {
135
- onSelectionChange: hasCustomValue ? onSelectionChangeHandler : onSelectionChange,
159
+ defaultItems: defaultItems,
160
+ items: items,
161
+ onSelectionChange: hasAddOption || hasCustomValue ? onSelectionChangeHandler : onSelectionChange,
136
162
  defaultFilter: typeof defaultFilter !== 'undefined' ? defaultFilter : contains
137
163
  }));
164
+ useEffect(function () {
165
+ if (shouldShowAddOption) state.selectionManager.setFocusedKey(addOption);
166
+ }, [shouldShowAddOption, state, addOption]);
138
167
 
139
168
  var _useComboBox = useComboBox(_objectSpread(_objectSpread({}, comboBoxOptions), {}, {
140
169
  buttonRef: buttonRef,
@@ -241,6 +270,9 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
241
270
  }, listbox));
242
271
  });
243
272
  ComboBoxField.propTypes = {
273
+ /* Whether or not adding new options to the list is enabled. */
274
+ hasAddOption: PropTypes.bool,
275
+
244
276
  /** Whether the ComboBox allows a non-item matching input value to be set. */
245
277
  hasCustomValue: PropTypes.bool,
246
278
 
@@ -1,3 +1,5 @@
1
+ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
2
+ import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
1
3
  import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
2
4
  import _startsWithInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/starts-with";
3
5
  import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
@@ -469,4 +471,53 @@ export var CustomDefaultFilter = function CustomDefaultFilter() {
469
471
  key: item.name
470
472
  }, item.name);
471
473
  }));
474
+ };
475
+ export var ControlledWithAddOption = function ControlledWithAddOption() {
476
+ var _useState11 = useState(items),
477
+ _useState12 = _slicedToArray(_useState11, 2),
478
+ options = _useState12[0],
479
+ setOptions = _useState12[1];
480
+
481
+ var _useState13 = useState(''),
482
+ _useState14 = _slicedToArray(_useState13, 2),
483
+ inputValue = _useState14[0],
484
+ setInputValue = _useState14[1];
485
+
486
+ var _useState15 = useState(''),
487
+ _useState16 = _slicedToArray(_useState15, 2),
488
+ selectedKey = _useState16[0],
489
+ setSelectedKey = _useState16[1];
490
+
491
+ var onSelectionChange = function onSelectionChange(key) {
492
+ // Add new option to options array
493
+ if (key && !_findInstanceProperty(options).call(options, function (_ref2) {
494
+ var name = _ref2.name;
495
+ return name === key;
496
+ })) {
497
+ var _context2;
498
+
499
+ setOptions(_concatInstanceProperty(_context2 = []).call(_context2, options, [{
500
+ key: key,
501
+ name: key
502
+ }]));
503
+ }
504
+
505
+ setInputValue(key);
506
+ setSelectedKey(key);
507
+ };
508
+
509
+ return ___EmotionJSX(OverlayProvider, null, ___EmotionJSX(ComboBoxField, _extends({
510
+ label: "Example label",
511
+ defaultItems: options
512
+ }, actions, {
513
+ inputValue: inputValue,
514
+ selectedKey: selectedKey,
515
+ onInputChange: setInputValue,
516
+ onSelectionChange: onSelectionChange,
517
+ hasAddOption: true
518
+ }), function (item) {
519
+ return ___EmotionJSX(Item, {
520
+ key: item.name
521
+ }, item.name);
522
+ }));
472
523
  };
@@ -9,6 +9,8 @@ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance
9
9
  import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
10
10
  import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
11
11
  import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
12
+ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
13
+ import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
12
14
  import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
13
15
  import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
14
16
  import _startsWithInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/starts-with";
@@ -16,7 +18,7 @@ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
16
18
 
17
19
  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; }
18
20
 
19
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context5, _context6; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context5 = ownKeys(Object(source), !0)).call(_context5, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context6 = ownKeys(Object(source))).call(_context6, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
21
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context6, _context7; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context6 = ownKeys(Object(source), !0)).call(_context6, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context7 = ownKeys(Object(source))).call(_context7, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
20
22
 
21
23
  import React, { useState, useMemo } from 'react';
22
24
  import { axe } from 'jest-axe';
@@ -83,6 +85,54 @@ var ComboBoxWithCustomFilter = function ComboBoxWithCustomFilter() {
83
85
  });
84
86
  };
85
87
 
88
+ var ComboBoxWithAddOption = function ComboBoxWithAddOption() {
89
+ var _useState3 = useState(items),
90
+ _useState4 = _slicedToArray(_useState3, 2),
91
+ options = _useState4[0],
92
+ setOptions = _useState4[1];
93
+
94
+ var _useState5 = useState(''),
95
+ _useState6 = _slicedToArray(_useState5, 2),
96
+ inputValue = _useState6[0],
97
+ setInputValue = _useState6[1];
98
+
99
+ var _useState7 = useState(''),
100
+ _useState8 = _slicedToArray(_useState7, 2),
101
+ selectedKey = _useState8[0],
102
+ setSelectedKey = _useState8[1];
103
+
104
+ var onSelectionChange = function onSelectionChange(key) {
105
+ if (key && !_findInstanceProperty(options).call(options, function (_ref2) {
106
+ var name = _ref2.name;
107
+ return name === key;
108
+ })) {
109
+ var _context;
110
+
111
+ setOptions(_concatInstanceProperty(_context = []).call(_context, options, [{
112
+ key: key,
113
+ name: key
114
+ }]));
115
+ }
116
+
117
+ setInputValue(key);
118
+ setSelectedKey(key);
119
+ };
120
+
121
+ return ___EmotionJSX(ComboBoxField, {
122
+ label: "Example label",
123
+ defaultItems: options,
124
+ inputValue: inputValue,
125
+ selectedKey: selectedKey,
126
+ onInputChange: setInputValue,
127
+ onSelectionChange: onSelectionChange,
128
+ hasAddOption: true
129
+ }, function (item) {
130
+ return ___EmotionJSX(Item, {
131
+ key: item.name
132
+ }, item.name);
133
+ });
134
+ };
135
+
86
136
  beforeAll(function () {
87
137
  jest.spyOn(window.HTMLElement.prototype, 'clientWidth', 'get').mockImplementation(function () {
88
138
  return 1000;
@@ -357,41 +407,41 @@ test('should use default contains filtering', function () {
357
407
  });
358
408
  test('should be able to use controlled filtering', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
359
409
  var options, input;
360
- return _regeneratorRuntime.wrap(function _callee$(_context) {
410
+ return _regeneratorRuntime.wrap(function _callee$(_context2) {
361
411
  while (1) {
362
- switch (_context.prev = _context.next) {
412
+ switch (_context2.prev = _context2.next) {
363
413
  case 0:
364
414
  render(___EmotionJSX(ComboBoxWithCustomFilter, null));
365
415
  input = screen.queryByRole('combobox'); // Should list all without filterable input
366
416
 
367
417
  userEvent.type(input, '{arrowdown}');
368
- _context.next = 5;
418
+ _context2.next = 5;
369
419
  return screen.findAllByRole('option');
370
420
 
371
421
  case 5:
372
- options = _context.sent;
422
+ options = _context2.sent;
373
423
  expect(options).toHaveLength(items.length); // Should only list the second option
374
424
 
375
425
  userEvent.type(input, 'k');
376
- _context.next = 10;
426
+ _context2.next = 10;
377
427
  return screen.findAllByRole('option');
378
428
 
379
429
  case 10:
380
- options = _context.sent;
430
+ options = _context2.sent;
381
431
  expect(options[0]).toHaveTextContent(items[1].name);
382
432
 
383
433
  case 12:
384
434
  case "end":
385
- return _context.stop();
435
+ return _context2.stop();
386
436
  }
387
437
  }
388
438
  }, _callee);
389
439
  })));
390
440
  test('should be able to use custom default filtering', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
391
441
  var options, defaultFilter, input;
392
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
442
+ return _regeneratorRuntime.wrap(function _callee2$(_context3) {
393
443
  while (1) {
394
- switch (_context2.prev = _context2.next) {
444
+ switch (_context3.prev = _context3.next) {
395
445
  case 0:
396
446
  defaultFilter = function defaultFilter(option, inputValue) {
397
447
  return _startsWithInstanceProperty(option).call(option, inputValue);
@@ -403,33 +453,33 @@ test('should be able to use custom default filtering', /*#__PURE__*/_asyncToGene
403
453
  input = screen.queryByRole('combobox'); // Should list all without filterable input
404
454
 
405
455
  userEvent.type(input, '{arrowdown}');
406
- _context2.next = 6;
456
+ _context3.next = 6;
407
457
  return screen.findAllByRole('option');
408
458
 
409
459
  case 6:
410
- options = _context2.sent;
460
+ options = _context3.sent;
411
461
  expect(options).toHaveLength(items.length); // Should only list the second option
412
462
 
413
463
  userEvent.type(input, 'K');
414
- _context2.next = 11;
464
+ _context3.next = 11;
415
465
  return screen.findAllByRole('option');
416
466
 
417
467
  case 11:
418
- options = _context2.sent;
468
+ options = _context3.sent;
419
469
  expect(options[0]).toHaveTextContent(items[1].name);
420
470
 
421
471
  case 13:
422
472
  case "end":
423
- return _context2.stop();
473
+ return _context3.stop();
424
474
  }
425
475
  }
426
476
  }, _callee2);
427
477
  })));
428
478
  test('should show in input "textValue" if provided', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
429
479
  var newItems, input, options;
430
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
480
+ return _regeneratorRuntime.wrap(function _callee3$(_context4) {
431
481
  while (1) {
432
- switch (_context3.prev = _context3.next) {
482
+ switch (_context4.prev = _context4.next) {
433
483
  case 0:
434
484
  newItems = _mapInstanceProperty(items).call(items, function (item) {
435
485
  return _objectSpread(_objectSpread({}, item), {}, {
@@ -441,11 +491,11 @@ test('should show in input "textValue" if provided', /*#__PURE__*/_asyncToGenera
441
491
  });
442
492
  input = screen.queryByRole('combobox');
443
493
  userEvent.click(input);
444
- _context3.next = 6;
494
+ _context4.next = 6;
445
495
  return screen.findAllByRole('option');
446
496
 
447
497
  case 6:
448
- options = _context3.sent;
498
+ options = _context4.sent;
449
499
  userEvent.click(options[0]);
450
500
  expect(input).toHaveValue(newItems[0].textValue); // Check that on clicking again "textValue" still returning
451
501
 
@@ -454,7 +504,7 @@ test('should show in input "textValue" if provided', /*#__PURE__*/_asyncToGenera
454
504
 
455
505
  case 11:
456
506
  case "end":
457
- return _context3.stop();
507
+ return _context4.stop();
458
508
  }
459
509
  }
460
510
  }, _callee3);
@@ -777,25 +827,56 @@ test('onSelectionChange works properly with custom value', function () {
777
827
  userEvent.type(input, '{selectall}{backspace}{enter}');
778
828
  expect(onSelectionChange).toHaveBeenCalledWith('');
779
829
  });
830
+ test('add option shows when "hasAddOption" is provided', function () {
831
+ render(___EmotionJSX(ComboBoxWithAddOption, null));
832
+ var input = screen.queryByRole('combobox');
833
+ expect(input).toHaveValue('');
834
+ expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
835
+ expect(screen.queryByRole('option')).not.toBeInTheDocument();
836
+ var inputValue = 'New value';
837
+ userEvent.type(input, inputValue);
838
+ expect(input).toHaveValue(inputValue);
839
+ expect(screen.queryByRole('listbox')).toBeInTheDocument();
840
+ var option = screen.queryByRole('option');
841
+ expect(option).toBeInTheDocument();
842
+ expect(option).toHaveClass('is-focused');
843
+ expect(option).toHaveTextContent("ADD: ".concat(inputValue));
844
+ });
845
+ test('if "hasAddOption" is provided, then custom value is added to listbox on blur', function () {
846
+ render(___EmotionJSX(ComboBoxWithAddOption, null));
847
+ var input = screen.queryByRole('combobox');
848
+ var inputValue = 'New value';
849
+ userEvent.type(input, inputValue);
850
+ expect(input).toHaveValue(inputValue); // blur input
851
+
852
+ userEvent.tab();
853
+ expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
854
+ expect(screen.queryByRole('option')).not.toBeInTheDocument();
855
+ userEvent.click(input);
856
+ expect(input).toHaveValue(inputValue);
857
+ expect(screen.queryByRole('listbox')).toBeInTheDocument();
858
+ var options = screen.queryAllByRole('option');
859
+ expect(options[options.length - 1]).toHaveTextContent(inputValue);
860
+ });
780
861
  test('should have no accessibility violations', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
781
862
  var _getComponent6, container, results;
782
863
 
783
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
864
+ return _regeneratorRuntime.wrap(function _callee4$(_context5) {
784
865
  while (1) {
785
- switch (_context4.prev = _context4.next) {
866
+ switch (_context5.prev = _context5.next) {
786
867
  case 0:
787
868
  jest.useRealTimers();
788
869
  _getComponent6 = getComponent(), container = _getComponent6.container;
789
- _context4.next = 4;
870
+ _context5.next = 4;
790
871
  return axe(container);
791
872
 
792
873
  case 4:
793
- results = _context4.sent;
874
+ results = _context5.sent;
794
875
  expect(results).toHaveNoViolations();
795
876
 
796
877
  case 6:
797
878
  case "end":
798
- return _context4.stop();
879
+ return _context5.stop();
799
880
  }
800
881
  }
801
882
  }, _callee4);
@@ -9,6 +9,12 @@ import { useFocusRing } from '@react-aria/focus';
9
9
  import { useHover, usePress } from '@react-aria/interactions';
10
10
  import { mergeProps } from '@react-aria/utils';
11
11
  import { usePropWarning, useStatusClasses } from '../../hooks';
12
+ /**
13
+ * Link uses the [Link - Theme-UI](https://theme-ui.com/components/link) component and
14
+ * React Aria's [useLink](https://react-spectrum.adobe.com/react-aria/useLink.html) hook.
15
+ *
16
+ */
17
+
12
18
  import { jsx as ___EmotionJSX } from "@emotion/react";
13
19
  var Link = /*#__PURE__*/forwardRef(function (props, ref) {
14
20
  var className = props.className,
@@ -58,6 +58,12 @@ export function useListLayout(state) {
58
58
  layout.disabledKeys = state.disabledKeys;
59
59
  return layout;
60
60
  }
61
+ /**
62
+ * ListViews are used to display a list of items. Users can select,
63
+ * view, or edit items in this list. This virtualized component supports
64
+ * asynchronous data in infinitely scrollable lists.
65
+ */
66
+
61
67
  var ListView = /*#__PURE__*/forwardRef(function (props, ref) {
62
68
  var disabledKeys = props.disabledKeys,
63
69
  loadingState = props.loadingState,
@@ -10,6 +10,11 @@ import { useListState } from '@react-stately/list';
10
10
  import statuses from '../../utils/devUtils/constants/statuses';
11
11
  import Message from './Message';
12
12
  import Box from '../Box';
13
+ /**
14
+ *Messages are intended to display non-critical alerts that
15
+ attract the users’ attention, but do not interfere or temporarily block their work.
16
+ */
17
+
13
18
  import { jsx as ___EmotionJSX } from "@emotion/react";
14
19
  var Messages = /*#__PURE__*/forwardRef(function (props, ref) {
15
20
  var _context;
@@ -26,6 +26,12 @@ import IconButton from '../IconButton';
26
26
  import Icon from '../Icon';
27
27
  import Text from '../Text';
28
28
  import { useStatusClasses, useDeprecationWarning } from '../../hooks';
29
+ /**
30
+ * Modals are overlays that interrupt a user’s workflow to convey an important message.
31
+ * The component must be wrapped in an OverlayProvider, and the first child should be a trigger,
32
+ * such as Button.
33
+ */
34
+
29
35
  import { jsx as ___EmotionJSX } from "@emotion/react";
30
36
  var Modal = /*#__PURE__*/forwardRef(function (props, ref) {
31
37
  var className = props.className,
@@ -12,7 +12,7 @@ import { Separator, Box, Link, NavBar, NavBarSection, NavBarItemButton, NavBarIt
12
12
  import { jsx as ___EmotionJSX } from "@emotion/react";
13
13
  export default {
14
14
  title: 'NavBar',
15
- component: 'NavBar',
15
+ component: NavBar,
16
16
  subcomponents: {
17
17
  NavBarSection: NavBarSection,
18
18
  NavBarItemLink: NavBarItemLink,
@@ -9,6 +9,10 @@ import { FocusScope } from '@react-aria/focus';
9
9
  import Box from '../Box';
10
10
  import { useStatusClasses, useOverlayPanelState } from '../../hooks';
11
11
  import { panelSizes } from '../../utils/devUtils/constants/panelSizes';
12
+ /**
13
+ * In Astro, side panels are used to show details and present modal interactions.
14
+ */
15
+
12
16
  import { jsx as ___EmotionJSX } from "@emotion/react";
13
17
  var OverlayPanel = /*#__PURE__*/forwardRef(function (props, ref) {
14
18
  var _props$sx;
@@ -11,6 +11,11 @@ import DefaultCircle from 'mdi-react/CheckboxBlankCircleOutlineIcon';
11
11
  import Box from '../Box';
12
12
  import Text from '../Text';
13
13
  import Icon from '../Icon';
14
+ /**
15
+ * List of requirements for a password, with indicators that can change to show when
16
+ * requirements are satisfied.
17
+ */
18
+
14
19
  import { jsx as ___EmotionJSX } from "@emotion/react";
15
20
  var RequirementsList = /*#__PURE__*/forwardRef(function (props, ref) {
16
21
  var requirements = props.requirements,
@@ -20,6 +20,10 @@ import React, { forwardRef, useImperativeHandle, useLayoutEffect, useRef, useSta
20
20
  import PropTypes from 'prop-types';
21
21
  import Box from '../Box';
22
22
  import useStatusClasses from '../../hooks/useStatusClasses';
23
+ /**
24
+ * Scrollbox is a container that allows content to be scrolled
25
+ */
26
+
23
27
  import { jsx as ___EmotionJSX } from "@emotion/react";
24
28
  var ScrollBox = /*#__PURE__*/forwardRef(function (props, ref) {
25
29
  var maxHeight = props.maxHeight,
@@ -31,7 +35,7 @@ var ScrollBox = /*#__PURE__*/forwardRef(function (props, ref) {
31
35
 
32
36
  var _useState = useState(0),
33
37
  _useState2 = _slicedToArray(_useState, 2),
34
- scrollTopPostion = _useState2[0],
38
+ scrollTopPosition = _useState2[0],
35
39
  setScrollTopPosition = _useState2[1];
36
40
 
37
41
  var _useState3 = useState(false),
@@ -59,7 +63,7 @@ var ScrollBox = /*#__PURE__*/forwardRef(function (props, ref) {
59
63
  setIsTopShadowShowing(outerRef.current.firstChild.scrollTop !== 0);
60
64
  }
61
65
  }
62
- }, [scrollTopPostion]);
66
+ }, [scrollTopPosition]);
63
67
  /* istanbul ignore next */
64
68
 
65
69
  var onScroll = function onScroll() {
@@ -31,6 +31,12 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
31
31
  var ACTIVE = stepStatuses.ACTIVE,
32
32
  COMPLETED = stepStatuses.COMPLETED,
33
33
  INACTIVE = stepStatuses.INACTIVE;
34
+ /**
35
+ * The Stepper component acts as a wrapper for individual Step components.
36
+ * Stepper is used to display progress through a sequence of logical and numbered steps
37
+ * usually within a configuration wizard.
38
+ */
39
+
34
40
  var Stepper = /*#__PURE__*/forwardRef(function (props, ref) {
35
41
  var activeStep = props.activeStep,
36
42
  onStepChange = props.onStepChange,
@@ -13,6 +13,11 @@ import { useStatusClasses, usePropWarning } from '../../hooks';
13
13
  import ORIENTATION from '../../utils/devUtils/constants/orientation';
14
14
  import TabPicker from '../TabPicker';
15
15
  import { Box, Text, TooltipTrigger, Tooltip, Button } from '../..';
16
+ /**
17
+ * Tab control for dividing up closely-related content.
18
+ * Typically used as a child of the Tabs component.
19
+ */
20
+
16
21
  import { jsx as ___EmotionJSX } from "@emotion/react";
17
22
  export var CollectionTab = /*#__PURE__*/forwardRef(function (props, ref) {
18
23
  var className = props.className,
@@ -28,6 +28,10 @@ import ORIENTATION from '../../utils/devUtils/constants/orientation';
28
28
  import { usePropWarning } from '../../hooks';
29
29
  import { jsx as ___EmotionJSX } from "@emotion/react";
30
30
  export var TabsContext = /*#__PURE__*/React.createContext({});
31
+ /**
32
+ * Tabs are used to divide content, navigate to other views, and indicate work progress.
33
+ */
34
+
31
35
  var Tabs = /*#__PURE__*/forwardRef(function (props, ref) {
32
36
  var _context4, _context5;
33
37
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "1.16.0-alpha.4",
3
+ "version": "1.17.0-alpha.0",
4
4
  "description": "PingUX themeable React component library",
5
5
  "author": "ux-development@pingidentity.com",
6
6
  "license": "Apache-2.0",