@hitachivantara/uikit-react-core 3.61.0 → 3.62.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/Dialog/Dialog.d.ts +4 -0
  3. package/dist/Dialog/Dialog.js +22 -6
  4. package/dist/Dialog/Dialog.js.map +1 -1
  5. package/dist/Dialog/DialogActions/DialogActions.js +18 -4
  6. package/dist/Dialog/DialogActions/DialogActions.js.map +1 -1
  7. package/dist/Dialog/DialogActions/styles.js +6 -0
  8. package/dist/Dialog/DialogActions/styles.js.map +1 -1
  9. package/dist/Dialog/DialogTitle/DialogTitle.js +4 -1
  10. package/dist/Dialog/DialogTitle/DialogTitle.js.map +1 -1
  11. package/dist/Dialog/styles.js +4 -1
  12. package/dist/Dialog/styles.js.map +1 -1
  13. package/dist/legacy/Dialog/Dialog.d.ts +4 -0
  14. package/dist/legacy/Dialog/Dialog.js +18 -4
  15. package/dist/legacy/Dialog/Dialog.js.map +1 -1
  16. package/dist/legacy/Dialog/DialogActions/DialogActions.js +17 -4
  17. package/dist/legacy/Dialog/DialogActions/DialogActions.js.map +1 -1
  18. package/dist/legacy/Dialog/DialogActions/styles.js +6 -0
  19. package/dist/legacy/Dialog/DialogActions/styles.js.map +1 -1
  20. package/dist/legacy/Dialog/DialogTitle/DialogTitle.js +4 -1
  21. package/dist/legacy/Dialog/DialogTitle/DialogTitle.js.map +1 -1
  22. package/dist/legacy/Dialog/styles.js +4 -1
  23. package/dist/legacy/Dialog/styles.js.map +1 -1
  24. package/dist/modern/Dialog/Dialog.d.ts +4 -0
  25. package/dist/modern/Dialog/Dialog.js +14 -5
  26. package/dist/modern/Dialog/Dialog.js.map +1 -1
  27. package/dist/modern/Dialog/DialogActions/DialogActions.js +17 -5
  28. package/dist/modern/Dialog/DialogActions/DialogActions.js.map +1 -1
  29. package/dist/modern/Dialog/DialogActions/styles.js +6 -0
  30. package/dist/modern/Dialog/DialogActions/styles.js.map +1 -1
  31. package/dist/modern/Dialog/DialogTitle/DialogTitle.js +4 -1
  32. package/dist/modern/Dialog/DialogTitle/DialogTitle.js.map +1 -1
  33. package/dist/modern/Dialog/styles.js +4 -1
  34. package/dist/modern/Dialog/styles.js.map +1 -1
  35. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.62.0](https://github.com/lumada-design/hv-uikit-react/compare/@hitachivantara/uikit-react-core@3.61.0...@hitachivantara/uikit-react-core@3.62.0) (2022-04-02)
7
+
8
+
9
+ ### Features
10
+
11
+ * **Dialog:** update component with 3.6.0 DS specification ([#2721](https://github.com/lumada-design/hv-uikit-react/issues/2721)) ([fec9399](https://github.com/lumada-design/hv-uikit-react/commit/fec939938354e6b0c31bba3ac2dbfeefce484999))
12
+
13
+
14
+
15
+
16
+
6
17
  # [3.61.0](https://github.com/lumada-design/hv-uikit-react/compare/@hitachivantara/uikit-react-core@3.60.0...@hitachivantara/uikit-react-core@3.61.0) (2022-03-31)
7
18
 
8
19
 
@@ -11,6 +11,10 @@ export interface HvDialogProps extends StandardProps<DialogProps, HvDialogClassK
11
11
  * Title for the button close.
12
12
  */
13
13
  buttonTitle?: string;
14
+ /**
15
+ * Set the dialog to fullscreen mode.
16
+ */
17
+ fullscreen?: boolean;
14
18
  }
15
19
 
16
20
  export default function HvDialog(props: HvDialogProps): JSX.Element | null;
@@ -14,15 +14,19 @@ require("core-js/modules/es.object.get-own-property-descriptor.js");
14
14
 
15
15
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
16
16
 
17
- var _typeof = require("@babel/runtime/helpers/typeof");
17
+ var _typeof3 = require("@babel/runtime/helpers/typeof");
18
18
 
19
19
  Object.defineProperty(exports, "__esModule", {
20
20
  value: true
21
21
  });
22
22
  exports.default = void 0;
23
23
 
24
+ require("core-js/modules/es.array.map.js");
25
+
24
26
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
25
27
 
28
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
29
+
26
30
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
27
31
 
28
32
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
@@ -51,11 +55,11 @@ var _focusableElementFinder = require("../utils/focusableElementFinder");
51
55
 
52
56
  var _Close;
53
57
 
54
- var _excluded = ["classes", "className", "id", "children", "open", "onClose", "firstFocusable", "buttonTitle"];
58
+ var _excluded = ["classes", "className", "id", "children", "open", "onClose", "firstFocusable", "buttonTitle", "fullscreen"];
55
59
 
56
60
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
57
61
 
58
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
62
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
59
63
 
60
64
  /**
61
65
  * The Dialog component provides a solid foundation for creating dialogs, popovers, lightboxes, etc.
@@ -71,6 +75,8 @@ var HvDialog = function HvDialog(_ref) {
71
75
  firstFocusable = _ref.firstFocusable,
72
76
  _ref$buttonTitle = _ref.buttonTitle,
73
77
  buttonTitle = _ref$buttonTitle === void 0 ? "Close" : _ref$buttonTitle,
78
+ _ref$fullscreen = _ref.fullscreen,
79
+ fullscreen = _ref$fullscreen === void 0 ? false : _ref$fullscreen,
74
80
  others = (0, _objectWithoutProperties2.default)(_ref, _excluded);
75
81
 
76
82
  var _useState = (0, _react.useState)(null),
@@ -138,9 +144,10 @@ var HvDialog = function HvDialog(_ref) {
138
144
  open: open,
139
145
  PaperProps: {
140
146
  classes: {
141
- root: classes.paper
147
+ root: (0, _clsx.default)(classes.paper, fullscreen && "fullscreen")
142
148
  }
143
149
  },
150
+ fullScreen: fullscreen,
144
151
  BackdropProps: {
145
152
  classes: {
146
153
  root: classes.background
@@ -160,7 +167,11 @@ var HvDialog = function HvDialog(_ref) {
160
167
  return _onClose(event);
161
168
  },
162
169
  "aria-label": buttonTitle
163
- }, /*#__PURE__*/_react.default.createElement(CloseButtonTooltipWrapper, null)), children));
170
+ }, /*#__PURE__*/_react.default.createElement(CloseButtonTooltipWrapper, null)), children && (0, _typeof2.default)(children) === "object" ? _react.default.Children.map(children, function (c) {
171
+ return /*#__PURE__*/_react.default.cloneElement(c, {
172
+ fullscreen: fullscreen
173
+ });
174
+ }) : children));
164
175
  };
165
176
 
