@openedx/paragon 23.0.0-alpha.4 → 23.0.0-alpha.6

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 (68) hide show
  1. package/dist/Card/BaseCard.d.ts +18 -0
  2. package/dist/Card/BaseCard.js +53 -0
  3. package/dist/Card/BaseCard.js.map +1 -0
  4. package/dist/Card/index.js +1 -1
  5. package/dist/Card/index.js.map +1 -1
  6. package/dist/Card/index.scss +2 -0
  7. package/dist/Container/index.d.ts +16 -0
  8. package/dist/Container/index.js +15 -13
  9. package/dist/Container/index.js.map +1 -1
  10. package/dist/IconButton/index.js +1 -1
  11. package/dist/IconButton/index.js.map +1 -1
  12. package/dist/Menu/SelectMenu.js +9 -4
  13. package/dist/Menu/SelectMenu.js.map +1 -1
  14. package/dist/Modal/ModalContext.d.ts +15 -0
  15. package/dist/Modal/ModalContext.js +7 -14
  16. package/dist/Modal/ModalContext.js.map +1 -1
  17. package/dist/Modal/ModalDialog.d.ts +110 -0
  18. package/dist/Modal/ModalDialog.js +23 -21
  19. package/dist/Modal/ModalDialog.js.map +1 -1
  20. package/dist/Modal/ModalDialogHeader.d.ts +10 -0
  21. package/dist/Modal/ModalDialogHeader.js +6 -7
  22. package/dist/Modal/ModalDialogHeader.js.map +1 -1
  23. package/dist/Modal/ModalLayer.d.ts +53 -0
  24. package/dist/Modal/ModalLayer.js +5 -14
  25. package/dist/Modal/ModalLayer.js.map +1 -1
  26. package/dist/Modal/Portal.d.ts +11 -0
  27. package/dist/Modal/Portal.js +5 -6
  28. package/dist/Modal/Portal.js.map +1 -1
  29. package/dist/core.css +2 -0
  30. package/dist/core.css.map +1 -1
  31. package/dist/core.min.css +1 -1
  32. package/dist/hooks/useArrowKeyNavigation.js +2 -3
  33. package/dist/hooks/useArrowKeyNavigation.js.map +1 -1
  34. package/dist/index.d.ts +19 -5
  35. package/dist/index.js +5 -5
  36. package/icons/es5/Newsstand.js +15 -0
  37. package/icons/es5/index.js +1 -0
  38. package/icons/es5/index.ts +1 -0
  39. package/icons/jsx/Newsstand.jsx +17 -0
  40. package/icons/jsx/index.jsx +1 -0
  41. package/icons/svg/newsstand.svg +1 -0
  42. package/package.json +2 -2
  43. package/src/Card/BaseCard.tsx +92 -0
  44. package/src/Card/README.md +0 -2
  45. package/src/Card/index.jsx +1 -1
  46. package/src/Card/index.scss +2 -0
  47. package/src/Card/tests/BaseCard.test.jsx +82 -0
  48. package/src/Container/{Container.test.jsx → Container.test.tsx} +14 -8
  49. package/src/Container/README.md +4 -0
  50. package/src/Container/index.tsx +64 -0
  51. package/src/DataTable/selection/tests/ControlledSelectHeader.test.jsx +7 -7
  52. package/src/IconButton/index.tsx +1 -1
  53. package/src/Menu/SelectMenu.jsx +5 -0
  54. package/src/Menu/SelectMenu.test.jsx +6 -0
  55. package/src/Menu/select-menu.md +8 -0
  56. package/src/Modal/{ModalContext.jsx → ModalContext.tsx} +19 -16
  57. package/src/Modal/{ModalDialog.jsx → ModalDialog.tsx} +50 -23
  58. package/src/Modal/{ModalDialogHeader.jsx → ModalDialogHeader.tsx} +17 -11
  59. package/src/Modal/{ModalLayer.jsx → ModalLayer.tsx} +17 -17
  60. package/src/Modal/{Portal.jsx → Portal.tsx} +10 -7
  61. package/src/Modal/tests/{ModalDialog.test.jsx → ModalDialog.test.tsx} +16 -10
  62. package/src/Modal/tests/{ModalLayer.test.jsx → ModalLayer.test.tsx} +5 -5
  63. package/src/Modal/tests/{Portal.test.jsx → Portal.test.tsx} +3 -3
  64. package/src/hooks/useArrowKeyNavigation.jsx +1 -2
  65. package/src/index.d.ts +19 -5
  66. package/src/index.js +5 -5
  67. package/src/Container/index.jsx +0 -49
  68. /package/src/Truncate/{Truncate.test.js → utils.test.js} +0 -0
@@ -7,11 +7,16 @@ import PropTypes from 'prop-types';
7
7
  import classNames from 'classnames';
8
8
  import { useMediaQuery } from 'react-responsive';
9
9
  import ModalLayer from './ModalLayer';
10
+ // @ts-ignore for now - this needs to be converted to TypeScript
10
11
  import ModalCloseButton from './ModalCloseButton';
11
12
  import ModalDialogHeader from './ModalDialogHeader';
13
+ // @ts-ignore for now - this needs to be converted to TypeScript
12
14
  import ModalDialogTitle from './ModalDialogTitle';
15
+ // @ts-ignore for now - this needs to be converted to TypeScript
13
16
  import ModalDialogFooter from './ModalDialogFooter';
17
+ // @ts-ignore for now - this needs to be converted to TypeScript
14
18
  import ModalDialogBody from './ModalDialogBody';
19
+ // @ts-ignore for now - this needs to be converted to TypeScript
15
20
  import ModalDialogHero from './ModalDialogHero';
16
21
  import Icon from '../Icon';
17
22
  import IconButton from '../IconButton';
