@wix/form-public 0.542.0 → 0.544.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
@@ -54125,7 +54125,9 @@ var DatePickerTriggerButton = /* @__PURE__ */ forwardRef((props2, ref) => {
54125
54125
  var DROPDOWN_FIELD_TYPES = [
54126
54126
  FIELD_TYPES.DROPDOWN,
54127
54127
  FIELD_TYPES.DEXT_DROPDOWN,
54128
- FIELD_TYPES.SERVICES_DROPDOWN,
54128
+ FIELD_TYPES.SERVICES_DROPDOWN
54129
+ ];
54130
+ var DATE_INPUT_FIELD_TYPES = [
54129
54131
  FIELD_TYPES.DATE_INPUT,
54130
54132
  FIELD_TYPES.CONTACTS_BIRTHDATE,
54131
54133
  FIELD_TYPES.DATE_TIME_INPUT,
@@ -54149,12 +54151,9 @@ var ADDRESS_FIELD_TYPES = [
54149
54151
  var hasCountryOptions = ({ properties }) => properties.validation?.string?.phoneOptions?.allowedCountryCodes?.length !== 1;
54150
54152
  var showsCountry = ({ properties }) => properties.fieldSettings?.country?.show !== false;
54151
54153
  var hasPhoneCountryList = (field, isMobile2) => PHONE_FIELD_TYPES.includes(field.fieldType) && !isMobile2 && hasCountryOptions(field);
54152
- var hasDropdown = (field) => {
54153
- if (ADDRESS_FIELD_TYPES.includes(field.fieldType)) {
54154
- return showsCountry(field);
54155
- }
54156
- return DROPDOWN_FIELD_TYPES.includes(field.fieldType);
54157
- };
54154
+ var hasDropdown = (field) => DROPDOWN_FIELD_TYPES.includes(field.fieldType);
54155
+ var hasDateInputMonthList = (field) => DATE_INPUT_FIELD_TYPES.includes(field.fieldType);
54156
+ var hasAddressCountryList = (field) => ADDRESS_FIELD_TYPES.includes(field.fieldType) && showsCountry(field);
54158
54157
  var hasDatePicker = (field) => DATE_PICKER_FIELD_TYPES.includes(field.fieldType);
54159
54158
  var isEditable = ({ properties }) => !properties.disabled && !properties.readOnly;
54160
54159
  var useOpenableFieldIds = (hasPopover) => {
@@ -54176,6 +54175,16 @@ var useIsForcedOpenDropdown = (fieldId) => {
54176
54175
  const openableDropdownIds = useOpenableFieldIds(hasDropdown);
54177
54176
  return isOpenState && openableDropdownIds.includes(fieldId);
54178
54177
  };
54178
+ var useIsForcedOpenDateInput = (fieldId) => {
54179
+ const isOpenState = useElementProps().dateInput?.elementProps?.dropdown?.open === true;
54180
+ const openableDateInputIds = useOpenableFieldIds(hasDateInputMonthList);
54181
+ return isOpenState && openableDateInputIds.includes(fieldId);
54182
+ };
54183
+ var useIsForcedOpenMultilineAddress = (fieldId) => {
54184
+ const isOpenState = useElementProps().multilineAddress?.elementProps?.dropdown?.open === true;
54185
+ const openableAddressIds = useOpenableFieldIds(hasAddressCountryList);
54186
+ return isOpenState && openableAddressIds.includes(fieldId);
54187
+ };
54179
54188
  var useIsForcedOpenPhone = (fieldId) => {
54180
54189
  const isOpenState = useElementProps().phone?.open === true;
54181
54190
  const openablePhoneIds = useOpenableFieldIds(hasPhoneCountryList);
@@ -54354,7 +54363,7 @@ var Month = ({ children, className }) => {
54354
54363
  const { partValue, partError, onPartChange } = useDatePart(SupportedDateParts.MONTH);
54355
54364
  const { t } = useTranslation2();
54356
54365
  const [isOpen, setIsOpen] = useState(false);
54357
- const isForcedOpen = useIsForcedOpenDropdown(id6);
54366
+ const isForcedOpen = useIsForcedOpenDateInput(id6);
54358
54367
  const [container, setContainer] = useState(null);
54359
54368
  const placeholder = hidePlaceholder ? EMPTY_SELECT_PLACEHOLDER : t("field.date.placeholder.month");
54360
54369
  const handleMonthChange = useCallback((selectedValue) => {
@@ -54966,7 +54975,7 @@ var Month2 = ({ children, className }) => {
54966
54975
  const { partValue, partError, onPartChange } = useFieldPart(SupportedDateParts.MONTH);
54967
54976
  const { t } = useTranslation2();
54968
54977
  const [isOpen, setIsOpen] = useState(false);
54969
- const isForcedOpen = useIsForcedOpenDropdown(id6);
54978
+ const isForcedOpen = useIsForcedOpenDateInput(id6);
54970
54979
  const [container, setContainer] = useState(null);
54971
54980
  const placeholder = hidePlaceholder ? EMPTY_SELECT_PLACEHOLDER : t("field.date.placeholder.month");
54972
54981
  const handleMonthChange = useCallback((selectedValue) => {
@@ -55913,12 +55922,19 @@ var useInvokeCallback = (callback) => {
55913
55922
  // ../form-fields/dist/esm/ui/events-repeater/events-repeater-headless.js
55914
55923
  var NO_ERRORS2 = [];
55915
55924
  var NO_VALUES = {};
55916
- var GuestCount = ({ children, ...internal }) => {
55925
+ var EventsRepeaterLabel = ({ className }) => {
55926
+ return /* @__PURE__ */ React172.createElement(Label, {
55927
+ className
55928
+ }, null);
55929
+ };
55930
+ var GuestCount = ({ children, className, ...internal }) => {
55917
55931
  const { guestLimit, guestCount, onGuestCountChange } = internal;
55918
55932
  const { label, disabled, readOnly, onBlur, onFocus } = useFieldPropsV2();
55919
55933
  const invokeBlur = useInvokeCallback(onBlur);
55934
+ const labelElement = findChildOfType(children, GuestCount.Label);
55920
55935
  const controlElement = findChildOfType(children, GuestCount.Control);
55921
55936
  return /* @__PURE__ */ React172.createElement(NumberField, {
55937
+ className,
55922
55938
  "aria-label": label,
55923
55939
  value: guestCount,
55924
55940
  onChange: onGuestCountChange,
@@ -55929,7 +55945,7 @@ var GuestCount = ({ children, ...internal }) => {
55929
55945
  isReadOnly: readOnly,
55930
55946
  onBlur: invokeBlur,
55931
55947
  onFocus
55932
- }, controlElement);
55948
+ }, labelElement, controlElement);
55933
55949
  };
55934
55950
  var GuestCountControl = ({ children, className }) => {
55935
55951
  const { disabled, readOnly } = useFieldPropsV2();
@@ -56069,6 +56085,7 @@ var Guest = ({ className, ...internal }) => {
56069
56085
  fieldActions
56070
56086
  }));
56071
56087
  };
56088
+ GuestCount.Label = EventsRepeaterLabel;
56072
56089
  GuestCount.Control = GuestCountControl;
56073
56090
  GuestCount.Input = GuestCountInput;
56074
56091
  GuestCount.Decrement = GuestCountDecrement;
@@ -59421,7 +59438,7 @@ var MultilineAddress = ({ children, className }) => {
59421
59438
  const field = form?.fields?.find((f) => "target" in f && f.target === firstError?.errorPath);
59422
59439
  return field?.id;
59423
59440
  });
59424
- const isForcedOpen = useIsForcedOpenDropdown(id6);
59441
+ const isForcedOpen = useIsForcedOpenMultilineAddress(id6);
59425
59442
  const countryElement = applyInternalProps(findChildOfType(children, MultilineAddress.Country), {
59426
59443
  isForcedOpen
59427
59444
  });