@pingux/astro 1.2.0-alpha.6 → 1.2.1

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 (76) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/lib/cjs/components/AccordionGridGroup/AccordionGridGroup.js +32 -25
  3. package/lib/cjs/components/AccordionGridGroup/AccordionGridGroup.stories.js +148 -169
  4. package/lib/cjs/components/AccordionGridGroup/AccordionGridGroup.test.js +25 -30
  5. package/lib/cjs/components/AccordionGridItem/AccordionGridItem.js +29 -14
  6. package/lib/cjs/components/AccordionGridItem/AccordionGridItemBody.js +3 -3
  7. package/lib/cjs/components/AccordionGridItem/AccordionGridItemHeader.js +16 -18
  8. package/lib/cjs/components/AccordionGroup/AccordionGroup.js +2 -1
  9. package/lib/cjs/components/AccordionGroup/AccordionGroup.test.js +20 -1
  10. package/lib/cjs/components/Breadcrumbs/Breadcrumbs.stories.js +3 -3
  11. package/lib/cjs/components/Button/Button.js +14 -2
  12. package/lib/cjs/components/Button/Button.stories.js +33 -33
  13. package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.js +5 -3
  14. package/lib/cjs/components/Link/Link.js +2 -1
  15. package/lib/cjs/components/ListView/ListView.js +9 -13
  16. package/lib/cjs/components/ListViewItem/ListViewItem.js +15 -3
  17. package/lib/cjs/components/Modal/Modal.stories.js +1 -1
  18. package/lib/cjs/components/OverlayPanel/OverlayPanel.js +2 -16
  19. package/lib/cjs/components/OverlayPanel/OverlayPanel.test.js +44 -0
  20. package/lib/cjs/components/RockerButton/RockerButton.js +14 -22
  21. package/lib/cjs/components/RockerButtonGroup/RockerButtonGroup.js +5 -9
  22. package/lib/cjs/components/RockerButtonGroup/RockerButtonGroup.stories.js +4 -22
  23. package/lib/cjs/components/RockerButtonGroup/RockerButtonGroup.test.js +5 -14
  24. package/lib/cjs/components/SearchField/SearchField.stories.js +1 -15
  25. package/lib/cjs/components/TextAreaField/TextAreaField.js +54 -9
  26. package/lib/cjs/components/TextAreaField/TextAreaField.stories.js +31 -52
  27. package/lib/cjs/components/TextAreaField/TextAreaField.test.js +12 -0
  28. package/lib/cjs/context/AccordionGridContext/index.js +20 -0
  29. package/lib/cjs/hooks/useAriaLabelWarning/useAriaLabelWarning.js +2 -1
  30. package/lib/cjs/hooks/useField/useField.js +5 -0
  31. package/lib/cjs/hooks/useRockerButton/useRockerButton.js +4 -6
  32. package/lib/cjs/layouts/ListLayout.stories.js +6 -6
  33. package/lib/cjs/recipes/ArrayField.stories.js +1 -1
  34. package/lib/cjs/recipes/ConditionalFilter.stories.js +7 -3
  35. package/lib/cjs/recipes/RadioButtonsWithLinks.stories.js +1 -1
  36. package/lib/cjs/styles/variants/boxes.js +9 -0
  37. package/lib/cjs/styles/variants/buttons.js +20 -0
  38. package/lib/components/AccordionGridGroup/AccordionGridGroup.js +32 -24
  39. package/lib/components/AccordionGridGroup/AccordionGridGroup.stories.js +143 -166
  40. package/lib/components/AccordionGridGroup/AccordionGridGroup.test.js +24 -25
  41. package/lib/components/AccordionGridItem/AccordionGridItem.js +29 -15
  42. package/lib/components/AccordionGridItem/AccordionGridItemBody.js +4 -4
  43. package/lib/components/AccordionGridItem/AccordionGridItemHeader.js +19 -20
  44. package/lib/components/AccordionGroup/AccordionGroup.js +2 -1
  45. package/lib/components/AccordionGroup/AccordionGroup.test.js +16 -2
  46. package/lib/components/Breadcrumbs/Breadcrumbs.stories.js +3 -3
  47. package/lib/components/Button/Button.js +15 -3
  48. package/lib/components/Button/Button.stories.js +17 -15
  49. package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.js +5 -3
  50. package/lib/components/Link/Link.js +2 -1
  51. package/lib/components/ListView/ListView.js +9 -12
  52. package/lib/components/ListViewItem/ListViewItem.js +14 -3
  53. package/lib/components/Modal/Modal.stories.js +1 -1
  54. package/lib/components/OverlayPanel/OverlayPanel.js +3 -16
  55. package/lib/components/OverlayPanel/OverlayPanel.test.js +38 -0
  56. package/lib/components/RockerButton/RockerButton.js +14 -21
  57. package/lib/components/RockerButtonGroup/RockerButtonGroup.js +5 -9
  58. package/lib/components/RockerButtonGroup/RockerButtonGroup.stories.js +2 -17
  59. package/lib/components/RockerButtonGroup/RockerButtonGroup.test.js +5 -11
  60. package/lib/components/SearchField/SearchField.stories.js +0 -11
  61. package/lib/components/TextAreaField/TextAreaField.js +54 -10
  62. package/lib/components/TextAreaField/TextAreaField.stories.js +26 -42
  63. package/lib/components/TextAreaField/TextAreaField.test.js +13 -0
  64. package/lib/context/AccordionGridContext/index.js +5 -0
  65. package/lib/hooks/useAriaLabelWarning/useAriaLabelWarning.js +2 -1
  66. package/lib/hooks/useField/useField.js +5 -0
  67. package/lib/hooks/useRockerButton/useRockerButton.js +4 -6
  68. package/lib/layouts/ListLayout.stories.js +6 -6
  69. package/lib/recipes/ArrayField.stories.js +1 -1
  70. package/lib/recipes/ConditionalFilter.stories.js +7 -3
  71. package/lib/recipes/RadioButtonsWithLinks.stories.js +1 -1
  72. package/lib/styles/variants/boxes.js +9 -0
  73. package/lib/styles/variants/buttons.js +20 -0
  74. package/package.json +3 -3
  75. package/lib/cjs/components/AccordionGridGroup/AccordionGridContext.js +0 -17
  76. package/lib/components/AccordionGridGroup/AccordionGridContext.js +0 -2
