@wix/form-public 0.134.0 → 0.136.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
@@ -33406,7 +33406,8 @@ var CheckboxContainer = (_ref2) => {
33406
33406
  disabled,
33407
33407
  required,
33408
33408
  onBlur,
33409
- onFocus
33409
+ onFocus,
33410
+ hasError
33410
33411
  } = useFieldPropsV2();
33411
33412
  const {
33412
33413
  inputId,
@@ -33430,6 +33431,7 @@ var CheckboxContainer = (_ref2) => {
33430
33431
  onChange: handleChange,
33431
33432
  isDisabled: disabled,
33432
33433
  isRequired: required,
33434
+ isInvalid: hasError,
33433
33435
  onBlur,
33434
33436
  onFocus,
33435
33437
  className
@@ -34023,7 +34025,8 @@ var Month = (_ref2) => {
34023
34025
  }, /* @__PURE__ */ React45__default.createElement(Button, {
34024
34026
  ref: buttonRef,
34025
34027
  id: inputId,
34026
- "data-hook": SupportedDateParts.MONTH
34028
+ "data-hook": SupportedDateParts.MONTH,
34029
+ "data-invalid": partError
34027
34030
  }, /* @__PURE__ */ React45__default.createElement(SelectValue, null)), optionsElement));
34028
34031
  };
