@wix/form-public 0.538.0 → 0.539.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 +12 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -8
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -54148,10 +54148,8 @@ var ADDRESS_FIELD_TYPES = [
|
|
|
54148
54148
|
];
|
|
54149
54149
|
var hasCountryOptions = ({ properties }) => properties.validation?.string?.phoneOptions?.allowedCountryCodes?.length !== 1;
|
|
54150
54150
|
var showsCountry = ({ properties }) => properties.fieldSettings?.country?.show !== false;
|
|
54151
|
-
var
|
|
54152
|
-
|
|
54153
|
-
return !isMobile2 && hasCountryOptions(field);
|
|
54154
|
-
}
|
|
54151
|
+
var hasPhoneCountryList = (field, isMobile2) => PHONE_FIELD_TYPES.includes(field.fieldType) && !isMobile2 && hasCountryOptions(field);
|
|
54152
|
+
var hasDropdown = (field) => {
|
|
54155
54153
|
if (ADDRESS_FIELD_TYPES.includes(field.fieldType)) {
|
|
54156
54154
|
return showsCountry(field);
|
|
54157
54155
|
}
|
|
@@ -54178,6 +54176,11 @@ var useIsForcedOpenDropdown = (fieldId) => {
|
|
|
54178
54176
|
const openableDropdownIds = useOpenableFieldIds(hasDropdown);
|
|
54179
54177
|
return isOpenState && openableDropdownIds.includes(fieldId);
|
|
54180
54178
|
};
|
|
54179
|
+
var useIsForcedOpenPhone = (fieldId) => {
|
|
54180
|
+
const isOpenState = useElementProps().phone?.open === true;
|
|
54181
|
+
const openablePhoneIds = useOpenableFieldIds(hasPhoneCountryList);
|
|
54182
|
+
return isOpenState && openablePhoneIds.includes(fieldId);
|
|
54183
|
+
};
|
|
54181
54184
|
var useIsForcedOpenDatePicker = (fieldId) => {
|
|
54182
54185
|
const isOpenState = useElementProps().datePicker?.open === true;
|
|
54183
54186
|
const openableDatePickerIds = useOpenableFieldIds(hasDatePicker);
|
|
@@ -54690,7 +54693,7 @@ var Control2 = ({ children, className }) => {
|
|
|
54690
54693
|
const { inputId, ariaDescribedBy } = useFieldAttributes();
|
|
54691
54694
|
const { hasError, disabled, readOnly } = useFieldPropsV2();
|
|
54692
54695
|
const state = useContext(DatePickerStateContext);
|
|
54693
|
-
const
|
|
54696
|
+
const handleClick = useCallback((event) => {
|
|
54694
54697
|
if (!state || state.isOpen || disabled || readOnly) {
|
|
54695
54698
|
return;
|
|
54696
54699
|
}
|
|
@@ -54713,7 +54716,7 @@ var Control2 = ({ children, className }) => {
|
|
|
54713
54716
|
"aria-describedby": ariaDescribedBy,
|
|
54714
54717
|
className,
|
|
54715
54718
|
"data-invalid": hasError,
|
|
54716
|
-
|
|
54719
|
+
onClick: handleClick
|
|
54717
54720
|
}, children);
|
|
54718
54721
|
};
|
|
54719
54722
|
var Input2 = ({ className }) => {
|
|
@@ -59324,7 +59327,7 @@ var ADDRESS_FIELDS = {
|
|
|
59324
59327
|
};
|
|
59325
59328
|
var NO_VALUES2 = {};
|
|
59326
59329
|
var NO_ERRORS3 = [];
|
|
59327
|
-
var MultilineAddress = ({ children }) => {
|
|
59330
|
+
var MultilineAddress = ({ children, className }) => {
|
|
59328
59331
|
const { id: id6, form: _form, value, onChange, onFieldBlur, onFieldFocus, errors, FieldLayout, fieldSettings, label, validation, target, autocompleteEnabled, required, fieldType } = useFieldPropsV2();
|
|
59329
59332
|
const [portalContainer, setPortalContainer] = useState(null);
|
|
59330
59333
|
const hostFields = useFormFields();
|
|
@@ -59467,6 +59470,7 @@ var MultilineAddress = ({ children }) => {
|
|
|
59467
59470
|
}), /* @__PURE__ */ React172.createElement($72abaeab4d80592f$export$78efe591171d7d45, {
|
|
59468
59471
|
getContainer: () => portalContainer
|
|
59469
59472
|
}, /* @__PURE__ */ React172.createElement("fieldset", {
|
|
59473
|
+
className,
|
|
59470
59474
|
style: FIELDSET_RESET_STYLE
|
|
59471
59475
|
}, /* @__PURE__ */ React172.createElement("legend", {
|
|
59472
59476
|
style: VISUALLY_HIDDEN_STYLE
|
|
@@ -60151,7 +60155,7 @@ var Control7 = ({ children, className }) => {
|
|
|
60151
60155
|
const popoverElement = findChildOfType(children, PhoneInput.CountryPopover);
|
|
60152
60156
|
const phoneNumberElement = findChildOfType(children, PhoneInput.PhoneNumber);
|
|
60153
60157
|
const hasCountryOptions2 = countries.length > 1;
|
|
60154
|
-
const isForcedOpen =
|
|
60158
|
+
const isForcedOpen = useIsForcedOpenPhone(id6) && !!popoverElement && hasCountryOptions2;
|
|
60155
60159
|
const controlClassName = typeof className === "function" ? ({ isHovered, isFocusWithin }) => className({
|
|
60156
60160
|
hasCountryOptions: hasCountryOptions2,
|
|
60157
60161
|
isHovered,
|