@pingux/astro 1.41.0-alpha.1 → 1.41.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 (65) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/NOTICE.html +4707 -0
  3. package/lib/Patterns/AttributeMappingDisplayViewPattern.stories.hidden.js +138 -0
  4. package/lib/Patterns/AttributeMappingEditViewPattern.stories.hidden.js +145 -0
  5. package/lib/Patterns/ListAndPanelPattern.stories.hidden.js +381 -0
  6. package/lib/Patterns/MessagesPattern.stories.hidden.js +69 -0
  7. package/lib/Patterns/SaveBarPattern.stories.hidden.js +80 -0
  8. package/lib/Patterns/UnsavedChangesPattern.stories.hidden.js +106 -0
  9. package/lib/cjs/Patterns/AttributeMappingDisplayViewPattern.stories.hidden.js +158 -0
  10. package/lib/cjs/Patterns/AttributeMappingEditViewPattern.stories.hidden.js +167 -0
  11. package/lib/cjs/Patterns/ListAndPanelPattern.stories.hidden.js +418 -0
  12. package/lib/cjs/Patterns/MessagesPattern.stories.hidden.js +99 -0
  13. package/lib/cjs/Patterns/SaveBarPattern.stories.hidden.js +109 -0
  14. package/lib/cjs/Patterns/UnsavedChangesPattern.stories.hidden.js +136 -0
  15. package/lib/cjs/components/Bracket/Bracket.stories.js +1 -3
  16. package/lib/cjs/components/Breadcrumbs/Breadcrumbs.js +1 -1
  17. package/lib/cjs/components/Breadcrumbs/Breadcrumbs.stories.js +2 -18
  18. package/lib/cjs/components/Card/Card.js +117 -2
  19. package/lib/cjs/components/Card/Card.stories.js +45 -17
  20. package/lib/cjs/components/Card/Card.test.js +50 -0
  21. package/lib/cjs/components/ComboBoxField/ComboBoxField.stories.js +13 -1
  22. package/lib/cjs/components/ComboBoxField/ComboBoxField.test.js +75 -4
  23. package/lib/cjs/components/DataTable/DataTable.js +56 -12
  24. package/lib/cjs/components/DataTable/DataTable.stories.js +84 -17
  25. package/lib/cjs/components/DataTable/DataTable.test.js +38 -6
  26. package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.js +1 -1
  27. package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.stories.js +18 -3
  28. package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.test.js +19 -5
  29. package/lib/cjs/components/Image/Image.stories.js +2 -2
  30. package/lib/cjs/components/ListBox/ListBoxSection.js +8 -1
  31. package/lib/cjs/components/ListView/ListView.stories.js +6 -4
  32. package/lib/cjs/components/OverlayPanel/OverlayPanel.stories.js +2 -1
  33. package/lib/cjs/components/SelectField/SelectField.stories.js +13 -1
  34. package/lib/cjs/components/SelectField/SelectField.test.js +75 -0
  35. package/lib/cjs/recipes/ConditionalFilter.stories.js +0 -1
  36. package/lib/cjs/recipes/ScrollableListView.stories.js +3 -2
  37. package/lib/cjs/recipes/TrialExperienceIndustryButtons.stories.js +4 -8
  38. package/lib/cjs/styles/variants/boxes.js +6 -6
  39. package/lib/cjs/utils/devUtils/constants/text.js +11 -0
  40. package/lib/components/Bracket/Bracket.stories.js +1 -3
  41. package/lib/components/Breadcrumbs/Breadcrumbs.js +1 -1
  42. package/lib/components/Breadcrumbs/Breadcrumbs.stories.js +0 -13
  43. package/lib/components/Card/Card.js +110 -2
  44. package/lib/components/Card/Card.stories.js +35 -10
  45. package/lib/components/Card/Card.test.js +36 -0
  46. package/lib/components/ComboBoxField/ComboBoxField.stories.js +13 -1
  47. package/lib/components/ComboBoxField/ComboBoxField.test.js +70 -5
  48. package/lib/components/DataTable/DataTable.js +56 -12
  49. package/lib/components/DataTable/DataTable.stories.js +75 -17
  50. package/lib/components/DataTable/DataTable.test.js +36 -6
  51. package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.js +1 -1
  52. package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.stories.js +18 -3
  53. package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.test.js +16 -5
  54. package/lib/components/Image/Image.stories.js +2 -2
  55. package/lib/components/ListBox/ListBoxSection.js +7 -2
  56. package/lib/components/ListView/ListView.stories.js +6 -4
  57. package/lib/components/OverlayPanel/OverlayPanel.stories.js +2 -1
  58. package/lib/components/SelectField/SelectField.stories.js +13 -1
  59. package/lib/components/SelectField/SelectField.test.js +68 -1
  60. package/lib/recipes/ConditionalFilter.stories.js +0 -1
  61. package/lib/recipes/ScrollableListView.stories.js +3 -2
  62. package/lib/recipes/TrialExperienceIndustryButtons.stories.js +4 -8
  63. package/lib/styles/variants/boxes.js +6 -6
  64. package/lib/utils/devUtils/constants/text.js +1 -0
  65. package/package.json +1 -1
