@pingux/astro 2.79.0 → 2.80.0-alpha.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 (41) hide show
  1. package/lib/cjs/components/CollapsiblePanel/CollapsiblePanel.d.ts +4 -0
  2. package/lib/cjs/components/CollapsiblePanel/CollapsiblePanel.js +7 -32
  3. package/lib/cjs/components/CollapsiblePanel/CollapsiblePanel.stories.d.ts +5 -0
  4. package/lib/cjs/components/CollapsiblePanel/CollapsiblePanel.stories.js +1 -1
  5. package/lib/cjs/components/CollapsiblePanel/CollapsiblePanel.styles.d.ts +220 -0
  6. package/lib/cjs/components/CollapsiblePanel/CollapsiblePanel.test.d.ts +1 -0
  7. package/lib/cjs/components/CollapsiblePanel/CollapsiblePanel.test.js +2 -1
  8. package/lib/cjs/components/CollapsiblePanel/index.d.ts +1 -0
  9. package/lib/cjs/components/CollapsiblePanelContainer/CollapsiblePanelBadge.d.ts +7 -0
  10. package/lib/cjs/components/CollapsiblePanelContainer/CollapsiblePanelBadge.js +2 -6
  11. package/lib/cjs/components/CollapsiblePanelContainer/CollapsiblePanelBadge.test.d.ts +1 -0
  12. package/lib/cjs/components/CollapsiblePanelContainer/CollapsiblePanelBadge.test.js +7 -0
  13. package/lib/cjs/components/CollapsiblePanelContainer/CollapsiblePanelContainer.d.ts +8 -0
  14. package/lib/cjs/components/CollapsiblePanelContainer/CollapsiblePanelContainer.js +6 -26
  15. package/lib/cjs/components/CollapsiblePanelContainer/CollapsiblePanelContainer.test.d.ts +1 -0
  16. package/lib/cjs/components/CollapsiblePanelContainer/CollapsiblePanelContainer.test.js +2 -9
  17. package/lib/cjs/components/CollapsiblePanelContainer/index.d.ts +1 -0
  18. package/lib/cjs/components/CollapsiblePanelItem/CollapsiblePanelItem.d.ts +4 -0
  19. package/lib/cjs/components/CollapsiblePanelItem/CollapsiblePanelItem.js +5 -23
  20. package/lib/cjs/components/CollapsiblePanelItem/CollapsiblePanelItem.test.d.ts +1 -0
  21. package/lib/cjs/components/CollapsiblePanelItem/index.d.ts +1 -0
  22. package/lib/cjs/components/IconButton/IconButton.styles.d.ts +37 -1
  23. package/lib/cjs/types/collapsiblePanel.d.ts +66 -0
  24. package/lib/cjs/types/collapsiblePanel.js +6 -0
  25. package/lib/cjs/types/colorField.d.ts +1 -1
  26. package/lib/cjs/types/iconButton.d.ts +2 -0
  27. package/lib/cjs/types/index.d.ts +1 -0
  28. package/lib/cjs/types/index.js +50 -39
  29. package/lib/cjs/types/input.d.ts +2 -0
  30. package/lib/cjs/types/listView.d.ts +2 -0
  31. package/lib/components/CollapsiblePanel/CollapsiblePanel.js +7 -32
  32. package/lib/components/CollapsiblePanel/CollapsiblePanel.stories.js +1 -1
  33. package/lib/components/CollapsiblePanel/CollapsiblePanel.test.js +2 -1
  34. package/lib/components/CollapsiblePanelContainer/CollapsiblePanelBadge.js +2 -6
  35. package/lib/components/CollapsiblePanelContainer/CollapsiblePanelBadge.test.js +7 -0
  36. package/lib/components/CollapsiblePanelContainer/CollapsiblePanelContainer.js +6 -26
  37. package/lib/components/CollapsiblePanelContainer/CollapsiblePanelContainer.test.js +2 -9
  38. package/lib/components/CollapsiblePanelItem/CollapsiblePanelItem.js +5 -23
  39. package/lib/types/collapsiblePanel.js +1 -0
  40. package/lib/types/index.js +1 -0
  41. package/package.json +1 -1
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { CollapsiblePanelProps } from '../../types';
3
+ declare const CollapsiblePanel: React.ForwardRefExoticComponent<CollapsiblePanelProps<object> & React.RefAttributes<HTMLDivElement>>;
4
+ export default CollapsiblePanel;
@@ -14,10 +14,8 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-c
14
14
  var _react = _interopRequireWildcard(require("react"));
