oa-componentbook 0.18.253 → 0.18.255

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.
@@ -9,5 +9,5 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
9
9
  var _templateObject, _templateObject2;
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
12
- const MainStyleSec = exports.MainStyleSec = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.ant-upload-list{\n display: flex !important;\n gap: 16px !important;\n flex-wrap: wrap !important;\n}\n.ant-upload-wrapper .ant-upload-list::before {\n display: none;\n}\n.ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload.ant-upload-select,.ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-container{\n width: 96px;\n height: 96px;\n margin-block: 0;\n margin-inline: 0;\n}\n.ant-upload-select button > span.UploadImg{\n width: 24px !important;\n height: 24px;\n}\n.ant-upload-select button > span.UploadImg > img{\n width: 100% !important;\n}\n.ant-upload-list-item-container:last-child{\n margin: 0 !important;\n}\n.ant-form-item{\n margin-bottom: 0;\n}\n.ant-upload button{\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n} \n\n.uploadSecPad div{\n padding: 0 0 8px;\n}\n.anticon-upload{\n font-size: 24px;\n}\n.uploadSecPad{\n width: 100%;\n}\n.uploadSecPad div:last-child{\n padding: 0;\n}\n display: flex;\n flex-direction: column;\n gap: 24px;\n .ant-upload-list-item-done,.ant-upload-list-item-A{\n border: 1px solid var(--color-divider) !important;\n }\n \n .ant-upload-list-item-actions{\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 16px;\n }\n \n.ant-upload-list-item-actions button{\n background: #212121;\n border-radius: 50px;\n height: 24px !important;\n display: flex;\n align-items: center;\n}\n.ant-btn-text:not(:disabled):not(.ant-btn-disabled):hover{\n background: #212121;\n}\n .ant-upload-list-item-actions a{\n background: #212121;\n border-radius: 50px;\n height: 24px;\n display: flex;\n }\n \n .ant-upload-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item{\n opacity: 1 !important;\n }\n \n @media only screen and (max-width: 600px) {\n .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-container,.ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload.ant-upload-select{\n width: 64px;\n height: 64px;\n }\n .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item::before,.ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-actions,.ant-upload-wrapper .ant-upload-list .ant-upload-list-item .ant-upload-list-item-actions .ant-upload-list-item-action {\n opacity: 1;\n }\n .ant-upload-list-item-actions a {\n height: 16px;\n align-items: center;\n justify-content: center;\n width: 16px !important;\n }\n .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-actions .anticon-eye, .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-actions .anticon-delete {\n font-size: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n margin: 0px !important;\n padding: 0px !important;\n color: #fff;\n}\n }\n"])));
12
+ const MainStyleSec = exports.MainStyleSec = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.ant-upload-list{\n display: flex !important;\n gap: 16px !important;\n flex-wrap: wrap !important;\n}\n.ant-upload-wrapper .ant-upload-list::before {\n display: none;\n}\n.ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload.ant-upload-select,.ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-container{\n width: 96px;\n height: 96px;\n margin-block: 0;\n margin-inline: 0;\n}\n.ant-upload-select button > span.UploadImg{\n width: 24px !important;\n height: 24px;\n}\n.ant-upload-select button > span.UploadImg > img{\n width: 100% !important;\n}\n.ant-upload-list-item-container:last-child{\n margin: 0 !important;\n}\n.ant-form-item{\n margin-bottom: 0;\n}\n.ant-upload button{\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n} \n\n.uploadSecPad div{\n padding: 0 0 8px;\n}\n.anticon-upload{\n font-size: 24px;\n}\n.ant-upload-disabled .button{\n cursor: not-allowed;\n}\n.uploadSecPad{\n width: 100%;\n}\n.uploadSecPad div:last-child{\n padding: 0;\n}\n display: flex;\n flex-direction: column;\n gap: 24px;\n .ant-upload-list-item-done,.ant-upload-list-item-A{\n border: 1px solid var(--color-divider) !important;\n }\n \n .ant-upload-list-item-actions{\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 16px;\n }\n \n.ant-upload-list-item-actions button{\n background: #212121;\n border-radius: 50px;\n height: 24px !important;\n display: flex;\n align-items: center;\n}\n.ant-btn-text:not(:disabled):not(.ant-btn-disabled):hover{\n background: #212121;\n}\n .ant-upload-list-item-actions a{\n background: #212121;\n border-radius: 50px;\n height: 24px;\n display: flex;\n }\n \n .ant-upload-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item{\n opacity: 1 !important;\n }\n \n @media only screen and (max-width: 600px) {\n .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-container,.ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload.ant-upload-select{\n width: 64px;\n height: 64px;\n }\n .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item::before,.ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-actions,.ant-upload-wrapper .ant-upload-list .ant-upload-list-item .ant-upload-list-item-actions .ant-upload-list-item-action {\n opacity: 1;\n }\n .ant-upload-list-item-actions a {\n height: 16px;\n align-items: center;\n justify-content: center;\n width: 16px !important;\n }\n .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-actions .anticon-eye, .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-actions .anticon-delete {\n font-size: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n margin: 0px !important;\n padding: 0px !important;\n color: #fff;\n}\n }\n"])));
13
13
  const StyledSection = exports.StyledSection = _styledComponents.default.section(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n gap: 16px;\n justify-content: space-between;\n h2{\n margin: 0;\n }\n \n @media only screen and (max-width: 600px) {\n \n .ant-upload-list-item-actions button {\n height: 16px!important;\n width: 16px !important;\n justify-content: center;\n }\n .ant-upload-list-item-actions a {\n height: 16px;\n width: 16px !important;\n align-items: center;\n justify-content: center;\n}\n .ant-upload-list-item-actions {\n gap: 8px;\n }\n .ant-upload button span + div{\n display: none;\n }\n }\n"])));
@@ -101,29 +101,29 @@ function Controls(_ref) {
101
101
  color: "primary"
102
102
  }))), getFileFormat === 'PDF' && /*#__PURE__*/_react.default.createElement("div", {
103
103
  className: "flextBodyContain pdfFlexStyles"
104
- }, /*#__PURE__*/_react.default.createElement("div", {
105
- role: "button",
104
+ }, /*#__PURE__*/_react.default.createElement("button", {
105
+ type: "button",
106
106
  tabIndex: 0,
107
107
  onClick: () => setPageNumber(pageNumber - 1),
108
108
  onKeyDown: event => handleKeyPress(event, () => setPageNumber(pageNumber - 1)),
109
- className: "iconWidthPad iconWidthPadPdf"
109
+ className: "iconWidthPad iconWidthPadPdf",
110
+ disabled: pageNumber <= 1
110
111
  }, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
111
112
  size: 18,
112
- icon: _ArrowBackIos.default,
113
- disabled: pageNumber <= 1
113
+ icon: _ArrowBackIos.default
114
114
  })), /*#__PURE__*/_react.default.createElement(_Typography.default, {
115
115
  className: "type-b2-400",
116
116
  color: "primary-content"
117
- }, "Page", ' ', pageNumber, ' ', "of", ' ', numPages), /*#__PURE__*/_react.default.createElement("div", {
118
- role: "button",
117
+ }, "Page", ' ', pageNumber, ' ', "of", ' ', numPages), /*#__PURE__*/_react.default.createElement("button", {
118
+ type: "button",
119
119
  tabIndex: 0,
120
120
  onClick: () => setPageNumber(pageNumber + 1),
121
121
  onKeyDown: event => handleKeyPress(event, () => setPageNumber(pageNumber + 1)),
122
- className: "iconWidthPad iconWidthPadPdf"
122
+ className: "iconWidthPad iconWidthPadPdf",
123
+ disabled: pageNumber >= numPages
123
124
  }, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
124
125
  size: 18,
125
- icon: _ArrowForwardIos.default,
126
- disabled: pageNumber >= numPages
126
+ icon: _ArrowForwardIos.default
127
127
  }))), /*#__PURE__*/_react.default.createElement("div", {
128
128
  role: "button",
129
129
  tabIndex: 0,
@@ -11,4 +11,4 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
11
11
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
12
12
  const mainStyle = exports.mainStyle = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\nposition: relative;\nbackground: red;\n"])));
13
13
  const StyledZoom = exports.StyledZoom = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n.flextBodyContain{\n position: absolute;\n right: 52px;\n bottom: 116px;\n flex-direction: column;\n z-index: 9999;\n display: flex;\n border-radius: 4px;\n overflow: hidden;\n box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.14);\n}\n.posroated{\n position: absolute;\n right: 52px;\n box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.14);\n top: 68px;\n z-index: 999;\n border-radius: 4px;\n}\n.iconWidthPad{\n cursor: pointer;\n background: var(--color-primary-background); \n padding: 6px;\n height: 32px;\n width: 32px;\n border-bottom: 1px solid var(--color-divider);\n}\n.iconWidthPad:last-child{\n border: none;\n}\n@media screen and (max-width: 992px) {\n .posroated,.flextBodyContain{\n right: 38px;\n }\n }\n"])));
