oa-componentbook 0.18.133 → 0.18.134

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.
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  require("core-js/modules/es.object.assign.js");
4
+ require("core-js/modules/es.weak-map.js");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
+ require("core-js/modules/web.dom-collections.iterator.js");
10
+ var _react = _interopRequireWildcard(require("react"));
9
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
10
12
  var _antd = require("antd");
11
13
  var _CloseRounded = _interopRequireDefault(require("@material-ui/icons/CloseRounded"));
@@ -17,6 +19,8 @@ var _styles = require("./styles");
17
19
  var _MaterialIcon = _interopRequireDefault(require("../oa-component-icons/MaterialIcon"));
18
20
  const _excluded = ["buttonConfig", "children", "isBaseDrawer", "onClose", "open", "placement", "title", "height", "width", "data-test"];
19
21
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
23
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
20
24
  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); }
21
25
  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
26
  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; }
@@ -30,13 +34,7 @@ function CustomDrawer(_ref) {
30
34
  let {
31
35
  buttonConfig,
32
36
  children,
33
- /*
34
- This boolean flag indicates whether the current drawer is the top-level base drawer
35
- within a stack of drawers or a nested drawer.
36
- A "base drawer" serves as the root or primary layer in a stack of drawers.
37
- */
38
37
  isBaseDrawer,
39
- // This callback function provided by parent is called upon clicking on the close button.
40
38
  onClose,
41
39
  open,
42
40
  placement,
@@ -46,14 +44,26 @@ function CustomDrawer(_ref) {
46
44
  'data-test': dataTest
47
45
  } = _ref,
48
46
  antDesignProps = _objectWithoutProperties(_ref, _excluded);
49
- /*
50
- We make our own callback function, which makes a call to the `onClose`
51
- function given to use by the parent.
52
- This is beneficial if we want some of our actions to be executed when
53
- we attempt to close the drawer.
54
- */
47
+ const [isMobile, setIsMobile] = (0, _react.useState)(false);
48
+ (0, _react.useEffect)(() => {
49
+ const handleResize = () => {
50
+ // Update isMobile state based on the screen width
51
+ setIsMobile(window.innerWidth <= 768); // Adjust the breakpoint as needed
52
+ };
53
+
54
+ // Initial check on mount
55
+ handleResize();
56
+
57
+ // Listen for window resize events
58
+ window.addEventListener('resize', handleResize);
59
+
60
+ // Cleanup event listener on component unmount
61
+ return () => {
62
+ window.removeEventListener('resize', handleResize);
63
+ };
64
+ }, []);
65
+ const drawerPlacement = isMobile ? 'bottom' : placement;
55
66
  const handleClose = () => {
56
- // Call to `onClose` callback received from props.
57
67
  onClose();
58
68
  };
59
69
  return /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, {
@@ -74,7 +84,8 @@ function CustomDrawer(_ref) {
74
84
  "data-test": dataTest,
75
85
  onClose: handleClose,
76
86
  open: open,
77
- placement: placement,
87
+ placement: drawerPlacement // Use the computed placement value
88
+ ,
78
89
  push: false,
79
90
  title: isBaseDrawer ? /*#__PURE__*/_react.default.createElement(_styles.BaseDrawerTitle, null, DrawerTitle(title), /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
80
91
  color: "primary-content",
@@ -92,11 +103,7 @@ function CustomDrawer(_ref) {
92
103
  height: height,
93
104
  width: width,
94
105
  footer: (buttonConfig === null || buttonConfig === void 0 ? void 0 : buttonConfig.length) > 0 && !antDesignProps.footer ? /*#__PURE__*/_react.default.createElement(_styles.DrawerFooter, null, buttonConfig.map(button => /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
95
- disabled:
96
- // This command checks whether this button config has a disabled field or not.
97
- Object.prototype.hasOwnProperty.call(button, 'disabled') ? button.disabled
98
- // If it doesn't we hardcode the button to never be disabled.
99
- : false,
106
+ disabled: Object.prototype.hasOwnProperty.call(button, 'disabled') ? button.disabled : false,
100
107
  iconConfig: button === null || button === void 0 ? void 0 : button.iconConfig,
101
108
  key: (0, _utils.getUUID)(),
102
109
  label: button.label,
@@ -108,7 +115,6 @@ function CustomDrawer(_ref) {
108
115
  }, antDesignProps), children)));
109
116
  }
110
117
  CustomDrawer.propTypes = {
111
- // Array of button configurations
112
118
  buttonConfig: _propTypes.default.arrayOf(_propTypes.default.shape({
113
119
  'data-test': _propTypes.default.string,
114
120
  disabled: _propTypes.default.bool,
@@ -140,7 +146,7 @@ CustomDrawer.defaultProps = {
140
146
  open: true,
141
147
  placement: 'right',
142
148
  title: null,
143
- height: 'auto',
149
+ height: '100%',
144
150
  width: '480'
145
151
  };
146
152
  var _default = exports.default = CustomDrawer;
@@ -117,7 +117,7 @@ function ServiceCard(_ref) {
117
117
  style: {
118
118
  color: 'inherit'
119
119
  }
120
- })))), /*#__PURE__*/_react.default.createElement(_CustomModal.default, {
120
+ })))), showModal && /*#__PURE__*/_react.default.createElement(_CustomModal.default, {
121
121
  open: showModal,
122
122
  imgSrc: null,
123
123
  onCancel: toggleModal,
@@ -10,4 +10,4 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
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 MembershipCardStyle = exports.MembershipCardStyle = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.flexGap div{\n padding: 0 0 8px;\n}\n.viewStatus button{\n padding: 16px 0 0;\n}\n.flexGap div:last-child{\n padding: 0;\n}\n.primaryInfo svg{\n cursor: pointer;\n}\np,h1, h2, h3, h4, h5, h6{\n margin: 0;\n}\n padding: 24px;\n background: var(--color-primary-background);\n border-radius: 12px;\n box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.14);\n position: relative;\n margin: 0 0 24px;\n border: 1px solid var(--color-divider);\n @media only screen and (max-width: 600px) {\n .type-t1-500 {\n font-size: 16px;\n font-weight: 700;\n line-height: 24px;\n }\n gap: 16px;\n padding: 24px 16px 16px;\n .cardHead p .type-b1-400{\n font-size: 14px;\n font-weight: 400;\n line-height: 20px;\n }\n .primary-info label .type-t2-700{\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n }\n }\n .primaryInfo{\n display: flex;\n padding: 12px 8px;\n justify-content: space-between;\n background: var(--color-primary);\n border-radius: 8px;\n align-items: center;\n cursor: pointer;\n }\n .primaryInfo img{\n width: 24px;\n height: 24px;\n }\n .toolTipInfo .text-container svg {\n font-size: 16px !important;\n }\n .paraWithIcon{\n display: flex;\n gap: 8px;\n align-items: center;\n }\n .toolTipInfo{\n display: flex;\n background: var(--color-background-positive);\n padding: 12px;\n border-radius: 8px;\n flex-direction: column;\n justify-content: space-between;\n }\n .flexChangeBody{\n flex-direction: row;\n align-items: center;\n }\n\n .toolTipInfo .toolTip + div{\n display: flex;\n justify-content: end;\n }\n .error{\n background: var(--color-background-negative);\n }\n .error .toolTip svg{\n color: var(--color-negative);\n }\n .warning{\n background: var(--color-background-warning);\n }\n .warning .toolTip svg{\n color: var(--color-warning);\n }\n .success{\n background: var(--color-background-positive);\n }\n\n .success .toolTip svg{\n color: var(--color-positive);\n }\n .toolTip{\n display: flex;\n gap: 8px;\n }\n .cardHead{\n display: flex;\n justify-content: space-between;\n gap: 24px;\n }\n .imgBg{\n border-radius: 8px;\n background: #DEF1FB;\n min-width: 56px;\n height: 56px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n \n .ant-modal-footer{\n display: none;\n }\n .toolTip svg{\n margin: 0px 0 0;\n }\n .flexChangeBody{\n align-items: center !important;\n flex-direction: row !important;\n gap: 8px !important;\n }\n .flexChangeBody .text-container{\n white-space: nowrap;\n }\n .flexChangeBody .viewStatus button {\n padding: 0 !important;\n}\n.displayFlex{\n display: flex;\n}\n @media only screen and (max-width: 600px) {\n .type-b1-400{\n font-size: 14px;\n font-weight: 400;\n line-height: 20px;\n }\n .toolTipInfo {\n flex-direction: column;\n gap: 0;\n align-items: unset;\n }\n \n .cardHead .titleHead > span{\n font-size: 16px;\n font-weight: 700;\n line-height: 24px;\n }\n }\n"])));
12
12
  const CardBody = exports.CardBody = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\ndisplay: flex;\nflex-direction: column;\ngap: 24px;\n@media only screen and (max-width: 600px) {\n gap: 16px;\n}\n"])));
13
- const CardFooter = exports.CardFooter = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n.mobileIcon{\n display: none;\n}\ndisplay: flex;\npadding: 16px 24px;\ngap: 24px;\nborder-top: 1px solid var(--color-divider);\nwidth: calc(100% + 48px);\nmargin: 0 0 0 -24px;\nposition: relative;\ntop: 24px;\njustify-content: end;\n@media only screen and (max-width: 600px) {\n .fullWidth{\n width: 100%;\n }\n .mobileIcon{\n min-width: 48px;\n height: 48px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: var(--color-primary);\n border-radius: 50%;\n color: var(--color-primary-background);\n }\n padding: 16px 16px;\n width: calc(100% + 32px);\n margin: 0 0 0 -16px;\n top: 16px;\n align-items:center;\ndiv span {\n display: block;\n}\ndiv span > .type-t2-700{\n padding: 4px 0 0;\n}\n .text-container .type-t2-700 {\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n}\n.large {\n height: 36px;\n min-width: 100px;\n padding: 10px 16px;\n}\n}\n"])));
13
+ const CardFooter = exports.CardFooter = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n.mobileIcon{\n display: none;\n}\ndisplay: flex;\npadding: 16px 24px;\ngap: 24px;\nborder-top: 1px solid var(--color-divider);\nwidth: calc(100% + 48px);\nmargin: 0 0 0 -24px;\nposition: relative;\ntop: 24px;\njustify-content: end;\n@media only screen and (max-width: 600px) {\n .fullWidth{\n width: 100%;\n }\n .mobileIcon{\n min-width: 48px;\n height: 48px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: var(--color-primary);\n border-radius: 50%;\n color: var(--color-primary-background);\n }\n .mobileIcon a{\n display: flex;\n }\n padding: 16px 16px;\n width: calc(100% + 32px);\n margin: 0 0 0 -16px;\n top: 16px;\n align-items:center;\ndiv span {\n display: block;\n}\ndiv span > .type-t2-700{\n padding: 4px 0 0;\n}\n .text-container .type-t2-700 {\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n}\n.large {\n height: 36px;\n min-width: 100px;\n padding: 10px 16px;\n}\n}\n"])));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oa-componentbook",
3
- "version": "0.18.133",
3
+ "version": "0.18.134",
4
4
  "private": false,
5
5
  "description": "Reusable components",
6
6
  "main": "build/index.js",