@wix/form-public 0.228.0 → 0.229.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
@@ -27040,381 +27040,6 @@ function useFieldPropsV2() {
27040
27040
  return useFieldProps().v2;
27041
27041
  }
27042
27042
 
27043
- // ../form-fields/dist/esm/mappers/public-props-map.js
27044
- init_esm3();
27045
- var allCallingCountryCodes = Object.keys(CALLING_COUNTRY_CODES);
27046
- var MinMaxLengthMapper = (validation) => {
27047
- var _validation$string, _validation$string2;
27048
- return {
27049
- maxLength: validation == null || (_validation$string = validation.string) == null ? void 0 : _validation$string.maxLength,
27050
- minLength: validation == null || (_validation$string2 = validation.string) == null ? void 0 : _validation$string2.minLength
27051
- };
27052
- };
27053
- var MinMaxItemsMapper = (validation) => {
27054
- var _validation$array, _validation$array2;
27055
- return {
27056
- minItems: validation == null || (_validation$array = validation.array) == null ? void 0 : _validation$array.minItems,
27057
- maxItems: validation == null || (_validation$array2 = validation.array) == null ? void 0 : _validation$array2.maxItems
27058
- };
27059
- };
27060
- var MinMaxValuesMapper = (validation) => {
27061
- var _validation$predefine, _validation$predefine2;
27062
- return {
27063
- minValue: validation == null || (_validation$predefine = validation.predefined) == null || (_validation$predefine = _validation$predefine.paymentOptions) == null || (_validation$predefine = _validation$predefine.products) == null || (_validation$predefine = _validation$predefine[0]) == null ? void 0 : _validation$predefine.dynamicPriceOptions.minPrice,
27064
- maxValue: validation == null || (_validation$predefine2 = validation.predefined) == null || (_validation$predefine2 = _validation$predefine2.paymentOptions) == null || (_validation$predefine2 = _validation$predefine2.products) == null || (_validation$predefine2 = _validation$predefine2[0]) == null ? void 0 : _validation$predefine2.dynamicPriceOptions.maxPrice
27065
- };
27066
- };
27067
- var AcceptedDatesMapper = (validation) => {
27068
- var _validation$string3, _validation$string4;
27069
- return {
27070
- acceptedDates: (validation == null || (_validation$string3 = validation.string) == null || (_validation$string3 = _validation$string3.dateOptions) == null ? void 0 : _validation$string3.minimum) === "$now" ? "future" : (validation == null || (_validation$string4 = validation.string) == null || (_validation$string4 = _validation$string4.dateOptions) == null ? void 0 : _validation$string4.maximum) === "$now" ? "past" : "all"
27071
- };
27072
- };
27073
- var CustomOptionMapper = (props) => {
27074
- const {
27075
- addOther,
27076
- addOtherLabel,
27077
- addOtherPlaceholder
27078
- } = props;
27079
- return {
27080
- customOption: addOther ? {
27081
- label: addOtherLabel,
27082
- placeholder: addOtherPlaceholder
27083
- } : void 0
27084
- };
27085
- };
27086
- var ErrorMapper = (error) => {
27087
- if (!error) {
27088
- return void 0;
27089
- }
27090
- return error.errorMessage || "Validation error";
27091
- };
27092
- var BaseMapper = (props) => {
27093
- const {
27094
- hideLabel,
27095
- error,
27096
- showLabel,
27097
- ...rest
27098
- } = props;
27099
- return {
27100
- ...rest,
27101
- showLabel: hideLabel === void 0 ? true : !hideLabel,
27102
- error: ErrorMapper(error)
27103
- };
27104
- };
27105
- var TextFieldMapper = (props) => ({
27106
- ...props,
27107
- ...MinMaxLengthMapper(props == null ? void 0 : props.validation),
27108
- ...BaseMapper(props)
27109
- });
27110
- var TextAreaMapper = (props) => ({
27111
- ...props,
27112
- ...MinMaxLengthMapper(props == null ? void 0 : props.validation),
27113
- ...BaseMapper(props)
27114
- });
27115
- var PhoneInputMapper = (props) => {
27116
- var _validation$string5;
27117
- const {
27118
- defaultCountry,
27119
- defaultCountryCode,
27120
- validation
27121
- } = props;
27122
- const allowedCountryCodes = validation == null || (_validation$string5 = validation.string) == null || (_validation$string5 = _validation$string5.phoneOptions) == null ? void 0 : _validation$string5.allowedCountryCodes;
27123
- return {
27124
- ...props,
27125
- ...BaseMapper(props),
27126
- defaultCountryCode: defaultCountry ?? defaultCountryCode,
27127
- countryCodes: allowedCountryCodes && allowedCountryCodes.length > 0 ? allowedCountryCodes : allCallingCountryCodes
27128
- };
27129
- };
27130
- var MultilineAddressMapper = (props) => {
27131
- var _view$fieldSettings, _validation$predefine3;
27132
- const {
27133
- view,
27134
- validation
27135
- } = props;
27136
- return {
27137
- ...props,
27138
- ...BaseMapper(props),
27139
- showAddressLine2: view == null || (_view$fieldSettings = view.fieldSettings) == null || (_view$fieldSettings = _view$fieldSettings.addressLine2) == null ? void 0 : _view$fieldSettings.show,
27140
- addressLine2Required: validation == null || (_validation$predefine3 = validation.predefined) == null || (_validation$predefine3 = _validation$predefine3.multilineAddressOptions) == null || (_validation$predefine3 = _validation$predefine3.fields) == null || (_validation$predefine3 = _validation$predefine3.addressLine2) == null ? void 0 : _validation$predefine3.required
27141
- };
27142
- };
27143
- var DateInputMapper = (props) => {
27144
- const {
27145
- hidePlaceholder,
27146
- validation
27147
- } = props;
27148
- return {
27149
- ...props,
27150
- ...BaseMapper(props),
27151
- ...AcceptedDatesMapper(validation),
27152
- showPlaceholder: hidePlaceholder === void 0 ? true : !hidePlaceholder
27153
- };
27154
- };
27155
- var DatePickerMapper = (props) => {
27156
- const {
27157
- validation
27158
- } = props;
27159
- return {
27160
- ...props,
27161
- ...BaseMapper(props),
27162
- ...AcceptedDatesMapper(validation)
27163
- };
27164
- };
27165
- var DateTimeInputMapper = (props) => {
27166
- const {
27167
- hidePlaceholder,
27168
- validation
27169
- } = props;
27170
- return {
27171
- ...props,
27172
- ...BaseMapper(props),
27173
- ...AcceptedDatesMapper(validation),
27174
- showPlaceholder: hidePlaceholder === void 0 ? true : !hidePlaceholder
27175
- };
27176
- };
27177
- var FileUploadMapper = (props) => {
27178
- const {
27179
- valueSliderLimit,
27180
- uploadFileFormats
27181
- } = props;
27182
- return {
27183
- ...props,
27184
- ...BaseMapper(props),
27185
- maxFiles: valueSliderLimit,
27186
- allowedFileFormats: uploadFileFormats
27187
- };
27188
- };
27189
- var NumberInputMapper = (props) => BaseMapper(props);
27190
- var CheckboxMapper = (props) => {
27191
- const {
27192
- error,
27193
- ...rest
27194
- } = props;
27195
- return {
27196
- ...rest,
27197
- error: ErrorMapper(error)
27198
- };
27199
- };
27200
- var SignatureMapper = (props) => {
27201
- const {
27202
- uploadEnabled
27203
- } = props;
27204
- return {
27205
- ...props,
27206
- ...BaseMapper(props),
27207
- imageUploadEnabled: uploadEnabled
27208
- };
27209
- };
27210
- var RatingInputMapper = (props) => BaseMapper(props);
27211
- var RadioGroupMapper = (props) => {
27212
- return {
27213
- ...props,
27214
- ...BaseMapper(props),
27215
- ...CustomOptionMapper(props)
27216
- };
27217
- };
27218
- var CheckboxGroupMapper = (props) => {
27219
- const {
27220
- validation
27221
- } = props;
27222
- return {
27223
- ...props,
27224
- ...BaseMapper(props),
27225
- ...CustomOptionMapper(props),
27226
- ...MinMaxItemsMapper(validation)
27227
- };
27228
- };
27229
- var DropdownMapper = (props) => BaseMapper(props);
27230
- var TagsMapper = (props) => {
27231
- const {
27232
- validation
27233
- } = props;
27234
- return {
27235
- ...props,
27236
- ...BaseMapper(props),
27237
- ...CustomOptionMapper(props),
27238
- ...MinMaxItemsMapper(validation)
27239
- };
27240
- };
27241
- var TimeInputMapper = (props) => {
27242
- const {
27243
- hidePlaceholder
27244
- } = props;
27245
- return {
27246
- ...props,
27247
- ...BaseMapper(props),
27248
- showPlaceholder: hidePlaceholder === void 0 ? true : !hidePlaceholder
27249
- };
27250
- };
27251
- var TextMapper = (props) => props;
27252
- var SubmitButtonMapper = (props) => {
27253
- return {
27254
- ...props
27255
- };
27256
- };
27257
- var ProductListMapper = (props) => {
27258
- return {
27259
- ...props,
27260
- ...BaseMapper(props),
27261
- ...MinMaxItemsMapper(props == null ? void 0 : props.validation)
27262
- };
27263
- };
27264
- var FixedPaymentMapper = (props) => {
27265
- var _validation$predefine4, _paymentValidation$fi;
27266
- const {
27267
- validation,
27268
- hideLabel,
27269
- showLabel,
27270
- ...rest
27271
- } = props;
27272
- const paymentValidation = validation == null || (_validation$predefine4 = validation.predefined) == null || (_validation$predefine4 = _validation$predefine4.paymentOptions) == null || (_validation$predefine4 = _validation$predefine4.products) == null ? void 0 : _validation$predefine4[0];
27273
- const fixedPaymentValue = paymentValidation == null || (_paymentValidation$fi = paymentValidation.fixedPriceOptions) == null ? void 0 : _paymentValidation$fi.price;
27274
- return {
27275
- ...rest,
27276
- validation,
27277
- showLabel: hideLabel === void 0 ? true : !hideLabel,
27278
- amount: fixedPaymentValue
27279
- };
27280
- };
27281
- var PaymentInputMapper = (props) => {
27282
- const {
27283
- validation
27284
- } = props;
27285
- return {
27286
- ...props,
27287
- ...BaseMapper(props),
27288
- ...MinMaxValuesMapper(validation)
27289
- };
27290
- };
27291
- var DonationMapper = (props) => {
27292
- return {
27293
- ...props,
27294
- ...BaseMapper(props),
27295
- ...CustomOptionMapper(props)
27296
- };
27297
- };
27298
- var AppointmentMapper = (props) => BaseMapper(props);
27299
- var ImageChoiceMapper = (props) => {
27300
- const {
27301
- isMultipleAnswers,
27302
- choiceImageResize
27303
- } = props;
27304
- return {
27305
- ...props,
27306
- ...BaseMapper(props),
27307
- multiple: isMultipleAnswers,
27308
- imageAspectRatio: choiceImageResize
27309
- };
27310
- };
27311
- var DefaultMapper = (props) => {
27312
- const {
27313
- error,
27314
- ...rest
27315
- } = props;
27316
- return {
27317
- ...rest,
27318
- error: ErrorMapper(error)
27319
- };
27320
- };
27321
- var FIELD_PROPS_MAPPERS = {
27322
- TEXT_INPUT: TextFieldMapper,
27323
- TEXT_AREA: TextAreaMapper,
27324
- NUMBER_INPUT: NumberInputMapper,
27325
- URL_INPUT: TextFieldMapper,
27326
- DATE_INPUT: DateInputMapper,
27327
- DATE_PICKER: DatePickerMapper,
27328
- DATE_TIME_INPUT: DateTimeInputMapper,
27329
- TIME_INPUT: TimeInputMapper,
27330
- CONTACTS_COMPANY: TextFieldMapper,
27331
- CONTACTS_POSITION: TextFieldMapper,
27332
- CONTACTS_TAX_ID: TextFieldMapper,
27333
- CONTACTS_FIRST_NAME: TextFieldMapper,
27334
- CONTACTS_LAST_NAME: TextFieldMapper,
27335
- CONTACTS_EMAIL: TextFieldMapper,
27336
- CONTACTS_BIRTHDATE: DateInputMapper,
27337
- CONTACTS_PHONE: PhoneInputMapper,
27338
- CONTACTS_ADDRESS: TextFieldMapper,
27339
- CONTACTS_SUBSCRIBE: CheckboxMapper,
27340
- RADIO_GROUP: RadioGroupMapper,
27341
- CHECKBOX: CheckboxMapper,
27342
- CHECKBOX_GROUP: CheckboxGroupMapper,
27343
- IMAGE_CHOICE: ImageChoiceMapper,
27344
- DROPDOWN: DropdownMapper,
27345
- TAGS: TagsMapper,
27346
- QUIZ_IMAGE_CHOICE: ImageChoiceMapper,
27347
- QUIZ_MULTI_CHOICE: CheckboxGroupMapper,
27348
- QUIZ_SINGLE_CHOICE: RadioGroupMapper,
27349
- QUIZ_SHORT_TEXT: TextFieldMapper,
27350
- QUIZ_LONG_TEXT: TextAreaMapper,
27351
- QUIZ_NUMBER: NumberInputMapper,
27352
- QUIZ_FILE_UPLOAD: FileUploadMapper,
27353
- DEXT_TEXT_INPUT: TextFieldMapper,
27354
- DEXT_TEXT_AREA: TextAreaMapper,
27355
- DEXT_DROPDOWN: DropdownMapper,
27356
- DEXT_URL_INPUT: TextFieldMapper,
27357
- DEXT_RADIO_GROUP: RadioGroupMapper,
27358
- DEXT_NUMBER_INPUT: NumberInputMapper,
27359
- DEXT_CHECKBOX: CheckboxMapper,
27360
- DEXT_CHECKBOX_GROUP: CheckboxGroupMapper,
27361
- DEXT_EMAIL: TextFieldMapper,
27362
- DEXT_PHONE: PhoneInputMapper,
27363
- DEXT_RATING_INPUT: RatingInputMapper,
27364
- DEXT_DATE_PICKER: DatePickerMapper,
27365
- DEXT_DATE_TIME_INPUT: DateTimeInputMapper,
27366
- DEXT_TAGS: TagsMapper,
27367
- MULTILINE_ADDRESS: MultilineAddressMapper,
27368
- MLA_COUNTRY: DropdownMapper,
27369
- MLA_CITY: TextFieldMapper,
27370
- MLA_ADDRESS_LINE: TextFieldMapper,
27371
- MLA_ADDRESS_LINE_2: TextFieldMapper,
27372
- MLA_POSTAL_CODE: TextFieldMapper,
27373
- MLA_SUBDIVISION: DropdownMapper,
27374
- MLA_STREET_NAME: TextFieldMapper,
27375
- MLA_STREET_NUMBER: TextFieldMapper,
27376
- MLA_APARTMENT: TextFieldMapper,
27377
- FULL_NAME: TextFieldMapper,
27378
- FULL_NAME_FIRST_NAME: TextFieldMapper,
27379
- FULL_NAME_LAST_NAME: TextFieldMapper,
27380
- ECOM_ADDITIONAL_INFO: TextAreaMapper,
27381
- ECOM_ADDRESS: TextFieldMapper,
27382
- ECOM_FULL_NAME: TextFieldMapper,
27383
- ECOM_PHONE: PhoneInputMapper,
27384
- ECOM_COMPANY_NAME: TextFieldMapper,
27385
- ECOM_EMAIL: TextFieldMapper,
27386
- ECOM_SUBSCRIPTION: CheckboxMapper,
27387
- ECOM_CONTACT_DETAILS: TextMapper,
27388
- ECOM_SHIPPING_DETAILS: TextMapper,
27389
- BOOKINGS_FIRST_NAME: TextFieldMapper,
27390
- BOOKINGS_LAST_NAME: TextFieldMapper,
27391
- BOOKINGS_EMAIL: TextFieldMapper,
27392
- BOOKINGS_PHONE: PhoneInputMapper,
27393
- BOOKINGS_ADDRESS: TextFieldMapper,
27394
- BOOKINGS_HEADER: TextMapper,
27395
- BOOKINGS_RICH_TEXT: TextMapper,
27396
- BOOKINGS_LOGIN_BAR: DefaultMapper,
27397
- APPOINTMENT: AppointmentMapper,
27398
- SERVICES_DROPDOWN: DropdownMapper,
27399
- SERVICES_MULTI_CHOICE: CheckboxGroupMapper,
27400
- PRODUCT_LIST: ProductListMapper,
27401
- FIXED_PAYMENT: FixedPaymentMapper,
27402
- PAYMENT_INPUT: PaymentInputMapper,
27403
- DONATION: DonationMapper,
27404
- EVENTS_RSVP: RadioGroupMapper,
27405
- EVENTS_REPEATER: TextMapper,
27406
- FILE_UPLOAD: FileUploadMapper,
27407
- SIGNATURE: SignatureMapper,
27408
- RATING_INPUT: RatingInputMapper,
27409
- VAT_ID: TextFieldMapper,
27410
- NESTED_FORM: DefaultMapper,
27411
- HEADER: TextMapper,
27412
- RICH_TEXT: TextMapper,
27413
- SUBMIT_BUTTON: SubmitButtonMapper,
27414
- PASSWORD: DefaultMapper,
27415
- PHONE: PhoneInputMapper
27416
- };
27417
-
27418
27043
  // ../form-fields/dist/esm/services/field-attributes.js
