unifyedx-storybook-new 0.1.45 → 0.1.47

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.
@@ -75240,6 +75240,31 @@ function SectionRenderer({ item, data: initialData, updateHandler, validationErr
75240
75240
  updateHandler(section.key, data);
75241
75241
  }
75242
75242
  }, [section.key, data, updateHandler]);
75243
+ const shouldShowField = (field) => {
75244
+ if (!field.dependsOn) return true;
75245
+ const { field: dependentField, value: requiredValue, operator = "equals" } = field.dependsOn;
75246
+ const dependentValue = data[dependentField];
75247
+ switch (operator) {
75248
+ case "equals":
75249
+ return dependentValue === requiredValue;
75250
+ case "notEquals":
75251
+ return dependentValue !== requiredValue;
75252
+ case "contains":
75253
+ return Array.isArray(dependentValue) && dependentValue.includes(requiredValue);
75254
+ case "notContains":
75255
+ return !Array.isArray(dependentValue) || !dependentValue.includes(requiredValue);
75256
+ case "greaterThan":
75257
+ return Number(dependentValue) > Number(requiredValue);
75258
+ case "lessThan":
75259
+ return Number(dependentValue) < Number(requiredValue);
75260
+ case "isEmpty":
75261
+ return !dependentValue || Array.isArray(dependentValue) && dependentValue.length === 0;
75262
+ case "isNotEmpty":
75263
+ return dependentValue && (!Array.isArray(dependentValue) || dependentValue.length > 0);
75264
+ default:
75265
+ return true;
75266
+ }
75267
+ };
75243
75268
  return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { style: { marginBottom: "20px" }, children: [
75244
75269
  /* @__PURE__ */ jsx(
75245
75270
  "h2",
@@ -75253,7 +75278,7 @@ function SectionRenderer({ item, data: initialData, updateHandler, validationErr
75253
75278
  }
75254
75279
  ),
75255
75280
  /* @__PURE__ */ jsx("p", { style: { fontSize: "14px", marginBottom: "10px" }, children: section.description }),
75256
- /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: section.fields.map((field, idx) => /* @__PURE__ */ jsxs("div", { style: { marginBottom: "10px" }, children: [
75281
+ /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: section.fields.map((field, idx) => shouldShowField(field) && /* @__PURE__ */ jsxs("div", { style: { marginBottom: "10px" }, children: [
75257
75282
  /* @__PURE__ */ jsxs(
75258
75283
  "label",
75259
75284
  {
@@ -75541,6 +75566,33 @@ function SectionRenderer({ item, data: initialData, updateHandler, validationErr
75541
75566
  ),
75542
75567
  validationErrors[section.key]?.[field.key] && /* @__PURE__ */ jsx("div", { style: { color: "#ef4444", fontSize: "12px", marginTop: "2px" }, children: validationErrors[section.key][field.key] })
75543
75568
  ] }),
75569
+ field.fieldtype === "native-radio" && /* @__PURE__ */ jsxs("div", { className: "native-radiogroup-container", children: [
75570
+ (field.options || []).map((option) => /* @__PURE__ */ jsxs("div", { className: "native-radio-option", children: [
75571
+ /* @__PURE__ */ jsx(
75572
+ "input",
75573
+ {
75574
+ type: "radio",
75575
+ id: `${field.key}-${option.value}`,
75576
+ name: field.key,
75577
+ value: option.value,
75578
+ checked: data[field.key] === option.value,
75579
+ onChange: (e) => {
75580
+ const newData = { ...data, [field.key]: e.target.value };
75581
+ setData(newData);
75582
+ if (updateHandler) {
75583
+ updateHandler(section.key, newData);
75584
+ }
75585
+ },
75586
+ disabled: field.disabled
75587
+ }
75588
+ ),
75589
+ /* @__PURE__ */ jsxs("label", { htmlFor: `${field.key}-${option.value}`, children: [
75590
+ /* @__PURE__ */ jsx("span", { className: "native-radio-label", children: option.label }),
75591
+ option.description && /* @__PURE__ */ jsx("span", { className: "native-radio-description", children: option.description })
75592
+ ] })
75593
+ ] }, option.value)),
75594
+ validationErrors[section.key]?.[field.key] && /* @__PURE__ */ jsx("div", { style: { color: "#ef4444", fontSize: "12px", marginTop: "2px" }, children: validationErrors[section.key][field.key] })
75595
+ ] }),
75544
75596
  field.fieldtype === "search" && /* @__PURE__ */ jsxs("div", { children: [
75545
75597
  /* @__PURE__ */ jsx(
75546
75598
  SearchBar,