@@ -118,7 +118,9 @@ var Default = function Default() {
118
118
  setEditOverviewVisible = _React$useState4[1];
119
119
 
120
120
  return (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_index.OverlayProvider, null, (0, _react2.jsx)(_index.Button, {
121
- onPress: setStaticOverviewVisible
121
+ onPress: function onPress() {
122
+ return setStaticOverviewVisible(true);
123
+ }
122
124
  }, "Open Panel"), staticOverviewVisible && (0, _react2.jsx)(_OverlayPanel["default"], {
123
125
  isOpen: staticOverviewVisible
124
126
  }, (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(_index.Box, {
@@ -133,7 +135,9 @@ var Default = function Default() {
133
135
  "aria-label": "edit",
134
136
  variant: "inverted",
135
137
  ml: "xs",
136
- onPress: setEditOverviewVisible
138
+ onPress: function onPress() {
139
+ return setEditOverviewVisible(true);
140
+ }
137
141
  }, (0, _react2.jsx)(_index.Icon, {
138
142
  icon: _CreateIcon["default"],
139
143
  size: 14
@@ -457,7 +461,7 @@ var Default = function Default() {
457
461
  onPress: function onPress() {
458
462
  return setEditOverviewVisible(false);
459
463
  },
460
- variant: "text",
464
+ variant: "link",
461
465
  "aria-label": "cancel"
462
466
  }, "Cancel"))))));
463
467
  };
@@ -72,7 +72,7 @@ var Default = function Default() {
72
72
  label: fieldName,
73
73
  isDisabled: isDisabled
74
74
  }), (0, _react2.jsx)(_index.Button, {
75
- variant: "text",
75
+ variant: "link",
76
76
  mb: "xs",
77
77
  ml: "md",
78
78
  onPress: function onPress() {
@@ -139,6 +139,14 @@ var inputInContainerSlot = {
139
139
  top: '50%',
140
140
  transform: 'translateY(-50%)'
141
141
  };
142
+ var textFieldInContainerSlot = {
143
+ position: 'absolute',
144
+ bg: 'transparent',
145
+ width: '20px',
146
+ right: '10px',
147
+ top: '50%',
148
+ transform: 'translateY(-50%)'
149
+ };
142
150
  var copy = {
143
151
  alignItems: 'center',
144
152
  width: 'max-content',
@@ -317,6 +325,7 @@ var _default = {
317
325
  environmentChip: environmentChip,
318
326
  expandableRow: expandableRow,
319
327
  inputInContainerSlot: inputInContainerSlot,
328
+ textFieldInContainerSlot: textFieldInContainerSlot,
320
329
  fileInputFieldWrapper: fileInputFieldWrapper,
321
330
  listItem: listItem,
322
331
  listBoxSectionTitle: listBoxSectionTitle,
@@ -397,6 +397,7 @@ var chipDeleteButton = {
397
397
  };
398
398
 
399
399
  var rocker = _objectSpread(_objectSpread({}, base), {}, {
400
+ border: '0',
400
401
  display: 'inline-flex',
401
402
  height: '26px',
402
403
  lineHeight: '26px',
@@ -408,6 +409,7 @@ var rocker = _objectSpread(_objectSpread({}, base), {}, {
408
409
  textTransform: 'uppercase',
409
410
  bg: 'accent.95',
410
411
  '&.is-selected': {
412
+ bg: 'active',
411
413
  color: 'white'
412
414
  },
413
415
  '&.is-focused': _objectSpread({}, defaultFocus)
@@ -561,6 +563,23 @@ var tooltipInline = _objectSpread(_objectSpread({}, text), {}, {
561
563
  }
562
564
  });
563
565
 
566
+ var defaultVariant = _objectSpread(_objectSpread({}, base), {}, {
567
+ bg: 'white',
568
+ border: '1px solid',
569
+ borderColor: 'active',
570
+ '&.is-hovered': _objectSpread({}, defaultHover),
571
+ '&.is-pressed': _objectSpread({}, defaultActive),
572
+ '&.is-focused': _objectSpread({}, defaultFocus)
573
+ });
574
+
575
+ var filter = _objectSpread(_objectSpread({}, defaultVariant), {}, {
576
+ px: 'sm',
577
+ borderColor: 'neutral.80',
578
+ height: 40,
579
+ color: 'active',
580
+ display: 'flex'
581
+ });
582
+
564
583
  var colorBlock = {
565
584
  bg: 'neutral.95',
566
585
  border: '1px solid',
@@ -633,6 +652,7 @@ var _default = {
633
652
  environmentBreadcrumb: environmentBreadcrumb,
634
653
  expandableRow: expandableRow,
635
654
  fileInputField: fileInputField,
655
+ filter: filter,
636
656
  iconButton: iconButton,
637
657
  imageUpload: imageUpload,
638
658
  inline: inline,
@@ -18,11 +18,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
18
18
  import React, { useMemo, forwardRef, useImperativeHandle, useRef } from 'react';
19
19
  import { GridCollection, useGridState } from '@react-stately/grid';
20
20
  import { GridKeyboardDelegate, useGrid } from '@react-aria/grid';
21
- import { mergeProps } from '@react-aria/utils';
22
21
  import { useListState } from '@react-stately/list';
23
22
  import PropTypes from 'prop-types';
24
23
  import { useCollator, useLocale } from '@react-aria/i18n';
25
- import { AccordionGridContext } from './AccordionGridContext';
24
+ import { AccordionGridContext } from '../../context/AccordionGridContext';
26
25
  import AccordionGridItem from '../AccordionGridItem';
27
26
  import Box from '../Box';
28
27
  import { isIterableProp } from '../../utils/devUtils/props/isIterable';
@@ -46,9 +45,7 @@ export var collectionTypes = {
46
45
  var AccordionGridGroup = /*#__PURE__*/forwardRef(function (props, ref) {
47
46
  var _context2;
48
47
 
49
- var disabledKeys = props.disabledKeys,
50
- selectedKeys = props.selectedKeys,
51
- onSelectionChange = props.onSelectionChange;
48
+ var disabledKeys = props.disabledKeys;
52
49
  var accordionGridRef = useRef();
53
50
  /* istanbul ignore next */
54
51
 
@@ -73,9 +70,11 @@ var AccordionGridGroup = /*#__PURE__*/forwardRef(function (props, ref) {
73
70
  columnCount: 1,
74
71
  items: _mapInstanceProperty(_context = _Array$from(collection)).call(_context, function (item) {
75
72
  return _objectSpread(_objectSpread({}, item), {}, {
73
+ key: "row-".concat(item.key),
76
74
  hasChildNodes: true,
77
75
  childNodes: [{
78
- key: "cell-".concat(item.key),
76
+ key: item.key,
77
+ // use key for first cell, fixes selection after changes from UIP-5170
79
78
  type: 'cell',
80
79
  index: 0,
81
80
  value: null,
@@ -101,12 +100,11 @@ var AccordionGridGroup = /*#__PURE__*/forwardRef(function (props, ref) {
101
100
  }, [collection]);
102
101
  var state = useGridState(_objectSpread(_objectSpread({}, props), {}, {
103
102
  disabledKeys: disabledKeys,
104
- selectedKeys: selectedKeys,
105
103
  collection: gridCollection,
106
- selectionMode: 'multiple',
107
- onSelectionChange: onSelectionChange,
108
- allowsCellSelection: true
109
- }));
104
+ selectionMode: 'multiple'
105
+ })); // Required to enable header selection
106
+
107
+ state.selectionManager.allowsCellSelection = true;
110
108
  var keyboardDelegate = useMemo(function () {
111
109
  return new GridKeyboardDelegate({
112
110
  collection: state.collection,
@@ -119,7 +117,6 @@ var AccordionGridGroup = /*#__PURE__*/forwardRef(function (props, ref) {
119
117
  }, [state, accordionGridRef, direction, collator]);
120
118
 
121
119
  var _useGrid = useGrid(_objectSpread(_objectSpread({}, props), {}, {
122
- isVirtualized: true,
123
120
  keyboardDelegate: keyboardDelegate
124
121
  }), state, accordionGridRef),
125
122
  gridProps = _useGrid.gridProps;
@@ -129,7 +126,7 @@ var AccordionGridGroup = /*#__PURE__*/forwardRef(function (props, ref) {
129
126
  state: state,
130
127
  keyboardDelegate: keyboardDelegate
131
128
  }
132
- }, ___EmotionJSX(Box, _extends({}, mergeProps(gridProps), {
129
+ }, ___EmotionJSX(Box, _extends({}, gridProps, {
133
130
  ref: accordionGridRef
134
131
  }), _mapInstanceProperty(_context2 = _Array$from(state.collection)).call(_context2, function (item) {
135
132
  return ___EmotionJSX(AccordionGridItem, _extends({
@@ -139,6 +136,27 @@ var AccordionGridGroup = /*#__PURE__*/forwardRef(function (props, ref) {
139
136
  })));
140
137
  });
141
138
  AccordionGridGroup.propTypes = {
139
+ /**
140
+ * The currently selected keys in the collection (uncontrolled).
141
+ *
142
+ * `selectedKeys="all"` can be used to select every key.
143
+ */
144
+ defaultSelectedKeys: isIterableProp,
145
+
146
+ /**
147
+ * The currently selected keys in the collection (controlled).
148
+ *
149
+ * `selectedKeys="all"` can be used to select every key.
150
+ */
151
+ selectedKeys: isIterableProp,
152
+
153
+ /**
154
+ * Callback function that fires when the selected key changes.
155
+ *
156
+ * `(selectedKeys: Set) => void`
157
+ */
158
+ onSelectionChange: PropTypes.func,
159
+
142
160
  /**
143
161
  * The item keys that are disabled. These items cannot be selected, focused, or otherwise
144
162
  * interacted with.
@@ -164,17 +182,7 @@ AccordionGridGroup.propTypes = {
164
182
  * Identifies the element (or elements) that provide a detailed, extended description for
165
183
  * the object.
166
184
  */
167
- 'aria-details': PropTypes.string,
168
-
169
- /**
170
- * The currently selected keys in the collection (controlled).
171
- *
172
- * `selectedKeys="all"` can be used to select every key.
173
- */
174
- selectedKeys: isIterableProp,
175
-
176
- /** Callback function that fires when the selected key changes. */
177
- onSelectionChange: PropTypes.func
185
+ 'aria-details': PropTypes.string
178
186
  };
179
187
  AccordionGridGroup.defaultProps = {
180
188
  'aria-label': 'accordion'
@@ -1,5 +1,5 @@
1
- import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
2
1
  import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
2
+ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
3
3
  import React, { useState } from 'react';
4
4
  import { Item } from '@react-stately/collections';
5
5
  import CreateIcon from 'mdi-react/CreateIcon';
@@ -72,188 +72,165 @@ export default {
72
72
  }
73
73
  }
74
74
  };
75
- export var Default = function Default() {
76
- var _useState = useState([]),
77
- _useState2 = _slicedToArray(_useState, 2),
78
- selectedKeys = _useState2[0],
79
- setselectedKeys = _useState2[1];
80
75
 
81
- var Header = function Header(props) {
82
- var item = props.item;
76
+ var Header = function Header(props) {
77
+ var item = props.item;
78
+ return ___EmotionJSX(Box, {
79
+ isRow: true,
80
+ sx: {
81
+ flexGrow: 1
82
+ }
83
+ }, ___EmotionJSX(Box, {
84
+ isRow: true,
85
+ alignSelf: "center",
86
+ sx: {
87
+ flexGrow: 1,
88
+ width: '50%'
89
+ }
90
+ }, ___EmotionJSX(Text, {
91
+ sx: {
92
+ fontWeight: 3,
93
+ textOverflow: 'ellipsis',
94
+ whiteSpace: 'nowrap',
95
+ overflow: 'hidden'
96
+ },
97
+ variant: "itemTitle",
98
+ alignSelf: "center"
99
+ }, item.name)), ___EmotionJSX(Box, {
100
+ isRow: true,
101
+ alignSelf: "center",
102
+ sx: {
103
+ flexGrow: 1,
104
+ width: '50%'
105
+ }
106
+ }, ___EmotionJSX(Text, {
107
+ sx: {
108
+ fontWeight: 0,
109
+ textOverflow: 'ellipsis',
110
+ whiteSpace: 'nowrap',
111
+ overflow: 'hidden'
112
+ },
113
+ alignSelf: "center"
114
+ }, item.organizations.length, " Organizations"), ___EmotionJSX(Box, {
115
+ isRow: true,
116
+ alignSelf: "center",
117
+ sx: {
118
+ ml: 'auto'
119
+ }
120
+ }, ___EmotionJSX(IconButton, {
121
+ "aria-label": "create-icon",
122
+ sx: {
123
+ mr: '4px',
124
+ height: '26px',
125
+ width: '26px'
126
+ }
127
+ }, ___EmotionJSX(CreateIcon, null)), ___EmotionJSX(IconButton, {
128
+ "aria-label": "vertical-lines-icon",
129
+ sx: {
130
+ mr: '4px',
131
+ height: '26px',
132
+ width: '26px'
133
+ }
134
+ }, ___EmotionJSX(MoreVertIcon, null)))));
135
+ };
136
+
137
+ var Body = function Body(props) {
138
+ var _context;
139
+
140
+ var item = props.item;
141
+ return ___EmotionJSX(Box, {
142
+ isRow: true
143
+ }, ___EmotionJSX(Box, {
144
+ sx: {
145
+ flexGrow: 1,
146
+ width: 'calc(50% - 20px)'
147
+ }
148
+ }, ___EmotionJSX(Link, {
149
+ "aria-label": "permissions",
150
+ variant: "link",
151
+ sx: {
152
+ marginTop: '15px',
153
+ whiteSpace: 'nowrap',
154
+ overflow: 'hidden',
155
+ textOverflow: 'ellipsis',
156
+ textDecoration: 'none'
157
+ },
158
+ href: "https://www.pingidentity.com",
159
+ target: "_blank"
160
+ }, "View permissions")), ___EmotionJSX(Box, {
161
+ sx: {
162
+ flexGrow: 1,
163
+ width: '50%'
164
+ }
165
+ }, _mapInstanceProperty(_context = item.organizations).call(_context, function (org) {
166
+ var _context2;
167
+
83
168
  return ___EmotionJSX(Box, {
84
- isRow: true,
169
+ key: "box".concat(org.name),
85
170
  sx: {
86
- flexGrow: 1
87
- }
88
- }, ___EmotionJSX(Box, {
89
- isRow: true,
90
- alignSelf: "center",
91
- sx: {
92
- flexGrow: 1,
93
- width: '50%'
94
- }
95
- }, ___EmotionJSX(Text, {
96
- sx: {
97
- fontWeight: 3,
98
- textOverflow: 'ellipsis',
99
- whiteSpace: 'nowrap',
100
- overflow: 'hidden'
101
- },
102
- variant: "itemTitle",
103
- alignSelf: "center"
104
- }, item.name)), ___EmotionJSX(Box, {
105
- isRow: true,
106
- alignSelf: "center",
107
- sx: {
108
- flexGrow: 1,
109
- width: '50%'
171
+ marginTop: '15px',
172
+ mb: '15px'
110
173
  }
111
174
  }, ___EmotionJSX(Text, {
112
175
  sx: {
113
- fontWeight: 0,
114
176
  textOverflow: 'ellipsis',
115
177
  whiteSpace: 'nowrap',
116
178
  overflow: 'hidden'
117
179
  },
118
- alignSelf: "center"
119
- }, item.organizations.length, " Organizations"), ___EmotionJSX(Box, {
120
- isRow: true,
121
- alignSelf: "center",
122
- sx: {
123
- ml: 'auto'
124
- }
125
- }, ___EmotionJSX(IconButton, {
126
- "aria-label": "create-icon",
127
- sx: {
128
- mr: '4px',
129
- height: '26px',
130
- width: '26px'
131
- }
132
- }, ___EmotionJSX(CreateIcon, null)), ___EmotionJSX(IconButton, {
133
- "aria-label": "vertical-lines-icon",
134
- sx: {
135
- mr: '4px',
136
- height: '26px',
137
- width: '26px'
138
- }
139
- }, ___EmotionJSX(MoreVertIcon, null)))));
140
- };
141
-
142
- var Body = function Body(props) {
143
- var _context;
180
+ key: "text".concat(org.name)
181
+ }, org.name), _mapInstanceProperty(_context2 = org.populations).call(_context2, function (pop) {
182
+ return ___EmotionJSX(Text, {
183
+ key: pop,
184
+ sx: {
185
+ marginLeft: 'md',
186
+ mt: '10px',
187
+ textOverflow: 'ellipsis',
188
+ whiteSpace: 'nowrap',
189
+ overflow: 'hidden'
190
+ }
191
+ }, pop, ")");
192
+ }));
193
+ })));
194
+ };
144
195
 
145
- var item = props.item;
146
- return ___EmotionJSX(Box, {
147
- isRow: true
148
- }, ___EmotionJSX(Box, {
196
+ export var Default = function Default() {
197
+ return (// See story source for info about the data used
198
+ ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Text, {
149
199
  sx: {
150
- flexGrow: 1,
151
- width: 'calc(50% - 20px)'
200
+ fontWeight: 3,
201
+ fontSize: '13px'
152
202
  }
153
- }, ___EmotionJSX(Link, {
154
- "aria-label": "permissions",
155
- variant: "link",
156
- sx: {
157
- marginTop: '15px',
158
- whiteSpace: 'nowrap',
159
- overflow: 'hidden',
160
- textOverflow: 'ellipsis',
161
- textDecoration: 'none'
162
- },
163
- href: "https://www.pingidentity.com",
164
- target: "_blank"
165
- }, "View permissions")), ___EmotionJSX(Box, {
203
+ }, "Role"), ___EmotionJSX(Separator, {
166
204
  sx: {
167
- flexGrow: 1,
168
- width: '50%'
205
+ mb: 0
169
206
  }
170
- }, _mapInstanceProperty(_context = item.organizations).call(_context, function (org) {
171
- var _context2;
172
-
173
- return ___EmotionJSX(Box, {
174
- key: "box".concat(org.name),
207
+ }), ___EmotionJSX(AccordionGridGroup, {
208
+ items: data,
209
+ defaultSelectedKeys: ['Environment']
210
+ }, function (item) {
211
+ return ___EmotionJSX(Item, {
212
+ key: item.key,
213
+ textValue: item.name
214
+ }, ___EmotionJSX(Header, {
215
+ item: item
216
+ }), ___EmotionJSX(Body, {
217
+ item: item
218
+ }), item.key !== 'Organization' ? ___EmotionJSX(Separator, {
175
219
  sx: {
176
- marginTop: '15px',
177
- mb: '15px'
220
+ m: 0,
221
+ bg: 'neutral.90'
178
222
  }
179
- }, ___EmotionJSX(Text, {
180
- sx: {
181
- textOverflow: 'ellipsis',
182
- whiteSpace: 'nowrap',
183
- overflow: 'hidden'
184
- },
185
- key: "text".concat(org.name)
186
- }, org.name), _mapInstanceProperty(_context2 = org.populations).call(_context2, function (pop) {
187
- return ___EmotionJSX(Text, {
188
- key: pop,
189
- sx: {
190
- marginLeft: 'md',
191
- mt: '10px',
192
- textOverflow: 'ellipsis',
193
- whiteSpace: 'nowrap',
194
- overflow: 'hidden'
195
- }
196
- }, pop, ")");
197
- }));
198
- })));
199
- };
223
+ }) : null);
224
+ }))
225
+ );
226
+ };
227
+ export var Controlled = function Controlled() {
228
+ var _useState = useState(['Client']),
229
+ _useState2 = _slicedToArray(_useState, 2),
230
+ selectedKeys = _useState2[0],
231
+ setSelectedKeys = _useState2[1];
200
232
 
201
- return (// const data = [
202
- // {
203
- // name: 'Client Application Developer',
204
- // key: '1',
205
- // organizations: [
206
- // {
207
- // name: 'Montana (Environment)',
208
- // populations: [
209
- // 'Administrators (Population)',
210
- // 'Other Population (Population)',
211
- // ],
212
- // },
213
- // {
214
- // name: 'Boston (Environment)',
215
- // populations: [
216
- // ],
217
- // },
218
- // ],
219
- // },
220
- // {
221
- // name: 'Environment Admin',
222
- // key: '2',
223
- // organizations: [
224
- // {
225
- // name: 'Montana (Environment)',
226
- // populations: [
227
- // 'Administrators (Population)',
228
- // 'Other Population (Population)',
229
- // ],
230
- // },
231
- // {
232
- // name: 'Boston (Environment)',
233
- // populations: [
234
- // ],
235
- // },
236
- // ],
237
- // },
238
- // {
239
- // name: 'Organization Admin',
240
- // key: '3',
241
- // organizations: [
242
- // {
243
- // name: 'Montana (Environment)',
244
- // populations: [
245
- // 'Administrators (Population)',
246
- // 'Other Population (Population)',
247
- // ],
248
- // },
249
- // {
250
- // name: 'Boston (Environment)',
251
- // populations: [
252
- // ],
253
- // },
254
- // ],
255
- // },
256
- // ];
233
+ return (// See story source for info about the data used
257
234
  ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Text, {
258
235
  sx: {
259
236
  fontWeight: 3,
@@ -266,7 +243,7 @@ export var Default = function Default() {
266
243
  }), ___EmotionJSX(AccordionGridGroup, {
267
244
  items: data,
268
245
  selectedKeys: selectedKeys,
269
- onSelectionChange: setselectedKeys
246
+ onSelectionChange: setSelectedKeys
270
247
  }, function (item) {
271
248
  return ___EmotionJSX(Item, {
272
249
  key: item.key,
@@ -1,9 +1,11 @@
1
+ import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
2
+ import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
1
3
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
4
  import React from 'react';
3
5
  import { Item } from '@react-stately/collections';
4
6
  import userEvent from '@testing-library/user-event';
5
7
  import axeTest from '../../utils/testUtils/testAxe';
6
- import { act, fireEvent, render, screen } from '../../utils/testUtils/testWrapper';
8
+ import { act, fireEvent, render, screen, waitFor } from '../../utils/testUtils/testWrapper';
7
9
  import { Link, Box, OverlayPanel } from '../../index';
8
10
  import AccordionGridGroup from '../AccordionGridGroup';
9
11
  import { jsx as ___EmotionJSX } from "@emotion/react";
@@ -50,20 +52,6 @@ axeTest(getComponent, {
50
52
  }
51
53
  }
52
54
  });
53
- test('button press', function () {
54
- var onPress = jest.fn();
55
- getComponent({
56
- onPress: onPress
57
- });
58
- var buttons = screen.getAllByRole('gridcell');
59
- var selectedItem = buttons[0];
60
- expect(selectedItem).toBeInTheDocument();
61
- expect(selectedItem).not.toHaveClass('is-pressed');
62
- expect(onPress).not.toHaveBeenCalled(); // Hold down the button to see pressed styles
63
-
64
- fireEvent.mouseDown(selectedItem);
65
- expect(selectedItem).toHaveClass('is-pressed');
66
- });
67
55
  test('button press uses callback', function () {
68
56
  var onPress = jest.fn();
69
57
  getComponent({
@@ -74,8 +62,7 @@ test('button press uses callback', function () {
74
62
  expect(selectedItem).not.toHaveClass('is-pressed');
75
63
  expect(onPress).not.toHaveBeenCalled(); // Hold down the button to see pressed styles
76
64
 
77
- fireEvent.mouseDown(selectedItem);
78
- fireEvent.mouseUp(selectedItem);
65
+ userEvent.click(selectedItem);
79
66
  expect(onPress).toHaveBeenCalled();
80
67
  });
81
68
  test('toggle accordion on mouse click', function () {
@@ -175,14 +162,26 @@ test('disabled keys prop disables an accordion item, and disables focus', functi
175
162
  expect(selectedRow).toHaveClass('is-disabled');
176
163
  expect(selectedRow).not.toHaveClass('is-focused');
177
164
  });
178
- test('default expanded keys expands an accordion item', function () {
179
- getComponent({
180
- selectedKeys: ['first']
181
- });
182
- var row = screen.getAllByRole('row');
183
- var selectedRow = row[0];
184
- expect(selectedRow).toHaveAttribute('aria-selected', 'true');
185
- });
165
+ test('default expanded keys expands an accordion item', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
166
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
167
+ while (1) {
168
+ switch (_context.prev = _context.next) {
169
+ case 0:
170
+ getComponent({
171
+ selectedKeys: ['first']
172
+ });
173
+ _context.next = 3;
174
+ return waitFor(function () {
175
+ return expect(screen.getAllByRole('row')[0]).toHaveAttribute('aria-selected', 'true');
176
+ });
177
+
178
+ case 3:
179
+ case "end":
180
+ return _context.stop();
181
+ }
182
+ }
183
+ }, _callee);
184
+ })));
186
185
  test('items do not automatically expand if wrapped in an open OverlayPanel', function () {
187
186
  getComponentInOverlayPanel();
188
187
  var row = screen.getAllByRole('row');