166
177
  process.env.NODE_ENV !== "production" ? HvDialog.propTypes = {
@@ -222,7 +233,12 @@ process.env.NODE_ENV !== "production" ? HvDialog.propTypes = {
222
233
  /**
223
234
  * Title for the button close.
224
235
  */
225
- buttonTitle: _propTypes.default.string
236
+ buttonTitle: _propTypes.default.string,
237
+
238
+ /**
239
+ * Set the dialog to fullscreen mode.
240
+ */
241
+ fullscreen: _propTypes.default.bool
226
242
  } : void 0;
227
243
 
228
244
  var _default = (0, _core.withStyles)(_styles.default, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Dialog/Dialog.js"],"names":["HvDialog","classes","className","id","children","open","onClose","firstFocusable","buttonTitle","others","focusableQueue","setFocusableQueue","measuredRef","node","focusableList","first","last","length","focus","element","document","getElementById","console","warn","keyDownHandler","event","KeyboardCodes","Tab","target","shiftKey","preventDefault","Esc","onEscapeKeyDown","disableEscapeKeyDown","stopPropagation","closeButtonDisplay","CloseButtonTooltipWrapper","root","paper","background","reason","closeButton","propTypes","PropTypes","string","shape","isRequired","bool","func","styles","name"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA,IAAMA,QAAQ,GAAG,SAAXA,QAAW,OAUX;AAAA,MATJC,OASI,QATJA,OASI;AAAA,MARJC,SAQI,QARJA,SAQI;AAAA,MAPJC,EAOI,QAPJA,EAOI;AAAA,MANJC,QAMI,QANJA,QAMI;AAAA,MALJC,IAKI,QALJA,IAKI;AAAA,MAJJC,QAII,QAJJA,OAII;AAAA,MAHJC,cAGI,QAHJA,cAGI;AAAA,8BAFJC,WAEI;AAAA,MAFJA,WAEI,iCAFU,OAEV;AAAA,MADDC,MACC;;AACJ,kBAA4C,qBAAS,IAAT,CAA5C;AAAA;AAAA,MAAOC,cAAP;AAAA,MAAuBC,iBAAvB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AAAA,IAAI,EAAE;AAAR,CAAnB,EAAyClD,QAAzC,C","sourcesContent":["import React, { useCallback, useState } from \"react\";\nimport clsx from \"clsx\";\nimport PropTypes from \"prop-types\";\nimport { Dialog, withStyles } from \"@material-ui/core\";\nimport { Close } from \"@hitachivantara/uikit-react-icons\";\nimport isNil from \"lodash/isNil\";\nimport Button from \"../Button\";\nimport { isKeypress, KeyboardCodes, setId } from \"../utils\";\nimport styles from \"./styles\";\nimport withTooltip from \"../withTooltip\";\nimport { getFocusableList } from \"../utils/focusableElementFinder\";\n\n/**\n * The Dialog component provides a solid foundation for creating dialogs, popovers, lightboxes, etc.\n * It is created by the composition of DialogTitle, DialogContent and DialogActions components, passed as child elements.\n */\nconst HvDialog = ({\n classes,\n className,\n id,\n children,\n open,\n onClose,\n firstFocusable,\n buttonTitle = \"Close\",\n ...others\n}) => {\n const [focusableQueue, setFocusableQueue] = useState(null);\n\n const measuredRef = useCallback(\n (node) => {\n if (node) {\n const focusableList = getFocusableList(node);\n setFocusableQueue({\n first: focusableList[1],\n last: focusableList[focusableList.length - 2],\n });\n if (isNil(firstFocusable)) focusableList[1].focus();\n else {\n const element = document.getElementById(firstFocusable);\n if (element) element.focus();\n else {\n // eslint-disable-next-line no-console\n console.warn(`firstFocusable element ${firstFocusable} not found.`);\n focusableList[1].focus();\n }\n }\n }\n },\n [firstFocusable]\n );\n\n const keyDownHandler = (event) => {\n if (isKeypress(event, KeyboardCodes.Tab) && !isNil(event.target) && !isNil(focusableQueue)) {\n if (event.shiftKey && event.target === focusableQueue.first) {\n focusableQueue.last.focus();\n event.preventDefault();\n }\n if (!event.shiftKey && event.target === focusableQueue.last) {\n focusableQueue.first.focus();\n event.preventDefault();\n }\n }\n // Needed as this handler overrides the one in the material ui Modal.\n else if (isKeypress(event, KeyboardCodes.Esc)) {\n if (others.onEscapeKeyDown) {\n others.onEscapeKeyDown(event);\n }\n\n if (!others.disableEscapeKeyDown) {\n // Swallow the event, in case someone is listening for the escape key on the body.\n event.stopPropagation();\n\n if (onClose) {\n onClose(event, \"escapeKeyDown\");\n }\n }\n }\n };\n\n const closeButtonDisplay = () => <Close role=\"presentation\" />;\n\n const CloseButtonTooltipWrapper = buttonTitle\n ? withTooltip(closeButtonDisplay, buttonTitle, \"top\")\n : closeButtonDisplay;\n\n return (\n <Dialog\n className={clsx(classes.root, className)}\n id={id}\n ref={measuredRef}\n open={open}\n PaperProps={{\n classes: {\n root: classes.paper,\n },\n }}\n BackdropProps={{\n classes: {\n root: classes.background,\n },\n }}\n onClose={(event, reason) => onClose(event, reason)}\n onKeyDown={keyDownHandler}\n {...others}\n >\n <div aria-modal>\n <Button\n id={setId(id, \"close\")}\n className={classes.closeButton}\n category=\"ghost\"\n onClick={(event) => onClose(event)}\n aria-label={buttonTitle}\n >\n <CloseButtonTooltipWrapper />\n </Button>\n {children}\n </div>\n </Dialog>\n );\n};\n\nHvDialog.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * Id to be applied to the root node.\n */\n id: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Style applied to the root of the component.\n */\n root: PropTypes.string,\n /**\n * Style applied to the background (outside) of the component.\n */\n background: PropTypes.string,\n /**\n * Style applied to the component (root).\n */\n paper: PropTypes.string,\n /**\n * Style applied to the close button.\n */\n closeButton: PropTypes.string,\n }).isRequired,\n /**\n * Components of the Dialog.\n */\n children: PropTypes.node.isRequired,\n /**\n * Current state of the Dialog.\n */\n open: PropTypes.bool.isRequired,\n /**\n * Function executed on close.\n */\n onClose: PropTypes.func.isRequired,\n /**\n * Element id that should be focus when the Dialog opens.\n */\n firstFocusable: PropTypes.string,\n /**\n * Title for the button close.\n */\n buttonTitle: PropTypes.string,\n};\n\nexport default withStyles(styles, { name: \"HvDialog\" })(HvDialog);\n"],"file":"Dialog.js"}
1
+ {"version":3,"sources":["../../src/Dialog/Dialog.js"],"names":["HvDialog","classes","className","id","children","open","onClose","firstFocusable","buttonTitle","fullscreen","others","focusableQueue","setFocusableQueue","measuredRef","node","focusableList","first","last","length","focus","element","document","getElementById","console","warn","keyDownHandler","event","KeyboardCodes","Tab","target","shiftKey","preventDefault","Esc","onEscapeKeyDown","disableEscapeKeyDown","stopPropagation","closeButtonDisplay","CloseButtonTooltipWrapper","root","paper","background","reason","closeButton","React","Children","map","c","cloneElement","propTypes","PropTypes","string","shape","isRequired","bool","func","styles","name"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA,IAAMA,QAAQ,GAAG,SAAXA,QAAW,OAWX;AAAA,MAVJC,OAUI,QAVJA,OAUI;AAAA,MATJC,SASI,QATJA,SASI;AAAA,MARJC,EAQI,QARJA,EAQI;AAAA,MAPJC,QAOI,QAPJA,QAOI;AAAA,MANJC,IAMI,QANJA,IAMI;AAAA,MALJC,QAKI,QALJA,OAKI;AAAA,MAJJC,cAII,QAJJA,cAII;AAAA,8BAHJC,WAGI;AAAA,MAHJA,WAGI,iCAHU,OAGV;AAAA,6BAFJC,UAEI;AAAA,MAFJA,UAEI,gCAFS,KAET;AAAA,MADDC,MACC;;AACJ,kBAA4C,qBAAS,IAAT,CAA5C;AAAA;AAAA,MAAOC,cAAP;AAAA,MAAuBC,iBAAvB;;AAEA,MAAMC,WAAW,GAAG,wBAClB,UAACC,IAAD,EAAU;AACR,QAAIA,IAAJ,EAAU;AACR,UAAMC,aAAa,GAAG,8CAAiBD,IAAjB,CAAtB;AACAF,MAAAA,iBAAiB,CAAC;AAChBI,QAAAA,KAAK,EAAED,aAAa,CAAC,CAAD,CADJ;AAEhBE,QAAAA,IAAI,EAAEF,aAAa,CAACA,aAAa,CAACG,MAAd,GAAuB,CAAxB;AAFH,OAAD,CAAjB;AAIA,UAAI,oBAAMX,cAAN,CAAJ,EAA2BQ,aAAa,CAAC,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E,eAAX,EAAmB;AAAEC,EAAAA,IAAI,EAAE;AAAR,CAAnB,EAAyCxD,QAAzC,C","sourcesContent":["import React, { useCallback, useState } from \"react\";\nimport clsx from \"clsx\";\nimport PropTypes from \"prop-types\";\nimport { Dialog, withStyles } from \"@material-ui/core\";\nimport { Close } from \"@hitachivantara/uikit-react-icons\";\nimport isNil from \"lodash/isNil\";\nimport Button from \"../Button\";\nimport { isKeypress, KeyboardCodes, setId } from \"../utils\";\nimport styles from \"./styles\";\nimport withTooltip from \"../withTooltip\";\nimport { getFocusableList } from \"../utils/focusableElementFinder\";\n\n/**\n * The Dialog component provides a solid foundation for creating dialogs, popovers, lightboxes, etc.\n * It is created by the composition of DialogTitle, DialogContent and DialogActions components, passed as child elements.\n */\nconst HvDialog = ({\n classes,\n className,\n id,\n children,\n open,\n onClose,\n firstFocusable,\n buttonTitle = \"Close\",\n fullscreen = false,\n ...others\n}) => {\n const [focusableQueue, setFocusableQueue] = useState(null);\n\n const measuredRef = useCallback(\n (node) => {\n if (node) {\n const focusableList = getFocusableList(node);\n setFocusableQueue({\n first: focusableList[1],\n last: focusableList[focusableList.length - 2],\n });\n if (isNil(firstFocusable)) focusableList[1].focus();\n else {\n const element = document.getElementById(firstFocusable);\n if (element) element.focus();\n else {\n // eslint-disable-next-line no-console\n console.warn(`firstFocusable element ${firstFocusable} not found.`);\n focusableList[1].focus();\n }\n }\n }\n },\n [firstFocusable]\n );\n\n const keyDownHandler = (event) => {\n if (isKeypress(event, KeyboardCodes.Tab) && !isNil(event.target) && !isNil(focusableQueue)) {\n if (event.shiftKey && event.target === focusableQueue.first) {\n focusableQueue.last.focus();\n event.preventDefault();\n }\n if (!event.shiftKey && event.target === focusableQueue.last) {\n focusableQueue.first.focus();\n event.preventDefault();\n }\n }\n // Needed as this handler overrides the one in the material ui Modal.\n else if (isKeypress(event, KeyboardCodes.Esc)) {\n if (others.onEscapeKeyDown) {\n others.onEscapeKeyDown(event);\n }\n\n if (!others.disableEscapeKeyDown) {\n // Swallow the event, in case someone is listening for the escape key on the body.\n event.stopPropagation();\n\n if (onClose) {\n onClose(event, \"escapeKeyDown\");\n }\n }\n }\n };\n\n const closeButtonDisplay = () => <Close role=\"presentation\" />;\n\n const CloseButtonTooltipWrapper = buttonTitle\n ? withTooltip(closeButtonDisplay, buttonTitle, \"top\")\n : closeButtonDisplay;\n\n return (\n <Dialog\n className={clsx(classes.root, className)}\n id={id}\n ref={measuredRef}\n open={open}\n PaperProps={{\n classes: {\n root: clsx(classes.paper, fullscreen ? \"fullscreen\" : \"\"),\n },\n }}\n fullScreen={fullscreen}\n BackdropProps={{\n classes: {\n root: classes.background,\n },\n }}\n onClose={(event, reason) => onClose(event, reason)}\n onKeyDown={keyDownHandler}\n {...others}\n >\n <div aria-modal>\n <Button\n id={setId(id, \"close\")}\n className={classes.closeButton}\n category=\"ghost\"\n onClick={(event) => onClose(event)}\n aria-label={buttonTitle}\n >\n <CloseButtonTooltipWrapper />\n </Button>\n {children && typeof children === \"object\"\n ? React.Children.map(children, (c) => React.cloneElement(c, { fullscreen }))\n : children}\n </div>\n </Dialog>\n );\n};\n\nHvDialog.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * Id to be applied to the root node.\n */\n id: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Style applied to the root of the component.\n */\n root: PropTypes.string,\n /**\n * Style applied to the background (outside) of the component.\n */\n background: PropTypes.string,\n /**\n * Style applied to the component (root).\n */\n paper: PropTypes.string,\n /**\n * Style applied to the close button.\n */\n closeButton: PropTypes.string,\n }).isRequired,\n /**\n * Components of the Dialog.\n */\n children: PropTypes.node.isRequired,\n /**\n * Current state of the Dialog.\n */\n open: PropTypes.bool.isRequired,\n /**\n * Function executed on close.\n */\n onClose: PropTypes.func.isRequired,\n /**\n * Element id that should be focus when the Dialog opens.\n */\n firstFocusable: PropTypes.string,\n /**\n * Title for the button close.\n */\n buttonTitle: PropTypes.string,\n /**\n * Set the dialog to fullscreen mode.\n */\n fullscreen: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvDialog\" })(HvDialog);\n"],"file":"Dialog.js"}
@@ -13,22 +13,26 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
13
13
 
14
14
  var _react = _interopRequireDefault(require("react"));
15
15
 
16
+ var _clsx = _interopRequireDefault(require("clsx"));
17
+
16
18
  var _propTypes = _interopRequireDefault(require("prop-types"));
17
19
 
18
20
  var _core = require("@material-ui/core");
19
21
 
20
22
  var _styles = _interopRequireDefault(require("./styles"));
21
23
 
22
- var _excluded = ["classes", "className", "children"];
24
+ var _excluded = ["classes", "className", "children", "fullscreen"];
23
25
 
24
26
  var HvDialogActions = function HvDialogActions(props) {
25
27
  var classes = props.classes,
26
28
  className = props.className,
27
29
  children = props.children,
30
+ _props$fullscreen = props.fullscreen,
31
+ fullscreen = _props$fullscreen === void 0 ? false : _props$fullscreen,
28
32
  others = (0, _objectWithoutProperties2.default)(props, _excluded);
29
33
  return /*#__PURE__*/_react.default.createElement(_core.DialogActions, (0, _extends2.default)({
30
34
  classes: {
31
- root: classes.root,
35
+ root: (0, _clsx.default)(classes.root, fullscreen && classes.fullscreen),
32
36
  spacing: classes.spacing
33
37
  },
34
38
  className: className
@@ -53,13 +57,23 @@ process.env.NODE_ENV !== "production" ? HvDialogActions.propTypes = {
53
57
  /**
54
58
  * Style applied to the root of the component if disableSpacing is off.
55
59
  */
56
- spacing: _propTypes.default.string
60
+ spacing: _propTypes.default.string,
61
+
62
+ /**
63
+ * Style applied to the root of the component if fullscreen is on.
64
+ */
65
+ fullscreen: _propTypes.default.string
57
66
  }).isRequired,
58
67
 
59
68
  /**
60
69
  * Actions of the Dialog.
61
70
  */
62
- children: _propTypes.default.node.isRequired
71
+ children: _propTypes.default.node.isRequired,
72
+
73
+ /**
74
+ * Whether or not the dialog is in fullscreen mode.
75
+ */
76
+ fullscreen: _propTypes.default.bool
63
77
  } : void 0;
64
78
 
65
79
  var _default = (0, _core.withStyles)(_styles.default, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Dialog/DialogActions/DialogActions.js"],"names":["HvDialogActions","props","classes","className","children","others","root","spacing","propTypes","PropTypes","string","shape","isRequired","node","styles","name"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AAEA,IAAMA,eAAe,GAAG,SAAlBA,eAAkB,CAACC,KAAD,EAAW;AACjC,MAAQC,OAAR,GAAoDD,KAApD,CAAQC,OAAR;AAAA,MAAiBC,SAAjB,GAAoDF,KAApD,CAAiBE,SAAjB;AAAA,MAA4BC,QAA5B,GAAoDH,KAApD,CAA4BG,QAA5B;AAAA,MAAyCC,MAAzC,0CAAoDJ,KAApD;AACA,sBACE,6BAAC,mBAAD;AACE,IAAA,OAAO,EAAE;AACPK,MAAAA,IAAI,EAAEJ,OAAO,CAACI,IADP;AAEPC,MAAAA,OAAO,EAAEL,OAAO,CAACK;AAFV,KADX;AAKE,IAAA,SAAS,EAAEJ;AALb,KAMME,MANN,GAQGD,QARH,CADF;AAYD,CAdD;;AAgBA,wCAAAJ,eAAe,CAACQ,SAAhB,GAA4B;AAC1B;AACF;AACA;AACEL,EAAAA,SAAS,EAAEM,mBAAUC,MAJK;;AAK1B;AACF;AACA;AACER,EAAAA,OAAO,EAAEO,mBAAUE,KAAV,CAAgB;AACvB;AACJ;AACA;AACIL,IAAAA,IAAI,EAAEG,mBAAUC,MAJO;;AAKvB;AACJ;AACA;AACIH,IAAAA,OAAO,EAAEE,mBAAUC;AARI,GAAhB,EASNE,UAjBuB;;AAkB1B;AACF;AACA;AACER,EAAAA,QAAQ,EAAEK,mBAAUI,IAAV,CAAeD;AArBC,CAA5B;;eAwBe,sBAAWE,eAAX,EAAmB;AAAEC,EAAAA,IAAI,EAAE;AAAR,CAAnB,EAAgDf,eAAhD,C","sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport { DialogActions, withStyles } from \"@material-ui/core\";\nimport styles from \"./styles\";\n\nconst HvDialogActions = (props) => {\n const { classes, className, children, ...others } = props;\n return (\n <DialogActions\n classes={{\n root: classes.root,\n spacing: classes.spacing,\n }}\n className={className}\n {...others}\n >\n {children}\n </DialogActions>\n );\n};\n\nHvDialogActions.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Style applied to the root of the component (container for the actions).\n */\n root: PropTypes.string,\n /**\n * Style applied to the root of the component if disableSpacing is off.\n */\n spacing: PropTypes.string,\n }).isRequired,\n /**\n * Actions of the Dialog.\n */\n children: PropTypes.node.isRequired,\n};\n\nexport default withStyles(styles, { name: \"HvDialogActions\" })(HvDialogActions);\n"],"file":"DialogActions.js"}
1
+ {"version":3,"sources":["../../../src/Dialog/DialogActions/DialogActions.js"],"names":["HvDialogActions","props","classes","className","children","fullscreen","others","root","spacing","propTypes","PropTypes","string","shape","isRequired","node","bool","styles","name"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;AAEA,IAAMA,eAAe,GAAG,SAAlBA,eAAkB,CAACC,KAAD,EAAW;AACjC,MAAQC,OAAR,GAAwED,KAAxE,CAAQC,OAAR;AAAA,MAAiBC,SAAjB,GAAwEF,KAAxE,CAAiBE,SAAjB;AAAA,MAA4BC,QAA5B,GAAwEH,KAAxE,CAA4BG,QAA5B;AAAA,0BAAwEH,KAAxE,CAAsCI,UAAtC;AAAA,MAAsCA,UAAtC,kCAAmD,KAAnD;AAAA,MAA6DC,MAA7D,0CAAwEL,KAAxE;AACA,sBACE,6BAAC,mBAAD;AACE,IAAA,OAAO,EAAE;AACPM,MAAAA,IAAI,EAAE,mBAAKL,OAAO,CAACK,IAAb,EAAmBF,UAAnB,IAAiCH,OAAO,CAACG,UAAzC,CADC;AAEPG,MAAAA,OAAO,EAAEN,OAAO,CAACM;AAFV,KADX;AAKE,IAAA,SAAS,EAAEL;AALb,KAMMG,MANN,GAQGF,QARH,CADF;AAYD,CAdD;;AAgBA,wCAAAJ,eAAe,CAACS,SAAhB,GAA4B;AAC1B;AACF;AACA;AACEN,EAAAA,SAAS,EAAEO,mBAAUC,MAJK;;AAK1B;AACF;AACA;AACET,EAAAA,OAAO,EAAEQ,mBAAUE,KAAV,CAAgB;AACvB;AACJ;AACA;AACIL,IAAAA,IAAI,EAAEG,mBAAUC,MAJO;;AAKvB;AACJ;AACA;AACIH,IAAAA,OAAO,EAAEE,mBAAUC,MARI;;AASvB;AACJ;AACA;AACIN,IAAAA,UAAU,EAAEK,mBAAUC;AAZC,GAAhB,EAaNE,UArBuB;;AAsB1B;AACF;AACA;AACET,EAAAA,QAAQ,EAAEM,mBAAUI,IAAV,CAAeD,UAzBC;;AA0B1B;AACF;AACA;AACER,EAAAA,UAAU,EAAEK,mBAAUK;AA7BI,CAA5B;;eAgCe,sBAAWC,eAAX,EAAmB;AAAEC,EAAAA,IAAI,EAAE;AAAR,CAAnB,EAAgDjB,eAAhD,C","sourcesContent":["import React from \"react\";\nimport clsx from \"clsx\";\nimport PropTypes from \"prop-types\";\nimport { DialogActions, withStyles } from \"@material-ui/core\";\nimport styles from \"./styles\";\n\nconst HvDialogActions = (props) => {\n const { classes, className, children, fullscreen = false, ...others } = props;\n return (\n <DialogActions\n classes={{\n root: clsx(classes.root, fullscreen && classes.fullscreen),\n spacing: classes.spacing,\n }}\n className={className}\n {...others}\n >\n {children}\n </DialogActions>\n );\n};\n\nHvDialogActions.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Style applied to the root of the component (container for the actions).\n */\n root: PropTypes.string,\n /**\n * Style applied to the root of the component if disableSpacing is off.\n */\n spacing: PropTypes.string,\n /**\n * Style applied to the root of the component if fullscreen is on.\n */\n fullscreen: PropTypes.string,\n }).isRequired,\n /**\n * Actions of the Dialog.\n */\n children: PropTypes.node.isRequired,\n /**\n * Whether or not the dialog is in fullscreen mode.\n */\n fullscreen: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvDialogActions\" })(HvDialogActions);\n"],"file":"DialogActions.js"}
@@ -16,6 +16,12 @@ var styles = function styles(theme) {
16
16
  "& > :not(:first-child)": {
17
17
  marginLeft: theme.hv.spacing.xs
18
18
  }
19
+ },
20
+ fullscreen: {
21
+ position: "fixed",
22
+ width: "100%",
23
+ bottom: 0,
24
+ left: 0
19
25
  }
20
26
  };
21
27
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Dialog/DialogActions/styles.js"],"names":["styles","theme","root","margin","padding","hv","spacing","sm","borderTop","palette","atmosphere","atmo2","marginLeft","xs"],"mappings":";;;;;;;AAAA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,IAAI,EAAE;AACJC,MAAAA,MAAM,EAAE,GADJ;AAEJC,MAAAA,OAAO,EAAEH,KAAK,CAACI,EAAN,CAASC,OAAT,CAAiBC,EAFtB;AAGJC,MAAAA,SAAS,sBAAeP,KAAK,CAACI,EAAN,CAASI,OAAT,CAAiBC,UAAjB,CAA4BC,KAA3C;AAHL,KADmB;AAMzBL,IAAAA,OAAO,EAAE;AACP,gCAA0B;AACxBM,QAAAA,UAAU,EAAEX,KAAK,CAACI,EAAN,CAASC,OAAT,CAAiBO;AADL;AADnB;AANgB,GAAZ;AAAA,CAAf;;eAaeb,M","sourcesContent":["const styles = (theme) => ({\n root: {\n margin: \"0\",\n padding: theme.hv.spacing.sm,\n borderTop: `3px solid ${theme.hv.palette.atmosphere.atmo2}`,\n },\n spacing: {\n \"& > :not(:first-child)\": {\n marginLeft: theme.hv.spacing.xs,\n },\n },\n});\n\nexport default styles;\n"],"file":"styles.js"}
1
+ {"version":3,"sources":["../../../src/Dialog/DialogActions/styles.js"],"names":["styles","theme","root","margin","padding","hv","spacing","sm","borderTop","palette","atmosphere","atmo2","marginLeft","xs","fullscreen","position","width","bottom","left"],"mappings":";;;;;;;AAAA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,IAAI,EAAE;AACJC,MAAAA,MAAM,EAAE,GADJ;AAEJC,MAAAA,OAAO,EAAEH,KAAK,CAACI,EAAN,CAASC,OAAT,CAAiBC,EAFtB;AAGJC,MAAAA,SAAS,sBAAeP,KAAK,CAACI,EAAN,CAASI,OAAT,CAAiBC,UAAjB,CAA4BC,KAA3C;AAHL,KADmB;AAMzBL,IAAAA,OAAO,EAAE;AACP,gCAA0B;AACxBM,QAAAA,UAAU,EAAEX,KAAK,CAACI,EAAN,CAASC,OAAT,CAAiBO;AADL;AADnB,KANgB;AAWzBC,IAAAA,UAAU,EAAE;AACVC,MAAAA,QAAQ,EAAE,OADA;AAEVC,MAAAA,KAAK,EAAE,MAFG;AAGVC,MAAAA,MAAM,EAAE,CAHE;AAIVC,MAAAA,IAAI,EAAE;AAJI;AAXa,GAAZ;AAAA,CAAf;;eAmBelB,M","sourcesContent":["const styles = (theme) => ({\n root: {\n margin: \"0\",\n padding: theme.hv.spacing.sm,\n borderTop: `3px solid ${theme.hv.palette.atmosphere.atmo2}`,\n },\n spacing: {\n \"& > :not(:first-child)\": {\n marginLeft: theme.hv.spacing.xs,\n },\n },\n fullscreen: {\n position: \"fixed\",\n width: \"100%\",\n bottom: 0,\n left: 0,\n },\n});\n\nexport default styles;\n"],"file":"styles.js"}
@@ -38,7 +38,10 @@ var HvDialogTitle = function HvDialogTitle(_ref) {
38
38
  _ref$customIcon = _ref.customIcon,
39
39
  customIcon = _ref$customIcon === void 0 ? null : _ref$customIcon,
40
40
  others = (0, _objectWithoutProperties2.default)(_ref, _excluded);
41
- var isString = typeof children === "string";
41
+ var isString = typeof children === "string"; // prevent the `fullscreen` prop from being passed to the `DialogTitle` component
42
+ // eslint-disable-next-line no-param-reassign
43
+
44
+ delete others.fullscreen;
42
45
  var icon = customIcon || showIcon && (0, _iconVariant.default)(variant);
43
46
  return /*#__PURE__*/_react.default.createElement(_core.DialogTitle, (0, _extends2.default)({
44
47
  className: (0, _clsx.default)(classes.root, className),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Dialog/DialogTitle/DialogTitle.js"],"names":["HvDialogTitle","classes","className","children","variant","showIcon","customIcon","others","isString","icon","root","messageContainer","textWithIcon","propTypes","PropTypes","string","shape","closeButton","isRequired","oneOf","bool","node","styles","name"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,OAQhB;AAAA,MAPJC,OAOI,QAPJA,OAOI;AAAA,MANJC,SAMI,QANJA,SAMI;AAAA,MALJC,QAKI,QALJA,QAKI;AAAA,0BAJJC,OAII;AAAA,MAJJA,OAII,6BAJM,SAIN;AAAA,2BAHJC,QAGI;AAAA,MAHJA,QAGI,8BAHO,IAGP;AAAA,6BAFJC,UAEI;AAAA,MAFJA,UAEI,gCAFS,IAET;AAAA,MADDC,MACC;AACJ,MAAMC,QAAQ,GAAG,OAAOL,QAAP,KAAoB,QAArC;AAEA,MAAMM,IAAI,GAAGH,UAAU,IAAKD,QAAQ,IAAI,0BAAYD,OAAZ,CAAxC;AAEA,sBACE,6BAAC,iBAAD;AAAa,IAAA,SAAS,EAAE,mBAAKH,OAAO,CAACS,IAAb,EAAmBR,SAAnB,CAAxB;AAAuD,IAAA,iBAAiB;AAAxE,KAA6EK,MAA7E,gBACE;AAAK,IAAA,SAAS,EAAEN,OAAO,CAACU;AAAxB,KACGF,IADH,eAEE;AAAK,IAAA,SAAS,EAAE,mBAA+BA,IAA/B,IAAQR,OAAO,CAACW,YAAhB;AAAhB,KACG,CAACJ,QAAD,IAAaL,QADhB,EAEGK,QAAQ,iBAAI,6BAAC,mBAAD;AAAc,IAAA,OAAO,EAAC;AAAtB,KAAkCL,QAAlC,CAFf,CAFF,CADF,CADF;AAWD,CAxBD;;AA0BA,wCAAAH,aAAa,CAACa,SAAd,GAA0B;AACxB;AACF;AACA;AACEX,EAAAA,SAAS,EAAEY,mBAAUC,MAJG;;AAKxB;AACF;AACA;AACEd,EAAAA,OAAO,EAAEa,mBAAUE,KAAV,CAAgB;AACvB;AACJ;AACA;AACIN,IAAAA,IAAI,EAAEI,mBAAUC,MAJO;;AAKvB;AACJ;AACA;AACIJ,IAAAA,gBAAgB,EAAEG,mBAAUC,MARL;;AASvB;AACJ;AACA;AACIH,IAAAA,YAAY,EAAEE,mBAAUC,MAZD;;AAavB;AACJ;AACA;AACIN,IAAAA,IAAI,EAAEK,mBAAUC,MAhBO;;AAiBvB;AACJ;AACA;AACIE,IAAAA,WAAW,EAAEH,mBAAUC;AApBA,GAAhB,EAqBNG,UA7BqB;;AA8BxB;AACF;AACA;AACEd,EAAAA,OAAO,EAAEU,mBAAUK,KAAV,CAAgB,CAAC,SAAD,EAAY,SAAZ,EAAuB,OAAvB,EAAgC,MAAhC,EAAwC,SAAxC,CAAhB,CAjCe;;AAkCxB;AACF;AACA;AACEd,EAAAA,QAAQ,EAAES,mBAAUM,IArCI;;AAsCxB;AACF;AACA;AACEd,EAAAA,UAAU,EAAEQ,mBAAUO,IAzCE;;AA0CxB;AACF;AACA;AACElB,EAAAA,QAAQ,EAAEW,mBAAUO,IAAV,CAAeH;AA7CD,CAA1B;;eAgDe,sBAAWI,eAAX,EAAmB;AAAEC,EAAAA,IAAI,EAAE;AAAR,CAAnB,EAA8CvB,aAA9C,C","sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\nimport { DialogTitle, withStyles } from \"@material-ui/core\";\nimport HvTypography from \"../../Typography\";\nimport iconVariant from \"../../utils/iconVariant\";\nimport styles from \"./styles\";\n\nconst HvDialogTitle = ({\n classes,\n className,\n children,\n variant = \"default\",\n showIcon = true,\n customIcon = null,\n ...others\n}) => {\n const isString = typeof children === \"string\";\n\n const icon = customIcon || (showIcon && iconVariant(variant));\n\n return (\n <DialogTitle className={clsx(classes.root, className)} disableTypography {...others}>\n <div className={classes.messageContainer}>\n {icon}\n <div className={clsx({ [classes.textWithIcon]: icon })}>\n {!isString && children}\n {isString && <HvTypography variant=\"xxsTitle\">{children}</HvTypography>}\n </div>\n </div>\n </DialogTitle>\n );\n};\n\nHvDialogTitle.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Style applied to the root of the component (container for the title).\n */\n root: PropTypes.string,\n /**\n * Style applied to the container of the title\n */\n messageContainer: PropTypes.string,\n /**\n * Style applied to the text when the icon is present.\n */\n textWithIcon: PropTypes.string,\n /**\n * Style applied to the icon.\n */\n icon: PropTypes.string,\n /**\n * Style applied to the close button.\n */\n closeButton: PropTypes.string,\n }).isRequired,\n /**\n * Variant of the Dialog.\n */\n variant: PropTypes.oneOf([\"success\", \"warning\", \"error\", \"info\", \"default\"]),\n /**\n * Controls if the associated icon to the variant should be shown.\n */\n showIcon: PropTypes.bool,\n /**\n * Custom icon to replace the variant default.\n */\n customIcon: PropTypes.node,\n /**\n * Node to be render.\n */\n children: PropTypes.node.isRequired,\n};\n\nexport default withStyles(styles, { name: \"HvDialogTitle\" })(HvDialogTitle);\n"],"file":"DialogTitle.js"}
1
+ {"version":3,"sources":["../../../src/Dialog/DialogTitle/DialogTitle.js"],"names":["HvDialogTitle","classes","className","children","variant","showIcon","customIcon","others","isString","fullscreen","icon","root","messageContainer","textWithIcon","propTypes","PropTypes","string","shape","closeButton","isRequired","oneOf","bool","node","styles","name"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,OAQhB;AAAA,MAPJC,OAOI,QAPJA,OAOI;AAAA,MANJC,SAMI,QANJA,SAMI;AAAA,MALJC,QAKI,QALJA,QAKI;AAAA,0BAJJC,OAII;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GAAhB,EAqBNG,UA7BqB;;AA8BxB;AACF;AACA;AACEf,EAAAA,OAAO,EAAEW,mBAAUK,KAAV,CAAgB,CAAC,SAAD,EAAY,SAAZ,EAAuB,OAAvB,EAAgC,MAAhC,EAAwC,SAAxC,CAAhB,CAjCe;;AAkCxB;AACF;AACA;AACEf,EAAAA,QAAQ,EAAEU,mBAAUM,IArCI;;AAsCxB;AACF;AACA;AACEf,EAAAA,UAAU,EAAES,mBAAUO,IAzCE;;AA0CxB;AACF;AACA;AACEnB,EAAAA,QAAQ,EAAEY,mBAAUO,IAAV,CAAeH;AA7CD,CAA1B;;eAgDe,sBAAWI,eAAX,EAAmB;AAAEC,EAAAA,IAAI,EAAE;AAAR,CAAnB,EAA8CxB,aAA9C,C","sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\nimport { DialogTitle, withStyles } from \"@material-ui/core\";\nimport HvTypography from \"../../Typography\";\nimport iconVariant from \"../../utils/iconVariant\";\nimport styles from \"./styles\";\n\nconst HvDialogTitle = ({\n classes,\n className,\n children,\n variant = \"default\",\n showIcon = true,\n customIcon = null,\n ...others\n}) => {\n const isString = typeof children === \"string\";\n // prevent the `fullscreen` prop from being passed to the `DialogTitle` component\n // eslint-disable-next-line no-param-reassign\n delete others.fullscreen;\n\n const icon = customIcon || (showIcon && iconVariant(variant));\n\n return (\n <DialogTitle className={clsx(classes.root, className)} disableTypography {...others}>\n <div className={classes.messageContainer}>\n {icon}\n <div className={clsx({ [classes.textWithIcon]: icon })}>\n {!isString && children}\n {isString && <HvTypography variant=\"xxsTitle\">{children}</HvTypography>}\n </div>\n </div>\n </DialogTitle>\n );\n};\n\nHvDialogTitle.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Style applied to the root of the component (container for the title).\n */\n root: PropTypes.string,\n /**\n * Style applied to the container of the title\n */\n messageContainer: PropTypes.string,\n /**\n * Style applied to the text when the icon is present.\n */\n textWithIcon: PropTypes.string,\n /**\n * Style applied to the icon.\n */\n icon: PropTypes.string,\n /**\n * Style applied to the close button.\n */\n closeButton: PropTypes.string,\n }).isRequired,\n /**\n * Variant of the Dialog.\n */\n variant: PropTypes.oneOf([\"success\", \"warning\", \"error\", \"info\", \"default\"]),\n /**\n * Controls if the associated icon to the variant should be shown.\n */\n showIcon: PropTypes.bool,\n /**\n * Custom icon to replace the variant default.\n */\n customIcon: PropTypes.node,\n /**\n * Node to be render.\n */\n children: PropTypes.node.isRequired,\n};\n\nexport default withStyles(styles, { name: \"HvDialogTitle\" })(HvDialogTitle);\n"],"file":"DialogTitle.js"}
@@ -18,7 +18,10 @@ var styles = function styles(theme) {
18
18
  background: "".concat(theme.hv.palette.atmosphere.atmo1),
19
19
  padding: "0px",
20
20
  overflow: "auto",
21
- boxShadow: theme.hv.shadows[1]
21
+ boxShadow: theme.hv.shadows[1],
22
+ "&:not(.fullscreen)": {
23
+ maxHeight: "calc(100% - 200px)"
24
+ }
22
25
  },
23
26
  closeButton: {
24
27
  padding: 0,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Dialog/styles.js"],"names":["styles","theme","background","hv","palette","atmosphere","atmo4","paper","atmo1","padding","overflow","boxShadow","shadows","closeButton","minWidth","position","top","hvSpacing","right"],"mappings":";;;;;;;;;AAAA;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,UAAU,EAAE;AACVA,MAAAA,UAAU,EAAE,wBAAKD,KAAK,CAACE,EAAN,CAASC,OAAT,CAAiBC,UAAjB,CAA4BC,KAAjC,EAAwC,GAAxC;AADF,KADa;AAIzBC,IAAAA,KAAK,EAAE;AACLL,MAAAA,UAAU,YAAKD,KAAK,CAACE,EAAN,CAASC,OAAT,CAAiBC,UAAjB,CAA4BG,KAAjC,CADL;AAELC,MAAAA,OAAO,EAAE,KAFJ;AAGLC,MAAAA,QAAQ,EAAE,MAHL;AAILC,MAAAA,SAAS,EAAEV,KAAK,CAACE,EAAN,CAASS,OAAT,CAAiB,CAAjB;AAJN,KAJkB;AAUzBC,IAAAA,WAAW,EAAE;AACXJ,MAAAA,OAAO,EAAE,CADE;AAEXK,MAAAA,QAAQ,EAAE,SAFC;AAGXC,MAAAA,QAAQ,EAAE,UAHC;AAIXC,MAAAA,GAAG,EAAEf,KAAK,CAACgB,SAAN,CAAgB,IAAhB,CAJM;AAKXC,MAAAA,KAAK,EAAEjB,KAAK,CAACgB,SAAN,CAAgB,IAAhB;AALI;AAVY,GAAZ;AAAA,CAAf;;eAmBejB,M","sourcesContent":["import fade from \"../utils/hexToRgbA\";\n\nconst styles = (theme) => ({\n background: {\n background: fade(theme.hv.palette.atmosphere.atmo4, 0.8),\n },\n paper: {\n background: `${theme.hv.palette.atmosphere.atmo1}`,\n padding: \"0px\",\n overflow: \"auto\",\n boxShadow: theme.hv.shadows[1],\n },\n closeButton: {\n padding: 0,\n minWidth: \"inherit\",\n position: \"absolute\",\n top: theme.hvSpacing(\"sm\"),\n right: theme.hvSpacing(\"sm\"),\n },\n});\n\nexport default styles;\n"],"file":"styles.js"}
1
+ {"version":3,"sources":["../../src/Dialog/styles.js"],"names":["styles","theme","background","hv","palette","atmosphere","atmo4","paper","atmo1","padding","overflow","boxShadow","shadows","maxHeight","closeButton","minWidth","position","top","hvSpacing","right"],"mappings":";;;;;;;;;AAAA;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,UAAU,EAAE;AACVA,MAAAA,UAAU,EAAE,wBAAKD,KAAK,CAACE,EAAN,CAASC,OAAT,CAAiBC,UAAjB,CAA4BC,KAAjC,EAAwC,GAAxC;AADF,KADa;AAIzBC,IAAAA,KAAK,EAAE;AACLL,MAAAA,UAAU,YAAKD,KAAK,CAACE,EAAN,CAASC,OAAT,CAAiBC,UAAjB,CAA4BG,KAAjC,CADL;AAELC,MAAAA,OAAO,EAAE,KAFJ;AAGLC,MAAAA,QAAQ,EAAE,MAHL;AAILC,MAAAA,SAAS,EAAEV,KAAK,CAACE,EAAN,CAASS,OAAT,CAAiB,CAAjB,CAJN;AAKL,4BAAsB;AACpBC,QAAAA,SAAS,EAAE;AADS;AALjB,KAJkB;AAazBC,IAAAA,WAAW,EAAE;AACXL,MAAAA,OAAO,EAAE,CADE;AAEXM,MAAAA,QAAQ,EAAE,SAFC;AAGXC,MAAAA,QAAQ,EAAE,UAHC;AAIXC,MAAAA,GAAG,EAAEhB,KAAK,CAACiB,SAAN,CAAgB,IAAhB,CAJM;AAKXC,MAAAA,KAAK,EAAElB,KAAK,CAACiB,SAAN,CAAgB,IAAhB;AALI;AAbY,GAAZ;AAAA,CAAf;;eAsBelB,M","sourcesContent":["import fade from \"../utils/hexToRgbA\";\n\nconst styles = (theme) => ({\n background: {\n background: fade(theme.hv.palette.atmosphere.atmo4, 0.8),\n },\n paper: {\n background: `${theme.hv.palette.atmosphere.atmo1}`,\n padding: \"0px\",\n overflow: \"auto\",\n boxShadow: theme.hv.shadows[1],\n \"&:not(.fullscreen)\": {\n maxHeight: \"calc(100% - 200px)\",\n },\n },\n closeButton: {\n padding: 0,\n minWidth: \"inherit\",\n position: \"absolute\",\n top: theme.hvSpacing(\"sm\"),\n right: theme.hvSpacing(\"sm\"),\n },\n});\n\nexport default styles;\n"],"file":"styles.js"}
@@ -11,6 +11,10 @@ export interface HvDialogProps extends StandardProps<DialogProps, HvDialogClassK
11
11
  * Title for the button close.
12
12
  */
13
13
  buttonTitle?: string;
14
+ /**
15
+ * Set the dialog to fullscreen mode.
16
+ */
17
+ fullscreen?: boolean;
14
18
  }
15
19
 
16
20
  export default function HvDialog(props: HvDialogProps): JSX.Element | null;
@@ -1,10 +1,12 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _typeof from "@babel/runtime/helpers/esm/typeof";
2
3
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
5
 
5
6
  var _Close;
6
7
 
7
- var _excluded = ["classes", "className", "id", "children", "open", "onClose", "firstFocusable", "buttonTitle"];
8
+ var _excluded = ["classes", "className", "id", "children", "open", "onClose", "firstFocusable", "buttonTitle", "fullscreen"];
9
+ import "core-js/modules/es.array.map.js";
8
10
  import React, { useCallback, useState } from "react";
9
11
  import clsx from "clsx";
10
12
  import PropTypes from "prop-types";
@@ -31,6 +33,8 @@ var HvDialog = function HvDialog(_ref) {
31
33
  firstFocusable = _ref.firstFocusable,
32
34
  _ref$buttonTitle = _ref.buttonTitle,
33
35
  buttonTitle = _ref$buttonTitle === void 0 ? "Close" : _ref$buttonTitle,
36
+ _ref$fullscreen = _ref.fullscreen,
37
+ fullscreen = _ref$fullscreen === void 0 ? false : _ref$fullscreen,
34
38
  others = _objectWithoutProperties(_ref, _excluded);
35
39
 
36
40
  var _useState = useState(null),
@@ -98,9 +102,10 @@ var HvDialog = function HvDialog(_ref) {
98
102
  open: open,
99
103
  PaperProps: {
100
104
  classes: {
101
- root: classes.paper
105
+ root: clsx(classes.paper, fullscreen && "fullscreen")
102
106
  }
103
107
  },
108
+ fullScreen: fullscreen,
104
109
  BackdropProps: {
105
110
  classes: {
106
111
  root: classes.background
@@ -120,7 +125,11 @@ var HvDialog = function HvDialog(_ref) {
120
125
  return _onClose(event);
121
126
  },
122
127
  "aria-label": buttonTitle
123
- }, /*#__PURE__*/React.createElement(CloseButtonTooltipWrapper, null)), children));
128
+ }, /*#__PURE__*/React.createElement(CloseButtonTooltipWrapper, null)), children && _typeof(children) === "object" ? React.Children.map(children, function (c) {
129
+ return /*#__PURE__*/React.cloneElement(c, {
130
+ fullscreen: fullscreen
131
+ });
132
+ }) : children));
124
133
  };
