@synerise/ds-modal 0.16.3 → 0.16.4
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/CHANGELOG.md +6 -13
- package/README.md +1 -0
- package/dist/Modal.d.ts +10 -0
- package/dist/Modal.js +30 -13
- package/dist/Modal.styles.d.ts +3 -0
- package/dist/Modal.styles.js +14 -2
- package/dist/Modal.types.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,25 +3,18 @@
|
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @synerise/ds-modal
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## [0.16.2](https://github.com/synerise/synerise-design/compare/@synerise/ds-modal@0.15.9...@synerise/ds-modal@0.16.2) (2022-08-04)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package @synerise/ds-modal
|
|
6
|
+
# [0.16.0](https://github.com/synerise/synerise-design/compare/@synerise/ds-modal@0.15.9...@synerise/ds-modal@0.16.0) (2022-07-28)
|
|
17
7
|
|
|
18
8
|
|
|
9
|
+
### Bug Fixes
|
|
19
10
|
|
|
11
|
+
* **modal:** add new option of footers in modal ([61aacf8](https://github.com/synerise/synerise-design/commit/61aacf8b256e4a7e17daeecd374bc7029f8b9bdb))
|
|
12
|
+
* **modal:** fix footer prop with buttons ([0d7b347](https://github.com/synerise/synerise-design/commit/0d7b347947c15be616b34cd963ef68aec8e4b45b))
|
|
20
13
|
|
|
21
14
|
|
|
22
|
-
|
|
15
|
+
### Features
|
|
23
16
|
|
|
24
|
-
**
|
|
17
|
+
* **modal:** buildModalFooter helper, missing onOk onCancel -> disabled ([a9d4c32](https://github.com/synerise/synerise-design/commit/a9d4c3288d9e97abe89c33314bc5fbf0b78c66ba))
|
|
25
18
|
|
|
26
19
|
|
|
27
20
|
|
package/README.md
CHANGED
|
@@ -46,3 +46,4 @@ Modal UI Component
|
|
|
46
46
|
| bodyBackground | Set color for body of modal | `white` / `grey` | `white` |
|
|
47
47
|
| texts | Labels to render | `{ okButton: string; cancelButton: string }` | `{ okButton: 'Apply', cancelButton: 'Cancel' }` |
|
|
48
48
|
| blank | Modal with header which contains only close button | Boolean | `false` |
|
|
49
|
+
| settingButtonText | Text of the setting button | string | `Setting` |
|
package/dist/Modal.d.ts
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import type { ButtonProps } from 'antd/lib/button';
|
|
2
3
|
import '@synerise/ds-core/dist/js/style';
|
|
3
4
|
import './style/index.less';
|
|
4
5
|
import { Props } from './Modal.types';
|
|
6
|
+
export declare type ModalFooterBuilder = {
|
|
7
|
+
prefix?: React.ReactNode;
|
|
8
|
+
infix?: React.ReactNode;
|
|
9
|
+
suffix?: React.ReactNode;
|
|
10
|
+
okButton?: React.ReactNode;
|
|
11
|
+
cancelButton?: React.ReactNode;
|
|
12
|
+
DSButton?: React.FC<ButtonProps>;
|
|
13
|
+
};
|
|
14
|
+
export declare function buildModalFooter({ DSButton, prefix, infix, suffix, ...antModalProps }: Props & ModalFooterBuilder): React.ReactNode;
|
|
5
15
|
declare class ModalProxy extends React.Component<Props> {
|
|
6
16
|
static defaultProps: {
|
|
7
17
|
closable: boolean;
|
package/dist/Modal.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
var _excluded = ["
|
|
2
|
-
|
|
3
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
-
|
|
5
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
1
|
+
var _excluded = ["DSButton", "prefix", "infix", "suffix"],
|
|
2
|
+
_excluded2 = ["texts", "bodyBackground", "closable", "headerActions", "title", "description", "size", "blank", "settingButtonText", "titleContainerStyle"];
|
|
6
3
|
|
|
7
4
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
|
8
5
|
|
|
9
6
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
7
|
|
|
8
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
9
|
+
|
|
10
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
|
+
|
|
11
12
|
import * as React from 'react';
|
|
12
13
|
import Modal from 'antd/lib/modal';
|
|
13
14
|
import Icon, { CloseM } from '@synerise/ds-icon';
|
|
@@ -23,6 +24,27 @@ var mapSizeToWidth = {
|
|
|
23
24
|
extraLarge: 1280,
|
|
24
25
|
fullSize: '100%'
|
|
25
26
|
};
|
|
27
|
+
export function buildModalFooter(_ref) {
|
|
28
|
+
var _ref$DSButton = _ref.DSButton,
|
|
29
|
+
DSButton = _ref$DSButton === void 0 ? Button : _ref$DSButton,
|
|
30
|
+
prefix = _ref.prefix,
|
|
31
|
+
infix = _ref.infix,
|
|
32
|
+
suffix = _ref.suffix,
|
|
33
|
+
antModalProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
34
|
+
|
|
35
|
+
var onOk = antModalProps.onOk,
|
|
36
|
+
onCancel = antModalProps.onCancel,
|
|
37
|
+
texts = antModalProps.texts;
|
|
38
|
+
return /*#__PURE__*/React.createElement(S.FooterContainer, null, prefix, antModalProps.cancelButton || /*#__PURE__*/React.createElement(DSButton, _extends({
|
|
39
|
+
type: "ghost",
|
|
40
|
+
onClick: onCancel,
|
|
41
|
+
disabled: !onCancel
|
|
42
|
+
}, antModalProps.cancelButtonProps), antModalProps.cancelText || (texts == null ? void 0 : texts.cancelButton)), infix, antModalProps.okButton || /*#__PURE__*/React.createElement(DSButton, _extends({
|
|
43
|
+
type: antModalProps.okType || 'primary',
|
|
44
|
+
onClick: onOk,
|
|
45
|
+
disabled: !onOk
|
|
46
|
+
}, antModalProps.okButtonProps), antModalProps.okText || (texts == null ? void 0 : texts.okButton)), suffix);
|
|
47
|
+
}
|
|
26
48
|
|
|
27
49
|
var ModalProxy = /*#__PURE__*/function (_React$Component) {
|
|
28
50
|
_inheritsLoose(ModalProxy, _React$Component);
|
|
@@ -43,8 +65,9 @@ var ModalProxy = /*#__PURE__*/function (_React$Component) {
|
|
|
43
65
|
description = _this$props.description,
|
|
44
66
|
size = _this$props.size,
|
|
45
67
|
blank = _this$props.blank,
|
|
68
|
+
settingButtonText = _this$props.settingButtonText,
|
|
46
69
|
titleContainerStyle = _this$props.titleContainerStyle,
|
|
47
|
-
antModalProps = _objectWithoutPropertiesLoose(_this$props,
|
|
70
|
+
antModalProps = _objectWithoutPropertiesLoose(_this$props, _excluded2);
|
|
48
71
|
|
|
49
72
|
var handleOnClose = antModalProps.onCancel;
|
|
50
73
|
var className = classnames("bodybg-" + bodyBackground, antModalProps.className, {
|
|
@@ -73,13 +96,7 @@ var ModalProxy = /*#__PURE__*/function (_React$Component) {
|
|
|
73
96
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
74
97
|
component: /*#__PURE__*/React.createElement(CloseM, null)
|
|
75
98
|
})))), description && /*#__PURE__*/React.createElement(S.Description, null, description));
|
|
76
|
-
var footerContainer = antModalProps.footer ||
|
|
77
|
-
type: "ghost",
|
|
78
|
-
onClick: antModalProps.onCancel
|
|
79
|
-
}, antModalProps.cancelButtonProps), texts && texts.cancelButton), /*#__PURE__*/React.createElement(Button, _extends({
|
|
80
|
-
type: antModalProps.okType || 'primary',
|
|
81
|
-
onClick: antModalProps.onOk
|
|
82
|
-
}, antModalProps.okButtonProps), texts && texts.okButton));
|
|
99
|
+
var footerContainer = antModalProps.footer || buildModalFooter(this.props);
|
|
83
100
|
return /*#__PURE__*/React.createElement(S.AntdModal, _extends({}, antModalProps, {
|
|
84
101
|
className: className,
|
|
85
102
|
width: !size ? undefined : mapSizeToWidth[size],
|
package/dist/Modal.styles.d.ts
CHANGED
|
@@ -7,4 +7,7 @@ export declare const Title: import("styled-components").StyledComponent<import("
|
|
|
7
7
|
export declare const Description: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
8
8
|
export declare const ActionButtons: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
9
9
|
export declare const FooterContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
10
|
+
export declare const CustomFooterContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
11
|
+
export declare const SettingButton: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
12
|
+
export declare const ButtonsWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
10
13
|
export declare const AntdModal: import("styled-components").StyledComponent<any, any, object & ModalProps, string | number | symbol>;
|
package/dist/Modal.styles.js
CHANGED
|
@@ -26,10 +26,22 @@ export var ActionButtons = styled.div.withConfig({
|
|
|
26
26
|
export var FooterContainer = styled.div.withConfig({
|
|
27
27
|
displayName: "Modalstyles__FooterContainer",
|
|
28
28
|
componentId: "jdspxw-4"
|
|
29
|
-
})(["display:flex;align-items:center;justify-content:flex-end;"]);
|
|
29
|
+
})(["display:flex;align-items:center;justify-content:flex-end;"]);
|
|
30
|
+
export var CustomFooterContainer = styled.div.withConfig({
|
|
31
|
+
displayName: "Modalstyles__CustomFooterContainer",
|
|
32
|
+
componentId: "jdspxw-5"
|
|
33
|
+
})(["display:flex;flex-wrap:nowrap;"]);
|
|
34
|
+
export var SettingButton = styled.div.withConfig({
|
|
35
|
+
displayName: "Modalstyles__SettingButton",
|
|
36
|
+
componentId: "jdspxw-6"
|
|
37
|
+
})(["display:flex;width:100%;"]);
|
|
38
|
+
export var ButtonsWrapper = styled.div.withConfig({
|
|
39
|
+
displayName: "Modalstyles__ButtonsWrapper",
|
|
40
|
+
componentId: "jdspxw-7"
|
|
41
|
+
})(["display:flex;"]); // FIXME: Exported variable 'AntdModal' has or is using name 'ModalInterface' from external module (probabli Antd's types issue)
|
|
30
42
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
43
|
|
|
32
44
|
export var AntdModal = styled(Modal).withConfig({
|
|
33
45
|
displayName: "Modalstyles__AntdModal",
|
|
34
|
-
componentId: "jdspxw-
|
|
46
|
+
componentId: "jdspxw-8"
|
|
35
47
|
})([""]);
|
package/dist/Modal.types.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './Modal';
|
|
1
|
+
export { default, buildModalFooter } from './Modal';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './Modal';
|
|
1
|
+
export { default, buildModalFooter } from './Modal';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-modal",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.4",
|
|
4
4
|
"description": "Modal UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "synerise/synerise-design",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
],
|
|
33
33
|
"types": "dist/index.d.ts",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@synerise/ds-button": "^0.17.
|
|
36
|
-
"@synerise/ds-icon": "^0.49.
|
|
37
|
-
"@synerise/ds-typography": "^0.12.
|
|
35
|
+
"@synerise/ds-button": "^0.17.2",
|
|
36
|
+
"@synerise/ds-icon": "^0.49.0",
|
|
37
|
+
"@synerise/ds-typography": "^0.12.2",
|
|
38
38
|
"classnames": "^2.2.6"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@synerise/ds-utils": "^0.19.0"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "1ff23a390382403be15699d1963ad8f6c26e5ba6"
|
|
49
49
|
}
|