pesona-ui 1.0.14 → 1.0.15

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