@pingux/astro 2.53.0-alpha.0 → 2.53.0-alpha.2

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/lib/cjs/components/IconButton/IconButton.styles.d.ts +36 -1
  2. package/lib/cjs/components/IconButtonToggle/IconButtonToggle.d.ts +4 -0
  3. package/lib/cjs/components/IconButtonToggle/IconButtonToggle.js +0 -17
  4. package/lib/cjs/components/IconButtonToggle/IconButtonToggle.stories.d.ts +6 -0
  5. package/lib/cjs/components/IconButtonToggle/IconButtonToggle.test.d.ts +1 -0
  6. package/lib/cjs/components/IconButtonToggle/index.d.ts +1 -0
  7. package/lib/cjs/components/Modal/Modal.d.ts +4 -0
  8. package/lib/cjs/components/Modal/Modal.js +9 -64
  9. package/lib/cjs/components/Modal/Modal.stories.d.ts +5 -0
  10. package/lib/cjs/components/Modal/Modal.stories.js +1 -1
  11. package/lib/cjs/components/Modal/Modal.styles.d.ts +77 -0
  12. package/lib/cjs/components/Modal/index.d.ts +1 -0
  13. package/lib/cjs/components/Modal/tests/Modal.integration.test.d.ts +1 -0
  14. package/lib/cjs/components/Modal/tests/Modal.integration.test.js +7 -5
  15. package/lib/cjs/components/Modal/tests/Modal.unit.test.d.ts +1 -0
  16. package/lib/cjs/components/Modal/tests/Modal.unit.test.js +8 -8
  17. package/lib/cjs/hooks/useComponentToggle/useComponentToggle.d.ts +2 -2
  18. package/lib/cjs/types/Modal.d.ts +58 -0
  19. package/lib/cjs/types/Modal.js +6 -0
  20. package/lib/cjs/types/button.d.ts +2 -1
  21. package/lib/cjs/types/icon.d.ts +1 -1
  22. package/lib/cjs/types/iconButton.d.ts +1 -3
  23. package/lib/cjs/types/iconButtonToggle.d.ts +20 -0
  24. package/lib/cjs/types/iconButtonToggle.js +6 -0
  25. package/lib/cjs/types/index.d.ts +2 -0
  26. package/lib/cjs/types/index.js +43 -21
  27. package/lib/cjs/types/shared/style.d.ts +1 -0
  28. package/lib/components/IconButtonToggle/IconButtonToggle.js +0 -17
  29. package/lib/components/Modal/Modal.js +11 -66
  30. package/lib/components/Modal/Modal.stories.js +1 -1
  31. package/lib/components/Modal/tests/Modal.integration.test.js +7 -5
  32. package/lib/components/Modal/tests/Modal.unit.test.js +9 -9
  33. package/lib/types/Modal.js +1 -0
  34. package/lib/types/iconButtonToggle.js +1 -0
  35. package/lib/types/index.js +2 -0
  36. package/package.json +1 -1
@@ -278,7 +278,42 @@ declare const _default: {
278
278
  outline: string;
279
279
  };
280
280
  messageCloseButton: any;
281
- modalCloseButton: any;
281
+ modalCloseButton: {
282
+ position: string;
283
+ top: number;
284
+ right: number;
285
+ width: string;
286
+ height: string;
287
+ justifyContent: string;
288
+ appearance: string;
289
+ alignItems: string;
290
+ alignSelf: string;
291
+ display: string;
292
+ flexGrow: number;
293
+ flexShrink: number;
294
+ borderRadius: string;
295
+ cursor: string;
296
+ bg: string;
297
+ p: string;
298
+ path: {
299
+ fill: string;
300
+ };
301
+ outline: string;
302
+ '&.is-focused': {
303
+ outline: string;
304
+ outlineColor: string;
305
+ outlineOffset: string;
306
+ };
307
+ '&.is-hovered': {
308
+ bg: string;
309
+ };
310
+ '&.is-pressed': {
311
+ path: {
312
+ fill: string;
313
+ };
314
+ bg: string;
315
+ };
316
+ };
282
317
  invertedBadgeDeleteButton: {
283
318
  path: {
284
319
  fill: string;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { IconButtonToggleProps } from '../../types';
3
+ declare const IconButtonToggle: React.ForwardRefExoticComponent<IconButtonToggleProps & React.RefAttributes<HTMLButtonElement>>;
4
+ export default IconButtonToggle;
@@ -11,7 +11,6 @@ _Object$defineProperty(exports, "__esModule", {
11
11
  exports["default"] = void 0;
12
12
  var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
13
13
  var _react = _interopRequireWildcard(require("react"));
14
- var _propTypes = _interopRequireDefault(require("prop-types"));
15
14
  var _hooks = require("../../hooks");
16
15
  var _Icon = _interopRequireDefault(require("../Icon"));
17
16
  var _IconButton = _interopRequireDefault(require("../IconButton"));
@@ -43,21 +42,5 @@ var IconButtonToggle = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
43
42
  icon: RenderedComponent
44
43
  }, iconProps)));
45
44
  });
46
- IconButtonToggle.propTypes = {
47
- /** Props object that is spread into the icon element. */
48
- iconProps: _propTypes["default"].shape({}),
49
- /** Props object that is spread into the button element. */
50
- buttonProps: _propTypes["default"].shape({}),
51
- /** The icon that will render by default. */
52
- defaultIcon: _propTypes["default"].elementType.isRequired,
53
- /** The icon that will render after toggling the icon. */
54
- toggledIcon: _propTypes["default"].elementType.isRequired,
55
- /** Whether or not the icon is toggled. (use only when controlled) */
56
- isToggled: _propTypes["default"].bool,
57
- /** Function that is passed into the IconButton within this component. */
58
- onToggle: _propTypes["default"].func,
59
- /** Content will be displayed in a tooltip on hover or focus. */
60
- title: _propTypes["default"].string
61
- };
62
45
  var _default = IconButtonToggle;
63
46
  exports["default"] = _default;
@@ -0,0 +1,6 @@
1
+ import { StoryFn } from '@storybook/react';
2
+ import { IconButtonToggleProps } 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<IconButtonToggleProps>;
6
+ export declare const Controlled: StoryFn<IconButtonToggleProps>;
@@ -0,0 +1 @@
1
+ export { default } from './IconButtonToggle';
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ModalProps } from '../../types';
3
+ declare const Modal: React.ForwardRefExoticComponent<ModalProps & React.RefAttributes<HTMLElement>>;
4
+ export default Modal;
@@ -22,9 +22,7 @@ var _react = _interopRequireWildcard(require("react"));
22
22
  var _reactAria = require("react-aria");
23
23
  var _CloseIcon = _interopRequireDefault(require("@pingux/mdi-react/CloseIcon"));
