unifyedx-storybook-new 0.1.56 → 0.1.57

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.
@@ -40985,7 +40985,12 @@ const Select = ({
40985
40985
  const filteredOptions = query === "" ? options : options.filter(
40986
40986
  (option) => option.label.toLowerCase().includes(query.toLowerCase())
40987
40987
  );
40988
- const selectedOption = options.find((option) => option.id === value?.id);
40988
+ const selectedOption = options.find((option) => {
40989
+ if (value?.id) {
40990
+ return option.id === value.id;
40991
+ }
40992
+ return option.id === value || option.value === value;
40993
+ });
40989
40994
  return /* @__PURE__ */ jsx(Listbox, { value, onChange, disabled, children: /* @__PURE__ */ jsxs("div", { className: "select-wrapper", ref, children: [
40990
40995
  label && /* @__PURE__ */ jsx("label", { className: "select-label", children: label }),
40991
40996
  /* @__PURE__ */ jsxs("div", { className: "select-button-container", children: [
@@ -41041,7 +41046,7 @@ const Select = ({
41041
41046
  ) : null
41042
41047
  ] })
41043
41048
  },
41044
- option.id
41049
+ option.id || option.value || option.label
41045
41050
  )) })
41046
41051
  ] })
41047
41052
  }
@@ -75235,6 +75240,16 @@ function TreeView({
75235
75240
  ] });
75236
75241
  }
75237
75242
 
75243
+ const getOptionsFromConfig = (optionsFrom, configData) => {
75244
+ if (!optionsFrom || !configData) return [];
75245
+ const { config, valueField, labelField } = optionsFrom;
75246
+ const configSection = configData[config];
75247
+ if (!configSection || !Array.isArray(configSection)) return [];
75248
+ return configSection.map((item) => ({
75249
+ value: item[valueField],
75250
+ label: item[labelField]
75251
+ }));
75252
+ };
75238
75253
  function SectionRenderer({ item, data: initialData, updateHandler, validationErrors = {} }) {
75239
75254
  console.log(item);
75240
75255
  const [section, setSection] = React__default.useState(item);
@@ -75414,7 +75429,7 @@ function SectionRenderer({ item, data: initialData, updateHandler, validationErr
75414
75429
  const newData = { ...data, [field.key]: value };
75415
75430
  setData(newData);
75416
75431
  },
75417
- options: field.options || [],
75432
+ options: field.optionsFrom ? getOptionsFromConfig(field.optionsFrom, initialData) : field.options || [],
75418
75433
  placeholder: field.placeholder || `Select ${field.label}`,
75419
75434
  required: field.required,
75420
75435
  disabled: field.disabled ? field.disabled : false,