@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.cjs CHANGED
@@ -33432,7 +33432,8 @@ var CheckboxContainer = (_ref2) => {
33432
33432
  disabled,
33433
33433
  required,
33434
33434
  onBlur,
33435
- onFocus
33435
+ onFocus,
33436
+ hasError
33436
33437
  } = useFieldPropsV2();
33437
33438
  const {
33438
33439
  inputId,
@@ -33456,6 +33457,7 @@ var CheckboxContainer = (_ref2) => {
33456
33457
  onChange: handleChange,
33457
33458
  isDisabled: disabled,
33458
33459
  isRequired: required,
33460
+ isInvalid: hasError,
33459
33461
  onBlur,
33460
33462
  onFocus,
33461
33463
  className
@@ -34049,7 +34051,8 @@ var Month = (_ref2) => {
34049
34051
  }, /* @__PURE__ */ React45__namespace.default.createElement(reactAriaComponents.Button, {
34050
34052
  ref: buttonRef,
34051
34053
  id: inputId,
34052
- "data-hook": SupportedDateParts.MONTH
34054
+ "data-hook": SupportedDateParts.MONTH,
34055
+ "data-invalid": partError
34053
34056
  }, /* @__PURE__ */ React45__namespace.default.createElement(reactAriaComponents.SelectValue, null)), optionsElement));
34054
34057
  };