125
134
 
126
135
  process.env.NODE_ENV !== "production" ? HvDialog.propTypes = {
@@ -182,7 +191,12 @@ process.env.NODE_ENV !== "production" ? HvDialog.propTypes = {
182
191
  /**
183
192
  * Title for the button close.
184
193
  */
185
- buttonTitle: PropTypes.string
194
+ buttonTitle: PropTypes.string,
195
+
196
+ /**
197
+ * Set the dialog to fullscreen mode.
198
+ */
199
+ fullscreen: PropTypes.bool
186
200
  } : void 0;
187
201
  export default withStyles(styles, {
188
202
  name: "HvDialog"
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Dialog/Dialog.js"],"names":["React","useCallback","useState","clsx","PropTypes","Dialog","withStyles","Close","isNil","Button","isKeypress","KeyboardCodes","setId","styles","withTooltip","getFocusableList","HvDialog","classes","className","id","children","open","onClose","firstFocusable","buttonTitle","others","focusableQueue","setFocusableQueue","measuredRef","node","focusableList","first","last","length","focus","element","document","getElementById","console","warn","keyDownHandler","event","Tab","target","shiftKey","preventDefault","Esc","onEscapeKeyDown","disableEscapeKeyDown","stopPropagation","closeButtonDisplay","CloseButtonTooltipWrapper","root","paper","background","reason","closeButton","propTypes","string","shape","isRequired","bool","func","name"],"mappings":";;;;;;;AAAA,OAAOA,KAAP,IAAgBC,WAAhB,EAA6BC,QAA7B,QAA6C,OAA7C;AACA,OAAOC,IAAP,MAAiB,MAAjB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,MAAT,EAAiBC,UAAjB,QAAmC,mBAAnC;AACA,SAASC,KAAT,QAAsB,mCAAtB;AACA,OAAOC,KAAP,MAAkB,cAAlB;AACA,OAAOC,MAAP,MAAmB,WAAnB;AACA,SAASC,UAAT,EAAqBC,aAArB,EAAoCC,KAApC,QAAiD,UAAjD;AACA,OAAOC,MAAP,MAAmB,UAAnB;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,SAASC,gBAAT,QAAiC,iCAAjC;AAEA;AACA;AACA;AACA;;AACA,IAAMC,QAAQ,GAAG,SAAXA,QAAW,OAUX;AAAA,MATJC,OASI,QATJA,OASI;AAAA,MARJC,SAQI,QARJA,SAQI;AAAA,MAPJC,EAOI,QAPJA,EAOI;AAAA,MANJC,QAMI,QANJA,Q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,EAAEhB,SAAS,CAACyB,IAAV,CAAe+B,UAjCN;;AAkCnB;AACF;AACA;AACEvC,EAAAA,IAAI,EAAEjB,SAAS,CAACyD,IAAV,CAAeD,UArCF;;AAsCnB;AACF;AACA;AACEtC,EAAAA,OAAO,EAAElB,SAAS,CAAC0D,IAAV,CAAeF,UAzCL;;AA0CnB;AACF;AACA;AACErC,EAAAA,cAAc,EAAEnB,SAAS,CAACsD,MA7CP;;AA8CnB;AACF;AACA;AACElC,EAAAA,WAAW,EAAEpB,SAAS,CAACsD;AAjDJ,CAArB;AAoDA,eAAepD,UAAU,CAACO,MAAD,EAAS;AAAEkD,EAAAA,IAAI,EAAE;AAAR,CAAT,CAAV,CAAyC/C,QAAzC,CAAf","sourcesContent":["import React, { useCallback, useState } from \"react\";\nimport clsx from \"clsx\";\nimport PropTypes from \"prop-types\";\nimport { Dialog, withStyles } from \"@material-ui/core\";\nimport { Close } from \"@hitachivantara/uikit-react-icons\";\nimport isNil from \"lodash/isNil\";\nimport Button from \"../Button\";\nimport { isKeypress, KeyboardCodes, setId } from \"../utils\";\nimport styles from \"./styles\";\nimport withTooltip from \"../withTooltip\";\nimport { getFocusableList } from \"../utils/focusableElementFinder\";\n\n/**\n * The Dialog component provides a solid foundation for creating dialogs, popovers, lightboxes, etc.\n * It is created by the composition of DialogTitle, DialogContent and DialogActions components, passed as child elements.\n */\nconst HvDialog = ({\n classes,\n className,\n id,\n children,\n open,\n onClose,\n firstFocusable,\n buttonTitle = \"Close\",\n ...others\n}) => {\n const [focusableQueue, setFocusableQueue] = useState(null);\n\n const measuredRef = useCallback(\n (node) => {\n if (node) {\n const focusableList = getFocusableList(node);\n setFocusableQueue({\n first: focusableList[1],\n last: focusableList[focusableList.length - 2],\n });\n if (isNil(firstFocusable)) focusableList[1].focus();\n else {\n const element = document.getElementById(firstFocusable);\n if (element) element.focus();\n else {\n // eslint-disable-next-line no-console\n console.warn(`firstFocusable element ${firstFocusable} not found.`);\n focusableList[1].focus();\n }\n }\n }\n },\n [firstFocusable]\n );\n\n const keyDownHandler = (event) => {\n if (isKeypress(event, KeyboardCodes.Tab) && !isNil(event.target) && !isNil(focusableQueue)) {\n if (event.shiftKey && event.target === focusableQueue.first) {\n focusableQueue.last.focus();\n event.preventDefault();\n }\n if (!event.shiftKey && event.target === focusableQueue.last) {\n focusableQueue.first.focus();\n event.preventDefault();\n }\n }\n // Needed as this handler overrides the one in the material ui Modal.\n else if (isKeypress(event, KeyboardCodes.Esc)) {\n if (others.onEscapeKeyDown) {\n others.onEscapeKeyDown(event);\n }\n\n if (!others.disableEscapeKeyDown) {\n // Swallow the event, in case someone is listening for the escape key on the body.\n event.stopPropagation();\n\n if (onClose) {\n onClose(event, \"escapeKeyDown\");\n }\n }\n }\n };\n\n const closeButtonDisplay = () => <Close role=\"presentation\" />;\n\n const CloseButtonTooltipWrapper = buttonTitle\n ? withTooltip(closeButtonDisplay, buttonTitle, \"top\")\n : closeButtonDisplay;\n\n return (\n <Dialog\n className={clsx(classes.root, className)}\n id={id}\n ref={measuredRef}\n open={open}\n PaperProps={{\n classes: {\n root: classes.paper,\n },\n }}\n BackdropProps={{\n classes: {\n root: classes.background,\n },\n }}\n onClose={(event, reason) => onClose(event, reason)}\n onKeyDown={keyDownHandler}\n {...others}\n >\n <div aria-modal>\n <Button\n id={setId(id, \"close\")}\n className={classes.closeButton}\n category=\"ghost\"\n onClick={(event) => onClose(event)}\n aria-label={buttonTitle}\n >\n <CloseButtonTooltipWrapper />\n </Button>\n {children}\n </div>\n </Dialog>\n );\n};\n\nHvDialog.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * Id to be applied to the root node.\n */\n id: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Style applied to the root of the component.\n */\n root: PropTypes.string,\n /**\n * Style applied to the background (outside) of the component.\n */\n background: PropTypes.string,\n /**\n * Style applied to the component (root).\n */\n paper: PropTypes.string,\n /**\n * Style applied to the close button.\n */\n closeButton: PropTypes.string,\n }).isRequired,\n /**\n * Components of the Dialog.\n */\n children: PropTypes.node.isRequired,\n /**\n * Current state of the Dialog.\n */\n open: PropTypes.bool.isRequired,\n /**\n * Function executed on close.\n */\n onClose: PropTypes.func.isRequired,\n /**\n * Element id that should be focus when the Dialog opens.\n */\n firstFocusable: PropTypes.string,\n /**\n * Title for the button close.\n */\n buttonTitle: PropTypes.string,\n};\n\nexport default withStyles(styles, { name: \"HvDialog\" })(HvDialog);\n"],"file":"Dialog.js"}
1
+ {"version":3,"sources":["../../../src/Dialog/Dialog.js"],"names":["React","useCallback","useState","clsx","PropTypes","Dialog","withStyles","Close","isNil","Button","isKeypress","KeyboardCodes","setId","styles","withTooltip","getFocusableList","HvDialog","classes","className","id","children","open","onClose","firstFocusable","buttonTitle","fullscreen","others","focusableQueue","setFocusableQueue","measuredRef","node","focusableList","first","last","length","focus","element","document","getElementById","console","warn","keyDownHandler","event","Tab","target","shiftKey","preventDefault","Esc","onEscapeKeyDown","disableEscapeKeyDown","stopPropagation","closeButtonDisplay","CloseButtonTooltipWrapper","root","paper","background","reason","closeButton","Children","map","c","cloneElement","propTypes","string","shape","isRequired","bool","func","name"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,WAAhB,EAA6BC,QAA7B,QAA6C,OAA7C;AACA,OAAOC,IAAP,MAAiB,MAAjB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,MAAT,EAAiBC,UAAjB,QAAmC,mBAAnC;AACA,SAASC,KAAT,QAAsB,mCAAtB;AACA,OAAOC,KAAP,MAAkB,cAAlB;AACA,OAAOC,MAAP,MAAmB,WAAnB;AACA,SAASC,UAAT,EAAqBC,aAArB,EAAoCC,KAApC,QAAiD,UAAjD;AACA,OAAOC,MAAP,MAAmB,UAAnB;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,SAASC,gBAAT,QAAiC,iCAAjC;AAEA;AACA;AACA;AACA;;AACA,IAAM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AC8C,SAAT,GAAqB;AACnB;AACF;AACA;AACE5C,EAAAA,SAAS,EAAEd,SAAS,CAAC2D,MAJF;;AAKnB;AACF;AACA;AACE5C,EAAAA,EAAE,EAAEf,SAAS,CAAC2D,MARK;;AASnB;AACF;AACA;AACE9C,EAAAA,OAAO,EAAEb,SAAS,CAAC4D,KAAV,CAAgB;AACvB;AACJ;AACA;AACIX,IAAAA,IAAI,EAAEjD,SAAS,CAAC2D,MAJO;;AAKvB;AACJ;AACA;AACIR,IAAAA,UAAU,EAAEnD,SAAS,CAAC2D,MARC;;AASvB;AACJ;AACA;AACIT,IAAAA,KAAK,EAAElD,SAAS,CAAC2D,MAZM;;AAavB;AACJ;AACA;AACIN,IAAAA,WAAW,EAAErD,SAAS,CAAC2D;AAhBA,GAAhB,EAiBNE,UA7BgB;;AA8BnB;AACF;AACA;AACE7C,EAAAA,QAAQ,EAAEhB,SAAS,CAAC0B,IAAV,CAAemC,UAjCN;;AAkCnB;AACF;AACA;AACE5C,EAAAA,IAAI,EAAEjB,SAAS,CAAC8D,IAAV,CAAeD,UArCF;;AAsCnB;AACF;AACA;AACE3C,EAAAA,OAAO,EAAElB,SAAS,CAAC+D,IAAV,CAAeF,UAzCL;;AA0CnB;AACF;AACA;AACE1C,EAAAA,cAAc,EAAEnB,SAAS,CAAC2D,MA7CP;;AA8CnB;AACF;AACA;AACEvC,EAAAA,WAAW,EAAEpB,SAAS,CAAC2D,MAjDJ;;AAkDnB;AACF;AACA;AACEtC,EAAAA,UAAU,EAAErB,SAAS,CAAC8D;AArDH,CAArB;AAwDA,eAAe5D,UAAU,CAACO,MAAD,EAAS;AAAEuD,EAAAA,IAAI,EAAE;AAAR,CAAT,CAAV,CAAyCpD,QAAzC,CAAf","sourcesContent":["import React, { useCallback, useState } from \"react\";\nimport clsx from \"clsx\";\nimport PropTypes from \"prop-types\";\nimport { Dialog, withStyles } from \"@material-ui/core\";\nimport { Close } from \"@hitachivantara/uikit-react-icons\";\nimport isNil from \"lodash/isNil\";\nimport Button from \"../Button\";\nimport { isKeypress, KeyboardCodes, setId } from \"../utils\";\nimport styles from \"./styles\";\nimport withTooltip from \"../withTooltip\";\nimport { getFocusableList } from \"../utils/focusableElementFinder\";\n\n/**\n * The Dialog component provides a solid foundation for creating dialogs, popovers, lightboxes, etc.\n * It is created by the composition of DialogTitle, DialogContent and DialogActions components, passed as child elements.\n */\nconst HvDialog = ({\n classes,\n className,\n id,\n children,\n open,\n onClose,\n firstFocusable,\n buttonTitle = \"Close\",\n fullscreen = false,\n ...others\n}) => {\n const [focusableQueue, setFocusableQueue] = useState(null);\n\n const measuredRef = useCallback(\n (node) => {\n if (node) {\n const focusableList = getFocusableList(node);\n setFocusableQueue({\n first: focusableList[1],\n last: focusableList[focusableList.length - 2],\n });\n if (isNil(firstFocusable)) focusableList[1].focus();\n else {\n const element = document.getElementById(firstFocusable);\n if (element) element.focus();\n else {\n // eslint-disable-next-line no-console\n console.warn(`firstFocusable element ${firstFocusable} not found.`);\n focusableList[1].focus();\n }\n }\n }\n },\n [firstFocusable]\n );\n\n const keyDownHandler = (event) => {\n if (isKeypress(event, KeyboardCodes.Tab) && !isNil(event.target) && !isNil(focusableQueue)) {\n if (event.shiftKey && event.target === focusableQueue.first) {\n focusableQueue.last.focus();\n event.preventDefault();\n }\n if (!event.shiftKey && event.target === focusableQueue.last) {\n focusableQueue.first.focus();\n event.preventDefault();\n }\n }\n // Needed as this handler overrides the one in the material ui Modal.\n else if (isKeypress(event, KeyboardCodes.Esc)) {\n if (others.onEscapeKeyDown) {\n others.onEscapeKeyDown(event);\n }\n\n if (!others.disableEscapeKeyDown) {\n // Swallow the event, in case someone is listening for the escape key on the body.\n event.stopPropagation();\n\n if (onClose) {\n onClose(event, \"escapeKeyDown\");\n }\n }\n }\n };\n\n const closeButtonDisplay = () => <Close role=\"presentation\" />;\n\n const CloseButtonTooltipWrapper = buttonTitle\n ? withTooltip(closeButtonDisplay, buttonTitle, \"top\")\n : closeButtonDisplay;\n\n return (\n <Dialog\n className={clsx(classes.root, className)}\n id={id}\n ref={measuredRef}\n open={open}\n PaperProps={{\n classes: {\n root: clsx(classes.paper, fullscreen ? \"fullscreen\" : \"\"),\n },\n }}\n fullScreen={fullscreen}\n BackdropProps={{\n classes: {\n root: classes.background,\n },\n }}\n onClose={(event, reason) => onClose(event, reason)}\n onKeyDown={keyDownHandler}\n {...others}\n >\n <div aria-modal>\n <Button\n id={setId(id, \"close\")}\n className={classes.closeButton}\n category=\"ghost\"\n onClick={(event) => onClose(event)}\n aria-label={buttonTitle}\n >\n <CloseButtonTooltipWrapper />\n </Button>\n {children && typeof children === \"object\"\n ? React.Children.map(children, (c) => React.cloneElement(c, { fullscreen }))\n : children}\n </div>\n </Dialog>\n );\n};\n\nHvDialog.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * Id to be applied to the root node.\n */\n id: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Style applied to the root of the component.\n */\n root: PropTypes.string,\n /**\n * Style applied to the background (outside) of the component.\n */\n background: PropTypes.string,\n /**\n * Style applied to the component (root).\n */\n paper: PropTypes.string,\n /**\n * Style applied to the close button.\n */\n closeButton: PropTypes.string,\n }).isRequired,\n /**\n * Components of the Dialog.\n */\n children: PropTypes.node.isRequired,\n /**\n * Current state of the Dialog.\n */\n open: PropTypes.bool.isRequired,\n /**\n * Function executed on close.\n */\n onClose: PropTypes.func.isRequired,\n /**\n * Element id that should be focus when the Dialog opens.\n */\n firstFocusable: PropTypes.string,\n /**\n * Title for the button close.\n */\n buttonTitle: PropTypes.string,\n /**\n * Set the dialog to fullscreen mode.\n */\n fullscreen: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvDialog\" })(HvDialog);\n"],"file":"Dialog.js"}
@@ -1,7 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["classes", "className", "children"];
3
+ var _excluded = ["classes", "className", "children", "fullscreen"];
4
4
  import React from "react";
5
+ import clsx from "clsx";
5
6
  import PropTypes from "prop-types";
6
7
  import { DialogActions, withStyles } from "@material-ui/core";
7
8
  import styles from "./styles";
@@ -10,11 +11,13 @@ var HvDialogActions = function HvDialogActions(props) {
10
11
  var classes = props.classes,
11
12
  className = props.className,
12
13
  children = props.children,
14
+ _props$fullscreen = props.fullscreen,
15
+ fullscreen = _props$fullscreen === void 0 ? false : _props$fullscreen,
13
16
  others = _objectWithoutProperties(props, _excluded);
14
17
 
15
18
  return /*#__PURE__*/React.createElement(DialogActions, _extends({
16
19
  classes: {
17
- root: classes.root,
20
+ root: clsx(classes.root, fullscreen && classes.fullscreen),
18
21
  spacing: classes.spacing
19
22
  },
20
23
  className: className
@@ -39,13 +42,23 @@ process.env.NODE_ENV !== "production" ? HvDialogActions.propTypes = {
39
42
  /**
40
43
  * Style applied to the root of the component if disableSpacing is off.
41
44
  */
42
- spacing: PropTypes.string
45
+ spacing: PropTypes.string,
46
+
47
+ /**
48
+ * Style applied to the root of the component if fullscreen is on.
49
+ */
50
+ fullscreen: PropTypes.string
43
51
  }).isRequired,
44
52
 
45
53
  /**
46
54
  * Actions of the Dialog.
47
55
  */
48
- children: PropTypes.node.isRequired
56
+ children: PropTypes.node.isRequired,
57
+
58
+ /**
59
+ * Whether or not the dialog is in fullscreen mode.
60
+ */
61
+ fullscreen: PropTypes.bool
49
62
  } : void 0;
50
63
  export default withStyles(styles, {
51
64
  name: "HvDialogActions"
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/Dialog/DialogActions/DialogActions.js"],"names":["React","PropTypes","DialogActions","withStyles","styles","HvDialogActions","props","classes","className","children","others","root","spacing","propTypes","string","shape","isRequired","node","name"],"mappings":";;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,aAAT,EAAwBC,UAAxB,QAA0C,mBAA1C;AACA,OAAOC,MAAP,MAAmB,UAAnB;;AAEA,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,CAACC,KAAD,EAAW;AACjC,MAAQC,OAAR,GAAoDD,KAApD,CAAQC,OAAR;AAAA,MAAiBC,SAAjB,GAAoDF,KAApD,CAAiBE,SAAjB;AAAA,MAA4BC,QAA5B,GAAoDH,KAApD,CAA4BG,QAA5B;AAAA,MAAyCC,MAAzC,4BAAoDJ,KAApD;;AACA,sBACE,oBAAC,aAAD;AACE,IAAA,OAAO,EAAE;AACPK,MAAAA,IAAI,EAAEJ,OAAO,CAACI,IADP;AAEPC,MAAAA,OAAO,EAAEL,OAAO,CAACK;AAFV,KADX;AAKE,IAAA,SAAS,EAAEJ;AALb,KAMME,MANN,GAQGD,QARH,CADF;AAYD,CAdD;;AAgBA,wCAAAJ,eAAe,CAACQ,SAAhB,GAA4B;AAC1B;AACF;AACA;AACEL,EAAAA,SAAS,EAAEP,SAAS,CAACa,MAJK;;AAK1B;AACF;AACA;AACEP,EAAAA,OAAO,EAAEN,SAAS,CAACc,KAAV,CAAgB;AACvB;AACJ;AACA;AACIJ,IAAAA,IAAI,EAAEV,SAAS,CAACa,MAJO;;AAKvB;AACJ;AACA;AACIF,IAAAA,OAAO,EAAEX,SAAS,CAACa;AARI,GAAhB,EASNE,UAjBuB;;AAkB1B;AACF;AACA;AACEP,EAAAA,QAAQ,EAAER,SAAS,CAACgB,IAAV,CAAeD;AArBC,CAA5B;AAwBA,eAAeb,UAAU,CAACC,MAAD,EAAS;AAAEc,EAAAA,IAAI,EAAE;AAAR,CAAT,CAAV,CAAgDb,eAAhD,CAAf","sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport { DialogActions, withStyles } from \"@material-ui/core\";\nimport styles from \"./styles\";\n\nconst HvDialogActions = (props) => {\n const { classes, className, children, ...others } = props;\n return (\n <DialogActions\n classes={{\n root: classes.root,\n spacing: classes.spacing,\n }}\n className={className}\n {...others}\n >\n {children}\n </DialogActions>\n );\n};\n\nHvDialogActions.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Style applied to the root of the component (container for the actions).\n */\n root: PropTypes.string,\n /**\n * Style applied to the root of the component if disableSpacing is off.\n */\n spacing: PropTypes.string,\n }).isRequired,\n /**\n * Actions of the Dialog.\n */\n children: PropTypes.node.isRequired,\n};\n\nexport default withStyles(styles, { name: \"HvDialogActions\" })(HvDialogActions);\n"],"file":"DialogActions.js"}
1
+ {"version":3,"sources":["../../../../src/Dialog/DialogActions/DialogActions.js"],"names":["React","clsx","PropTypes","DialogActions","withStyles","styles","HvDialogActions","props","classes","className","children","fullscreen","others","root","spacing","propTypes","string","shape","isRequired","node","bool","name"],"mappings":";;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,IAAP,MAAiB,MAAjB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,aAAT,EAAwBC,UAAxB,QAA0C,mBAA1C;AACA,OAAOC,MAAP,MAAmB,UAAnB;;AAEA,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,CAACC,KAAD,EAAW;AACjC,MAAQC,OAAR,GAAwED,KAAxE,CAAQC,OAAR;AAAA,MAAiBC,SAAjB,GAAwEF,KAAxE,CAAiBE,SAAjB;AAAA,MAA4BC,QAA5B,GAAwEH,KAAxE,CAA4BG,QAA5B;AAAA,0BAAwEH,KAAxE,CAAsCI,UAAtC;AAAA,MAAsCA,UAAtC,kCAAmD,KAAnD;AAAA,MAA6DC,MAA7D,4BAAwEL,KAAxE;;AACA,sBACE,oBAAC,aAAD;AACE,IAAA,OAAO,EAAE;AACPM,MAAAA,IAAI,EAAEZ,IAAI,CAACO,OAAO,CAACK,IAAT,EAAeF,UAAf,IAA6BH,OAAO,CAACG,UAArC,CADH;AAEPG,MAAAA,OAAO,EAAEN,OAAO,CAACM;AAFV,KADX;AAKE,IAAA,SAAS,EAAEL;AALb,KAMMG,MANN,GAQGF,QARH,CADF;AAYD,CAdD;;AAgBA,wCAAAJ,eAAe,CAACS,SAAhB,GAA4B;AAC1B;AACF;AACA;AACEN,EAAAA,SAAS,EAAEP,SAAS,CAACc,MAJK;;AAK1B;AACF;AACA;AACER,EAAAA,OAAO,EAAEN,SAAS,CAACe,KAAV,CAAgB;AACvB;AACJ;AACA;AACIJ,IAAAA,IAAI,EAAEX,SAAS,CAACc,MAJO;;AAKvB;AACJ;AACA;AACIF,IAAAA,OAAO,EAAEZ,SAAS,CAACc,MARI;;AASvB;AACJ;AACA;AACIL,IAAAA,UAAU,EAAET,SAAS,CAACc;AAZC,GAAhB,EAaNE,UArBuB;;AAsB1B;AACF;AACA;AACER,EAAAA,QAAQ,EAAER,SAAS,CAACiB,IAAV,CAAeD,UAzBC;;AA0B1B;AACF;AACA;AACEP,EAAAA,UAAU,EAAET,SAAS,CAACkB;AA7BI,CAA5B;AAgCA,eAAehB,UAAU,CAACC,MAAD,EAAS;AAAEgB,EAAAA,IAAI,EAAE;AAAR,CAAT,CAAV,CAAgDf,eAAhD,CAAf","sourcesContent":["import React from \"react\";\nimport clsx from \"clsx\";\nimport PropTypes from \"prop-types\";\nimport { DialogActions, withStyles } from \"@material-ui/core\";\nimport styles from \"./styles\";\n\nconst HvDialogActions = (props) => {\n const { classes, className, children, fullscreen = false, ...others } = props;\n return (\n <DialogActions\n classes={{\n root: clsx(classes.root, fullscreen && classes.fullscreen),\n spacing: classes.spacing,\n }}\n className={className}\n {...others}\n >\n {children}\n </DialogActions>\n );\n};\n\nHvDialogActions.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Style applied to the root of the component (container for the actions).\n */\n root: PropTypes.string,\n /**\n * Style applied to the root of the component if disableSpacing is off.\n */\n spacing: PropTypes.string,\n /**\n * Style applied to the root of the component if fullscreen is on.\n */\n fullscreen: PropTypes.string,\n }).isRequired,\n /**\n * Actions of the Dialog.\n */\n children: PropTypes.node.isRequired,\n /**\n * Whether or not the dialog is in fullscreen mode.\n */\n fullscreen: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvDialogActions\" })(HvDialogActions);\n"],"file":"DialogActions.js"}
@@ -9,6 +9,12 @@ var styles = function styles(theme) {
9
9
  "& > :not(:first-child)": {
10
10
  marginLeft: theme.hv.spacing.xs
11
11
  }
12
+ },
13
+ fullscreen: {
14
+ position: "fixed",
15
+ width: "100%",
16
+ bottom: 0,
17
+ left: 0
12
18
  }
13
19
  };
14
20
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/Dialog/DialogActions/styles.js"],"names":["styles","theme","root","margin","padding","hv","spacing","sm","borderTop","palette","atmosphere","atmo2","marginLeft","xs"],"mappings":"AAAA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,IAAI,EAAE;AACJC,MAAAA,MAAM,EAAE,GADJ;AAEJC,MAAAA,OAAO,EAAEH,KAAK,CAACI,EAAN,CAASC,OAAT,CAAiBC,EAFtB;AAGJC,MAAAA,SAAS,sBAAeP,KAAK,CAACI,EAAN,CAASI,OAAT,CAAiBC,UAAjB,CAA4BC,KAA3C;AAHL,KADmB;AAMzBL,IAAAA,OAAO,EAAE;AACP,gCAA0B;AACxBM,QAAAA,UAAU,EAAEX,KAAK,CAACI,EAAN,CAASC,OAAT,CAAiBO;AADL;AADnB;AANgB,GAAZ;AAAA,CAAf;;AAaA,eAAeb,MAAf","sourcesContent":["const styles = (theme) => ({\n root: {\n margin: \"0\",\n padding: theme.hv.spacing.sm,\n borderTop: `3px solid ${theme.hv.palette.atmosphere.atmo2}`,\n },\n spacing: {\n \"& > :not(:first-child)\": {\n marginLeft: theme.hv.spacing.xs,\n },\n },\n});\n\nexport default styles;\n"],"file":"styles.js"}
1
+ {"version":3,"sources":["../../../../src/Dialog/DialogActions/styles.js"],"names":["styles","theme","root","margin","padding","hv","spacing","sm","borderTop","palette","atmosphere","atmo2","marginLeft","xs","fullscreen","position","width","bottom","left"],"mappings":"AAAA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,IAAI,EAAE;AACJC,MAAAA,MAAM,EAAE,GADJ;AAEJC,MAAAA,OAAO,EAAEH,KAAK,CAACI,EAAN,CAASC,OAAT,CAAiBC,EAFtB;AAGJC,MAAAA,SAAS,sBAAeP,KAAK,CAACI,EAAN,CAASI,OAAT,CAAiBC,UAAjB,CAA4BC,KAA3C;AAHL,KADmB;AAMzBL,IAAAA,OAAO,EAAE;AACP,gCAA0B;AACxBM,QAAAA,UAAU,EAAEX,KAAK,CAACI,EAAN,CAASC,OAAT,CAAiBO;AADL;AADnB,KANgB;AAWzBC,IAAAA,UAAU,EAAE;AACVC,MAAAA,QAAQ,EAAE,OADA;AAEVC,MAAAA,KAAK,EAAE,MAFG;AAGVC,MAAAA,MAAM,EAAE,CAHE;AAIVC,MAAAA,IAAI,EAAE;AAJI;AAXa,GAAZ;AAAA,CAAf;;AAmBA,eAAelB,MAAf","sourcesContent":["const styles = (theme) => ({\n root: {\n margin: \"0\",\n padding: theme.hv.spacing.sm,\n borderTop: `3px solid ${theme.hv.palette.atmosphere.atmo2}`,\n },\n spacing: {\n \"& > :not(:first-child)\": {\n marginLeft: theme.hv.spacing.xs,\n },\n },\n fullscreen: {\n position: \"fixed\",\n width: \"100%\",\n bottom: 0,\n left: 0,\n },\n});\n\nexport default styles;\n"],"file":"styles.js"}
@@ -21,7 +21,10 @@ var HvDialogTitle = function HvDialogTitle(_ref) {
21
21
  customIcon = _ref$customIcon === void 0 ? null : _ref$customIcon,
22
22
  others = _objectWithoutProperties(_ref, _excluded);
23
23
 
24
- var isString = typeof children === "string";
24
+ var isString = typeof children === "string"; // prevent the `fullscreen` prop from being passed to the `DialogTitle` component
25
+ // eslint-disable-next-line no-param-reassign
26
+
27
+ delete others.fullscreen;
25
28
  var icon = customIcon || showIcon && iconVariant(variant);
26
29
  return /*#__PURE__*/React.createElement(DialogTitle, _extends({
27
30
  className: clsx(classes.root, className),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/Dialog/DialogTitle/DialogTitle.js"],"names":["React","PropTypes","clsx","DialogTitle","withStyles","HvTypography","iconVariant","styles","HvDialogTitle","classes","className","children","variant","showIcon","customIcon","others","isString","icon","root","messageContainer","textWithIcon","propTypes","string","shape","closeButton","isRequired","oneOf","bool","node","name"],"mappings":";;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,IAAP,MAAiB,MAAjB;AACA,SAASC,WAAT,EAAsBC,UAAtB,QAAwC,mBAAxC;AACA,OAAOC,YAAP,MAAyB,kBAAzB;AACA,OAAOC,WAAP,MAAwB,yBAAxB;AACA,OAAOC,MAAP,MAAmB,UAAnB;;AAEA,IAAMC,aAAa,GAAG,SAAhBA,aAAgB,OAQhB;AAAA,MAPJC,OAOI,QAPJA,OAOI;AAAA,MANJC,SAMI,QANJA,SAMI;AAAA,MALJC,QAKI,QALJA,QAKI;AAAA,0BAJJC,OAII;AAAA,MAJJA,OAII,6BAJM,SAIN;AAAA,2BAHJC,QAGI;AAAA,MAHJA,QAGI,8BAHO,IAGP;AAAA,6BAFJC,UAEI;AAAA,MAFJA,UAEI,gCAFS,IAET;AAAA,MADDC,MACC;;AACJ,MAAMC,QAAQ,GAAG,OAAOL,QAAP,KAAoB,QAArC;AAEA,MAAMM,IAAI,GAAGH,UAAU,IAAKD,QAAQ,IAAIP,WAAW,CAACM,OAAD,CAAnD;AAEA,sBACE,oBAAC,WAAD;AAAa,IAAA,SAAS,EAAEV,IAAI,CAACO,OAAO,CAACS,IAAT,EAAeR,SAAf,CAA5B;AAAuD,IAAA,iBAAiB;AAAxE,KAA6EK,MAA7E,gBACE;AAAK,IAAA,SAAS,EAAEN,OAAO,CAACU;AAAxB,K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,CAA8CrB,aAA9C,CAAf","sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\nimport { DialogTitle, withStyles } from \"@material-ui/core\";\nimport HvTypography from \"../../Typography\";\nimport iconVariant from \"../../utils/iconVariant\";\nimport styles from \"./styles\";\n\nconst HvDialogTitle = ({\n classes,\n className,\n children,\n variant = \"default\",\n showIcon = true,\n customIcon = null,\n ...others\n}) => {\n const isString = typeof children === \"string\";\n\n const icon = customIcon || (showIcon && iconVariant(variant));\n\n return (\n <DialogTitle className={clsx(classes.root, className)} disableTypography {...others}>\n <div className={classes.messageContainer}>\n {icon}\n <div className={clsx({ [classes.textWithIcon]: icon })}>\n {!isString && children}\n {isString && <HvTypography variant=\"xxsTitle\">{children}</HvTypography>}\n </div>\n </div>\n </DialogTitle>\n );\n};\n\nHvDialogTitle.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Style applied to the root of the component (container for the title).\n */\n root: PropTypes.string,\n /**\n * Style applied to the container of the title\n */\n messageContainer: PropTypes.string,\n /**\n * Style applied to the text when the icon is present.\n */\n textWithIcon: PropTypes.string,\n /**\n * Style applied to the icon.\n */\n icon: PropTypes.string,\n /**\n * Style applied to the close button.\n */\n closeButton: PropTypes.string,\n }).isRequired,\n /**\n * Variant of the Dialog.\n */\n variant: PropTypes.oneOf([\"success\", \"warning\", \"error\", \"info\", \"default\"]),\n /**\n * Controls if the associated icon to the variant should be shown.\n */\n showIcon: PropTypes.bool,\n /**\n * Custom icon to replace the variant default.\n */\n customIcon: PropTypes.node,\n /**\n * Node to be render.\n */\n children: PropTypes.node.isRequired,\n};\n\nexport default withStyles(styles, { name: \"HvDialogTitle\" })(HvDialogTitle);\n"],"file":"DialogTitle.js"}
1
+ {"version":3,"sources":["../../../../src/Dialog/DialogTitle/DialogTitle.js"],"names":["React","PropTypes","clsx","DialogTitle","withStyles","HvTypography","iconVariant","styles","HvDialogTitle","classes","className","children","variant","showIcon","customIcon","others","isString","fullscreen","icon","root","messageContainer","textWithIcon","propTypes","string","shape","closeButton","isRequired","oneOf","bool","node","name"],"mappings":";;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,IAAP,MAAiB,MAAjB;AACA,SAASC,WAAT,EAAsBC,UAAtB,QAAwC,mBAAxC;AACA,OAAOC,YAAP,MAAyB,kBAAzB;AACA,OAAOC,WAAP,MAAwB,yBAAxB;AACA,OAAOC,MAAP,MAAmB,UAAnB;;AAEA,IAAMC,aAAa,GAAG,SAAhBA,aAAgB,OAQhB;AAAA,MAPJC,OAOI,QAPJA,OAOI;AAAA,MANJC,SAMI,QANJA,SAMI;AAAA,MALJC,QAKI,QALJA,QAKI;AAAA,0BAJJC,OAII;AAAA,MAJJA,OAII,6BAJM,SAIN;AAAA,2BAHJC,QAGI;AAAA,MAHJA,QAGI,8BAHO,IAGP;AAAA,6BAFJC,UAEI;AAAA,MAFJA,UAEI,gCAFS,IAET;AAAA,MADDC,MACC;;AACJ,MAAMC,QAAQ,GAAG,OAAOL,QAAP,KAAoB,QAArC,CADI,CAEJ;AACA;;AACA,SAAOI,MAAM,CAACE,UAAd;AAEA,MAAMC,IAAI,GAAGJ,UAAU,IAAKD,QAAQ,IAAIP,WAAW,CAACM,OAAD,CAAnD;AAEA,sBACE,oBAAC,WAAD;AAAa,IAAA,SAAS,EAAEV,IAAI,CAACO,OAAO,CAACU,IAAT,EAAeT,SAAf,CAA5B;AAAuD,IAAA,iBAAiB;AAAxE,KAA6EK,MAA7E,gBACE;AAAK,IAAA,SAAS,EAAEN,OAAO,CAACW;AAAxB,KACGF,IADH,eAEE;AAAK,IAAA,SAAS,EAAEhB,IAAI,CAA2BgB,IAA3B,IAAIT,OAAO,CAACY,YAAZ;AAApB,KACG,CAACL,QAAD,IAAaL,QADhB,EAEGK,QAAQ,iBAAI,oBAAC,YAAD;AAAc,IAAA,OAAO,EAAC;AAAtB,KAAkCL,QAAlC,CAFf,CAFF,CADF,CADF;AAWD,CA3BD;;AA6BA,wCAAAH,aAAa,CAACc,SAAd,GAA0B;AACxB;AACF;AACA;AACEZ,EAAAA,SAAS,EAAET,SAAS,CAACsB,MAJG;;AAKxB;AACF;AACA;AACEd,EAAAA,OAAO,EAAER,SAAS,CAACuB,KAAV,CAAgB;AACvB;AACJ;AACA;AACIL,IAAAA,IAAI,EAAElB,SAAS,CAACsB,MAJO;;AAKvB;AACJ;AACA;AACIH,IAAAA,gBAAgB,EAAEnB,SAAS,CAACsB,MARL;;AASvB;AACJ;AACA;AACIF,IAAAA,YAAY,EAAEpB,SAAS,CAACsB,MAZD;;AAavB;AACJ;AACA;AACIL,IAAAA,IAAI,EAAEjB,SAAS,CAACsB,MAhBO;;AAiBvB;AACJ;AACA;AACIE,IAAAA,WAAW,EAAExB,SAAS,CAACsB;AApBA,GAAhB,EAqBNG,UA7BqB;;AA8BxB;AACF;AACA;AACEd,EAAAA,OAAO,EAAEX,SAAS,CAAC0B,KAAV,CAAgB,CAAC,SAAD,EAAY,SAAZ,EAAuB,OAAvB,EAAgC,MAAhC,EAAwC,SAAxC,CAAhB,CAjCe;;AAkCxB;AACF;AACA;AACEd,EAAAA,QAAQ,EAAEZ,SAAS,CAAC2B,IArCI;;AAsCxB;AACF;AACA;AACEd,EAAAA,UAAU,EAAEb,SAAS,CAAC4B,IAzCE;;AA0CxB;AACF;AACA;AACElB,EAAAA,QAAQ,EAAEV,SAAS,CAAC4B,IAAV,CAAeH;AA7CD,CAA1B;AAgDA,eAAetB,UAAU,CAACG,MAAD,EAAS;AAAEuB,EAAAA,IAAI,EAAE;AAAR,CAAT,CAAV,CAA8CtB,aAA9C,CAAf","sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\nimport { DialogTitle, withStyles } from \"@material-ui/core\";\nimport HvTypography from \"../../Typography\";\nimport iconVariant from \"../../utils/iconVariant\";\nimport styles from \"./styles\";\n\nconst HvDialogTitle = ({\n classes,\n className,\n children,\n variant = \"default\",\n showIcon = true,\n customIcon = null,\n ...others\n}) => {\n const isString = typeof children === \"string\";\n // prevent the `fullscreen` prop from being passed to the `DialogTitle` component\n // eslint-disable-next-line no-param-reassign\n delete others.fullscreen;\n\n const icon = customIcon || (showIcon && iconVariant(variant));\n\n return (\n <DialogTitle className={clsx(classes.root, className)} disableTypography {...others}>\n <div className={classes.messageContainer}>\n {icon}\n <div className={clsx({ [classes.textWithIcon]: icon })}>\n {!isString && children}\n {isString && <HvTypography variant=\"xxsTitle\">{children}</HvTypography>}\n </div>\n </div>\n </DialogTitle>\n );\n};\n\nHvDialogTitle.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Style applied to the root of the component (container for the title).\n */\n root: PropTypes.string,\n /**\n * Style applied to the container of the title\n */\n messageContainer: PropTypes.string,\n /**\n * Style applied to the text when the icon is present.\n */\n textWithIcon: PropTypes.string,\n /**\n * Style applied to the icon.\n */\n icon: PropTypes.string,\n /**\n * Style applied to the close button.\n */\n closeButton: PropTypes.string,\n }).isRequired,\n /**\n * Variant of the Dialog.\n */\n variant: PropTypes.oneOf([\"success\", \"warning\", \"error\", \"info\", \"default\"]),\n /**\n * Controls if the associated icon to the variant should be shown.\n */\n showIcon: PropTypes.bool,\n /**\n * Custom icon to replace the variant default.\n */\n customIcon: PropTypes.node,\n /**\n * Node to be render.\n */\n children: PropTypes.node.isRequired,\n};\n\nexport default withStyles(styles, { name: \"HvDialogTitle\" })(HvDialogTitle);\n"],"file":"DialogTitle.js"}
@@ -9,7 +9,10 @@ var styles = function styles(theme) {
9
9
  background: "".concat(theme.hv.palette.atmosphere.atmo1),
10
10
  padding: "0px",
11
11
  overflow: "auto",
12
- boxShadow: theme.hv.shadows[1]
12
+ boxShadow: theme.hv.shadows[1],
13
+ "&:not(.fullscreen)": {
14
+ maxHeight: "calc(100% - 200px)"
15
+ }
13
16
  },
14
17
  closeButton: {
15
18
  padding: 0,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Dialog/styles.js"],"names":["fade","styles","theme","background","hv","palette","atmosphere","atmo4","paper","atmo1","padding","overflow","boxShadow","shadows","closeButton","minWidth","position","top","hvSpacing","right"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,oBAAjB;;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,UAAU,EAAE;AACVA,MAAAA,UAAU,EAAEH,IAAI,CAACE,KAAK,CAACE,EAAN,CAASC,OAAT,CAAiBC,UAAjB,CAA4BC,KAA7B,EAAoC,GAApC;AADN,KADa;AAIzBC,IAAAA,KAAK,EAAE;AACLL,MAAAA,UAAU,YAAKD,KAAK,CAACE,EAAN,CAASC,OAAT,CAAiBC,UAAjB,CAA4BG,KAAjC,CADL;AAELC,MAAAA,OAAO,EAAE,KAFJ;AAGLC,MAAAA,QAAQ,EAAE,MAHL;AAILC,MAAAA,SAAS,EAAEV,KAAK,CAACE,EAAN,CAASS,OAAT,CAAiB,CAAjB;AAJN,KAJkB;AAUzBC,IAAAA,WAAW,EAAE;AACXJ,MAAAA,OAAO,EAAE,CADE;AAEXK,MAAAA,QAAQ,EAAE,SAFC;AAGXC,MAAAA,QAAQ,EAAE,UAHC;AAIXC,MAAAA,GAAG,EAAEf,KAAK,CAACgB,SAAN,CAAgB,IAAhB,CAJM;AAKXC,MAAAA,KAAK,EAAEjB,KAAK,CAACgB,SAAN,CAAgB,IAAhB;AALI;AAVY,GAAZ;AAAA,CAAf;;AAmBA,eAAejB,MAAf","sourcesContent":["import fade from \"../utils/hexToRgbA\";\n\nconst styles = (theme) => ({\n background: {\n background: fade(theme.hv.palette.atmosphere.atmo4, 0.8),\n },\n paper: {\n background: `${theme.hv.palette.atmosphere.atmo1}`,\n padding: \"0px\",\n overflow: \"auto\",\n boxShadow: theme.hv.shadows[1],\n },\n closeButton: {\n padding: 0,\n minWidth: \"inherit\",\n position: \"absolute\",\n top: theme.hvSpacing(\"sm\"),\n right: theme.hvSpacing(\"sm\"),\n },\n});\n\nexport default styles;\n"],"file":"styles.js"}
1
+ {"version":3,"sources":["../../../src/Dialog/styles.js"],"names":["fade","styles","theme","background","hv","palette","atmosphere","atmo4","paper","atmo1","padding","overflow","boxShadow","shadows","maxHeight","closeButton","minWidth","position","top","hvSpacing","right"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,oBAAjB;;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,UAAU,EAAE;AACVA,MAAAA,UAAU,EAAEH,IAAI,CAACE,KAAK,CAACE,EAAN,CAASC,OAAT,CAAiBC,UAAjB,CAA4BC,KAA7B,EAAoC,GAApC;AADN,KADa;AAIzBC,IAAAA,KAAK,EAAE;AACLL,MAAAA,UAAU,YAAKD,KAAK,CAACE,EAAN,CAASC,OAAT,CAAiBC,UAAjB,CAA4BG,KAAjC,CADL;AAELC,MAAAA,OAAO,EAAE,KAFJ;AAGLC,MAAAA,QAAQ,EAAE,MAHL;AAILC,MAAAA,SAAS,EAAEV,KAAK,CAACE,EAAN,CAASS,OAAT,CAAiB,CAAjB,CAJN;AAKL,4BAAsB;AACpBC,QAAAA,SAAS,EAAE;AADS;AALjB,KAJkB;AAazBC,IAAAA,WAAW,EAAE;AACXL,MAAAA,OAAO,EAAE,CADE;AAEXM,MAAAA,QAAQ,EAAE,SAFC;AAGXC,MAAAA,QAAQ,EAAE,UAHC;AAIXC,MAAAA,GAAG,EAAEhB,KAAK,CAACiB,SAAN,CAAgB,IAAhB,CAJM;AAKXC,MAAAA,KAAK,EAAElB,KAAK,CAACiB,SAAN,CAAgB,IAAhB;AALI;AAbY,GAAZ;AAAA,CAAf;;AAsBA,eAAelB,MAAf","sourcesContent":["import fade from \"../utils/hexToRgbA\";\n\nconst styles = (theme) => ({\n background: {\n background: fade(theme.hv.palette.atmosphere.atmo4, 0.8),\n },\n paper: {\n background: `${theme.hv.palette.atmosphere.atmo1}`,\n padding: \"0px\",\n overflow: \"auto\",\n boxShadow: theme.hv.shadows[1],\n \"&:not(.fullscreen)\": {\n maxHeight: \"calc(100% - 200px)\",\n },\n },\n closeButton: {\n padding: 0,\n minWidth: \"inherit\",\n position: \"absolute\",\n top: theme.hvSpacing(\"sm\"),\n right: theme.hvSpacing(\"sm\"),\n },\n});\n\nexport default styles;\n"],"file":"styles.js"}
@@ -11,6 +11,10 @@ export interface HvDialogProps extends StandardProps<DialogProps, HvDialogClassK
11
11
  * Title for the button close.
12
12
  */
13
13
  buttonTitle?: string;
14
+ /**
15
+ * Set the dialog to fullscreen mode.
16
+ */
17
+ fullscreen?: boolean;
14
18
  }
15
19
 
16
20
  export default function HvDialog(props: HvDialogProps): JSX.Element | null;
@@ -3,7 +3,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
3
3
 
4
4
  var _Close;
5
5
 
6
- const _excluded = ["classes", "className", "id", "children", "open", "onClose", "firstFocusable", "buttonTitle"];
6
+ const _excluded = ["classes", "className", "id", "children", "open", "onClose", "firstFocusable", "buttonTitle", "fullscreen"];
7
7
  import "core-js/modules/web.dom-collections.iterator.js";
8
8
  import React, { useCallback, useState } from "react";
9
9
  import clsx from "clsx";
@@ -30,7 +30,8 @@ const HvDialog = _ref => {
30
30
  open,
31
31
  onClose,
32
32
  firstFocusable,
33
- buttonTitle = "Close"
33
+ buttonTitle = "Close",
34
+ fullscreen = false
34
35
  } = _ref,
35
36
  others = _objectWithoutProperties(_ref, _excluded);
36
37
 
@@ -93,9 +94,10 @@ const HvDialog = _ref => {
93
94
  open: open,
94
95
  PaperProps: {
95
96
  classes: {
96
- root: classes.paper
97
+ root: clsx(classes.paper, fullscreen && "fullscreen")
97
98
  }
98
99
  },
100
+ fullScreen: fullscreen,
99
101
  BackdropProps: {
100
102
  classes: {
101
103
  root: classes.background
@@ -111,7 +113,9 @@ const HvDialog = _ref => {
111
113
  category: "ghost",
112
114
  onClick: event => onClose(event),
113
115
  "aria-label": buttonTitle
114
- }, /*#__PURE__*/React.createElement(CloseButtonTooltipWrapper, null)), children));
116
+ }, /*#__PURE__*/React.createElement(CloseButtonTooltipWrapper, null)), children && typeof children === "object" ? React.Children.map(children, c => /*#__PURE__*/React.cloneElement(c, {
117
+ fullscreen
118
+ })) : children));
115
119
  };
