@wix/form-public 0.227.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.cjs CHANGED
@@ -27066,381 +27066,6 @@ function useFieldPropsV2() {
27066
27066
  return useFieldProps().v2;
27067
27067
  }
27068
27068
 
27069
- // ../form-fields/dist/esm/mappers/public-props-map.js
27070
- init_esm3();
27071
- var allCallingCountryCodes = Object.keys(CALLING_COUNTRY_CODES);
27072
- var MinMaxLengthMapper = (validation) => {
27073
- var _validation$string, _validation$string2;
27074
- return {
27075
- maxLength: validation == null || (_validation$string = validation.string) == null ? void 0 : _validation$string.maxLength,
27076
- minLength: validation == null || (_validation$string2 = validation.string) == null ? void 0 : _validation$string2.minLength
27077
- };
27078
- };
27079
- var MinMaxItemsMapper = (validation) => {
27080
- var _validation$array, _validation$array2;
27081
- return {
27082
- minItems: validation == null || (_validation$array = validation.array) == null ? void 0 : _validation$array.minItems,
27083
- maxItems: validation == null || (_validation$array2 = validation.array) == null ? void 0 : _validation$array2.maxItems
27084
- };
27085
- };
27086
- var MinMaxValuesMapper = (validation) => {
27087
- var _validation$predefine, _validation$predefine2;
27088
- return {
27089
- 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,
27090
- 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
27091
- };
27092
- };
27093
- var AcceptedDatesMapper = (validation) => {
27094
- var _validation$string3, _validation$string4;
27095
- return {
27096
- 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"
27097
- };
27098
- };
27099
- var CustomOptionMapper = (props) => {
27100
- const {
27101
- addOther,
27102
- addOtherLabel,
27103
- addOtherPlaceholder
27104
- } = props;
27105
- return {
27106
- customOption: addOther ? {
27107
- label: addOtherLabel,
27108
- placeholder: addOtherPlaceholder
27109
- } : void 0
27110
- };
27111
- };
27112
- var ErrorMapper = (error) => {
27113
- if (!error) {
27114
- return void 0;
27115
- }
27116
- return error.errorMessage || "Validation error";
27117
- };
27118
- var BaseMapper = (props) => {
27119
- const {
27120
- hideLabel,
27121
- error,
27122
- showLabel,
27123
- ...rest
27124
- } = props;
27125
- return {
27126
- ...rest,
27127
- showLabel: hideLabel === void 0 ? true : !hideLabel,
27128
- error: ErrorMapper(error)
27129
- };
27130
- };
27131
- var TextFieldMapper = (props) => ({
27132
- ...props,
27133
- ...MinMaxLengthMapper(props == null ? void 0 : props.validation),
27134
- ...BaseMapper(props)
27135
- });
27136
- var TextAreaMapper = (props) => ({
27137
- ...props,
27138
- ...MinMaxLengthMapper(props == null ? void 0 : props.validation),
27139
- ...BaseMapper(props)
27140
- });
27141
- var PhoneInputMapper = (props) => {
27142
- var _validation$string5;
27143
- const {
27144
- defaultCountry,
27145
- defaultCountryCode,
27146
- validation
27147
- } = props;
27148
- const allowedCountryCodes = validation == null || (_validation$string5 = validation.string) == null || (_validation$string5 = _validation$string5.phoneOptions) == null ? void 0 : _validation$string5.allowedCountryCodes;
27149
- return {
27150
- ...props,
27151
- ...BaseMapper(props),
27152
- defaultCountryCode: defaultCountry ?? defaultCountryCode,
27153
- countryCodes: allowedCountryCodes && allowedCountryCodes.length > 0 ? allowedCountryCodes : allCallingCountryCodes
27154
- };
27155
- };
27156
- var MultilineAddressMapper = (props) => {
27157
- var _view$fieldSettings, _validation$predefine3;
27158
- const {
27159
- view,
27160
- validation
27161
- } = props;
27162
- return {
27163
- ...props,
27164
- ...BaseMapper(props),
27165
- showAddressLine2: view == null || (_view$fieldSettings = view.fieldSettings) == null || (_view$fieldSettings = _view$fieldSettings.addressLine2) == null ? void 0 : _view$fieldSettings.show,
27166
- 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
27167
- };
27168
- };
27169
- var DateInputMapper = (props) => {
27170
- const {
27171
- hidePlaceholder,
27172
- validation
27173
- } = props;
27174
- return {
27175
- ...props,
27176
- ...BaseMapper(props),
27177
- ...AcceptedDatesMapper(validation),
27178
- showPlaceholder: hidePlaceholder === void 0 ? true : !hidePlaceholder
27179
- };
27180
- };
27181
- var DatePickerMapper = (props) => {
27182
- const {
27183
- validation
27184
- } = props;
27185
- return {
27186
- ...props,
27187
- ...BaseMapper(props),
27188
- ...AcceptedDatesMapper(validation)
27189
- };
27190
- };
27191
- var DateTimeInputMapper = (props) => {
27192
- const {
27193
- hidePlaceholder,
27194
- validation
27195
- } = props;
27196
- return {
27197
- ...props,
27198
- ...BaseMapper(props),
27199
- ...AcceptedDatesMapper(validation),
27200
- showPlaceholder: hidePlaceholder === void 0 ? true : !hidePlaceholder
27201
- };
27202
- };
27203
- var FileUploadMapper = (props) => {
27204
- const {
27205
- valueSliderLimit,
27206
- uploadFileFormats
27207
- } = props;
27208
- return {
27209
- ...props,
27210
- ...BaseMapper(props),
27211
- maxFiles: valueSliderLimit,
27212
- allowedFileFormats: uploadFileFormats
27213
- };
27214
- };
27215
- var NumberInputMapper = (props) => BaseMapper(props);
27216
- var CheckboxMapper = (props) => {
27217
- const {
27218
- error,
27219
- ...rest
27220
- } = props;
27221
- return {
27222
- ...rest,
27223
- error: ErrorMapper(error)
27224
- };
27225
- };
27226
- var SignatureMapper = (props) => {
27227
- const {
27228
- uploadEnabled
27229
- } = props;
27230
- return {
27231
- ...props,
27232
- ...BaseMapper(props),
27233
- imageUploadEnabled: uploadEnabled
27234
- };
27235
- };
27236
- var RatingInputMapper = (props) => BaseMapper(props);
27237
- var RadioGroupMapper = (props) => {
27238
- return {
27239
- ...props,
27240
- ...BaseMapper(props),
27241
- ...CustomOptionMapper(props)
27242
- };
27243
- };
27244
- var CheckboxGroupMapper = (props) => {
27245
- const {
27246
- validation
27247
- } = props;
27248
- return {
27249
- ...props,
27250
- ...BaseMapper(props),
27251
- ...CustomOptionMapper(props),
27252
- ...MinMaxItemsMapper(validation)
27253
- };
27254
- };
27255
- var DropdownMapper = (props) => BaseMapper(props);
27256
- var TagsMapper = (props) => {
27257
- const {
27258
- validation
27259
- } = props;
27260
- return {
27261
- ...props,
27262
- ...BaseMapper(props),
27263
- ...CustomOptionMapper(props),
27264
- ...MinMaxItemsMapper(validation)
27265
- };
27266
- };
27267
- var TimeInputMapper = (props) => {
27268
- const {
27269
- hidePlaceholder
27270
- } = props;
27271
- return {
27272
- ...props,
27273
- ...BaseMapper(props),
27274
- showPlaceholder: hidePlaceholder === void 0 ? true : !hidePlaceholder
27275
- };
27276
- };
27277
- var TextMapper = (props) => props;
27278
- var SubmitButtonMapper = (props) => {
27279
- return {
27280
- ...props
27281
- };
27282
- };
27283
- var ProductListMapper = (props) => {
27284
- return {
27285
- ...props,
27286
- ...BaseMapper(props),
27287
- ...MinMaxItemsMapper(props == null ? void 0 : props.validation)
27288
- };
27289
- };
27290
- var FixedPaymentMapper = (props) => {
27291
- var _validation$predefine4, _paymentValidation$fi;
27292
- const {
27293
- validation,
27294
- hideLabel,
27295
- showLabel,
27296
- ...rest
27297
- } = props;
27298
- 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];
27299
- const fixedPaymentValue = paymentValidation == null || (_paymentValidation$fi = paymentValidation.fixedPriceOptions) == null ? void 0 : _paymentValidation$fi.price;
27300
- return {
27301
- ...rest,
27302
- validation,
27303
- showLabel: hideLabel === void 0 ? true : !hideLabel,
27304
- amount: fixedPaymentValue
27305
- };
27306
- };
27307
- var PaymentInputMapper = (props) => {
27308
- const {
27309
- validation
27310
- } = props;
27311
- return {
27312
- ...props,
27313
- ...BaseMapper(props),
27314
- ...MinMaxValuesMapper(validation)
27315
- };
27316
- };
27317
- var DonationMapper = (props) => {
27318
- return {
27319
- ...props,
27320
- ...BaseMapper(props),
27321
- ...CustomOptionMapper(props)
27322
- };
27323
- };
27324
- var AppointmentMapper = (props) => BaseMapper(props);
27325
- var ImageChoiceMapper = (props) => {
27326
- const {
27327
- isMultipleAnswers,
27328
- choiceImageResize
27329
- } = props;
27330
- return {
27331
- ...props,
27332
- ...BaseMapper(props),
27333
- multiple: isMultipleAnswers,
27334
- imageAspectRatio: choiceImageResize
27335
- };
27336
- };
27337
- var DefaultMapper = (props) => {
27338
- const {
27339
- error,
27340
- ...rest
27341
- } = props;
27342
- return {
27343
- ...rest,
27344
- error: ErrorMapper(error)
27345
- };
27346
- };
27347
- var FIELD_PROPS_MAPPERS = {
27348
- TEXT_INPUT: TextFieldMapper,
27349
- TEXT_AREA: TextAreaMapper,
27350
- NUMBER_INPUT: NumberInputMapper,
27351
- URL_INPUT: TextFieldMapper,
27352
- DATE_INPUT: DateInputMapper,
27353
- DATE_PICKER: DatePickerMapper,
27354
- DATE_TIME_INPUT: DateTimeInputMapper,
27355
- TIME_INPUT: TimeInputMapper,
27356
- CONTACTS_COMPANY: TextFieldMapper,
27357
- CONTACTS_POSITION: TextFieldMapper,
27358
- CONTACTS_TAX_ID: TextFieldMapper,
27359
- CONTACTS_FIRST_NAME: TextFieldMapper,
27360
- CONTACTS_LAST_NAME: TextFieldMapper,
27361
- CONTACTS_EMAIL: TextFieldMapper,
27362
- CONTACTS_BIRTHDATE: DateInputMapper,
27363
- CONTACTS_PHONE: PhoneInputMapper,
27364
- CONTACTS_ADDRESS: TextFieldMapper,
27365
- CONTACTS_SUBSCRIBE: CheckboxMapper,
27366
- RADIO_GROUP: RadioGroupMapper,
27367
- CHECKBOX: CheckboxMapper,
27368
- CHECKBOX_GROUP: CheckboxGroupMapper,
27369
- IMAGE_CHOICE: ImageChoiceMapper,
27370
- DROPDOWN: DropdownMapper,
27371
- TAGS: TagsMapper,
27372
- QUIZ_IMAGE_CHOICE: ImageChoiceMapper,
27373
- QUIZ_MULTI_CHOICE: CheckboxGroupMapper,
27374
- QUIZ_SINGLE_CHOICE: RadioGroupMapper,
27375
- QUIZ_SHORT_TEXT: TextFieldMapper,
27376
- QUIZ_LONG_TEXT: TextAreaMapper,
27377
- QUIZ_NUMBER: NumberInputMapper,
27378
- QUIZ_FILE_UPLOAD: FileUploadMapper,
27379
- DEXT_TEXT_INPUT: TextFieldMapper,
27380
- DEXT_TEXT_AREA: TextAreaMapper,
27381
- DEXT_DROPDOWN: DropdownMapper,
27382
- DEXT_URL_INPUT: TextFieldMapper,
27383
- DEXT_RADIO_GROUP: RadioGroupMapper,
27384
- DEXT_NUMBER_INPUT: NumberInputMapper,
27385
- DEXT_CHECKBOX: CheckboxMapper,
27386
- DEXT_CHECKBOX_GROUP: CheckboxGroupMapper,
27387
- DEXT_EMAIL: TextFieldMapper,
27388
- DEXT_PHONE: PhoneInputMapper,
27389
- DEXT_RATING_INPUT: RatingInputMapper,
27390
- DEXT_DATE_PICKER: DatePickerMapper,
27391
- DEXT_DATE_TIME_INPUT: DateTimeInputMapper,
27392
- DEXT_TAGS: TagsMapper,
27393
- MULTILINE_ADDRESS: MultilineAddressMapper,
27394
- MLA_COUNTRY: DropdownMapper,
27395
- MLA_CITY: TextFieldMapper,
27396
- MLA_ADDRESS_LINE: TextFieldMapper,
27397
- MLA_ADDRESS_LINE_2: TextFieldMapper,
27398
- MLA_POSTAL_CODE: TextFieldMapper,
27399
- MLA_SUBDIVISION: DropdownMapper,
27400
- MLA_STREET_NAME: TextFieldMapper,
27401
- MLA_STREET_NUMBER: TextFieldMapper,
27402
- MLA_APARTMENT: TextFieldMapper,
27403
- FULL_NAME: TextFieldMapper,
27404
- FULL_NAME_FIRST_NAME: TextFieldMapper,
27405
- FULL_NAME_LAST_NAME: TextFieldMapper,
27406
- ECOM_ADDITIONAL_INFO: TextAreaMapper,
27407
- ECOM_ADDRESS: TextFieldMapper,
27408
- ECOM_FULL_NAME: TextFieldMapper,
27409
- ECOM_PHONE: PhoneInputMapper,
27410
- ECOM_COMPANY_NAME: TextFieldMapper,
27411
- ECOM_EMAIL: TextFieldMapper,
27412
- ECOM_SUBSCRIPTION: CheckboxMapper,
27413
- ECOM_CONTACT_DETAILS: TextMapper,
27414
- ECOM_SHIPPING_DETAILS: TextMapper,
27415
- BOOKINGS_FIRST_NAME: TextFieldMapper,
27416
- BOOKINGS_LAST_NAME: TextFieldMapper,
27417
- BOOKINGS_EMAIL: TextFieldMapper,
27418
- BOOKINGS_PHONE: PhoneInputMapper,
27419
- BOOKINGS_ADDRESS: TextFieldMapper,
27420
- BOOKINGS_HEADER: TextMapper,
27421
- BOOKINGS_RICH_TEXT: TextMapper,
27422
- BOOKINGS_LOGIN_BAR: DefaultMapper,
27423
- APPOINTMENT: AppointmentMapper,
27424
- SERVICES_DROPDOWN: DropdownMapper,
27425
- SERVICES_MULTI_CHOICE: CheckboxGroupMapper,
27426
- PRODUCT_LIST: ProductListMapper,
27427
- FIXED_PAYMENT: FixedPaymentMapper,
27428
- PAYMENT_INPUT: PaymentInputMapper,
27429
- DONATION: DonationMapper,
27430
- EVENTS_RSVP: RadioGroupMapper,
27431
- EVENTS_REPEATER: TextMapper,
27432
- FILE_UPLOAD: FileUploadMapper,
27433
- SIGNATURE: SignatureMapper,
27434
- RATING_INPUT: RatingInputMapper,
27435
- VAT_ID: TextFieldMapper,
27436
- NESTED_FORM: DefaultMapper,
27437
- HEADER: TextMapper,
27438
- RICH_TEXT: TextMapper,
27439
- SUBMIT_BUTTON: SubmitButtonMapper,
27440
- PASSWORD: DefaultMapper,
27441
- PHONE: PhoneInputMapper
27442
- };
27443
-
27444
27069
  // ../form-fields/dist/esm/services/field-attributes.js