@@ -6,6 +6,10 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/e
6
6
 
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
 
9
+ var _overlays = require("@react-aria/overlays");
10
+
11
+ var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
12
+
9
13
  var _testAxe = _interopRequireDefault(require("../../utils/testUtils/testAxe"));
10
14
 
11
15
  var _testWrapper = require("../../utils/testUtils/testWrapper");
@@ -23,6 +27,37 @@ var items = [{
23
27
  }, {
24
28
  name: 'c'
25
29
  }];
30
+ var withSection = [{
31
+ name: 'Animals',
32
+ key: 'Animals',
33
+ kids: [{
34
+ name: 'Aardvark'
35
+ }, {
36
+ name: 'Kangaroo'
37
+ }, {
38
+ name: 'Snake'
39
+ }]
40
+ }, {
41
+ name: 'People',
42
+ key: 'People',
43
+ kids: [{
44
+ name: 'Michael'
45
+ }, {
46
+ name: 'Dwight'
47
+ }, {
48
+ name: 'Creed'
49
+ }]
50
+ }, {
51
+ name: null,
52
+ key: 'Fruit',
53
+ kids: [{
54
+ name: 'Apple'
55
+ }, {
56
+ name: 'Strawberry'
57
+ }, {
58
+ name: 'Blueberry'
59
+ }]
60
+ }];
26
61
  var testId = 'test-dropdown';
27
62
  var controlTestId = "".concat(testId, "-input");
28
63
  var testValue = 'test';
@@ -48,6 +83,28 @@ var getComponent = function getComponent() {
48
83
  key: item.name
49
84
  }, item.name);
50
85
  }));
86
+ };
87
+
88
+ var getComponentWithSections = function getComponentWithSections() {
89
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
90
+
91
+ var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
92
+ _ref2$renderFn = _ref2.renderFn,
93
+ renderFn = _ref2$renderFn === void 0 ? _testWrapper.render : _ref2$renderFn;
94
+
95
+ return renderFn((0, _react2.jsx)(_overlays.OverlayProvider, null, (0, _react2.jsx)(_index.SelectField, (0, _extends2["default"])({}, defaultProps, props, {
96
+ items: withSection
97
+ }), function (section) {
98
+ return (0, _react2.jsx)(_index.Section, {
99
+ key: section.key,
100
+ items: section.kids,
101
+ title: section.name
102
+ }, function (item) {
103
+ return (0, _react2.jsx)(_index.Item, {
104
+ key: item.name
105
+ }, item.name);
106
+ });
107
+ })));
51
108
  }; // Need to be added to each test file to test accessibility using axe.
52
109
 
53
110
 