@@ -21,18 +26,27 @@ function ModalDialog(_ref) {
21
26
  var _classNames;
22
27
  var children = _ref.children,
23
28
  title = _ref.title,
24
- isOpen = _ref.isOpen,
29
+ _ref$isOpen = _ref.isOpen,
30
+ isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
25
31
  onClose = _ref.onClose,
26
- size = _ref.size,
27
- variant = _ref.variant,
28
- hasCloseButton = _ref.hasCloseButton,
29
- closeLabel = _ref.closeLabel,
30
- isFullscreenScroll = _ref.isFullscreenScroll,
32
+ _ref$size = _ref.size,
33
+ size = _ref$size === void 0 ? 'md' : _ref$size,
34
+ _ref$variant = _ref.variant,
35
+ variant = _ref$variant === void 0 ? 'default' : _ref$variant,
36
+ _ref$hasCloseButton = _ref.hasCloseButton,
37
+ hasCloseButton = _ref$hasCloseButton === void 0 ? true : _ref$hasCloseButton,
38
+ _ref$closeLabel = _ref.closeLabel,
39
+ closeLabel = _ref$closeLabel === void 0 ? MODAL_DIALOG_CLOSE_LABEL : _ref$closeLabel,
40
+ _ref$isFullscreenScro = _ref.isFullscreenScroll,
41
+ isFullscreenScroll = _ref$isFullscreenScro === void 0 ? false : _ref$isFullscreenScro,
31
42
  className = _ref.className,
32
- isFullscreenOnMobile = _ref.isFullscreenOnMobile,
33
- isBlocking = _ref.isBlocking,
43
+ _ref$isFullscreenOnMo = _ref.isFullscreenOnMobile,
44
+ isFullscreenOnMobile = _ref$isFullscreenOnMo === void 0 ? false : _ref$isFullscreenOnMo,
45
+ _ref$isBlocking = _ref.isBlocking,
46
+ isBlocking = _ref$isBlocking === void 0 ? false : _ref$isBlocking,
34
47
  zIndex = _ref.zIndex,
35
- isOverflowVisible = _ref.isOverflowVisible;
48
+ _ref$isOverflowVisibl = _ref.isOverflowVisible,
49
+ isOverflowVisible = _ref$isOverflowVisibl === void 0 ? true : _ref$isOverflowVisibl;
36
50
  var isMobile = useMediaQuery({
37
51
  query: '(max-width: 767.98px)'
38
52
  });
@@ -119,18 +133,6 @@ ModalDialog.propTypes = {
119
133
  */
120
134
  isOverflowVisible: PropTypes.bool.isRequired
121
135
  };
122
- ModalDialog.defaultProps = {
123
- isOpen: false,
124
- hasCloseButton: true,
125
- size: 'md',
126
- variant: 'default',
127
- closeLabel: MODAL_DIALOG_CLOSE_LABEL,
128
- className: undefined,
129
- isFullscreenScroll: false,
130
- isFullscreenOnMobile: false,
131
- isBlocking: false,
132
- zIndex: undefined
133
- };
134
136
  ModalDialog.Header = ModalDialogHeader;
135
137
  ModalDialog.Title = ModalDialogTitle;
136
138
  ModalDialog.Footer = ModalDialogFooter;
@@ -1 +1 @@
1
- {"version":3,"file":"ModalDialog.js","names":["React","PropTypes","classNames","useMediaQuery","ModalLayer","ModalCloseButton","ModalDialogHeader","ModalDialogTitle","ModalDialogFooter","ModalDialogBody","ModalDialogHero","Icon","IconButton","Close","MODAL_DIALOG_CLOSE_LABEL","ModalDialog","_ref","_classNames","children","title","isOpen","onClose","size","variant","hasCloseButton","closeLabel","isFullscreenScroll","className","isFullscreenOnMobile","isBlocking","zIndex","isOverflowVisible","isMobile","query","showFullScreen","createElement","role","_defineProperty","concat","as","iconAs","invertColors","src","alt","propTypes","node","isRequired","string","func","bool","oneOf","number","defaultProps","undefined","Header","Title","Footer","CloseButton","Body","Hero"],"sources":["../../src/Modal/ModalDialog.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { useMediaQuery } from 'react-responsive';\nimport ModalLayer from './ModalLayer';\nimport ModalCloseButton from './ModalCloseButton';\nimport ModalDialogHeader from './ModalDialogHeader';\nimport ModalDialogTitle from './ModalDialogTitle';\nimport ModalDialogFooter from './ModalDialogFooter';\nimport ModalDialogBody from './ModalDialogBody';\nimport ModalDialogHero from './ModalDialogHero';\n\nimport Icon from '../Icon';\nimport IconButton from '../IconButton';\nimport { Close } from '../../icons';\n\nexport const MODAL_DIALOG_CLOSE_LABEL = 'Close';\n\nfunction ModalDialog({\n children,\n title,\n isOpen,\n onClose,\n size,\n variant,\n hasCloseButton,\n closeLabel,\n isFullscreenScroll,\n className,\n isFullscreenOnMobile,\n isBlocking,\n zIndex,\n isOverflowVisible,\n}) {\n const isMobile = useMediaQuery({ query: '(max-width: 767.98px)' });\n const showFullScreen = (isFullscreenOnMobile && isMobile);\n return (\n <ModalLayer isOpen={isOpen} onClose={onClose} isBlocking={isBlocking} zIndex={zIndex}>\n <div\n role=\"dialog\"\n aria-label={title}\n className={classNames(\n 'pgn__modal',\n {\n [`pgn__modal-${showFullScreen ? 'fullscreen' : size}`]: size,\n [`pgn__modal-${variant}`]: variant,\n 'pgn__modal-scroll-fullscreen': isFullscreenScroll,\n 'pgn__modal-visible-overflow': isOverflowVisible,\n },\n className,\n )}\n >\n {hasCloseButton && (\n <div className=\"pgn__modal-close-container\">\n <ModalCloseButton\n as={IconButton}\n iconAs={Icon}\n invertColors={variant === 'dark'}\n src={Close}\n alt={closeLabel}\n />\n </div>\n )}\n {children}\n </div>\n </ModalLayer>\n );\n}\n\nModalDialog.propTypes = {\n /**\n * Specifies the content of the dialog\n */\n children: PropTypes.node.isRequired,\n /**\n * The aria-label of the dialog\n */\n title: PropTypes.string.isRequired,\n /**\n * A callback to close the modal dialog\n */\n onClose: PropTypes.func.isRequired,\n /**\n * Is the modal dialog open or closed\n */\n isOpen: PropTypes.bool,\n /**\n * The close 'x' icon button in the top right of the dialog box\n */\n hasCloseButton: PropTypes.bool,\n /**\n * Sizes determine the maximum width of the dialog box\n */\n size: PropTypes.oneOf(['sm', 'md', 'lg', 'xl', 'fullscreen']),\n /**\n * The visual style of the dialog box\n */\n variant: PropTypes.oneOf(['default', 'warning', 'danger', 'success', 'dark']),\n /**\n * The label supplied to the close icon button if one is rendered\n */\n closeLabel: PropTypes.string,\n /**\n * Specifies class name to append to the base element\n */\n className: PropTypes.string,\n /**\n * Determines where a scrollbar should appear if a modal is too large for the\n * viewport. When false, the ``ModalDialog``. Body receives a scrollbar, when true\n * the browser window itself receives the scrollbar.\n */\n isFullscreenScroll: PropTypes.bool,\n /**\n * To show full screen view on mobile screens\n */\n isFullscreenOnMobile: PropTypes.bool,\n /**\n * Prevent clicking on the backdrop or pressing Esc to close the modal\n */\n isBlocking: PropTypes.bool,\n /**\n * Specifies the z-index of the modal\n */\n zIndex: PropTypes.number,\n /**\n * Specifies whether overflow content inside the modal should be visible.\n * - `true` - content that exceeds the modal boundaries will remain visible outside the modal's main viewport,\n * rather than being clipped or hidden.\n * - `false` - any overflow content will be clipped to fit within the modal's dimensions.\n */\n isOverflowVisible: PropTypes.bool.isRequired,\n};\n\nModalDialog.defaultProps = {\n isOpen: false,\n hasCloseButton: true,\n size: 'md',\n variant: 'default',\n closeLabel: MODAL_DIALOG_CLOSE_LABEL,\n className: undefined,\n isFullscreenScroll: false,\n isFullscreenOnMobile: false,\n isBlocking: false,\n zIndex: undefined,\n};\n\nModalDialog.Header = ModalDialogHeader;\nModalDialog.Title = ModalDialogTitle;\nModalDialog.Footer = ModalDialogFooter;\nModalDialog.CloseButton = ModalCloseButton;\nModalDialog.Body = ModalDialogBody;\nModalDialog.Hero = ModalDialogHero;\n\nexport default ModalDialog;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,aAAa,QAAQ,kBAAkB;AAChD,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ignoreList":[]}
1
+ {"version":3,"file":"ModalDialog.js","names":["React","PropTypes","classNames","useMediaQuery","ModalLayer","ModalCloseButton","ModalDialogHeader","ModalDialogTitle","ModalDialogFooter","ModalDialogBody","ModalDialogHero","Icon","IconButton","Close","MODAL_DIALOG_CLOSE_LABEL","ModalDialog","_ref","_classNames","children","title","_ref$isOpen","isOpen","onClose","_ref$size","size","_ref$variant","variant","_ref$hasCloseButton","hasCloseButton","_ref$closeLabel","closeLabel","_ref$isFullscreenScro","isFullscreenScroll","className","_ref$isFullscreenOnMo","isFullscreenOnMobile","_ref$isBlocking","isBlocking","zIndex","_ref$isOverflowVisibl","isOverflowVisible","isMobile","query","showFullScreen","createElement","role","_defineProperty","concat","as","iconAs","invertColors","src","alt","propTypes","node","isRequired","string","func","bool","oneOf","number","Header","Title","Footer","CloseButton","Body","Hero"],"sources":["../../src/Modal/ModalDialog.tsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { useMediaQuery } from 'react-responsive';\nimport ModalLayer from './ModalLayer';\n// @ts-ignore for now - this needs to be converted to TypeScript\nimport ModalCloseButton from './ModalCloseButton';\nimport ModalDialogHeader from './ModalDialogHeader';\n// @ts-ignore for now - this needs to be converted to TypeScript\nimport ModalDialogTitle from './ModalDialogTitle';\n// @ts-ignore for now - this needs to be converted to TypeScript\nimport ModalDialogFooter from './ModalDialogFooter';\n// @ts-ignore for now - this needs to be converted to TypeScript\nimport ModalDialogBody from './ModalDialogBody';\n// @ts-ignore for now - this needs to be converted to TypeScript\nimport ModalDialogHero from './ModalDialogHero';\n\nimport Icon from '../Icon';\nimport IconButton from '../IconButton';\nimport { Close } from '../../icons';\n\nexport const MODAL_DIALOG_CLOSE_LABEL = 'Close';\n\ninterface Props {\n /** Specifies the content of the dialog */\n children: React.ReactNode;\n /** The aria-label of the dialog */\n title: string;\n /** A callback to close the modal dialog, e.g. when Escape is pressed */\n onClose: () => void;\n /** Is the modal dialog open or closed? */\n isOpen?: boolean;\n /** The close 'x' icon button in the top right of the dialog box */\n hasCloseButton?: boolean;\n /** Size determines the maximum width of the dialog box */\n size?: 'sm' | 'md' | 'lg' | 'xl' | 'fullscreen';\n /** The visual style of the dialog box */\n variant?: 'default' | 'warning' | 'danger' | 'success' | 'dark';\n /** The label supplied to the close icon button if one is rendered */\n closeLabel?: string;\n /** Specifies class name to append to the base element */\n className?: string;\n /**\n * Determines where a scrollbar should appear if a modal is too large for the\n * viewport. When false, the ``ModalDialog``. Body receives a scrollbar, when true\n * the browser window itself receives the scrollbar.\n */\n isFullscreenScroll?: boolean;\n /** To show full screen view on mobile screens */\n isFullscreenOnMobile?: boolean;\n /** Prevent clicking on the backdrop or pressing Esc to close the modal */\n isBlocking?: boolean;\n /** Specifies the z-index of the modal */\n zIndex?: number;\n /** Specifies whether overflow is visible in the modal */\n isOverflowVisible?: boolean;\n}\n\nfunction ModalDialog({\n children,\n title,\n isOpen = false,\n onClose,\n size = 'md',\n variant = 'default',\n hasCloseButton = true,\n closeLabel = MODAL_DIALOG_CLOSE_LABEL,\n isFullscreenScroll = false,\n className,\n isFullscreenOnMobile = false,\n isBlocking = false,\n zIndex,\n isOverflowVisible = true,\n}: Props) {\n const isMobile = useMediaQuery({ query: '(max-width: 767.98px)' });\n const showFullScreen = (isFullscreenOnMobile && isMobile);\n return (\n <ModalLayer isOpen={isOpen} onClose={onClose} isBlocking={isBlocking} zIndex={zIndex}>\n <div\n role=\"dialog\"\n aria-label={title}\n className={classNames(\n 'pgn__modal',\n {\n [`pgn__modal-${showFullScreen ? 'fullscreen' : size}`]: size,\n [`pgn__modal-${variant}`]: variant,\n 'pgn__modal-scroll-fullscreen': isFullscreenScroll,\n 'pgn__modal-visible-overflow': isOverflowVisible,\n },\n className,\n )}\n >\n {hasCloseButton && (\n <div className=\"pgn__modal-close-container\">\n <ModalCloseButton\n as={IconButton}\n iconAs={Icon}\n invertColors={variant === 'dark'}\n src={Close}\n alt={closeLabel}\n />\n </div>\n )}\n {children}\n </div>\n </ModalLayer>\n );\n}\n\nModalDialog.propTypes = {\n /**\n * Specifies the content of the dialog\n */\n children: PropTypes.node.isRequired,\n /**\n * The aria-label of the dialog\n */\n title: PropTypes.string.isRequired,\n /**\n * A callback to close the modal dialog\n */\n onClose: PropTypes.func.isRequired,\n /**\n * Is the modal dialog open or closed\n */\n isOpen: PropTypes.bool,\n /**\n * The close 'x' icon button in the top right of the dialog box\n */\n hasCloseButton: PropTypes.bool,\n /**\n * Sizes determine the maximum width of the dialog box\n */\n size: PropTypes.oneOf(['sm', 'md', 'lg', 'xl', 'fullscreen']),\n /**\n * The visual style of the dialog box\n */\n variant: PropTypes.oneOf(['default', 'warning', 'danger', 'success', 'dark']),\n /**\n * The label supplied to the close icon button if one is rendered\n */\n closeLabel: PropTypes.string,\n /**\n * Specifies class name to append to the base element\n */\n className: PropTypes.string,\n /**\n * Determines where a scrollbar should appear if a modal is too large for the\n * viewport. When false, the ``ModalDialog``. Body receives a scrollbar, when true\n * the browser window itself receives the scrollbar.\n */\n isFullscreenScroll: PropTypes.bool,\n /**\n * To show full screen view on mobile screens\n */\n isFullscreenOnMobile: PropTypes.bool,\n /**\n * Prevent clicking on the backdrop or pressing Esc to close the modal\n */\n isBlocking: PropTypes.bool,\n /**\n * Specifies the z-index of the modal\n */\n zIndex: PropTypes.number,\n /**\n * Specifies whether overflow content inside the modal should be visible.\n * - `true` - content that exceeds the modal boundaries will remain visible outside the modal's main viewport,\n * rather than being clipped or hidden.\n * - `false` - any overflow content will be clipped to fit within the modal's dimensions.\n */\n isOverflowVisible: PropTypes.bool.isRequired,\n};\n\nModalDialog.Header = ModalDialogHeader;\nModalDialog.Title = ModalDialogTitle;\nModalDialog.Footer = ModalDialogFooter;\nModalDialog.CloseButton = ModalCloseButton;\nModalDialog.Body = ModalDialogBody;\nModalDialog.Hero = ModalDialogHero;\n\nexport default ModalDialog;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SA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yD,IAAI,CAACH;AACpC,CAAC;AAEDxC,WAAW,CAAC8C,MAAM,GAAGvD,iBAAiB;AACtCS,WAAW,CAAC+C,KAAK,GAAGvD,gBAAgB;AACpCQ,WAAW,CAACgD,MAAM,GAAGvD,iBAAiB;AACtCO,WAAW,CAACiD,WAAW,GAAG3D,gBAAgB;AAC1CU,WAAW,CAACkD,IAAI,GAAGxD,eAAe;AAClCM,WAAW,CAACmD,IAAI,GAAGxD,eAAe;AAElC,eAAeK,WAAW","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import type { ComponentWithAsProp } from '../utils/types/bootstrap';
3
+ export interface Props {
4
+ as?: string;
5
+ children: React.ReactNode;
6
+ className?: string;
7
+ }
8
+ type HeaderType = ComponentWithAsProp<'div', Props>;
9
+ declare const ModalDialogHeader: HeaderType;
10
+ export default ModalDialogHeader;
@@ -7,17 +7,20 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
7
7
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
8
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
9
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
+ /* eslint-disable react/require-default-props */
10
11
  import React from 'react';
11
12
  import PropTypes from 'prop-types';
12
13
  import classNames from 'classnames';
13
- function ModalDialogHeader(_ref) {
14
- var as = _ref.as,
14
+ var ModalDialogHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
15
+ var _ref$as = _ref.as,
16
+ as = _ref$as === void 0 ? 'div' : _ref$as,
15
17
  children = _ref.children,
16
18
  props = _objectWithoutProperties(_ref, _excluded);
17
19
  return /*#__PURE__*/React.createElement(as, _objectSpread(_objectSpread({}, props), {}, {
20
+ ref: ref,
18
21
  className: classNames('pgn__modal-header', props.className)
19
22
  }), children);
20
- }
23
+ });
21
24
  ModalDialogHeader.propTypes = {
22
25
  /** Specifies the base element */
23
26
  as: PropTypes.elementType,
@@ -26,9 +29,5 @@ ModalDialogHeader.propTypes = {
26
29
  /** Specifies class name to append to the base element */
27
30
  className: PropTypes.string
28
31
  };
29
- ModalDialogHeader.defaultProps = {
30
- as: 'div',
31
- className: undefined
32
- };
33
32
  export default ModalDialogHeader;
34
33
  //# sourceMappingURL=ModalDialogHeader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ModalDialogHeader.js","names":["React","PropTypes","classNames","ModalDialogHeader","_ref","as","children","props","_objectWithoutProperties","_excluded","createElement","_objectSpread","className","propTypes","elementType","node","isRequired","string","defaultProps","undefined"],"sources":["../../src/Modal/ModalDialogHeader.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\nfunction ModalDialogHeader({\n as,\n children,\n ...props\n}) {\n return React.createElement(\n as,\n {\n ...props,\n className: classNames('pgn__modal-header', props.className),\n },\n children,\n );\n}\n\nModalDialogHeader.propTypes = {\n /** Specifies the base element */\n as: PropTypes.elementType,\n /** Specifies the contents of the header */\n children: PropTypes.node.isRequired,\n /** Specifies class name to append to the base element */\n className: PropTypes.string,\n};\n\nModalDialogHeader.defaultProps = {\n as: 'div',\n className: undefined,\n};\n\nexport default ModalDialogHeader;\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,iBAAiBA,CAAAC,IAAA,EAIvB;EAAA,IAHDC,EAAE,GAAAD,IAAA,CAAFC,EAAE;IACFC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACLC,KAAK,GAAAC,wBAAA,CAAAJ,IAAA,EAAAK,SAAA;EAER,oBAAOT,KAAK,CAACU,aAAa,CACxBL,EAAE,EAAAM,aAAA,CAAAA,aAAA,KAEGJ,KAAK;IACRK,SAAS,EAAEV,UAAU,CAAC,mBAAmB,EAAEK,KAAK,CAACK,SAAS;EAAC,IAE7DN,QACF,CAAC;AACH;AAEAH,iBAAiB,CAACU,SAAS,GAAG;EAC5B;EACAR,EAAE,EAAEJ,SAAS,CAACa,WAAW;EACzB;EACAR,QAAQ,EAAEL,SAAS,CAACc,IAAI,CAACC,UAAU;EACnC;EACAJ,SAAS,EAAEX,SAAS,CAACgB;AACvB,CAAC;AAEDd,iBAAiB,CAACe,YAAY,GAAG;EAC/Bb,EAAE,EAAE,KAAK;EACTO,SAAS,EAAEO;AACb,CAAC;AAED,eAAehB,iBAAiB","ignoreList":[]}
1
+ {"version":3,"file":"ModalDialogHeader.js","names":["React","PropTypes","classNames","ModalDialogHeader","forwardRef","_ref","ref","_ref$as","as","children","props","_objectWithoutProperties","_excluded","createElement","_objectSpread","className","propTypes","elementType","node","isRequired","string"],"sources":["../../src/Modal/ModalDialogHeader.tsx"],"sourcesContent":["/* eslint-disable react/require-default-props */\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport type { ComponentWithAsProp } from '../utils/types/bootstrap';\n\nexport interface Props {\n as?: string;\n children: React.ReactNode;\n className?: string;\n}\n\ntype HeaderType = ComponentWithAsProp<'div', Props>;\n\nconst ModalDialogHeader: HeaderType = React.forwardRef<HTMLDivElement, Props>(({\n as = 'div',\n children,\n ...props\n}, ref) => (\n React.createElement(\n as,\n {\n ...props,\n ref,\n className: classNames('pgn__modal-header', props.className),\n },\n children,\n )\n));\n\nModalDialogHeader.propTypes = {\n /** Specifies the base element */\n as: PropTypes.elementType,\n /** Specifies the contents of the header */\n children: PropTypes.node.isRequired,\n /** Specifies class name to append to the base element */\n className: PropTypes.string,\n};\n\nexport default ModalDialogHeader;\n"],"mappings":";;;;;;;;;AAAA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AAWnC,IAAMC,iBAA6B,gBAAGH,KAAK,CAACI,UAAU,CAAwB,UAAAC,IAAA,EAI3EC,GAAG;EAAA,IAAAC,OAAA,GAAAF,IAAA,CAHJG,EAAE;IAAFA,EAAE,GAAAD,OAAA,cAAG,KAAK,GAAAA,OAAA;IACVE,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;IACLC,KAAK,GAAAC,wBAAA,CAAAN,IAAA,EAAAO,SAAA;EAAA,oBAERZ,KAAK,CAACa,aAAa,CACjBL,EAAE,EAAAM,aAAA,CAAAA,aAAA,KAEGJ,KAAK;IACRJ,GAAG,EAAHA,GAAG;IACHS,SAAS,EAAEb,UAAU,CAAC,mBAAmB,EAAEQ,KAAK,CAACK,SAAS;EAAC,IAE7DN,QACF,CAAC;AAAA,CACF,CAAC;AAEFN,iBAAiB,CAACa,SAAS,GAAG;EAC5B;EACAR,EAAE,EAAEP,SAAS,CAACgB,WAAW;EACzB;EACAR,QAAQ,EAAER,SAAS,CAACiB,IAAI,CAACC,UAAU;EACnC;EACAJ,SAAS,EAAEd,SAAS,CAACmB;AACvB,CAAC;AAED,eAAejB,iBAAiB","ignoreList":[]}
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ declare function ModalBackdrop({ onClick }: {
4
+ onClick?: () => void;
5
+ }): import("react/jsx-runtime").JSX.Element;
6
+ declare namespace ModalBackdrop {
7
+ var propTypes: {
8
+ onClick: PropTypes.Requireable<(...args: any[]) => any>;
9
+ };
10
+ }
11
+ declare function ModalContentContainer({ children }: {
12
+ children?: React.ReactNode;
13
+ }): import("react/jsx-runtime").JSX.Element;
14
+ declare namespace ModalContentContainer {
15
+ var propTypes: {
16
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
17
+ };
18
+ }
19
+ interface Props {
20
+ /** Specifies the contents of the modal */
21
+ children: React.ReactNode;
22
+ /** A callback function for when the modal is dismissed */
23
+ onClose: () => void;
24
+ /** Is the modal dialog open or closed */
25
+ isOpen: boolean;
26
+ /** Prevent clicking on the backdrop or pressing Esc to close the modal */
27
+ isBlocking?: boolean;
28
+ /** Specifies the z-index of the modal */
29
+ zIndex?: number;
30
+ }
31
+ /**
32
+ * The ModalLayer should be used for any component that wishes to engage the user
33
+ * in a "mode" where a layer on top of the application is interactive while the
34
+ * rest of the application is made non-interactive. The assumption made by this
35
+ * component is that if a modal object is visible then it is "enabled"
36
+ */
37
+ declare function ModalLayer({ children, onClose, isOpen, isBlocking, zIndex, }: Props): import("react/jsx-runtime").JSX.Element | null;
38
+ declare namespace ModalLayer {
39
+ var propTypes: {
40
+ /** Specifies the contents of the modal */
41
+ children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
42
+ /** A callback function for when the modal is dismissed */
43
+ onClose: PropTypes.Validator<(...args: any[]) => any>;
44
+ /** Is the modal dialog open or closed */
45
+ isOpen: PropTypes.Validator<boolean>;
46
+ /** Prevent clicking on the backdrop or pressing Esc to close the modal */
47
+ isBlocking: PropTypes.Requireable<boolean>;
48
+ /** Specifies the z-index of the modal */
49
+ zIndex: PropTypes.Requireable<number>;
50
+ };
51
+ }
52
+ export { ModalBackdrop, ModalContentContainer };
53
+ export default ModalLayer;
@@ -22,13 +22,11 @@ function ModalBackdrop(_ref) {
22
22
  ModalBackdrop.propTypes = {
23
23
  onClick: PropTypes.func
24
24
  };
25
- ModalBackdrop.defaultProps = {
26
- onClick: undefined
27
- };
28
25
 
29
26
  // istanbul ignore next
30
27
  function ModalContentContainer(_ref2) {
31
- var children = _ref2.children;
28
+ var _ref2$children = _ref2.children,
29
+ children = _ref2$children === void 0 ? null : _ref2$children;
32
30
  return /*#__PURE__*/React.createElement("div", {
33
31
  className: "pgn__modal-content-container"
34
32
  }, children);
@@ -36,10 +34,6 @@ function ModalContentContainer(_ref2) {
36
34
  ModalContentContainer.propTypes = {
37
35
  children: PropTypes.node
38
36
  };
39
- ModalContentContainer.defaultProps = {
40
- children: null
41
- };
42
-
43
37
  /**
44
38
  * The ModalLayer should be used for any component that wishes to engage the user
45
39
  * in a "mode" where a layer on top of the application is interactive while the
@@ -50,7 +44,8 @@ function ModalLayer(_ref3) {
50
44
  var children = _ref3.children,
51
45
  onClose = _ref3.onClose,
52
46
  isOpen = _ref3.isOpen,
53
- isBlocking = _ref3.isBlocking,
47
+ _ref3$isBlocking = _ref3.isBlocking,
48
+ isBlocking = _ref3$isBlocking === void 0 ? false : _ref3$isBlocking,
54
49
  zIndex = _ref3.zIndex;
55
50
  useEffect(function () {
56
51
  if (isOpen) {
@@ -65,7 +60,7 @@ function ModalLayer(_ref3) {
65
60
  if (!isOpen) {
66
61
  return null;
67
62
  }
68
- var handleClose = isBlocking ? null : onClose;
63
+ var handleClose = isBlocking ? undefined : onClose;
69
64
  return /*#__PURE__*/React.createElement(ModalContextProvider, {
70
65
  onClose: onClose,
71
66
  isOpen: isOpen,
@@ -93,10 +88,6 @@ ModalLayer.propTypes = {
93
88
  /** Specifies the z-index of the modal */
94
89
  zIndex: PropTypes.number
95
90
  };
96
- ModalLayer.defaultProps = {
97
- isBlocking: false,
98
- zIndex: undefined
99
- };
100
91
  export { ModalBackdrop, ModalContentContainer };
101
92
  export default ModalLayer;
102
93
  //# sourceMappingURL=ModalLayer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ModalLayer.js","names":["React","useEffect","classNames","PropTypes","FocusOn","Portal","ModalContextProvider","ModalBackdrop","_ref","onClick","createElement","className","onKeyDown","propTypes","func","defaultProps","undefined","ModalContentContainer","_ref2","children","node","ModalLayer","_ref3","onClose","isOpen","isBlocking","zIndex","document","body","classList","add","remove","handleClose","allowPinchZoom","scrollLock","enabled","onEscapeKey","onClickOutside","concat","isRequired","bool","number"],"sources":["../../src/Modal/ModalLayer.jsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\nimport { FocusOn } from 'react-focus-on';\nimport Portal from './Portal';\nimport { ModalContextProvider } from './ModalContext';\n\n// istanbul ignore next\nfunction ModalBackdrop({ onClick }) {\n return (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div\n className=\"pgn__modal-backdrop\"\n onClick={onClick}\n onKeyDown={onClick}\n data-testid=\"modal-backdrop\"\n />\n );\n}\n\nModalBackdrop.propTypes = {\n onClick: PropTypes.func,\n};\n\nModalBackdrop.defaultProps = {\n onClick: undefined,\n};\n\n// istanbul ignore next\nfunction ModalContentContainer({ children }) {\n return <div className=\"pgn__modal-content-container\">{children}</div>;\n}\n\nModalContentContainer.propTypes = {\n children: PropTypes.node,\n};\n\nModalContentContainer.defaultProps = {\n children: null,\n};\n\n/**\n * The ModalLayer should be used for any component that wishes to engage the user\n * in a \"mode\" where a layer on top of the application is interactive while the\n * rest of the application is made non-interactive. The assumption made by this\n * component is that if a modal object is visible then it is \"enabled\"\n */\nfunction ModalLayer({\n children, onClose, isOpen, isBlocking, zIndex,\n}) {\n useEffect(() => {\n if (isOpen) {\n document.body.classList.add('pgn__hidden-scroll-padding-right');\n } else {\n document.body.classList.remove('pgn__hidden-scroll-padding-right');\n }\n return () => {\n document.body.classList.remove('pgn__hidden-scroll-padding-right');\n };\n }, [isOpen]);\n\n if (!isOpen) {\n return null;\n }\n\n const handleClose = isBlocking ? null : onClose;\n\n return (\n <ModalContextProvider onClose={onClose} isOpen={isOpen} isBlocking={isBlocking}>\n <Portal>\n <FocusOn\n allowPinchZoom\n scrollLock\n enabled={isOpen}\n onEscapeKey={handleClose}\n onClickOutside={handleClose}\n className={classNames(\n 'pgn__modal-layer',\n zIndex ? `zindex-${zIndex}` : '',\n )}\n >\n <ModalContentContainer>\n <ModalBackdrop onClick={handleClose} />\n {children}\n </ModalContentContainer>\n </FocusOn>\n </Portal>\n </ModalContextProvider>\n );\n}\n\nModalLayer.propTypes = {\n /** Specifies the contents of the modal */\n children: PropTypes.node.isRequired,\n /** A callback function for when the modal is dismissed */\n onClose: PropTypes.func.isRequired,\n /** Is the modal dialog open or closed */\n isOpen: PropTypes.bool.isRequired,\n /** Prevent clicking on the backdrop or pressing Esc to close the modal */\n isBlocking: PropTypes.bool,\n /** Specifies the z-index of the modal */\n zIndex: PropTypes.number,\n};\n\nModalLayer.defaultProps = {\n isBlocking: false,\n zIndex: undefined,\n};\n\nexport { ModalBackdrop, ModalContentContainer };\nexport default ModalLayer;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,OAAO,QAAQ,gBAAgB;AACxC,OAAOC,MAAM,MAAM,UAAU;AAC7B,SAASC,oBAAoB,QAAQ,gBAAgB;;AAErD;AACA,SAASC,aAAaA,CAAAC,IAAA,EAAc;EAAA,IAAXC,OAAO,GAAAD,IAAA,CAAPC,OAAO;EAC9B;IAAA;IACE;IACAT,KAAA,CAAAU,aAAA;MACEC,SAAS,EAAC,qBAAqB;MAC/BF,OAAO,EAAEA,OAAQ;MACjBG,SAAS,EAAEH,OAAQ;MACnB,eAAY;IAAgB,CAC7B;EAAC;AAEN;AAEAF,aAAa,CAACM,SAAS,GAAG;EACxBJ,OAAO,EAAEN,SAAS,CAACW;AACrB,CAAC;AAEDP,aAAa,CAACQ,YAAY,GAAG;EAC3BN,OAAO,EAAEO;AACX,CAAC;;AAED;AACA,SAASC,qBAAqBA,CAAAC,KAAA,EAAe;EAAA,IAAZC,QA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IACdC,UAAU;IACVC,OAAO,EAAEX,MAAO;IAChBY,WAAW,EAAEJ,WAAY;IACzBK,cAAc,EAAEL,WAAY;IAC5BrB,SAAS,EAAET,UAAU,CACnB,kBAAkB,EAClBwB,MAAM,aAAAY,MAAA,CAAaZ,MAAM,IAAK,EAChC;EAAE,gBAEF1B,KAAA,CAAAU,aAAA,CAACO,qBAAqB,qBACpBjB,KAAA,CAAAU,aAAA,CAACH,aAAa;IAACE,OAAO,EAAEuB;EAAY,CAAE,CAAC,EACtCb,QACoB,CAChB,CACH,CACY,CAAC;AAE3B;AAEAE,UAAU,CAACR,SAAS,GAAG;EACrB;EACAM,QAAQ,EAAEhB,SAAS,CAACiB,IAAI,CAACmB,UAAU;EACnC;EACAhB,OAAO,EAAEpB,SAAS,CAACW,IAAI,CAACyB,UAAU;EAClC;EACAf,MAAM,EAAErB,SAAS,CAACqC,IAAI,CAACD,UAAU;EACjC;EACAd,UAAU,EAAEtB,SAAS,CAACqC,IAAI;EAC1B;EACAd,MAAM,EAAEvB,SAAS,CAACsC;AACpB,CAAC;AAEDpB,UAAU,CAACN,YAAY,GAAG;EACxBU,UAAU,EAAE,KAAK;EACjBC,MAAM,EAAEV;AACV,CAAC;AAED,SAAST,aAAa,EAAEU,qBAAqB;AAC7C,eAAeI,UAAU","ignoreList":[]}
1
+ {"version":3,"file":"ModalLayer.js","names":["React","useEffect","classNames","PropTypes","FocusOn","Portal","ModalContextProvider","ModalBackdrop","_ref","onClick","createElement","className","onKeyDown","propTypes","func","ModalContentContainer","_ref2","_ref2$children","children","node","ModalLayer","_ref3","onClose","isOpen","_ref3$isBlocking","isBlocking","zIndex","document","body","classList","add","remove","handleClose","undefined","allowPinchZoom","scrollLock","enabled","onEscapeKey","onClickOutside","concat","isRequired","bool","number"],"sources":["../../src/Modal/ModalLayer.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\nimport { FocusOn } from 'react-focus-on';\nimport Portal from './Portal';\nimport { ModalContextProvider } from './ModalContext';\n\n// istanbul ignore next\nfunction ModalBackdrop({ onClick }: { onClick?: () => void }) {\n return (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div\n className=\"pgn__modal-backdrop\"\n onClick={onClick}\n onKeyDown={onClick}\n data-testid=\"modal-backdrop\"\n />\n );\n}\n\nModalBackdrop.propTypes = {\n onClick: PropTypes.func,\n};\n\n// istanbul ignore next\nfunction ModalContentContainer({ children = null }: { children?: React.ReactNode }) {\n return <div className=\"pgn__modal-content-container\">{children}</div>;\n}\n\nModalContentContainer.propTypes = {\n children: PropTypes.node,\n};\n\ninterface Props {\n /** Specifies the contents of the modal */\n children: React.ReactNode;\n /** A callback function for when the modal is dismissed */\n onClose: () => void;\n /** Is the modal dialog open or closed */\n isOpen: boolean;\n /** Prevent clicking on the backdrop or pressing Esc to close the modal */\n isBlocking?: boolean;\n /** Specifies the z-index of the modal */\n zIndex?: number;\n}\n\n/**\n * The ModalLayer should be used for any component that wishes to engage the user\n * in a \"mode\" where a layer on top of the application is interactive while the\n * rest of the application is made non-interactive. The assumption made by this\n * component is that if a modal object is visible then it is \"enabled\"\n */\nfunction ModalLayer({\n children, onClose, isOpen, isBlocking = false, zIndex,\n}: Props) {\n useEffect(() => {\n if (isOpen) {\n document.body.classList.add('pgn__hidden-scroll-padding-right');\n } else {\n document.body.classList.remove('pgn__hidden-scroll-padding-right');\n }\n return () => {\n document.body.classList.remove('pgn__hidden-scroll-padding-right');\n };\n }, [isOpen]);\n\n if (!isOpen) {\n return null;\n }\n\n const handleClose = isBlocking ? undefined : onClose;\n\n return (\n <ModalContextProvider onClose={onClose} isOpen={isOpen} isBlocking={isBlocking}>\n <Portal>\n <FocusOn\n allowPinchZoom\n scrollLock\n enabled={isOpen}\n onEscapeKey={handleClose}\n onClickOutside={handleClose}\n className={classNames(\n 'pgn__modal-layer',\n zIndex ? `zindex-${zIndex}` : '',\n )}\n >\n <ModalContentContainer>\n <ModalBackdrop onClick={handleClose} />\n {children}\n </ModalContentContainer>\n </FocusOn>\n </Portal>\n </ModalContextProvider>\n );\n}\n\nModalLayer.propTypes = {\n /** Specifies the contents of the modal */\n children: PropTypes.node.isRequired,\n /** A callback function for when the modal is dismissed */\n onClose: PropTypes.func.isRequired,\n /** Is the modal dialog open or closed */\n isOpen: PropTypes.bool.isRequired,\n /** Prevent clicking on the backdrop or pressing Esc to close the modal */\n isBlocking: PropTypes.bool,\n /** Specifies the z-index of the modal */\n zIndex: PropTypes.number,\n};\n\nexport { ModalBackdrop, ModalContentContainer };\nexport default ModalLayer;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,OAAO,QAAQ,gBAAgB;AACxC,OAAOC,MAAM,MAAM,UAAU;AAC7B,SAASC,oBAAoB,QAAQ,gBAAgB;;AAErD;AACA,SAASC,aAAaA,CAAAC,IAAA,EAAwC;EAAA,IAArCC,OAAO,GAAAD,IAAA,CAAPC,OAAO;EAC9B;IAAA;IACE;IACAT,KAAA,CAAAU,aAAA;MACEC,SAAS,EAAC,qBAAqB;MAC/BF,OAAO,EAAEA,OAAQ;MACjBG,SAAS,EAAEH,OAAQ;MACnB,eAAY;IAAgB,CAC7B;EAAC;AAEN;AAEAF,aAAa,CAACM,SAAS,GAAG;EACxBJ,OAAO,EAAEN,SAAS,CAACW;AACrB,CAAC;;AAED;AACA,SAASC,qBAAqBA,CAAAC,KAAA,EAAsD;EAAA,IAAAC,cAAA,GAAAD,KAAA,CAAnDE,QAAQ;IAARA,QAAQ,GAAAD,cAAA,cAAG,IAAI,GAAAA,cAAA;EAC9C,oBAAOjB,KAAA,CAAAU,aAAA;IAAKC,SAAS,EAAC;EAA8B,GAAEO,QAAc,CAAC;AACvE;AAEAH,qBAAqB,CAACF,SAAS,GAAG;EAChCK,QAAQ,EAAEf,SAAS,CAACgB;AACtB,CAA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AAA,CAACK,qBAAqB,qBACpBf,KAAA,CAAAU,aAAA,CAACH,aAAa;IAACE,OAAO,EAAEuB;EAAY,CAAE,CAAC,EACtCd,QACoB,CAChB,CACH,CACY,CAAC;AAE3B;AAEAE,UAAU,CAACP,SAAS,GAAG;EACrB;EACAK,QAAQ,EAAEf,SAAS,CAACgB,IAAI,CAACqB,UAAU;EACnC;EACAlB,OAAO,EAAEnB,SAAS,CAACW,IAAI,CAAC0B,UAAU;EAClC;EACAjB,MAAM,EAAEpB,SAAS,CAACsC,IAAI,CAACD,UAAU;EACjC;EACAf,UAAU,EAAEtB,SAAS,CAACsC,IAAI;EAC1B;EACAf,MAAM,EAAEvB,SAAS,CAACuC;AACpB,CAAC;AAED,SAASnC,aAAa,EAAEQ,qBAAqB;AAC7C,eAAeK,UAAU","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ children: React.ReactNode;
4
+ }
5
+ declare class Portal extends React.Component<Props> {
6
+ private rootName;
7
+ private rootElement;
8
+ constructor(props: Props);
9
+ render(): React.ReactPortal | null;
10
+ }
11
+ export default Portal;
@@ -2,8 +2,6 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2
2
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3
3
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
4
4
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
5
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
8
6
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
9
7
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
@@ -11,9 +9,11 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
11
9
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
12
10
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
13
11
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
12
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
14
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
14
15
  import React from 'react';
15
16
  import ReactDOM from 'react-dom';
16
- import PropTypes from 'prop-types';
17
17
  var Portal = /*#__PURE__*/function (_React$Component) {
18
18
  _inherits(Portal, _React$Component);
19
19
  var _super = _createSuper(Portal);
@@ -21,6 +21,8 @@ var Portal = /*#__PURE__*/function (_React$Component) {
21
21
  var _this;
22
22
  _classCallCheck(this, Portal);
23
23
  _this = _super.call(this, props);
24
+ _defineProperty(_assertThisInitialized(_this), "rootName", void 0);
25
+ _defineProperty(_assertThisInitialized(_this), "rootElement", void 0);
24
26
  _this.rootName = 'paragon-portal-root';
25
27
  // istanbul ignore if
26
28
  if (typeof document === 'undefined') {
@@ -47,8 +49,5 @@ var Portal = /*#__PURE__*/function (_React$Component) {
47
49
  }]);
48
50
  return Portal;
49
51
  }(React.Component);
50
- Portal.propTypes = {
51
- children: PropTypes.node.isRequired
52
- };
53
52
  export default Portal;
54
53
  //# sourceMappingURL=Portal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Portal.js","names":["React","ReactDOM","PropTypes","Portal","_React$Component","_inherits","_super","_createSuper","props","_this","_classCallCheck","call","rootName","document","rootElement","getElementById","createElement","setAttribute","body","appendChild","_createClass","key","value","render","createPortal","children","Component","propTypes","node","isRequired"],"sources":["../../src/Modal/Portal.jsx"],"sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\n\nclass Portal extends React.Component {\n constructor(props) {\n super(props);\n this.rootName = 'paragon-portal-root';\n // istanbul ignore if\n if (typeof document === 'undefined') {\n this.rootElement = null;\n } else if (document.getElementById(this.rootName)) {\n this.rootElement = document.getElementById(this.rootName);\n } else {\n const rootElement = document.createElement('div');\n rootElement.setAttribute('id', this.rootName);\n this.rootElement = document.body.appendChild(rootElement);\n }\n }\n\n render() {\n // istanbul ignore else\n if (this.rootElement) {\n return ReactDOM.createPortal(\n this.props.children,\n this.rootElement,\n );\n }\n // istanbul ignore next\n return null;\n }\n}\n\nPortal.propTypes = {\n children: PropTypes.node.isRequired,\n};\n\nexport default Portal;\n"],"mappings":";;;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,QAAQ,MAAM,WAAW;AAChC,OAAOC,SAAS,MAAM,YAAY;AAAC,IAE7BC,MAAM,0BAAAC,gBAAA;EAAAC,SAAA,CAAAF,MAAA,EAAAC,gBAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,MAAA;EACV,SAAAA,OAAYK,KAAK,EAAE;IAAA,IAAAC,KAAA;IAAAC,eAAA,OAAAP,MAAA;IACjBM,KAAA,GAAAH,MAAA,CAAAK,IAAA,OAAMH,KAAK;IACXC,KAAA,CAAKG,QAAQ,GAAG,qBAAqB;IACrC;IACA,IAAI,OAAOC,QAAQ,KAAK,WAAW,EAAE;MACnCJ,KAAA,CAAKK,WAAW,GAAG,IAAI;IACzB,CAAC,MAAM,IAAID,QAAQ,CAACE,cAAc,CAACN,KAAA,CAAKG,QAAQ,CAAC,EAAE;MACjDH,KAAA,CAAKK,WAAW,GAAGD,QAAQ,CAACE,cAAc,CAACN,KAAA,CAAKG,QAAQ,CAAC;IAC3D,CAAC,MAAM;MACL,IAAME,WAAW,GAAGD,QAAQ,CAACG,aAAa,CAAC,KAAK,CAAC;MACjDF,WAAW,CAACG,YAAY,CAAC,IAAI,EAAER,KAAA,CAAKG,QAAQ,CAAC;MAC7CH,KAAA,CAAKK,WAAW,GAAGD,QAAQ,CAACK,IAAI,CAACC,WAAW,CAACL,WAAW,CAAC;IAC3D;IAAC,OAAAL,KAAA;EACH;EAACW,YAAA,CAAAjB,MAAA;IAAAkB,GAAA;IAAAC,KAAA,EAED,SAAAC,OAAA,EAAS;MACP;MACA,IAAI,IAAI,CAACT,WAAW,EAAE;QACpB,oBAAOb,QAAQ,CAACuB,YAAY,CAC1B,IAAI,CAAChB,KAAK,CAACiB,QAAQ,EACnB,IAAI,CAACX,WACP,CAAC;MACH;MACA;MACA,OAAO,IAAI;IACb;EAAC;EAAA,OAAAX,MAAA;AAAA,EA1BkBH,KAAK,CAAC0B,SAAS;AA6BpCvB,MAAM,CAACwB,SAAS,GAAG;EACjBF,QAAQ,EAAEvB,SAAS,CAAC0B,IAAI,CAACC;AAC3B,CAAC;AAED,eAAe1B,MAAM","ignoreList":[]}
1
+ {"version":3,"file":"Portal.js","names":["React","ReactDOM","Portal","_React$Component","_inherits","_super","_createSuper","props","_this","_classCallCheck","call","_defineProperty","_assertThisInitialized","rootName","document","rootElement","getElementById","createElement","setAttribute","body","appendChild","_createClass","key","value","render","createPortal","children","Component"],"sources":["../../src/Modal/Portal.tsx"],"sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\n\ninterface Props {\n children: React.ReactNode;\n}\n\nclass Portal extends React.Component<Props> {\n private rootName: string;\n\n private rootElement: HTMLElement | null;\n\n constructor(props: Props) {\n super(props);\n this.rootName = 'paragon-portal-root';\n // istanbul ignore if\n if (typeof document === 'undefined') {\n this.rootElement = null;\n } else if (document.getElementById(this.rootName)) {\n this.rootElement = document.getElementById(this.rootName);\n } else {\n const rootElement = document.createElement('div');\n rootElement.setAttribute('id', this.rootName);\n this.rootElement = document.body.appendChild(rootElement);\n }\n }\n\n render() {\n // istanbul ignore else\n if (this.rootElement) {\n return ReactDOM.createPortal(\n this.props.children,\n this.rootElement,\n );\n }\n // istanbul ignore next\n return null;\n }\n}\n\nexport default Portal;\n"],"mappings":";;;;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,QAAQ,MAAM,WAAW;AAAC,IAM3BC,MAAM,0BAAAC,gBAAA;EAAAC,SAAA,CAAAF,M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a.pgn__card {
11099
11099
  bottom: calc(-1 * var(--pgn-spacing-card-logo-bottom-offset-base));
11100
11100
  width: var(--pgn-size-card-logo-width);
11101
11101
  height: var(--pgn-size-card-logo-height);
11102
+ object-fit: scale-down;
11103
+ object-position: center center;
11102
11104
  border-radius: var(--pgn-size-card-border-radius-logo);
11103
11105
  box-shadow: var(--pgn-elevation-box-shadow-level-1);
11104
11106
  padding: calc(var(--pgn-spacing-spacer-base) * .5);