24
24
  var _overlays = require("@react-aria/overlays");
25
- var _propTypes = _interopRequireDefault(require("prop-types"));
26
25
  var _hooks = require("../../hooks");
27
- var _modalSizes = require("../../utils/devUtils/constants/modalSizes");
28
26
  var _Box = _interopRequireDefault(require("../Box"));
29
27
  var _Icon = _interopRequireDefault(require("../Icon"));
30
28
  var _IconButton = _interopRequireDefault(require("../IconButton"));
@@ -70,11 +68,8 @@ var Modal = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
70
68
  isOpen: isOpen,
71
69
  close: onClose
72
70
  };
73
- var modalRef = (0, _react.useRef)();
74
- /* istanbul ignore next */
75
- (0, _react.useImperativeHandle)(ref, function () {
76
- return modalRef.current;
77
- });
71
+ var modalRef = (0, _hooks.useLocalOrForwardRef)(ref);
72
+
78
73
  // Handle interacting outside the dialog and pressing
79
74
  // the Escape key to close the modal,
80
75
  // prevent scrolling while the modal is open, and hide content
@@ -91,7 +86,9 @@ var Modal = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
91
86
  classNames = _useStatusClasses.classNames;
92
87
  return (0, _react2.jsx)(_reactAria.OverlayContainer, null, (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({
93
88
  variant: "modal.container"
94
- }, (0, _reactAria.mergeProps)(containerProps, underlayProps, others)), (0, _react2.jsx)(_reactAria.FocusScope, {
89
+ }, (0, _reactAria.mergeProps)(containerProps, underlayProps, others), {
90
+ role: "none"
91
+ }), (0, _react2.jsx)(_reactAria.FocusScope, {
95
92
  contain: true,
96
93
  restoreFocus: true,
97
94
  autoFocus: hasAutoFocus
@@ -100,7 +97,8 @@ var Modal = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
100
97
  className: classNames
101
98
  }, propsContentProps, dialogProps, modalProps, {
102
99
  ref: modalRef,
103
- "aria-modal": true
100
+ "aria-modal": true,
101
+ role: "dialog"
104
102
  }), hasCloseButton && (closeButton !== null && closeButton !== void 0 ? closeButton : (0, _react2.jsx)(_IconButton["default"], {
105
103
  "aria-label": "Close modal window",
106
104
  "data-id": "icon-button__close-modal-window",
@@ -112,63 +110,10 @@ var Modal = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
112
110
  name: 'Close Icon'
113
111
  }
114
112
  }))), title && (0, _react2.jsx)(_Text["default"], (0, _extends2["default"])({}, titleProps, {
115
- variant: "variants.modal.title"
113
+ variant: "variants.modal.title",
114
+ role: "heading"
116
115
  }), title), children))));
117
116
  });
118
- Modal.propTypes = {
119
- /** Used in tandem with `hasCloseButton` to customize how the close button is rendered. */
120
- closeButton: _propTypes["default"].node,
121
- /** The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). */
122
- id: _propTypes["default"].string,
123
- /** Whether to auto focus the first focusable element in the focus scope on mount. */
124
- hasAutoFocus: _propTypes["default"].bool,
125
- /** Whether the modal has a visible close button. */
126
- hasCloseButton: _propTypes["default"].bool,
127
- /** Whether the overlay should close when focus is lost or moves outside it. */
128
- isClosedOnBlur: _propTypes["default"].bool,
129
- /** Whether to close the overlay when the user interacts outside it. */
130
- isDismissable: _propTypes["default"].bool,
131
- /** Whether pressing the escape key to close the overlay should be disabled. */
132
- isKeyboardDismissDisabled: _propTypes["default"].bool,
133
- /** Whether the overlay is currently open. */
134
- isOpen: _propTypes["default"].bool,
135
- /** The accessibility role for the dialog. */
136
- role: _propTypes["default"].oneOf(['dialog', 'alertdialog']),
137
- /** Sets the size of the modal container. */
138
- size: _propTypes["default"].oneOf(_modalSizes.modalSizes),
139
- /** The title for the modal. */
140
- title: _propTypes["default"].node,
141
- /**
142
- * Handler that is called when the overlay should close.
143
- *
144
- * `() => void`
145
- */
146
- onClose: _propTypes["default"].func,
147
- /**
148
- * When a user interacts with the argument element outside of the overlay ref, return true if
149
- * onClose should be called. This gives you a chance to filter out interaction with elements that
150
- * should not dismiss the overlay. By default, onClose will always be called on interaction
151
- * outside the overlay ref.
152
- *
153
- * `(element: HTMLElement) => boolean`
154
- */
155
- shouldCloseOnInteractOutside: _propTypes["default"].func,
156
- /** Defines a string value that labels the current element. */
157
- 'aria-label': _propTypes["default"].string,
158
- /** Identifies the element (or elements) that labels the current element. */
159
- 'aria-labelledby': _propTypes["default"].string,
160
- /** Identifies the element (or elements) that describes the object. */
161
- 'aria-describedby': _propTypes["default"].string,
162
- /**
163
- * Identifies the element (or elements) that provide a detailed, extended description for the
164
- * object.
165
- */
166
- 'aria-details': _propTypes["default"].string,
167
- /** Props object spread directly into the modal content Box. */
168
- contentProps: _propTypes["default"].shape({}),
169
- /** Props object spread directly into the modal container Box. */
170
- containerProps: _propTypes["default"].shape({})
171
- };
172
117
  Modal.defaultProps = {
173
118
  role: 'dialog'
174
119
  };
@@ -0,0 +1,5 @@
1
+ import { StoryFn } from '@storybook/react';
2
+ import { ModalProps } 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<ModalProps>;
@@ -12,7 +12,7 @@ var _storybookAddonDesigns = require("storybook-addon-designs");
12
12
  var _storybookDocsLayout = _interopRequireDefault(require("../../../.storybook/storybookDocsLayout"));
13
13
  var _hooks = require("../../hooks");
14
14
  var _index = require("../../index");
15
- var _figmaLinks = require("../../utils/designUtils/figmaLinks.ts");
15
+ var _figmaLinks = require("../../utils/designUtils/figmaLinks");
16
16
  var _modalSizes = require("../../utils/devUtils/constants/modalSizes");
17
17
  var _Modal = _interopRequireDefault(require("./Modal.mdx"));
18
18
  var _react2 = require("@emotion/react");