15
15
  var _reactAria = require("react-aria");
16
16
  var _kebabCase = _interopRequireDefault(require("lodash/kebabCase"));
17
- var _propTypes = _interopRequireDefault(require("prop-types"));
18
17
  var _ = require("../..");
19
18
  var _hooks = require("../../hooks");
20
- var _isIterable = require("../../utils/devUtils/props/isIterable");
21
19
  var _CollapsiblePanelBadge = _interopRequireDefault(require("../CollapsiblePanelContainer/CollapsiblePanelBadge"));
22
20
  var _react2 = require("@emotion/react");
23
21
  var _excluded = ["selectedFilterCount", "className", "closeAriaLabel", "children", "isDefaultOpen", "isOpen", "items", "listTitle", "onOpenChange", "onSelectionChange", "openAriaLabel"];
@@ -64,7 +62,9 @@ var CollapsiblePanel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
64
62
  ref: ref,
65
63
  tabIndex: -1,
66
64
  variant: "collapsiblePanel.content"
67
- }, mergedProps, others), (0, _react2.jsx)(_.Box, {
65
+ }, mergedProps, others, {
66
+ role: "region"
67
+ }), (0, _react2.jsx)(_.Box, {
68
68
  isRow: true,
69
69
  variant: "collapsiblePanel.containerTitle"
70
70
  }, (0, _react2.jsx)(_.Text, {
@@ -81,37 +81,12 @@ var CollapsiblePanel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
81
81
  onSelectionChange: onSelectionChange,
82
82
  selectionMode: "none",
83
83
  selectionStyle: "highlight",
84
- style: {
85
- width: '100%'
86
- },
87
- pl: "md"
84
+ sx: {
85
+ width: '100%',
86
+ pl: 'md'
87
+ }
88
88
  }, children))));
89
89
  });
90
- CollapsiblePanel.propTypes = {
91
- /** Amount of selected items indicator. */
92
- selectedFilterCount: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
93
- /** Title of list content. */
94
- listTitle: _propTypes["default"].string,
95
- /** Defines a string value that labels the trigger icon when menu is open. */
96
- closeAriaLabel: _propTypes["default"].string,
97
- /** Sets the default open state of the overlay. */
98
- isDefaultOpen: _propTypes["default"].bool,
99
- /** Whether the overlay is currently open. */
100
- isOpen: _propTypes["default"].bool,
101
- /** The list of ListView items (controlled). */
102
- items: _isIterable.isIterableProp,
103
- /**
104
- * Method that is called when the open state of the menu changes.
105
- * Returns the new open state and the action that caused the opening of the menu.
106
- *
107
- * `(isOpen: boolean, overlayTrigger: OverlayTriggerAction) => void`
108
- */
109
- onOpenChange: _propTypes["default"].func,
110
- /** Callback function that fires when the selected key changes. */
111
- onSelectionChange: _propTypes["default"].func,
112
- /** Defines a string value that labels the trigger icon when menu is closed. */
113
- openAriaLabel: _propTypes["default"].string
114
- };
115
90
  CollapsiblePanel.defaultProps = {
116
91
  isDefaultOpen: true
117
92
  };
@@ -0,0 +1,5 @@
1
+ import { StoryFn } from '@storybook/react';
2
+ import { CollapsiblePanelProps } from '../../types';
3
+ declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
4
+ export default _default;
5
+ export declare const Default: StoryFn<CollapsiblePanelProps<object>>;
@@ -10,7 +10,7 @@ var _react = _interopRequireDefault(require("react"));
10
10
  var _storybookAddonDesigns = require("storybook-addon-designs");
11
11
  var _storybookDocsLayout = _interopRequireDefault(require("../../../.storybook/storybookDocsLayout"));
12
12
  var _index = require("../../index");
13
- var _figmaLinks = require("../../utils/designUtils/figmaLinks.ts");
13
+ var _figmaLinks = require("../../utils/designUtils/figmaLinks");
14
14
  var _CollapsiblePanel = _interopRequireDefault(require("./CollapsiblePanel.mdx"));
15
15
  var _react2 = require("@emotion/react");
