@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.cjs CHANGED
@@ -54135,7 +54135,9 @@ var DatePickerTriggerButton = /* @__PURE__ */ React172.forwardRef((props2, ref)
54135
54135
  var DROPDOWN_FIELD_TYPES = [
54136
54136
  FIELD_TYPES.DROPDOWN,
54137
54137
  FIELD_TYPES.DEXT_DROPDOWN,
54138
- FIELD_TYPES.SERVICES_DROPDOWN,
54138
+ FIELD_TYPES.SERVICES_DROPDOWN
54139
+ ];
54140
+ var DATE_INPUT_FIELD_TYPES = [
54139
54141
  FIELD_TYPES.DATE_INPUT,
54140
54142
  FIELD_TYPES.CONTACTS_BIRTHDATE,
54141
54143
  FIELD_TYPES.DATE_TIME_INPUT,
@@ -54159,12 +54161,9 @@ var ADDRESS_FIELD_TYPES = [
54159
54161
  var hasCountryOptions = ({ properties }) => properties.validation?.string?.phoneOptions?.allowedCountryCodes?.length !== 1;
54160
54162
  var showsCountry = ({ properties }) => properties.fieldSettings?.country?.show !== false;
54161
54163
  var hasPhoneCountryList = (field, isMobile2) => PHONE_FIELD_TYPES.includes(field.fieldType) && !isMobile2 && hasCountryOptions(field);
54162
- var hasDropdown = (field) => {
54163
- if (ADDRESS_FIELD_TYPES.includes(field.fieldType)) {
54164
- return showsCountry(field);
54165
- }
54166
- return DROPDOWN_FIELD_TYPES.includes(field.fieldType);
54167
- };
54164
+ var hasDropdown = (field) => DROPDOWN_FIELD_TYPES.includes(field.fieldType);
54165
+ var hasDateInputMonthList = (field) => DATE_INPUT_FIELD_TYPES.includes(field.fieldType);
54166
+ var hasAddressCountryList = (field) => ADDRESS_FIELD_TYPES.includes(field.fieldType) && showsCountry(field);
54168
54167
  var hasDatePicker = (field) => DATE_PICKER_FIELD_TYPES.includes(field.fieldType);
54169
54168
  var isEditable = ({ properties }) => !properties.disabled && !properties.readOnly;
54170
54169
  var useOpenableFieldIds = (hasPopover) => {
@@ -54186,6 +54185,16 @@ var useIsForcedOpenDropdown = (fieldId) => {
54186
54185
  const openableDropdownIds = useOpenableFieldIds(hasDropdown);
54187
54186
  return isOpenState && openableDropdownIds.includes(fieldId);
54188
54187
  };
54188
+ var useIsForcedOpenDateInput = (fieldId) => {
54189
+ const isOpenState = useElementProps().dateInput?.elementProps?.dropdown?.open === true;
54190
+ const openableDateInputIds = useOpenableFieldIds(hasDateInputMonthList);
54191
+ return isOpenState && openableDateInputIds.includes(fieldId);
54192
+ };
54193
+ var useIsForcedOpenMultilineAddress = (fieldId) => {
54194
+ const isOpenState = useElementProps().multilineAddress?.elementProps?.dropdown?.open === true;
54195
+ const openableAddressIds = useOpenableFieldIds(hasAddressCountryList);
54196
+ return isOpenState && openableAddressIds.includes(fieldId);
54197
+ };
54189
54198
  var useIsForcedOpenPhone = (fieldId) => {
54190
54199
  const isOpenState = useElementProps().phone?.open === true;
54191
54200
  const openablePhoneIds = useOpenableFieldIds(hasPhoneCountryList);
@@ -54364,7 +54373,7 @@ var Month = ({ children, className }) => {
54364
54373
  const { partValue, partError, onPartChange } = useDatePart(SupportedDateParts.MONTH);
54365
54374
  const { t } = useTranslation2();
54366
54375
  const [isOpen, setIsOpen] = React172.useState(false);
54367
- const isForcedOpen = useIsForcedOpenDropdown(id6);
54376
+ const isForcedOpen = useIsForcedOpenDateInput(id6);
54368
54377
  const [container, setContainer] = React172.useState(null);
54369
54378
  const placeholder = hidePlaceholder ? EMPTY_SELECT_PLACEHOLDER : t("field.date.placeholder.month");
54370
54379
  const handleMonthChange = React172.useCallback((selectedValue) => {
@@ -54976,7 +54985,7 @@ var Month2 = ({ children, className }) => {
54976
54985
  const { partValue, partError, onPartChange } = useFieldPart(SupportedDateParts.MONTH);
54977
54986
  const { t } = useTranslation2();
54978
54987
  const [isOpen, setIsOpen] = React172.useState(false);
54979
- const isForcedOpen = useIsForcedOpenDropdown(id6);
54988
+ const isForcedOpen = useIsForcedOpenDateInput(id6);
54980
54989
  const [container, setContainer] = React172.useState(null);
54981
54990
  const placeholder = hidePlaceholder ? EMPTY_SELECT_PLACEHOLDER : t("field.date.placeholder.month");
54982
54991
  const handleMonthChange = React172.useCallback((selectedValue) => {
@@ -59439,7 +59448,7 @@ var MultilineAddress = ({ children, className }) => {
59439
59448
  const field = form?.fields?.find((f) => "target" in f && f.target === firstError?.errorPath);
59440
59449
  return field?.id;
59441
59450
  });
59442
- const isForcedOpen = useIsForcedOpenDropdown(id6);
59451
+ const isForcedOpen = useIsForcedOpenMultilineAddress(id6);
59443
59452
  const countryElement = applyInternalProps(findChildOfType(children, MultilineAddress.Country), {
59444
59453
  isForcedOpen
59445
59454
  });