@wix/form-public 0.543.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) => {
@@ -59429,7 +59438,7 @@ var MultilineAddress = ({ children, className }) => {
59429
59438
  const field = form?.fields?.find((f) => "target" in f && f.target === firstError?.errorPath);
59430
59439
  return field?.id;
59431
59440
  });
59432
- const isForcedOpen = useIsForcedOpenDropdown(id6);
59441
+ const isForcedOpen = useIsForcedOpenMultilineAddress(id6);
59433
59442
  const countryElement = applyInternalProps(findChildOfType(children, MultilineAddress.Country), {
59434
59443
  isForcedOpen
59435
59444
  });