16
16
  var _default = {
@@ -0,0 +1,220 @@
1
+ export declare const toggle: {
2
+ bg: string;
3
+ borderRadius: string;
4
+ height: string;
5
+ minWidth: string;
6
+ pl: string;
7
+ ml: string;
8
+ path: {
9
+ fill: string;
10
+ };
11
+ '&.is-hovered': {
12
+ backgroundColor: string;
13
+ };
14
+ '&.is-pressed': {
15
+ backgroundColor: string;
16
+ };
17
+ ':focus': {
18
+ outline: string;
19
+ };
20
+ '&.is-focused': {
21
+ outlineOffset: string;
22
+ zIndex: number;
23
+ outline: string;
24
+ outlineColor: string;
25
+ };
26
+ justifyContent: string;
27
+ appearance: string;
28
+ alignItems: string;
29
+ alignSelf: string;
30
+ display: string;
31
+ flexGrow: number;
32
+ flexShrink: number;
33
+ cursor: string;
34
+ p: string;
35
+ width: string;
36
+ outline: string;
37
+ };
38
+ declare const _default: {
39
+ container: {
40
+ pr: string;
41
+ minHeight: string;
42
+ '>div': {
43
+ visibility: string;
44
+ width: number;
45
+ transition: string;
46
+ };
47
+ '&.is-open>div': {
48
+ visibility: string;
49
+ width: string;
50
+ };
51
+ };
52
+ content: {
53
+ bg: string;
54
+ fontSize: string;
55
+ height: string;
56
+ width: string;
57
+ '&.is-focused': {
58
+ boxShadow: string;
59
+ outline: string;
60
+ outlineColor: string;
61
+ outlineOffset: string;
62
+ borderColor: string;
63
+ };
64
+ '& div': {
65
+ alignItems: string;
66
+ display: string;
67
+ minHeight: string;
68
+ padding: string;
69
+ width: string;
70
+ justifyContent: string;
71
+ };
72
+ };
73
+ containerTitle: {
74
+ alignContent: string;
75
+ fontWeight: string;
76
+ minHeight: string;
77
+ alignItems: string;
78
+ padding: string;
79
+ flexWrap: string;
80
+ maxWidth: string;
81
+ margin: string;
82
+ width: string;
83
+ '.is-open &': {
84
+ width: string;
85
+ };
86
+ };
87
+ badge: {
88
+ borderRadius: string;
89
+ display: string;
90
+ height: string;
91
+ justifyContent: string;
92
+ minWidth: string;
93
+ position: string;
94
+ pb: string;
95
+ pr: string;
96
+ pl: string;
97
+ alignItems: string;
98
+ fontWeight: number;
99
+ '.is-open &.title-badge': {
100
+ minWidth: string;
101
+ display: string;
102
+ transition: string;
103
+ width: string;
104
+ };
105
+ '&.title-badge': {
106
+ display: string;
107
+ width: string;
108
+ };
109
+ };
110
+ item: {
111
+ minHeight: string;
112
+ margin: string;
113
+ };
114
+ toggle: {
115
+ bg: string;
116
+ borderRadius: string;
117
+ height: string;
118
+ minWidth: string;
119
+ pl: string;
120
+ ml: string;
121
+ path: {
122
+ fill: string;
123
+ };
124
+ '&.is-hovered': {
125
+ backgroundColor: string;
126
+ };
127
+ '&.is-pressed': {
128
+ backgroundColor: string;
129
+ };
130
+ ':focus': {
131
+ outline: string;
132
+ };
133
+ '&.is-focused': {
134
+ outlineOffset: string;
135
+ zIndex: number;
136
+ outline: string;
137
+ outlineColor: string;
138
+ };
139
+ justifyContent: string;
140
+ appearance: string;
141
+ alignItems: string;
142
+ alignSelf: string;
143
+ display: string;
144
+ flexGrow: number;
145
+ flexShrink: number;
146
+ cursor: string;
147
+ p: string;
148
+ width: string;
149
+ outline: string;
150
+ };
151
+ neutralText: {
152
+ color: string;
153
+ lineHeight: string;
154
+ textDecoration: string;
155
+ display: string;
156
+ justifyContent: string;
157
+ width: string;
158
+ '&.is-current': {
159
+ cursor: string;
160
+ color: string;
161
+ };
162
+ '&.is-focused': {
163
+ boxShadow: string;
164
+ outline: string;
165
+ outlineColor: string;
166
+ outlineOffset: string;
167
+ };
168
+ bg: string;
169
+ border: string;
170
+ borderColor: string;
171
+ height: string;
172
+ padding: string;
173
+ '&.is-hovered': {
174
+ textDecoration: string;
175
+ };
176
+ fontSize: string;
177
+ fontWeight: number;
178
+ fontFamily: string;
179
+ overflowWrap: import("../..").overflowWrap;
180
+ maxWidth: string;
181
+ wordWrap: import("../..").wordWrap;
182
+ wordBreak: import("../..").wordBreak;
183
+ cursor: string;
184
+ minWidth: string;
185
+ outline: string;
186
+ alignItems: string;
187
+ borderRadius: string;
188
+ flexShrink: number;
189
+ whiteSpace: string;
190
+ };
191
+ itemText: {
192
+ color: string;
193
+ fontSize: string;
194
+ fontWeight: number;
195
+ overflow: string;
196
+ marginRight: string;
197
+ textOverflow: string;
198
+ whiteSpace: string;
199
+ display: string;
200
+ overflowWrap: import("../..").overflowWrap;
201
+ maxWidth: string;
202
+ wordWrap: import("../..").wordWrap;
203
+ wordBreak: import("../..").wordBreak;
204
+ };
205
+ title: {
206
+ fontSize: string;
207
+ fontWeight: number;
208
+ color: string;
209
+ whiteSpace: string;
210
+ overflow: string;
211
+ textOverflow: string;
212
+ mr: string;
213
+ display: string;
214
+ overflowWrap: import("../..").overflowWrap;
215
+ maxWidth: string;
216
+ wordWrap: import("../..").wordWrap;
217
+ wordBreak: import("../..").wordBreak;
218
+ };
219
+ };
220
+ export default _default;
@@ -35,7 +35,8 @@ beforeAll(function () {
35
35
  return 1024;
36
36
  });
37
37
  jest.spyOn(window, 'requestAnimationFrame').mockImplementation(function (cb) {
38
- return cb();
38
+ cb(0);
39
+ return 0;
39
40
  });
40
41
  });
