@torq-north/react-tools 1.4.0 → 1.4.2

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.
package/dist/index.es.js CHANGED
@@ -608,9 +608,9 @@ function buildCheckboxOption(option, values) {
608
608
  }
609
609
  function render(option, showCheckbox, isSelected) {
610
610
  if (typeof option === "string") {
611
- return (jsx(MenuItem, { value: option, sx: { display: "block" }, children: jsxs(Stack, { direction: "row", gap: 1, alignItems: "center", children: [showCheckbox && jsx(Checkbox, { checked: isSelected }), jsx(Box, { children: jsx(Typography, { sx: { textWrap: "wrap" }, children: option }) })] }) }, option));
611
+ return (jsx(MenuItem, { value: option, sx: { display: "block" }, children: jsxs(Stack, { direction: "row", gap: 1, alignItems: "center", children: [showCheckbox && (jsx(Checkbox, { checked: isSelected, sx: { padding: 0, marginX: 1 } })), jsx(Box, { children: jsx(Typography, { sx: { textWrap: "wrap" }, children: option }) })] }) }, option));
612
612
  }
613
- return (jsx(MenuItem, { value: option.value, sx: { display: "block" }, disabled: option.disabled, children: jsxs(Stack, { direction: "row", gap: 1, alignItems: "center", children: [showCheckbox && jsx(Checkbox, { checked: isSelected }), jsxs(Box, { children: [jsx(Typography, { fontWeight: option.subText ? "bold" : undefined, sx: { textWrap: "wrap" }, children: option.text }), option.subText && (jsx(Box, { children: jsx(Typography, { variant: "body2", sx: { textWrap: "wrap" }, children: option.subText }) }))] })] }) }, option.value));
613
+ return (jsx(MenuItem, { value: option.value, sx: { display: "block" }, disabled: option.disabled, children: jsxs(Stack, { direction: "row", gap: 1, alignItems: "center", children: [showCheckbox && (jsx(Checkbox, { checked: isSelected, sx: { padding: 0, marginX: 1 } })), jsxs(Box, { children: [jsx(Typography, { fontWeight: option.subText ? "bold" : undefined, sx: { textWrap: "wrap" }, children: option.text }), option.subText && (jsx(Box, { children: jsx(Typography, { variant: "body2", sx: { textWrap: "wrap" }, children: option.subText }) }))] })] }) }, option.value));
614
614
  }
615
615
 
616
616
  function SelectFormField(_a) {
@@ -643,7 +643,10 @@ function findTextFor(value, options) {
643
643
  for (var _i = 0, options_1 = options; _i < options_1.length; _i++) {
644
644
  var option = options_1[_i];
645
645
  if (isGroup(option)) {
646
- return findTextFor(value, option.options);
646
+ var foundOption = findTextFor(value, option.options);
647
+ if (foundOption) {
648
+ return foundOption;
649
+ }
647
650
  }
648
651
  else if (typeof option === "string") {
649
652
  if (option === value) {
@@ -656,7 +659,6 @@ function findTextFor(value, options) {
656
659
  }
657
660
  }
658
661
  }
659
- return "Unknown";
660
662
  }
661
663
  function MultiSelectFormField(_a) {
662
664
  var _b, _c;
@@ -678,7 +680,9 @@ function MultiSelectFormField(_a) {
678
680
  select: {
679
681
  endAdornment: isClearable ? (jsx(Box, { pr: 2, children: jsx(IconButton, { size: (_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.textField) === null || _b === void 0 ? void 0 : _b.size, onClick: function () { return onChange([]); }, children: jsx(CloseIcon, { fontSize: "inherit" }) }) })) : undefined,
680
682
  multiple: true,
681
- renderValue: function (selected) { return (jsx(Box, { whiteSpace: "normal", children: selected.map(function (s) { return findTextFor(s, options); }).join(", ") })); },
683
+ renderValue: function (selected) { return (jsx(Box, { whiteSpace: "normal", children: selected
684
+ .map(function (s) { var _a; return (_a = findTextFor(s, options)) !== null && _a !== void 0 ? _a : "Unknown"; })
685
+ .join(", ") })); },
682
686
  },
683
687
  },
684
688
  }, (_c = slotProps === null || slotProps === void 0 ? void 0 : slotProps.textField) !== null && _c !== void 0 ? _c : {});