27445
27070
  function getInputId(fieldId, uniqueId) {
27446
27071
  return `form-field-input-${fieldId}-${uniqueId}`;
@@ -27514,7 +27139,6 @@ var InputField = (_ref) => {
27514
27139
  requiredIndicator,
27515
27140
  requiredIndicatorPlacement
27516
27141
  } = form.requiredIndicatorProperties || {};
27517
- const propsMapper = FIELD_PROPS_MAPPERS[field.fieldType] || BaseMapper;
27518
27142
  const _onBlur = React42.useCallback(() => {
27519
27143
  const currentFieldValue = fieldValueRef.current;
27520
27144
  bi == null || bi.report(formFieldFocus({
@@ -27591,24 +27215,6 @@ var InputField = (_ref) => {
27591
27215
  value: fieldAttributes
27592
27216
  }, /* @__PURE__ */ React42__namespace.default.createElement(FieldPropsContext.Provider, {
27593
27217
  value: {
27594
- ...propsMapper({
27595
- ...field.properties,
27596
- id: field.id,
27597
- target: field.target,
27598
- path: field.path,
27599
- error: fieldError,
27600
- errors: fieldErrors,
27601
- value: fieldValue,
27602
- externalData,
27603
- fieldType: field.fieldType,
27604
- requiredIndicatorType: requiredIndicator,
27605
- requiredIndicatorPlacement
27606
- }),
27607
- onChange: handleChange,
27608
- onBlur: _onBlur,
27609
- onFocus: _onFocus,
27610
- hasError,
27611
- errorMessage,
27612
27218
  v2: fieldProps
27613
27219
  }
27614
27220
  }, /* @__PURE__ */ React42__namespace.default.createElement(FieldComponent, fieldProps)));
@@ -27625,7 +27231,6 @@ var ReadOnlyField = (_ref) => {
27625
27231
  requiredIndicator,
27626
27232
  requiredIndicatorPlacement
27627
27233
  } = form.requiredIndicatorProperties || {};
27628
- const propsMapper = FIELD_PROPS_MAPPERS[field.fieldType] || BaseMapper;
27629
27234
  const FieldComponent = componentsById[field.fieldType];
27630
27235
  if (!FieldComponent) {
27631
27236
  return null;
@@ -27641,14 +27246,6 @@ var ReadOnlyField = (_ref) => {
27641
27246
  };
27642
27247
  return /* @__PURE__ */ React42__namespace.default.createElement(FieldPropsContext.Provider, {
27643
27248
  value: {
27644
- ...propsMapper({
27645
- ...field.properties,
27646
- id: field.id,
27647
- externalData,
27648
- fieldType: field.fieldType,
27649
- requiredIndicatorType: requiredIndicator,
27650
- requiredIndicatorPlacement
27651
- }),
27652
27249
  v2: fieldProps
27653
27250
  }
27654
27251
  }, /* @__PURE__ */ React42__namespace.default.createElement(FieldComponent, fieldProps));
@@ -27675,7 +27272,6 @@ var NestedFormField = (_ref) => {
27675
27272
  requiredIndicator,
27676
27273
  requiredIndicatorPlacement
27677
27274
  } = form.requiredIndicatorProperties || {};
27678
- const propsMapper = FIELD_PROPS_MAPPERS[field.fieldType] || BaseMapper;
27679
27275
  const handleChange = React42.useCallback((value) => {
27680
27276
  if (!value) {
27681
27277
  value = null;
@@ -27703,20 +27299,6 @@ var NestedFormField = (_ref) => {
27703
27299
  };
27704
27300
  return /* @__PURE__ */ React42__namespace.default.createElement(FieldPropsContext.Provider, {
27705
27301
  value: {
27706
- ...propsMapper({
27707
- ...field.properties,
27708
- id: field.id,
27709
- target: field.target,
27710
- path: field.path,
27711
- error: fieldError,
27712
- errors: fieldErrors,
27713
- value: fieldValue,
27714
- externalData,
27715
- fieldType: field.fieldType,
27716
- requiredIndicatorType: requiredIndicator,
27717
- requiredIndicatorPlacement
27718
- }),
27719
- onChange: handleChange,
27720
27302
  v2: fieldProps
27721
27303
  }
27722
27304
  }, /* @__PURE__ */ React42__namespace.default.createElement(FieldComponent, fieldProps));
@@ -27823,7 +27405,6 @@ var SubmitButtonField = (_ref) => {
27823
27405
  const submitButtonText = submitText || text || "";
27824
27406
  const previousButtonText = previousText || "";
27825
27407
  const nextButtonText = nextText || "";
27826
- const propsMapper = FIELD_PROPS_MAPPERS[field.fieldType] || BaseMapper;
27827
27408
  const FieldComponent = componentsById[field.fieldType];
27828
27409
  if (!FieldComponent) {
27829
27410
  return null;
@@ -27849,24 +27430,6 @@ var SubmitButtonField = (_ref) => {
27849
27430
  };
27850
27431
  return /* @__PURE__ */ React42__namespace.default.createElement(FieldPropsContext.Provider, {
27851
27432
  value: {
27852
- ...propsMapper({
27853
- ...field.properties,
27854
- id: field.id,
27855
- externalData,
27856
- fieldType: field.fieldType,
27857
- hasSteps,
27858
- isDisabled,
27859
- isInProgress,
27860
- showPreviousButton,
27861
- showNextButton,
27862
- showSubmitButton,
27863
- submitText: submitButtonText,
27864
- previousText: previousButtonText,
27865
- nextText: nextButtonText,
27866
- onSubmitClick: handleSubmitClick,
27867
- onPreviousClick: () => actions == null ? void 0 : actions.setPreviousStep(),
27868
- onNextClick: () => actions == null ? void 0 : actions.setNextStep()
27869
- }),
27870
27433
  v2: fieldProps
27871
27434
  }
27872
27435
  }, /* @__PURE__ */ React42__namespace.default.createElement(FieldComponent, fieldProps));