41
42
  afterEach(function () {
@@ -0,0 +1 @@
1
+ export { default } from './CollapsiblePanel';
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { CollapsiblePanelBadgeProps } from '../../types';
3
+ /**
4
+ * The CollapsiblePanelBadge serves as a badge to display selected count.
5
+ */
6
+ declare const CollapsiblePanelBadge: React.ForwardRefExoticComponent<CollapsiblePanelBadgeProps & React.RefAttributes<HTMLDivElement>>;
7
+ export default CollapsiblePanelBadge;
@@ -12,7 +12,6 @@ exports["default"] = void 0;
12
12
  var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
13
13
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
14
14
  var _react = _interopRequireWildcard(require("react"));
15
- var _propTypes = _interopRequireDefault(require("prop-types"));
16
15
  var _Badge = _interopRequireDefault(require("../Badge"));
17
16
  var _react2 = require("@emotion/react");
18
17
  var _excluded = ["selectedFilterCount"];
@@ -22,22 +21,19 @@ var _excluded = ["selectedFilterCount"];
22
21
  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); }
23
22
  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; }
24
23
  var CollapsiblePanelBadge = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
24
+ var _ref;
25
25
  var selectedFilterCount = props.selectedFilterCount,
26
26
  others = (0, _objectWithoutProperties2["default"])(props, _excluded);
27
27
  return (0, _react2.jsx)(_Badge["default"], (0, _extends2["default"])({
28
28
  ref: ref,
29
29
  as: "span",
30
30
  bg: "neutral.90",
31
- label: selectedFilterCount.toString(),
31
+ label: (_ref = selectedFilterCount && selectedFilterCount.toString()) !== null && _ref !== void 0 ? _ref : '',
32
32
  textColor: "neutral.30",
33
33
  variant: "variants.collapsiblePanel.badge",
34
34
  isUppercase: true
35
35
  }, others));
36
36
  });
37
- CollapsiblePanelBadge.propTypes = {
38
- selectedFilterCount: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
39
- margin: _propTypes["default"].string
40
- };
41
37
  CollapsiblePanelBadge.displayName = 'CollapsiblePanelBadge';
42
38
  var _default = CollapsiblePanelBadge;
43
39
  exports["default"] = _default;
@@ -37,4 +37,11 @@ test('custom classname can be passed', function () {
37
37
  });
38
38
  var collapsiblePanelBadge = _testWrapper.screen.getByTestId(testId);