@@ -0,0 +1,77 @@
1
+ export declare const modalCloseButton: {
2
+ position: string;
3
+ top: number;
4
+ right: number;
5
+ width: string;
6
+ height: string;
7
+ };
8
+ declare const _default: {
9
+ closeIcon: {
10
+ color: string;
11
+ };
12
+ container: {
13
+ position: string;
14
+ zIndex: number;
15
+ top: number;
16
+ left: number;
17
+ bottom: number;
18
+ right: number;
19
+ background: string;
20
+ display: string;
21
+ alignItems: string;
22
+ justifyContent: string;
23
+ };
24
+ content: {
25
+ position: string;
26
+ outline: string;
27
+ background: string;
28
+ color: string;
29
+ pt: string;
30
+ pr: string;
31
+ pb: string;
32
+ pl: string;
33
+ maxWidth: string;
34
+ boxShadow: string;
35
+ borderRadius: number;
36
+ '&.is-extra-small': {
37
+ maxWidth: string;
38
+ width: string;
39
+ };
40
+ '&.is-small': {
41
+ maxWidth: string;
42
+ width: string;
43
+ };
44
+ '&.is-medium': {
45
+ maxWidth: string;
46
+ width: string;
47
+ };
48
+ '&.is-large': {
49
+ maxWidth: string;
50
+ width: string;
51
+ };
52
+ '&.is-full': {
53
+ maxWidth: string;
54
+ width: string;
55
+ };
56
+ };
57
+ title: {
58
+ mr: string;
59
+ fontWeight: number;
60
+ fontSize: string;
61
+ color: string;
62
+ fontFamily: string;
63
+ display: string;
64
+ overflowWrap: import("../..").overflowWrap;
65
+ maxWidth: string;
66
+ wordWrap: import("../..").wordWrap;
67
+ wordBreak: import("../..").wordBreak;
68
+ };
69
+ modalCloseButton: {
70
+ position: string;
71
+ top: number;
72
+ right: number;
73
+ width: string;
74
+ height: string;
75
+ };
76
+ };
77
+ export default _default;
@@ -0,0 +1 @@
1
+ export { default } from './Modal';
@@ -22,7 +22,9 @@ var _react2 = require("@emotion/react");
22
22
  hasCloseButton: true
23
23
  }, modalProps))));
24
24
  };
