umwd-components 0.1.773 → 0.1.775

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.
@@ -54,7 +54,12 @@ sx, multiple = true, onChangeCallback, }) => {
54
54
  return (jsxs(Box, { sx: [
55
55
  // You cannot spread `sx` directly because `SxProps` (typeof sx) can be an array.
56
56
  ...(Array.isArray(sx) ? sx : [sx]),
57
- ], children: [jsx(Autocomplete, { multiple: multiple, options: categories, getOptionLabel: (option) => option.title, filterSelectedOptions: true, onChange: handleCategoryChange, renderInput: (params) => jsx(TextField, { ...params, label: "Category" }), value: categories.filter((category) => selectedValues.includes(category.documentId)) }), jsx("input", { type: "hidden", name: name, value: JSON.stringify(selectedValues) || "" })] }));
57
+ ], children: [jsx(Autocomplete, { multiple: multiple, options: categories, getOptionLabel: (option) => {
58
+ return option?.title || "";
59
+ }, filterSelectedOptions: true, onChange: handleCategoryChange, renderInput: (params) => jsx(TextField, { ...params, label: "Category" }), value: multiple
60
+ ? categories.filter((category) => selectedValues.includes(category.documentId))
61
+ : // If not multiple, we return the first matching category
62
+ categories.filter((category) => selectedValues.includes(category.documentId))[0] || "" }), jsx("input", { type: "hidden", name: name, value: JSON.stringify(selectedValues) || "" })] }));
58
63
  };
59
64
 
60
65
  export { CategorySelector as default };
@@ -55,8 +55,11 @@ sx, multiple = true, onChangeCallback, }) => {
55
55
  // You cannot spread `sx` directly because `SxProps` (typeof sx) can be an array.
56
56
  ...(Array.isArray(sx) ? sx : [sx]),
57
57
  ], children: [jsx(Autocomplete, { multiple: multiple, options: productNames, getOptionLabel: (option) => {
58
- return `${option.product_number} | ${option.title}`;
59
- }, filterSelectedOptions: true, onChange: handleProductChange, renderInput: (params) => jsx(TextField, { ...params, label: "Products" }), value: productNames.filter((productName) => selectedValues.includes(productName.documentId)) }), jsx("input", { type: "hidden", name: name, value: JSON.stringify(selectedValues) })] }));
58
+ return `${option?.product_number || "Unknown Product"} | ${option?.title || "Untitled Product"}`;
59
+ }, filterSelectedOptions: true, onChange: handleProductChange, renderInput: (params) => jsx(TextField, { ...params, label: "Products" }), value: multiple
60
+ ? productNames.filter((productName) => selectedValues.includes(productName.documentId))
61
+ : // If not multiple, we return the first matching product
62
+ productNames.filter((productName) => selectedValues.includes(productName.documentId))[0] || "" }), jsx("input", { type: "hidden", name: name, value: JSON.stringify(selectedValues) })] }));
60
63
  };
61
64
 
62
65
  export { ProductSelector as default };