39
39
  expect(collapsiblePanelBadge).toHaveClass('testing-class');
40
+ });
41
+ test('Filter count is passed', function () {
42
+ getComponent({
43
+ selectedFilterCount: 5
44
+ });
45
+ var collapsiblePanelBadge = _testWrapper.screen.getByTestId(testId);
46
+ expect(collapsiblePanelBadge).toHaveTextContent('5');
40
47
  });
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { CollapsiblePanelContainerProps } from '../../types';
3
+ /**
4
+ * The CollapsiblePanelContainer serves as a wrapper around a list and its associated trigger,
5
+ * linking the list's open state with the trigger's press state and providing necessary context.
6
+ */
7
+ declare const CollapsiblePanelContainer: React.ForwardRefExoticComponent<CollapsiblePanelContainerProps & React.RefAttributes<HTMLElement>>;
8
+ export default CollapsiblePanelContainer;
@@ -15,7 +15,6 @@ var _react = _interopRequireWildcard(require("react"));
15
15
  var _reactStately = require("react-stately");
16
16
  var _ChevronLeftIcon = _interopRequireDefault(require("@pingux/mdi-react/ChevronLeftIcon"));
17
17
  var _ChevronRightIcon = _interopRequireDefault(require("@pingux/mdi-react/ChevronRightIcon"));
18
- var _propTypes = _interopRequireDefault(require("prop-types"));
19
18
  var _hooks = require("../../hooks");
20
19
  var _index = require("../../index");
21
20
  var _CollapsiblePanelBadge = _interopRequireDefault(require("./CollapsiblePanelBadge"));
