@luscii-healthtech/web-ui 2.68.0 → 2.68.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/components/Form/FormRadioGroup.d.ts +1 -1
- package/dist/components/RadioGroup/RadioGroupV2.d.ts +1 -1
- package/dist/web-ui.cjs.development.js +13 -3
- package/dist/web-ui.cjs.development.js.map +1 -1
- package/dist/web-ui.cjs.production.min.js +1 -1
- package/dist/web-ui.cjs.production.min.js.map +1 -1
- package/dist/web-ui.esm.js +14 -4
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -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, "
|
|
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:
|
|
4271
|
+
defaultChecked: defaultChecked,
|
|
4266
4272
|
key: option.value
|
|
4267
4273
|
}, option, registerProps, {
|
|
4268
4274
|
ref: innerRef
|
|
@@ -8303,11 +8309,15 @@ var FormRadioGroup = /*#__PURE__*/React__default.forwardRef(function (_ref, inne
|
|
|
8303
8309
|
var onChange = _ref2.onChange,
|
|
8304
8310
|
value = _ref2.value;
|
|
8305
8311
|
return /*#__PURE__*/React__default.createElement(RadioGroupV2, _extends({}, fieldProps, {
|
|
8312
|
+
options: fieldProps.options.map(function (option) {
|
|
8313
|
+
return _extends({}, option, {
|
|
8314
|
+
checked: value === option.value
|
|
8315
|
+
});
|
|
8316
|
+
}),
|
|
8306
8317
|
isError: hasError(name, fieldErrors),
|
|
8307
8318
|
ref: innerRef,
|
|
8308
8319
|
name: name,
|
|
8309
|
-
onChange: onChange
|
|
8310
|
-
defaultValue: value
|
|
8320
|
+
onChange: onChange
|
|
8311
8321
|
}));
|
|
8312
8322
|
}
|
|
8313
8323
|
}));
|