@dhis2-ui/modal 8.1.11 → 8.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,16 +21,19 @@ const createClickHandler = onClick => event => {
21
21
  onClick({}, event);
22
22
  };
23
23
 
24
- const CloseButton = ({
25
- onClick
26
- }) => /*#__PURE__*/_react.default.createElement("button", {
27
- "data-test": "dhis2-modal-close-button",
28
- onClick: createClickHandler(onClick),
29
- className: _style.default.dynamic([["3281559950", [_uiConstants.colors.grey700, _uiConstants.colors.grey200, _uiConstants.colors.grey900, _uiConstants.colors.grey200, _uiConstants.theme.focus, _uiConstants.colors.grey300]]])
30
- }, /*#__PURE__*/_react.default.createElement(_uiIcons.IconCross16, null), /*#__PURE__*/_react.default.createElement(_style.default, {
31
- id: "3281559950",
32
- dynamic: [_uiConstants.colors.grey700, _uiConstants.colors.grey200, _uiConstants.colors.grey900, _uiConstants.colors.grey200, _uiConstants.theme.focus, _uiConstants.colors.grey300]
33
- }, [`button.__jsx-style-dynamic-selector{background-color:transparent;color:${_uiConstants.colors.grey700};border:none;outline:none;padding:4px 4px 0px;border-radius:3px;position:absolute;top:0px;right:0px;}`, `button.__jsx-style-dynamic-selector:hover{background-color:${_uiConstants.colors.grey200};color:${_uiConstants.colors.grey900};}`, `button.__jsx-style-dynamic-selector:focus{background-color:${_uiConstants.colors.grey200};outline:3px solid ${_uiConstants.theme.focus};}`, "button.__jsx-style-dynamic-selector:focus.__jsx-style-dynamic-selector:not(:focus-visible){outline:none;}", `button.__jsx-style-dynamic-selector:active{background-color:${_uiConstants.colors.grey300};}`]));
24
+ const CloseButton = _ref => {
25
+ let {
26
+ onClick
27
+ } = _ref;
28
+ return /*#__PURE__*/_react.default.createElement("button", {
29
+ "data-test": "dhis2-modal-close-button",
30
+ onClick: createClickHandler(onClick),
31
+ className: _style.default.dynamic([["3281559950", [_uiConstants.colors.grey700, _uiConstants.colors.grey200, _uiConstants.colors.grey900, _uiConstants.colors.grey200, _uiConstants.theme.focus, _uiConstants.colors.grey300]]])
32
+ }, /*#__PURE__*/_react.default.createElement(_uiIcons.IconCross16, null), /*#__PURE__*/_react.default.createElement(_style.default, {
33
+ id: "3281559950",
34
+ dynamic: [_uiConstants.colors.grey700, _uiConstants.colors.grey200, _uiConstants.colors.grey900, _uiConstants.colors.grey200, _uiConstants.theme.focus, _uiConstants.colors.grey300]
35
+ }, ["button.__jsx-style-dynamic-selector{background-color:transparent;color:".concat(_uiConstants.colors.grey700, ";border:none;outline:none;padding:4px 4px 0px;border-radius:3px;position:absolute;top:0px;right:0px;}"), "button.__jsx-style-dynamic-selector:hover{background-color:".concat(_uiConstants.colors.grey200, ";color:").concat(_uiConstants.colors.grey900, ";}"), "button.__jsx-style-dynamic-selector:focus{background-color:".concat(_uiConstants.colors.grey200, ";outline:3px solid ").concat(_uiConstants.theme.focus, ";}"), "button.__jsx-style-dynamic-selector:focus.__jsx-style-dynamic-selector:not(:focus-visible){outline:none;}", "button.__jsx-style-dynamic-selector:active{background-color:".concat(_uiConstants.colors.grey300, ";}")]));
36
+ };
34
37
 
35
38
  exports.CloseButton = CloseButton;
36
39
  CloseButton.propTypes = {
@@ -29,21 +29,22 @@ const resolveLayerStyles = hide => ({
29
29
  styles: /*#__PURE__*/_react.default.createElement(_style.default, {
30
30
  id: "1884450060",
31
31
  dynamic: [_uiConstants.spacers.dp64, hide ? 'none' : 'block']
32
- }, [`div.__jsx-style-dynamic-selector{padding:${_uiConstants.spacers.dp64};display:${hide ? 'none' : 'block'};}`]),
32
+ }, ["div.__jsx-style-dynamic-selector{padding:".concat(_uiConstants.spacers.dp64, ";display:").concat(hide ? 'none' : 'block', ";}")]),
33
33
  className: _style.default.dynamic([["1884450060", [_uiConstants.spacers.dp64, hide ? 'none' : 'block']]])
34
34
  });
35
35
 