27419
27044
  function getInputId(fieldId, uniqueId) {
27420
27045
  return `form-field-input-${fieldId}-${uniqueId}`;
@@ -27488,7 +27113,6 @@ var InputField = (_ref) => {
27488
27113
  requiredIndicator,
27489
27114
  requiredIndicatorPlacement
27490
27115
  } = form.requiredIndicatorProperties || {};
27491
- const propsMapper = FIELD_PROPS_MAPPERS[field.fieldType] || BaseMapper;
27492
27116
  const _onBlur = useCallback(() => {
27493
27117
  const currentFieldValue = fieldValueRef.current;
27494
27118
  bi == null || bi.report(formFieldFocus({
@@ -27565,24 +27189,6 @@ var InputField = (_ref) => {
27565
27189
  value: fieldAttributes
27566
27190
  }, /* @__PURE__ */ React42__default.createElement(FieldPropsContext.Provider, {
27567
27191
  value: {
27568
- ...propsMapper({
27569
- ...field.properties,
27570
- id: field.id,
27571
- target: field.target,
27572
- path: field.path,
27573
- error: fieldError,
27574
- errors: fieldErrors,
27575
- value: fieldValue,
27576
- externalData,
27577
- fieldType: field.fieldType,
27578
- requiredIndicatorType: requiredIndicator,
27579
- requiredIndicatorPlacement
27580
- }),
27581
- onChange: handleChange,
27582
- onBlur: _onBlur,
27583
- onFocus: _onFocus,
27584
- hasError,
27585
- errorMessage,
27586
27192
  v2: fieldProps
27587
27193
  }
27588
27194
  }, /* @__PURE__ */ React42__default.createElement(FieldComponent, fieldProps)));
@@ -27599,7 +27205,6 @@ var ReadOnlyField = (_ref) => {
27599
27205
  requiredIndicator,
27600
27206
  requiredIndicatorPlacement
27601
27207
  } = form.requiredIndicatorProperties || {};
27602
- const propsMapper = FIELD_PROPS_MAPPERS[field.fieldType] || BaseMapper;
27603
27208
  const FieldComponent = componentsById[field.fieldType];
27604
27209
  if (!FieldComponent) {
27605
27210
  return null;
@@ -27615,14 +27220,6 @@ var ReadOnlyField = (_ref) => {
27615
27220
  };
27616
27221
  return /* @__PURE__ */ React42__default.createElement(FieldPropsContext.Provider, {
27617
27222
  value: {
27618
- ...propsMapper({
27619
- ...field.properties,
27620
- id: field.id,
27621
- externalData,
27622
- fieldType: field.fieldType,
27623
- requiredIndicatorType: requiredIndicator,
27624
- requiredIndicatorPlacement
27625
- }),
27626
27223
  v2: fieldProps
27627
27224
  }
27628
27225
  }, /* @__PURE__ */ React42__default.createElement(FieldComponent, fieldProps));
@@ -27649,7 +27246,6 @@ var NestedFormField = (_ref) => {
27649
27246
  requiredIndicator,
27650
27247
  requiredIndicatorPlacement
27651
27248
  } = form.requiredIndicatorProperties || {};
27652
- const propsMapper = FIELD_PROPS_MAPPERS[field.fieldType] || BaseMapper;
27653
27249
  const handleChange = useCallback((value) => {
27654
27250
  if (!value) {
27655
27251
  value = null;
@@ -27677,20 +27273,6 @@ var NestedFormField = (_ref) => {
27677
27273
  };
27678
27274
  return /* @__PURE__ */ React42__default.createElement(FieldPropsContext.Provider, {
27679
27275
  value: {
27680
- ...propsMapper({
27681
- ...field.properties,
27682
- id: field.id,
27683
- target: field.target,
27684
- path: field.path,
27685
- error: fieldError,
27686
- errors: fieldErrors,
27687
- value: fieldValue,
27688
- externalData,
27689
- fieldType: field.fieldType,
27690
- requiredIndicatorType: requiredIndicator,
27691
- requiredIndicatorPlacement
27692
- }),
27693
- onChange: handleChange,
27694
27276
  v2: fieldProps
27695
27277
  }
27696
27278
  }, /* @__PURE__ */ React42__default.createElement(FieldComponent, fieldProps));
@@ -27797,7 +27379,6 @@ var SubmitButtonField = (_ref) => {
27797
27379
  const submitButtonText = submitText || text || "";
27798
27380
  const previousButtonText = previousText || "";
27799
27381
  const nextButtonText = nextText || "";
27800
- const propsMapper = FIELD_PROPS_MAPPERS[field.fieldType] || BaseMapper;
27801
27382
  const FieldComponent = componentsById[field.fieldType];
27802
27383
  if (!FieldComponent) {
27803
27384
  return null;
@@ -27823,24 +27404,6 @@ var SubmitButtonField = (_ref) => {
27823
27404
  };
27824
27405
  return /* @__PURE__ */ React42__default.createElement(FieldPropsContext.Provider, {
27825
27406
  value: {
27826
- ...propsMapper({
27827
- ...field.properties,
27828
- id: field.id,
27829
- externalData,
27830
- fieldType: field.fieldType,
27831
- hasSteps,
27832
- isDisabled,
27833
- isInProgress,
27834
- showPreviousButton,
27835
- showNextButton,
27836
- showSubmitButton,
27837
- submitText: submitButtonText,
27838
- previousText: previousButtonText,
27839
- nextText: nextButtonText,
27840
- onSubmitClick: handleSubmitClick,
27841
- onPreviousClick: () => actions == null ? void 0 : actions.setPreviousStep(),
27842
- onNextClick: () => actions == null ? void 0 : actions.setNextStep()
27843
- }),
27844
27407
  v2: fieldProps
27845
27408
  }
27846
27409
  }, /* @__PURE__ */ React42__default.createElement(FieldComponent, fieldProps));