34029
34032
  var MonthLabel = (_ref3) => {
@@ -34994,7 +34997,9 @@ var DatePicker = (_ref) => {
34994
34997
  required,
34995
34998
  onBlur,
34996
34999
  onFocus,
34997
- FieldLayout
35000
+ FieldLayout,
35001
+ hasError,
35002
+ readOnly
34998
35003
  } = useFieldPropsV2();
34999
35004
  const handleChange = useCallback((dateValue2) => {
35000
35005
  const stringValue = dateValueToString(dateValue2);
@@ -35013,6 +35018,8 @@ var DatePicker = (_ref) => {
35013
35018
  value: dateValue,
35014
35019
  onChange: handleChange,
35015
35020
  isDisabled: disabled,
35021
+ isInvalid: hasError,
35022
+ isReadOnly: readOnly,
35016
35023
  isRequired: required,
35017
35024
  onBlur,
35018
35025
  onFocus
@@ -35029,10 +35036,14 @@ var Control = (_ref2) => {
35029
35036
  inputId,
35030
35037
  ariaDescribedBy
35031
35038
  } = useFieldAttributes2();
35039
+ const {
35040
+ hasError
35041
+ } = useFieldPropsV2();
35032
35042
  return /* @__PURE__ */ React45__default.createElement(Group, {
35033
35043
  id: inputId,
35034
35044
  "aria-describedby": ariaDescribedBy,
35035
- className
35045
+ className,
35046
+ "data-invalid": hasError
35036
35047
  }, children);
35037
35048
  };
35038
35049
  var Input2 = (_ref3) => {
@@ -35231,7 +35242,8 @@ var Month2 = (_ref2) => {
35231
35242
  }, /* @__PURE__ */ React45__default.createElement(Button, {
35232
35243
  ref: buttonRef,
35233
35244
  id: inputId,
35234
- "data-hook": SupportedDateParts.MONTH
35245
+ "data-hook": SupportedDateParts.MONTH,
35246
+ "data-invalid": partError
35235
35247
  }, /* @__PURE__ */ React45__default.createElement(SelectValue, null)), optionsElement));
35236
35248
  };
35237
35249
  var MonthLabel2 = (_ref3) => {
@@ -35692,7 +35704,8 @@ var Dropdown = (_ref) => {
35692
35704
  required,
35693
35705
  onBlur,
35694
35706
  onFocus,
35695
- FieldLayout
35707
+ FieldLayout,
35708
+ hasError
35696
35709
  } = useFieldPropsV2();
35697
35710
  const handleChange = useCallback((selectedValue) => {
35698
35711
  onChange(typeof selectedValue === "string" ? selectedValue : null);
@@ -35709,6 +35722,7 @@ var Dropdown = (_ref) => {
35709
35722
  value: value ?? null,
35710
35723
  onChange: handleChange,
35711
35724
  isDisabled: disabled,
35725
+ isInvalid: hasError,
35712
35726
  isRequired: required,
35713
35727
  placeholder,
35714
35728
  onBlur,
@@ -35726,7 +35740,8 @@ var Trigger2 = (_ref2) => {
35726
35740
  ariaDescribedBy
35727
35741
  } = useFieldAttributes2();
35728
35742
  const {
35729
- id
35743
+ id,
35744
+ hasError
35730
35745
  } = useFieldPropsV2();
35731
35746
  const ref = useRef(null);
35732
35747
  useFocusFieldEvent(() => {
@@ -35737,7 +35752,8 @@ var Trigger2 = (_ref2) => {
35737
35752
  ref,
35738
35753
  id: inputId,
35739
35754
  "aria-describedby": ariaDescribedBy,
35740
- className
35755
+ className,
35756
+ "data-invalid": hasError
35741
35757
  }, /* @__PURE__ */ React45__default.createElement(SelectValue, null));
35742
35758
  };
35743
35759
  var Options2 = (_ref3) => {
@@ -35798,7 +35814,8 @@ var DropZone = (_ref) => {
35798
35814
  ariaDescribedBy
35799
35815
  } = useFieldAttributes2();
35800
35816
  const {
35801
- disabled
35817
+ disabled,
35818
+ hasError
35802
35819
  } = useFieldPropsV2();
35803
35820
  const {
35804
35821
  handleFileChange,
@@ -35810,6 +35827,7 @@ var DropZone = (_ref) => {
35810
35827
  return /* @__PURE__ */ React45__default.createElement(DropZone$1, {
35811
35828
  "aria-describedby": ariaDescribedBy,
35812
35829
  className,
35830
+ "data-invalid": hasError,
35813
35831
  isDisabled: disabled,
35814
35832
  onDrop: async (e2) => {
35815
35833
  const droppedFiles = [];
@@ -39433,7 +39451,8 @@ var CountryButton = (_ref3) => {
39433
39451
  labelId
39434
39452
  } = useFieldAttributes2();
39435
39453
  const {
39436
- id
39454
+ id,
39455
+ hasError
39437
39456
  } = useFieldPropsV2();
39438
39457
  const {
39439
39458
  t
@@ -39457,7 +39476,8 @@ var CountryButton = (_ref3) => {
39457
39476
  id: buttonId,
39458
39477
  "aria-label": ariaLabel,
39459
39478
  "aria-labelledby": labelId ? `${labelId} ${buttonId}` : void 0,
39460
- className
39479
+ className,
39480
+ "data-invalid": hasError
39461
39481
  }, children);
39462
39482
  };
39463
39483
  var CountryButtonFlag = (_ref4) => {
@@ -39636,7 +39656,8 @@ var Control3 = (_ref10) => {
39636
39656
  } = _ref10;
39637
39657
  const {
39638
39658
  disabled,
39639
- required
39659
+ required,
39660
+ hasError
39640
39661
  } = useFieldPropsV2();
39641
39662
  const {
39642
39663
  selectedCountryCode,
@@ -39651,6 +39672,7 @@ var Control3 = (_ref10) => {
39651
39672
  value: selectedCountryCode ?? null,
39652
39673
  onChange: (key) => handleCountryCodeChange(key),
39653
39674
  isDisabled: disabled,
39675
+ isInvalid: hasError,
39654
39676
  isRequired: required,
39655
39677
  placeholder: ""
39656
39678
  }, countryButtonElement, countryOptionsElement), phoneNumberElement);
@@ -39686,6 +39708,7 @@ var RadioGroup = (_ref) => {
39686
39708
  required,
39687
39709
  onBlur,
39688
39710
  onFocus,
39711
+ hasError,
39689
39712
  FieldLayout
39690
39713
  } = useFieldPropsV2();
39691
39714
  const {
@@ -39710,6 +39733,7 @@ var RadioGroup = (_ref) => {
39710
39733
  onChange,
39711
39734
  isDisabled: disabled,
39712
39735
  isRequired: required,
39736
+ isInvalid: hasError,
39713
39737
  onBlur,
39714
39738
  onFocus
39715
39739
  }, optionsElement),
@@ -39726,7 +39750,8 @@ var Options8 = (_ref2) => {
39726
39750
  addOther,
39727
39751
  addOtherLabel,
39728
39752
  id,
39729
- numberOfColumns
39753
+ numberOfColumns,
39754
+ hasError
39730
39755
  } = useFieldPropsV2();
39731
39756
  const {
39732
39757
  t
@@ -39740,7 +39765,8 @@ var Options8 = (_ref2) => {
39740
39765
  }, id);
39741
39766
  return /* @__PURE__ */ React45__default.createElement("div", {
39742
39767
  className,
39743
- "data-columns": numberOfColumns
39768
+ "data-columns": numberOfColumns,
39769
+ "data-invalid": hasError
39744
39770
  }, options.map((option, index) => applyInternalProps(optionElement, {
39745
39771
  key: option.value ?? option.label,
39746
39772
  value: option.value ?? option.label,
@@ -39898,7 +39924,8 @@ var Stars = (_ref2) => {
39898
39924
  className
39899
39925
  } = _ref2;
39900
39926
  const {
39901
- value
39927
+ value,
39928
+ hasError
39902
39929
  } = useFieldPropsV2();
39903
39930
  const {
39904
39931
  inputId,
@@ -39913,7 +39940,8 @@ var Stars = (_ref2) => {
39913
39940
  ref: containerRef,
39914
39941
  id: inputId,
39915
39942
  "aria-describedby": ariaDescribedBy,
39916
- className
39943
+ className,
39944
+ "data-invalid": hasError
39917
39945
  }, starValues.map((starValue) => applyInternalProps(starElement, {
39918
39946
  key: starValue,
39919
39947
  value: starValue,
@@ -40092,6 +40120,7 @@ var Control4 = (_ref5) => {
40092
40120
  const {
40093
40121
  addOther,
40094
40122
  addOtherLabel,
40123
+ hasError,
40095
40124
  value: fieldValue
40096
40125
  } = useFieldPropsV2();
40097
40126
  const {
@@ -40107,7 +40136,8 @@ var Control4 = (_ref5) => {
40107
40136
  return fieldValue.some((val) => val === otherLabel || val.startsWith(`${otherLabel}:`));
40108
40137
  }, [addOther, fieldValue, otherLabel]);
40109
40138
  return /* @__PURE__ */ React45__default.createElement("div", {
40110
- className
40139
+ className,
40140
+ "data-invalid": hasError
40111
40141
  }, optionsElement, isOtherSelected && otherInputElement);
40112
40142
  };
40113
40143
  var Tags = (_ref6) => {
@@ -40119,8 +40149,16 @@ var Tags = (_ref6) => {
40119
40149
  value,
40120
40150
  onChange,
40121
40151
  addOtherLabel,
40122
- FieldLayout
40152
+ FieldLayout,
40153
+ required,
40154
+ onBlur,
40155
+ onFocus
40123
40156
  } = useFieldPropsV2();
40157
+ const {
40158
+ inputId,
40159
+ labelId,
40160
+ ariaDescribedBy
40161
+ } = useFieldAttributes2();
40124
40162
  const {
40125
40163
  t
40126
40164
  } = useTranslation();
@@ -40155,11 +40193,18 @@ var Tags = (_ref6) => {
40155
40193
  return /* @__PURE__ */ React45__default.createElement(FieldLayout, {
40156
40194
  fieldId: id,
40157
40195
  renderLabel: () => labelElement,
40158
- renderInput: () => /* @__PURE__ */ React45__default.createElement(TagGroup, {
40196
+ renderInput: () => /* @__PURE__ */ React45__default.createElement(FieldsetHeadless, {
40197
+ id: inputId,
40198
+ ariaLabelledBy: labelId,
40199
+ ariaDescribedBy,
40200
+ required,
40201
+ onBlur,
40202
+ onFocus
40203
+ }, /* @__PURE__ */ React45__default.createElement(TagGroup, {
40159
40204
  selectionMode: "multiple",
40160
40205
  selectedKeys,
40161
40206
  onSelectionChange: handleSelectionChange
40162
- }, controlElement),
40207
+ }, controlElement)),
40163
40208
  renderDescription: () => /* @__PURE__ */ React45__default.createElement(React45__default.Fragment, null, descriptionElement, errorElement)
40164
40209
  });
40165
40210
  };
@@ -40183,7 +40228,8 @@ var TextArea = (_ref) => {
40183
40228
  required,
40184
40229
  onBlur,
40185
40230
  onFocus,
40186
- FieldLayout
40231
+ FieldLayout,
40232
+ hasError
40187
40233
  } = useFieldPropsV2();
40188
40234
  const handleChange = useCallback((newValue) => {
40189
40235
  onChange(newValue);
@@ -40200,6 +40246,7 @@ var TextArea = (_ref) => {
40200
40246
  onChange: handleChange,
40201
40247
  isDisabled: disabled,
40202
40248
  isRequired: required,
40249
+ isInvalid: hasError,
40203
40250
  onBlur,
40204
40251
  onFocus
40205
40252
  }, inputElement),
@@ -40314,7 +40361,8 @@ var TimeInput2 = (_ref) => {
40314
40361
  onBlur,
40315
40362
  onFocus,
40316
40363
  use24HourFormat,
40317
- FieldLayout
40364
+ FieldLayout,
40365
+ hasError
40318
40366
  } = useFieldPropsV2();
40319
40367
  const {
40320
40368
  inputId,
@@ -40338,6 +40386,7 @@ var TimeInput2 = (_ref) => {
40338
40386
  value: timeValue,
40339
40387
  onChange: handleChange,
40340
40388
  isDisabled: disabled,
40389
+ isInvalid: hasError,
40341
40390
  isRequired: required,
40342
40391
  onBlur,
40343
40392
  onFocus,
@@ -40351,11 +40400,15 @@ var Time2 = (_ref2) => {
40351
40400
  children,
40352
40401
  className
40353
40402
  } = _ref2;
40403
+ const {
40404
+ hasError
40405
+ } = useFieldPropsV2();
40354
40406
  const hourElement = findChildOfType(children, Time2.Hour);
40355
40407
  const minuteElement = findChildOfType(children, Time2.Minute);
40356
40408
  const periodElement = findChildOfType(children, Time2.Period);
40357
40409
  return /* @__PURE__ */ React45__default.createElement(DateInput$1, {
40358
- className
40410
+ className,
40411
+ "data-invalid": hasError
40359
40412
  }, (segment) => {
40360
40413
  switch (segment.type) {
40361
40414
  case "hour":
@@ -41135,7 +41188,8 @@ var Donation = (_ref) => {
41135
41188
  validation,
41136
41189
  addOther,
41137
41190
  addOtherPlaceholder,
41138
- FieldLayout
41191
+ FieldLayout,
41192
+ hasError
41139
41193
  } = useFieldPropsV2();
41140
41194
  const {
41141
41195
  t
@@ -41197,6 +41251,7 @@ var Donation = (_ref) => {
41197
41251
  value: selectedValue,
41198
41252
  onChange: handleRadioChange,
41199
41253
  isDisabled: disabled,
41254
+ isInvalid: hasError,
41200
41255
  isRequired: required,
41201
41256
  onBlur,
41202
41257
  onFocus
@@ -41231,10 +41286,14 @@ var Control5 = (_ref2) => {
41231
41286
  customAmountProductId,
41232
41287
  onFocusCustomInput
41233
41288
  } = internal;
41289
+ const {
41290
+ hasError
41291
+ } = useFieldPropsV2();
41234
41292
  const optionsElement = findChildOfType(children, Donation.Options);
41235
41293
  const otherInputElement = findChildOfType(children, Donation.OtherInput);
41236
41294
  return /* @__PURE__ */ React45__default.createElement("div", {
41237
- className
41295
+ className,
41296
+ "data-invalid": hasError
41238
41297
  }, optionsElement ? applyInternalProps(optionsElement, {
41239
41298
  productsById,
41240
41299
  addOther,
@@ -41369,7 +41428,8 @@ var OtherInput3 = (_ref7) => {
41369
41428
  onFocusCustomInput
41370
41429
  } = internal;
41371
41430
  const {
41372
- disabled
41431
+ disabled,
41432
+ hasError
41373
41433
  } = useFieldPropsV2();
41374
41434
  const currencyElement = findChildOfType(children, OtherInput3.Currency);
41375
41435
  const valueElement = findChildOfType(children, OtherInput3.Value);
@@ -41390,6 +41450,7 @@ var OtherInput3 = (_ref7) => {
41390
41450
  onChange: handleChange,
41391
41451
  onFocus: handleFocus,
41392
41452
  isDisabled: disabled,
41453
+ isInvalid: hasError,
41393
41454
  className,
41394
41455
  "data-selected": hasValue ? "true" : void 0
41395
41456
  }, customAmount && currency && currencyElement ? applyInternalProps(currencyElement, {
@@ -43126,7 +43187,8 @@ var Value2 = (_ref8) => {
43126
43187
  const {
43127
43188
  readOnly,
43128
43189
  onBlur,
43129
- onFocus
43190
+ onFocus,
43191
+ hasError
43130
43192
  } = useFieldPropsV2();
43131
43193
  const {
43132
43194
  t
@@ -43137,7 +43199,8 @@ var Value2 = (_ref8) => {
43137
43199
  return /* @__PURE__ */ React45__default.createElement("div", {
43138
43200
  className,
43139
43201
  role: "region",
43140
- "aria-label": t("field.signature.input-area") || "Signature input area"
43202
+ "aria-label": t("field.signature.input-area") || "Signature input area",
43203
+ "data-invalid": hasError
43141
43204
  }, signatureView === SignatureView.DRAW && applyInternalProps(canvasElement, {
43142
43205
  value: signatureValueForView,
43143
43206
  onChange: handleChange,