36
- const Modal = ({
37
- children,
38
- className,
39
- dataTest,
40
- hide,
41
- fluid,
42
- large,
43
- onClose,
44
- position,
45
- small
46
- }) => {
36
+ const Modal = _ref => {
37
+ let {
38
+ children,
39
+ className,
40
+ dataTest,
41
+ hide,
42
+ fluid,
43
+ large,
44
+ onClose,
45
+ position,
46
+ small
47
+ } = _ref;
47
48
  const layerStyles = resolveLayerStyles(hide);
48
49
  return /*#__PURE__*/_react.default.createElement(_layer.Layer, {
49
50
  onClick: onClose,
@@ -55,7 +56,7 @@ const Modal = ({
55
56
  role: "dialog",
56
57
  "aria-modal": "true",
57
58
  "data-test": dataTest,
58
- className: _style.default.dynamic([["332269773", [2 * _uiConstants.spacersNum.dp64, 2 * _uiConstants.spacersNum.dp64]]]) + " " + ((0, _classnames.default)(className, {
59
+ className: _style.default.dynamic([["3655640549", [2 * _uiConstants.spacersNum.dp64, 2 * _uiConstants.spacersNum.dp64, 2 * _uiConstants.spacersNum.dp64, 2 * _uiConstants.spacersNum.dp64]]]) + " " + ((0, _classnames.default)(className, {
59
60
  small,
60
61
  large,
61
62
  fluid
@@ -63,11 +64,11 @@ const Modal = ({
63
64
  }, /*#__PURE__*/_react.default.createElement(_card.Card, null, onClose && /*#__PURE__*/_react.default.createElement(_closeButton.CloseButton, {
64
65
  onClick: onClose
65
66
  }), /*#__PURE__*/_react.default.createElement("div", {
66
- className: _style.default.dynamic([["332269773", [2 * _uiConstants.spacersNum.dp64, 2 * _uiConstants.spacersNum.dp64]]])
67
+ className: _style.default.dynamic([["3655640549", [2 * _uiConstants.spacersNum.dp64, 2 * _uiConstants.spacersNum.dp64, 2 * _uiConstants.spacersNum.dp64, 2 * _uiConstants.spacersNum.dp64]]])
67
68
  }, children))), layerStyles.styles), /*#__PURE__*/_react.default.createElement(_style.default, {
68
- id: "332269773",
69
- dynamic: [2 * _uiConstants.spacersNum.dp64, 2 * _uiConstants.spacersNum.dp64]
70
- }, [`aside.__jsx-style-dynamic-selector{height:auto;width:600px;max-width:calc(100vw - ${2 * _uiConstants.spacersNum.dp64}px);max-height:calc(100vh - ${2 * _uiConstants.spacersNum.dp64}px);}`, "aside.small.__jsx-style-dynamic-selector{width:400px;}", "aside.large.__jsx-style-dynamic-selector{width:800px;}", "aside.fluid.__jsx-style-dynamic-selector{width:auto;}", "div.__jsx-style-dynamic-selector{padding:24px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-flow:column;-ms-flex-flow:column;flex-flow:column;max-width:100%;max-height:100%;}"]));
69
+ id: "3655640549",
70
+ dynamic: [2 * _uiConstants.spacersNum.dp64, 2 * _uiConstants.spacersNum.dp64, 2 * _uiConstants.spacersNum.dp64, 2 * _uiConstants.spacersNum.dp64]
71
+ }, ["aside.__jsx-style-dynamic-selector{height:auto;width:600px;max-width:calc(100vw - ".concat(2 * _uiConstants.spacersNum.dp64, "px);max-height:calc(100vh - ").concat(2 * _uiConstants.spacersNum.dp64, "px);}"), "aside.small.__jsx-style-dynamic-selector{width:400px;}", "aside.large.__jsx-style-dynamic-selector{width:800px;}", "aside.fluid.__jsx-style-dynamic-selector{width:auto;}", "div.__jsx-style-dynamic-selector{padding:24px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-flow:column;-ms-flex-flow:column;flex-flow:column;max-width:calc(100vw - ".concat(2 * _uiConstants.spacersNum.dp64, "px);max-height:calc(100vh - ").concat(2 * _uiConstants.spacersNum.dp64, "px);}")]));
71
72
  };
72
73
 
73
74
  exports.Modal = Modal;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.FluidBottom = exports.FluidMiddle = exports.FluidTop = exports.ModalThatHidesWithStatefulComponens = exports.LargeModalWithMoreNestedModals = exports.LargeWithSelectComponent = exports.SmallLongTitle = exports.BottomScrollable = exports.MiddleScrollable = exports.TopScrollable = exports.SmallClickableScreenCover = exports.SmallDestructivePrimary = exports.SmallContentPrimary = exports.FluidTitleContentPrimary = exports.LargeTitleContentPrimary = exports.MediumTitleContentAction = exports.SmallTitleContentAction = exports.AlignmentBottom = exports.AlignmentMiddle = exports.DefaultContent = exports.default = void 0;
6
+ exports.default = exports.TopScrollable = exports.SmallTitleContentAction = exports.SmallLongTitle = exports.SmallDestructivePrimary = exports.SmallContentPrimary = exports.SmallClickableScreenCover = exports.ModalThatHidesWithStatefulComponens = exports.MiddleScrollable = exports.MediumTitleContentAction = exports.LargeWithSelectComponent = exports.LargeTitleContentPrimary = exports.LargeModalWithMoreNestedModals = exports.FluidTop = exports.FluidTitleContentPrimary = exports.FluidMiddle = exports.FluidBottom = exports.DefaultContent = exports.BottomScrollable = exports.AlignmentMiddle = exports.AlignmentBottom = void 0;
7
7
 
8
8
  var _style = _interopRequireDefault(require("styled-jsx/style"));
9
9
 
@@ -31,36 +31,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
31
31
 
32
32
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
33
 
34
- const description = `
35
- _**Note**: For performance reasons, only one representative example is shown here. For more (interactive) examples, see individual stories in the Canvas tab._
36
-
37
- A modal focuses user attention on a single task or piece of information inside a container. A modal blocks the rest of the application until it is dismissed.
38
-
39
- #### Usage
40
-
41
- A modal should be used to focus user attention on a single task or piece of information. Modals take over the entire screen and should be used sparingly to avoid interrupting a user's flow too often.
42
-
43
- Use a modal in the following cases:
44
-
45
- - to collect short, focussed user input that is blocking progress
46
- - to present critical information that a user needs to acknowledge before continuing
47
- - to ask the user to confirm a destructive action that cannot be undone
48
-
49
- Do not use a modal in the following cases:
50
-
51
- - to display unrelated or non-critical information; use an alert bar or a notice box instead
52
- - to display complex, workflows that span multiple screens; navigate to a new, full page in the app instead
53
-
54
- #### Children
55
-
56
- Modals should be used with children \`<ModalTitle>\` (optional), \`<ModalContent>\` (required), and \`<ModalActions>\` (recommended)
57
-
58
- See more about modal usage, including alignment and sizing, at [Design System: Modals](https://github.com/dhis2/design-system/blob/master/molecules/modal.md#usage).
59
-
60
- \`\`\`js
61
- import { Modal } from '@dhis2/ui'
62
- \`\`\`
63
- `;
34
+ const description = "\n_**Note**: For performance reasons, only one representative example is shown here. For more (interactive) examples, see individual stories in the Canvas tab._\n\nA modal focuses user attention on a single task or piece of information inside a container. A modal blocks the rest of the application until it is dismissed.\n\n#### Usage\n\nA modal should be used to focus user attention on a single task or piece of information. Modals take over the entire screen and should be used sparingly to avoid interrupting a user's flow too often.\n\nUse a modal in the following cases:\n\n- to collect short, focussed user input that is blocking progress\n- to present critical information that a user needs to acknowledge before continuing\n- to ask the user to confirm a destructive action that cannot be undone\n\nDo not use a modal in the following cases:\n\n- to display unrelated or non-critical information; use an alert bar or a notice box instead\n- to display complex, workflows that span multiple screens; navigate to a new, full page in the app instead\n\n#### Children\n\nModals should be used with children `<ModalTitle>` (optional), `<ModalContent>` (required), and `<ModalActions>` (recommended)\n\nSee more about modal usage, including alignment and sizing, at [Design System: Modals](https://github.com/dhis2/design-system/blob/master/molecules/modal.md#usage).\n\n```js\nimport { Modal } from '@dhis2/ui'\n```\n";
64
35
 
65
36
  const say = something => () => alert(something);
66
37
 
@@ -69,10 +40,12 @@ window.onClose = (payload, event) => {
69
40
  console.log('onClose event', event);
70
41
  };
71
42
 
72
- const onClose = (...args) => window.onClose(...args);
43
+ const onClose = function () {
44
+ return window.onClose(...arguments);
45
+ };
73
46
 
74
47
  var _default = {
75
- title: 'Layout/Modal',
48
+ title: 'Modal',
76
49
  component: _modal.Modal,
77
50
  parameters: {
78
51
  docs: {
@@ -525,20 +498,23 @@ const LargeModalWithMoreNestedModals = args => /*#__PURE__*/_react.default.creat
525
498
  label: "ten"
526
499
  })), /*#__PURE__*/_react.default.createElement(_tooltip.Tooltip, {
527
500
  content: "Some extra info"
528
- }, ({
529
- ref,
530
- onMouseOver,
531
- onMouseOut
532
- }) => /*#__PURE__*/_react.default.createElement("span", {
533
- ref: ref,
534
- onMouseOver: onMouseOver,
535
- onMouseOut: onMouseOut,
536
- className: "jsx-2364308943"
537
- }, /*#__PURE__*/_react.default.createElement("button", {
538
- className: "jsx-2364308943"
539
- }, "Tooltip on button"), /*#__PURE__*/_react.default.createElement(_style.default, {
540
- id: "2364308943"
541
- }, ["span.jsx-2364308943{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}"]))), /*#__PURE__*/_react.default.createElement(_menu.FlyoutMenu, null, /*#__PURE__*/_react.default.createElement(_menu.MenuSectionHeader, {
501
+ }, _ref => {
502
+ let {
503
+ ref,
504
+ onMouseOver,
505
+ onMouseOut
506
+ } = _ref;
507
+ return /*#__PURE__*/_react.default.createElement("span", {
508
+ ref: ref,
509
+ onMouseOver: onMouseOver,
510
+ onMouseOut: onMouseOut,
511
+ className: "jsx-2364308943"
512
+ }, /*#__PURE__*/_react.default.createElement("button", {
513
+ className: "jsx-2364308943"
514
+ }, "Tooltip on button"), /*#__PURE__*/_react.default.createElement(_style.default, {
515
+ id: "2364308943"
516
+ }, ["span.jsx-2364308943{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}"]));
517
+ }), /*#__PURE__*/_react.default.createElement(_menu.FlyoutMenu, null, /*#__PURE__*/_react.default.createElement(_menu.MenuSectionHeader, {
542
518
  label: "Section with sub-menus"
543
519
  }), /*#__PURE__*/_react.default.createElement(_menu.MenuItem, {
544
520
  label: "Item 1"
@@ -15,16 +15,19 @@ var _react = _interopRequireDefault(require("react"));
15
15
 
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
17
 
18
- const ModalActions = ({
19
- children,
20
- dataTest
21
- }) => /*#__PURE__*/_react.default.createElement("div", {
22
- "data-test": dataTest,
23
- className: _style.default.dynamic([["2674552674", [_uiConstants.spacers.dp16]]])
24
- }, children, /*#__PURE__*/_react.default.createElement(_style.default, {
25
- id: "2674552674",
26
- dynamic: [_uiConstants.spacers.dp16]
27
- }, [`div.__jsx-style-dynamic-selector{-webkit-order:3;-ms-flex-order:3;order:3;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:end;-webkit-justify-content:flex-end;-ms-flex-pack:end;justify-content:flex-end;-webkit-align-self:flex-end;-ms-flex-item-align:end;align-self:flex-end;margin:${_uiConstants.spacers.dp16} 0 0;}`]));
18
+ const ModalActions = _ref => {
19
+ let {
20
+ children,
21
+ dataTest
22
+ } = _ref;
23
+ return /*#__PURE__*/_react.default.createElement("div", {
24
+ "data-test": dataTest,
25
+ className: _style.default.dynamic([["2674552674", [_uiConstants.spacers.dp16]]])
26
+ }, children, /*#__PURE__*/_react.default.createElement(_style.default, {
27
+ id: "2674552674",
28
+ dynamic: [_uiConstants.spacers.dp16]
29
+ }, ["div.__jsx-style-dynamic-selector{-webkit-order:3;-ms-flex-order:3;order:3;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:end;-webkit-justify-content:flex-end;-ms-flex-pack:end;justify-content:flex-end;-webkit-align-self:flex-end;-ms-flex-item-align:end;align-self:flex-end;margin:".concat(_uiConstants.spacers.dp16, " 0 0;}")]));
30
+ };
28
31
 
29
32
  exports.ModalActions = ModalActions;
30
33
  ModalActions.defaultProps = {
@@ -13,16 +13,19 @@ var _react = _interopRequireDefault(require("react"));
13
13
 
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
16
- const ModalContent = ({
17
- children,
18
- className,
19
- dataTest
20
- }) => /*#__PURE__*/_react.default.createElement("div", {
21
- "data-test": dataTest,
22
- className: "jsx-3719215021" + " " + (className || "")
23
- }, children, /*#__PURE__*/_react.default.createElement(_style.default, {
24
- id: "3719215021"
25
- }, ["div.jsx-3719215021{-webkit-order:2;-ms-flex-order:2;order:2;-webkit-box-flex:2;-webkit-flex-grow:2;-ms-flex-positive:2;flex-grow:2;overflow-y:auto;}"]));
16
+ const ModalContent = _ref => {
17
+ let {
18
+ children,
19
+ className,
20
+ dataTest
21
+ } = _ref;
22
+ return /*#__PURE__*/_react.default.createElement("div", {
23
+ "data-test": dataTest,
24
+ className: "jsx-3719215021" + " " + (className || "")
25
+ }, children, /*#__PURE__*/_react.default.createElement(_style.default, {
26
+ id: "3719215021"
27
+ }, ["div.jsx-3719215021{-webkit-order:2;-ms-flex-order:2;order:2;-webkit-box-flex:2;-webkit-flex-grow:2;-ms-flex-positive:2;flex-grow:2;overflow-y:auto;}"]));
28
+ };
26
29
 
27
30
  exports.ModalContent = ModalContent;
28
31
  ModalContent.defaultProps = {
@@ -17,16 +17,19 @@ var _react = _interopRequireDefault(require("react"));
17
17
 
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
19
 
20
- const ModalTitle = ({
21
- children,
22
- dataTest
23
- }) => /*#__PURE__*/_react.default.createElement("h1", {
24
- "data-test": dataTest,
25
- className: _style.default.dynamic([["4169842822", [_uiConstants.colors.grey900, _uiConstants.spacers.dp12]]]) + " " + ((0, _classnames.default)('title') || "")
26
- }, children, /*#__PURE__*/_react.default.createElement(_style.default, {
27
- id: "4169842822",
28
- dynamic: [_uiConstants.colors.grey900, _uiConstants.spacers.dp12]
29
- }, [`h1.__jsx-style-dynamic-selector{-webkit-order:1;-ms-flex-order:1;order:1;-webkit-align-self:flex-start;-ms-flex-item-align:start;align-self:flex-start;color:${_uiConstants.colors.grey900};font-size:20px;font-weight:500;line-height:24px;margin:0 0 ${_uiConstants.spacers.dp12};}`]));
20
+ const ModalTitle = _ref => {
21
+ let {
22
+ children,
23
+ dataTest
24
+ } = _ref;
25
+ return /*#__PURE__*/_react.default.createElement("h1", {
26
+ "data-test": dataTest,
27
+ className: _style.default.dynamic([["4169842822", [_uiConstants.colors.grey900, _uiConstants.spacers.dp12]]]) + " " + ((0, _classnames.default)('title') || "")
28
+ }, children, /*#__PURE__*/_react.default.createElement(_style.default, {
29
+ id: "4169842822",
30
+ dynamic: [_uiConstants.colors.grey900, _uiConstants.spacers.dp12]
31
+ }, ["h1.__jsx-style-dynamic-selector{-webkit-order:1;-ms-flex-order:1;order:1;-webkit-align-self:flex-start;-ms-flex-item-align:start;align-self:flex-start;color:".concat(_uiConstants.colors.grey900, ";font-size:20px;font-weight:500;line-height:24px;margin:0 0 ").concat(_uiConstants.spacers.dp12, ";}")]));
32
+ };
30
33
 
31
34
  exports.ModalTitle = ModalTitle;
32
35
  ModalTitle.defaultProps = {
@@ -8,16 +8,19 @@ const createClickHandler = onClick => event => {
8
8
  onClick({}, event);
9
9
  };
10
10
 
11
- export const CloseButton = ({
12
- onClick
13
- }) => /*#__PURE__*/React.createElement("button", {
14
- "data-test": "dhis2-modal-close-button",
15
- onClick: createClickHandler(onClick),
16
- className: _JSXStyle.dynamic([["3281559950", [colors.grey700, colors.grey200, colors.grey900, colors.grey200, theme.focus, colors.grey300]]])
17
- }, /*#__PURE__*/React.createElement(IconCross16, null), /*#__PURE__*/React.createElement(_JSXStyle, {
18
- id: "3281559950",
19
- dynamic: [colors.grey700, colors.grey200, colors.grey900, colors.grey200, theme.focus, colors.grey300]
20
- }, [`button.__jsx-style-dynamic-selector{background-color:transparent;color:${colors.grey700};border:none;outline:none;padding:4px 4px 0px;border-radius:3px;position:absolute;top:0px;right:0px;}`, `button.__jsx-style-dynamic-selector:hover{background-color:${colors.grey200};color:${colors.grey900};}`, `button.__jsx-style-dynamic-selector:focus{background-color:${colors.grey200};outline:3px solid ${theme.focus};}`, "button.__jsx-style-dynamic-selector:focus.__jsx-style-dynamic-selector:not(:focus-visible){outline:none;}", `button.__jsx-style-dynamic-selector:active{background-color:${colors.grey300};}`]));
11
+ export const CloseButton = _ref => {
12
+ let {
13
+ onClick
14
+ } = _ref;
15
+ return /*#__PURE__*/React.createElement("button", {
16
+ "data-test": "dhis2-modal-close-button",
17
+ onClick: createClickHandler(onClick),
18
+ className: _JSXStyle.dynamic([["3281559950", [colors.grey700, colors.grey200, colors.grey900, colors.grey200, theme.focus, colors.grey300]]])
19
+ }, /*#__PURE__*/React.createElement(IconCross16, null), /*#__PURE__*/React.createElement(_JSXStyle, {
20
+ id: "3281559950",
21
+ dynamic: [colors.grey700, colors.grey200, colors.grey900, colors.grey200, theme.focus, colors.grey300]
22
+ }, ["button.__jsx-style-dynamic-selector{background-color:transparent;color:".concat(colors.grey700, ";border:none;outline:none;padding:4px 4px 0px;border-radius:3px;position:absolute;top:0px;right:0px;}"), "button.__jsx-style-dynamic-selector:hover{background-color:".concat(colors.grey200, ";color:").concat(colors.grey900, ";}"), "button.__jsx-style-dynamic-selector:focus{background-color:".concat(colors.grey200, ";outline:3px solid ").concat(theme.focus, ";}"), "button.__jsx-style-dynamic-selector:focus.__jsx-style-dynamic-selector:not(:focus-visible){outline:none;}", "button.__jsx-style-dynamic-selector:active{background-color:".concat(colors.grey300, ";}")]));
23
+ };
21
24
  CloseButton.propTypes = {
22
25
  onClick: PropTypes.func
23
26
  };
@@ -12,21 +12,22 @@ const resolveLayerStyles = hide => ({
12
12
  styles: /*#__PURE__*/React.createElement(_JSXStyle, {
13
13
  id: "1884450060",
14
14
  dynamic: [spacers.dp64, hide ? 'none' : 'block']
15
- }, [`div.__jsx-style-dynamic-selector{padding:${spacers.dp64};display:${hide ? 'none' : 'block'};}`]),
15
+ }, ["div.__jsx-style-dynamic-selector{padding:".concat(spacers.dp64, ";display:").concat(hide ? 'none' : 'block', ";}")]),
16
16
  className: _JSXStyle.dynamic([["1884450060", [spacers.dp64, hide ? 'none' : 'block']]])
17
17
  });
18
18
 
19
- export const Modal = ({
20
- children,
21
- className,
22
- dataTest,
23
- hide,
24
- fluid,
25
- large,
26
- onClose,
27
- position,
28
- small
29
- }) => {
19
+ export const Modal = _ref => {
20
+ let {
21
+ children,
22
+ className,
23
+ dataTest,
24
+ hide,
25
+ fluid,
26
+ large,
27
+ onClose,
28
+ position,
29
+ small
30
+ } = _ref;
30
31
  const layerStyles = resolveLayerStyles(hide);
31
32
  return /*#__PURE__*/React.createElement(Layer, {
32
33
  onClick: onClose,
@@ -38,7 +39,7 @@ export const Modal = ({
38
39
  role: "dialog",
39
40
  "aria-modal": "true",
40
41
  "data-test": dataTest,
41
- className: _JSXStyle.dynamic([["332269773", [2 * spacersNum.dp64, 2 * spacersNum.dp64]]]) + " " + (cx(className, {
42
+ className: _JSXStyle.dynamic([["3655640549", [2 * spacersNum.dp64, 2 * spacersNum.dp64, 2 * spacersNum.dp64, 2 * spacersNum.dp64]]]) + " " + (cx(className, {
42
43
  small,
43
44
  large,
44
45
  fluid
@@ -46,11 +47,11 @@ export const Modal = ({
46
47
  }, /*#__PURE__*/React.createElement(Card, null, onClose && /*#__PURE__*/React.createElement(CloseButton, {
47
48
  onClick: onClose
48
49
  }), /*#__PURE__*/React.createElement("div", {
49
- className: _JSXStyle.dynamic([["332269773", [2 * spacersNum.dp64, 2 * spacersNum.dp64]]])
50
+ className: _JSXStyle.dynamic([["3655640549", [2 * spacersNum.dp64, 2 * spacersNum.dp64, 2 * spacersNum.dp64, 2 * spacersNum.dp64]]])
50
51
  }, children))), layerStyles.styles), /*#__PURE__*/React.createElement(_JSXStyle, {
51
- id: "332269773",
52
- dynamic: [2 * spacersNum.dp64, 2 * spacersNum.dp64]
53
- }, [`aside.__jsx-style-dynamic-selector{height:auto;width:600px;max-width:calc(100vw - ${2 * spacersNum.dp64}px);max-height:calc(100vh - ${2 * spacersNum.dp64}px);}`, "aside.small.__jsx-style-dynamic-selector{width:400px;}", "aside.large.__jsx-style-dynamic-selector{width:800px;}", "aside.fluid.__jsx-style-dynamic-selector{width:auto;}", "div.__jsx-style-dynamic-selector{padding:24px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-flow:column;-ms-flex-flow:column;flex-flow:column;max-width:100%;max-height:100%;}"]));
52
+ id: "3655640549",
53
+ dynamic: [2 * spacersNum.dp64, 2 * spacersNum.dp64, 2 * spacersNum.dp64, 2 * spacersNum.dp64]
54
+ }, ["aside.__jsx-style-dynamic-selector{height:auto;width:600px;max-width:calc(100vw - ".concat(2 * spacersNum.dp64, "px);max-height:calc(100vh - ").concat(2 * spacersNum.dp64, "px);}"), "aside.small.__jsx-style-dynamic-selector{width:400px;}", "aside.large.__jsx-style-dynamic-selector{width:800px;}", "aside.fluid.__jsx-style-dynamic-selector{width:auto;}", "div.__jsx-style-dynamic-selector{padding:24px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-flow:column;-ms-flex-flow:column;flex-flow:column;max-width:calc(100vw - ".concat(2 * spacersNum.dp64, "px);max-height:calc(100vh - ").concat(2 * spacersNum.dp64, "px);}")]));
54
55
  };
55
56
  Modal.defaultProps = {
56
57
  dataTest: 'dhis2-uicore-modal',
@@ -8,36 +8,7 @@ import { sharedPropTypes } from '@dhis2/ui-constants';
8
8
  import React, { useState } from 'react';
9
9
  import { ModalActions, ModalContent, ModalTitle } from '../index.js';
10
10
  import { Modal } from './modal.js';
11
- const description = `
12
- _**Note**: For performance reasons, only one representative example is shown here. For more (interactive) examples, see individual stories in the Canvas tab._
13
-
14
- A modal focuses user attention on a single task or piece of information inside a container. A modal blocks the rest of the application until it is dismissed.
15
-
16
- #### Usage
17
-
18
- A modal should be used to focus user attention on a single task or piece of information. Modals take over the entire screen and should be used sparingly to avoid interrupting a user's flow too often.
19
-
20
- Use a modal in the following cases:
21
-
22
- - to collect short, focussed user input that is blocking progress
23
- - to present critical information that a user needs to acknowledge before continuing
24
- - to ask the user to confirm a destructive action that cannot be undone
25
-
26
- Do not use a modal in the following cases:
27
-
28
- - to display unrelated or non-critical information; use an alert bar or a notice box instead
29
- - to display complex, workflows that span multiple screens; navigate to a new, full page in the app instead
30
-
31
- #### Children
32
-
33
- Modals should be used with children \`<ModalTitle>\` (optional), \`<ModalContent>\` (required), and \`<ModalActions>\` (recommended)
34
-
35
- See more about modal usage, including alignment and sizing, at [Design System: Modals](https://github.com/dhis2/design-system/blob/master/molecules/modal.md#usage).
36
-
37
- \`\`\`js
38
- import { Modal } from '@dhis2/ui'
39
- \`\`\`
40
- `;
11
+ const description = "\n_**Note**: For performance reasons, only one representative example is shown here. For more (interactive) examples, see individual stories in the Canvas tab._\n\nA modal focuses user attention on a single task or piece of information inside a container. A modal blocks the rest of the application until it is dismissed.\n\n#### Usage\n\nA modal should be used to focus user attention on a single task or piece of information. Modals take over the entire screen and should be used sparingly to avoid interrupting a user's flow too often.\n\nUse a modal in the following cases:\n\n- to collect short, focussed user input that is blocking progress\n- to present critical information that a user needs to acknowledge before continuing\n- to ask the user to confirm a destructive action that cannot be undone\n\nDo not use a modal in the following cases:\n\n- to display unrelated or non-critical information; use an alert bar or a notice box instead\n- to display complex, workflows that span multiple screens; navigate to a new, full page in the app instead\n\n#### Children\n\nModals should be used with children `<ModalTitle>` (optional), `<ModalContent>` (required), and `<ModalActions>` (recommended)\n\nSee more about modal usage, including alignment and sizing, at [Design System: Modals](https://github.com/dhis2/design-system/blob/master/molecules/modal.md#usage).\n\n```js\nimport { Modal } from '@dhis2/ui'\n```\n";
41
12
 
42
13
  const say = something => () => alert(something);
43
14
 
@@ -46,10 +17,12 @@ window.onClose = (payload, event) => {
46
17
  console.log('onClose event', event);
47
18
  };
48
19
 
49
- const onClose = (...args) => window.onClose(...args);
20
+ const onClose = function () {
21
+ return window.onClose(...arguments);
22
+ };
50
23
 
51
24
  export default {
52
- title: 'Layout/Modal',
25
+ title: 'Modal',
53
26
  component: Modal,
54
27
  parameters: {
55
28
  docs: {
@@ -455,20 +428,23 @@ export const LargeModalWithMoreNestedModals = args => /*#__PURE__*/React.createE
455
428
  label: "ten"
456
429
  })), /*#__PURE__*/React.createElement(Tooltip, {
457
430
  content: "Some extra info"
458
- }, ({
459
- ref,
460
- onMouseOver,
461
- onMouseOut
462
- }) => /*#__PURE__*/React.createElement("span", {
463
- ref: ref,
464
- onMouseOver: onMouseOver,
465
- onMouseOut: onMouseOut,
466
- className: "jsx-2364308943"
467
- }, /*#__PURE__*/React.createElement("button", {
468
- className: "jsx-2364308943"
469
- }, "Tooltip on button"), /*#__PURE__*/React.createElement(_JSXStyle, {
470
- id: "2364308943"
471
- }, ["span.jsx-2364308943{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}"]))), /*#__PURE__*/React.createElement(FlyoutMenu, null, /*#__PURE__*/React.createElement(MenuSectionHeader, {
431
+ }, _ref => {
432
+ let {
433
+ ref,
434
+ onMouseOver,
435
+ onMouseOut
436
+ } = _ref;
437
+ return /*#__PURE__*/React.createElement("span", {
438
+ ref: ref,
439
+ onMouseOver: onMouseOver,
440
+ onMouseOut: onMouseOut,
441
+ className: "jsx-2364308943"
442
+ }, /*#__PURE__*/React.createElement("button", {
443
+ className: "jsx-2364308943"
444
+ }, "Tooltip on button"), /*#__PURE__*/React.createElement(_JSXStyle, {
445
+ id: "2364308943"
446
+ }, ["span.jsx-2364308943{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}"]));
447
+ }), /*#__PURE__*/React.createElement(FlyoutMenu, null, /*#__PURE__*/React.createElement(MenuSectionHeader, {
472
448
  label: "Section with sub-menus"
473
449
  }), /*#__PURE__*/React.createElement(MenuItem, {
474
450
  label: "Item 1"
@@ -2,16 +2,19 @@ import _JSXStyle from "styled-jsx/style";
2
2
  import { spacers } from '@dhis2/ui-constants';
3
3
  import PropTypes from 'prop-types';
4
4
  import React from 'react';
5
- export const ModalActions = ({
6
- children,
7
- dataTest
8
- }) => /*#__PURE__*/React.createElement("div", {
9
- "data-test": dataTest,
10
- className: _JSXStyle.dynamic([["2674552674", [spacers.dp16]]])
11
- }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
12
- id: "2674552674",
13
- dynamic: [spacers.dp16]
14
- }, [`div.__jsx-style-dynamic-selector{-webkit-order:3;-ms-flex-order:3;order:3;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:end;-webkit-justify-content:flex-end;-ms-flex-pack:end;justify-content:flex-end;-webkit-align-self:flex-end;-ms-flex-item-align:end;align-self:flex-end;margin:${spacers.dp16} 0 0;}`]));
5
+ export const ModalActions = _ref => {
6
+ let {
7
+ children,
8
+ dataTest
9
+ } = _ref;
10
+ return /*#__PURE__*/React.createElement("div", {
11
+ "data-test": dataTest,
12
+ className: _JSXStyle.dynamic([["2674552674", [spacers.dp16]]])
13
+ }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
14
+ id: "2674552674",
15
+ dynamic: [spacers.dp16]
16
+ }, ["div.__jsx-style-dynamic-selector{-webkit-order:3;-ms-flex-order:3;order:3;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:end;-webkit-justify-content:flex-end;-ms-flex-pack:end;justify-content:flex-end;-webkit-align-self:flex-end;-ms-flex-item-align:end;align-self:flex-end;margin:".concat(spacers.dp16, " 0 0;}")]));
17
+ };
15
18
  ModalActions.defaultProps = {
16
19
  dataTest: 'dhis2-uicore-modalactions'
17
20
  };
@@ -1,16 +1,19 @@
1
1
  import _JSXStyle from "styled-jsx/style";
2
2
  import PropTypes from 'prop-types';
3
3
  import React from 'react';
4
- export const ModalContent = ({
5
- children,
6
- className,
7
- dataTest
8
- }) => /*#__PURE__*/React.createElement("div", {
9
- "data-test": dataTest,
10
- className: "jsx-3719215021" + " " + (className || "")
11
- }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
12
- id: "3719215021"
13
- }, ["div.jsx-3719215021{-webkit-order:2;-ms-flex-order:2;order:2;-webkit-box-flex:2;-webkit-flex-grow:2;-ms-flex-positive:2;flex-grow:2;overflow-y:auto;}"]));
4
+ export const ModalContent = _ref => {
5
+ let {
6
+ children,
7
+ className,
8
+ dataTest
9
+ } = _ref;
10
+ return /*#__PURE__*/React.createElement("div", {
11
+ "data-test": dataTest,
12
+ className: "jsx-3719215021" + " " + (className || "")
13
+ }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
14
+ id: "3719215021"
15
+ }, ["div.jsx-3719215021{-webkit-order:2;-ms-flex-order:2;order:2;-webkit-box-flex:2;-webkit-flex-grow:2;-ms-flex-positive:2;flex-grow:2;overflow-y:auto;}"]));
16
+ };
14
17
  ModalContent.defaultProps = {
15
18
  dataTest: 'dhis2-uicore-modalcontent'
16
19
  };
@@ -3,16 +3,19 @@ import { colors, spacers } from '@dhis2/ui-constants';
3
3
  import cx from 'classnames';
4
4
  import PropTypes from 'prop-types';
5
5
  import React from 'react';
6
- export const ModalTitle = ({
7
- children,
8
- dataTest
9
- }) => /*#__PURE__*/React.createElement("h1", {
10
- "data-test": dataTest,
11
- className: _JSXStyle.dynamic([["4169842822", [colors.grey900, spacers.dp12]]]) + " " + (cx('title') || "")
12
- }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
13
- id: "4169842822",
14
- dynamic: [colors.grey900, spacers.dp12]
15
- }, [`h1.__jsx-style-dynamic-selector{-webkit-order:1;-ms-flex-order:1;order:1;-webkit-align-self:flex-start;-ms-flex-item-align:start;align-self:flex-start;color:${colors.grey900};font-size:20px;font-weight:500;line-height:24px;margin:0 0 ${spacers.dp12};}`]));
6
+ export const ModalTitle = _ref => {
7
+ let {
8
+ children,
9
+ dataTest
10
+ } = _ref;
11
+ return /*#__PURE__*/React.createElement("h1", {
12
+ "data-test": dataTest,
13
+ className: _JSXStyle.dynamic([["4169842822", [colors.grey900, spacers.dp12]]]) + " " + (cx('title') || "")
14
+ }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
15
+ id: "4169842822",
16
+ dynamic: [colors.grey900, spacers.dp12]
17
+ }, ["h1.__jsx-style-dynamic-selector{-webkit-order:1;-ms-flex-order:1;order:1;-webkit-align-self:flex-start;-ms-flex-item-align:start;align-self:flex-start;color:".concat(colors.grey900, ";font-size:20px;font-weight:500;line-height:24px;margin:0 0 ").concat(spacers.dp12, ";}")]));
18
+ };
16
19
  ModalTitle.defaultProps = {
17
20
  dataTest: 'dhis2-uicore-modaltitle'
18
21
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2-ui/modal",
3
- "version": "8.1.11",
3
+ "version": "8.2.2",
4
4
  "description": "UI Modal",
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,12 +32,12 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@dhis2/prop-types": "^3.0.0-beta.1",
35
- "@dhis2-ui/card": "8.1.11",
36
- "@dhis2-ui/center": "8.1.11",
37
- "@dhis2-ui/layer": "8.1.11",
38
- "@dhis2-ui/portal": "8.1.11",
39
- "@dhis2/ui-constants": "8.1.11",
40
- "@dhis2/ui-icons": "8.1.11",
35
+ "@dhis2-ui/card": "8.2.2",
36
+ "@dhis2-ui/center": "8.2.2",
37
+ "@dhis2-ui/layer": "8.2.2",
38
+ "@dhis2-ui/portal": "8.2.2",
39
+ "@dhis2/ui-constants": "8.2.2",
40
+ "@dhis2/ui-icons": "8.2.2",
41
41
  "classnames": "^2.3.1",
42
42
  "prop-types": "^15.7.2"
43
43
  },