pesona-ui 1.0.12 → 1.0.14

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.esm.js CHANGED
@@ -8495,12 +8495,21 @@ const Radio = React.forwardRef(({ name, label, options, error, ...rest }, ref) =
8495
8495
  });
8496
8496
 
8497
8497
  const RadioButtonGroup = React.forwardRef(({ name, label, size = 'md', options, selectedValue, error, required, ...rest }, ref) => {
8498
+ const [stringSelectedValue, setStringSelectedValue] = React.useState(selectedValue || '');
8499
+ // Update the state when selectedValue changes
8500
+ React.useEffect(() => {
8501
+ if (selectedValue !== undefined) {
8502
+ // Convert selectedValue to string if it's a boolean
8503
+ const valueAsString = typeof selectedValue === 'boolean' ? (selectedValue ? 'true' : 'false') : selectedValue.toString();
8504
+ setStringSelectedValue(valueAsString);
8505
+ }
8506
+ }, [selectedValue]);
8498
8507
  return (React.createElement(React.Fragment, null,
8499
8508
  label && (React.createElement("label", { htmlFor: name },
8500
8509
  label,
8501
8510
  " ",
8502
8511
  required && React.createElement("span", { className: "text-danger" }, "*"))),
8503
- React.createElement("div", { className: "btn-group", "data-toggle": "buttons" }, options.map((option) => (React.createElement("label", { key: option.value, className: `btn auto btn-default btn-${size} ${option.value === selectedValue ? 'active' : ''}` },
8512
+ React.createElement("div", { className: "btn-group", "data-toggle": "buttons" }, options.map((option) => (React.createElement("label", { key: option.value, className: `btn auto btn-default btn-${size} ${option.value === stringSelectedValue ? 'active' : ''}` },
8504
8513
  React.createElement("input", { type: "radio", id: option.value.toString(), name: name, value: option.value, ref: ref, ...rest }),
8505
8514
  React.createElement("span", null, option.label))))),
8506
8515
  error !== undefined && React.createElement("small", { className: "form-message" }, error)));