@wix/form-public 0.541.0 → 0.543.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
@@ -55803,6 +55803,8 @@ var Dropdown = ({ children }) => {
55803
55803
  const [container, setContainer] = React172.useState(null);
55804
55804
  const selectedValue = value && options.some((option2) => (option2.value ?? option2.label) === value) ? value : defaultValue || null;
55805
55805
  const { labelId } = useFieldAttributes();
55806
+ const { t } = useTranslation2();
55807
+ const requiredLabelId = `${labelId}-required`;
55806
55808
  const handleChange = React172.useCallback((selectedValue2) => {
55807
55809
  if (!readOnly) {
55808
55810
  onChange(typeof selectedValue2 === "string" ? selectedValue2 : null);
@@ -55828,10 +55830,12 @@ var Dropdown = ({ children }) => {
55828
55830
  style: {
55829
55831
  display: "contents"
55830
55832
  }
55831
- }), /* @__PURE__ */ React172__default.default.createElement($72abaeab4d80592f$export$78efe591171d7d45, {
55833
+ }), required ? /* @__PURE__ */ React172__default.default.createElement(reactAriaComponents.VisuallyHidden, {
55834
+ id: requiredLabelId
55835
+ }, t("settings.required-indicator-text")) : null, /* @__PURE__ */ React172__default.default.createElement($72abaeab4d80592f$export$78efe591171d7d45, {
55832
55836
  getContainer: () => container
55833
55837
  }, /* @__PURE__ */ React172__default.default.createElement(reactAriaComponents.Select, {
55834
- "aria-labelledby": labelId,
55838
+ "aria-labelledby": required ? `${labelId} ${requiredLabelId}` : labelId,
55835
55839
  value: selectedValue,
55836
55840
  isOpen: isForcedOpen || isOpen && !disabled && !readOnly,
55837
55841
  onOpenChange: isForcedOpen ? void 0 : handleOpenChange,
@@ -55919,12 +55923,19 @@ var useInvokeCallback = (callback) => {
55919
55923
  // ../form-fields/dist/esm/ui/events-repeater/events-repeater-headless.js
55920
55924
  var NO_ERRORS2 = [];
55921
55925
  var NO_VALUES = {};
55922
- var GuestCount = ({ children, ...internal }) => {
55926
+ var EventsRepeaterLabel = ({ className }) => {
55927
+ return /* @__PURE__ */ React172__default.default.createElement(Label, {
55928
+ className
55929
+ }, null);
55930
+ };
55931
+ var GuestCount = ({ children, className, ...internal }) => {
55923
55932
  const { guestLimit, guestCount, onGuestCountChange } = internal;
55924
55933
  const { label, disabled, readOnly, onBlur, onFocus } = useFieldPropsV2();
55925
55934
  const invokeBlur = useInvokeCallback(onBlur);
55935
+ const labelElement = findChildOfType(children, GuestCount.Label);
55926
55936
  const controlElement = findChildOfType(children, GuestCount.Control);
55927
55937
  return /* @__PURE__ */ React172__default.default.createElement(reactAriaComponents.NumberField, {
55938
+ className,
55928
55939
  "aria-label": label,
55929
55940
  value: guestCount,
55930
55941
  onChange: onGuestCountChange,
@@ -55935,7 +55946,7 @@ var GuestCount = ({ children, ...internal }) => {
55935
55946
  isReadOnly: readOnly,
55936
55947
  onBlur: invokeBlur,
55937
55948
  onFocus
55938
- }, controlElement);
55949
+ }, labelElement, controlElement);
55939
55950
  };
55940
55951
  var GuestCountControl = ({ children, className }) => {
55941
55952
  const { disabled, readOnly } = useFieldPropsV2();
@@ -56075,6 +56086,7 @@ var Guest = ({ className, ...internal }) => {
56075
56086
  fieldActions
56076
56087
  }));
56077
56088
  };
56089
+ GuestCount.Label = EventsRepeaterLabel;
56078
56090
  GuestCount.Control = GuestCountControl;
56079
56091
  GuestCount.Input = GuestCountInput;
56080
56092
  GuestCount.Decrement = GuestCountDecrement;