oa-componentbook 1.0.1-stage.363 → 1.0.1-stage.365

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.
Files changed (24) hide show
  1. package/build/components/oa-component-accordion/Accordion.js +102 -42
  2. package/build/components/oa-component-accordion/styles.js +2 -2
  3. package/build/components/oa-component-button/CustomButton.js +6 -4
  4. package/build/components/oa-component-icons/MaterialIcon.js +1 -1
  5. package/build/components/oa-component-modal/styles.js +1 -1
  6. package/build/components/oa-component-tag/CustomTag.js +18 -12
  7. package/build/index.js +14 -0
  8. package/build/layout/EntityOverviewLayout/EntityOverviewLayout.js +215 -0
  9. package/build/layout/EntityOverviewLayout/reducer/entityOverviewLayoutReducer.js +77 -0
  10. package/build/layout/EntityOverviewLayout/styles.js +13 -0
  11. package/build/layout/GenricLayOut/GenricLayOut.js +299 -173
  12. package/build/layout/GenricLayOut/components/Header.js +7 -1
  13. package/build/layout/GenricLayOut/components/ProfileSection.js +85 -0
  14. package/build/layout/GenricLayOut/reducer/layoutReducer.js +5 -1
  15. package/build/layout/GenricLayOut/styles.js +6 -3
  16. package/build/widgets/oa-form-widget/FormWidget.js +89 -22
  17. package/build/widgets/oa-widget-approval/ApprovalWidgetNew.js +91 -46
  18. package/build/widgets/oa-widget-key-value/KeyValueWidget.js +3 -0
  19. package/build/widgets/oa-widget-profile-data/ProfileDataWidget.js +115 -0
  20. package/build/widgets/oa-widget-profile-data/styles.js +13 -0
  21. package/build/widgets/oa-widget-progressive-steps/ProgressiveStepsWidget.js +104 -105
  22. package/build/widgets/oa-widget-user-management/UserManagementWidget.js +332 -0
  23. package/build/widgets/oa-widget-user-management/styles.js +15 -0
  24. package/package.json +1 -1