@@ -38,7 +37,7 @@ var CollapsiblePanelContainer = /*#__PURE__*/(0, _react.forwardRef)(function (pr
38
37
  openAriaLabel = props.openAriaLabel,
39
38
  collapsiblePanelId = props.collapsiblePanelId,
40
39
  others = (0, _objectWithoutProperties2["default"])(props, _excluded);
41
- var triggerRef = _react["default"].useRef();
40
+ var triggerRef = _react["default"].useRef(null);
42
41
  var state = (0, _reactStately.useOverlayTriggerState)({
43
42
  defaultOpen: isDefaultOpen,
44
43
  isOpen: isOpen,
@@ -51,14 +50,16 @@ var CollapsiblePanelContainer = /*#__PURE__*/(0, _react.forwardRef)(function (pr
51
50
  classNames = _useStatusClasses.classNames;
52
51
  var handleButtonPress = function handleButtonPress() {
53
52
  if (state.isOpen) {
54
- close(state, triggerRef, close);
53
+ // close(state, triggerRef, close);
54
+ close();
55
55
  } else {
56
56
  state.open();
57
57
  }
58
58
  };
59
59
  var handleClose = function handleClose(e) {
60
60
  if (e.key === 'Escape') {
61
- close(state, triggerRef, close);
61
+ // close(state, triggerRef, close);
62
+ close();
62
63
  }
63
64
  };
64
65
  return (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({
@@ -76,7 +77,7 @@ var CollapsiblePanelContainer = /*#__PURE__*/(0, _react.forwardRef)(function (pr
76
77
  ref: triggerRef,
77
78
  variant: "toggle",
78
79
  pr: "sm",
79
- "aria-controls": state.isOpen ? collapsiblePanelId : null
80
+ "aria-controls": state.isOpen ? collapsiblePanelId : ''
80
81
  }, (0, _react2.jsx)(_index.Icon, {
81
82
  color: "active",
82
83
  icon: state.isOpen ? _ChevronRightIcon["default"] : _ChevronLeftIcon["default"],
@@ -91,27 +92,6 @@ var CollapsiblePanelContainer = /*#__PURE__*/(0, _react.forwardRef)(function (pr
91
92
  selectedFilterCount: selectedFilterCount
92
93
  })), children);
93
94
  });
94
- CollapsiblePanelContainer.propTypes = {
95
- /** Amount of selected items indicator. */
96
- selectedFilterCount: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
97
- /** Defines a string value that labels the trigger icon when menu is open. */
98
- closeAriaLabel: _propTypes["default"].string,
99
- /** Sets the default open state of the overlay. */
100
- isDefaultOpen: _propTypes["default"].bool,
101
- /** Whether the overlay is currently open. */
102
- isOpen: _propTypes["default"].bool,
103
- /**
104
- * Method that is called when the open state of the menu changes.
105
- * Returns the new open state and the action that caused the opening of the menu.
106
- *
107
- * `(isOpen: boolean, overlayTrigger: OverlayTriggerAction) => void`
108
- */
109
- onOpenChange: _propTypes["default"].func,
110
- /** Defines a string value that labels the trigger icon when menu is closed. */
111
- openAriaLabel: _propTypes["default"].string,
112
- /** Used in button aria-controls attribute. */
113
- collapsiblePanelId: _propTypes["default"].string
114
- };
115
95
  CollapsiblePanelContainer.defaultProps = {
116
96
  openAriaLabel: 'Open filter menu?',
117
97
  closeAriaLabel: 'Close filter menu?'
@@ -46,20 +46,13 @@ test('custom classname can be passed', function () {
46
46
  test('shows badge when container is closed', function () {
47
47
  getComponent({
48
48
  selectedFilterCount: 9,
49
- state: {
50
- isOpen: false
51
- }
49
+ isOpen: false
52
50
  });
53
51
  var badge = _testWrapper.screen.getByTestId(collapsiblePanelBadgeId);
54
52
  expect(badge).toBeInTheDocument();
55
53
  });
56
54
  test('updates aria label when button is clicked', function () {
57
- var state = {
58
- isOpen: true
59
- };
60
- getComponent({
61
- state: state
62
- });
55
+ getComponent();
63
56
  var button = _testWrapper.screen.getByTestId(collapsiblePanelButtonId);
64
57
  var container = _testWrapper.screen.getByTestId(testId);
65
58
  _userEvent["default"].click(button);
@@ -0,0 +1 @@
1
+ export { default } from './CollapsiblePanelContainer';
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { CollapsiblePanelItemProps } from '../../types';
3
+ declare const CollapsiblePanelItem: React.ForwardRefExoticComponent<CollapsiblePanelItemProps & React.RefAttributes<HTMLDivElement>>;
4
+ export default CollapsiblePanelItem;
@@ -9,8 +9,8 @@ _Object$defineProperty(exports, "__esModule", {
9
9
  value: true
10
10
  });
11
11
  exports["default"] = void 0;
12
+ var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
12
13
  var _react = _interopRequireWildcard(require("react"));
13
- var _propTypes = _interopRequireDefault(require("prop-types"));
14
14
  var _index = require("../../index");
15
15
  var _react2 = require("@emotion/react");
16
16
  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); }
@@ -19,13 +19,14 @@ var CollapsiblePanelItem = /*#__PURE__*/(0, _react.forwardRef)(function (props,
19
19
  var text = props.text,
20
20
  icon = props.icon,
21
21
  isDefaultSelected = props.isDefaultSelected,
22
- onPress = props.onPress;
23
- var iconElement = icon && (0, _react2.jsx)(_index.Icon, {
22
+ onPress = props.onPress,
23
+ iconProps = props.iconProps;
24
+ var iconElement = icon && (0, _react2.jsx)(_index.Icon, (0, _extends2["default"])({
24
25
  "data-testid": "collapsible-panel-data-icon",
25
26
  icon: icon,
26
27
  color: isDefaultSelected ? 'neutral.10' : 'active',
27
28
  size: 13
28
- });
29
+ }, iconProps));
29
30
  return (0, _react2.jsx)(_index.Box, {
30
31
  "data-testid": "collapsible-panel-item",
31
32
  isRow: true,
@@ -45,25 +46,6 @@ var CollapsiblePanelItem = /*#__PURE__*/(0, _react.forwardRef)(function (props,
45
46
  "aria-label": "icon"
46
47
  }, iconElement)));
47
48
  });
48
- CollapsiblePanelItem.propTypes = {
49
- /**
50
- * Display text.
51
- */
52
- text: _propTypes["default"].string,
53
- /**
54
- * List icon.
55
- */
56
- icon: _propTypes["default"].shape({}),
57
- /**
58
- * Whether the element is default selected
59
- * and has to use Icon element instead of IconButton
60
- */
61
- isDefaultSelected: _propTypes["default"].bool,
62
- /**
63
- * Handler that is called at the press on icon button
64
- */
65
- onPress: _propTypes["default"].func
66
- };
67
49
  CollapsiblePanelItem.displayName = 'CollapsiblePanelItem';
68
50
  var _default = CollapsiblePanelItem;
69
51
  exports["default"] = _default;
@@ -0,0 +1 @@
1
+ export { default } from './CollapsiblePanelItem';
@@ -514,7 +514,43 @@ declare const _default: {
514
514
  bg: string;
515
515
  };
516
516
  };
517
- toggle: any;
517
+ toggle: {
518
+ bg: string;
519
+ borderRadius: string;
520
+ height: string;
521
+ minWidth: string;
522
+ pl: string;
523
+ ml: string;
524
+ path: {
525
+ fill: string;
526
+ };
527
+ '&.is-hovered': {
528
+ backgroundColor: string;
529
+ };
530
+ '&.is-pressed': {
531
+ backgroundColor: string;
532
+ };
533
+ ':focus': {
534
+ outline: string;
535
+ };
536
+ '&.is-focused': {
537
+ outlineOffset: string;
538
+ zIndex: number;
539
+ outline: string;
540
+ outlineColor: string;
541
+ };
542
+ justifyContent: string;
543
+ appearance: string;
544
+ alignItems: string;
545
+ alignSelf: string;
546
+ display: string;
547
+ flexGrow: number;
548
+ flexShrink: number;
549
+ cursor: string;
550
+ p: string;
551
+ width: string;
552
+ outline: string;
553
+ };
518
554
  tooltip: {
519
555
  button: any;
520
556
  };
@@ -0,0 +1,66 @@
1
+ /// <reference types="react" />
2
+ import type { CollectionChildren } from '@react-types/shared';
3
+ import { IconProps, IconTypeExtended } from './icon';
4
+ export interface CollapsiblePanelProps<T> {
5
+ children?: React.ReactNode | CollectionChildren<T>;
6
+ className?: string;
7
+ /** Amount of selected items indicator. */
8
+ selectedFilterCount?: string | number;
9
+ /** Title of list content. */
10
+ listTitle?: string;
11
+ /** Defines a string value that labels the trigger icon when menu is open. */
12
+ closeAriaLabel?: string;
13
+ /** Sets the default open state of the overlay. */
14
+ isDefaultOpen?: boolean;
15
+ /** Whether the overlay is currently open. */
16
+ isOpen?: boolean;
17
+ /** The list of ListView items (controlled). */
18
+ items?: Iterable<object>;
19
+ /**
20
+ * Method that is called when the open state of the menu changes.
21
+ * Returns the new open state and the action that caused the opening of the menu.
22
+ *
23
+ * `(isOpen: boolean; overlayTrigger: OverlayTriggerAction) => void`
24
+ */
25
+ onOpenChange?: () => void;
26
+ /** Callback function that fires when the selected key changes. */
27
+ onSelectionChange?: () => void;
28
+ /** Defines a string value that labels the trigger icon when menu is closed. */
29
+ openAriaLabel?: string;
30
+ }
31
+ export interface CollapsiblePanelItemProps {
32
+ text: string;
33
+ icon?: IconTypeExtended;
34
+ isDefaultSelected?: boolean;
35
+ onPress?: () => void;
36
+ iconProps?: IconProps;
37
+ }
38
+ export interface CollapsiblePanelContainerProps {
39
+ children?: React.ReactNode;
40
+ className?: string;
41
+ /** Amount of selected items indicator. */
42
+ selectedFilterCount?: string | number;
43
+ /** Defines a string value that labels the trigger icon when menu is open. */
44
+ closeAriaLabel?: string;
45
+ /** Sets the default open state of the overlay. */
46
+ isDefaultOpen?: boolean;
47
+ /** Whether the overlay is currently open. */
48
+ isOpen?: boolean;
49
+ /**
50
+ * Method that is called when the open state of the menu changes.
51
+ * Returns the new open state and the action that caused the opening of the menu.
52
+ *
53
+ * `(isOpen: boolean, overlayTrigger: OverlayTriggerAction) => void`
54
+ */
55
+ onOpenChange?: () => void;
56
+ /** Defines a string value that labels the trigger icon when menu is closed. */
57
+ openAriaLabel?: string;
58
+ /** Used in button aria-controls attribute. */
59
+ collapsiblePanelId?: string;
60
+ }
61
+ export interface CollapsiblePanelBadgeProps {
62
+ className?: string;
63
+ selectedFilterCount?: string | number;
64
+ margin?: string;
65
+ as?: string | React.ReactNode | React.ElementType;
66
+ }