116
120
 
117
121
  process.env.NODE_ENV !== "production" ? HvDialog.propTypes = {
@@ -173,7 +177,12 @@ process.env.NODE_ENV !== "production" ? HvDialog.propTypes = {
173
177
  /**
174
178
  * Title for the button close.
175
179
  */
176
- buttonTitle: PropTypes.string
180
+ buttonTitle: PropTypes.string,
181
+
182
+ /**
183
+ * Set the dialog to fullscreen mode.
184
+ */
185
+ fullscreen: PropTypes.bool
177
186
  } : void 0;
178
187
  export default withStyles(styles, {
179
188
  name: "HvDialog"
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Dialog/Dialog.js"],"names":["React","useCallback","useState","clsx","PropTypes","Dialog","withStyles","Close","isNil","Button","isKeypress","KeyboardCodes","setId","styles","withTooltip","getFocusableList","HvDialog","classes","className","id","children","open","onClose","firstFocusable","buttonTitle","others","focusableQueue","setFocusableQueue","measuredRef","node","focusableList","first","last","length","focus","element","document","getElementById","console","warn","keyDownHandler","event","Tab","target","shiftKey","preventDefault","Esc","onEscapeKeyDown","disableEscapeKeyDown","stopPropagation","closeButtonDisplay","CloseButtonTooltipWrapper","root","paper","background","reason","closeButton","propTypes","string","shape","isRequired","bool","func","name"],"mappings":";;;;;;;AAAA,OAAOA,KAAP,IAAgBC,WAAhB,EAA6BC,QAA7B,QAA6C,OAA7C;AACA,OAAOC,IAAP,MAAiB,MAAjB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,MAAT,EAAiBC,UAAjB,QAAmC,mBAAnC;AACA,SAASC,KAAT,QAAsB,mCA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A;AACIJ,IAAAA,UAAU,EAAElD,SAAS,CAACsD,MARC;;AASvB;AACJ;AACA;AACIL,IAAAA,KAAK,EAAEjD,SAAS,CAACsD,MAZM;;AAavB;AACJ;AACA;AACIF,IAAAA,WAAW,EAAEpD,SAAS,CAACsD;AAhBA,GAAhB,EAiBNE,UA7BgB;;AA8BnB;AACF;AACA;AACExC,EAAAA,QAAQ,EAAEhB,SAAS,CAACyB,IAAV,CAAe+B,UAjCN;;AAkCnB;AACF;AACA;AACEvC,EAAAA,IAAI,EAAEjB,SAAS,CAACyD,IAAV,CAAeD,UArCF;;AAsCnB;AACF;AACA;AACEtC,EAAAA,OAAO,EAAElB,SAAS,CAAC0D,IAAV,CAAeF,UAzCL;;AA0CnB;AACF;AACA;AACErC,EAAAA,cAAc,EAAEnB,SAAS,CAACsD,MA7CP;;AA8CnB;AACF;AACA;AACElC,EAAAA,WAAW,EAAEpB,SAAS,CAACsD;AAjDJ,CAArB;AAoDA,eAAepD,UAAU,CAACO,MAAD,EAAS;AAAEkD,EAAAA,IAAI,EAAE;AAAR,CAAT,CAAV,CAAyC/C,QAAzC,CAAf","sourcesContent":["import React, { useCallback, useState } from \"react\";\nimport clsx from \"clsx\";\nimport PropTypes from \"prop-types\";\nimport { Dialog, withStyles } from \"@material-ui/core\";\nimport { Close } from \"@hitachivantara/uikit-react-icons\";\nimport isNil from \"lodash/isNil\";\nimport Button from \"../Button\";\nimport { isKeypress, KeyboardCodes, setId } from \"../utils\";\nimport styles from \"./styles\";\nimport withTooltip from \"../withTooltip\";\nimport { getFocusableList } from \"../utils/focusableElementFinder\";\n\n/**\n * The Dialog component provides a solid foundation for creating dialogs, popovers, lightboxes, etc.\n * It is created by the composition of DialogTitle, DialogContent and DialogActions components, passed as child elements.\n */\nconst HvDialog = ({\n classes,\n className,\n id,\n children,\n open,\n onClose,\n firstFocusable,\n buttonTitle = \"Close\",\n ...others\n}) => {\n const [focusableQueue, setFocusableQueue] = useState(null);\n\n const measuredRef = useCallback(\n (node) => {\n if (node) {\n const focusableList = getFocusableList(node);\n setFocusableQueue({\n first: focusableList[1],\n last: focusableList[focusableList.length - 2],\n });\n if (isNil(firstFocusable)) focusableList[1].focus();\n else {\n const element = document.getElementById(firstFocusable);\n if (element) element.focus();\n else {\n // eslint-disable-next-line no-console\n console.warn(`firstFocusable element ${firstFocusable} not found.`);\n focusableList[1].focus();\n }\n }\n }\n },\n [firstFocusable]\n );\n\n const keyDownHandler = (event) => {\n if (isKeypress(event, KeyboardCodes.Tab) && !isNil(event.target) && !isNil(focusableQueue)) {\n if (event.shiftKey && event.target === focusableQueue.first) {\n focusableQueue.last.focus();\n event.preventDefault();\n }\n if (!event.shiftKey && event.target === focusableQueue.last) {\n focusableQueue.first.focus();\n event.preventDefault();\n }\n }\n // Needed as this handler overrides the one in the material ui Modal.\n else if (isKeypress(event, KeyboardCodes.Esc)) {\n if (others.onEscapeKeyDown) {\n others.onEscapeKeyDown(event);\n }\n\n if (!others.disableEscapeKeyDown) {\n // Swallow the event, in case someone is listening for the escape key on the body.\n event.stopPropagation();\n\n if (onClose) {\n onClose(event, \"escapeKeyDown\");\n }\n }\n }\n };\n\n const closeButtonDisplay = () => <Close role=\"presentation\" />;\n\n const CloseButtonTooltipWrapper = buttonTitle\n ? withTooltip(closeButtonDisplay, buttonTitle, \"top\")\n : closeButtonDisplay;\n\n return (\n <Dialog\n className={clsx(classes.root, className)}\n id={id}\n ref={measuredRef}\n open={open}\n PaperProps={{\n classes: {\n root: classes.paper,\n },\n }}\n BackdropProps={{\n classes: {\n root: classes.background,\n },\n }}\n onClose={(event, reason) => onClose(event, reason)}\n onKeyDown={keyDownHandler}\n {...others}\n >\n <div aria-modal>\n <Button\n id={setId(id, \"close\")}\n className={classes.closeButton}\n category=\"ghost\"\n onClick={(event) => onClose(event)}\n aria-label={buttonTitle}\n >\n <CloseButtonTooltipWrapper />\n </Button>\n {children}\n </div>\n </Dialog>\n );\n};\n\nHvDialog.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * Id to be applied to the root node.\n */\n id: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Style applied to the root of the component.\n */\n root: PropTypes.string,\n /**\n * Style applied to the background (outside) of the component.\n */\n background: PropTypes.string,\n /**\n * Style applied to the component (root).\n */\n paper: PropTypes.string,\n /**\n * Style applied to the close button.\n */\n closeButton: PropTypes.string,\n }).isRequired,\n /**\n * Components of the Dialog.\n */\n children: PropTypes.node.isRequired,\n /**\n * Current state of the Dialog.\n */\n open: PropTypes.bool.isRequired,\n /**\n * Function executed on close.\n */\n onClose: PropTypes.func.isRequired,\n /**\n * Element id that should be focus when the Dialog opens.\n */\n firstFocusable: PropTypes.string,\n /**\n * Title for the button close.\n */\n buttonTitle: PropTypes.string,\n};\n\nexport default withStyles(styles, { name: \"HvDialog\" })(HvDialog);\n"],"file":"Dialog.js"}
1
+ {"version":3,"sources":["../../../src/Dialog/Dialog.js"],"names":["React","useCallback","useState","clsx","PropTypes","Dialog","withStyles","Close","isNil","Button","isKeypress","KeyboardCodes","setId","styles","withTooltip","getFocusableList","HvDialog","classes","className","id","children","open","onClose","firstFocusable","buttonTitle","fullscreen","others","focusableQueue","setFocusableQueue","measuredRef","node","focusableList","first","last","length","focus","element","document","getElementById","console","warn","keyDownHandler","event","Tab","target","shiftKey","preventDefault","Esc","onEscapeKeyDown","disableEscapeKeyDown","stopPropagation","closeButtonDisplay","CloseButtonTooltipWrapper","root","paper","background","reason","closeButton","Children","map","c","cloneElement","propTypes","string","shape","isRequired","bool","func","name"],"mappings":";;;;;;;AAAA,OAAOA,KAAP,IAAgBC,WAAhB,EAA6BC,QAA7B,QAA6C,OAA7C;AACA,OAAOC,IAAP,MAAiB,MAAjB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,MAAT,EAAiBC,UAAjB,QAAmC,mBAAnC;AACA,SAASC,KAAT,QAAsB,mCAAtB;AACA,OAAOC,KAAP,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AAQ,CAAC8C,SAAT,GAAqB;AACnB;AACF;AACA;AACE5C,EAAAA,SAAS,EAAEd,SAAS,CAAC2D,MAJF;;AAKnB;AACF;AACA;AACE5C,EAAAA,EAAE,EAAEf,SAAS,CAAC2D,MARK;;AASnB;AACF;AACA;AACE9C,EAAAA,OAAO,EAAEb,SAAS,CAAC4D,KAAV,CAAgB;AACvB;AACJ;AACA;AACIX,IAAAA,IAAI,EAAEjD,SAAS,CAAC2D,MAJO;;AAKvB;AACJ;AACA;AACIR,IAAAA,UAAU,EAAEnD,SAAS,CAAC2D,MARC;;AASvB;AACJ;AACA;AACIT,IAAAA,KAAK,EAAElD,SAAS,CAAC2D,MAZM;;AAavB;AACJ;AACA;AACIN,IAAAA,WAAW,EAAErD,SAAS,CAAC2D;AAhBA,GAAhB,EAiBNE,UA7BgB;;AA8BnB;AACF;AACA;AACE7C,EAAAA,QAAQ,EAAEhB,SAAS,CAAC0B,IAAV,CAAemC,UAjCN;;AAkCnB;AACF;AACA;AACE5C,EAAAA,IAAI,EAAEjB,SAAS,CAAC8D,IAAV,CAAeD,UArCF;;AAsCnB;AACF;AACA;AACE3C,EAAAA,OAAO,EAAElB,SAAS,CAAC+D,IAAV,CAAeF,UAzCL;;AA0CnB;AACF;AACA;AACE1C,EAAAA,cAAc,EAAEnB,SAAS,CAAC2D,MA7CP;;AA8CnB;AACF;AACA;AACEvC,EAAAA,WAAW,EAAEpB,SAAS,CAAC2D,MAjDJ;;AAkDnB;AACF;AACA;AACEtC,EAAAA,UAAU,EAAErB,SAAS,CAAC8D;AArDH,CAArB;AAwDA,eAAe5D,UAAU,CAACO,MAAD,EAAS;AAAEuD,EAAAA,IAAI,EAAE;AAAR,CAAT,CAAV,CAAyCpD,QAAzC,CAAf","sourcesContent":["import React, { useCallback, useState } from \"react\";\nimport clsx from \"clsx\";\nimport PropTypes from \"prop-types\";\nimport { Dialog, withStyles } from \"@material-ui/core\";\nimport { Close } from \"@hitachivantara/uikit-react-icons\";\nimport isNil from \"lodash/isNil\";\nimport Button from \"../Button\";\nimport { isKeypress, KeyboardCodes, setId } from \"../utils\";\nimport styles from \"./styles\";\nimport withTooltip from \"../withTooltip\";\nimport { getFocusableList } from \"../utils/focusableElementFinder\";\n\n/**\n * The Dialog component provides a solid foundation for creating dialogs, popovers, lightboxes, etc.\n * It is created by the composition of DialogTitle, DialogContent and DialogActions components, passed as child elements.\n */\nconst HvDialog = ({\n classes,\n className,\n id,\n children,\n open,\n onClose,\n firstFocusable,\n buttonTitle = \"Close\",\n fullscreen = false,\n ...others\n}) => {\n const [focusableQueue, setFocusableQueue] = useState(null);\n\n const measuredRef = useCallback(\n (node) => {\n if (node) {\n const focusableList = getFocusableList(node);\n setFocusableQueue({\n first: focusableList[1],\n last: focusableList[focusableList.length - 2],\n });\n if (isNil(firstFocusable)) focusableList[1].focus();\n else {\n const element = document.getElementById(firstFocusable);\n if (element) element.focus();\n else {\n // eslint-disable-next-line no-console\n console.warn(`firstFocusable element ${firstFocusable} not found.`);\n focusableList[1].focus();\n }\n }\n }\n },\n [firstFocusable]\n );\n\n const keyDownHandler = (event) => {\n if (isKeypress(event, KeyboardCodes.Tab) && !isNil(event.target) && !isNil(focusableQueue)) {\n if (event.shiftKey && event.target === focusableQueue.first) {\n focusableQueue.last.focus();\n event.preventDefault();\n }\n if (!event.shiftKey && event.target === focusableQueue.last) {\n focusableQueue.first.focus();\n event.preventDefault();\n }\n }\n // Needed as this handler overrides the one in the material ui Modal.\n else if (isKeypress(event, KeyboardCodes.Esc)) {\n if (others.onEscapeKeyDown) {\n others.onEscapeKeyDown(event);\n }\n\n if (!others.disableEscapeKeyDown) {\n // Swallow the event, in case someone is listening for the escape key on the body.\n event.stopPropagation();\n\n if (onClose) {\n onClose(event, \"escapeKeyDown\");\n }\n }\n }\n };\n\n const closeButtonDisplay = () => <Close role=\"presentation\" />;\n\n const CloseButtonTooltipWrapper = buttonTitle\n ? withTooltip(closeButtonDisplay, buttonTitle, \"top\")\n : closeButtonDisplay;\n\n return (\n <Dialog\n className={clsx(classes.root, className)}\n id={id}\n ref={measuredRef}\n open={open}\n PaperProps={{\n classes: {\n root: clsx(classes.paper, fullscreen ? \"fullscreen\" : \"\"),\n },\n }}\n fullScreen={fullscreen}\n BackdropProps={{\n classes: {\n root: classes.background,\n },\n }}\n onClose={(event, reason) => onClose(event, reason)}\n onKeyDown={keyDownHandler}\n {...others}\n >\n <div aria-modal>\n <Button\n id={setId(id, \"close\")}\n className={classes.closeButton}\n category=\"ghost\"\n onClick={(event) => onClose(event)}\n aria-label={buttonTitle}\n >\n <CloseButtonTooltipWrapper />\n </Button>\n {children && typeof children === \"object\"\n ? React.Children.map(children, (c) => React.cloneElement(c, { fullscreen }))\n : children}\n </div>\n </Dialog>\n );\n};\n\nHvDialog.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * Id to be applied to the root node.\n */\n id: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Style applied to the root of the component.\n */\n root: PropTypes.string,\n /**\n * Style applied to the background (outside) of the component.\n */\n background: PropTypes.string,\n /**\n * Style applied to the component (root).\n */\n paper: PropTypes.string,\n /**\n * Style applied to the close button.\n */\n closeButton: PropTypes.string,\n }).isRequired,\n /**\n * Components of the Dialog.\n */\n children: PropTypes.node.isRequired,\n /**\n * Current state of the Dialog.\n */\n open: PropTypes.bool.isRequired,\n /**\n * Function executed on close.\n */\n onClose: PropTypes.func.isRequired,\n /**\n * Element id that should be focus when the Dialog opens.\n */\n firstFocusable: PropTypes.string,\n /**\n * Title for the button close.\n */\n buttonTitle: PropTypes.string,\n /**\n * Set the dialog to fullscreen mode.\n */\n fullscreen: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvDialog\" })(HvDialog);\n"],"file":"Dialog.js"}
@@ -1,7 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- const _excluded = ["classes", "className", "children"];
3
+ const _excluded = ["classes", "className", "children", "fullscreen"];
4
4
  import React from "react";
5
+ import clsx from "clsx";
5
6
  import PropTypes from "prop-types";
6
7
  import { DialogActions, withStyles } from "@material-ui/core";
7
8
  import styles from "./styles";
@@ -10,13 +11,14 @@ const HvDialogActions = props => {
10
11
  const {
11
12
  classes,
12
13
  className,
13
- children
14
+ children,
15
+ fullscreen = false
14
16
  } = props,
15
17
  others = _objectWithoutProperties(props, _excluded);
16
18
 
17
19
  return /*#__PURE__*/React.createElement(DialogActions, _extends({
18
20
  classes: {
19
- root: classes.root,
21
+ root: clsx(classes.root, fullscreen && classes.fullscreen),
20
22
  spacing: classes.spacing
21
23
  },
22
24
  className: className
@@ -41,13 +43,23 @@ process.env.NODE_ENV !== "production" ? HvDialogActions.propTypes = {
41
43
  /**
42
44
  * Style applied to the root of the component if disableSpacing is off.
43
45
  */
44
- spacing: PropTypes.string
46
+ spacing: PropTypes.string,
47
+
48
+ /**
49
+ * Style applied to the root of the component if fullscreen is on.
50
+ */
51
+ fullscreen: PropTypes.string
45
52
  }).isRequired,
46
53
 
47
54
  /**
48
55
  * Actions of the Dialog.
49
56
  */
50
- children: PropTypes.node.isRequired
57
+ children: PropTypes.node.isRequired,
58
+
59
+ /**
60
+ * Whether or not the dialog is in fullscreen mode.
61
+ */
62
+ fullscreen: PropTypes.bool
51
63
  } : void 0;
52
64
  export default withStyles(styles, {
53
65
  name: "HvDialogActions"
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/Dialog/DialogActions/DialogActions.js"],"names":["React","PropTypes","DialogActions","withStyles","styles","HvDialogActions","props","classes","className","children","others","root","spacing","propTypes","string","shape","isRequired","node","name"],"mappings":";;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,aAAT,EAAwBC,UAAxB,QAA0C,mBAA1C;AACA,OAAOC,MAAP,MAAmB,UAAnB;;AAEA,MAAMC,eAAe,GAAIC,KAAD,IAAW;AACjC,QAAM;AAAEC,IAAAA,OAAF;AAAWC,IAAAA,SAAX;AAAsBC,IAAAA;AAAtB,MAA8CH,KAApD;AAAA,QAAyCI,MAAzC,4BAAoDJ,KAApD;;AACA,sBACE,oBAAC,aAAD;AACE,IAAA,OAAO,EAAE;AACPK,MAAAA,IAAI,EAAEJ,OAAO,CAACI,IADP;AAEPC,MAAAA,OAAO,EAAEL,OAAO,CAACK;AAFV,KADX;AAKE,IAAA,SAAS,EAAEJ;AALb,KAMME,MANN,GAQGD,QARH,CADF;AAYD,CAdD;;AAgBA,wCAAAJ,eAAe,CAACQ,SAAhB,GAA4B;AAC1B;AACF;AACA;AACEL,EAAAA,SAAS,EAAEP,SAAS,CAACa,MAJK;;AAK1B;AACF;AACA;AACEP,EAAAA,OAAO,EAAEN,SAAS,CAACc,KAAV,CAAgB;AACvB;AACJ;AACA;AACIJ,IAAAA,IAAI,EAAEV,SAAS,CAACa,MAJO;;AAKvB;AACJ;AACA;AACIF,IAAAA,OAAO,EAAEX,SAAS,CAACa;AARI,GAAhB,EASNE,UAjBuB;;AAkB1B;AACF;AACA;AACEP,EAAAA,QAAQ,EAAER,SAAS,CAACgB,IAAV,CAAeD;AArBC,CAA5B;AAwBA,eAAeb,UAAU,CAACC,MAAD,EAAS;AAAEc,EAAAA,IAAI,EAAE;AAAR,CAAT,CAAV,CAAgDb,eAAhD,CAAf","sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport { DialogActions, withStyles } from \"@material-ui/core\";\nimport styles from \"./styles\";\n\nconst HvDialogActions = (props) => {\n const { classes, className, children, ...others } = props;\n return (\n <DialogActions\n classes={{\n root: classes.root,\n spacing: classes.spacing,\n }}\n className={className}\n {...others}\n >\n {children}\n </DialogActions>\n );\n};\n\nHvDialogActions.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Style applied to the root of the component (container for the actions).\n */\n root: PropTypes.string,\n /**\n * Style applied to the root of the component if disableSpacing is off.\n */\n spacing: PropTypes.string,\n }).isRequired,\n /**\n * Actions of the Dialog.\n */\n children: PropTypes.node.isRequired,\n};\n\nexport default withStyles(styles, { name: \"HvDialogActions\" })(HvDialogActions);\n"],"file":"DialogActions.js"}
1
+ {"version":3,"sources":["../../../../src/Dialog/DialogActions/DialogActions.js"],"names":["React","clsx","PropTypes","DialogActions","withStyles","styles","HvDialogActions","props","classes","className","children","fullscreen","others","root","spacing","propTypes","string","shape","isRequired","node","bool","name"],"mappings":";;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,IAAP,MAAiB,MAAjB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,aAAT,EAAwBC,UAAxB,QAA0C,mBAA1C;AACA,OAAOC,MAAP,MAAmB,UAAnB;;AAEA,MAAMC,eAAe,GAAIC,KAAD,IAAW;AACjC,QAAM;AAAEC,IAAAA,OAAF;AAAWC,IAAAA,SAAX;AAAsBC,IAAAA,QAAtB;AAAgCC,IAAAA,UAAU,GAAG;AAA7C,MAAkEJ,KAAxE;AAAA,QAA6DK,MAA7D,4BAAwEL,KAAxE;;AACA,sBACE,oBAAC,aAAD;AACE,IAAA,OAAO,EAAE;AACPM,MAAAA,IAAI,EAAEZ,IAAI,CAACO,OAAO,CAACK,IAAT,EAAeF,UAAf,IAA6BH,OAAO,CAACG,UAArC,CADH;AAEPG,MAAAA,OAAO,EAAEN,OAAO,CAACM;AAFV,KADX;AAKE,IAAA,SAAS,EAAEL;AALb,KAMMG,MANN,GAQGF,QARH,CADF;AAYD,CAdD;;AAgBA,wCAAAJ,eAAe,CAACS,SAAhB,GAA4B;AAC1B;AACF;AACA;AACEN,EAAAA,SAAS,EAAEP,SAAS,CAACc,MAJK;;AAK1B;AACF;AACA;AACER,EAAAA,OAAO,EAAEN,SAAS,CAACe,KAAV,CAAgB;AACvB;AACJ;AACA;AACIJ,IAAAA,IAAI,EAAEX,SAAS,CAACc,MAJO;;AAKvB;AACJ;AACA;AACIF,IAAAA,OAAO,EAAEZ,SAAS,CAACc,MARI;;AASvB;AACJ;AACA;AACIL,IAAAA,UAAU,EAAET,SAAS,CAACc;AAZC,GAAhB,EAaNE,UArBuB;;AAsB1B;AACF;AACA;AACER,EAAAA,QAAQ,EAAER,SAAS,CAACiB,IAAV,CAAeD,UAzBC;;AA0B1B;AACF;AACA;AACEP,EAAAA,UAAU,EAAET,SAAS,CAACkB;AA7BI,CAA5B;AAgCA,eAAehB,UAAU,CAACC,MAAD,EAAS;AAAEgB,EAAAA,IAAI,EAAE;AAAR,CAAT,CAAV,CAAgDf,eAAhD,CAAf","sourcesContent":["import React from \"react\";\nimport clsx from \"clsx\";\nimport PropTypes from \"prop-types\";\nimport { DialogActions, withStyles } from \"@material-ui/core\";\nimport styles from \"./styles\";\n\nconst HvDialogActions = (props) => {\n const { classes, className, children, fullscreen = false, ...others } = props;\n return (\n <DialogActions\n classes={{\n root: clsx(classes.root, fullscreen && classes.fullscreen),\n spacing: classes.spacing,\n }}\n className={className}\n {...others}\n >\n {children}\n </DialogActions>\n );\n};\n\nHvDialogActions.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Style applied to the root of the component (container for the actions).\n */\n root: PropTypes.string,\n /**\n * Style applied to the root of the component if disableSpacing is off.\n */\n spacing: PropTypes.string,\n /**\n * Style applied to the root of the component if fullscreen is on.\n */\n fullscreen: PropTypes.string,\n }).isRequired,\n /**\n * Actions of the Dialog.\n */\n children: PropTypes.node.isRequired,\n /**\n * Whether or not the dialog is in fullscreen mode.\n */\n fullscreen: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvDialogActions\" })(HvDialogActions);\n"],"file":"DialogActions.js"}
@@ -8,6 +8,12 @@ const styles = theme => ({
8
8
  "& > :not(:first-child)": {
9
9
  marginLeft: theme.hv.spacing.xs
10
10
  }
11
+ },
12
+ fullscreen: {
13
+ position: "fixed",
14
+ width: "100%",
15
+ bottom: 0,
16
+ left: 0
11
17
  }
12
18
  });
13
19
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/Dialog/DialogActions/styles.js"],"names":["styles","theme","root","margin","padding","hv","spacing","sm","borderTop","palette","atmosphere","atmo2","marginLeft","xs"],"mappings":"AAAA,MAAMA,MAAM,GAAIC,KAAD,KAAY;AACzBC,EAAAA,IAAI,EAAE;AACJC,IAAAA,MAAM,EAAE,GADJ;AAEJC,IAAAA,OAAO,EAAEH,KAAK,CAACI,EAAN,CAASC,OAAT,CAAiBC,EAFtB;AAGJC,IAAAA,SAAS,EAAG,aAAYP,KAAK,CAACI,EAAN,CAASI,OAAT,CAAiBC,UAAjB,CAA4BC,KAAM;AAHtD,GADmB;AAMzBL,EAAAA,OAAO,EAAE;AACP,8BAA0B;AACxBM,MAAAA,UAAU,EAAEX,KAAK,CAACI,EAAN,CAASC,OAAT,CAAiBO;AADL;AADnB;AANgB,CAAZ,CAAf;;AAaA,eAAeb,MAAf","sourcesContent":["const styles = (theme) => ({\n root: {\n margin: \"0\",\n padding: theme.hv.spacing.sm,\n borderTop: `3px solid ${theme.hv.palette.atmosphere.atmo2}`,\n },\n spacing: {\n \"& > :not(:first-child)\": {\n marginLeft: theme.hv.spacing.xs,\n },\n },\n});\n\nexport default styles;\n"],"file":"styles.js"}
1
+ {"version":3,"sources":["../../../../src/Dialog/DialogActions/styles.js"],"names":["styles","theme","root","margin","padding","hv","spacing","sm","borderTop","palette","atmosphere","atmo2","marginLeft","xs","fullscreen","position","width","bottom","left"],"mappings":"AAAA,MAAMA,MAAM,GAAIC,KAAD,KAAY;AACzBC,EAAAA,IAAI,EAAE;AACJC,IAAAA,MAAM,EAAE,GADJ;AAEJC,IAAAA,OAAO,EAAEH,KAAK,CAACI,EAAN,CAASC,OAAT,CAAiBC,EAFtB;AAGJC,IAAAA,SAAS,EAAG,aAAYP,KAAK,CAACI,EAAN,CAASI,OAAT,CAAiBC,UAAjB,CAA4BC,KAAM;AAHtD,GADmB;AAMzBL,EAAAA,OAAO,EAAE;AACP,8BAA0B;AACxBM,MAAAA,UAAU,EAAEX,KAAK,CAACI,EAAN,CAASC,OAAT,CAAiBO;AADL;AADnB,GANgB;AAWzBC,EAAAA,UAAU,EAAE;AACVC,IAAAA,QAAQ,EAAE,OADA;AAEVC,IAAAA,KAAK,EAAE,MAFG;AAGVC,IAAAA,MAAM,EAAE,CAHE;AAIVC,IAAAA,IAAI,EAAE;AAJI;AAXa,CAAZ,CAAf;;AAmBA,eAAelB,MAAf","sourcesContent":["const styles = (theme) => ({\n root: {\n margin: \"0\",\n padding: theme.hv.spacing.sm,\n borderTop: `3px solid ${theme.hv.palette.atmosphere.atmo2}`,\n },\n spacing: {\n \"& > :not(:first-child)\": {\n marginLeft: theme.hv.spacing.xs,\n },\n },\n fullscreen: {\n position: \"fixed\",\n width: \"100%\",\n bottom: 0,\n left: 0,\n },\n});\n\nexport default styles;\n"],"file":"styles.js"}
@@ -20,7 +20,10 @@ const HvDialogTitle = _ref => {
20
20
  } = _ref,
21
21
  others = _objectWithoutProperties(_ref, _excluded);
22
22
 
23
- const isString = typeof children === "string";
23
+ const isString = typeof children === "string"; // prevent the `fullscreen` prop from being passed to the `DialogTitle` component
24
+ // eslint-disable-next-line no-param-reassign
25
+
26
+ delete others.fullscreen;
24
27
  const icon = customIcon || showIcon && iconVariant(variant);
25
28
  return /*#__PURE__*/React.createElement(DialogTitle, _extends({
26
29
  className: clsx(classes.root, className),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/Dialog/DialogTitle/DialogTitle.js"],"names":["React","PropTypes","clsx","DialogTitle","withStyles","HvTypography","iconVariant","styles","HvDialogTitle","classes","className","children","variant","showIcon","customIcon","others","isString","icon","root","messageContainer","textWithIcon","propTypes","string","shape","closeButton","isRequired","oneOf","bool","node","name"],"mappings":";;;AAAA,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;AACA;AACIL,IAAAA,IAAI,EAAEjB,SAAS,CAACqB,MAJO;;AAKvB;AACJ;AACA;AACIH,IAAAA,gBAAgB,EAAElB,SAAS,CAACqB,MARL;;AASvB;AACJ;AACA;AACIF,IAAAA,YAAY,EAAEnB,SAAS,CAACqB,MAZD;;AAavB;AACJ;AACA;AACIL,IAAAA,IAAI,EAAEhB,SAAS,CAACqB,MAhBO;;AAiBvB;AACJ;AACA;AACIE,IAAAA,WAAW,EAAEvB,SAAS,CAACqB;AApBA,GAAhB,EAqBNG,UA7BqB;;AA8BxB;AACF;AACA;AACEb,EAAAA,OAAO,EAAEX,SAAS,CAACyB,KAAV,CAAgB,CAAC,SAAD,EAAY,SAAZ,EAAuB,OAAvB,EAAgC,MAAhC,EAAwC,SAAxC,CAAhB,CAjCe;;AAkCxB;AACF;AACA;AACEb,EAAAA,QAAQ,EAAEZ,SAAS,CAAC0B,IArCI;;AAsCxB;AACF;AACA;AACEb,EAAAA,UAAU,EAAEb,SAAS,CAAC2B,IAzCE;;AA0CxB;AACF;AACA;AACEjB,EAAAA,QAAQ,EAAEV,SAAS,CAAC2B,IAAV,CAAeH;AA7CD,CAA1B;AAgDA,eAAerB,UAAU,CAACG,MAAD,EAAS;AAAEsB,EAAAA,IAAI,EAAE;AAAR,CAAT,CAAV,CAA8CrB,aAA9C,CAAf","sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\nimport { DialogTitle, withStyles } from \"@material-ui/core\";\nimport HvTypography from \"../../Typography\";\nimport iconVariant from \"../../utils/iconVariant\";\nimport styles from \"./styles\";\n\nconst HvDialogTitle = ({\n classes,\n className,\n children,\n variant = \"default\",\n showIcon = true,\n customIcon = null,\n ...others\n}) => {\n const isString = typeof children === \"string\";\n\n const icon = customIcon || (showIcon && iconVariant(variant));\n\n return (\n <DialogTitle className={clsx(classes.root, className)} disableTypography {...others}>\n <div className={classes.messageContainer}>\n {icon}\n <div className={clsx({ [classes.textWithIcon]: icon })}>\n {!isString && children}\n {isString && <HvTypography variant=\"xxsTitle\">{children}</HvTypography>}\n </div>\n </div>\n </DialogTitle>\n );\n};\n\nHvDialogTitle.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Style applied to the root of the component (container for the title).\n */\n root: PropTypes.string,\n /**\n * Style applied to the container of the title\n */\n messageContainer: PropTypes.string,\n /**\n * Style applied to the text when the icon is present.\n */\n textWithIcon: PropTypes.string,\n /**\n * Style applied to the icon.\n */\n icon: PropTypes.string,\n /**\n * Style applied to the close button.\n */\n closeButton: PropTypes.string,\n }).isRequired,\n /**\n * Variant of the Dialog.\n */\n variant: PropTypes.oneOf([\"success\", \"warning\", \"error\", \"info\", \"default\"]),\n /**\n * Controls if the associated icon to the variant should be shown.\n */\n showIcon: PropTypes.bool,\n /**\n * Custom icon to replace the variant default.\n */\n customIcon: PropTypes.node,\n /**\n * Node to be render.\n */\n children: PropTypes.node.isRequired,\n};\n\nexport default withStyles(styles, { name: \"HvDialogTitle\" })(HvDialogTitle);\n"],"file":"DialogTitle.js"}
1
+ {"version":3,"sources":["../../../../src/Dialog/DialogTitle/DialogTitle.js"],"names":["React","PropTypes","clsx","DialogTitle","withStyles","HvTypography","iconVariant","styles","HvDialogTitle","classes","className","children","variant","showIcon","customIcon","others","isString","fullscreen","icon","root","messageContainer","textWithIcon","propTypes","string","shape","closeButton","isRequired","oneOf","bool","node","name"],"mappings":";;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,IAAP,MAAiB,MAAjB;AACA,SAASC,WAAT,EAAsBC,UAAtB,QAAwC,mBAAxC;AACA,OAAOC,YAAP,MAAyB,kBAAzB;AACA,OAAOC,WAAP,MAAwB,yBAAxB;AACA,OAAOC,MAAP,MAAmB,UAAnB;;AAEA,MAAMC,aAAa,GAAG,QAQhB;AAAA,MARi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AAS,CAACsB,MAhBO;;AAiBvB;AACJ;AACA;AACIE,IAAAA,WAAW,EAAExB,SAAS,CAACsB;AApBA,GAAhB,EAqBNG,UA7BqB;;AA8BxB;AACF;AACA;AACEd,EAAAA,OAAO,EAAEX,SAAS,CAAC0B,KAAV,CAAgB,CAAC,SAAD,EAAY,SAAZ,EAAuB,OAAvB,EAAgC,MAAhC,EAAwC,SAAxC,CAAhB,CAjCe;;AAkCxB;AACF;AACA;AACEd,EAAAA,QAAQ,EAAEZ,SAAS,CAAC2B,IArCI;;AAsCxB;AACF;AACA;AACEd,EAAAA,UAAU,EAAEb,SAAS,CAAC4B,IAzCE;;AA0CxB;AACF;AACA;AACElB,EAAAA,QAAQ,EAAEV,SAAS,CAAC4B,IAAV,CAAeH;AA7CD,CAA1B;AAgDA,eAAetB,UAAU,CAACG,MAAD,EAAS;AAAEuB,EAAAA,IAAI,EAAE;AAAR,CAAT,CAAV,CAA8CtB,aAA9C,CAAf","sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\nimport { DialogTitle, withStyles } from \"@material-ui/core\";\nimport HvTypography from \"../../Typography\";\nimport iconVariant from \"../../utils/iconVariant\";\nimport styles from \"./styles\";\n\nconst HvDialogTitle = ({\n classes,\n className,\n children,\n variant = \"default\",\n showIcon = true,\n customIcon = null,\n ...others\n}) => {\n const isString = typeof children === \"string\";\n // prevent the `fullscreen` prop from being passed to the `DialogTitle` component\n // eslint-disable-next-line no-param-reassign\n delete others.fullscreen;\n\n const icon = customIcon || (showIcon && iconVariant(variant));\n\n return (\n <DialogTitle className={clsx(classes.root, className)} disableTypography {...others}>\n <div className={classes.messageContainer}>\n {icon}\n <div className={clsx({ [classes.textWithIcon]: icon })}>\n {!isString && children}\n {isString && <HvTypography variant=\"xxsTitle\">{children}</HvTypography>}\n </div>\n </div>\n </DialogTitle>\n );\n};\n\nHvDialogTitle.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Style applied to the root of the component (container for the title).\n */\n root: PropTypes.string,\n /**\n * Style applied to the container of the title\n */\n messageContainer: PropTypes.string,\n /**\n * Style applied to the text when the icon is present.\n */\n textWithIcon: PropTypes.string,\n /**\n * Style applied to the icon.\n */\n icon: PropTypes.string,\n /**\n * Style applied to the close button.\n */\n closeButton: PropTypes.string,\n }).isRequired,\n /**\n * Variant of the Dialog.\n */\n variant: PropTypes.oneOf([\"success\", \"warning\", \"error\", \"info\", \"default\"]),\n /**\n * Controls if the associated icon to the variant should be shown.\n */\n showIcon: PropTypes.bool,\n /**\n * Custom icon to replace the variant default.\n */\n customIcon: PropTypes.node,\n /**\n * Node to be render.\n */\n children: PropTypes.node.isRequired,\n};\n\nexport default withStyles(styles, { name: \"HvDialogTitle\" })(HvDialogTitle);\n"],"file":"DialogTitle.js"}
@@ -8,7 +8,10 @@ const styles = theme => ({
8
8
  background: `${theme.hv.palette.atmosphere.atmo1}`,
9
9
  padding: "0px",
10
10
  overflow: "auto",
11
- boxShadow: theme.hv.shadows[1]
11
+ boxShadow: theme.hv.shadows[1],
12
+ "&:not(.fullscreen)": {
13
+ maxHeight: "calc(100% - 200px)"
14
+ }
12
15
  },
13
16
  closeButton: {
14
17
  padding: 0,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Dialog/styles.js"],"names":["fade","styles","theme","background","hv","palette","atmosphere","atmo4","paper","atmo1","padding","overflow","boxShadow","shadows","closeButton","minWidth","position","top","hvSpacing","right"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,oBAAjB;;AAEA,MAAMC,MAAM,GAAIC,KAAD,KAAY;AACzBC,EAAAA,UAAU,EAAE;AACVA,IAAAA,UAAU,EAAEH,IAAI,CAACE,KAAK,CAACE,EAAN,CAASC,OAAT,CAAiBC,UAAjB,CAA4BC,KAA7B,EAAoC,GAApC;AADN,GADa;AAIzBC,EAAAA,KAAK,EAAE;AACLL,IAAAA,UAAU,EAAG,GAAED,KAAK,CAACE,EAAN,CAASC,OAAT,CAAiBC,UAAjB,CAA4BG,KAAM,EAD5C;AAELC,IAAAA,OAAO,EAAE,KAFJ;AAGLC,IAAAA,QAAQ,EAAE,MAHL;AAILC,IAAAA,SAAS,EAAEV,KAAK,CAACE,EAAN,CAASS,OAAT,CAAiB,CAAjB;AAJN,GAJkB;AAUzBC,EAAAA,WAAW,EAAE;AACXJ,IAAAA,OAAO,EAAE,CADE;AAEXK,IAAAA,QAAQ,EAAE,SAFC;AAGXC,IAAAA,QAAQ,EAAE,UAHC;AAIXC,IAAAA,GAAG,EAAEf,KAAK,CAACgB,SAAN,CAAgB,IAAhB,CAJM;AAKXC,IAAAA,KAAK,EAAEjB,KAAK,CAACgB,SAAN,CAAgB,IAAhB;AALI;AAVY,CAAZ,CAAf;;AAmBA,eAAejB,MAAf","sourcesContent":["import fade from \"../utils/hexToRgbA\";\n\nconst styles = (theme) => ({\n background: {\n background: fade(theme.hv.palette.atmosphere.atmo4, 0.8),\n },\n paper: {\n background: `${theme.hv.palette.atmosphere.atmo1}`,\n padding: \"0px\",\n overflow: \"auto\",\n boxShadow: theme.hv.shadows[1],\n },\n closeButton: {\n padding: 0,\n minWidth: \"inherit\",\n position: \"absolute\",\n top: theme.hvSpacing(\"sm\"),\n right: theme.hvSpacing(\"sm\"),\n },\n});\n\nexport default styles;\n"],"file":"styles.js"}
1
+ {"version":3,"sources":["../../../src/Dialog/styles.js"],"names":["fade","styles","theme","background","hv","palette","atmosphere","atmo4","paper","atmo1","padding","overflow","boxShadow","shadows","maxHeight","closeButton","minWidth","position","top","hvSpacing","right"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,oBAAjB;;AAEA,MAAMC,MAAM,GAAIC,KAAD,KAAY;AACzBC,EAAAA,UAAU,EAAE;AACVA,IAAAA,UAAU,EAAEH,IAAI,CAACE,KAAK,CAACE,EAAN,CAASC,OAAT,CAAiBC,UAAjB,CAA4BC,KAA7B,EAAoC,GAApC;AADN,GADa;AAIzBC,EAAAA,KAAK,EAAE;AACLL,IAAAA,UAAU,EAAG,GAAED,KAAK,CAACE,EAAN,CAASC,OAAT,CAAiBC,UAAjB,CAA4BG,KAAM,EAD5C;AAELC,IAAAA,OAAO,EAAE,KAFJ;AAGLC,IAAAA,QAAQ,EAAE,MAHL;AAILC,IAAAA,SAAS,EAAEV,KAAK,CAACE,EAAN,CAASS,OAAT,CAAiB,CAAjB,CAJN;AAKL,0BAAsB;AACpBC,MAAAA,SAAS,EAAE;AADS;AALjB,GAJkB;AAazBC,EAAAA,WAAW,EAAE;AACXL,IAAAA,OAAO,EAAE,CADE;AAEXM,IAAAA,QAAQ,EAAE,SAFC;AAGXC,IAAAA,QAAQ,EAAE,UAHC;AAIXC,IAAAA,GAAG,EAAEhB,KAAK,CAACiB,SAAN,CAAgB,IAAhB,CAJM;AAKXC,IAAAA,KAAK,EAAElB,KAAK,CAACiB,SAAN,CAAgB,IAAhB;AALI;AAbY,CAAZ,CAAf;;AAsBA,eAAelB,MAAf","sourcesContent":["import fade from \"../utils/hexToRgbA\";\n\nconst styles = (theme) => ({\n background: {\n background: fade(theme.hv.palette.atmosphere.atmo4, 0.8),\n },\n paper: {\n background: `${theme.hv.palette.atmosphere.atmo1}`,\n padding: \"0px\",\n overflow: \"auto\",\n boxShadow: theme.hv.shadows[1],\n \"&:not(.fullscreen)\": {\n maxHeight: \"calc(100% - 200px)\",\n },\n },\n closeButton: {\n padding: 0,\n minWidth: \"inherit\",\n position: \"absolute\",\n top: theme.hvSpacing(\"sm\"),\n right: theme.hvSpacing(\"sm\"),\n },\n});\n\nexport default styles;\n"],"file":"styles.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hitachivantara/uikit-react-core",
3
- "version": "3.61.0",
3
+ "version": "3.62.0",
4
4
  "description": "A collection of React components for the Hitachi Vantara's Design System.",
5
5
  "homepage": "https://github.com/lumada-design/hv-uikit-react",
6
6
  "license": "Apache-2.0",
@@ -104,5 +104,5 @@
104
104
  "publishConfig": {
105
105
  "access": "public"
106
106
  },
107
- "gitHead": "7c657c951e5085b81d43cc9e25a24a4c0ebb54b7"
107
+ "gitHead": "77f662253c4d45283eda7ba3eaccd4f55c6b974d"
108
108
  }