@@ -77,6 +77,9 @@ function KeyValueDataView(_ref) {
77
77
  className: "type-b2-400",
78
78
  title: value
79
79
  }, value) || _react.default.isValidElement && /*#__PURE__*/_react.default.createElement("span", null, value), (tagStatus === null || tagStatus === void 0 ? void 0 : tagStatus.tagKey) === key && (tagStatus === null || tagStatus === void 0 ? void 0 : tagStatus.tagData) && /*#__PURE__*/_react.default.createElement(_CustomTag.default, {
80
+ style: {
81
+ width: "100px"
82
+ },
80
83
  type: tagStatus.tagData.type || "success",
81
84
  label: tagStatus.tagData.label,
82
85
  size: tagStatus.tagData.size || "small"
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = ProfileDataWidget;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _Typography = _interopRequireDefault(require("../../components/oa-component-typography/Typography"));
10
+ var _styles = require("./styles");
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ /* eslint-disable */
13
+
14
+ function ProfileDataWidget(_ref) {
15
+ let {
16
+ image,
17
+ title,
18
+ line1,
19
+ line2,
20
+ line3,
21
+ line4,
22
+ line5,
23
+ alignProfile
24
+ } = _ref;
25
+ // Determine what to display in the icon
26
+ const getIconContent = () => {
27
+ if (!(image !== null && image !== void 0 && image.visible)) return null;
28
+ if (image.imageType === "source" && image.imageFile) {
29
+ return /*#__PURE__*/_react.default.createElement("img", {
30
+ src: image.imageFile,
31
+ alt: "Profile",
32
+ style: {
33
+ width: "100%",
34
+ height: "100%",
35
+ borderRadius: "50%",
36
+ objectFit: "cover"
37
+ }
38
+ });
39
+ }
40
+ if (image.imageType === "letterIcon") {
41
+ const letter = title !== null && title !== void 0 && title.label ? title.label.charAt(0).toUpperCase() : "";
42
+ return letter;
43
+ }
44
+ return null;
45
+ };
46
+ return /*#__PURE__*/_react.default.createElement(_styles.ProfileDataContainer, {
47
+ alignProfile: alignProfile
48
+ }, (image === null || image === void 0 ? void 0 : image.visible) && /*#__PURE__*/_react.default.createElement(_styles.ProfileIcon, {
49
+ style: {
50
+ backgroundColor: (image === null || image === void 0 ? void 0 : image.bgColor) || "#1976d2",
51
+ color: (image === null || image === void 0 ? void 0 : image.color) || "#ffffff"
52
+ }
53
+ }, getIconContent()), /*#__PURE__*/_react.default.createElement(_styles.ProfileInfo, null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
54
+ color: (title === null || title === void 0 ? void 0 : title.color) || "primary-content",
55
+ typography: (title === null || title === void 0 ? void 0 : title.typography) || "type-h3-500",
56
+ className: "company-name"
57
+ }, (title === null || title === void 0 ? void 0 : title.label) || ""), /*#__PURE__*/_react.default.createElement("div", {
58
+ className: "company-details"
59
+ }, line1 && /*#__PURE__*/_react.default.createElement(_Typography.default, {
60
+ color: line1.color || "secondary-content",
61
+ typography: line1.typography || "type-b1-400"
62
+ }, line1.label || ""), line2 && /*#__PURE__*/_react.default.createElement(_Typography.default, {
63
+ color: line2.color || "secondary-content",
64
+ typography: line2.typography || "type-b1-400"
65
+ }, line2.label || ""), line3 && /*#__PURE__*/_react.default.createElement(_Typography.default, {
66
+ color: line3.color || "secondary-content",
67
+ typography: line3.typography || "type-b1-400"
68
+ }, line3.label || ""), line4 && /*#__PURE__*/_react.default.createElement(_Typography.default, {
69
+ color: line4.color || "secondary-content",
70
+ typography: line4.typography || "type-b1-400"
71
+ }, line4.label || ""), line5 && /*#__PURE__*/_react.default.createElement(_Typography.default, {
72
+ color: line5.color || "secondary-content",
73
+ typography: line5.typography || "type-b1-400"
74
+ }, line5.label || ""))));
75
+ }
76
+ ProfileDataWidget.propTypes = {
77
+ image: _propTypes.default.shape({
78
+ visible: _propTypes.default.bool,
79
+ imageType: _propTypes.default.oneOf(["source", "letterIcon"]),
80
+ imageFile: _propTypes.default.string,
81
+ color: _propTypes.default.string,
82
+ bgColor: _propTypes.default.string
83
+ }),
84
+ title: _propTypes.default.shape({
85
+ label: _propTypes.default.string,
86
+ typography: _propTypes.default.string,
87
+ color: _propTypes.default.string
88
+ }),
89
+ line1: _propTypes.default.shape({
90
+ label: _propTypes.default.string,
91
+ typography: _propTypes.default.string,
92
+ color: _propTypes.default.string
93
+ }),
94
+ line2: _propTypes.default.shape({
95
+ label: _propTypes.default.string,
96
+ typography: _propTypes.default.string,
97
+ color: _propTypes.default.string
98
+ }),
99
+ line3: _propTypes.default.shape({
100
+ label: _propTypes.default.string,
101
+ typography: _propTypes.default.string,
102
+ color: _propTypes.default.string
103
+ }),
104
+ line4: _propTypes.default.shape({
105
+ label: _propTypes.default.string,
106
+ typography: _propTypes.default.string,
107
+ color: _propTypes.default.string
108
+ }),
109
+ line5: _propTypes.default.shape({
110
+ label: _propTypes.default.string,
111
+ typography: _propTypes.default.string,
112
+ color: _propTypes.default.string
113
+ }),
114
+ alignProfile: _propTypes.default.string
115
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ProfileInfo = exports.ProfileIcon = exports.ProfileDataContainer = void 0;
7
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
8
+ var _templateObject, _templateObject2, _templateObject3;
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
11
+ const ProfileDataContainer = exports.ProfileDataContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: flex-start;\n gap: 24px;\n padding: ", ";\n background: ", ";\n border-radius: ", ";\n margin: ", ";\n box-shadow: ", ";\n border: ", ";\n max-width: ", ";\n justify-content: ", ";\n\n @media (max-width: 768px) {\n flex-direction: column;\n align-items: center;\n text-align: center;\n gap: 16px;\n margin: ", ";\n padding: 24px;\n }\n"])), props => props.alignProfile === 'center' ? '32px' : '32px', props => props.alignProfile === 'center' ? 'transparent' : '#ffffff', props => props.alignProfile === 'center' ? '0' : '12px', props => props.alignProfile === 'center' ? '24px auto' : '24px', props => props.alignProfile === 'center' ? 'none' : '0 2px 8px rgba(0, 0, 0, 0.1)', props => props.alignProfile === 'center' ? 'none' : '1px solid #f0f0f0', props => props.alignProfile === 'center' ? '600px' : 'none', props => props.alignProfile === 'center' ? 'center' : 'flex-start', props => props.alignProfile === 'center' ? '16px auto' : '16px');
12
+ const ProfileIcon = exports.ProfileIcon = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 100px;\n height: 100px;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 48px;\n font-weight: 700;\n flex-shrink: 0;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n\n @media (max-width: 768px) {\n width: 80px;\n height: 80px;\n font-size: 36px;\n }\n"])));
13
+ const ProfileInfo = exports.ProfileInfo = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 12px;\n\n .company-name {\n margin-bottom: 4px;\n font-size: 24px;\n font-weight: 700;\n color: #333333;\n }\n\n .company-details {\n display: flex;\n flex-direction: column;\n gap: 8px;\n\n .ant-typography {\n font-size: 14px;\n line-height: 1.5;\n color: #666666;\n }\n }\n"])));
@@ -10,6 +10,7 @@ require("core-js/modules/web.dom-collections.iterator.js");
10
10
  require("core-js/modules/es.symbol.description.js");
11
11
  var _react = _interopRequireWildcard(require("react"));
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
+ var _icons = require("@ant-design/icons");
13
14
  var _CustomButton = _interopRequireDefault(require("../../components/oa-component-button/CustomButton"));
14
15
  var _CustomInput = _interopRequireDefault(require("../../components/oa-component-input/CustomInput"));
15
16
  var _CustomUpload = _interopRequireDefault(require("../../components/oa-component-upload/CustomUpload"));
@@ -17,12 +18,12 @@ var _CustomRadio = _interopRequireDefault(require("../../components/oa-component
17
18
  var _CustomCheckBox = _interopRequireDefault(require("../../components/oa-component-checkbox/CustomCheckBox"));
18
19
  var _CustomSelect = _interopRequireDefault(require("../../components/oa-component-select/CustomSelect"));
19
20
  var _CustomTextArea = _interopRequireDefault(require("../../components/oa-component-textarea/CustomTextArea"));
20
- var _icons = require("@ant-design/icons");
21
21
  var _CustomSteps = _interopRequireDefault(require("../../components/oa-component-steps/CustomSteps"));
22
22
  var _Typography = require("../../components/oa-component-typography/Typography");
23
23
  var _utils = require("../../utils");
24
24
  var _styles = require("./styles");
25
25
  const _excluded = ["data", "data-test", "current", "initialAnswers", "onComplete", "onStepChange", "style", "showSubmitButton"];
26
+ /* eslint-disable */
26
27
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
28
  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); }
28
29
  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; }
@@ -44,7 +45,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
44
45
  function ProgressiveStepsWidget(_ref) {
45
46
  let {
46
47
  data,
47
- 'data-test': dataTest,
48
+ "data-test": dataTest,
48
49
  current: externalCurrent,
49
50
  initialAnswers = {},
50
51
  onComplete,
@@ -105,12 +106,10 @@ function ProgressiveStepsWidget(_ref) {
105
106
  };
106
107
 
107
108
  // Check if all steps are completed (including pre-populated ones)
108
- const isAllStepsCompleted = () => {
109
- return steps.every((step, index) => {
110
- const stepId = step.key || index;
111
- return answers[stepId] !== undefined;
112
- });
113
- };
109
+ const isAllStepsCompleted = () => steps.every((step, index) => {
110
+ const stepId = step.key || index;
111
+ return answers[stepId] !== undefined;
112
+ });
114
113
  const renderAnswerInput = (step, stepIndex) => {
115
114
  const {
116
115
  answerType,
@@ -121,24 +120,24 @@ function ProgressiveStepsWidget(_ref) {
121
120
  const stepId = step.key || stepIndex;
122
121
  const currentAnswer = answers[stepId];
123
122
  switch (answerType) {
124
- case 'singleSelect':
123
+ case "singleSelect":
125
124
  return /*#__PURE__*/_react.default.createElement("div", {
126
125
  style: {
127
- display: 'flex',
128
- gap: '12px',
129
- flexWrap: 'wrap'
126
+ display: "flex",
127
+ gap: "12px",
128
+ flexWrap: "wrap"
130
129
  }
131
130
  }, answerOptions === null || answerOptions === void 0 ? void 0 : answerOptions.map((option, idx) => /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
132
131
  key: idx,
133
- type: currentAnswer === (option.value || option) ? 'primary' : 'secondary',
132
+ type: currentAnswer === (option.value || option) ? "primary" : "secondary",
134
133
  onClick: () => handleAnswer(stepIndex, option.value || option),
135
134
  label: option.label || option,
136
135
  "data-test": dataTest ? "".concat(dataTest, "--button-").concat(stepIndex, "-").concat(idx) : undefined
137
136
  })));
138
- case 'button':
137
+ case "button":
139
138
  return /*#__PURE__*/_react.default.createElement("div", null, answerOptions === null || answerOptions === void 0 ? void 0 : answerOptions.map((option, idx) => /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
140
139
  key: idx,
141
- type: option.type || 'primary',
140
+ type: option.type || "primary",
142
141
  onClick: () => {
143
142
  // Execute custom click function if provided
144
143
  if (option.onClick) {
@@ -150,10 +149,10 @@ function ProgressiveStepsWidget(_ref) {
150
149
  }
151
150
  },
152
151
  label: option.label || option,
153
- size: option.size || 'default',
152
+ size: option.size || "default",
154
153
  "data-test": dataTest ? "".concat(dataTest, "--button-").concat(stepIndex, "-").concat(idx) : undefined
155
154
  })));
156
- case 'custom':
155
+ case "custom":
157
156
  // Render custom component with props for integration
158
157
  if (customComponent) {
159
158
  const CustomComponent = customComponent;
@@ -165,44 +164,44 @@ function ProgressiveStepsWidget(_ref) {
165
164
  }, step.customProps));
166
165
  }
167
166
  return null;
168
- case 'paymentOptions':
167
+ case "paymentOptions":
169
168
  return /*#__PURE__*/_react.default.createElement("div", {
170
169
  style: {
171
- width: '100%'
170
+ width: "100%"
172
171
  }
173
172
  }, answerOptions === null || answerOptions === void 0 ? void 0 : answerOptions.map((option, idx) => /*#__PURE__*/_react.default.createElement("div", {
174
173
  key: idx,
175
174
  style: {
176
- border: '1px solid #d9d9d9',
177
- borderRadius: '8px',
178
- padding: '16px',
179
- marginBottom: '12px',
180
- display: 'flex',
181
- justifyContent: 'space-between',
182
- alignItems: 'center',
183
- backgroundColor: currentAnswer === (option.value || option) ? '#f0f8ff' : 'white',
175
+ border: "1px solid #d9d9d9",
176
+ borderRadius: "8px",
177
+ padding: "16px",
178
+ marginBottom: "12px",
179
+ display: "flex",
180
+ justifyContent: "space-between",
181
+ alignItems: "center",
182
+ backgroundColor: currentAnswer === (option.value || option) ? "#f0f8ff" : "white",
184
183
  // cursor: 'pointer',
185
- transition: 'all 0.3s ease'
184
+ transition: "all 0.3s ease"
186
185
  }
187
186
  // onClick={() => handleAnswer(stepIndex, option.value || option)}
188
187
  ,
189
188
  "data-test": dataTest ? "".concat(dataTest, "--payment-option-").concat(stepIndex, "-").concat(idx) : undefined
190
189
  }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
191
190
  style: {
192
- fontSize: '16px',
193
- fontWeight: '500',
194
- color: currentAnswer === (option.value || option) ? '#1890ff' : '#000'
191
+ fontSize: "16px",
192
+ fontWeight: "500",
193
+ color: currentAnswer === (option.value || option) ? "#1890ff" : "#000"
195
194
  }
196
195
  }, option.label || option), option.description && /*#__PURE__*/_react.default.createElement("div", {
197
196
  style: {
198
- fontSize: '14px',
199
- color: '#666',
200
- marginTop: '4px'
197
+ fontSize: "14px",
198
+ color: "#666",
199
+ marginTop: "4px"
201
200
  }
202
201
  }, option.description)), /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
203
202
  type: "text-only",
204
203
  size: "small",
205
- label: option.detailsText || 'Enter details',
204
+ label: option.detailsText || "Enter details",
206
205
  onClick: e => {
207
206
  e.stopPropagation();
208
207
  if (option.onDetailsClick) {
@@ -210,22 +209,22 @@ function ProgressiveStepsWidget(_ref) {
210
209
  }
211
210
  }
212
211
  }))));
