@wix/form-public 0.489.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.cjs CHANGED
@@ -59673,7 +59673,7 @@ ProductList.Option = ProductOption;
59673
59673
  ProductList.Description = Description;
59674
59674
  ProductList.Error = Error2;
59675
59675
  var RatingInput = ({ children }) => {
59676
- const { id: id6, value, onChange, disabled, required, hasError, onBlur, onFocus, FieldLayout } = useFieldPropsV2();
59676
+ const { id: id6, value, onChange, disabled, readOnly, required, hasError, onBlur, onFocus, FieldLayout } = useFieldPropsV2();
59677
59677
  const { labelId } = useFieldAttributes();
59678
59678
  const handleChange = React171.useCallback((selectedValue) => onChange(Number(selectedValue)), [
59679
59679
  onChange
@@ -59690,6 +59690,7 @@ var RatingInput = ({ children }) => {
59690
59690
  value: value ? String(value) : void 0,
59691
59691
  onChange: handleChange,
59692
59692
  isDisabled: disabled,
59693
+ isReadOnly: readOnly,
59693
59694
  isRequired: required,
59694
59695
  isInvalid: hasError,
59695
59696
  onBlur,
@@ -59700,7 +59701,7 @@ var RatingInput = ({ children }) => {
59700
59701
  });
59701
59702
  };
59702
59703
  var Ratings = ({ children, className, getReactionLabel }) => {
59703
- const { value, hasError } = useFieldPropsV2();
59704
+ const { value, readOnly, hasError } = useFieldPropsV2();
59704
59705
  const { inputId, ariaDescribedBy } = useFieldAttributes();
59705
59706
  const [hovered, setHovered] = React171.useState();
59706
59707
  const containerRef = React171.useRef(null);
@@ -59712,13 +59713,14 @@ var Ratings = ({ children, className, getReactionLabel }) => {
59712
59713
  "4",
59713
59714
  "5"
59714
59715
  ];
59715
- const isSelected = (ratingValue) => hovered ? hovered >= ratingValue : !!value && value >= Number(ratingValue);
59716
+ const isSelected = (ratingValue) => hovered && !readOnly ? hovered >= ratingValue : !!value && value >= Number(ratingValue);
59716
59717
  return /* @__PURE__ */ React171__default.default.createElement("div", {
59717
59718
  ref: containerRef,
59718
59719
  id: inputId,
59719
59720
  "aria-describedby": ariaDescribedBy,
59720
59721
  className,
59721
- "data-invalid": hasError
59722
+ "data-invalid": hasError,
59723
+ "data-readonly": readOnly
59722
59724
  }, ratingValues.map((ratingValue) => applyInternalProps(ratingElement, {
59723
59725
  key: ratingValue,
59724
59726
  value: ratingValue,
@@ -59740,10 +59742,13 @@ var visuallyHiddenStyle = {
59740
59742
  };
59741
59743
  var Rating = ({ className, children, ...internal }) => {
59742
59744
  const { value, isSelected, onHoverChange, label } = internal;
59745
+ const resolvedClassName = typeof className === "function" ? className({
59746
+ isSelected
59747
+ }) : className;
59743
59748
  return /* @__PURE__ */ React171__default.default.createElement(reactAriaComponents.RadioField, {
59744
59749
  value
59745
59750
  }, /* @__PURE__ */ React171__default.default.createElement(reactAriaComponents.RadioButton, {
59746
- className,
59751
+ className: resolvedClassName,
59747
59752
  "data-active": isSelected || void 0,
59748
59753
  onHoverChange
59749
59754
  }, typeof children === "function" ? children({