@@ -102,4 +159,22 @@ test('passing helper text should display it and correct aria attributes on input
102
159
  expect(visibleInput).toHaveAttribute('aria-invalid', 'true');
103
160
  var helperTextID = helper.getAttribute('id');
104
161
  expect(_testWrapper.screen.getByRole('button')).toHaveAttribute('aria-describedby', helperTextID);
162
+ });
163
+ test('passing sections, renders separators', function () {
164
+ getComponentWithSections();
165
+
166
+ var button = _testWrapper.screen.getByRole('button');
167
+
168
+ _userEvent["default"].click(button);
169
+
170
+ expect(_testWrapper.screen.queryAllByRole('separator')).toHaveLength(2);
171
+ });
172
+ test('a blank title does not render', function () {
173
+ getComponentWithSections();
174
+
175
+ var button = _testWrapper.screen.getByRole('button');
176
+
177
+ _userEvent["default"].click(button);
178
+
179
+ expect(_testWrapper.screen.queryByText('Fruit')).not.toBeInTheDocument();
105
180
  });
@@ -141,7 +141,6 @@ var Default = function Default() {
141
141
  isRow: true,
142
142
  key: item.key
143
143
  }, (0, _react2.jsx)(_index.Bracket, null), (0, _react2.jsx)(_index.Box, {
144
- ml: "3px",
145
144
  width: "100%"
146
145
  }, (0, _react2.jsx)(_index.Box, {
147
146
  variant: "forms.input.container",
@@ -128,14 +128,15 @@ var Default = function Default(_ref) {
128
128
  }, (0, _react2.jsx)(_index.Icon, {
129
129
  icon: _FormSelectIcon["default"],
130
130
  mr: "sm",
131
- color: "text.primary",
131
+ color: "accent.40",
132
132
  size: 25
133
133
  }), (0, _react2.jsx)(_index.Text, {
134
134
  variant: "itemTitle",
135
135
  alignSelf: "center"
136
136
  }, item.name)), (0, _react2.jsx)(_index.Box, {
137
137
  isRow: true,
138
- alignSelf: "center"
138
+ alignSelf: "center",
139
+ gap: "sm"
139
140
  }, (0, _react2.jsx)(_index.IconButton, {
140
141
  "aria-label": "create-icon"
141
142
  }, (0, _react2.jsx)(_index.Icon, {
@@ -667,14 +667,10 @@ var buttons = [{
667
667
 
668
668
  var Default = function Default() {
669
669
  var state = (0, _useModalState["default"])();
670
- return (0, _react2.jsx)(_index.OverlayProvider, null, (0, _react2.jsx)(_index.Button, {
671
- onPress: state.open,
672
- "aria-label": "Open modal"
673
- }, "Open Modal"), state.isOpen && (0, _react2.jsx)(_index.Modal, {
674
- isOpen: state.isOpen,
670
+ return (0, _react2.jsx)(_index.OverlayProvider, null, (0, _react2.jsx)(_index.Modal, {
671
+ isOpen: true,
675
672
  onClose: state.close,
676
- contentProps: sx.contentProps,
677
- isDismissable: true
673
+ contentProps: sx.contentProps
678
674
  }, (0, _react2.jsx)(_index.Box, {
679
675
  contentProps: true
680
676
  }, (0, _react2.jsx)(_index.IconButton, {
@@ -701,7 +697,7 @@ var Default = function Default() {
701
697
  }, (0, _react2.jsx)(_index.Icon, {
702
698
  icon: button.icon,
703
699
  sx: sx.iconStyle,
704
- size: "58"
700
+ size: 58
705
701
  }), (0, _react2.jsx)(_index.Text, {
706
702
  sx: sx.buttonLabelStyle
707
703
  }, button.name)));
@@ -36,13 +36,13 @@ var base = {
36
36
  display: 'flex'
37
37
  };
38
38
  var card = {
39
- boxShadow: 'standard',
39
+ boxShadow: '0px 1px 14px rgba(37, 55, 70, 0.15)',
40
+ borderRadius: '3px',
40
41
  p: 'lg',
41
- alignItems: 'center',
42
- justifyContent: 'center',
43
42
  flex: '1 1 0',
44
- fontWeight: 1,
45
- fontSize: 'md'
43
+ fontWeight: 0,
44
+ fontSize: 'md',
45
+ color: 'text.primary'
46
46
  }; // Used to give a border to radio elements
47
47
 
48
48
  var radioContainer = {
@@ -96,7 +96,7 @@ var listViewItem = _objectSpread(_objectSpread({}, base), {}, {
96
96
  },
97
97
  '&.has-separator': {
98
98
  borderBottom: '1px solid',
99
- borderBottomColor: 'line.hairline'
99
+ borderBottomColor: 'neutral.80'
100
100
  },
101
101
  '&.is-focused': {
102
102
  boxShadow: '0 0 0 1px inset #D033FF'
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
+
5
+ _Object$defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+
9
+ exports.DummyText = void 0;
10
+ var DummyText = "\nSed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium,\ntotam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae\ndicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, \nsed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, \nqui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora\nincidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum\nexercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel\neum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem \neum fugiat quo voluptas nulla pariatur? At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis \npraesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate \nnon provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. \nEt harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi \noptio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis \ndolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et \nvoluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut \nreiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.\n";
11
+ exports.DummyText = DummyText;
@@ -41,8 +41,7 @@ export var Default = function Default() {
41
41
  ml: "sm",
42
42
  bg: "background"
43
43
  }, ___EmotionJSX(Box, {
44
- isRow: true,
45
- mb: "xs"
44
+ isRow: true
46
45
  }, ___EmotionJSX(Chip, {
47
46
  label: "Any",
48
47
  bg: "neutral.20",
@@ -57,7 +56,6 @@ export var Default = function Default() {
57
56
  isLast: index === anyConditions.length - 1
58
57
  }), ___EmotionJSX(Box, {
59
58
  mt: "md",
60
- ml: "xs",
61
59
  variant: "forms.input.container",
62
60
  bg: "white",
63
61
  isRow: true,
@@ -55,7 +55,7 @@ var Breadcrumbs = /*#__PURE__*/forwardRef(function (props, ref) {
55
55
  "aria-hidden": "true",
56
56
  icon: icon,
57
57
  mx: 5,
58
- size: 16
58
+ size: "xs"
59
59
  }, iconProps)));
60
60
  }, [children.length, filteredChildren, icon, iconProps, onAction]);
61
61
  return ___EmotionJSX("nav", {
@@ -61,17 +61,4 @@ export var Default = function Default(args) {
61
61
  "data-id": "march",
62
62
  href: "https://www.pingidentity.com"
63
63
  }, "March 2020 Assets"));
64
- };
65
- export var WithSpan = function WithSpan() {
66
- return ___EmotionJSX(Breadcrumbs, {
67
- icon: ChevronRightIcon
68
- }, ___EmotionJSX(Item, {
69
- key: "Parent",
70
- "aria-label": "parent",
71
- elementType: "span"
72
- }, "Parent"), ___EmotionJSX(Item, {
73
- key: "FonsVernall",
74
- "aria-label": "fons-vernall",
75
- elementType: "span"
76
- }, "Fons Vernall"));
77
64
  };
@@ -1,6 +1,13 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["className", "onHoverStart", "onHoverChange", "onHoverEnd", "onPress", "onPressStart", "onPressEnd", "onPressChange", "onPressUp"];
2
4
  import React, { forwardRef } from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import { mergeProps } from '@react-aria/utils';
7
+ import { useHover, usePress } from '@react-aria/interactions';
8
+ import { useFocusRing } from '@react-aria/focus';
3
9
  import Box from '../Box';
10
+ import { useStatusClasses } from '../../hooks';
4
11
  /**
5
12
  * A Box component built for the common "Card" use case. Has default variant of card.
6
13
  * See Box for list of props.
@@ -8,10 +15,111 @@ import Box from '../Box';
8
15
 
9
16
  import { jsx as ___EmotionJSX } from "@emotion/react";
10
17
  var Card = /*#__PURE__*/forwardRef(function (props, ref) {
18
+ var className = props.className,
19
+ onHoverStart = props.onHoverStart,
20
+ onHoverChange = props.onHoverChange,
21
+ onHoverEnd = props.onHoverEnd,
22
+ onPress = props.onPress,
23
+ onPressStart = props.onPressStart,
24
+ onPressEnd = props.onPressEnd,
25
+ onPressChange = props.onPressChange,
26
+ onPressUp = props.onPressUp,
27
+ others = _objectWithoutProperties(props, _excluded);
28
+
29
+ var _useHover = useHover(props),
30
+ hoverProps = _useHover.hoverProps,
31
+ isHovered = _useHover.isHovered;
32
+
33
+ var _useFocusRing = useFocusRing(),
34
+ focusProps = _useFocusRing.focusProps,
35
+ isFocusVisible = _useFocusRing.isFocusVisible;
36
+
37
+ var _usePress = usePress({
38
+ ref: ref,
39
+ onPress: onPress,
40
+ onPressStart: onPressStart,
41
+ onPressEnd: onPressEnd,
42
+ onPressChange: onPressChange,
43
+ onPressUp: onPressUp
44
+ }),
45
+ pressProps = _usePress.pressProps,
46
+ isPressed = _usePress.isPressed;
47
+
48
+ var _useFocusRing2 = useFocusRing({
49
+ within: true
50
+ }),
51
+ focusWithinProps = _useFocusRing2.focusProps,
52
+ isFocusedWithin = _useFocusRing2.isFocusVisible;
53
+
54
+ var _useStatusClasses = useStatusClasses(className, {
55
+ isHovered: isHovered,
56
+ isPressed: isPressed,
57
+ isFocused: isFocusVisible || isFocusedWithin
58
+ }),
59
+ classNames = _useStatusClasses.classNames;
60
+
61
+ var ariaLabel = props['aria-label'];
11
62
  return ___EmotionJSX(Box, _extends({
63
+ "aria-label": ariaLabel,
12
64
  variant: "boxes.card",
13
- ref: ref
14
- }, props));
65
+ className: classNames,
66
+ ref: ref,
67
+ isFocused: isFocusVisible
68
+ }, others, mergeProps(hoverProps, pressProps, focusProps, focusWithinProps)));
15
69
  });
70
+ Card.propTypes = {
71
+ /** Defines a string value that labels the current element. */
72
+ 'aria-label': PropTypes.string,
73
+
74
+ /**
75
+ * Handler that is called when a hover interaction starts.
76
+ * (e: HoverEvent) => void
77
+ */
78
+ onHoverStart: PropTypes.func,
79
+
80
+ /**
81
+ * Handler that is called when a hover interaction ends.
82
+ * (e: HoverEvent) => void
83
+ */
84
+ onHoverEnd: PropTypes.func,
85
+
86
+ /**
87
+ * Handler that is called when the hover state changes.
88
+ * (isHovering: boolean) => void
89
+ */
90
+ onHoverChange: PropTypes.func,
91
+
92
+ /**
93
+ * Handler that is called when the press is released over the target.
94
+ * (e: PressEvent) => void
95
+ */
96
+ onPress: PropTypes.func,
97
+
98
+ /**
99
+ * Handler that is called when a press interaction starts.
100
+ * (e: PressEvent) => void
101
+ */
102
+ onPressStart: PropTypes.func,
103
+
104
+ /**
105
+ * Handler that is called when a press interaction ends, either over the target or when the
106
+ * pointer leaves the target.
107
+ * (e: PressEvent) => void
108
+ */
109
+ onPressEnd: PropTypes.func,
110
+
111
+ /**
112
+ * Handler that is called when the press state changes.
113
+ * (isPressed: boolean) => void
114
+ */
115
+ onPressChange: PropTypes.func,
116
+
117
+ /**
118
+ * Handler that is called when a press is released over the target, regardless of whether it
119
+ * started on the target or not.
120
+ * (e: PressEvent) => void
121
+ */
122
+ onPressUp: PropTypes.func
123
+ };
16
124
  Card.displayName = 'Card';
17
125
  export default Card;
@@ -1,6 +1,6 @@
1
+ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
1
2
  import React from 'react';
2
- import Card from './Card';
3
- import Box from '../Box';
3
+ import { Box, Button, Card } from '../../index';
4
4
  import { jsx as ___EmotionJSX } from "@emotion/react";
5
5
  export default {
6
6
  title: 'Components/Card',
@@ -8,7 +8,7 @@ export default {
8
8
  argTypes: {
9
9
  children: {
10
10
  description: 'Card content.',
11
- defaultValue: 'Card Children',
11
+ defaultValue: 'Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Ut at enim nunc. Cras congue consequat odio, ac sodales lacus imperdiet quis. In id ex eu lorem sollicitudin hendrerit feugiat ultrices elit. Curabitur imperdiet libero vitae luctus blandit. Ut ac dignissim tortor. Pellentesque convallis eu metus vitae mollis. Donec sapien felis, laoreet eu egestas eu, blandit quis tellus. Donec luctus suscipit nibh, et tincidunt nisl facilisis ut. Mauris molestie purus at lectus venenatis, ac ultrices felis ultrices.',
12
12
  table: {
13
13
  type: {}
14
14
  },
@@ -21,7 +21,7 @@ export default {
21
21
  export var Default = function Default(args) {
22
22
  return ___EmotionJSX(Card, args);
23
23
  };
24
- export var CardRow = function CardRow() {
24
+ export var CardRow = function CardRow(args) {
25
25
  var sx = {
26
26
  li: {
27
27
  display: 'inline',
@@ -40,17 +40,42 @@ export var CardRow = function CardRow() {
40
40
  }, ___EmotionJSX(Box, {
41
41
  as: "li",
42
42
  sx: sx.li
43
- }, ___EmotionJSX(Card, {
43
+ }, ___EmotionJSX(Card, _extends({
44
44
  sx: sx.card
45
- }, "First")), ___EmotionJSX(Box, {
45
+ }, args))), ___EmotionJSX(Box, {
46
46
  as: "li",
47
47
  sx: sx.li
48
- }, ___EmotionJSX(Card, {
48
+ }, ___EmotionJSX(Card, _extends({
49
49
  sx: sx.card
50
- }, "Second")), ___EmotionJSX(Box, {
50
+ }, args))), ___EmotionJSX(Box, {
51
51
  as: "li",
52
52
  sx: sx.li
53
- }, ___EmotionJSX(Card, {
53
+ }, ___EmotionJSX(Card, _extends({
54
54
  sx: sx.card
55
- }, "Third")));
55
+ }, args))));
56
+ };
57
+ export var InteractiveCard = function InteractiveCard() {
58
+ var sx = {
59
+ alignContent: 'center',
60
+ height: '221px',
61
+ justifyContent: 'center',
62
+ textAlign: 'center',
63
+ width: '233px'
64
+ };
65
+ return ___EmotionJSX(Card, {
66
+ onPress: function onPress() {
67
+ return console.log('card pressed');
68
+ },
69
+ onHoverStart: function onHoverStart() {
70
+ return console.log('card hovered');
71
+ },
72
+ tabIndex: "0",
73
+ sx: sx
74
+ }, "Interactive Card", ___EmotionJSX(Button, {
75
+ variant: "inline",
76
+ mt: "md",
77
+ onPress: function onPress() {
78
+ return console.log('button pressed');
79
+ }
80
+ }, "Explore"));
56
81
  };
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
2
  import React from 'react';
3
3
  import { render, screen } from '@testing-library/react';
4
+ import userEvent from '@testing-library/user-event';
4
5
  import Card from './Card';
5
6
  import Button from '../Button';
6
7
  import axeTest from '../../utils/testUtils/testAxe';
@@ -31,4 +32,39 @@ test('renders children within Card component', function () {
31
32
  });
32
33
  var mockedChildren = screen.getByRole('button');
33
34
  expect(mockedChildren).toBeInTheDocument();
35
+ });
36
+ test('card allows hover, focus, and press events', function () {
37
+ var children = ___EmotionJSX(Button, null);
38
+
39
+ var onPress = jest.fn();
40
+ getComponent({
41
+ children: children,
42
+ onPress: onPress,
43
+ tabIndex: 0
44
+ });
45
+ var card = screen.getByTestId(testId);
46
+ expect(card).not.toHaveClass('is-hovered');
47
+ userEvent.hover(card);
48
+ expect(card).toHaveClass('is-hovered');
49
+ userEvent.click(card);
50
+ expect(onPress).toHaveBeenCalled();
51
+ expect(card).not.toHaveClass('is-focused');
52
+ userEvent.tab();
53
+ expect(card).toHaveClass('is-focused');
54
+ });
55
+ test('allows focus within card', function () {
56
+ var children = ___EmotionJSX(Button, null);
57
+
58
+ getComponent({
59
+ children: children,
60
+ tabIndex: 0
61
+ });
62
+ var button = screen.getByRole('button');
63
+ var card = screen.getByTestId(testId);
64
+ expect(button).not.toHaveClass('is-focused');
65
+ userEvent.tab();
66
+ expect(button).not.toHaveClass('is-focused');
67
+ expect(card).toHaveClass('is-focused');
68
+ userEvent.tab();
69
+ expect(button).toHaveClass('is-focused');
34
70
  });
@@ -88,6 +88,7 @@ var animals = [{
88
88
  }];
89
89
  var withSection = [{
90
90
  name: 'Animals',
91
+ key: 'Animals',
91
92
  children: [{
92
93
  name: 'Raccoon'
93
94
  }, {
@@ -97,6 +98,7 @@ var withSection = [{
97
98
  }]
98
99
  }, {
99
100
  name: 'People',
101
+ key: 'People',
100
102
  children: [{
101
103
  name: 'Michael'
102
104
  }, {
@@ -104,6 +106,16 @@ var withSection = [{
104
106
  }, {
105
107
  name: 'Creed'
106
108
  }]
109
+ }, {
110
+ name: null,
111
+ key: 'fruit',
112
+ children: [{
113
+ name: 'Apple'
114
+ }, {
115
+ name: 'Orange'
116
+ }, {
117
+ name: 'Banana'
118
+ }]
107
119
  }];
108
120
  var actions = {
109
121
  onOpenChange: action('onOpenChange'),
@@ -192,7 +204,7 @@ export var WithSections = function WithSections(args) {
192
204
  items: withSection
193
205
  }, args), function (section) {
194
206
  return ___EmotionJSX(Section, {
195
- key: section.name,
207
+ key: section.key,
196
208
  items: section.children,
197
209
  title: section.name
198
210
  }, function (item) {
@@ -26,7 +26,7 @@ import { axe } from 'jest-axe';
26
26
  import { useFilter } from '@react-aria/i18n';
27
27
  import userEvent from '@testing-library/user-event';
28
28
  import { render, screen, act, within } from '../../utils/testUtils/testWrapper';
29
- import { ComboBoxField, Item, OverlayProvider } from '../../index';
29
+ import { ComboBoxField, Item, OverlayProvider, Section } from '../../index';
30
30
  import loadingStates from '../../utils/devUtils/constants/loadingStates';
31
31
  import statuses from '../../utils/devUtils/constants/statuses';
32
32
  import { jsx as ___EmotionJSX } from "@emotion/react";
@@ -40,6 +40,37 @@ var items = [{
40
40
  name: 'Snake',
41
41
  id: '3'
42
42
  }];
43
+ var withSection = [{
44
+ name: 'Animals',
45
+ key: 'Animals',
46
+ kids: [{
47
+ name: 'Raccoon'
48
+ }, {
49
+ name: 'Kangaroo'
50
+ }, {
51
+ name: 'Opossum'
52
+ }]
53
+ }, {
54
+ name: 'People',
55
+ key: 'People',
56
+ kids: [{
57
+ name: 'Michael'
58
+ }, {
59
+ name: 'Dwight'
60
+ }, {
61
+ name: 'Creed'
62
+ }]
63
+ }, {
64
+ name: null,
65
+ key: 'fruit',
66
+ kids: [{
67
+ name: 'Apple'
68
+ }, {
69
+ name: 'Orange'
70
+ }, {
71
+ name: 'Banana'
72
+ }]
73
+ }];
43
74
  var defaultProps = {
44
75
  defaultItems: items,
45
76
  label: 'Test Label'
@@ -60,6 +91,28 @@ var getComponent = function getComponent() {
60
91
  })));
61
92
  };
62
93
 
94
+ var getComponentWithSections = function getComponentWithSections() {
95
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
96
+
97
+ var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
98
+ _ref2$renderFn = _ref2.renderFn,
99
+ renderFn = _ref2$renderFn === void 0 ? render : _ref2$renderFn;
100
+
101
+ return renderFn(___EmotionJSX(OverlayProvider, null, ___EmotionJSX(ComboBoxField, _extends({}, defaultProps, props, {
102
+ items: withSection
103
+ }), function (section) {
104
+ return ___EmotionJSX(Section, {
105
+ key: section.key,
106
+ items: section.kids,
107
+ title: section.name
108
+ }, function (item) {
109
+ return ___EmotionJSX(Item, {
110
+ key: item.name
111
+ }, item.name);
112
+ });
113
+ })));
114
+ };
115
+
63
116
  var ComboBoxWithCustomFilter = function ComboBoxWithCustomFilter() {
64
117
  var _useFilter = useFilter({
65
118
  sensitivity: 'base'
@@ -76,8 +129,8 @@ var ComboBoxWithCustomFilter = function ComboBoxWithCustomFilter() {
76
129
  setFieldState = _useState2[1];
77
130
 
78
131
  var onSelectionChange = function onSelectionChange(key) {
79
- var selectedItem = _filterInstanceProperty(items).call(items, function (_ref2) {
80
- var id = _ref2.id;
132
+ var selectedItem = _filterInstanceProperty(items).call(items, function (_ref3) {
133
+ var id = _ref3.id;
81
134
  return id === key;
82
135
  });
83
136
 
@@ -148,8 +201,8 @@ var ComboBoxWithAddOption = function ComboBoxWithAddOption() {
148
201
  setSelectedKey = _useState8[1];
149
202
 
150
203
  var onSelectionChange = function onSelectionChange(key) {
151
- if (key && !_findInstanceProperty(options).call(options, function (_ref3) {
152
- var name = _ref3.name;
204
+ if (key && !_findInstanceProperty(options).call(options, function (_ref4) {
205
+ var name = _ref4.name;
153
206
  return name === key;
154
207
  })) {
155
208
  var _context;
@@ -1009,6 +1062,18 @@ test('popover closes on input blur', function () {
1009
1062
  expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
1010
1063
  expect(screen.queryByRole('option')).not.toBeInTheDocument();
1011
1064
  });
1065
+ test('passing sections, renders separators', function () {
1066
+ getComponentWithSections();
1067
+ var button = screen.getByRole('button');
1068
+ userEvent.click(button);
1069
+ expect(screen.queryAllByRole('separator')).toHaveLength(4);
1070
+ });
1071
+ test('a blank title does not render', function () {
1072
+ getComponentWithSections();
1073
+ var button = screen.getByRole('button');
1074
+ userEvent.click(button);
1075
+ expect(screen.queryByText('Fruit')).not.toBeInTheDocument();
1076
+ });
1012
1077
  describe('when isReadOnly is true', function () {
1013
1078
  var testProp = {
1014
1079
  isReadOnly: true