34055
34058
  var MonthLabel = (_ref3) => {
@@ -35020,7 +35023,9 @@ var DatePicker = (_ref) => {
35020
35023
  required,
35021
35024
  onBlur,
35022
35025
  onFocus,
35023
- FieldLayout
35026
+ FieldLayout,
35027
+ hasError,
35028
+ readOnly
35024
35029
  } = useFieldPropsV2();
35025
35030
  const handleChange = React45.useCallback((dateValue2) => {
35026
35031
  const stringValue = dateValueToString(dateValue2);
@@ -35039,6 +35044,8 @@ var DatePicker = (_ref) => {
35039
35044
  value: dateValue,
35040
35045
  onChange: handleChange,
35041
35046
  isDisabled: disabled,
35047
+ isInvalid: hasError,
35048
+ isReadOnly: readOnly,
35042
35049
  isRequired: required,
35043
35050
  onBlur,
35044
35051
  onFocus
@@ -35055,10 +35062,14 @@ var Control = (_ref2) => {
35055
35062
  inputId,
35056
35063
  ariaDescribedBy
35057
35064
  } = useFieldAttributes2();
35065
+ const {
35066
+ hasError
35067
+ } = useFieldPropsV2();
35058
35068
  return /* @__PURE__ */ React45__namespace.default.createElement(reactAriaComponents.Group, {
35059
35069
  id: inputId,
35060
35070
  "aria-describedby": ariaDescribedBy,
35061
- className
35071
+ className,
35072
+ "data-invalid": hasError
35062
35073
  }, children);
35063
35074
  };
35064
35075
  var Input2 = (_ref3) => {
@@ -35257,7 +35268,8 @@ var Month2 = (_ref2) => {
35257
35268
  }, /* @__PURE__ */ React45__namespace.default.createElement(reactAriaComponents.Button, {
35258
35269
  ref: buttonRef,
35259
35270
  id: inputId,
35260
- "data-hook": SupportedDateParts.MONTH
35271
+ "data-hook": SupportedDateParts.MONTH,
35272
+ "data-invalid": partError
35261
35273
  }, /* @__PURE__ */ React45__namespace.default.createElement(reactAriaComponents.SelectValue, null)), optionsElement));
35262
35274
  };
35263
35275
  var MonthLabel2 = (_ref3) => {
@@ -35718,7 +35730,8 @@ var Dropdown = (_ref) => {
35718
35730
  required,
35719
35731
  onBlur,
35720
35732
  onFocus,
35721
- FieldLayout
35733
+ FieldLayout,
35734
+ hasError
35722
35735
  } = useFieldPropsV2();
35723
35736
  const handleChange = React45.useCallback((selectedValue) => {
35724
35737
  onChange(typeof selectedValue === "string" ? selectedValue : null);
@@ -35735,6 +35748,7 @@ var Dropdown = (_ref) => {
35735
35748
  value: value ?? null,
35736
35749
  onChange: handleChange,
35737
35750
  isDisabled: disabled,
35751
+ isInvalid: hasError,
35738
35752
  isRequired: required,
35739
35753
  placeholder,
35740
35754
  onBlur,
@@ -35752,7 +35766,8 @@ var Trigger2 = (_ref2) => {
35752
35766
  ariaDescribedBy
35753
35767
  } = useFieldAttributes2();
35754
35768
  const {
35755
- id
35769
+ id,
35770
+ hasError
35756
35771
  } = useFieldPropsV2();
35757
35772
  const ref = React45.useRef(null);
35758
35773
  useFocusFieldEvent(() => {
@@ -35763,7 +35778,8 @@ var Trigger2 = (_ref2) => {
35763
35778
  ref,
35764
35779
  id: inputId,
35765
35780
  "aria-describedby": ariaDescribedBy,
35766
- className
35781
+ className,
35782
+ "data-invalid": hasError
35767
35783
  }, /* @__PURE__ */ React45__namespace.default.createElement(reactAriaComponents.SelectValue, null));
35768
35784
  };
35769
35785
  var Options2 = (_ref3) => {
@@ -35824,7 +35840,8 @@ var DropZone = (_ref) => {
35824
35840
  ariaDescribedBy
35825
35841
  } = useFieldAttributes2();
35826
35842
  const {
35827
- disabled
35843
+ disabled,
35844
+ hasError
35828
35845
  } = useFieldPropsV2();
35829
35846
  const {
35830
35847
  handleFileChange,
@@ -35836,6 +35853,7 @@ var DropZone = (_ref) => {
35836
35853
  return /* @__PURE__ */ React45__namespace.default.createElement(reactAriaComponents.DropZone, {
35837
35854
  "aria-describedby": ariaDescribedBy,
35838
35855
  className,
35856
+ "data-invalid": hasError,
35839
35857
  isDisabled: disabled,
35840
35858
  onDrop: async (e2) => {
35841
35859
  const droppedFiles = [];
@@ -39459,7 +39477,8 @@ var CountryButton = (_ref3) => {
39459
39477
  labelId
39460
39478
  } = useFieldAttributes2();
39461
39479
  const {
39462
- id
39480
+ id,
39481
+ hasError
39463
39482
  } = useFieldPropsV2();
39464
39483
  const {
39465
39484
  t
@@ -39483,7 +39502,8 @@ var CountryButton = (_ref3) => {
39483
39502
  id: buttonId,
39484
39503
  "aria-label": ariaLabel,
39485
39504
  "aria-labelledby": labelId ? `${labelId} ${buttonId}` : void 0,
39486
- className
39505
+ className,
39506
+ "data-invalid": hasError
39487
39507
  }, children);
39488
39508
  };
39489
39509
  var CountryButtonFlag = (_ref4) => {
@@ -39662,7 +39682,8 @@ var Control3 = (_ref10) => {
39662
39682
  } = _ref10;
39663
39683
  const {
39664
39684
  disabled,
39665
- required
39685
+ required,
39686
+ hasError
39666
39687
  } = useFieldPropsV2();
39667
39688
  const {
39668
39689
  selectedCountryCode,
@@ -39677,6 +39698,7 @@ var Control3 = (_ref10) => {
39677
39698
  value: selectedCountryCode ?? null,
39678
39699
  onChange: (key) => handleCountryCodeChange(key),
39679
39700
  isDisabled: disabled,
39701
+ isInvalid: hasError,
39680
39702
  isRequired: required,
39681
39703
  placeholder: ""
39682
39704
  }, countryButtonElement, countryOptionsElement), phoneNumberElement);
@@ -39712,6 +39734,7 @@ var RadioGroup = (_ref) => {
39712
39734
  required,
39713
39735
  onBlur,
39714
39736
  onFocus,
39737
+ hasError,
39715
39738
  FieldLayout
39716
39739
  } = useFieldPropsV2();
39717
39740
  const {
@@ -39736,6 +39759,7 @@ var RadioGroup = (_ref) => {
39736
39759
  onChange,
39737
39760
  isDisabled: disabled,
39738
39761
  isRequired: required,
39762
+ isInvalid: hasError,
39739
39763
  onBlur,
39740
39764
  onFocus
39741
39765
  }, optionsElement),
@@ -39752,7 +39776,8 @@ var Options8 = (_ref2) => {
39752
39776
  addOther,
39753
39777
  addOtherLabel,
39754
39778
  id,
39755
- numberOfColumns
39779
+ numberOfColumns,
39780
+ hasError
39756
39781
  } = useFieldPropsV2();
39757
39782
  const {
39758
39783
  t
@@ -39766,7 +39791,8 @@ var Options8 = (_ref2) => {
39766
39791
  }, id);
39767
39792
  return /* @__PURE__ */ React45__namespace.default.createElement("div", {
39768
39793
  className,
39769
- "data-columns": numberOfColumns
39794
+ "data-columns": numberOfColumns,
39795
+ "data-invalid": hasError
39770
39796
  }, options.map((option, index) => applyInternalProps(optionElement, {
39771
39797
  key: option.value ?? option.label,
39772
39798
  value: option.value ?? option.label,
@@ -39924,7 +39950,8 @@ var Stars = (_ref2) => {
39924
39950
  className
39925
39951
  } = _ref2;
39926
39952
  const {
39927
- value
39953
+ value,
39954
+ hasError
39928
39955
  } = useFieldPropsV2();
39929
39956
  const {
39930
39957
  inputId,
@@ -39939,7 +39966,8 @@ var Stars = (_ref2) => {
39939
39966
  ref: containerRef,
39940
39967
  id: inputId,
39941
39968
  "aria-describedby": ariaDescribedBy,
39942
- className
39969
+ className,
39970
+ "data-invalid": hasError
39943
39971
  }, starValues.map((starValue) => applyInternalProps(starElement, {
39944
39972
  key: starValue,
39945
39973
  value: starValue,
@@ -40118,6 +40146,7 @@ var Control4 = (_ref5) => {
40118
40146
  const {
40119
40147
  addOther,
40120
40148
  addOtherLabel,
40149
+ hasError,
40121
40150
  value: fieldValue
40122
40151
  } = useFieldPropsV2();
40123
40152
  const {
@@ -40133,7 +40162,8 @@ var Control4 = (_ref5) => {
40133
40162
  return fieldValue.some((val) => val === otherLabel || val.startsWith(`${otherLabel}:`));
40134
40163
  }, [addOther, fieldValue, otherLabel]);
40135
40164
  return /* @__PURE__ */ React45__namespace.default.createElement("div", {
40136
- className
40165
+ className,
40166
+ "data-invalid": hasError
40137
40167
  }, optionsElement, isOtherSelected && otherInputElement);
40138
40168
  };
40139
40169
  var Tags = (_ref6) => {
@@ -40145,8 +40175,16 @@ var Tags = (_ref6) => {
40145
40175
  value,
40146
40176
  onChange,
40147
40177
  addOtherLabel,
40148
- FieldLayout
40178
+ FieldLayout,
40179
+ required,
40180
+ onBlur,
40181
+ onFocus
40149
40182
  } = useFieldPropsV2();
40183
+ const {
40184
+ inputId,
40185
+ labelId,
40186
+ ariaDescribedBy
40187
+ } = useFieldAttributes2();
40150
40188
  const {
40151
40189
  t
40152
40190
  } = useTranslation();
@@ -40181,11 +40219,18 @@ var Tags = (_ref6) => {
40181
40219
  return /* @__PURE__ */ React45__namespace.default.createElement(FieldLayout, {
40182
40220
  fieldId: id,
40183
40221
  renderLabel: () => labelElement,
40184
- renderInput: () => /* @__PURE__ */ React45__namespace.default.createElement(reactAriaComponents.TagGroup, {
40222
+ renderInput: () => /* @__PURE__ */ React45__namespace.default.createElement(FieldsetHeadless, {
40223
+ id: inputId,
40224
+ ariaLabelledBy: labelId,
40225
+ ariaDescribedBy,
40226
+ required,
40227
+ onBlur,
40228
+ onFocus
40229
+ }, /* @__PURE__ */ React45__namespace.default.createElement(reactAriaComponents.TagGroup, {
40185
40230
  selectionMode: "multiple",
40186
40231
  selectedKeys,
40187
40232
  onSelectionChange: handleSelectionChange
40188
- }, controlElement),
40233
+ }, controlElement)),
40189
40234
  renderDescription: () => /* @__PURE__ */ React45__namespace.default.createElement(React45__namespace.default.Fragment, null, descriptionElement, errorElement)
40190
40235
  });
40191
40236
  };
@@ -40209,7 +40254,8 @@ var TextArea = (_ref) => {
40209
40254
  required,
40210
40255
  onBlur,
40211
40256
  onFocus,
40212
- FieldLayout
40257
+ FieldLayout,
40258
+ hasError
40213
40259
  } = useFieldPropsV2();
40214
40260
  const handleChange = React45.useCallback((newValue) => {
40215
40261
  onChange(newValue);
@@ -40226,6 +40272,7 @@ var TextArea = (_ref) => {
40226
40272
  onChange: handleChange,
40227
40273
  isDisabled: disabled,
40228
40274
  isRequired: required,
40275
+ isInvalid: hasError,
40229
40276
  onBlur,
40230
40277
  onFocus
40231
40278
  }, inputElement),
@@ -40340,7 +40387,8 @@ var TimeInput2 = (_ref) => {
40340
40387
  onBlur,
40341
40388
  onFocus,
40342
40389
  use24HourFormat,
40343
- FieldLayout
40390
+ FieldLayout,
40391
+ hasError
40344
40392
  } = useFieldPropsV2();
40345
40393
  const {
40346
40394
  inputId,
@@ -40364,6 +40412,7 @@ var TimeInput2 = (_ref) => {
40364
40412
  value: timeValue,
40365
40413
  onChange: handleChange,
40366
40414
  isDisabled: disabled,
40415
+ isInvalid: hasError,
40367
40416
  isRequired: required,
40368
40417
  onBlur,
40369
40418
  onFocus,
@@ -40377,11 +40426,15 @@ var Time2 = (_ref2) => {
40377
40426
  children,
40378
40427
  className
40379
40428
  } = _ref2;
40429
+ const {
40430
+ hasError
40431
+ } = useFieldPropsV2();
40380
40432
  const hourElement = findChildOfType(children, Time2.Hour);
40381
40433
  const minuteElement = findChildOfType(children, Time2.Minute);
40382
40434
  const periodElement = findChildOfType(children, Time2.Period);
40383
40435
  return /* @__PURE__ */ React45__namespace.default.createElement(reactAriaComponents.DateInput, {
40384
- className
40436
+ className,
40437
+ "data-invalid": hasError
40385
40438
  }, (segment) => {
40386
40439
  switch (segment.type) {
40387
40440
  case "hour":
@@ -41161,7 +41214,8 @@ var Donation = (_ref) => {
41161
41214
  validation,
41162
41215
  addOther,
41163
41216
  addOtherPlaceholder,
41164
- FieldLayout
41217
+ FieldLayout,
41218
+ hasError
41165
41219
  } = useFieldPropsV2();
41166
41220
  const {
41167
41221
  t
@@ -41223,6 +41277,7 @@ var Donation = (_ref) => {
41223
41277
  value: selectedValue,
41224
41278
  onChange: handleRadioChange,
41225
41279
  isDisabled: disabled,
41280
+ isInvalid: hasError,
41226
41281
  isRequired: required,
41227
41282
  onBlur,
41228
41283
  onFocus
@@ -41257,10 +41312,14 @@ var Control5 = (_ref2) => {
41257
41312
  customAmountProductId,
41258
41313
  onFocusCustomInput
41259
41314
  } = internal;
41315
+ const {
41316
+ hasError
41317
+ } = useFieldPropsV2();
41260
41318
  const optionsElement = findChildOfType(children, Donation.Options);
41261
41319
  const otherInputElement = findChildOfType(children, Donation.OtherInput);
41262
41320
  return /* @__PURE__ */ React45__namespace.default.createElement("div", {
41263
- className
41321
+ className,
41322
+ "data-invalid": hasError
41264
41323
  }, optionsElement ? applyInternalProps(optionsElement, {
41265
41324
  productsById,
41266
41325
  addOther,
@@ -41395,7 +41454,8 @@ var OtherInput3 = (_ref7) => {
41395
41454
  onFocusCustomInput
41396
41455
  } = internal;
41397
41456
  const {
41398
- disabled
41457
+ disabled,
41458
+ hasError
41399
41459
  } = useFieldPropsV2();
41400
41460
  const currencyElement = findChildOfType(children, OtherInput3.Currency);
41401
41461
  const valueElement = findChildOfType(children, OtherInput3.Value);
@@ -41416,6 +41476,7 @@ var OtherInput3 = (_ref7) => {
41416
41476
  onChange: handleChange,
41417
41477
  onFocus: handleFocus,
41418
41478
  isDisabled: disabled,
41479
+ isInvalid: hasError,
41419
41480
  className,
41420
41481
  "data-selected": hasValue ? "true" : void 0
41421
41482
  }, customAmount && currency && currencyElement ? applyInternalProps(currencyElement, {
@@ -43152,7 +43213,8 @@ var Value2 = (_ref8) => {
43152
43213
  const {
43153
43214
  readOnly,
43154
43215
  onBlur,
43155
- onFocus
43216
+ onFocus,
43217
+ hasError
43156
43218
  } = useFieldPropsV2();
43157
43219
  const {
43158
43220
  t
@@ -43163,7 +43225,8 @@ var Value2 = (_ref8) => {
43163
43225
  return /* @__PURE__ */ React45__namespace.default.createElement("div", {
43164
43226
  className,
43165
43227
  role: "region",
43166
- "aria-label": t("field.signature.input-area") || "Signature input area"
43228
+ "aria-label": t("field.signature.input-area") || "Signature input area",
43229
+ "data-invalid": hasError
43167
43230
  }, signatureView === SignatureView.DRAW && applyInternalProps(canvasElement, {
43168
43231
  value: signatureValueForView,
43169
43232
  onChange: handleChange,