@codacy/ui-components 0.64.15 → 0.64.17
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.
- package/lib/Avatar/Avatar.js +25 -19
- package/lib/Avatar/Avatar.types.js +5 -1
- package/lib/Avatar/gravatar.js +17 -13
- package/lib/Avatar/index.js +16 -1
- package/lib/Banner/Banner.js +45 -32
- package/lib/Banner/Banner.styles.d.ts +11 -12
- package/lib/Banner/Banner.styles.js +26 -15
- package/lib/Banner/Banner.types.js +5 -1
- package/lib/Banner/index.js +27 -2
- package/lib/Button/Button.js +54 -51
- package/lib/Button/index.js +27 -2
- package/lib/Button/styles.d.ts +16 -12
- package/lib/Button/styles.js +58 -44
- package/lib/Button/types.js +5 -1
- package/lib/Checkbox/Checkbox.js +63 -54
- package/lib/Checkbox/CheckboxFilterList.js +46 -32
- package/lib/Checkbox/index.js +38 -3
- package/lib/Checkbox/styles.d.ts +25 -22
- package/lib/Checkbox/styles.js +52 -37
- package/lib/Checkbox/types.js +5 -1
- package/lib/CloseButton/index.js +27 -16
- package/lib/Divider/Divider.js +23 -13
- package/lib/Divider/Divider.styles.d.ts +16 -19
- package/lib/Divider/Divider.styles.js +24 -11
- package/lib/Divider/Divider.types.js +5 -1
- package/lib/Divider/index.js +16 -1
- package/lib/Dropdown/Content/DropdownInput.js +20 -8
- package/lib/Dropdown/Content/DropdownItem.js +29 -21
- package/lib/Dropdown/Content/DropdownSeparator.js +19 -7
- package/lib/Dropdown/Content/index.js +38 -3
- package/lib/Dropdown/Dropdown.js +89 -85
- package/lib/Dropdown/Dropdown.styles.d.ts +37 -34
- package/lib/Dropdown/Dropdown.styles.js +62 -43
- package/lib/Dropdown/Dropdown.types.js +5 -1
- package/lib/Dropdown/Triggers/DropdownButtonTrigger.js +30 -20
- package/lib/Dropdown/Triggers/DropdownLinkTrigger.js +29 -19
- package/lib/Dropdown/Triggers/InputTrigger.js +18 -10
- package/lib/Dropdown/Triggers/SelectTrigger.js +19 -12
- package/lib/Dropdown/Triggers/hooks.js +18 -14
- package/lib/Dropdown/Triggers/index.js +60 -5
- package/lib/Dropdown/Triggers/types.js +5 -1
- package/lib/Dropdown/index.js +49 -4
- package/lib/Flexbox/Flexbox.d.ts +31 -17
- package/lib/Flexbox/Flexbox.js +36 -16
- package/lib/Flexbox/index.js +16 -1
- package/lib/Group/Group.js +17 -8
- package/lib/Group/Group.styles.d.ts +8 -10
- package/lib/Group/Group.styles.js +17 -7
- package/lib/Group/Group.types.js +5 -1
- package/lib/Group/index.js +16 -1
- package/lib/Icon/Icon.js +24 -14
- package/lib/Icon/Icon.styles.d.ts +9 -11
- package/lib/Icon/Icon.styles.js +39 -44
- package/lib/Icon/Icon.types.js +5 -1
- package/lib/Icon/index.js +16 -1
- package/lib/IconAndText/IconAndText.js +33 -21
- package/lib/IconAndText/IconAndText.styles.d.ts +8 -10
- package/lib/IconAndText/IconAndText.styles.js +20 -10
- package/lib/IconAndText/IconAndText.types.js +5 -1
- package/lib/IconAndText/index.js +16 -1
- package/lib/Icons/Chevrons.js +53 -41
- package/lib/Icons/CodacyIcon.js +17 -8
- package/lib/Icons/Messages.js +54 -35
- package/lib/Icons/Search.js +16 -7
- package/lib/Icons/Severities.js +117 -106
- package/lib/Icons/Sorting.js +23 -13
- package/lib/Icons/Spinner.js +19 -10
- package/lib/Icons/Symbols.js +73 -58
- package/lib/Icons/index.js +93 -8
- package/lib/Img/Img.js +44 -37
- package/lib/Img/Img.styles.d.ts +12 -11
- package/lib/Img/Img.styles.js +37 -32
- package/lib/Img/Img.types.js +5 -1
- package/lib/Img/index.js +16 -1
- package/lib/InlineMessage/InlineMessage.js +47 -34
- package/lib/InlineMessage/index.js +16 -1
- package/lib/InlineMessage/types.js +5 -1
- package/lib/Input/Input.js +148 -126
- package/lib/Input/hooks.js +149 -178
- package/lib/Input/index.js +27 -2
- package/lib/Input/styles.d.ts +55 -104
- package/lib/Input/styles.js +85 -54
- package/lib/Input/types.js +5 -1
- package/lib/Labeled/Labeled.js +34 -22
- package/lib/Labeled/index.js +16 -1
- package/lib/Labeled/styles.d.ts +16 -12
- package/lib/Labeled/styles.js +27 -11
- package/lib/Labeled/types.js +5 -1
- package/lib/LeftMenu/LeftMenu.js +20 -11
- package/lib/LeftMenu/LeftMenu.styles.d.ts +8 -10
- package/lib/LeftMenu/LeftMenu.styles.js +20 -10
- package/lib/LeftMenu/LeftMenu.types.js +5 -1
- package/lib/LeftMenu/index.js +16 -1
- package/lib/Link/Link.js +43 -33
- package/lib/Link/Link.styles.d.ts +4 -1
- package/lib/Link/Link.styles.js +21 -11
- package/lib/Link/Link.types.js +5 -1
- package/lib/Link/index.js +38 -3
- package/lib/Message/Message.js +32 -24
- package/lib/Message/Message.styles.d.ts +8 -10
- package/lib/Message/Message.styles.js +17 -7
- package/lib/Message/Message.types.js +5 -1
- package/lib/Message/index.js +16 -1
- package/lib/Modal/ConfirmationModal.js +65 -39
- package/lib/Modal/Modal.js +120 -107
- package/lib/Modal/index.js +27 -2
- package/lib/Modal/styles.d.ts +44 -61
- package/lib/Modal/styles.js +97 -85
- package/lib/Modal/types.d.ts +1 -0
- package/lib/Modal/types.js +5 -1
- package/lib/MoreInfo/MoreInfo.js +45 -39
- package/lib/MoreInfo/index.js +16 -1
- package/lib/MoreInfo/types.js +5 -1
- package/lib/Panel/Panel.js +18 -9
- package/lib/Panel/Panel.styles.d.ts +8 -11
- package/lib/Panel/Panel.styles.js +15 -5
- package/lib/Panel/Panel.types.js +5 -1
- package/lib/Panel/index.js +27 -2
- package/lib/PillLabel/PillLabel.js +28 -21
- package/lib/PillLabel/PillLabel.styles.d.ts +8 -10
- package/lib/PillLabel/PillLabel.styles.js +25 -16
- package/lib/PillLabel/PillLabel.types.js +5 -1
- package/lib/PillLabel/index.js +16 -1
- package/lib/Popup/Popup.js +55 -45
- package/lib/Popup/index.js +16 -1
- package/lib/Popup/styles.d.ts +12 -11
- package/lib/Popup/styles.js +21 -8
- package/lib/Popup/types.js +5 -1
- package/lib/ProgressBar/ProgressBar.js +30 -20
- package/lib/ProgressBar/index.js +27 -2
- package/lib/ProgressBar/styles.d.ts +24 -28
- package/lib/ProgressBar/styles.js +30 -14
- package/lib/ProgressBar/types.js +5 -1
- package/lib/Radio/Radio.js +53 -48
- package/lib/Radio/index.js +16 -1
- package/lib/Radio/styles.d.ts +25 -22
- package/lib/Radio/styles.js +49 -30
- package/lib/Radio/types.js +5 -1
- package/lib/ScrollableContent/ScrollableContent.js +35 -24
- package/lib/ScrollableContent/ScrollableContent.styles.d.ts +9 -11
- package/lib/ScrollableContent/ScrollableContent.styles.js +23 -13
- package/lib/ScrollableContent/ScrollableContent.types.js +5 -1
- package/lib/ScrollableContent/index.js +27 -2
- package/lib/ScrollableContent/useScrollContainer.js +29 -24
- package/lib/Select/Select.js +31 -20
- package/lib/Select/index.js +16 -1
- package/lib/Select/types.js +5 -1
- package/lib/Skeleton/Skeleton.js +30 -25
- package/lib/Skeleton/Skeleton.styles.d.ts +8 -10
- package/lib/Skeleton/Skeleton.styles.js +21 -14
- package/lib/Skeleton/Skeleton.types.js +5 -1
- package/lib/Skeleton/index.js +20 -2
- package/lib/Stepper/Stepper.js +49 -40
- package/lib/Stepper/Stepper.styles.d.ts +24 -29
- package/lib/Stepper/Stepper.styles.js +35 -19
- package/lib/Stepper/Stepper.types.js +5 -1
- package/lib/Stepper/index.js +16 -1
- package/lib/Switcher/Switcher.js +32 -23
- package/lib/Switcher/Switcher.styles.d.ts +13 -13
- package/lib/Switcher/Switcher.styles.js +27 -15
- package/lib/Switcher/Switcher.types.js +5 -1
- package/lib/Switcher/index.js +16 -1
- package/lib/Tab/Tab.js +31 -23
- package/lib/Tab/Tab.styles.d.ts +13 -12
- package/lib/Tab/Tab.styles.js +30 -21
- package/lib/Tab/Tab.types.js +5 -1
- package/lib/Tab/index.js +16 -1
- package/lib/Table/NewSelectableTable.js +77 -56
- package/lib/Table/SelectableTable.js +138 -118
- package/lib/Table/Table.js +126 -111
- package/lib/Table/Table.styles.d.ts +32 -16
- package/lib/Table/Table.styles.js +79 -59
- package/lib/Table/Table.types.js +5 -1
- package/lib/Table/index.js +27 -2
- package/lib/TagsInput/TagsInput.js +44 -33
- package/lib/TagsInput/index.js +16 -1
- package/lib/TagsInput/style.d.ts +16 -19
- package/lib/TagsInput/style.js +22 -9
- package/lib/TagsInput/types.js +5 -1
- package/lib/Textarea/Textarea.js +75 -58
- package/lib/Textarea/Textarea.styles.d.ts +28 -22
- package/lib/Textarea/Textarea.styles.js +55 -32
- package/lib/Textarea/Textarea.types.js +5 -1
- package/lib/Textarea/index.js +16 -1
- package/lib/ThemeProvider/ThemeProvider.d.ts +5 -2
- package/lib/ThemeProvider/ThemeProvider.js +48 -30
- package/lib/ThemeProvider/index.js +16 -1
- package/lib/Toast/Toast.js +56 -53
- package/lib/Toast/index.js +16 -1
- package/lib/Toast/styles.d.ts +4 -2
- package/lib/Toast/styles.js +13 -3
- package/lib/Toast/types.js +5 -1
- package/lib/Toggle/Toggle.js +59 -50
- package/lib/Toggle/index.js +16 -1
- package/lib/Toggle/styles.d.ts +21 -14
- package/lib/Toggle/styles.js +51 -34
- package/lib/Toggle/types.js +5 -1
- package/lib/Tooltip/Tooltip.js +100 -102
- package/lib/Tooltip/index.js +16 -1
- package/lib/Tooltip/styles.d.ts +14 -8
- package/lib/Tooltip/styles.js +33 -25
- package/lib/Tooltip/types.js +5 -1
- package/lib/Typography/Typography.js +96 -85
- package/lib/Typography/Typography.styles.d.ts +48 -54
- package/lib/Typography/Typography.styles.js +70 -45
- package/lib/Typography/Typography.types.js +5 -1
- package/lib/Typography/index.js +38 -3
- package/lib/emotion.d.js +3 -0
- package/lib/hooks/index.js +38 -3
- package/lib/hooks/useForwardedRef.js +11 -6
- package/lib/hooks/useInfiniteScroll.js +24 -20
- package/lib/hooks/useStatefulRef.js +18 -14
- package/lib/index.js +489 -44
- package/lib/system-props/color.js +8 -2
- package/lib/system-props/index.js +27 -2
- package/lib/system-props/types.js +5 -1
- package/lib/theme/ColorSchemes/codacy.js +11 -4
- package/lib/theme/ColorSchemes/pulse.js +17 -9
- package/lib/theme/index.js +38 -3
- package/lib/theme/theme.js +42 -69
- package/lib/types.js +5 -1
- package/lib/utils/hash.js +8 -6
- package/lib/utils/reactNodeToText.js +13 -14
- package/package.json +32 -32
|
@@ -1,45 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
var _excluded = ["title", "confirmText", "onConfirm", "cancelText", "onCancel", "variant", "icon", "children"];
|
|
3
|
-
import React, { useCallback, useRef } from 'react';
|
|
4
|
-
import { Modal } from '.';
|
|
5
|
-
import { Button, ButtonGroup, IconAndText, Subheader } from '..';
|
|
6
|
-
export var ConfirmationModal = function ConfirmationModal(_ref) {
|
|
7
|
-
var title = _ref.title,
|
|
8
|
-
confirmText = _ref.confirmText,
|
|
9
|
-
onConfirm = _ref.onConfirm,
|
|
10
|
-
_ref$cancelText = _ref.cancelText,
|
|
11
|
-
cancelText = _ref$cancelText === void 0 ? 'Cancel' : _ref$cancelText,
|
|
12
|
-
onCancel = _ref.onCancel,
|
|
13
|
-
_ref$variant = _ref.variant,
|
|
14
|
-
variant = _ref$variant === void 0 ? 'primary' : _ref$variant,
|
|
15
|
-
icon = _ref.icon,
|
|
16
|
-
children = _ref.children,
|
|
17
|
-
dialog = _objectWithoutProperties(_ref, _excluded);
|
|
1
|
+
"use strict";
|
|
18
2
|
|
|
19
|
-
|
|
20
|
-
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.ConfirmationModal = void 0;
|
|
9
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _ = require(".");
|
|
13
|
+
var _2 = require("..");
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
var _excluded = ["title", "confirmText", "onConfirm", "cancelText", "onCancel", "variant", "icon", "isLoading", "children"];
|
|
16
|
+
var ConfirmationModal = exports.ConfirmationModal = function ConfirmationModal(_ref) {
|
|
17
|
+
var title = _ref.title,
|
|
18
|
+
confirmText = _ref.confirmText,
|
|
19
|
+
onConfirm = _ref.onConfirm,
|
|
20
|
+
_ref$cancelText = _ref.cancelText,
|
|
21
|
+
cancelText = _ref$cancelText === void 0 ? 'Cancel' : _ref$cancelText,
|
|
22
|
+
onCancel = _ref.onCancel,
|
|
23
|
+
_ref$variant = _ref.variant,
|
|
24
|
+
variant = _ref$variant === void 0 ? 'primary' : _ref$variant,
|
|
25
|
+
icon = _ref.icon,
|
|
26
|
+
isLoading = _ref.isLoading,
|
|
27
|
+
children = _ref.children,
|
|
28
|
+
dialog = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
29
|
+
var cancelRef = (0, _react.useRef)(null);
|
|
30
|
+
var handleCancel = (0, _react.useCallback)(function () {
|
|
21
31
|
if (onCancel) onCancel();
|
|
22
32
|
dialog.hide();
|
|
23
33
|
}, [onCancel, dialog]);
|
|
24
|
-
return /*#__PURE__*/
|
|
34
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_.Modal, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({
|
|
25
35
|
focusRef: cancelRef
|
|
26
|
-
}, dialog),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
}, dialog), {}, {
|
|
37
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.Modal.Header, {
|
|
38
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_2.Subheader, {
|
|
39
|
+
children: icon ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_2.IconAndText, {
|
|
40
|
+
icon: icon,
|
|
41
|
+
iconProps: {
|
|
42
|
+
color: "icon-".concat(variant)
|
|
43
|
+
},
|
|
44
|
+
children: title
|
|
45
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
46
|
+
children: title
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Modal.Body, {
|
|
50
|
+
mt: 4,
|
|
51
|
+
children: children
|
|
52
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Modal.Footer, {
|
|
53
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_2.ButtonGroup, {
|
|
54
|
+
mt: 5,
|
|
55
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_2.Button, {
|
|
56
|
+
variant: "primary",
|
|
57
|
+
color: variant,
|
|
58
|
+
onClick: onConfirm,
|
|
59
|
+
isLoading: isLoading,
|
|
60
|
+
children: confirmText
|
|
61
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_2.Button, {
|
|
62
|
+
variant: "link",
|
|
63
|
+
color: "subtle",
|
|
64
|
+
onClick: handleCancel,
|
|
65
|
+
ref: cancelRef,
|
|
66
|
+
children: cancelText
|
|
67
|
+
})]
|
|
68
|
+
})
|
|
69
|
+
})]
|
|
70
|
+
}));
|
|
45
71
|
};
|
package/lib/Modal/Modal.js
CHANGED
|
@@ -1,45 +1,51 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useModal = exports.Modal = void 0;
|
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _CloseButton = require("../CloseButton");
|
|
12
|
+
var _styles = require("./styles");
|
|
13
|
+
var _Dialog = require("reakit/Dialog");
|
|
14
|
+
var _Typography = require("../Typography");
|
|
15
|
+
var _Flexbox = require("../Flexbox");
|
|
16
|
+
var _ = require("..");
|
|
17
|
+
var _lodash = require("lodash");
|
|
18
|
+
var _ScrollableContent = require("../ScrollableContent");
|
|
19
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
2
20
|
var _excluded = ["title", "description", "role", "headerImg", "size", "vPos", "focusRef", "children", "tabIndex", "showCloseButton", "p"],
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { CloseButton } from '../CloseButton';
|
|
9
|
-
import { Overlay, ModalBox, CloseBtnLocation, ModalHeaderBox, ModalBodyBox, ModalFooterBox } from './styles';
|
|
10
|
-
import { useDialogState, Dialog, DialogBackdrop } from 'reakit/Dialog';
|
|
11
|
-
import { Subheader, Paragraph } from '../Typography';
|
|
12
|
-
import { Box } from '../Flexbox';
|
|
13
|
-
import { Img } from '..';
|
|
14
|
-
import { isObject } from 'lodash';
|
|
15
|
-
import { useScrollContainer } from '../ScrollableContent';
|
|
21
|
+
_excluded2 = ["headerImg", "title", "description", "id", "children"],
|
|
22
|
+
_excluded3 = ["children"],
|
|
23
|
+
_excluded4 = ["atTop", "atBottom", "scroll", "height"],
|
|
24
|
+
_excluded5 = ["children"];
|
|
16
25
|
var defaultModalPadding = 6;
|
|
17
|
-
|
|
18
26
|
function findChild(ofType, children) {
|
|
19
|
-
return
|
|
20
|
-
return child && isObject(child) && 'type' in child && isObject(child.type) && child.type.name === ofType.name;
|
|
27
|
+
return _react["default"].Children.toArray(children).find(function (child) {
|
|
28
|
+
return child && (0, _lodash.isObject)(child) && 'type' in child && (0, _lodash.isObject)(child.type) && child.type.name === ofType.name;
|
|
21
29
|
});
|
|
22
30
|
}
|
|
23
|
-
|
|
24
31
|
var ModalComponent = function ModalComponent(_ref) {
|
|
25
32
|
var title = _ref.title,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
description = _ref.description,
|
|
34
|
+
_ref$role = _ref.role,
|
|
35
|
+
role = _ref$role === void 0 ? 'dialog' : _ref$role,
|
|
36
|
+
headerImg = _ref.headerImg,
|
|
37
|
+
_ref$size = _ref.size,
|
|
38
|
+
size = _ref$size === void 0 ? 'xs' : _ref$size,
|
|
39
|
+
_ref$vPos = _ref.vPos,
|
|
40
|
+
vPos = _ref$vPos === void 0 ? 'top' : _ref$vPos,
|
|
41
|
+
focusRef = _ref.focusRef,
|
|
42
|
+
children = _ref.children,
|
|
43
|
+
tabIndex = _ref.tabIndex,
|
|
44
|
+
_ref$showCloseButton = _ref.showCloseButton,
|
|
45
|
+
showCloseButton = _ref$showCloseButton === void 0 ? false : _ref$showCloseButton,
|
|
46
|
+
_ref$p = _ref.p,
|
|
47
|
+
p = _ref$p === void 0 ? defaultModalPadding : _ref$p,
|
|
48
|
+
dialog = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
43
49
|
var labelProps = {
|
|
44
50
|
'aria-labelledby': "modal-title-".concat(dialog.baseId)
|
|
45
51
|
};
|
|
@@ -47,105 +53,112 @@ var ModalComponent = function ModalComponent(_ref) {
|
|
|
47
53
|
var childHeader = findChild(ModalHeader, children);
|
|
48
54
|
var childBody = findChild(ModalBody, children);
|
|
49
55
|
var childFooter = findChild(ModalFooter, children);
|
|
50
|
-
return /*#__PURE__*/
|
|
56
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dialog.DialogBackdrop, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({
|
|
51
57
|
role: "presentation",
|
|
52
|
-
as: Overlay
|
|
53
|
-
}, dialog),
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
58
|
+
as: _styles.Overlay
|
|
59
|
+
}, dialog), {}, {
|
|
60
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Dialog.Dialog, (0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, dialog), labelProps), {}, {
|
|
61
|
+
as: _styles.ModalBox,
|
|
62
|
+
id: dialog.baseId,
|
|
63
|
+
role: role,
|
|
64
|
+
hideOnEsc: !isAlert,
|
|
65
|
+
hideOnClickOutside: !isAlert,
|
|
66
|
+
unstable_initialFocusRef: focusRef,
|
|
67
|
+
tabIndex: tabIndex,
|
|
68
|
+
size: size,
|
|
69
|
+
vPos: vPos,
|
|
70
|
+
children: [!!childHeader ? childHeader : /*#__PURE__*/(0, _jsxRuntime.jsx)(ModalHeader, {
|
|
71
|
+
headerImg: headerImg,
|
|
72
|
+
title: title,
|
|
73
|
+
description: description,
|
|
74
|
+
pt: defaultModalPadding,
|
|
75
|
+
px: defaultModalPadding,
|
|
76
|
+
id: dialog.baseId
|
|
77
|
+
}), childBody ? childBody : /*#__PURE__*/(0, _jsxRuntime.jsx)(ModalBody, {
|
|
78
|
+
pt: defaultModalPadding / 2,
|
|
79
|
+
pb: defaultModalPadding,
|
|
80
|
+
children: children
|
|
81
|
+
}), childFooter, (!isAlert || showCloseButton) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.CloseBtnLocation, {
|
|
82
|
+
padding: defaultModalPadding,
|
|
83
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CloseButton.CloseButton, {
|
|
84
|
+
onClick: dialog.hide
|
|
85
|
+
})
|
|
86
|
+
})]
|
|
87
|
+
}))
|
|
88
|
+
}));
|
|
78
89
|
};
|
|
79
|
-
|
|
80
90
|
var ModalHeader = function ModalHeader(_ref2) {
|
|
81
91
|
var headerImg = _ref2.headerImg,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
92
|
+
title = _ref2.title,
|
|
93
|
+
description = _ref2.description,
|
|
94
|
+
id = _ref2.id,
|
|
95
|
+
children = _ref2.children,
|
|
96
|
+
props = (0, _objectWithoutProperties2["default"])(_ref2, _excluded2);
|
|
88
97
|
var titleProps = id && {
|
|
89
98
|
id: "modal-title-".concat(id)
|
|
90
99
|
};
|
|
91
|
-
return /*#__PURE__*/
|
|
100
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.ModalHeaderBox, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({
|
|
92
101
|
px: defaultModalPadding,
|
|
93
102
|
pt: defaultModalPadding
|
|
94
|
-
}, props),
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
}, props), {}, {
|
|
104
|
+
children: [headerImg && /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Img, {
|
|
105
|
+
src: headerImg.src,
|
|
106
|
+
alt: headerImg.alt,
|
|
107
|
+
width: headerImg.width,
|
|
108
|
+
transparent: true,
|
|
109
|
+
mr: 4
|
|
110
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Flexbox.Box, {
|
|
111
|
+
pr: 5,
|
|
112
|
+
flexGrow: 1,
|
|
113
|
+
children: [title && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.Subheader, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, titleProps), {}, {
|
|
114
|
+
children: title
|
|
115
|
+
})), description && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.Paragraph, {
|
|
116
|
+
mt: 2,
|
|
117
|
+
as: "div",
|
|
118
|
+
children: description
|
|
119
|
+
}), children]
|
|
120
|
+
})]
|
|
121
|
+
}));
|
|
122
|
+
};
|
|
108
123
|
|
|
124
|
+
// On future usages we should start using these components
|
|
109
125
|
|
|
110
126
|
var ModalBody = function ModalBody(_ref3) {
|
|
111
127
|
var children = _ref3.children,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
return /*#__PURE__*/React.createElement(ModalBodyBox, Object.assign({
|
|
128
|
+
props = (0, _objectWithoutProperties2["default"])(_ref3, _excluded3);
|
|
129
|
+
var _useScrollContainer = (0, _ScrollableContent.useScrollContainer)(),
|
|
130
|
+
atTop = _useScrollContainer.atTop,
|
|
131
|
+
atBottom = _useScrollContainer.atBottom,
|
|
132
|
+
scroll = _useScrollContainer.scroll,
|
|
133
|
+
height = _useScrollContainer.height,
|
|
134
|
+
divProps = (0, _objectWithoutProperties2["default"])(_useScrollContainer, _excluded4);
|
|
135
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.ModalBodyBox, (0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({
|
|
122
136
|
px: defaultModalPadding,
|
|
123
137
|
moreTop: !atTop,
|
|
124
138
|
moreBottom: !atBottom
|
|
125
|
-
}, props, divProps),
|
|
139
|
+
}, props), divProps), {}, {
|
|
140
|
+
children: children
|
|
141
|
+
}));
|
|
126
142
|
};
|
|
127
|
-
|
|
128
143
|
var ModalFooter = function ModalFooter(_ref4) {
|
|
129
144
|
var children = _ref4.children,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
return /*#__PURE__*/React.createElement(ModalFooterBox, Object.assign({
|
|
145
|
+
props = (0, _objectWithoutProperties2["default"])(_ref4, _excluded5);
|
|
146
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.ModalFooterBox, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({
|
|
133
147
|
px: defaultModalPadding,
|
|
134
148
|
pb: defaultModalPadding
|
|
135
|
-
}, props),
|
|
149
|
+
}, props), {}, {
|
|
150
|
+
children: children
|
|
151
|
+
}));
|
|
136
152
|
};
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
return useDialogState({
|
|
153
|
+
var useModal = exports.useModal = function useModal(id, visibleOnMount) {
|
|
154
|
+
return (0, _Dialog.useDialogState)({
|
|
140
155
|
baseId: id,
|
|
141
156
|
animated: true,
|
|
142
157
|
visible: visibleOnMount
|
|
143
158
|
});
|
|
144
159
|
};
|
|
145
|
-
|
|
146
|
-
var Modal = Object.assign(ModalComponent, {
|
|
160
|
+
var Modal = exports.Modal = Object.assign(ModalComponent, {
|
|
147
161
|
Header: ModalHeader,
|
|
148
162
|
Body: ModalBody,
|
|
149
163
|
Footer: ModalFooter
|
|
150
|
-
});
|
|
151
|
-
export { Modal, useModal };
|
|
164
|
+
});
|
package/lib/Modal/index.js
CHANGED
|
@@ -1,2 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _Modal = require("./Modal");
|
|
7
|
+
Object.keys(_Modal).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _Modal[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return _Modal[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _ConfirmationModal = require("./ConfirmationModal");
|
|
18
|
+
Object.keys(_ConfirmationModal).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _ConfirmationModal[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function get() {
|
|
24
|
+
return _ConfirmationModal[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
package/lib/Modal/styles.d.ts
CHANGED
|
@@ -1,66 +1,49 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { CodacyTheme } from '../theme';
|
|
3
2
|
import { ModalProps } from './types';
|
|
4
|
-
export declare const Overlay: import("@emotion/styled
|
|
5
|
-
theme?:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
} &
|
|
16
|
-
theme?:
|
|
17
|
-
}
|
|
18
|
-
export declare const ModalHeaderBox: import("@emotion/styled
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}, "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "as" | "theme" | keyof import("react").HTMLAttributes<HTMLDivElement> | keyof import("..").ColorProps | keyof import("..").LayoutProps | keyof import("..").SpaceProps | keyof import("..").BorderProps | keyof import("..").PositionProps | keyof import("..").ShadowProps | keyof import("..").FlexboxProps>, object>;
|
|
35
|
-
export declare const ModalBodyBox: import("@emotion/styled-base").StyledComponent<Pick<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Pick<import("..").ColorProps & import("..").LayoutProps & import("..").SpaceProps & import("..").BorderProps & import("..").PositionProps & import("..").ShadowProps & import("..").TextAlignProps & Omit<import("..").TypographyProps, "fontWeight"> & import("..").As & {
|
|
36
|
-
fontWeight?: import("styled-system").ResponsiveValue<number | import("..").FontWeights, CodacyTheme> | undefined;
|
|
37
|
-
}, "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "as" | keyof import("..").ColorProps | keyof import("..").LayoutProps | keyof import("..").SpaceProps | keyof import("..").BorderProps | keyof import("..").PositionProps | keyof import("..").ShadowProps> & {
|
|
38
|
-
theme?: object | undefined;
|
|
39
|
-
}, "key" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "as" | "theme" | keyof import("react").HTMLAttributes<HTMLDivElement> | keyof import("..").ColorProps | keyof import("..").LayoutProps | keyof import("..").SpaceProps | keyof import("..").BorderProps | keyof import("..").PositionProps | keyof import("..").ShadowProps> & {
|
|
40
|
-
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
41
|
-
} & Pick<import("..").BoxProps, "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "as" | keyof import("..").ColorProps | keyof import("..").LayoutProps | keyof import("..").SpaceProps | keyof import("..").BorderProps | keyof import("..").PositionProps | keyof import("..").ShadowProps | keyof import("..").FlexboxProps | keyof import("..").GridboxProps> & {
|
|
42
|
-
theme?: object | undefined;
|
|
43
|
-
}, {
|
|
3
|
+
export declare const Overlay: import("@emotion/styled").StyledComponent<{
|
|
4
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
5
|
+
as?: import("react").ElementType<any> | undefined;
|
|
6
|
+
} & import("react").HTMLAttributes<HTMLDivElement> & import("react").ClassAttributes<HTMLDivElement> & {
|
|
7
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
8
|
+
} & Record<string, unknown>, {}, {}>;
|
|
9
|
+
export declare const ModalBox: import("@emotion/styled").StyledComponent<{
|
|
10
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
11
|
+
as?: import("react").ElementType<any> | undefined;
|
|
12
|
+
} & import("..").ColorProps & Omit<import("..").LayoutProps, "size"> & import("..").SpaceProps & import("..").BorderProps & import("..").PositionProps & import("..").ShadowProps & import("..").TextAlignProps & Omit<import("..").TypographyProps, "fontWeight"> & import("..").As & {
|
|
13
|
+
fontWeight?: import("styled-system").ResponsiveValue<number | import("..").FontWeights, import("..").CodacyTheme> | undefined;
|
|
14
|
+
} & import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
15
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
16
|
+
} & import("..").FlexboxProps & Pick<ModalProps, "size" | "vPos">, {}, {}>;
|
|
17
|
+
export declare const ModalHeaderBox: import("@emotion/styled").StyledComponent<{
|
|
18
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
19
|
+
as?: import("react").ElementType<any> | undefined;
|
|
20
|
+
} & import("..").ColorProps & Omit<import("..").LayoutProps, "size"> & import("..").SpaceProps & import("..").BorderProps & import("..").PositionProps & import("..").ShadowProps & import("..").TextAlignProps & Omit<import("..").TypographyProps, "fontWeight"> & import("..").As & {
|
|
21
|
+
fontWeight?: import("styled-system").ResponsiveValue<number | import("..").FontWeights, import("..").CodacyTheme> | undefined;
|
|
22
|
+
} & import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
23
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
24
|
+
} & import("..").FlexboxProps, {}, {}>;
|
|
25
|
+
export declare const ModalBodyBox: import("@emotion/styled").StyledComponent<{
|
|
26
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
27
|
+
as?: import("react").ElementType<any> | undefined;
|
|
28
|
+
} & import("..").ColorProps & Omit<import("..").LayoutProps, "size"> & import("..").SpaceProps & import("..").BorderProps & import("..").PositionProps & import("..").ShadowProps & import("..").TextAlignProps & Omit<import("..").TypographyProps, "fontWeight"> & import("..").As & {
|
|
29
|
+
fontWeight?: import("styled-system").ResponsiveValue<number | import("..").FontWeights, import("..").CodacyTheme> | undefined;
|
|
30
|
+
} & import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
31
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
32
|
+
} & import("..").FlexboxProps & import("..").GridboxProps & {
|
|
44
33
|
moreTop: boolean;
|
|
45
34
|
moreBottom: boolean;
|
|
46
|
-
},
|
|
47
|
-
export declare const ModalFooterBox: import("@emotion/styled
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}, "key" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "as" | "theme" | keyof import("react").HTMLAttributes<HTMLDivElement> | keyof import("..").ColorProps | keyof import("..").LayoutProps | keyof import("..").SpaceProps | keyof import("..").BorderProps | keyof import("..").PositionProps | keyof import("..").ShadowProps> & {
|
|
60
|
-
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
61
|
-
} & Pick<import("..").BoxProps, "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "as" | keyof import("..").ColorProps | keyof import("..").LayoutProps | keyof import("..").SpaceProps | keyof import("..").BorderProps | keyof import("..").PositionProps | keyof import("..").ShadowProps | keyof import("..").FlexboxProps | keyof import("..").GridboxProps> & {
|
|
62
|
-
theme?: object | undefined;
|
|
63
|
-
}, "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "as" | "theme" | keyof import("react").HTMLAttributes<HTMLDivElement> | keyof import("..").ColorProps | keyof import("..").LayoutProps | keyof import("..").SpaceProps | keyof import("..").BorderProps | keyof import("..").PositionProps | keyof import("..").ShadowProps | keyof import("..").FlexboxProps | keyof import("..").GridboxProps>, object>;
|
|
64
|
-
export declare const CloseBtnLocation: import("@emotion/styled-base").StyledComponent<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
35
|
+
}, {}, {}>;
|
|
36
|
+
export declare const ModalFooterBox: import("@emotion/styled").StyledComponent<{
|
|
37
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
38
|
+
as?: import("react").ElementType<any> | undefined;
|
|
39
|
+
} & import("..").ColorProps & Omit<import("..").LayoutProps, "size"> & import("..").SpaceProps & import("..").BorderProps & import("..").PositionProps & import("..").ShadowProps & import("..").TextAlignProps & Omit<import("..").TypographyProps, "fontWeight"> & import("..").As & {
|
|
40
|
+
fontWeight?: import("styled-system").ResponsiveValue<number | import("..").FontWeights, import("..").CodacyTheme> | undefined;
|
|
41
|
+
} & import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
42
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
43
|
+
} & import("..").FlexboxProps & import("..").GridboxProps, {}, {}>;
|
|
44
|
+
export declare const CloseBtnLocation: import("@emotion/styled").StyledComponent<{
|
|
45
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
46
|
+
as?: import("react").ElementType<any> | undefined;
|
|
47
|
+
} & {
|
|
65
48
|
padding: number;
|
|
66
|
-
},
|
|
49
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|