@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.cjs CHANGED
@@ -610,9 +610,9 @@ function buildCheckboxOption(option, values) {
610
610
  }
611
611
  function render(option, showCheckbox, isSelected) {
612
612
  if (typeof option === "string") {
613
- return (jsxRuntime.jsx(material.MenuItem, { value: option, sx: { display: "block" }, children: jsxRuntime.jsxs(material.Stack, { direction: "row", gap: 1, alignItems: "center", children: [showCheckbox && jsxRuntime.jsx(material.Checkbox, { checked: isSelected }), jsxRuntime.jsx(material.Box, { children: jsxRuntime.jsx(material.Typography, { sx: { textWrap: "wrap" }, children: option }) })] }) }, option));
613
+ return (jsxRuntime.jsx(material.MenuItem, { value: option, sx: { display: "block" }, children: jsxRuntime.jsxs(material.Stack, { direction: "row", gap: 1, alignItems: "center", children: [showCheckbox && (jsxRuntime.jsx(material.Checkbox, { checked: isSelected, sx: { padding: 0, marginX: 1 } })), jsxRuntime.jsx(material.Box, { children: jsxRuntime.jsx(material.Typography, { sx: { textWrap: "wrap" }, children: option }) })] }) }, option));
614
614
  }
615
- return (jsxRuntime.jsx(material.MenuItem, { value: option.value, sx: { display: "block" }, disabled: option.disabled, children: jsxRuntime.jsxs(material.Stack, { direction: "row", gap: 1, alignItems: "center", children: [showCheckbox && jsxRuntime.jsx(material.Checkbox, { checked: isSelected }), jsxRuntime.jsxs(material.Box, { children: [jsxRuntime.jsx(material.Typography, { fontWeight: option.subText ? "bold" : undefined, sx: { textWrap: "wrap" }, children: option.text }), option.subText && (jsxRuntime.jsx(material.Box, { children: jsxRuntime.jsx(material.Typography, { variant: "body2", sx: { textWrap: "wrap" }, children: option.subText }) }))] })] }) }, option.value));
615
+ return (jsxRuntime.jsx(material.MenuItem, { value: option.value, sx: { display: "block" }, disabled: option.disabled, children: jsxRuntime.jsxs(material.Stack, { direction: "row", gap: 1, alignItems: "center", children: [showCheckbox && (jsxRuntime.jsx(material.Checkbox, { checked: isSelected, sx: { padding: 0, marginX: 1 } })), jsxRuntime.jsxs(material.Box, { children: [jsxRuntime.jsx(material.Typography, { fontWeight: option.subText ? "bold" : undefined, sx: { textWrap: "wrap" }, children: option.text }), option.subText && (jsxRuntime.jsx(material.Box, { children: jsxRuntime.jsx(material.Typography, { variant: "body2", sx: { textWrap: "wrap" }, children: option.subText }) }))] })] }) }, option.value));
616
616
  }
617
617
 
618
618
  function SelectFormField(_a) {
@@ -703,9 +703,9 @@ var CheckboxFormField = function (_a) {
703
703
 
704
704
  var DateFormField = function (_a) {
705
705
  var _b;
706
- 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;
707
- var _d = reactFinalForm.useField(name, __assign({ format: format, validate: required
708
- ? 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;
706
+ 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;
707
+ var _e = reactFinalForm.useField(name, __assign({ format: format, validate: required
708
+ ? 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;
709
709
  var datePickerProps = deepmerge({
710
710
  label: label,
711
711
  disabled: disabled,
@@ -722,7 +722,9 @@ var DateFormField = function (_a) {
722
722
  },
723
723
  },
724
724
  }, (_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.datePicker) !== null && _b !== void 0 ? _b : {});
725
- return (jsxRuntime.jsx(FieldWrapper, { icon: icon, showSpace: showSpace, children: jsxRuntime.jsx(xDatePickers.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)) }));
725
+ return (jsxRuntime.jsx(FieldWrapper, { icon: icon, showSpace: showSpace, children: jsxRuntime.jsx(xDatePickers.DatePicker, __assign({ value: input.value ? dayjs(input.value) : null, onChange: function (value) {
726
+ 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());
727
+ } }, datePickerProps)) }));
726
728
  };
727
729
 
728
730
  var DateTimeFormField = function (_a) {