213
- case 'text':
212
+ case "text":
214
213
  return /*#__PURE__*/_react.default.createElement(_CustomInput.default, {
215
- placeholder: placeholder || 'Enter your answer...',
216
- value: currentAnswer || '',
214
+ placeholder: placeholder || "Enter your answer...",
215
+ value: currentAnswer || "",
217
216
  onChange: e => handleAnswer(stepIndex, e.target.value),
218
217
  "data-test": dataTest ? "".concat(dataTest, "--text-input-").concat(stepIndex) : undefined
219
218
  });
220
- case 'textarea':
219
+ case "textarea":
221
220
  return /*#__PURE__*/_react.default.createElement(_CustomTextArea.default, {
222
- placeholder: placeholder || 'Enter your answer...',
223
- value: currentAnswer || '',
221
+ placeholder: placeholder || "Enter your answer...",
222
+ value: currentAnswer || "",
224
223
  onChange: e => handleAnswer(stepIndex, e.target.value),
225
224
  rows: 4,
226
225
  "data-test": dataTest ? "".concat(dataTest, "--textarea-").concat(stepIndex) : undefined
227
226
  });
228
- case 'upload':
227
+ case "upload":
229
228
  return /*#__PURE__*/_react.default.createElement(_CustomUpload.default, {
230
229
  beforeUpload: file => {
231
230
  handleAnswer(stepIndex, file);
@@ -235,11 +234,11 @@ function ProgressiveStepsWidget(_ref) {
235
234
  }, /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
236
235
  iconConfig: {
237
236
  icon: /*#__PURE__*/_react.default.createElement(_icons.UploadOutlined, null),
238
- position: 'left'
237
+ position: "left"
239
238
  },
240
239
  label: "Upload File"
241
240
  }));
