@torq-north/react-tools 1.3.0 → 1.4.1

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) {
@@ -701,9 +701,9 @@ var CheckboxFormField = function (_a) {
701
701
 
702
702
  var DateFormField = function (_a) {
703
703
  var _b;
704
- var name = _a.name, label = _a.label, required = _a.required, icon = _a.icon, showSpace = _a.showSpace, slotProps = _a.slotProps, disabled = _a.disabled, helperText = _a.helperText, format = _a.format, _c = _a.validators, validators = _c === void 0 ? [] : _c;
705
- var _d = useField(name, __assign({ format: format, validate: required
706
- ? composeValidators.apply(void 0, __spreadArray(__spreadArray([], validators, false), [isRequired], false)) : composeValidators.apply(void 0, validators) }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.field)), input = _d.input, meta = _d.meta;
704
+ var name = _a.name, label = _a.label, required = _a.required, icon = _a.icon, showSpace = _a.showSpace, slotProps = _a.slotProps, disabled = _a.disabled, helperText = _a.helperText, format = _a.format, _c = _a.validators, validators = _c === void 0 ? [] : _c, _d = _a.formatAsDate, formatAsDate = _d === void 0 ? false : _d;
705
+ var _e = useField(name, __assign({ format: format, validate: required
706
+ ? composeValidators.apply(void 0, __spreadArray(__spreadArray([], validators, false), [isRequired], false)) : composeValidators.apply(void 0, validators) }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.field)), input = _e.input, meta = _e.meta;
707
707
  var datePickerProps = deepmerge({
708
708
  label: label,
709
709
  disabled: disabled,
@@ -720,7 +720,9 @@ var DateFormField = function (_a) {
720
720
  },
721
721
  },
722
722
  }, (_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.datePicker) !== null && _b !== void 0 ? _b : {});
723
- return (jsx(FieldWrapper, { icon: icon, showSpace: showSpace, children: jsx(DatePicker, __assign({ value: input.value ? dayjs(input.value) : null, onChange: function (value) { return input.onChange(value === null || value === void 0 ? void 0 : value.toJSON()); } }, datePickerProps)) }));
723
+ return (jsx(FieldWrapper, { icon: icon, showSpace: showSpace, children: jsx(DatePicker, __assign({ value: input.value ? dayjs(input.value) : null, onChange: function (value) {
724
+ return input.onChange(formatAsDate ? value === null || value === void 0 ? void 0 : value.format("YYYY-MM-DD") : value === null || value === void 0 ? void 0 : value.toJSON());
725
+ } }, datePickerProps)) }));
724
726
  };
725
727
 
726
728
  var DateTimeFormField = function (_a) {