@wix/form-public 0.490.0 → 0.491.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.
package/dist/index.js CHANGED
@@ -59663,7 +59663,7 @@ ProductList.Option = ProductOption;
59663
59663
  ProductList.Description = Description;
59664
59664
  ProductList.Error = Error2;
59665
59665
  var RatingInput = ({ children }) => {
59666
- const { id: id6, value, onChange, disabled, required, hasError, onBlur, onFocus, FieldLayout } = useFieldPropsV2();
59666
+ const { id: id6, value, onChange, disabled, readOnly, required, hasError, onBlur, onFocus, FieldLayout } = useFieldPropsV2();
59667
59667
  const { labelId } = useFieldAttributes();
59668
59668
  const handleChange = useCallback((selectedValue) => onChange(Number(selectedValue)), [
59669
59669
  onChange
@@ -59680,6 +59680,7 @@ var RatingInput = ({ children }) => {
59680
59680
  value: value ? String(value) : void 0,
59681
59681
  onChange: handleChange,
59682
59682
  isDisabled: disabled,
59683
+ isReadOnly: readOnly,
59683
59684
  isRequired: required,
59684
59685
  isInvalid: hasError,
59685
59686
  onBlur,
@@ -59690,7 +59691,7 @@ var RatingInput = ({ children }) => {
59690
59691
  });
59691
59692
  };
59692
59693
  var Ratings = ({ children, className, getReactionLabel }) => {
59693
- const { value, hasError } = useFieldPropsV2();
59694
+ const { value, readOnly, hasError } = useFieldPropsV2();
59694
59695
  const { inputId, ariaDescribedBy } = useFieldAttributes();
59695
59696
  const [hovered, setHovered] = useState();
59696
59697
  const containerRef = useRef(null);
@@ -59702,13 +59703,14 @@ var Ratings = ({ children, className, getReactionLabel }) => {
59702
59703
  "4",
59703
59704
  "5"
59704
59705
  ];
59705
- const isSelected = (ratingValue) => hovered ? hovered >= ratingValue : !!value && value >= Number(ratingValue);
59706
+ const isSelected = (ratingValue) => hovered && !readOnly ? hovered >= ratingValue : !!value && value >= Number(ratingValue);
59706
59707
  return /* @__PURE__ */ React171.createElement("div", {
59707
59708
  ref: containerRef,
59708
59709
  id: inputId,
59709
59710
  "aria-describedby": ariaDescribedBy,
59710
59711
  className,
59711
- "data-invalid": hasError
59712
+ "data-invalid": hasError,
59713
+ "data-readonly": readOnly
59712
59714
  }, ratingValues.map((ratingValue) => applyInternalProps(ratingElement, {
59713
59715
  key: ratingValue,
59714
59716
  value: ratingValue,
@@ -59730,10 +59732,13 @@ var visuallyHiddenStyle = {
59730
59732
  };
59731
59733
  var Rating = ({ className, children, ...internal }) => {
59732
59734
  const { value, isSelected, onHoverChange, label } = internal;
59735
+ const resolvedClassName = typeof className === "function" ? className({
59736
+ isSelected
59737
+ }) : className;
59733
59738
  return /* @__PURE__ */ React171.createElement(RadioField, {
59734
59739
  value
59735
59740
  }, /* @__PURE__ */ React171.createElement(RadioButton, {
59736
- className,
59741
+ className: resolvedClassName,
59737
59742
  "data-active": isSelected || void 0,
59738
59743
  onHoverChange
59739
59744
  }, typeof children === "function" ? children({