@wix/form-public 0.522.0 → 0.524.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
@@ -248,7 +248,7 @@ function deriveError(validation, error, options) {
248
248
  if (!error) {
249
249
  return error;
250
250
  }
251
- return derivePatternError(error) ?? deriveCharacterLengthError(validation, error) ?? deriveItemsCountError(validation, error) ?? deriveNumericValueError(validation, error) ?? deriveDateFieldError(validation, error, options?.value) ?? deriveDateTimeFieldError(validation, error, options?.value) ?? error;
251
+ return derivePatternError(error) ?? deriveCharacterLengthError(validation, error) ?? deriveItemsCountError(validation, error) ?? deriveNumericValueError(validation, error) ?? deriveDateTimeFieldError(validation, error, options?.value) ?? deriveDateFieldError(validation, error, options?.value) ?? error;
252
252
  }
253
253
  function derivePatternError(error) {
254
254
  if (!error || error.errorType !== ErrorType.PATTERN_ERROR) {
@@ -54083,6 +54083,7 @@ var NonModalPopover = /* @__PURE__ */ forwardRef((props2, forwardedRef) => {
54083
54083
  shouldCloseOnInteractOutside: isOutsideTrigger
54084
54084
  }));
54085
54085
  });
54086
+ var EMPTY_SELECT_PLACEHOLDER = "\u200B";
54086
54087
  var SelectTriggerButton = /* @__PURE__ */ forwardRef((props2, ref) => {
54087
54088
  const overlayState = useContext(OverlayTriggerStateContext);
54088
54089
  const handlePressStart = (event) => {
@@ -54321,7 +54322,7 @@ var Month = ({ children, className }) => {
54321
54322
  const [isOpen, setIsOpen] = useState(false);
54322
54323
  const isForcedOpen = useIsForcedOpenDropdown(id6);
54323
54324
  const [container, setContainer] = useState(null);
54324
- const placeholder = hidePlaceholder ? void 0 : t("field.date.placeholder.month");
54325
+ const placeholder = hidePlaceholder ? EMPTY_SELECT_PLACEHOLDER : t("field.date.placeholder.month");
54325
54326
  const handleMonthChange = useCallback((selectedValue) => {
54326
54327
  if (readOnly) {
54327
54328
  return;
@@ -54687,7 +54688,8 @@ var Input2 = ({ className }) => {
54687
54688
  regionalFormat
54688
54689
  ]);
54689
54690
  return /* @__PURE__ */ React173.createElement(DateInput$1, {
54690
- className
54691
+ className,
54692
+ "data-placeholder-hidden": !placeholder || void 0
54691
54693
  }, (segment) => {
54692
54694
  const showCustomPlaceholder = segment.type === firstSegmentType && segment.isPlaceholder && Boolean(placeholder);
54693
54695
  return /* @__PURE__ */ React173.createElement(DateSegment, {
@@ -54921,7 +54923,7 @@ var Month2 = ({ children, className }) => {
54921
54923
  const [isOpen, setIsOpen] = useState(false);
54922
54924
  const isForcedOpen = useIsForcedOpenDropdown(id6);
54923
54925
  const [container, setContainer] = useState(null);
54924
- const placeholder = hidePlaceholder ? void 0 : t("field.date.placeholder.month");
54926
+ const placeholder = hidePlaceholder ? EMPTY_SELECT_PLACEHOLDER : t("field.date.placeholder.month");
54925
54927
  const handleMonthChange = useCallback((selectedValue) => {
54926
54928
  if (readOnly) {
54927
54929
  return;
@@ -55145,12 +55147,14 @@ var TimeLabel = ({ className }) => {
55145
55147
  }, label);
55146
55148
  };
55147
55149
  var TimeInput = ({ children, className }) => {
55150
+ const { hidePlaceholder } = useFieldPropsV2();
55148
55151
  const hourElement = findChildOfType(children, Time.Hour);
55149
55152
  const minuteElement = findChildOfType(children, Time.Minute);
55150
55153
  const periodElement = findChildOfType(children, Time.Period);
55151
55154
  return /* @__PURE__ */ React173.createElement(DateInput$1, {
55152
55155
  className,
55153
- "data-hook": "time"
55156
+ "data-hook": "time",
55157
+ "data-placeholder-hidden": hidePlaceholder || void 0
55154
55158
  }, (segment) => {
55155
55159
  switch (segment.type) {
55156
55160
  case "hour":
@@ -55780,7 +55784,7 @@ var Dropdown = ({ children }) => {
55780
55784
  isDisabled: disabled,
55781
55785
  isInvalid: hasError,
55782
55786
  isRequired: required,
55783
- placeholder,
55787
+ placeholder: placeholder || EMPTY_SELECT_PLACEHOLDER,
55784
55788
  onBlur,
55785
55789
  onFocus
55786
55790
  }, triggerElement, applyInternalProps(optionsElement, {
@@ -62850,13 +62854,14 @@ var TimeInput2 = ({ children }) => {
62850
62854
  });
62851
62855
  };
62852
62856
  var Time2 = ({ children, className }) => {
62853
- const { hasError } = useFieldPropsV2();
62857
+ const { hasError, hidePlaceholder } = useFieldPropsV2();
62854
62858
  const hourElement = findChildOfType(children, Time2.Hour);
62855
62859
  const minuteElement = findChildOfType(children, Time2.Minute);
62856
62860
  const periodElement = findChildOfType(children, Time2.Period);
62857
62861
  return /* @__PURE__ */ React173.createElement(DateInput$1, {
62858
62862
  className,
62859
- "data-invalid": hasError || void 0
62863
+ "data-invalid": hasError || void 0,
62864
+ "data-placeholder-hidden": hidePlaceholder || void 0
62860
62865
  }, (segment) => {
62861
62866
  switch (segment.type) {
62862
62867
  case "hour":