14
- const PdfStyles = exports.PdfStyles = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\ncanvas{\n margin: 0 auto;\n}\n.pdfFlexStyles{\n left: 0;\n right: 0;\n bottom: 92px;\n width: fit-content;\n display: flex;\n flex-direction: row;\n align-items: center;\n background: #fff;\n margin-left: auto;\n margin-right: auto;\n padding: 8px;\n gap: 12px;\n}\n.iconWidthPadPdf {\n width: auto;\n height: auto;\n padding: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 8px;\n border-bottom: none;\n}\nbutton:disabled {\n color: var(--color-disabled-button);\n cursor: not-allowed; \n }\n button{\n color: var(--color-primary-content);\n }\n@media screen and (max-width: 600px) {\n\n canvas {\n width: 100% !important;\n height: auto !important;\n }\n }\n"])));
14
+ const PdfStyles = exports.PdfStyles = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\ncanvas{\n margin: 0 auto;\n}\n.pdfFlexStyles{\n left: 0;\n right: 0;\n bottom: 92px;\n width: fit-content;\n display: flex;\n flex-direction: row;\n align-items: center;\n background: #fff;\n margin-left: auto;\n margin-right: auto;\n padding: 8px;\n gap: 12px;\n}\n.iconWidthPadPdf {\n width: auto;\n height: auto;\n padding: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 8px;\n border: none;\n border-bottom: none;\n}\n\nbutton:disabled {\n color: var(--color-disabled-button);\n cursor: not-allowed; \n border:none;\n }\n button{\n color: var(--color-primary-content);\n }\n@media screen and (max-width: 600px) {\n\n canvas {\n width: 100% !important;\n height: auto !important;\n }\n }\n"])));
@@ -53,14 +53,12 @@ function AddSparePartCollapseWidget(_ref) {
53
53
  const [formValues, setFormValues] = (0, _react.useState)({});
54
54
  const [searchValue, setSearchValue] = (0, _react.useState)('');
55
55
  const notificationRef = (0, _react.useRef)(null);
56
- const itemRefs = (0, _react.useRef)({}); // Create a ref to store references to item panels
57
-
56
+ const itemRefs = (0, _react.useRef)({});
58
57
  const openNotification = parameters => {
59
58
  var _notificationRef$curr;
60
59
  return notificationRef === null || notificationRef === void 0 || (_notificationRef$curr = notificationRef.current) === null || _notificationRef$curr === void 0 ? void 0 : _notificationRef$curr.openNotification(parameters);
61
60
  };
62
61
  (0, _react.useEffect)(() => {
63
- // Pre-fill form values and select the items that are already selected
64
62
  const initialFormValues = {};
65
63
  const initialSelectedItems = new Set();
66
64
  selectedItems.forEach(item => {
@@ -75,12 +73,10 @@ function AddSparePartCollapseWidget(_ref) {
75
73
  setSelectedItemIds(initialSelectedItems);
76
74
  }, [selectedItems]);
77
75
  (0, _react.useEffect)(() => {
78
- // Combine selected items at the top followed by other items
79
76
  const sortedItems = [...selectedItems.map(item => items.find(i => i.id === item.scopeId)).filter(Boolean), ...items.filter(item => !selectedItems.some(selected => selected.scopeId === item.id))];
80
77
  setFilteredItems(sortedItems);
81
78
  }, [items, selectedItems]);
82
79
  (0, _react.useEffect)(() => {
83
- // Uncheck item if any required field is empty
84
80
  const newSelectedItemIds = new Set(selectedItemIds);
85
81
  selectedItemIds.forEach(itemId => {
86
82
  const fields = formValues[itemId];
@@ -135,16 +131,18 @@ function AddSparePartCollapseWidget(_ref) {
135
131
  newSelectedItems.add(itemId);
136
132
  }
137
133
  setSelectedItemIds(newSelectedItems);
138
- if (itemRefs.current[itemId]) {
139
- itemRefs.current[itemId].scrollIntoView({
140
- behavior: 'smooth',
141
- block: 'center'
142
- });
143
- }
144
134
  setSearchValue(''); // Clear search value on item selection
145
- // Reset the filtered items to show all items with selected items at the top
135
+
146
136
  const sortedItems = [...selectedItems.map(item => items.find(i => i.id === item.scopeId)).filter(Boolean), ...items.filter(item => !selectedItems.some(selected => selected.scopeId === item.id))];
147
137
  setFilteredItems(sortedItems);
138
+ setTimeout(() => {
139
+ if (itemRefs.current[itemId]) {
140
+ itemRefs.current[itemId].scrollIntoView({
141
+ behavior: 'smooth',
142
+ block: 'center'
143
+ });
144
+ }
145
+ }, 0);
148
146
  };
149
147
  const isNumeric = value => /^\d*$/.test(value); // Regular expression to check if the value is numeric
150
148
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oa-componentbook",
3
- "version": "0.18.253",
3
+ "version": "0.18.255",
4
4
  "private": false,
5
5
  "description": "Reusable components",
6
6
  "main": "build/index.js",