@wix/form-public 0.543.0 → 0.545.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 +29 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -13
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -14178,12 +14178,15 @@ function mapToStringSchemaProperty(stringField, validationMode) {
|
|
|
14178
14178
|
const validationMessages = isStringType(stringField) ? setValidationMessages(STRING_VALIDATION_PROPERTIES, stringField) : {};
|
|
14179
14179
|
return {
|
|
14180
14180
|
type: PropertyTypes.STRING,
|
|
14181
|
-
maxLength:
|
|
14181
|
+
maxLength: getAllowedMaxLength(stringField),
|
|
14182
14182
|
...validationMessages,
|
|
14183
14183
|
...resolveAjvFormat(stringField),
|
|
14184
14184
|
...resolveRestrictedValidationProperties5(stringField, validationMode)
|
|
14185
14185
|
};
|
|
14186
14186
|
}
|
|
14187
|
+
function getAllowedMaxLength(stringField) {
|
|
14188
|
+
return stringField.format === types$1.Format.EMAIL ? EMAIL_MAX_LENGTH : ALLOWED_MAX_LENGTH;
|
|
14189
|
+
}
|
|
14187
14190
|
function isStringType(field) {
|
|
14188
14191
|
return "validationMessages" in field;
|
|
14189
14192
|
}
|
|
@@ -14195,7 +14198,10 @@ function resolveRestrictedValidationProperties5(stringField, validationMode) {
|
|
|
14195
14198
|
if (validationMode !== types.ValidationMode.UNRESTRICTED_UPDATE) {
|
|
14196
14199
|
return {
|
|
14197
14200
|
...setValidationProperties(STRING_VALIDATION_PROPERTIES.filter((property) => property !== "format"), stringField, {
|
|
14198
|
-
maxLength: (value) =>
|
|
14201
|
+
maxLength: (value) => {
|
|
14202
|
+
const allowedMaxLength = getAllowedMaxLength(stringField);
|
|
14203
|
+
return Math.min(value ?? allowedMaxLength, allowedMaxLength);
|
|
14204
|
+
}
|
|
14199
14205
|
}),
|
|
14200
14206
|
...stringFormatOptionsMapper(stringField.format, getDateTimeConstrains(stringField), void 0, stringField.phoneOptions),
|
|
14201
14207
|
...availabilitySchema
|
|
@@ -14238,7 +14244,7 @@ function getDateAvailability(field) {
|
|
|
14238
14244
|
const dateOptions = "dateOptions" in field ? field.dateOptions : void 0;
|
|
14239
14245
|
return dateOptions?.availability;
|
|
14240
14246
|
}
|
|
14241
|
-
var ALLOWED_MAX_LENGTH, formMap;
|
|
14247
|
+
var ALLOWED_MAX_LENGTH, EMAIL_MAX_LENGTH, formMap;
|
|
14242
14248
|
var init_string_schema_property_mapper = __esm({
|
|
14243
14249
|
"../form-validator/dist/esm/lib/submission-validation/mappers/string-schema-property-mapper.js"() {
|
|
14244
14250
|
init_lang();
|
|
@@ -14247,6 +14253,7 @@ var init_string_schema_property_mapper = __esm({
|
|
|
14247
14253
|
init_property_types();
|
|
14248
14254
|
init_string_format_options_mapper();
|
|
14249
14255
|
ALLOWED_MAX_LENGTH = 2e4;
|
|
14256
|
+
EMAIL_MAX_LENGTH = 254;
|
|
14250
14257
|
formMap = {
|
|
14251
14258
|
[types$1.Format.DATE]: [
|
|
14252
14259
|
"date"
|
|
@@ -54135,7 +54142,9 @@ var DatePickerTriggerButton = /* @__PURE__ */ React172.forwardRef((props2, ref)
|
|
|
54135
54142
|
var DROPDOWN_FIELD_TYPES = [
|
|
54136
54143
|
FIELD_TYPES.DROPDOWN,
|
|
54137
54144
|
FIELD_TYPES.DEXT_DROPDOWN,
|
|
54138
|
-
FIELD_TYPES.SERVICES_DROPDOWN
|
|
54145
|
+
FIELD_TYPES.SERVICES_DROPDOWN
|
|
54146
|
+
];
|
|
54147
|
+
var DATE_INPUT_FIELD_TYPES = [
|
|
54139
54148
|
FIELD_TYPES.DATE_INPUT,
|
|
54140
54149
|
FIELD_TYPES.CONTACTS_BIRTHDATE,
|
|
54141
54150
|
FIELD_TYPES.DATE_TIME_INPUT,
|
|
@@ -54159,12 +54168,9 @@ var ADDRESS_FIELD_TYPES = [
|
|
|
54159
54168
|
var hasCountryOptions = ({ properties }) => properties.validation?.string?.phoneOptions?.allowedCountryCodes?.length !== 1;
|
|
54160
54169
|
var showsCountry = ({ properties }) => properties.fieldSettings?.country?.show !== false;
|
|
54161
54170
|
var hasPhoneCountryList = (field, isMobile2) => PHONE_FIELD_TYPES.includes(field.fieldType) && !isMobile2 && hasCountryOptions(field);
|
|
54162
|
-
var hasDropdown = (field) =>
|
|
54163
|
-
|
|
54164
|
-
|
|
54165
|
-
}
|
|
54166
|
-
return DROPDOWN_FIELD_TYPES.includes(field.fieldType);
|
|
54167
|
-
};
|
|
54171
|
+
var hasDropdown = (field) => DROPDOWN_FIELD_TYPES.includes(field.fieldType);
|
|
54172
|
+
var hasDateInputMonthList = (field) => DATE_INPUT_FIELD_TYPES.includes(field.fieldType);
|
|
54173
|
+
var hasAddressCountryList = (field) => ADDRESS_FIELD_TYPES.includes(field.fieldType) && showsCountry(field);
|
|
54168
54174
|
var hasDatePicker = (field) => DATE_PICKER_FIELD_TYPES.includes(field.fieldType);
|
|
54169
54175
|
var isEditable = ({ properties }) => !properties.disabled && !properties.readOnly;
|
|
54170
54176
|
var useOpenableFieldIds = (hasPopover) => {
|
|
@@ -54186,6 +54192,16 @@ var useIsForcedOpenDropdown = (fieldId) => {
|
|
|
54186
54192
|
const openableDropdownIds = useOpenableFieldIds(hasDropdown);
|
|
54187
54193
|
return isOpenState && openableDropdownIds.includes(fieldId);
|
|
54188
54194
|
};
|
|
54195
|
+
var useIsForcedOpenDateInput = (fieldId) => {
|
|
54196
|
+
const isOpenState = useElementProps().dateInput?.elementProps?.dropdown?.open === true;
|
|
54197
|
+
const openableDateInputIds = useOpenableFieldIds(hasDateInputMonthList);
|
|
54198
|
+
return isOpenState && openableDateInputIds.includes(fieldId);
|
|
54199
|
+
};
|
|
54200
|
+
var useIsForcedOpenMultilineAddress = (fieldId) => {
|
|
54201
|
+
const isOpenState = useElementProps().multilineAddress?.elementProps?.dropdown?.open === true;
|
|
54202
|
+
const openableAddressIds = useOpenableFieldIds(hasAddressCountryList);
|
|
54203
|
+
return isOpenState && openableAddressIds.includes(fieldId);
|
|
54204
|
+
};
|
|
54189
54205
|
var useIsForcedOpenPhone = (fieldId) => {
|
|
54190
54206
|
const isOpenState = useElementProps().phone?.open === true;
|
|
54191
54207
|
const openablePhoneIds = useOpenableFieldIds(hasPhoneCountryList);
|
|
@@ -54364,7 +54380,7 @@ var Month = ({ children, className }) => {
|
|
|
54364
54380
|
const { partValue, partError, onPartChange } = useDatePart(SupportedDateParts.MONTH);
|
|
54365
54381
|
const { t } = useTranslation2();
|
|
54366
54382
|
const [isOpen, setIsOpen] = React172.useState(false);
|
|
54367
|
-
const isForcedOpen =
|
|
54383
|
+
const isForcedOpen = useIsForcedOpenDateInput(id6);
|
|
54368
54384
|
const [container, setContainer] = React172.useState(null);
|
|
54369
54385
|
const placeholder = hidePlaceholder ? EMPTY_SELECT_PLACEHOLDER : t("field.date.placeholder.month");
|
|
54370
54386
|
const handleMonthChange = React172.useCallback((selectedValue) => {
|
|
@@ -54976,7 +54992,7 @@ var Month2 = ({ children, className }) => {
|
|
|
54976
54992
|
const { partValue, partError, onPartChange } = useFieldPart(SupportedDateParts.MONTH);
|
|
54977
54993
|
const { t } = useTranslation2();
|
|
54978
54994
|
const [isOpen, setIsOpen] = React172.useState(false);
|
|
54979
|
-
const isForcedOpen =
|
|
54995
|
+
const isForcedOpen = useIsForcedOpenDateInput(id6);
|
|
54980
54996
|
const [container, setContainer] = React172.useState(null);
|
|
54981
54997
|
const placeholder = hidePlaceholder ? EMPTY_SELECT_PLACEHOLDER : t("field.date.placeholder.month");
|
|
54982
54998
|
const handleMonthChange = React172.useCallback((selectedValue) => {
|
|
@@ -59439,7 +59455,7 @@ var MultilineAddress = ({ children, className }) => {
|
|
|
59439
59455
|
const field = form?.fields?.find((f) => "target" in f && f.target === firstError?.errorPath);
|
|
59440
59456
|
return field?.id;
|
|
59441
59457
|
});
|
|
59442
|
-
const isForcedOpen =
|
|
59458
|
+
const isForcedOpen = useIsForcedOpenMultilineAddress(id6);
|
|
59443
59459
|
const countryElement = applyInternalProps(findChildOfType(children, MultilineAddress.Country), {
|
|
59444
59460
|
isForcedOpen
|
|
59445
59461
|
});
|