242
- case 'radio':
241
+ case "radio":
243
242
  return /*#__PURE__*/_react.default.createElement(_CustomRadio.default.Group, {
244
243
  value: currentAnswer,
245
244
  onChange: e => handleAnswer(stepIndex, e.target.value),
@@ -249,7 +248,7 @@ function ProgressiveStepsWidget(_ref) {
249
248
  value: option.value || option,
250
249
  label: option.label || option
251
250
  })));
252
- case 'checkbox':
251
+ case "checkbox":
253
252
  return /*#__PURE__*/_react.default.createElement(_CustomCheckBox.default.Group, {
254
253
  value: currentAnswer || [],
255
254
  onChange: values => handleAnswer(stepIndex, values),
@@ -259,9 +258,9 @@ function ProgressiveStepsWidget(_ref) {
259
258
  value: option.value || option,
260
259
  label: option.label || option
261
260
  })));
262
- case 'select':
261
+ case "select":
263
262
  return /*#__PURE__*/_react.default.createElement(_CustomSelect.default, {
264
- placeholder: placeholder || 'Select an option...',
263
+ placeholder: placeholder || "Select an option...",
265
264
  value: currentAnswer,
266
265
  onSelectionChange: value => handleAnswer(stepIndex, value.value),
267
266
  options: answerOptions === null || answerOptions === void 0 ? void 0 : answerOptions.map((option, idx) => ({
@@ -276,65 +275,65 @@ function ProgressiveStepsWidget(_ref) {
276
275
  };
277
276
 
278
277
  // Prepare steps data for CustomSteps component
279
- const prepareStepsForCustomSteps = () => {
280
- return steps.map((step, stepIndex) => {
281
- const stepId = step.key || stepIndex;
282
- const isActive = stepIndex === currentStep;
283
- const isCompleted = stepIndex < currentStep && answers[stepId] !== undefined;
284
- const isDisabled = stepIndex > currentStep;
285
- const isVisible = stepIndex < visibleSteps;
286
- const hasAnswer = answers[stepId] !== undefined;
287
- if (!isVisible) return null;
288
-
289
- // Get dynamic content based on answer state
290
- const getDynamicContent = () => {
291
- if (!hasAnswer || !step.dynamicContent) return null;
292
- const dynamicContent = step.dynamicContent;
278
+ const prepareStepsForCustomSteps = () => steps.map((step, stepIndex) => {
279
+ const stepId = step.key || stepIndex;
280
+ const isActive = stepIndex === currentStep;
281
+ const isCompleted = stepIndex < currentStep && answers[stepId] !== undefined;
282
+ const isDisabled = stepIndex > currentStep;
283
+ const isVisible = stepIndex < visibleSteps;
284
+ const hasAnswer = answers[stepId] !== undefined;
285
+ if (!isVisible) return null;
293
286
 
294
- // Check if we should show dynamic content for this answer
295
- const shouldShowDynamic = typeof dynamicContent.showFor === 'function' ? dynamicContent.showFor(answers[stepId]) : dynamicContent.showFor === answers[stepId] || dynamicContent.showFor === true;
296
- if (!shouldShowDynamic) return null;
297
- return {
298
- title: dynamicContent.title || step.title,
299
- description: typeof dynamicContent.description === 'function' ? dynamicContent.description(answers[stepId]) : dynamicContent.description,
300
- descriptionStyle: dynamicContent.descriptionStyle,
301
- hideAnswerInput: dynamicContent.hideAnswerInput || false
302
- };
303
- };
304
- const dynamicContent = getDynamicContent();
305
- const displayTitle = (dynamicContent === null || dynamicContent === void 0 ? void 0 : dynamicContent.title) || step.title;
306
- const displayDescription = (dynamicContent === null || dynamicContent === void 0 ? void 0 : dynamicContent.description) || step.description;
307
- const displayDescriptionStyle = dynamicContent === null || dynamicContent === void 0 ? void 0 : dynamicContent.descriptionStyle;
308
- const shouldHideAnswerInput = (dynamicContent === null || dynamicContent === void 0 ? void 0 : dynamicContent.hideAnswerInput) || false;
287
+ // Get dynamic content based on answer state
288
+ const getDynamicContent = () => {
289
+ if (!hasAnswer || !step.dynamicContent) return null;
290
+ const {
291
+ dynamicContent
292
+ } = step;
309
293
 
310
- // Create the step content with question and answer
311
- const stepContent = /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
312
- style: {
313
- fontSize: '16px',
314
- fontWeight: '500',
315
- color: isActive ? '#1890ff' : isCompleted ? '#52c41a' : isDisabled ? '#d9d9d9' : '#000',
316
- marginBottom: '8px'
317
- }
318
- }, (0, _utils.isString)(displayTitle) || (0, _utils.isNumber)(displayTitle) ? /*#__PURE__*/_react.default.createElement("span", {
319
- "data-test": "".concat(dataTest, "--title-(").concat(displayTitle, ")")
320
- }, displayTitle) : displayTitle), displayDescription && /*#__PURE__*/_react.default.createElement("div", {
321
- style: _objectSpread({
322
- color: '#666',
323
- fontSize: '14px',
324
- marginBottom: '12px'
325
- }, displayDescriptionStyle)
326
- }, displayDescription), (isActive || isCompleted) && !shouldHideAnswerInput && /*#__PURE__*/_react.default.createElement("div", {
327
- style: {
328
- marginTop: '12px'
329
- }
330
- }, renderAnswerInput(step, stepIndex)));
294
+ // Check if we should show dynamic content for this answer
295
+ const shouldShowDynamic = typeof dynamicContent.showFor === "function" ? dynamicContent.showFor(answers[stepId]) : dynamicContent.showFor === answers[stepId] || dynamicContent.showFor === true;
296
+ if (!shouldShowDynamic) return null;
331
297
  return {
332
- key: step.key || stepIndex,
333
- title: stepContent,
334
- disabled: isDisabled
298
+ title: dynamicContent.title || step.title,
299
+ description: typeof dynamicContent.description === "function" ? dynamicContent.description(answers[stepId]) : dynamicContent.description,
300
+ descriptionStyle: dynamicContent.descriptionStyle,
301
+ hideAnswerInput: dynamicContent.hideAnswerInput || false
335
302
  };
336
- }).filter(Boolean); // Remove null entries
337
- };
303
+ };
304
+ const dynamicContent = getDynamicContent();
305
+ const displayTitle = (dynamicContent === null || dynamicContent === void 0 ? void 0 : dynamicContent.title) || step.title;
306
+ const displayDescription = (dynamicContent === null || dynamicContent === void 0 ? void 0 : dynamicContent.description) || step.description;
307
+ const displayDescriptionStyle = dynamicContent === null || dynamicContent === void 0 ? void 0 : dynamicContent.descriptionStyle;
308
+ const shouldHideAnswerInput = (dynamicContent === null || dynamicContent === void 0 ? void 0 : dynamicContent.hideAnswerInput) || false;
309
+
310
+ // Create the step content with question and answer
311
+ const stepContent = /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
312
+ style: {
313
+ fontSize: "16px",
314
+ fontWeight: "500",
315
+ color: isActive ? "#1890ff" : isCompleted ? "#52c41a" : isDisabled ? "#d9d9d9" : "#000",
316
+ marginBottom: "8px"
317
+ }
318
+ }, (0, _utils.isString)(displayTitle) || (0, _utils.isNumber)(displayTitle) ? /*#__PURE__*/_react.default.createElement("span", {
319
+ "data-test": "".concat(dataTest, "--title-(").concat(displayTitle, ")")
320
+ }, displayTitle) : displayTitle), displayDescription && /*#__PURE__*/_react.default.createElement("div", {
321
+ style: _objectSpread({
322
+ color: "#666",
323
+ fontSize: "14px",
324
+ marginBottom: "12px"
325
+ }, displayDescriptionStyle)
326
+ }, displayDescription), (isActive || isCompleted) && !shouldHideAnswerInput && /*#__PURE__*/_react.default.createElement("div", {
327
+ style: {
328
+ marginTop: "12px"
329
+ }
330
+ }, renderAnswerInput(step, stepIndex)));
331
+ return {
332
+ key: step.key || stepIndex,
333
+ title: stepContent,
334
+ disabled: isDisabled
335
+ };
336
+ }).filter(Boolean); // Remove null entries
338
337
  return /*#__PURE__*/_react.default.createElement(_styles.StepsContainer, {
339
338
  style: style
340
339
  }, /*#__PURE__*/_react.default.createElement(_CustomSteps.default, _extends({
@@ -358,7 +357,7 @@ ProgressiveStepsWidget.propTypes = {
358
357
  key: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
359
358
  title: _propTypes.default.node,
360
359
  description: _propTypes.default.node,
361
- answerType: _propTypes.default.oneOf(['singleSelect', 'button', 'paymentOptions', 'text', 'textarea', 'upload', 'radio', 'checkbox', 'select', 'custom']),
360
+ answerType: _propTypes.default.oneOf(["singleSelect", "button", "paymentOptions", "text", "textarea", "upload", "radio", "checkbox", "select", "custom"]),
362
361
  answerOptions: _propTypes.default.array,
363
362
  placeholder: _propTypes.default.string,
364
363
  customComponent: _propTypes.default.elementType,
@@ -372,7 +371,7 @@ ProgressiveStepsWidget.propTypes = {
372
371
  })
373
372
  }))
374
373
  }),
375
- 'data-test': _propTypes.default.string,
374
+ "data-test": _propTypes.default.string,
376
375
  current: _propTypes.default.number,
377
376
  initialAnswers: _propTypes.default.object,
378
377
  onComplete: _propTypes.default.func,
@@ -384,7 +383,7 @@ ProgressiveStepsWidget.defaultProps = {
384
383
  data: {
385
384
  steps: []
386
385
  },
387
- 'data-test': null,
386
+ "data-test": null,
388
387
  current: 0,
389
388
  initialAnswers: {},
390
389
  onComplete: undefined,