@luscii-healthtech/web-ui 2.68.0 → 2.69.0

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.
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { Control, RegisterOptions } from "react-hook-form/dist/index.ie11";
3
3
  import { RadioGroupProps } from "../RadioGroup/RadioGroupV2";
4
4
  import { FormFieldLabelerWithFormProps } from "./form.types";
5
- interface FormRadioGroupProps extends Omit<RadioGroupProps, "name">, FormFieldLabelerWithFormProps {
5
+ interface FormRadioGroupProps extends Omit<RadioGroupProps, "isError">, FormFieldLabelerWithFormProps {
6
6
  control: Control;
7
7
  rules?: Exclude<RegisterOptions, "valueAsNumber" | "valueAsDate" | "setValueAs">;
8
8
  }
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { RadioProps } from "../Radio/RadioV2";
3
- export interface RadioGroupProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "value"> {
3
+ export interface RadioGroupProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "name" | "value" | "checked"> {
4
4
  name: string;
5
5
  isError?: boolean;
6
6
  options: Omit<RadioProps, "name">[];
@@ -4261,8 +4261,14 @@ function RadioGroupInner(_ref) {
4261
4261
  }, title && /*#__PURE__*/React__default.createElement(Text, {
4262
4262
  text: title
4263
4263
  }), options.map(function (option) {
4264
+ var defaultChecked;
4265
+
4266
+ if (!lodash.isNil(defaultValue)) {
4267
+ defaultChecked = defaultValue === option.value;
4268
+ }
4269
+
4264
4270
  return /*#__PURE__*/React__default.createElement(RadioV2, _extends({
4265
- defaultChecked: option.value === defaultValue,
4271
+ defaultChecked: defaultChecked,
4266
4272
  key: option.value
4267
4273
  }, option, registerProps, {
4268
4274
  ref: innerRef
@@ -6890,8 +6896,7 @@ var CRUDPage = function CRUDPage(_ref) {
6890
6896
  currentStep: steps.currentStep,
6891
6897
  localization: steps.localization
6892
6898
  }), children, /*#__PURE__*/React__default.createElement(Line, {
6893
- left: [cancelButton],
6894
- right: [submitButton],
6899
+ left: [submitButton, cancelButton],
6895
6900
  className: classNames("cweb-crud-page-button-line", "border-t border-solid border-color-divider pt-4 mt-4")
6896
6901
  }))));
6897
6902
  };
@@ -8303,11 +8308,15 @@ var FormRadioGroup = /*#__PURE__*/React__default.forwardRef(function (_ref, inne
8303
8308
  var onChange = _ref2.onChange,
8304
8309
  value = _ref2.value;
8305
8310
  return /*#__PURE__*/React__default.createElement(RadioGroupV2, _extends({}, fieldProps, {
8311
+ options: fieldProps.options.map(function (option) {
8312
+ return _extends({}, option, {
8313
+ checked: value === option.value
8314
+ });
8315
+ }),
8306
8316
  isError: hasError(name, fieldErrors),
8307
8317
  ref: innerRef,
8308
8318
  name: name,
8309
- onChange: onChange,
8310
- defaultValue: value
8319
+ onChange: onChange
8311
8320
  }));
8312
8321
  }
8313
8322
  }));