oa-componentbook 0.17.0 → 0.17.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.
- package/build/components/oa-component-button/CustomButton.js +15 -6
- package/build/components/oa-component-button/styles.js +1 -1
- package/build/components/oa-component-checkbox/CustomCheckBox.js +16 -7
- package/build/components/oa-component-drawer/CustomDrawer.js +6 -5
- package/build/components/oa-component-notification/CustomNotification.js +61 -30
- package/build/components/oa-component-notification/styles.js +5 -4
- package/build/components/oa-component-notification/usage-example.md +44 -0
- package/build/components/oa-component-radio/CustomRadio.js +6 -4
- package/build/index.js +7 -7
- package/build/widgets/oa-widget-address/Address.js +11 -7
- package/build/widgets/oa-widget-approval/ApprovalWidget.js +1 -3
- package/build/widgets/oa-widget-close-claim/CloseClaim.js +17 -13
- package/build/widgets/oa-widget-send-payment-link/SendPaymentLink.js +13 -11
- package/build/widgets/oa-widget-send-payment-link/styles.js +3 -5
- package/package.json +17 -4
- /package/build/widgets/oa-widget-send-payment-link/{example-usage.md → usage-example.md} +0 -0
|
@@ -21,7 +21,7 @@ function CustomButton(_ref) {
|
|
|
21
21
|
className,
|
|
22
22
|
disabled,
|
|
23
23
|
onClick,
|
|
24
|
-
|
|
24
|
+
iconConfig,
|
|
25
25
|
size,
|
|
26
26
|
label,
|
|
27
27
|
type,
|
|
@@ -34,25 +34,34 @@ function CustomButton(_ref) {
|
|
|
34
34
|
type: "button"
|
|
35
35
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
36
36
|
className: "text-container"
|
|
37
|
-
},
|
|
37
|
+
}, iconConfig.position === 'left' && iconConfig.icon, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
38
38
|
typography: typography
|
|
39
|
-
}, label),
|
|
39
|
+
}, label), iconConfig.position === 'right' && iconConfig.icon));
|
|
40
40
|
}
|
|
41
41
|
CustomButton.propTypes = {
|
|
42
42
|
className: _propTypes.default.string,
|
|
43
43
|
disabled: _propTypes.default.bool,
|
|
44
44
|
onClick: _propTypes.default.func.isRequired,
|
|
45
45
|
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
46
|
-
|
|
46
|
+
iconConfig: _propTypes.default.shape({
|
|
47
|
+
icon: _propTypes.default.node,
|
|
48
|
+
position: _propTypes.default.oneOf(['left', 'right']),
|
|
49
|
+
style: _propTypes.default.objectOf(_propTypes.default.string || _propTypes.default.number)
|
|
50
|
+
}),
|
|
47
51
|
label: _propTypes.default.string.isRequired,
|
|
48
52
|
type: _propTypes.default.oneOf(['primary', 'secondary', 'text-only', 'danger-primary', 'danger-secondary', 'danger-text-only']),
|
|
49
|
-
|
|
53
|
+
/*
|
|
54
|
+
This needs to be done because storybook treats the array
|
|
55
|
+
'typographyOptions` as an object, so indices are shown in the storybook
|
|
56
|
+
select menu instead of the values at those indices.
|
|
57
|
+
*/
|
|
58
|
+
typography: _propTypes.default.oneOf(Array.from(_Typography.typographyOptions))
|
|
50
59
|
};
|
|
51
60
|
CustomButton.defaultProps = {
|
|
52
61
|
className: '',
|
|
53
62
|
disabled: false,
|
|
63
|
+
iconConfig: {},
|
|
54
64
|
size: 'medium',
|
|
55
|
-
iconPosition: 'none',
|
|
56
65
|
type: 'primary',
|
|
57
66
|
typography: 'type-button-500'
|
|
58
67
|
};
|
|
@@ -33,6 +33,6 @@ const getSizeStyles = size => {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
-
const StyledButton = _styledComponents.default.button(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n border-radius: 4px;\n cursor: pointer;\n\n .text-container {\n display: flex;\n align-items: center;\n justify-content: center;\n
|
|
36
|
+
const StyledButton = _styledComponents.default.button(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n border-radius: 4px;\n cursor: pointer;\n\n .text-container {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px; \n }\n"])));
|
|
37
37
|
const ColoredStyledButton = (0, _styledComponents.default)(StyledButton)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n\n ", "\n\n &.primary {\n background: var(--color-blue-CTA);\n border: 1px solid var(--color-blue-CTA);\n color: var(--color-white-background);\n }\n &.primary:hover {\n background: var(--color-blue-hover);\n border: 1px solid var(--color-blue-hover);\n }\n\n &.primary-disabled {\n background: var(--color-grey2-disabled);\n cursor: not-allowed;\n color: var(--color-white-background);\n }\n\n &.secondary {\n background: var(--color-white-background);\n border: 1px solid var(--color-blue-CTA);\n color: var(--color-blue-CTA);\n }\n &.secondary:hover {\n border: 1px solid var(--color-blue-hover);\n color: var(--color-blue-hover);\n }\n\n &.secondary-disabled {\n background: var(--color-white-background);\n border: 1px solid var(--color-grey2-disabled);\n color: var(--color-grey2-disabled);\n cursor: not-allowed;\n }\n\n &.text-only {\n border: none;\n background: var(--color-white-background);\n color: var(--color-blue-CTA);\n }\n &.text-only:hover {\n color: var(--color-blue-hover);\n }\n\n &.text-only-disabled {\n border: none;\n background: var(--color-white-background);\n color: var(--color-grey2-disabled);\n cursor: not-allowed;\n }\n \n &.danger-primary {\n background: var(--color-red-error);\n color: var(--color-white-background);\n border: 1px solid var(--color-red-error);\n }\n &.danger-primary:hover {\n background: var(--color-red-hover);\n color: var(--color-white-background);\n border: 1px solid var(--color-red-hover);\n }\n\n &.danger-secondary {\n color: var(--color-red-error);\n border: 1px solid var(--color-red-error);\n background: var(--color-white-background);\n }\n &.danger-secondary:hover {\n color: var(--color-red-hover);\n border: 1px solid var(--color-red-hover);\n background: var(--color-white-background);\n }\n\n &.danger-text-only {\n border: none;\n color: var(--color-red-error);\n background: var(--color-white-background);\n }\n &.danger-text-only:hover {\n border: none;\n color: var(--color-red-hover);\n background: var(--color-white-background);\n }\n"])), props => getSizeStyles(props.size));
|
|
38
38
|
exports.ColoredStyledButton = ColoredStyledButton;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.object.assign.js");
|
|
3
4
|
require("core-js/modules/es.weak-map.js");
|
|
4
5
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
5
6
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -10,23 +11,31 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
10
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
12
|
var _antd = require("antd");
|
|
12
13
|
var _Typography = _interopRequireWildcard(require("../oa-component-typography/Typography"));
|
|
14
|
+
const _excluded = ["disabled", "onChange", "label", "typography"];
|
|
13
15
|
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); }
|
|
14
16
|
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; }
|
|
15
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
19
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
20
|
+
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; }
|
|
16
21
|
function CustomCheckBox(_ref) {
|
|
17
22
|
let {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
disabled,
|
|
24
|
+
onChange,
|
|
25
|
+
label,
|
|
26
|
+
typography
|
|
27
|
+
} = _ref,
|
|
28
|
+
antDesignProps = _objectWithoutProperties(_ref, _excluded);
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement(_antd.Checkbox, _extends({}, antDesignProps, {
|
|
24
30
|
disabled: disabled,
|
|
25
31
|
onChange: disabled ? null : onChange
|
|
26
|
-
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
32
|
+
}), /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
27
33
|
typography: typography
|
|
28
34
|
}, label));
|
|
29
35
|
}
|
|
36
|
+
|
|
37
|
+
// This allows us referencing the Group container in our Checkbox component
|
|
38
|
+
CustomCheckBox.Group = _antd.Checkbox.Group;
|
|
30
39
|
CustomCheckBox.propTypes = {
|
|
31
40
|
disabled: _propTypes.default.bool,
|
|
32
41
|
onChange: _propTypes.default.func.isRequired,
|
|
@@ -51,7 +51,7 @@ function CustomDrawer(_ref) {
|
|
|
51
51
|
title: drawerTitle,
|
|
52
52
|
height: height,
|
|
53
53
|
width: width,
|
|
54
|
-
footer: /*#__PURE__*/_react.default.createElement(_styles.DrawerFooter, null, buttonConfig.map(button => /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
|
|
54
|
+
footer: buttonConfig && /*#__PURE__*/_react.default.createElement(_styles.DrawerFooter, null, buttonConfig.map(button => /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
|
|
55
55
|
key: button,
|
|
56
56
|
label: button.label,
|
|
57
57
|
onClick: button.callback,
|
|
@@ -63,19 +63,20 @@ function CustomDrawer(_ref) {
|
|
|
63
63
|
CustomDrawer.propTypes = {
|
|
64
64
|
// Array of button configurations
|
|
65
65
|
buttonConfig: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
66
|
-
callback: _propTypes.default.
|
|
66
|
+
callback: _propTypes.default.func.isRequired,
|
|
67
67
|
label: _propTypes.default.string.isRequired,
|
|
68
68
|
type: _propTypes.default.oneOf(['secondary', 'primary']).isRequired
|
|
69
|
-
}))
|
|
69
|
+
})),
|
|
70
70
|
children: _propTypes.default.node.isRequired,
|
|
71
71
|
onClose: _propTypes.default.func.isRequired,
|
|
72
72
|
open: _propTypes.default.bool,
|
|
73
73
|
placement: _propTypes.default.oneOf(['top', 'right', 'bottom', 'left']),
|
|
74
74
|
title: _propTypes.default.node,
|
|
75
|
-
height: _propTypes.default.number,
|
|
76
|
-
width: _propTypes.default.number
|
|
75
|
+
height: _propTypes.default.number || _propTypes.default.string,
|
|
76
|
+
width: _propTypes.default.number || _propTypes.default.string
|
|
77
77
|
};
|
|
78
78
|
CustomDrawer.defaultProps = {
|
|
79
|
+
buttonConfig: null,
|
|
79
80
|
open: true,
|
|
80
81
|
placement: 'right',
|
|
81
82
|
title: null,
|
|
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.notificationOptions = exports.default = void 0;
|
|
8
|
-
require("core-js/modules/es.symbol.description.js");
|
|
9
8
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
9
|
+
require("core-js/modules/es.symbol.description.js");
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _antd = require("antd");
|
|
13
13
|
var _icons = require("@ant-design/icons");
|
|
14
14
|
var _Typography = _interopRequireWildcard(require("../oa-component-typography/Typography"));
|
|
15
|
-
var _styles =
|
|
15
|
+
var _styles = require("./styles");
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
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); }
|
|
18
18
|
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; }
|
|
@@ -20,57 +20,85 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
20
20
|
|
|
21
21
|
const notificationOptions = ['green-success', 'red-error'];
|
|
22
22
|
exports.notificationOptions = notificationOptions;
|
|
23
|
-
|
|
23
|
+
const Notification = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
24
24
|
let {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
duration,
|
|
26
|
+
storyConfig,
|
|
27
|
+
// Useful only for the purpose of displaying in storybook
|
|
28
|
+
onClick,
|
|
29
|
+
onClose,
|
|
27
30
|
placement,
|
|
28
|
-
title,
|
|
29
|
-
type,
|
|
30
31
|
typographies
|
|
31
32
|
} = _ref;
|
|
32
|
-
const [api, contextHolder] = _antd.notification.useNotification(
|
|
33
|
-
|
|
33
|
+
const [api, contextHolder] = _antd.notification.useNotification({
|
|
34
|
+
duration,
|
|
35
|
+
placement
|
|
36
|
+
});
|
|
37
|
+
const handleClick = (0, _react.useCallback)(() => {
|
|
38
|
+
// console.log('`handleClick` in Notification component');
|
|
39
|
+
onClick(); // Calling the provided `onClick` callback.
|
|
40
|
+
}, [onClick]);
|
|
41
|
+
const handleClose = (0, _react.useCallback)(() => {
|
|
42
|
+
// console.log('`handleClose` in Notification component');
|
|
43
|
+
onClose(); // Calling the provided `onClose` callback.
|
|
44
|
+
}, [onClose]);
|
|
45
|
+
const openNotification = (0, _react.useCallback)(_ref2 => {
|
|
46
|
+
let {
|
|
47
|
+
description,
|
|
48
|
+
title,
|
|
49
|
+
type
|
|
50
|
+
} = _ref2;
|
|
51
|
+
// type can be success or failure
|
|
34
52
|
const titleColor = type === 'success' ? 'green-success' : 'red-error';
|
|
35
|
-
const descriptionColor = type === 'success' ? '
|
|
53
|
+
const descriptionColor = type === 'success' ? 'primarygrey-text' : 'primarygrey-text';
|
|
36
54
|
const borderColor = type === 'success' ? 'var(--color-green-success)' : 'var(--color-red-error)';
|
|
37
|
-
const customNotification = /*#__PURE__*/_react.default.createElement(_styles.
|
|
38
|
-
|
|
39
|
-
|
|
55
|
+
const customNotification = /*#__PURE__*/_react.default.createElement(_styles.StyledNotification, null, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
56
|
+
color: titleColor,
|
|
57
|
+
typography: typographies.title
|
|
40
58
|
}, /*#__PURE__*/_react.default.createElement("div", null, title)), /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
41
59
|
color: descriptionColor,
|
|
42
60
|
typography: typographies.description
|
|
43
|
-
}, description))
|
|
44
|
-
onClick: api.destroy('string')
|
|
45
|
-
}));
|
|
61
|
+
}, description)));
|
|
46
62
|
api.open({
|
|
47
63
|
message: customNotification,
|
|
48
|
-
closeIcon: false,
|
|
49
|
-
duration: isDisplayed ? 0 : 2000,
|
|
50
64
|
style: {
|
|
51
65
|
padding: '8px 16px 8px 16px',
|
|
52
66
|
borderRadius: '4px',
|
|
53
67
|
borderLeft: "4px solid ".concat(borderColor),
|
|
54
68
|
boxShadow: '0px 2px 8px 0px rgba(0, 0, 0, 0.12)'
|
|
55
69
|
},
|
|
56
|
-
|
|
70
|
+
closeIcon: /*#__PURE__*/_react.default.createElement(_icons.CloseOutlined, {
|
|
71
|
+
style: {
|
|
72
|
+
fontSize: '20px',
|
|
73
|
+
color: 'var(--color-primarygrey-text'
|
|
74
|
+
}
|
|
75
|
+
}),
|
|
76
|
+
onClick: handleClick,
|
|
77
|
+
onClose: handleClose
|
|
57
78
|
});
|
|
58
|
-
};
|
|
79
|
+
}, [api, handleClick, handleClose, typographies]);
|
|
80
|
+
(0, _react.useImperativeHandle)(ref, () => ({
|
|
81
|
+
openNotification
|
|
82
|
+
}));
|
|
59
83
|
|
|
60
|
-
// This is for displaying the notification
|
|
84
|
+
// This is only for the purpose of displaying the notification in storybook.
|
|
61
85
|
(0, _react.useEffect)(() => {
|
|
62
|
-
if (
|
|
63
|
-
openNotification();
|
|
86
|
+
if (storyConfig != null) {
|
|
87
|
+
openNotification(storyConfig);
|
|
64
88
|
}
|
|
65
|
-
});
|
|
89
|
+
}, [storyConfig, openNotification]);
|
|
66
90
|
return contextHolder;
|
|
67
|
-
}
|
|
91
|
+
});
|
|
68
92
|
Notification.propTypes = {
|
|
69
|
-
|
|
70
|
-
|
|
93
|
+
duration: _propTypes.default.number,
|
|
94
|
+
onClick: _propTypes.default.func,
|
|
95
|
+
onClose: _propTypes.default.func,
|
|
71
96
|
placement: _propTypes.default.oneOf(['topLeft', 'topRight', 'bottomLeft', 'bottomRight']),
|
|
72
|
-
|
|
73
|
-
|
|
97
|
+
storyConfig: _propTypes.default.shape({
|
|
98
|
+
description: _propTypes.default.string,
|
|
99
|
+
title: _propTypes.default.string,
|
|
100
|
+
type: _propTypes.default.oneOf(['success', 'failure'])
|
|
101
|
+
}),
|
|
74
102
|
typographies: _propTypes.default.shape({
|
|
75
103
|
button: _propTypes.default.oneOf(_Typography.typographyOptions),
|
|
76
104
|
description: _propTypes.default.oneOf(_Typography.typographyOptions),
|
|
@@ -78,8 +106,11 @@ Notification.propTypes = {
|
|
|
78
106
|
})
|
|
79
107
|
};
|
|
80
108
|
Notification.defaultProps = {
|
|
81
|
-
|
|
109
|
+
duration: 2000,
|
|
110
|
+
onClick: () => {},
|
|
111
|
+
onClose: () => {},
|
|
82
112
|
placement: 'topRight',
|
|
113
|
+
storyConfig: null,
|
|
83
114
|
typographies: {
|
|
84
115
|
button: 'type-button-500',
|
|
85
116
|
description: 'type-b3-400',
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.default = exports.StyledNotification = void 0;
|
|
7
7
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
8
|
var _templateObject; // NotificationStyles.js
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
10
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
var _default = {};
|
|
12
|
+
exports.default = _default;
|
|
13
|
+
const StyledNotification = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between; \n"])));
|
|
14
|
+
exports.StyledNotification = StyledNotification;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Usage Example of CustomNotification component
|
|
2
|
+
|
|
3
|
+
## Explanation
|
|
4
|
+
|
|
5
|
+
We need to use refs in order to use this commponent since the method for calling this notification is quite complex.
|
|
6
|
+
|
|
7
|
+
So, we expose that method to the parent using refs. Take a look at the code example below for better understanding.
|
|
8
|
+
|
|
9
|
+
## Code snippet
|
|
10
|
+
|
|
11
|
+
```jsx
|
|
12
|
+
function App() {
|
|
13
|
+
const myRef = useRef(null);
|
|
14
|
+
|
|
15
|
+
const onClick = () => {
|
|
16
|
+
console.log('click callback for Notification');
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const onClose = () => {
|
|
20
|
+
console.log('close callback for Notification');
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<>
|
|
25
|
+
<CustomButton
|
|
26
|
+
label="trigger notification"
|
|
27
|
+
onClick={() => myRef.current.openNotification({
|
|
28
|
+
description: 'Notification description HERE',
|
|
29
|
+
title: 'Notification title HERE',
|
|
30
|
+
type: 'Failure',
|
|
31
|
+
})}
|
|
32
|
+
/>
|
|
33
|
+
<CustomNotification
|
|
34
|
+
onClick={onClick}
|
|
35
|
+
onClose={onClose}
|
|
36
|
+
placement="bottomLeft"
|
|
37
|
+
ref={myRef}
|
|
38
|
+
/>
|
|
39
|
+
</>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default App;
|
|
44
|
+
```
|
|
@@ -5,7 +5,7 @@ require("core-js/modules/web.dom-collections.iterator.js");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default =
|
|
8
|
+
exports.default = void 0;
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
var _antd = require("antd");
|
|
@@ -32,6 +32,10 @@ function CustomRadio(_ref) {
|
|
|
32
32
|
typography: typography
|
|
33
33
|
}, label));
|
|
34
34
|
}
|
|
35
|
+
|
|
36
|
+
// This allows us referencing the Group container and Button component in our Checkbox component
|
|
37
|
+
CustomRadio.Group = _antd.Radio.Group;
|
|
38
|
+
CustomRadio.Button = _antd.Radio.Button;
|
|
35
39
|
CustomRadio.propTypes = {
|
|
36
40
|
disabled: _propTypes.default.bool,
|
|
37
41
|
onChange: _propTypes.default.func.isRequired,
|
|
@@ -46,6 +50,4 @@ CustomRadio.defaultProps = {
|
|
|
46
50
|
typography: 'type-b1-400'
|
|
47
51
|
};
|
|
48
52
|
var _default = CustomRadio;
|
|
49
|
-
exports.default = _default;
|
|
50
|
-
const CustomRadioGroup = _antd.Radio.Group;
|
|
51
|
-
exports.CustomRadioGroup = CustomRadioGroup;
|
|
53
|
+
exports.default = _default;
|
package/build/index.js
CHANGED
|
@@ -23,12 +23,6 @@ Object.defineProperty(exports, "ApprovalWidget", {
|
|
|
23
23
|
return _ApprovalWidget.default;
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
|
-
Object.defineProperty(exports, "CheckBox", {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
get: function get() {
|
|
29
|
-
return _CustomCheckBox.default;
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
26
|
Object.defineProperty(exports, "CloseClaim", {
|
|
33
27
|
enumerable: true,
|
|
34
28
|
get: function get() {
|
|
@@ -59,6 +53,12 @@ Object.defineProperty(exports, "CustomButton", {
|
|
|
59
53
|
return _CustomButton.default;
|
|
60
54
|
}
|
|
61
55
|
});
|
|
56
|
+
Object.defineProperty(exports, "CustomCheckBox", {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function get() {
|
|
59
|
+
return _CustomCheckBox.default;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
62
|
Object.defineProperty(exports, "CustomDrawer", {
|
|
63
63
|
enumerable: true,
|
|
64
64
|
get: function get() {
|
|
@@ -186,10 +186,10 @@ Object.defineProperty(exports, "typographyOptions", {
|
|
|
186
186
|
}
|
|
187
187
|
});
|
|
188
188
|
var _Accordians = _interopRequireDefault(require("./components/Accordians"));
|
|
189
|
-
var _CustomCheckBox = _interopRequireDefault(require("./components/oa-component-checkbox/CustomCheckBox"));
|
|
190
189
|
var _ColorUsage = _interopRequireWildcard(require("./components/oa-component-colorUsage/ColorUsage"));
|
|
191
190
|
var _CornerRadius = _interopRequireDefault(require("./components/oa-component-cornerRadius/CornerRadius"));
|
|
192
191
|
var _CustomButton = _interopRequireDefault(require("./components/oa-component-button/CustomButton"));
|
|
192
|
+
var _CustomCheckBox = _interopRequireDefault(require("./components/oa-component-checkbox/CustomCheckBox"));
|
|
193
193
|
var _CustomDrawer = _interopRequireDefault(require("./components/oa-component-drawer/CustomDrawer"));
|
|
194
194
|
var _CustomModal = _interopRequireDefault(require("./components/oa-component-modal/CustomModal"));
|
|
195
195
|
var _CustomNotification = _interopRequireDefault(require("./components/oa-component-notification/CustomNotification"));
|
|
@@ -14,8 +14,9 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
14
14
|
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; }
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
16
|
function Address(_ref) {
|
|
17
|
+
var _address$additional_i, _address$additional_i2;
|
|
17
18
|
let {
|
|
18
|
-
|
|
19
|
+
address,
|
|
19
20
|
heading,
|
|
20
21
|
typography
|
|
21
22
|
} = _ref;
|
|
@@ -24,22 +25,25 @@ function Address(_ref) {
|
|
|
24
25
|
}, heading), /*#__PURE__*/_react.default.createElement(_styles.AddressLines, null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
25
26
|
color: "secondarygrey-text",
|
|
26
27
|
typography: typography
|
|
27
|
-
},
|
|
28
|
+
}, address.addressLine1), address.addressLine2 && /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
28
29
|
color: "secondarygrey-text",
|
|
29
30
|
typography: typography
|
|
30
|
-
},
|
|
31
|
+
}, address.addressLine2), address.addressLine3 && /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
31
32
|
color: "secondarygrey-text",
|
|
32
33
|
typography: typography
|
|
33
|
-
},
|
|
34
|
+
}, address.addressLine3), address.landmark && /*#__PURE__*/_react.default.createElement("i", null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
34
35
|
color: "secondarygrey-text",
|
|
35
36
|
typography: typography
|
|
36
|
-
}, "Near", ' ',
|
|
37
|
+
}, "Near", ' ', address.landmark)), /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
37
38
|
color: "secondarygrey-text",
|
|
38
39
|
typography: typography
|
|
39
|
-
},
|
|
40
|
+
}, address.city, ', ', address.state, "-", address.pincode), ((_address$additional_i = address.additional_info) === null || _address$additional_i === void 0 ? void 0 : _address$additional_i.lat) && ((_address$additional_i2 = address.additional_info) === null || _address$additional_i2 === void 0 ? void 0 : _address$additional_i2.long) && /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
41
|
+
color: "secondarygrey-text",
|
|
42
|
+
typography: typography
|
|
43
|
+
}, "Location:", ' ', address.additional_info.lat, ",", address.additional_info.long)));
|
|
40
44
|
}
|
|
41
45
|
Address.propTypes = {
|
|
42
|
-
|
|
46
|
+
address: _propTypes.default.shape({
|
|
43
47
|
addressLine1: _propTypes.default.string.isRequired,
|
|
44
48
|
addressLine2: _propTypes.default.string,
|
|
45
49
|
addressLine3: _propTypes.default.string,
|
|
@@ -40,9 +40,7 @@ function ApprovalWidget(_ref) {
|
|
|
40
40
|
const isDivider = isUndefined(divider) ? true : divider;
|
|
41
41
|
return /*#__PURE__*/_react.default.createElement(StyledAside, {
|
|
42
42
|
key: key
|
|
43
|
-
}, /*#__PURE__*/_react.default.createElement("parentDiv", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
44
|
-
lg: layoutFor === layoutTypes.doc ? 8 : 14
|
|
45
|
-
}, title && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_antd.Typography.Text, {
|
|
43
|
+
}, /*#__PURE__*/_react.default.createElement("parentDiv", null, /*#__PURE__*/_react.default.createElement("div", null, title && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_antd.Typography.Text, {
|
|
46
44
|
level: 4,
|
|
47
45
|
strong: true
|
|
48
46
|
}, title)), description && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_antd.Typography.Text, {
|
|
@@ -41,8 +41,12 @@ function CloseClaim(_ref) {
|
|
|
41
41
|
}, []);
|
|
42
42
|
const handleConfirm = () => {
|
|
43
43
|
form.validateFields().then(values => {
|
|
44
|
+
// Passing up the form data to the parent using the provided callback.
|
|
44
45
|
onConfirm(values);
|
|
45
46
|
});
|
|
47
|
+
|
|
48
|
+
// This resets the form upon confirm.
|
|
49
|
+
form.resetFields();
|
|
46
50
|
};
|
|
47
51
|
const handleCancel = () => {
|
|
48
52
|
onCancel();
|
|
@@ -69,15 +73,15 @@ function CloseClaim(_ref) {
|
|
|
69
73
|
}, /*#__PURE__*/_react.default.createElement(AsideContainer, null, /*#__PURE__*/_react.default.createElement("h1", null, "Close Claim"), /*#__PURE__*/_react.default.createElement("p", null, "Are you sure you would like to close this claim as this action will close the SR#", serviceRequestData === null || serviceRequestData === void 0 ? void 0 : serviceRequestData.referencePrimaryTrackingNo, ' ', "and no further processing will be allowed. Please provide the reason for closure."), /*#__PURE__*/_react.default.createElement(_antd.Form, {
|
|
70
74
|
form: form
|
|
71
75
|
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("label", {
|
|
72
|
-
htmlFor: "
|
|
76
|
+
htmlFor: "serviceCancelReason"
|
|
73
77
|
}, "Select reason for rejection (Visible to the customer) "), /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
74
|
-
name: "
|
|
78
|
+
name: "serviceCancelReason",
|
|
75
79
|
rules: [{
|
|
76
80
|
required: true,
|
|
77
81
|
message: 'Required'
|
|
78
82
|
}],
|
|
79
83
|
initialValue: false,
|
|
80
|
-
id: "
|
|
84
|
+
id: "serviceCancelReason"
|
|
81
85
|
}, /*#__PURE__*/_react.default.createElement(_antd.Select, {
|
|
82
86
|
placeholder: "Select"
|
|
83
87
|
}, /*#__PURE__*/_react.default.createElement(Option, {
|
|
@@ -88,37 +92,37 @@ function CloseClaim(_ref) {
|
|
|
88
92
|
value: row.key,
|
|
89
93
|
width: 432
|
|
90
94
|
}, row.value)))), /*#__PURE__*/_react.default.createElement("label", {
|
|
91
|
-
htmlFor: "
|
|
95
|
+
htmlFor: "isCustomerFraudCase"
|
|
92
96
|
}, "Is this a fraud case?"), /*#__PURE__*/_react.default.createElement("div", {
|
|
93
97
|
className: ""
|
|
94
98
|
}, /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
95
|
-
name: "
|
|
99
|
+
name: "isCustomerFraudCase",
|
|
96
100
|
rules: [{
|
|
97
101
|
required: true,
|
|
98
102
|
message: 'Required'
|
|
99
103
|
}],
|
|
100
104
|
initialValue: undefined,
|
|
101
|
-
id: "
|
|
105
|
+
id: "isCustomerFraudCase"
|
|
102
106
|
}, /*#__PURE__*/_react.default.createElement(_antd.Radio.Group, {
|
|
103
|
-
name: "
|
|
107
|
+
name: "isCustomerFraudCase",
|
|
104
108
|
onChange: handleRadioChange
|
|
105
109
|
}, /*#__PURE__*/_react.default.createElement(_antd.Radio, {
|
|
106
110
|
value: true
|
|
107
111
|
}, "Yes"), /*#__PURE__*/_react.default.createElement(_antd.Radio, {
|
|
108
112
|
value: false
|
|
109
113
|
}, "No")))), isFraud && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("label", {
|
|
110
|
-
htmlFor: "
|
|
114
|
+
htmlFor: "serviceFraudCaseReason"
|
|
111
115
|
}, "Why is this a fraud case?", /*#__PURE__*/_react.default.createElement("span", {
|
|
112
116
|
className: "redColor"
|
|
113
117
|
}, "*")), /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
114
|
-
name: "
|
|
118
|
+
name: "serviceFraudCaseReason",
|
|
115
119
|
rules: [{
|
|
116
120
|
required: true,
|
|
117
121
|
message: 'Required',
|
|
118
122
|
type: 'array'
|
|
119
123
|
}],
|
|
120
124
|
initialValue: undefined,
|
|
121
|
-
id: "
|
|
125
|
+
id: "serviceFraudCaseReason"
|
|
122
126
|
}, /*#__PURE__*/_react.default.createElement(_antd.Select, {
|
|
123
127
|
mode: "multiple",
|
|
124
128
|
placeholder: "Select"
|
|
@@ -129,17 +133,17 @@ function CloseClaim(_ref) {
|
|
|
129
133
|
key: row.key,
|
|
130
134
|
value: row.key
|
|
131
135
|
}, row.value)))))), /*#__PURE__*/_react.default.createElement("label", {
|
|
132
|
-
htmlFor: "
|
|
136
|
+
htmlFor: "remarks"
|
|
133
137
|
}, "Remarks", /*#__PURE__*/_react.default.createElement("span", {
|
|
134
138
|
className: "redColor"
|
|
135
139
|
}, "*")), /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
136
|
-
name: "
|
|
140
|
+
name: "remarks",
|
|
137
141
|
rules: [{
|
|
138
142
|
required: true,
|
|
139
143
|
message: 'Required'
|
|
140
144
|
}],
|
|
141
145
|
initialValue: null,
|
|
142
|
-
id: "
|
|
146
|
+
id: "remarks"
|
|
143
147
|
}, /*#__PURE__*/_react.default.createElement(TextArea, {
|
|
144
148
|
rows: "3",
|
|
145
149
|
placeholder: "Start typing..."
|
|
@@ -11,9 +11,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _antd = require("antd");
|
|
13
13
|
var _styles = require("./styles");
|
|
14
|
-
var _CustomButton = _interopRequireDefault(require("../../components/oa-component-button/CustomButton"));
|
|
15
14
|
var _CustomDrawer = _interopRequireDefault(require("../../components/oa-component-drawer/CustomDrawer"));
|
|
16
|
-
var _CustomRadio =
|
|
15
|
+
var _CustomRadio = _interopRequireDefault(require("../../components/oa-component-radio/CustomRadio"));
|
|
17
16
|
var _Typography = _interopRequireDefault(require("../../components/oa-component-typography/Typography"));
|
|
18
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
18
|
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); }
|
|
@@ -48,24 +47,27 @@ function SendPaymentLink(_ref) {
|
|
|
48
47
|
const onClose = () => {
|
|
49
48
|
setOpen(false);
|
|
50
49
|
};
|
|
50
|
+
const onClick = () => {
|
|
51
|
+
form.submit();
|
|
52
|
+
};
|
|
51
53
|
return /*#__PURE__*/_react.default.createElement(_CustomDrawer.default, {
|
|
52
54
|
closable: true,
|
|
53
|
-
|
|
54
|
-
label:
|
|
55
|
+
buttonConfig: [{
|
|
56
|
+
label: 'Cancel',
|
|
55
57
|
onClick: onClose,
|
|
56
|
-
type:
|
|
57
|
-
}
|
|
58
|
-
label:
|
|
58
|
+
type: 'secondary'
|
|
59
|
+
}, {
|
|
60
|
+
label: 'Send',
|
|
59
61
|
// Calling submit on the form, if the Send button is clicked
|
|
60
|
-
,
|
|
61
|
-
|
|
62
|
-
}
|
|
62
|
+
onClick,
|
|
63
|
+
type: 'primary'
|
|
64
|
+
}],
|
|
63
65
|
onClose: onClose,
|
|
64
66
|
open: open,
|
|
65
67
|
title: /*#__PURE__*/_react.default.createElement(_Typography.default, null, heading)
|
|
66
68
|
}, /*#__PURE__*/_react.default.createElement(_styles.RadioContainer, null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
67
69
|
typography: "type-t2-700"
|
|
68
|
-
}, "Send to:"), /*#__PURE__*/_react.default.createElement(_CustomRadio.
|
|
70
|
+
}, "Send to:"), /*#__PURE__*/_react.default.createElement(_CustomRadio.default.Group, {
|
|
69
71
|
onChange: onChange,
|
|
70
72
|
value: selectedRadio
|
|
71
73
|
}, /*#__PURE__*/_react.default.createElement(_styles.RadioGrid, null, options.map((option, idx) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.RadioGrid = exports.RadioContainer =
|
|
6
|
+
exports.RadioGrid = exports.RadioContainer = void 0;
|
|
7
7
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
-
var _templateObject, _templateObject2
|
|
8
|
+
var _templateObject, _templateObject2;
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
10
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
11
11
|
const RadioContainer = _styledComponents.default.section(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n gap: 20px;\n margin-bottom: 20px;\n"])));
|
|
@@ -13,6 +13,4 @@ const RadioContainer = _styledComponents.default.section(_templateObject || (_te
|
|
|
13
13
|
// This helps make the radio buttons aligned in uniform columns
|
|
14
14
|
exports.RadioContainer = RadioContainer;
|
|
15
15
|
const RadioGrid = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));\n"])));
|
|
16
|
-
exports.RadioGrid = RadioGrid;
|
|
17
|
-
const ButtonContainer = _styledComponents.default.section(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: flex-end;\n gap: 20px;\n"])));
|
|
18
|
-
exports.ButtonContainer = ButtonContainer;
|
|
16
|
+
exports.RadioGrid = RadioGrid;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oa-componentbook",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Reusable components",
|
|
6
6
|
"main": "build/index.js",
|
|
@@ -76,9 +76,22 @@
|
|
|
76
76
|
"react/forbid-prop-types": [
|
|
77
77
|
1
|
|
78
78
|
],
|
|
79
|
-
"jsx-a11y/label-has-associated-control": [
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
"jsx-a11y/label-has-associated-control": [
|
|
80
|
+
2,
|
|
81
|
+
{
|
|
82
|
+
"controlComponents": [
|
|
83
|
+
"Form.Item"
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
"react/jsx-props-no-spreading": [
|
|
88
|
+
1,
|
|
89
|
+
{
|
|
90
|
+
"html": "enforce",
|
|
91
|
+
"custom": "enforce",
|
|
92
|
+
"explicitSpread": "enforce"
|
|
93
|
+
}
|
|
94
|
+
]
|
|
82
95
|
}
|
|
83
96
|
},
|
|
84
97
|
"browserslist": {
|
|
File without changes
|