@wix/form-public 0.121.0 → 0.122.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
@@ -39417,20 +39417,33 @@ var CountryButton = (_ref3) => {
39417
39417
  } = _ref3;
39418
39418
  const {
39419
39419
  inputId,
39420
- ariaDescribedBy
39420
+ labelId
39421
39421
  } = useFieldAttributes2();
39422
39422
  const {
39423
39423
  id
39424
39424
  } = useFieldPropsV2();
39425
+ const {
39426
+ t
39427
+ } = useTranslation();
39428
+ const {
39429
+ selectedCountryCode,
39430
+ countries
39431
+ } = usePhoneInputContext();
39432
+ const buttonId = `${inputId}-country`;
39425
39433
  const ref = React44.useRef(null);
39426
39434
  useFocusFieldEvent(() => {
39427
39435
  var _ref$current;
39428
39436
  (_ref$current = ref.current) == null || _ref$current.focus();
39429
39437
  }, id);
39438
+ const selectedCountry = selectedCountryCode ? countries.find((c) => c.shortCountryCode === selectedCountryCode) : void 0;
39439
+ const dialingCode = selectedCountry ? getCallingCode2(selectedCountry.longCountryCode) || "" : "";
39440
+ const countryCodeLabel = t("field.phone.country-code.aria-label");
39441
+ const ariaLabel = selectedCountry ? `${countryCodeLabel}, ${selectedCountry.countryName}, ${dialingCode}` : countryCodeLabel;
39430
39442
  return /* @__PURE__ */ React44__namespace.default.createElement(reactAriaComponents.Button, {
39431
39443
  ref,
39432
- id: `${inputId}-country`,
39433
- "aria-describedby": ariaDescribedBy,
39444
+ id: buttonId,
39445
+ "aria-label": ariaLabel,
39446
+ "aria-labelledby": labelId ? `${labelId} ${buttonId}` : void 0,
39434
39447
  className
39435
39448
  }, children);
39436
39449
  };
@@ -39560,6 +39573,9 @@ var PhoneNumber2 = (_ref1) => {
39560
39573
  let {
39561
39574
  className
39562
39575
  } = _ref1;
39576
+ const {
39577
+ t
39578
+ } = useTranslation();
39563
39579
  const {
39564
39580
  inputId,
39565
39581
  ariaDescribedBy
@@ -39570,7 +39586,9 @@ var PhoneNumber2 = (_ref1) => {
39570
39586
  disabled,
39571
39587
  required,
39572
39588
  onBlur,
39573
- onFocus
39589
+ onFocus,
39590
+ label,
39591
+ hasError
39574
39592
  } = useFieldPropsV2();
39575
39593
  const {
39576
39594
  currentValue,
@@ -39591,7 +39609,9 @@ var PhoneNumber2 = (_ref1) => {
39591
39609
  required,
39592
39610
  onBlur,
39593
39611
  onFocus,
39612
+ "aria-label": `${label}. ${t("field.phone.aria-label")}`,
39594
39613
  "aria-describedby": ariaDescribedBy,
39614
+ "aria-invalid": hasError,
39595
39615
  placeholder,
39596
39616
  className
39597
39617
  });
@@ -39603,9 +39623,7 @@ var Control3 = (_ref10) => {
39603
39623
  } = _ref10;
39604
39624
  const {
39605
39625
  disabled,
39606
- required,
39607
- onBlur,
39608
- onFocus
39626
+ required
39609
39627
  } = useFieldPropsV2();
39610
39628
  const {
39611
39629
  selectedCountryCode,
@@ -39621,8 +39639,7 @@ var Control3 = (_ref10) => {
39621
39639
  onChange: (key) => handleCountryCodeChange(key),
39622
39640
  isDisabled: disabled,
39623
39641
  isRequired: required,
39624
- onBlur,
39625
- onFocus
39642
+ placeholder: ""
39626
39643
  }, countryButtonElement, countryOptionsElement), phoneNumberElement);
39627
39644
  };
39628
39645
  PhoneInput.Label = Label;