25
- var getComposedComponent = function getComposedComponent(defaultState, modalProps) {
25
+ var getComposedComponent = function getComposedComponent() {
26
+ var defaultState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
27
+ var modalProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
26
28
  return (0, _testWrapper.render)((0, _react2.jsx)(ComposedComponent, {
27
29
  defaultState: defaultState,
28
30
  modalProps: modalProps
@@ -33,12 +35,12 @@ test('clicking the trigger should open the modal', function () {
33
35
  expect(_testWrapper.screen.queryByRole('dialog')).not.toBeInTheDocument();
34
36
 
35
37
  // Open it with the button trigger
36
- _userEvent["default"].click(_testWrapper.screen.queryByRole('button'));
38
+ _userEvent["default"].click(_testWrapper.screen.getByRole('button'));
37
39
  expect(_testWrapper.screen.queryByRole('dialog')).toBeInTheDocument();
38
40
  });
39
41
  test('keyboard interaction with the trigger should open the modal', function () {
40
42
  getComposedComponent();
41
- var button = _testWrapper.screen.queryByRole('button');
43
+ var button = _testWrapper.screen.getByRole('button');
42
44
  expect(_testWrapper.screen.queryByRole('dialog')).not.toBeInTheDocument();
43
45
 
44
46
  // Open it with the button trigger
@@ -79,11 +81,11 @@ test('keyboard interactions on the close button should close the modal', functio
79
81
  });
80
82
  test('assign aria-hidden to elements outside the modal when the modal is opened', function () {
81
83
  getComposedComponent();
82
- var button = _testWrapper.screen.queryByRole('button');
84
+ var button = _testWrapper.screen.getByRole('button');
83
85
  var buttonParent = button.closest('div');
84
86
  expect(buttonParent).not.toHaveAttribute('aria-hidden');
85
87
 
86
88
  // Open the modal
87
- _userEvent["default"].click(_testWrapper.screen.queryByRole('button'));
89
+ _userEvent["default"].click(_testWrapper.screen.getByRole('button'));
88
90
  expect(buttonParent).toHaveAttribute('aria-hidden');
89
91
  });
@@ -32,32 +32,32 @@ test('default modal', function () {
32
32
  });
33
33
  test('should spread undocumented props to the container element', function () {
34
34
  getComponent({
35
- 'data-prop': 'test'
35
+ 'data-testid': 'test'
36
36
  });
37
- var container = (0, _testWrapper.queryByAttribute)('data-prop', document, 'test');
37
+ var container = _testWrapper.screen.queryByTestId('test');
38
38
  var modal = _testWrapper.screen.getByRole('dialog');
39
39
  expect(container).toContainElement(modal);
40
- expect(modal).not.toHaveAttribute('data-prop', 'test');
40
+ expect(modal).not.toHaveAttribute('data-testid', 'test');
41
41
  });
42
42
  test('should spread container props to the container element even if documented', function () {
43
43
  getComponent({
44
44
  containerProps: {
45
- id: 'test'
45
+ 'data-testid': 'test'
46
46
  }
47
47
  });
48
- var container = (0, _testWrapper.queryByAttribute)('id', document, 'test');
48
+ var container = _testWrapper.screen.queryByTestId('test');
49
49
  var modal = _testWrapper.screen.getByRole('dialog');
50
50
  expect(container).toContainElement(modal);
51
- expect(modal).not.toHaveAttribute('id', 'test');
51
+ expect(modal).not.toHaveAttribute('data-testid', 'test');
52
52
  });
53
53
  test('should spread content props to the modal dialog even if undocumented', function () {
54
54
  getComponent({
55
55
  contentProps: {
56
- 'data-prop': 'test'
56
+ 'data-testid': 'test'
57
57
  }
58
58
  });
59
59
  var modal = _testWrapper.screen.getByRole('dialog');
60
- expect(modal).toHaveAttribute('data-prop', 'test');
60
+ expect(modal).toHaveAttribute('data-testid', 'test');
61
61
  });
62
62
  test('should display title for modal', function () {
63
63
  var title = 'my title';
@@ -18,13 +18,13 @@ interface UseComponentToggle {
18
18
  */
19
19
  (props: ComponentToggleProps): ComponentToggleResult;
20
20
  }
21
- interface ComponentToggleProps {
21
+ export interface ComponentToggleProps {
22
22
  ComponentToRenderIfTrue: React.ReactNode;
23
23
  ComponentToRenderIfFalse: React.ReactNode;
24
24
  condition: boolean;
25
25
  onConditionChange?: (newCondition: boolean, ...args: unknown[]) => void;
26
26
  }
27
- interface ComponentToggleResult {
27
+ export interface ComponentToggleResult {
28
28
  handleConditionChange: (...args: unknown[]) => void;
29
29
  RenderedComponent: React.ReactNode;
30
30
  }
@@ -0,0 +1,58 @@
1
+ import { ReactNode } from 'react';
2
+ import { DOMAttributes } from './shared/dom';
3
+ import { ModalSizeProps } from './shared/style';
4
+ import { TestingAttributes } from './shared/test';
5
+ export interface ModalProps extends DOMAttributes, TestingAttributes {
6
+ /** Used in tandem with `hasCloseButton` to customize how the close button is rendered. */
7
+ closeButton?: ReactNode;
8
+ /** The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). */
9
+ id?: string;
10
+ /** Whether to auto focus the first focusable element in the focus scope on mount. */
11
+ hasAutoFocus?: boolean;
12
+ /** Whether the modal has a visible close button. */
13
+ hasCloseButton?: boolean;
14
+ /** Whether the overlay should close when focus is lost or moves outside it. */
15
+ isClosedOnBlur?: boolean;
16
+ /** Whether to close the overlay when the user interacts outside it. */
17
+ isDismissable?: boolean;
18
+ /** Whether pressing the escape key to close the overlay should be disabled. */
19
+ isKeyboardDismissDisabled?: boolean;
20
+ /** Whether the overlay is currently open. */
21
+ isOpen?: boolean;
22
+ /** The accessibility role for the dialog. */
23
+ role?: 'dialog' | 'alertdialog';
24
+ /** Sets the size of the modal container. */
25
+ size?: ModalSizeProps;
26
+ /** The title for the modal. */
27
+ title?: ReactNode;
28
+ /**
29
+ * Handler that is called when the overlay should close.
30
+ *
31
+ * `() => void`
32
+ */
33
+ onClose?: () => void;
34
+ /**
35
+ * When a user interacts with the argument element outside of the overlay ref, return true if
36
+ * onClose should be called. This gives you a chance to filter out interaction with elements that
37
+ * should not dismiss the overlay. By default, onClose will always be called on interaction
38
+ * outside the overlay ref.
39
+ *
40
+ * `(element: HTMLElement) => boolean`
41
+ */
42
+ shouldCloseOnInteractOutside?: (element: Element) => boolean;
43
+ /** Defines a string value that labels the current element. */
44
+ 'aria-label'?: string;
45
+ /** Identifies the element (or elements) that labels the current element. */
46
+ 'aria-labelledby'?: string;
47
+ /** Identifies the element (or elements) that describes the object. */
48
+ 'aria-describedby'?: string;
49
+ /**
50
+ * Identifies the element (or elements) that provide a detailed, extended description for the
51
+ * object.
52
+ */
53
+ 'aria-details'?: string;
54
+ /** Props object spread directly into the modal content Box. */
55
+ contentProps?: object;
56
+ /** Props object spread directly into the modal container Box. */
57
+ containerProps?: object;
58
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
+ _Object$defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
@@ -1,6 +1,7 @@
1
1
  import { ButtonProps as ThemeUIButtonProps } from 'theme-ui';
2
+ import { TestingAttributes } from './shared/test';
2
3
  import { HoverProps, PressProps } from './shared';
3
- export interface ButtonProps extends HoverProps, PressProps, ThemeUIButtonProps {
4
+ export interface ButtonProps extends HoverProps, PressProps, ThemeUIButtonProps, TestingAttributes {
4
5
  isDisabled?: boolean;
5
6
  isLoading?: boolean;
6
7
  tabIndex?: number;
@@ -23,7 +23,7 @@ export interface IconProps extends StyleProps, DOMAttributes, TestingAttributes
23
23
  name: string;
24
24
  };
25
25
  /** The icon to render. */
26
- icon: IconTypeExtended;
26
+ icon?: IconTypeExtended;
27
27
  size?: IconSize;
28
28
  /** A theme-aware prop to set the icon's color. */
29
29
  color?: string;
@@ -1,4 +1,4 @@
1
- import { IconButtonProps as ThemeUIIconButtonProps, ThemeUICSSObject } from 'theme-ui';
1
+ import { IconButtonProps as ThemeUIIconButtonProps } from 'theme-ui';
2
2
  import { TestingAttributes } from './shared/test';
3
3
  import { IconTypeExtended } from './icon';
4
4
  import { HoverProps, IconSize, PressProps } from './shared';
@@ -16,7 +16,5 @@ export interface IconButtonProps extends ThemeUIIconButtonProps, TestingAttribut
16
16
  'aria-label'?: string | undefined;
17
17
  /** Whether the icon button is disabled. */
18
18
  isDisabled?: boolean;
19
- /** Inline styling prop */
20
- sx?: ThemeUICSSObject;
21
19
  size?: IconSize;
22
20
  }
@@ -0,0 +1,20 @@
1
+ import { ElementType } from 'react';
2
+ import { TestingAttributes } from './shared/test';
3
+ import { ButtonProps } from './button';
4
+ import { IconProps } from './icon';
5
+ export interface IconButtonToggleProps extends TestingAttributes {
6
+ /** Props object that is spread into the icon element. */
7
+ iconProps?: IconProps;
8
+ /** Props object that is spread into the button element. */
9
+ buttonProps?: ButtonProps;
10
+ /** The icon that will render by default. */
11
+ defaultIcon: ElementType;
12
+ /** The icon that will render after toggling the icon. */
13
+ toggledIcon: ElementType;
14
+ /** Whether or not the icon is toggled. (use only when controlled) */
15
+ isToggled?: boolean;
16
+ /** Function that is passed into the IconButton within this component. */
17
+ onToggle?: () => void;
18
+ /** Content will be displayed in a tooltip on hover or focus. */
19
+ title?: string;
20
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
+ _Object$defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
@@ -11,6 +11,7 @@ export * from './helpHint';
11
11
  export * from './icon';
12
12
  export * from './iconBadge';
13
13
  export * from './iconButton';
14
+ export * from './iconButtonToggle';
14
15
  export * from './input';
15
16
  export * from './item';
16
17
  export * from './label';
@@ -20,6 +21,7 @@ export * from './listItem';
20
21
  export * from './loader';
21
22
  export * from './menu';
22
23
  export * from './menuItem';
24
+ export * from './Modal';
23
25
  export * from './overlayPanel';
24
26
  export * from './popoverContainer';
25
27
  export * from './popoverMenu';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17, _context18, _context19, _context20, _context21, _context22, _context23, _context24, _context25, _context26, _context27, _context28, _context29, _context30, _context31, _context32, _context33;
3
+ var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17, _context18, _context19, _context20, _context21, _context22, _context23, _context24, _context25, _context26, _context27, _context28, _context29, _context30, _context31, _context32, _context33, _context34, _context35;
4
4
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
5
5
  var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
6
6
  var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
@@ -150,8 +150,19 @@ _forEachInstanceProperty(_context13 = _Object$keys(_iconButton)).call(_context13
150
150
  }
151
151
  });
152
152
  });
153
+ var _iconButtonToggle = require("./iconButtonToggle");
154
+ _forEachInstanceProperty(_context14 = _Object$keys(_iconButtonToggle)).call(_context14, function (key) {
155
+ if (key === "default" || key === "__esModule") return;
156
+ if (key in exports && exports[key] === _iconButtonToggle[key]) return;
157
+ _Object$defineProperty(exports, key, {
158
+ enumerable: true,
159
+ get: function get() {
160
+ return _iconButtonToggle[key];
161
+ }
162
+ });
163
+ });
153
164
  var _input = require("./input");
154
- _forEachInstanceProperty(_context14 = _Object$keys(_input)).call(_context14, function (key) {
165
+ _forEachInstanceProperty(_context15 = _Object$keys(_input)).call(_context15, function (key) {
155
166
  if (key === "default" || key === "__esModule") return;
156
167
  if (key in exports && exports[key] === _input[key]) return;
157
168
  _Object$defineProperty(exports, key, {
@@ -162,7 +173,7 @@ _forEachInstanceProperty(_context14 = _Object$keys(_input)).call(_context14, fun
162
173
  });
163
174
  });
164
175
  var _item = require("./item");
165
- _forEachInstanceProperty(_context15 = _Object$keys(_item)).call(_context15, function (key) {
176
+ _forEachInstanceProperty(_context16 = _Object$keys(_item)).call(_context16, function (key) {
166
177
  if (key === "default" || key === "__esModule") return;
167
178
  if (key in exports && exports[key] === _item[key]) return;
168
179
  _Object$defineProperty(exports, key, {
@@ -173,7 +184,7 @@ _forEachInstanceProperty(_context15 = _Object$keys(_item)).call(_context15, func
173
184
  });
174
185
  });
175
186
  var _label = require("./label");
176
- _forEachInstanceProperty(_context16 = _Object$keys(_label)).call(_context16, function (key) {
187
+ _forEachInstanceProperty(_context17 = _Object$keys(_label)).call(_context17, function (key) {
177
188
  if (key === "default" || key === "__esModule") return;
178
189
  if (key in exports && exports[key] === _label[key]) return;
179
190
  _Object$defineProperty(exports, key, {
@@ -184,7 +195,7 @@ _forEachInstanceProperty(_context16 = _Object$keys(_label)).call(_context16, fun
184
195
  });
185
196
  });
186
197
  var _link = require("./link");
187
- _forEachInstanceProperty(_context17 = _Object$keys(_link)).call(_context17, function (key) {
198
+ _forEachInstanceProperty(_context18 = _Object$keys(_link)).call(_context18, function (key) {
188
199
  if (key === "default" || key === "__esModule") return;
189
200
  if (key in exports && exports[key] === _link[key]) return;
190
201
  _Object$defineProperty(exports, key, {
@@ -195,7 +206,7 @@ _forEachInstanceProperty(_context17 = _Object$keys(_link)).call(_context17, func
195
206
  });
196
207
  });
197
208
  var _listBox = require("./listBox");
198
- _forEachInstanceProperty(_context18 = _Object$keys(_listBox)).call(_context18, function (key) {
209
+ _forEachInstanceProperty(_context19 = _Object$keys(_listBox)).call(_context19, function (key) {
199
210
  if (key === "default" || key === "__esModule") return;
200
211
  if (key in exports && exports[key] === _listBox[key]) return;
201
212
  _Object$defineProperty(exports, key, {
@@ -206,7 +217,7 @@ _forEachInstanceProperty(_context18 = _Object$keys(_listBox)).call(_context18, f
206
217
  });
207
218
  });
208
219
  var _listItem = require("./listItem");
209
- _forEachInstanceProperty(_context19 = _Object$keys(_listItem)).call(_context19, function (key) {
220
+ _forEachInstanceProperty(_context20 = _Object$keys(_listItem)).call(_context20, function (key) {
210
221
  if (key === "default" || key === "__esModule") return;
211
222
  if (key in exports && exports[key] === _listItem[key]) return;
212
223
  _Object$defineProperty(exports, key, {
@@ -217,7 +228,7 @@ _forEachInstanceProperty(_context19 = _Object$keys(_listItem)).call(_context19,
217
228
  });
218
229
  });
219
230
  var _loader = require("./loader");
220
- _forEachInstanceProperty(_context20 = _Object$keys(_loader)).call(_context20, function (key) {
231
+ _forEachInstanceProperty(_context21 = _Object$keys(_loader)).call(_context21, function (key) {
221
232
  if (key === "default" || key === "__esModule") return;
222
233
  if (key in exports && exports[key] === _loader[key]) return;
223
234
  _Object$defineProperty(exports, key, {
@@ -228,7 +239,7 @@ _forEachInstanceProperty(_context20 = _Object$keys(_loader)).call(_context20, fu
228
239
  });
229
240
  });
230
241
  var _menu = require("./menu");
231
- _forEachInstanceProperty(_context21 = _Object$keys(_menu)).call(_context21, function (key) {
242
+ _forEachInstanceProperty(_context22 = _Object$keys(_menu)).call(_context22, function (key) {
232
243
  if (key === "default" || key === "__esModule") return;
233
244
  if (key in exports && exports[key] === _menu[key]) return;
234
245
  _Object$defineProperty(exports, key, {
@@ -239,7 +250,7 @@ _forEachInstanceProperty(_context21 = _Object$keys(_menu)).call(_context21, func
239
250
  });
240
251
  });
241
252
  var _menuItem = require("./menuItem");
242
- _forEachInstanceProperty(_context22 = _Object$keys(_menuItem)).call(_context22, function (key) {
253
+ _forEachInstanceProperty(_context23 = _Object$keys(_menuItem)).call(_context23, function (key) {
243
254
  if (key === "default" || key === "__esModule") return;
244
255
  if (key in exports && exports[key] === _menuItem[key]) return;
245
256
  _Object$defineProperty(exports, key, {
@@ -249,8 +260,19 @@ _forEachInstanceProperty(_context22 = _Object$keys(_menuItem)).call(_context22,
249
260
  }
250
261
  });
251
262
  });
263
+ var _Modal = require("./Modal");
264
+ _forEachInstanceProperty(_context24 = _Object$keys(_Modal)).call(_context24, function (key) {
265
+ if (key === "default" || key === "__esModule") return;
266
+ if (key in exports && exports[key] === _Modal[key]) return;
267
+ _Object$defineProperty(exports, key, {
268
+ enumerable: true,
269
+ get: function get() {
270
+ return _Modal[key];
271
+ }
272
+ });
273
+ });
252
274
  var _overlayPanel = require("./overlayPanel");
253
- _forEachInstanceProperty(_context23 = _Object$keys(_overlayPanel)).call(_context23, function (key) {
275
+ _forEachInstanceProperty(_context25 = _Object$keys(_overlayPanel)).call(_context25, function (key) {
254
276
  if (key === "default" || key === "__esModule") return;
255
277
  if (key in exports && exports[key] === _overlayPanel[key]) return;
256
278
  _Object$defineProperty(exports, key, {
@@ -261,7 +283,7 @@ _forEachInstanceProperty(_context23 = _Object$keys(_overlayPanel)).call(_context
261
283
  });
262
284
  });
263
285
  var _popoverContainer = require("./popoverContainer");
264
- _forEachInstanceProperty(_context24 = _Object$keys(_popoverContainer)).call(_context24, function (key) {
286
+ _forEachInstanceProperty(_context26 = _Object$keys(_popoverContainer)).call(_context26, function (key) {
265
287
  if (key === "default" || key === "__esModule") return;
266
288
  if (key in exports && exports[key] === _popoverContainer[key]) return;
267
289
  _Object$defineProperty(exports, key, {
@@ -272,7 +294,7 @@ _forEachInstanceProperty(_context24 = _Object$keys(_popoverContainer)).call(_con
272
294
  });
273
295
  });
274
296
  var _popoverMenu = require("./popoverMenu");
275
- _forEachInstanceProperty(_context25 = _Object$keys(_popoverMenu)).call(_context25, function (key) {
297
+ _forEachInstanceProperty(_context27 = _Object$keys(_popoverMenu)).call(_context27, function (key) {
276
298
  if (key === "default" || key === "__esModule") return;
277
299
  if (key in exports && exports[key] === _popoverMenu[key]) return;
278
300
  _Object$defineProperty(exports, key, {
@@ -283,7 +305,7 @@ _forEachInstanceProperty(_context25 = _Object$keys(_popoverMenu)).call(_context2
283
305
  });
284
306
  });
285
307
  var _requirementsList = require("./requirementsList");
286
- _forEachInstanceProperty(_context26 = _Object$keys(_requirementsList)).call(_context26, function (key) {
308
+ _forEachInstanceProperty(_context28 = _Object$keys(_requirementsList)).call(_context28, function (key) {
287
309
  if (key === "default" || key === "__esModule") return;
288
310
  if (key in exports && exports[key] === _requirementsList[key]) return;
289
311
  _Object$defineProperty(exports, key, {
@@ -294,7 +316,7 @@ _forEachInstanceProperty(_context26 = _Object$keys(_requirementsList)).call(_con
294
316
  });
295
317
  });
296
318
  var _rockerButtonGroup = require("./rockerButtonGroup");
297
- _forEachInstanceProperty(_context27 = _Object$keys(_rockerButtonGroup)).call(_context27, function (key) {
319
+ _forEachInstanceProperty(_context29 = _Object$keys(_rockerButtonGroup)).call(_context29, function (key) {
298
320
  if (key === "default" || key === "__esModule") return;
299
321
  if (key in exports && exports[key] === _rockerButtonGroup[key]) return;
300
322
  _Object$defineProperty(exports, key, {
@@ -305,7 +327,7 @@ _forEachInstanceProperty(_context27 = _Object$keys(_rockerButtonGroup)).call(_co
305
327
  });
306
328
  });
307
329
  var _scrollBox = require("./scrollBox");
308
- _forEachInstanceProperty(_context28 = _Object$keys(_scrollBox)).call(_context28, function (key) {
330
+ _forEachInstanceProperty(_context30 = _Object$keys(_scrollBox)).call(_context30, function (key) {
309
331
  if (key === "default" || key === "__esModule") return;
310
332
  if (key in exports && exports[key] === _scrollBox[key]) return;
311
333
  _Object$defineProperty(exports, key, {
@@ -316,7 +338,7 @@ _forEachInstanceProperty(_context28 = _Object$keys(_scrollBox)).call(_context28,
316
338
  });
317
339
  });
318
340
  var _separator = require("./separator");
319
- _forEachInstanceProperty(_context29 = _Object$keys(_separator)).call(_context29, function (key) {
341
+ _forEachInstanceProperty(_context31 = _Object$keys(_separator)).call(_context31, function (key) {
320
342
  if (key === "default" || key === "__esModule") return;
321
343
  if (key in exports && exports[key] === _separator[key]) return;
322
344
  _Object$defineProperty(exports, key, {
@@ -327,7 +349,7 @@ _forEachInstanceProperty(_context29 = _Object$keys(_separator)).call(_context29,
327
349
  });
328
350
  });
329
351
  var _shared = require("./shared");
330
- _forEachInstanceProperty(_context30 = _Object$keys(_shared)).call(_context30, function (key) {
352
+ _forEachInstanceProperty(_context32 = _Object$keys(_shared)).call(_context32, function (key) {
331
353
  if (key === "default" || key === "__esModule") return;
332
354
  if (key in exports && exports[key] === _shared[key]) return;
333
355
  _Object$defineProperty(exports, key, {
@@ -338,7 +360,7 @@ _forEachInstanceProperty(_context30 = _Object$keys(_shared)).call(_context30, fu
338
360
  });
339
361
  });
340
362
  var _table = require("./table");
341
- _forEachInstanceProperty(_context31 = _Object$keys(_table)).call(_context31, function (key) {
363
+ _forEachInstanceProperty(_context33 = _Object$keys(_table)).call(_context33, function (key) {
342
364
  if (key === "default" || key === "__esModule") return;
343
365
  if (key in exports && exports[key] === _table[key]) return;
344
366
  _Object$defineProperty(exports, key, {
@@ -349,7 +371,7 @@ _forEachInstanceProperty(_context31 = _Object$keys(_table)).call(_context31, fun
349
371
  });
350
372
  });
351
373
  var _text = require("./text");
352
- _forEachInstanceProperty(_context32 = _Object$keys(_text)).call(_context32, function (key) {
374
+ _forEachInstanceProperty(_context34 = _Object$keys(_text)).call(_context34, function (key) {
353
375
  if (key === "default" || key === "__esModule") return;
354
376
  if (key in exports && exports[key] === _text[key]) return;
355
377
  _Object$defineProperty(exports, key, {
@@ -360,7 +382,7 @@ _forEachInstanceProperty(_context32 = _Object$keys(_text)).call(_context32, func
360
382
  });
361
383
  });
362
384
  var _tooltipTrigger = require("./tooltipTrigger");
363
- _forEachInstanceProperty(_context33 = _Object$keys(_tooltipTrigger)).call(_context33, function (key) {
385
+ _forEachInstanceProperty(_context35 = _Object$keys(_tooltipTrigger)).call(_context35, function (key) {
364
386
  if (key === "default" || key === "__esModule") return;
365
387
  if (key in exports && exports[key] === _tooltipTrigger[key]) return;
366
388
  _Object$defineProperty(exports, key, {
@@ -17,6 +17,7 @@ export type Alignment = 'start' | 'end' | 'middle';
17
17
  export type SizeAxis = 'width' | 'height';
18
18
  export type PlacementAxis = Axis | 'center';
19
19
  export type PanelSize = 'small' | 'medium' | 'large' | 'full' | 'custom';
20
+ export type ModalSizeProps = 'extra-small' | 'small' | 'medium' | 'large' | 'full';
20
21
  type IconTShirtSize = 'xs' | 'sm' | 'md';
21
22
  type pixelSize = 'em' | 'px' | 'rem';
22
23
  export type IconSize = IconTShirtSize | number | `${number}${pixelSize}`;
@@ -1,6 +1,5 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
2
  import React, { forwardRef } from 'react';
3
- import PropTypes from 'prop-types';
4
3
  import { useComponentToggle } from '../../hooks';
5
4
  import Icon from '../Icon';
6
5
  import IconButton from '../IconButton';
@@ -30,20 +29,4 @@ var IconButtonToggle = /*#__PURE__*/forwardRef(function (props, ref) {
30
29
  icon: RenderedComponent
31
30
  }, iconProps)));
32
31
  });
33
- IconButtonToggle.propTypes = {
34
- /** Props object that is spread into the icon element. */
35
- iconProps: PropTypes.shape({}),
36
- /** Props object that is spread into the button element. */
37
- buttonProps: PropTypes.shape({}),
38
- /** The icon that will render by default. */
39
- defaultIcon: PropTypes.elementType.isRequired,
40
- /** The icon that will render after toggling the icon. */
41
- toggledIcon: PropTypes.elementType.isRequired,
42
- /** Whether or not the icon is toggled. (use only when controlled) */
43
- isToggled: PropTypes.bool,
44
- /** Function that is passed into the IconButton within this component. */
45
- onToggle: PropTypes.func,
46
- /** Content will be displayed in a tooltip on hover or focus. */
47
- title: PropTypes.string
48
- };
49
32
  export default IconButtonToggle;
@@ -12,13 +12,11 @@ import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectW
12
12
  var _excluded = ["className", "closeButton", "hasAutoFocus", "hasCloseButton", "id", "isClosedOnBlur", "isDismissable", "isKeyboardDismissDisabled", "isOpen", "role", "size", "title", "onClose", "shouldCloseOnInteractOutside", "children", "contentProps", "containerProps"];
13
13
  function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
14
14
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _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; }
15
- import React, { forwardRef, useImperativeHandle, useRef } from 'react';
15
+ import React, { forwardRef } from 'react';
16
16
  import { FocusScope, mergeProps, OverlayContainer, useDialog } from 'react-aria';
17
17
  import CloseIcon from '@pingux/mdi-react/CloseIcon';
18
18
  import { useModalOverlay } from '@react-aria/overlays';
19
- import PropTypes from 'prop-types';
20
- import { useStatusClasses } from '../../hooks';
21
- import { modalSizes } from '../../utils/devUtils/constants/modalSizes';
19
+ import { useLocalOrForwardRef, useStatusClasses } from '../../hooks';
22
20
  import Box from '../Box';
23
21
  import Icon from '../Icon';
24
22
  import IconButton from '../IconButton';
@@ -59,11 +57,8 @@ var Modal = /*#__PURE__*/forwardRef(function (props, ref) {
59
57
  isOpen: isOpen,
60
58
  close: onClose
61
59
  };
62
- var modalRef = useRef();
63
- /* istanbul ignore next */
64
- useImperativeHandle(ref, function () {
65
- return modalRef.current;
66
- });
60
+ var modalRef = useLocalOrForwardRef(ref);
61
+
67
62
  // Handle interacting outside the dialog and pressing
68
63
  // the Escape key to close the modal,
69
64
  // prevent scrolling while the modal is open, and hide content
@@ -80,7 +75,9 @@ var Modal = /*#__PURE__*/forwardRef(function (props, ref) {
80
75
  classNames = _useStatusClasses.classNames;
81
76
  return ___EmotionJSX(OverlayContainer, null, ___EmotionJSX(Box, _extends({
82
77
  variant: "modal.container"
83
- }, mergeProps(containerProps, underlayProps, others)), ___EmotionJSX(FocusScope, {
78
+ }, mergeProps(containerProps, underlayProps, others), {
79
+ role: "none"
80
+ }), ___EmotionJSX(FocusScope, {
84
81
  contain: true,
85
82
  restoreFocus: true,
86
83
  autoFocus: hasAutoFocus
@@ -89,7 +86,8 @@ var Modal = /*#__PURE__*/forwardRef(function (props, ref) {
89
86
  className: classNames
90
87
  }, propsContentProps, dialogProps, modalProps, {
91
88
  ref: modalRef,
92
- "aria-modal": true
89
+ "aria-modal": true,
90
+ role: "dialog"
93
91
  }), hasCloseButton && (closeButton !== null && closeButton !== void 0 ? closeButton : ___EmotionJSX(IconButton, {
94
92
  "aria-label": "Close modal window",
95
93
  "data-id": "icon-button__close-modal-window",
@@ -101,63 +99,10 @@ var Modal = /*#__PURE__*/forwardRef(function (props, ref) {
101
99
  name: 'Close Icon'
102
100
  }
103
101
  }))), title && ___EmotionJSX(Text, _extends({}, titleProps, {
104
- variant: "variants.modal.title"
102
+ variant: "variants.modal.title",
103
+ role: "heading"
105
104
  }), title), children))));
106
105
  });
107
- Modal.propTypes = {
108
- /** Used in tandem with `hasCloseButton` to customize how the close button is rendered. */
109
- closeButton: PropTypes.node,
110
- /** The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). */
111
- id: PropTypes.string,
112
- /** Whether to auto focus the first focusable element in the focus scope on mount. */
113
- hasAutoFocus: PropTypes.bool,
114
- /** Whether the modal has a visible close button. */
115
- hasCloseButton: PropTypes.bool,
116
- /** Whether the overlay should close when focus is lost or moves outside it. */
117
- isClosedOnBlur: PropTypes.bool,
118
- /** Whether to close the overlay when the user interacts outside it. */
119
- isDismissable: PropTypes.bool,
120
- /** Whether pressing the escape key to close the overlay should be disabled. */
121
- isKeyboardDismissDisabled: PropTypes.bool,
122
- /** Whether the overlay is currently open. */
123
- isOpen: PropTypes.bool,
124
- /** The accessibility role for the dialog. */
125
- role: PropTypes.oneOf(['dialog', 'alertdialog']),
126
- /** Sets the size of the modal container. */
127
- size: PropTypes.oneOf(modalSizes),
128
- /** The title for the modal. */
129
- title: PropTypes.node,
130
- /**
131
- * Handler that is called when the overlay should close.
132
- *
133
- * `() => void`
134
- */
135
- onClose: PropTypes.func,
136
- /**
137
- * When a user interacts with the argument element outside of the overlay ref, return true if
138
- * onClose should be called. This gives you a chance to filter out interaction with elements that
139
- * should not dismiss the overlay. By default, onClose will always be called on interaction
140
- * outside the overlay ref.
141
- *
142
- * `(element: HTMLElement) => boolean`
143
- */
144
- shouldCloseOnInteractOutside: PropTypes.func,
145
- /** Defines a string value that labels the current element. */
146
- 'aria-label': PropTypes.string,
147
- /** Identifies the element (or elements) that labels the current element. */
148
- 'aria-labelledby': PropTypes.string,
149
- /** Identifies the element (or elements) that describes the object. */
150
- 'aria-describedby': PropTypes.string,
151
- /**
152
- * Identifies the element (or elements) that provide a detailed, extended description for the
153
- * object.
154
- */
155
- 'aria-details': PropTypes.string,
156
- /** Props object spread directly into the modal content Box. */
157
- contentProps: PropTypes.shape({}),
158
- /** Props object spread directly into the modal container Box. */
159
- containerProps: PropTypes.shape({})
160
- };
161
106
  Modal.defaultProps = {
162
107
  role: 'dialog'
163
108
  };
@@ -4,7 +4,7 @@ import { withDesign } from 'storybook-addon-designs';
4
4
  import DocsLayout from '../../../.storybook/storybookDocsLayout';
5
5
  import { useModalState } from '../../hooks';
6
6
  import { Box, Button, Modal, OverlayProvider, Text } from '../../index';
7
- import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks.ts';
7
+ import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks';
8
8
  import { modalSizes } from '../../utils/devUtils/constants/modalSizes';
9
9
  import ModalReadme from './Modal.mdx';
10
10
  import { jsx as ___EmotionJSX } from "@emotion/react";
@@ -21,7 +21,9 @@ var ComposedComponent = function ComposedComponent(props) {
21
21
  hasCloseButton: true
22
22
  }, modalProps))));
23
23
  };
24
- var getComposedComponent = function getComposedComponent(defaultState, modalProps) {
24
+ var getComposedComponent = function getComposedComponent() {
25
+ var defaultState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
26
+ var modalProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25
27
  return render(___EmotionJSX(ComposedComponent, {
26
28
  defaultState: defaultState,
27
29
  modalProps: modalProps
@@ -32,12 +34,12 @@ test('clicking the trigger should open the modal', function () {
32
34
  expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
33
35
 
34
36
  // Open it with the button trigger
35
- userEvent.click(screen.queryByRole('button'));
37
+ userEvent.click(screen.getByRole('button'));
36
38
  expect(screen.queryByRole('dialog')).toBeInTheDocument();
37
39
  });
38
40
  test('keyboard interaction with the trigger should open the modal', function () {
39
41
  getComposedComponent();
40
- var button = screen.queryByRole('button');
42
+ var button = screen.getByRole('button');
41
43
  expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
42
44
 
43
45
  // Open it with the button trigger
@@ -78,11 +80,11 @@ test('keyboard interactions on the close button should close the modal', functio
78
80
  });
79
81
  test('assign aria-hidden to elements outside the modal when the modal is opened', function () {
80
82
  getComposedComponent();
81
- var button = screen.queryByRole('button');
83
+ var button = screen.getByRole('button');
82
84
  var buttonParent = button.closest('div');
83
85
  expect(buttonParent).not.toHaveAttribute('aria-hidden');
84
86
 
85
87
  // Open the modal
86
- userEvent.click(screen.queryByRole('button'));
88
+ userEvent.click(screen.getByRole('button'));
87
89
  expect(buttonParent).toHaveAttribute('aria-hidden');
88
90
  });
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import userEvent from '@testing-library/user-event';
3
3
  import { Modal, OverlayProvider } from '../../../index';
4
- import { queryByAttribute, render, screen } from '../../../utils/testUtils/testWrapper';
4
+ import { render, screen } from '../../../utils/testUtils/testWrapper';
5
5
  import { universalComponentTests } from '../../../utils/testUtils/universalComponentTest';
6
6
 
7
7
  // For testing the modal alone
@@ -30,32 +30,32 @@ test('default modal', function () {
30
30
  });
31
31
  test('should spread undocumented props to the container element', function () {
32
32
  getComponent({
33
- 'data-prop': 'test'
33
+ 'data-testid': 'test'
34
34
  });
35
- var container = queryByAttribute('data-prop', document, 'test');
35
+ var container = screen.queryByTestId('test');
36
36
  var modal = screen.getByRole('dialog');
37
37
  expect(container).toContainElement(modal);
38
- expect(modal).not.toHaveAttribute('data-prop', 'test');
38
+ expect(modal).not.toHaveAttribute('data-testid', 'test');
39
39
  });
40
40
  test('should spread container props to the container element even if documented', function () {
41
41
  getComponent({
42
42
  containerProps: {
43
- id: 'test'
43
+ 'data-testid': 'test'
44
44
  }
45
45
  });
46
- var container = queryByAttribute('id', document, 'test');
46
+ var container = screen.queryByTestId('test');
47
47
  var modal = screen.getByRole('dialog');
48
48
  expect(container).toContainElement(modal);
49
- expect(modal).not.toHaveAttribute('id', 'test');
49
+ expect(modal).not.toHaveAttribute('data-testid', 'test');
50
50
  });
51
51
  test('should spread content props to the modal dialog even if undocumented', function () {
52
52
  getComponent({
53
53
  contentProps: {
54
- 'data-prop': 'test'
54
+ 'data-testid': 'test'
55
55
  }
56
56
  });
57
57
  var modal = screen.getByRole('dialog');
58
- expect(modal).toHaveAttribute('data-prop', 'test');
58
+ expect(modal).toHaveAttribute('data-testid', 'test');
59
59
  });
60
60
  test('should display title for modal', function () {
61
61
  var title = 'my title';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -11,6 +11,7 @@ export * from './helpHint';
11
11
  export * from './icon';
12
12
  export * from './iconBadge';
13
13
  export * from './iconButton';
14
+ export * from './iconButtonToggle';
14
15
  export * from './input';
15
16
  export * from './item';
16
17
  export * from './label';
@@ -20,6 +21,7 @@ export * from './listItem';
20
21
  export * from './loader';
21
22
  export * from './menu';
22
23
  export * from './menuItem';
24
+ export * from './Modal';
23
25
  export * from './overlayPanel';
24
26
  export * from './popoverContainer';
25
27
  export * from './popoverMenu';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "2.53.0-alpha.0",
3
+ "version": "2.53.0-alpha.2",
4
4
  "description": "React component library for Ping Identity's design system",
5
5
  "repository": {
6
6
  "type": "git",