oa-componentbook 0.17.9 → 0.17.11

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.
@@ -31,7 +31,8 @@ function CustomButton(_ref) {
31
31
  className: "\n ".concat(disabled ? "".concat(type.replace('danger-', ''), "-disabled") : type, " \n ").concat(className, "\n "),
32
32
  disabled: disabled,
33
33
  onClick: disabled ? null : onClick,
34
- type: "button"
34
+ type: "button",
35
+ size: size
35
36
  }, /*#__PURE__*/_react.default.createElement("div", {
36
37
  className: "text-container"
37
38
  }, iconConfig.position === 'left' && iconConfig.icon, /*#__PURE__*/_react.default.createElement(_Typography.default, {
@@ -17,22 +17,22 @@ const getSizeStyles = size => {
17
17
  switch (size) {
18
18
  case 'small':
19
19
  {
20
- return (0, _styledComponents.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n min-width: 80px;\n padding: 10px 16px;\n "])));
20
+ return (0, _styledComponents.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 1.875rem;\n min-width: 80px;\n padding: 0.625rem 1rem;\n "])));
21
21
  }
22
22
  case 'medium':
23
23
  {
24
- return (0, _styledComponents.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n min-width: 100px;\n padding: 10px 16px; \n "])));
24
+ return (0, _styledComponents.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n height: 2.25rem;\n min-width: 100px;\n padding: 0.625rem 1rem;\n "])));
25
25
  }
26
26
  case 'large':
27
27
  {
28
- return (0, _styledComponents.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n min-width: 136px;\n padding: 10px 24px;\n "])));
28
+ return (0, _styledComponents.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n height: 3rem;\n min-width: 136px;\n padding: 0.625rem 1.5rem;\n "])));
29
29
  }
30
30
  default:
31
31
  {
32
- return (0, _styledComponents.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n min-width: 100px;\n padding: 10px 16px; \n "])));
32
+ return (0, _styledComponents.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n height: 2.25rem;\n min-width: 100px;\n padding: 0.625rem 1rem;\n "])));
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 gap: 8px; \n }\n"])));
36
+ const StyledButton = _styledComponents.default.button(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n border-radius: 4px;\n cursor: pointer;\n\n display: flex;\n align-items: center;\n justify-content: center;\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;
@@ -34,10 +34,9 @@ function CustomDrawer(_ref) {
34
34
  we attempt to close the drawer.
35
35
  */
36
36
  const handleClose = () => {
37
+ // Call to `onClose` callback received from props.
37
38
  onClose();
38
- // console.log('`handleClose` callback of CustomDrawer component called.');
39
39
  };
40
-
41
40
  const drawerTitle = /*#__PURE__*/_react.default.createElement(_styles.CustomDrawerTitle, null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
42
41
  typography: "type-sl1-700"
43
42
  }, title), /*#__PURE__*/_react.default.createElement(_icons.CloseOutlined, {
@@ -52,7 +51,7 @@ function CustomDrawer(_ref) {
52
51
  height: height,
53
52
  width: width,
54
53
  footer: buttonConfig && /*#__PURE__*/_react.default.createElement(_styles.DrawerFooter, null, buttonConfig.map(button => /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
55
- key: button,
54
+ key: button.label,
56
55
  label: button.label,
57
56
  onClick: button.callback,
58
57
  size: "large",
@@ -67,8 +66,8 @@ CustomDrawer.propTypes = {
67
66
  label: _propTypes.default.string.isRequired,
68
67
  type: _propTypes.default.oneOf(['secondary', 'primary']).isRequired
69
68
  })),
70
- children: _propTypes.default.node.isRequired,
71
- onClose: _propTypes.default.func.isRequired,
69
+ children: _propTypes.default.node,
70
+ onClose: _propTypes.default.func,
72
71
  open: _propTypes.default.bool,
73
72
  placement: _propTypes.default.oneOf(['top', 'right', 'bottom', 'left']),
74
73
  title: _propTypes.default.node,
@@ -77,6 +76,8 @@ CustomDrawer.propTypes = {
77
76
  };
78
77
  CustomDrawer.defaultProps = {
79
78
  buttonConfig: null,
79
+ children: null,
80
+ onClose: () => {},
80
81
  open: false,
81
82
  placement: 'right',
82
83
  title: null,
@@ -36,11 +36,15 @@ const Notification = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
36
36
  });
37
37
  const handleClick = (0, _react.useCallback)(() => {
38
38
  // console.log('`handleClick` in Notification component');
39
- onClick(); // Calling the provided `onClick` callback.
39
+
40
+ // Call to `onClick` callback received from props.
41
+ onClick();
40
42
  }, [onClick]);
41
43
  const handleClose = (0, _react.useCallback)(() => {
42
44
  // console.log('`handleClose` in Notification component');
43
- onClose(); // Calling the provided `onClose` callback.
45
+
46
+ // Call to `onClose` callback received from props.
47
+ onClose();
44
48
  }, [onClose]);
45
49
  const openNotification = (0, _react.useCallback)(_ref2 => {
46
50
  let {
@@ -1,56 +1,66 @@
1
1
  "use strict";
2
2
 
3
+ require("core-js/modules/es.symbol.description.js");
4
+ require("core-js/modules/es.object.assign.js");
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports.default = void 0;
7
- require("core-js/modules/es.symbol.description.js");
8
9
  var _react = _interopRequireDefault(require("react"));
9
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
10
11
  var _antd = require("antd");
11
12
  require("antd/dist/reset.css");
13
+ const _excluded = ["data", "defaultActiveKey", "disabled", "style", "tabPosition", "type"]; // Keeping a static import in this component so that styling is picked up appropriately
12
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+ 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); }
13
16
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
14
17
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
15
18
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
16
19
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
17
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } // Keeping a static import in this component so that styling is picked up appropriately
18
- const {
19
- TabPane
20
- } = _antd.Tabs;
20
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
21
+ 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; }
22
+ 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; }
21
23
  function CustomTabs(_ref) {
22
24
  let {
23
- data,
24
- defaultActiveKey,
25
- disabled,
26
- style,
27
- tabPosition,
28
- type
29
- } = _ref;
30
- return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_antd.Tabs, {
25
+ data,
26
+ defaultActiveKey,
27
+ disabled,
28
+ style,
29
+ tabPosition,
30
+ type
31
+ } = _ref,
32
+ antDesignProps = _objectWithoutProperties(_ref, _excluded);
33
+ const items = data.tabs.map(tab => ({
34
+ children: tab.body,
35
+ disabled: tab.disabled,
36
+ key: tab.key,
37
+ label: tab.label
38
+ }));
39
+ return /*#__PURE__*/_react.default.createElement(_antd.Tabs, _extends({
31
40
  defaultActiveKey: defaultActiveKey,
41
+ disabled: true,
42
+ items: items,
32
43
  style: _objectSpread({}, style),
33
44
  tabPosition: tabPosition,
34
45
  type: type
35
- }, data.tabs.length > 0 && data.tabs.map((item, i) => /*#__PURE__*/_react.default.createElement(TabPane, {
36
- disabled: item.disabled,
37
- key: item.key,
38
- tab: item.label
39
- }, item.body))));
46
+ }, antDesignProps));
40
47
  }
41
48
  CustomTabs.propTypes = {
42
49
  data: _propTypes.default.shape({
43
50
  tabs: _propTypes.default.arrayOf({
51
+ body: _propTypes.default.node.isRequired,
52
+ disabled: _propTypes.default.bool,
44
53
  key: _propTypes.default.string.isRequired,
45
- label: _propTypes.default.string.isRequired,
46
- body: _propTypes.default.string.isRequired,
47
- disabled: _propTypes.default.bool
54
+ label: _propTypes.default.string.isRequired
48
55
  }).isRequired
49
56
  }),
50
57
  defaultActiveKey: _propTypes.default.string,
51
58
  disabled: _propTypes.default.bool,
52
59
  tabPosition: _propTypes.default.oneOf(['top', 'right', 'bottom', 'left']),
53
- type: _propTypes.default.oneOf(['line', 'card', 'editable-card']),
60
+ type: _propTypes.default.oneOf(['line', 'card'
61
+ // 'editable-card',
62
+ ]),
63
+
54
64
  style: _propTypes.default.objectOf(_propTypes.default.string)
55
65
  };
56
66
  CustomTabs.defaultProps = {
@@ -6,27 +6,30 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _Typography = _interopRequireDefault(require("../oa-component-typography/Typography"));
9
10
  var _styles = require("./styles");
10
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
- function Tag(_ref) {
12
+ function CustomTag(_ref) {
12
13
  let {
13
- text,
14
+ label,
14
15
  type,
15
16
  visible
16
17
  } = _ref;
17
18
  return /*#__PURE__*/_react.default.createElement(_styles.StyledTag, {
18
19
  type: type,
19
20
  visible: visible
20
- }, /*#__PURE__*/_react.default.createElement("span", null, text));
21
+ }, /*#__PURE__*/_react.default.createElement(_styles.CenteredTextContainer, null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
22
+ typography: "type-b3-400"
23
+ }, label)));
21
24
  }
22
- Tag.propTypes = {
23
- text: _propTypes.default.string.isRequired,
24
- type: _propTypes.default.oneOf(['success', 'pending', 'failed', 'other']),
25
+ CustomTag.propTypes = {
26
+ label: _propTypes.default.string.isRequired,
27
+ type: _propTypes.default.oneOf(['success', 'pending', 'failed']),
25
28
  visible: _propTypes.default.bool
26
29
  };
27
- Tag.defaultProps = {
28
- type: 'other',
30
+ CustomTag.defaultProps = {
31
+ type: '',
29
32
  visible: true
30
33
  };
31
- var _default = Tag;
34
+ var _default = CustomTag;
32
35
  exports.default = _default;
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports.StyledTag = void 0;
6
+ exports.default = exports.StyledTag = exports.CenteredTextContainer = void 0;
7
7
  var _styledComponents = _interopRequireDefault(require("styled-components"));
8
- var _templateObject;
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 getColorStyles = type => {
@@ -32,11 +32,13 @@ const getColorStyles = type => {
32
32
  }
33
33
  return {
34
34
  backgroundColor: '#CCCCCC',
35
- borderColor: '#CCCCCC',
35
+ borderColor: 'var(--color-primarygrey-text)',
36
36
  textColor: 'var(--color-primarygrey-text)'
37
37
  };
38
38
  };
39
39
  var _default = {};
40
40
  exports.default = _default;
41
- const StyledTag = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-block;\n padding: 4px 12px;\n color: ", ";\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: 4px;\n font-size: 12px;\n font-style: normal;\n font-weight: 400;\n line-height: 16px;\n visibility: ", ";\n"])), props => getColorStyles(props.type).textColor, props => getColorStyles(props.type).backgroundColor, props => getColorStyles(props.type).borderColor, props => props.visible ? 'visible' : 'hidden');
42
- exports.StyledTag = StyledTag;
41
+ const StyledTag = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-block;\n \n padding: 4px 12px;\n \n color: ", ";\n \n background-color: ", ";\n\n border: 1px solid ", ";\n border-radius: 4px;\n \n visibility: ", ";\n"])), props => getColorStyles(props.type).textColor, props => getColorStyles(props.type).backgroundColor, props => getColorStyles(props.type).borderColor, props => props.visible ? 'visible' : 'hidden');
42
+ exports.StyledTag = StyledTag;
43
+ const CenteredTextContainer = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n"])));
44
+ exports.CenteredTextContainer = CenteredTextContainer;
@@ -1,44 +1,94 @@
1
1
  "use strict";
2
2
 
3
+ require("core-js/modules/es.object.assign.js");
4
+ require("core-js/modules/es.weak-map.js");
5
+ require("core-js/modules/web.dom-collections.iterator.js");
3
6
  Object.defineProperty(exports, "__esModule", {
4
7
  value: true
5
8
  });
6
9
  exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
10
+ var _react = _interopRequireWildcard(require("react"));
8
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
+ var _antd = require("antd");
9
13
  var _styles = require("./styles");
14
+ const _excluded = ["defaultChecked", "disabled", "onChange", "onClick", "checkedLabel", "uncheckedLabel", "size"];
10
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
- // Import the styles from the separate file
12
-
16
+ 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); }
17
+ 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; }
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; }
13
21
  function CustomToggle(_ref) {
14
22
  let {
15
- disabled,
16
- onChange,
17
- checkedLabel,
18
- uncheckedLabel,
19
- type,
20
- size
21
- } = _ref;
22
- return /*#__PURE__*/_react.default.createElement(_styles.StyledSwitch, {
23
+ defaultChecked,
24
+ disabled,
25
+ onChange,
26
+ onClick,
27
+ checkedLabel,
28
+ uncheckedLabel,
29
+ size
30
+
31
+ /*
32
+ Since we are allowing all ant design props to be passed,
33
+ a state managed `checked` prop can be passed as it also present
34
+ in ant design.
35
+ */
36
+ } = _ref,
37
+ antDesignProps = _objectWithoutProperties(_ref, _excluded);
38
+ // Styling config is stored using a ref to preserve it across re-renders.
39
+ const SwitchConfig = (0, _react.useRef)((0, _styles.getSwitchConfig)({
40
+ disabled
41
+ }));
42
+ const handleChange = value => {
43
+ // console.log(value);
44
+
45
+ // Call to `onChange` callback received from props.
46
+ onChange(value);
47
+ };
48
+ const handleClick = value => {
49
+ // console.log(value);
50
+
51
+ // Call to `onClick` callback received from props.
52
+ onClick(value);
53
+ };
54
+ (0, _react.useEffect)(() => {
55
+ SwitchConfig.current = (0, _styles.getSwitchConfig)({
56
+ disabled
57
+ });
58
+ }, [disabled]);
59
+ return /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, {
60
+ theme: {
61
+ components: {
62
+ Switch: SwitchConfig.current
63
+ }
64
+ }
65
+ }, /*#__PURE__*/_react.default.createElement(_antd.Switch, _extends({
23
66
  checkedChildren: checkedLabel,
24
67
  unCheckedChildren: uncheckedLabel,
25
68
  disabled: disabled,
26
- onChange: disabled ? null : onChange,
27
- defaultChecked: true
28
- });
69
+ onChange: disabled ? null : handleChange,
70
+ onClick: disabled ? null : handleClick,
71
+ defaultChecked: defaultChecked,
72
+ size: size === 'large' ? 'default' : size
73
+ }, antDesignProps)));
29
74
  }
30
75
  CustomToggle.propTypes = {
31
- checkedLabel: _propTypes.default.string,
76
+ defaultChecked: _propTypes.default.bool,
32
77
  disabled: _propTypes.default.bool,
33
- onChange: _propTypes.default.func.isRequired,
78
+ onChange: _propTypes.default.func,
79
+ onClick: _propTypes.default.func,
80
+ checkedLabel: _propTypes.default.string,
34
81
  uncheckedLabel: _propTypes.default.string,
35
- size: _propTypes.default.oneOf(['large', 'small']).isRequired,
36
- type: _propTypes.default.oneOf(['primary', 'secondary']).isRequired
82
+ size: _propTypes.default.oneOf(['large', 'small'])
37
83
  };
38
84
  CustomToggle.defaultProps = {
85
+ defaultChecked: false,
86
+ disabled: false,
87
+ onChange: value => value,
88
+ onClick: value => value,
39
89
  checkedLabel: null,
40
90
  uncheckedLabel: null,
41
- disabled: false
91
+ size: 'large'
42
92
  };
43
93
  var _default = CustomToggle;
44
94
  exports.default = _default;
@@ -3,14 +3,40 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports.StyledSwitch = void 0;
6
+ exports.getSwitchConfig = exports.default = void 0;
7
7
  var _styledComponents = _interopRequireDefault(require("styled-components"));
8
8
  var _antd = require("antd");
9
- var _templateObject; // ToggleStyles.js
10
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
10
+ // ToggleStyles.js
12
11
  var _default = {};
13
12
  exports.default = _default;
14
- const StyledSwitch = (0, _styledComponents.default)(_antd.Switch)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n && {\n // Customize the track color based on the type prop\n background-color: ", "; // Secondary color\n \n display: flex;\n\n // Customize the handle (knob) color based on the type prop\n .ant-switch-handle::before {\n /* height: 100%; */\n }\n\n // Customize the track size based on the size prop\n height: ", ";\n width: ", "\n // Customize other styles as needed\n // For example, padding, border-radius, etc.\n // Example:\n // padding: 2px;\n // border-radius: 4px;\n }\n"])), props => props.type === 'primary' ? '#00875A' // Primary color
15
- : '#FF5733', props => props.size === 'large' ? '32px' : '20px', props => props.checkedLabel === null && props.uncheckedLabel === null && (props.size === 'large' ? '56px' : '35px'));
16
- exports.StyledSwitch = StyledSwitch;
13
+ const getSwitchConfig = _ref => {
14
+ let {
15
+ disabled
16
+ } = _ref;
17
+ return {
18
+ // trackPadding: '2px',
19
+ // handleSizeSM: '1rem',
20
+ // handleSize: '28',
21
+ // trackHeightSM: '1.25rem',
22
+ // trackHeight: '2rem',
23
+ // trackMinWidthSM: '2.1875rem',
24
+ // trackMinWidth: '3.5rem',
25
+
26
+ // Toggle handle color.
27
+ handleBg: "var(".concat(disabled ? '--color-secondarygrey-text' : '--color-white-background', ")"),
28
+ // Toggle labels color.
29
+ colorText: "var(".concat(disabled ? '--color-secondarygrey-text' : '--color-white-background', ")"),
30
+ // Toggle on, background color
31
+ colorPrimary: "var(".concat(disabled ? '--color-grey2-disabled' : '--color-blue-CTA', ")"),
32
+ // Toggle on, hover background color
33
+ colorPrimaryHover: 'var(--color-blue-hover)',
34
+ // Toggle off, hover background color.
35
+ colorTextTertiary: 'var(--color-blue-hover)',
36
+ // Toggle off, background color.
37
+ colorTextQuaternary: "var(".concat(disabled ? '--color-grey2-disabled' : '--color-secondarygrey-text', ")"),
38
+ // Removes lightening effect on disable.
39
+ opacityLoading: 1
40
+ };
41
+ };
42
+ exports.getSwitchConfig = getSwitchConfig;
package/build/index.js CHANGED
@@ -101,12 +101,24 @@ Object.defineProperty(exports, "CustomTabs", {
101
101
  return _CustomTabs.default;
102
102
  }
103
103
  });
104
+ Object.defineProperty(exports, "CustomTag", {
105
+ enumerable: true,
106
+ get: function get() {
107
+ return _CustomTag.default;
108
+ }
109
+ });
104
110
  Object.defineProperty(exports, "CustomTimeline", {
105
111
  enumerable: true,
106
112
  get: function get() {
107
113
  return _CustomTimeline.default;
108
114
  }
109
115
  });
116
+ Object.defineProperty(exports, "CustomToggle", {
117
+ enumerable: true,
118
+ get: function get() {
119
+ return _CustomToggle.default;
120
+ }
121
+ });
110
122
  Object.defineProperty(exports, "KeyValueDataView", {
111
123
  enumerable: true,
112
124
  get: function get() {
@@ -149,24 +161,12 @@ Object.defineProperty(exports, "StageTimelineChild", {
149
161
  return _StageTimeline.StageTimelineChild;
150
162
  }
151
163
  });
152
- Object.defineProperty(exports, "Tag", {
153
- enumerable: true,
154
- get: function get() {
155
- return _Tag.default;
156
- }
157
- });
158
164
  Object.defineProperty(exports, "TextArea", {
159
165
  enumerable: true,
160
166
  get: function get() {
161
167
  return _TextArea.default;
162
168
  }
163
169
  });
164
- Object.defineProperty(exports, "Toggle", {
165
- enumerable: true,
166
- get: function get() {
167
- return _CustomToggle.default;
168
- }
169
- });
170
170
  Object.defineProperty(exports, "TrackShipment", {
171
171
  enumerable: true,
172
172
  get: function get() {
@@ -211,7 +211,7 @@ var _SpacingScales = _interopRequireDefault(require("./components/oa-component-s
211
211
  var _CustomTable = _interopRequireDefault(require("./components/oa-component-table/CustomTable"));
212
212
  var _CustomTabs = _interopRequireDefault(require("./components/oa-component-tabs/CustomTabs"));
213
213
  var _TextArea = _interopRequireDefault(require("./components/oa-component-textarea/TextArea"));
214
- var _Tag = _interopRequireDefault(require("./components/oa-component-tag/Tag"));
214
+ var _CustomTag = _interopRequireDefault(require("./components/oa-component-tag/CustomTag"));
215
215
  var _CustomTimeline = _interopRequireDefault(require("./components/oa-component-timeline/CustomTimeline"));
216
216
  var _CustomToggle = _interopRequireDefault(require("./components/oa-component-toggle/CustomToggle"));
217
217
  var _TrackShipment = _interopRequireDefault(require("./widgets/oa-widget-track-shipment/TrackShipment"));
@@ -13,34 +13,40 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
13
13
  var _antd = require("antd");
14
14
  var _icons = require("@ant-design/icons");
15
15
  var _templateObject;
16
+ /* eslint-disable react/prop-types */
16
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
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); }
18
19
  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; }
19
20
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
20
- const StyledAside = _styledComponents.default.aside(_templateObject || (_templateObject = _taggedTemplateLiteral(["\nparentDiv{\n display: grid;\n grid-template-columns: repeat(12, 1fr);\n gap: 24px;\n padding:0;\n}\n.col-7 {\n grid-column: span 7;\n}\n\n.col-5 {\n grid-column: span 5;\n}\n.col-5 a{\n padding:0 !important;\n}\n.col-12 {\n grid-column: span 12;\n}\n.ant-typography{\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px; \n color: #212121;\n padding: 0 0 10px;\n display: block;\n }\n .ant-typography strong{\n font-weight: 400;\n }\n a{\n color: #014FC5 !important;\n padding:10px 0 0 !important;\n font-weight: 500 !important;\n display: block;\n }\n .ant-typography-secondary{\n color: #717171;\n padding: 0 !important;\n }\n .ant-radio-group-outline{\n display: flex;\n justify-content: space-between;\n }\n section{\n padding: 16px 0 0;\n }\n section span{\n padding: 0 0 4px !important;\n display: block;\n }\n textarea{\n padding: 12px;\n min-height: 88px;\n resize: none;\n border-radius: 4px;\n }\n radiofield label{\n white-space: nowrap;\n }\n docdetailstag a{\n white-space: nowrap;\n }\n"])));
21
+ const StyledAside = _styledComponents.default.aside(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\n.col-7 {\n grid-column: span 7;\n}\n\n.col-5 {\n grid-column: span 5;\n}\n.col-5 a{\n padding:0 !important;\n}\n.col-12 {\n grid-column: span 12;\n}\n.ant-typography{\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px; \n color: #212121;\n padding: 0 0 10px;\n display: block;\n }\n .ant-typography strong{\n font-weight: 400;\n }\n a{\n color: #014FC5 !important;\n padding:10px 0 0 !important;\n font-weight: 500 !important;\n display: block;\n }\n .ant-typography-secondary{\n color: #717171;\n padding: 0 !important;\n }\n .ant-radio-group-outline{\n display: flex;\n justify-content: space-between;\n }\n section{\n padding: 16px 0 0;\n }\n section span{\n padding: 0 0 4px !important;\n display: block;\n }\n textarea{\n padding: 12px;\n min-height: 88px;\n resize: none;\n border-radius: 4px;\n }\n radiofield label{\n white-space: nowrap;\n }\n docdetailstag a{\n white-space: nowrap;\n }\n .container {\n max-width: 1120px;\n margin: 0 auto;\n padding: 0 16px;\n }\n .container-fluid{\n width: 100%;\n padding: 0 16px;\n }\n .row {\n display: flex;\n flex-direction: column;\n }\n .gutter{\n margin: 0 24px 0 0;\n }\n .row::after {\n content: \"\";\n clear: both;\n display: table;\n }\n .col-xs-1 {\n width: 8.33333%;\n }\n \n .col-xs-2 {\n width: 16.66667%;\n }\n \n .col-xs-3 {\n width: 25%;\n }\n \n .col-xs-4 {\n width: 33.33333%;\n }\n \n .col-xs-5 {\n width: 41.66667%;\n }\n \n .col-xs-6 {\n width: 50%;\n }\n \n .col-xs-7 {\n width: 58.33333%;\n }\n \n .col-xs-8 {\n width: 66.66667%;\n }\n \n .col-xs-9 {\n width: 75%;\n }\n \n .col-xs-10 {\n width: 83.33333%;\n }\n \n .col-xs-11 {\n width: 91.66667%;\n }\n \n .col-xs-12 {\n width: 100%;\n }\n @media (min-width: 768px) {\n .row {\n flex-direction: row;\n }\n .col-sm-1 {\n width: 8.33333%;\n }\n \n .col-sm-2 {\n width: 16.66667%;\n }\n \n .col-sm-3 {\n width: 25%;\n }\n \n .col-sm-4 {\n width: 33.33333%;\n }\n \n .col-sm-5 {\n width: 41.66667%;\n }\n \n .col-sm-6 {\n width: 50%;\n }\n .col-sm-7 {\n width: 58.33333%;\n }\n .col-sm-8 {\n width: 66.66667%;\n }\n .col-sm-9 {\n width: 75%;\n }\n .col-sm-10 {\n width: 83.33333%;\n }\n .col-sm-11 {\n width: 91.66667%;\n }\n .col-sm-12 {\n width: 100%;\n }\n }\n \n @media (min-width: 768px) {\n .col-md-1 {\n width: 8.33333%;\n }\n .col-md-2 {\n width: 16.66667%;\n }\n .col-md-3 {\n width: 25%;\n }\n .col-md-4 {\n width: 33.33333%;\n float: left;\n }\n \n .col-md-5 {\n width: 41.66667%;\n }\n \n .col-md-6 {\n width: 50%;\n }\n \n .col-md-7 {\n width: 58.33333%;\n }\n \n .col-md-8 {\n width: 66.66667%;\n }\n \n .col-md-9 {\n width: 75%;\n }\n \n .col-md-10 {\n width: 83.33333%;\n }\n .col-md-11 {\n width: 91.66667%;\n }\n \n .col-md-12 {\n width: 100%;\n }\n \n }\n /* Large Devices (desktops) */\n @media (min-width: 992px) {\n .gutter{\n margin: 0 24px 0 0;\n }\n .col-lg-1 {\n width: 8.33333%;\n }\n .col-lg-2 {\n width: 16.66667%;\n }\n .col-lg-3 {\n width: 25%;\n float: left;\n }\n .col-lg-4 {\n width: 33.33333%;\n float: left;\n }\n .col-lg-5 {\n width: 41.66667%;\n }\n .col-lg-6 {\n width: 50%;\n }\n .col-lg-7 {\n width: 58.33333%;\n }\n .col-lg-8 {\n width: 66.66667%;\n }\n .col-lg-9 {\n width: 75%;\n }\n .col-lg-10 {\n width: 83.33333%;\n }\n \n .col-lg-11 {\n width: 91.66667%;\n }\n \n .col-lg-12 {\n width: 100%;\n }\n }\n \n @media (min-width: 1200px) {\n .gutter{\n margin: 0 32px 0 0;\n }\n .col-xl-1 {\n width: 8.33333%;\n }\n \n }\n \n"])));
21
22
  const isUndefined = () => typeof testVar === 'undefined';
22
23
  function ApprovalWidget(_ref) {
23
24
  let {
24
- data: {
25
- title,
26
- description,
27
- key,
28
- isFaq,
29
- field,
30
- remarks,
31
- view,
32
- docDetails,
33
- divider
34
- }
25
+ title,
26
+ description,
27
+ key,
28
+ layoutType,
29
+ field,
30
+ remarks,
31
+ view,
32
+ docDetails,
33
+ divider,
34
+ isFaq
35
35
  } = _ref;
36
36
  const [drawer, setDrawer] = (0, _react.useState)(false);
37
37
  const isDivider = isUndefined(divider) ? true : divider;
38
38
  return /*#__PURE__*/_react.default.createElement(StyledAside, {
39
39
  key: key
40
- }, /*#__PURE__*/_react.default.createElement("parentDiv", null, /*#__PURE__*/_react.default.createElement("div", {
41
- className: "col-7"
42
- }, /*#__PURE__*/_react.default.createElement("parentdiv", null, /*#__PURE__*/_react.default.createElement("div", {
43
- className: isFaq ? 'col-12' : 'col-7'
40
+ }, /*#__PURE__*/_react.default.createElement("div", {
41
+ className: "container"
42
+ }, /*#__PURE__*/_react.default.createElement("div", {
43
+ className: "row"
44
+ }, /*#__PURE__*/_react.default.createElement("div", {
45
+ className: "col-sm-12 col-md-7 col-lg-7 gutter"
46
+ }, /*#__PURE__*/_react.default.createElement("div", {
47
+ className: "row"
48
+ }, /*#__PURE__*/_react.default.createElement("div", {
49
+ className: isFaq ? 'col-sm-12 col-md-12 col-lg-12' : 'col-sm-12 col-md-8 col-lg-8 gutter'
44
50
  }, title && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_antd.Typography.Text, {
45
51
  level: 4,
46
52
  strong: true
@@ -63,7 +69,7 @@ function ApprovalWidget(_ref) {
63
69
  },
64
70
  open: drawer
65
71
  }, view.description))), !isFaq && /*#__PURE__*/_react.default.createElement("div", {
66
- className: "col-5"
72
+ className: "col-sm-12 col-md-4 col-lg-4"
67
73
  }, docDetails ? /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_antd.Typography.Link, {
68
74
  level: 4,
69
75
  strong: true,
@@ -71,7 +77,7 @@ function ApprovalWidget(_ref) {
71
77
  }, docDetails.name && /*#__PURE__*/_react.default.createElement(_icons.DownloadOutlined, null), ' ', docDetails.name)) : /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_antd.Typography.Text, {
72
78
  level: 4
73
79
  }, "Not Uploaded"))))), /*#__PURE__*/_react.default.createElement("div", {
74
- className: "col-5"
80
+ className: "col-sm-12 col-md-5 col-lg-5"
75
81
  }, field && /*#__PURE__*/_react.default.createElement(_antd.Radio.Group, {
76
82
  options: field.options,
77
83
  onChange: field.onChange,
@@ -81,7 +87,7 @@ function ApprovalWidget(_ref) {
81
87
  }, "Remarks"), /*#__PURE__*/_react.default.createElement(_antd.Input.TextArea, {
82
88
  onChange: remarks.onChange,
83
89
  value: remarks.value
84
- })))), isDivider && /*#__PURE__*/_react.default.createElement(_antd.Divider, null));
90
+ }))))), isDivider && /*#__PURE__*/_react.default.createElement(_antd.Divider, null));
85
91
  }
86
92
  ApprovalWidget.propTypes = {
87
93
  data: _propTypes.default.shape({
@@ -116,6 +122,7 @@ ApprovalWidget.propTypes = {
116
122
 
117
123
  ApprovalWidget.defaultProps = {
118
124
  data: {
125
+ title: 'hello',
119
126
  description: '',
120
127
  // Provide a default value for description
121
128
  isFaq: false,
@@ -8,9 +8,9 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
8
8
  var _templateObject, _templateObject2, _templateObject3, _templateObject4; // KeyValueDataViewStyles.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
- const KeyValueGroups = _styledComponents.default.section(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n \n display: grid;\n gap: 12px;\n grid-template-columns: repeat(", " ,1fr);\n"])), props => props.columns);
11
+ const KeyValueGroups = _styledComponents.default.section(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n \n display: flex;\n gap: 32px;\n grid-template-columns: repeat(", " ,1fr);\n"])), props => props.columns);
12
12
  exports.KeyValueGroups = KeyValueGroups;
13
- const KeyValueGroup = _styledComponents.default.section(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: grid;\n grid-template-columns: 110px 1fr;\n // This prevents the rows from taking up all the available space.\n grid-auto-rows: min-content;\n gap: 5px;\n\n /* width: 100%; */\n"])));
13
+ const KeyValueGroup = _styledComponents.default.section(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: grid;\n grid-template-columns: 120px 1fr;\n // This prevents the rows from taking up all the available space.\n grid-auto-rows: min-content;\n width: 33.33%;\n"])));
14
14
  exports.KeyValueGroup = KeyValueGroup;
15
15
  const StyledBold = _styledComponents.default.b(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n color: var(--color-primarygrey-text);\n font-weight: 400;\n"])));
16
16
  exports.StyledBold = StyledBold;
@@ -32,7 +32,7 @@ function SendPaymentLink(_ref) {
32
32
  } = _ref;
33
33
  const [form] = _antd.Form.useForm();
34
34
  const [selectedRadio, setSelectedRadio] = (0, _react.useState)(0);
35
- const onChange = event => {
35
+ const onRadioChange = event => {
36
36
  setSelectedRadio(event.target.value);
37
37
 
38
38
  // Setting mobileNum and email to falsy values just in case the data is empty.
@@ -45,11 +45,21 @@ function SendPaymentLink(_ref) {
45
45
  const handleSubmit = () => {
46
46
  // Customize submit behavior over here.
47
47
 
48
- // Call to `onSubmit` callback received from props.
49
- onSubmit();
48
+ form.validateFields().then(formData => {
49
+ const modifiedFormData = _objectSpread(_objectSpread({}, formData), {}, {
50
+ label: options[selectedRadio].label,
51
+ value: options[selectedRadio].value
52
+ });
50
53
 
51
- // Submitting the form.
52
- form.submit();
54
+ /*
55
+ Call to `onSubmit` callback received from props.
56
+ Passing the form data up to the parent by putting it as an argument.
57
+ */
58
+ onSubmit(modifiedFormData);
59
+ });
60
+
61
+ // This resets the form upon submit.
62
+ form.resetFields();
53
63
  };
54
64
  const handleClose = () => {
55
65
  // Customize close behavior over here.
@@ -61,12 +71,12 @@ function SendPaymentLink(_ref) {
61
71
  closable: true,
62
72
  buttonConfig: [{
63
73
  label: 'Cancel',
64
- onClick: handleClose,
74
+ callback: handleClose,
65
75
  type: 'secondary'
66
76
  }, {
67
77
  label: 'Send',
68
78
  // Calling submit on the form, if the Send button is clicked
69
- onClick: handleSubmit,
79
+ callback: handleSubmit,
70
80
  type: 'primary'
71
81
  }],
72
82
  onClose: handleClose,
@@ -75,16 +85,17 @@ function SendPaymentLink(_ref) {
75
85
  }, /*#__PURE__*/_react.default.createElement(_styles.RadioContainer, null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
76
86
  typography: "type-t2-700"
77
87
  }, "Send to:"), /*#__PURE__*/_react.default.createElement(_CustomRadio.default.Group, {
78
- onChange: onChange,
88
+ onChange: onRadioChange,
79
89
  value: selectedRadio
80
90
  }, /*#__PURE__*/_react.default.createElement(_styles.RadioGrid, null, options.map((option, idx) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
81
91
  key: option.value
82
92
  }, /*#__PURE__*/_react.default.createElement(_CustomRadio.default, {
93
+ onChange: onRadioChange,
83
94
  label: option.label,
84
95
  value: idx
85
96
  })))))), /*#__PURE__*/_react.default.createElement(_antd.Form, {
86
97
  form: form,
87
- initialValues: options[0].data,
98
+ initialValues: options[selectedRadio].data,
88
99
  layout: "vertical",
89
100
  onFinish: handleSubmit
90
101
  // `handleSubmit` (using the alias `onFinish`)
@@ -1,6 +1,10 @@
1
1
  ```jsx
2
- const onSubmit = ({ mobileNum, email }) => {
2
+ const onSubmit = ({
3
+ email, label, mobileNum, value,
4
+ }) => {
3
5
  // Use the mobile number and email obtained from the form over here.
6
+ console.log(`Contact person is '${label}'`);
7
+ console.log(`Code of contact person is '${value}`);
4
8
  console.log(`Phone Number is '${mobileNum}'`);
5
9
  console.log(`Email ID is '${email}'`);
6
10
  };
@@ -26,9 +30,20 @@ const sendPaymentProps = {
26
30
  ],
27
31
  };
28
32
 
29
- <SendPaymentLink
30
- heading={sendPaymentProps.heading}
31
- options={sendPaymentProps.options}
32
- onSubmit={onSubmit}
33
- />
33
+ function App() {
34
+ const [open, setOpen] = useState(false);
35
+
36
+ return (
37
+ <>
38
+ <CustomButton onClick={() => setOpen(true)}>
39
+
40
+ <SendPaymentLink
41
+ heading={sendPaymentProps.heading}
42
+ options={sendPaymentProps.options}
43
+ open={open}
44
+ onSubmit={onSubmit}
45
+ />
46
+ </>
47
+ )
48
+ };
34
49
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oa-componentbook",
3
- "version": "0.17.9",
3
+ "version": "0.17.11",
4
4
  "private": false,
5
5
  "description": "Reusable components",
6
6
  "main": "build/index.js",
@@ -14,6 +14,7 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@ant-design/icons": "^5.2.6",
17
+ "@babel/plugin-proposal-private-property-in-object": "^7.21.11",
17
18
  "@storybook/addon-actions": "^7.4.3",
18
19
  "@storybook/addon-styling": "^1.3.7",
19
20
  "@storybook/cli": "^7.3.2",
@@ -39,7 +40,7 @@
39
40
  "@storybook/testing-library": "^0.2.0",
40
41
  "babel-plugin-named-exports-order": "^0.0.2",
41
42
  "eslint-config-airbnb": "^19.0.4",
42
- "eslint-plugin-storybook": "^0.6.13",
43
+ "eslint-plugin-storybook": "^0.6.14",
43
44
  "react-scripts": "^5.0.1",
44
45
  "storybook": "^7.3.2",
45
46
  "webpack": "^5.88.2",
@@ -85,7 +86,7 @@
85
86
  }
86
87
  ],
87
88
  "react/jsx-props-no-spreading": [
88
- 1,
89
+ 1,
89
90
  {
90
91
  "html": "enforce",
91
92
  "custom": "enforce",