@povio/ui 2.3.0-rc.18 → 2.3.0-rc.19

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.
@@ -25,6 +25,7 @@ interface DatePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<Da
25
25
  shouldUpdateDateOnMonthYearChange?: boolean;
26
26
  granularity?: DatePickerGranularity;
27
27
  format?: string;
28
+ fireBlurOnChange?: boolean;
28
29
  }
29
30
  export interface DatePickerProps extends Omit<DatePickerBaseProps, "value" | "onChange" | "minValue" | "maxValue"> {
30
31
  value?: string | null;
@@ -26,7 +26,7 @@ import { useCalendarState, useDatePickerState } from "react-stately";
26
26
  var DATE_PICKER_TIME_ZONE = "UTC";
27
27
  var DatePickerBase = (props) => {
28
28
  const ui = UIConfig.useConfig();
29
- const { ref, label, tooltipText, helperText, isRequired, rightContent, isDirty, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, className, placeholder, inputClassName, as: asProp, hideLabel: hideLabelProp, variant: variantProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, shouldUpdateDateOnMonthYearChange: shouldUpdateDateOnMonthYearChangeProp, granularity: granularityProp, autoFixYear: autoFixYearProp, format, ...rest } = props;
29
+ const { ref, label, tooltipText, helperText, isRequired, rightContent, isDirty, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, className, placeholder, inputClassName, as: asProp, hideLabel: hideLabelProp, variant: variantProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, shouldUpdateDateOnMonthYearChange: shouldUpdateDateOnMonthYearChangeProp, granularity: granularityProp, autoFixYear: autoFixYearProp, fireBlurOnChange: fireBlurOnChangeProp, format, ...rest } = props;
30
30
  const as = asProp ?? ui.input.as;
31
31
  const hideLabel = hideLabelProp ?? ui.input.hideLabel;
32
32
  const variant = variantProp ?? ui.input.variant;
@@ -40,6 +40,7 @@ var DatePickerBase = (props) => {
40
40
  const shouldUpdateDateOnMonthYearChange = shouldUpdateDateOnMonthYearChangeProp ?? ui.dateInput.shouldUpdateDateOnMonthYearChange;
41
41
  const granularity = granularityProp ?? ui.dateInput.granularity;
42
42
  const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
43
+ const fireBlurOnChange = fireBlurOnChangeProp ?? ui.dateInput.fireBlurOnChange;
43
44
  const normalizeByGranularity = useCallback((date) => {
44
45
  if (granularity === "year") return date.set({
45
46
  month: 1,
@@ -94,7 +95,7 @@ var DatePickerBase = (props) => {
94
95
  }
95
96
  onChange?.(normalizedValue);
96
97
  dialogState.setValue(normalizedValue);
97
- debouncedBlur(normalizedValue);
98
+ if (fireBlurOnChange) debouncedBlur(normalizedValue);
98
99
  if (normalizedValue) {
99
100
  calendarState.setFocusedDate(normalizedValue);
100
101
  return;
@@ -134,7 +135,7 @@ var DatePickerBase = (props) => {
134
135
  const newValue = dialogState.value ? normalizeByGranularity(dialogState.value) : dialogState.value;
135
136
  state.setValue(newValue);
136
137
  state.toggle();
137
- handleBlur(newValue);
138
+ if (fireBlurOnChange) handleBlur(newValue);
138
139
  };
139
140
  const onMonthYearChange = (selectedDate) => {
140
141
  if (!(shouldUpdateDateOnMonthYearChange || granularity !== "day")) return;
@@ -208,7 +209,8 @@ var DatePickerBase = (props) => {
208
209
  className: inputClassName,
209
210
  dateGranularity: granularity,
210
211
  format,
211
- timeZone: DATE_PICKER_TIME_ZONE
212
+ timeZone: DATE_PICKER_TIME_ZONE,
213
+ fireBlurOnChange
212
214
  }), (!disableDropdown || disableManualEntry) && state.isOpen && /* @__PURE__ */ jsx(DateTimeDialog, {
213
215
  footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
214
216
  isDisabled,
@@ -23,6 +23,7 @@ interface DateRangePickerBaseProps extends FormFieldProps, InputVariantProps, Om
23
23
  placeholder?: string;
24
24
  inputClassName?: string;
25
25
  onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
26
+ fireBlurOnChange?: boolean;
26
27
  }
27
28
  export interface DateRangePickerProps extends Omit<DateRangePickerBaseProps, "value" | "onChange" | "minValue" | "maxValue"> {
28
29
  value?: {
@@ -31,7 +31,7 @@ var DATE_PICKER_TIME_ZONE = "UTC";
31
31
  var DateRangePickerBase = (props) => {
32
32
  const ui = UIConfig.useConfig();
33
33
  const { t } = useTranslation();
34
- const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, className, hideSidebar, placeholder, inputClassName, hideLabel: hideLabelProp, variant: variantProp, as: asProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, autoFixYear: autoFixYearProp, ...rest } = props;
34
+ const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, className, hideSidebar, placeholder, inputClassName, hideLabel: hideLabelProp, variant: variantProp, as: asProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, autoFixYear: autoFixYearProp, fireBlurOnChange: fireBlurOnChangeProp, ...rest } = props;
35
35
  const hideLabel = hideLabelProp ?? ui.input.hideLabel;
36
36
  const variant = variantProp ?? ui.input.variant;
37
37
  const as = asProp ?? ui.input.as;
@@ -43,6 +43,7 @@ var DateRangePickerBase = (props) => {
43
43
  const shouldForceLeadingZeros = shouldForceLeadingZerosProp ?? ui.dateInput.shouldForceLeadingZeros;
44
44
  const disableManualEntry = disableManualEntryProp ?? ui.dateInput.disableManualEntry;
45
45
  const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
46
+ const fireBlurOnChange = fireBlurOnChangeProp ?? ui.dateInput.fireBlurOnChange;
46
47
  const [validationRangeError, setValidationRangeError] = useState();
47
48
  const datePickerInputRef = useRef(null);
48
49
  const dateRangePickerRef = useMemo(() => ({ get current() {
@@ -62,7 +63,7 @@ var DateRangePickerBase = (props) => {
62
63
  if (isValidRange(newValue)) return;
63
64
  onChange?.(newValue);
64
65
  handleCalendarStatesChange(newValue);
65
- debouncedBlur(newValue);
66
+ if (fireBlurOnChange) debouncedBlur(newValue);
66
67
  },
67
68
  shouldCloseOnSelect: false
68
69
  });
@@ -350,7 +351,7 @@ var DateRangePickerBase = (props) => {
350
351
  } : dialogState.value;
351
352
  if (valueToApply) {
352
353
  state.setValue(valueToApply);
353
- handleBlur(valueToApply);
354
+ if (fireBlurOnChange) handleBlur(valueToApply);
354
355
  }
355
356
  state.toggle();
356
357
  };
@@ -513,7 +514,8 @@ var DateRangePickerBase = (props) => {
513
514
  placeholder,
514
515
  className: inputClassName,
515
516
  onOpenDropdown: () => state.toggle(),
516
- timeZone: DATE_PICKER_TIME_ZONE
517
+ timeZone: DATE_PICKER_TIME_ZONE,
518
+ fireBlurOnChange
517
519
  }), /* @__PURE__ */ jsx(DateTimeDialog, {
518
520
  hideSidebar,
519
521
  sidebar: /* @__PURE__ */ jsx("div", {
@@ -25,6 +25,7 @@ interface DateTimePickerBaseProps extends FormFieldProps, InputVariantProps, Omi
25
25
  timeZone?: string;
26
26
  format?: string;
27
27
  onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
28
+ fireBlurOnChange?: boolean;
28
29
  }
29
30
  export interface DateTimePickerProps extends Omit<DateTimePickerBaseProps, "value" | "onChange"> {
30
31
  value?: string | null;
@@ -24,7 +24,7 @@ import { useCalendarState, useDatePickerState } from "react-stately";
24
24
  //#region src/components/inputs/DateTime/DateTimePicker/DateTimePicker.tsx
25
25
  var DateTimePickerBase = (props) => {
26
26
  const ui = UIConfig.useConfig();
27
- const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, isTimeOptional, placeholder, inputClassName, hideLabel: hideLabelProp, variant: variantProp, as: asProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, shouldUpdateDateOnMonthYearChange: shouldUpdateDateOnMonthYearChangeProp, timeZone: _timeZone, autoFixYear: autoFixYearProp, format, setDateValueOnDateSelection: setDateValueOnDateSelectionProp, ...rest } = props;
27
+ const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, isTimeOptional, placeholder, inputClassName, hideLabel: hideLabelProp, variant: variantProp, as: asProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, shouldUpdateDateOnMonthYearChange: shouldUpdateDateOnMonthYearChangeProp, timeZone: _timeZone, autoFixYear: autoFixYearProp, fireBlurOnChange: fireBlurOnChangeProp, format, setDateValueOnDateSelection: setDateValueOnDateSelectionProp, ...rest } = props;
28
28
  const hideLabel = hideLabelProp ?? ui.input.hideLabel;
29
29
  const variant = variantProp ?? ui.input.variant;
30
30
  const as = asProp ?? ui.input.as;
@@ -37,6 +37,7 @@ var DateTimePickerBase = (props) => {
37
37
  const disableManualEntry = disableManualEntryProp ?? ui.dateInput.disableManualEntry;
38
38
  const shouldUpdateDateOnMonthYearChange = shouldUpdateDateOnMonthYearChangeProp ?? ui.dateInput.shouldUpdateDateOnMonthYearChange;
39
39
  const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
40
+ const fireBlurOnChange = fireBlurOnChangeProp ?? ui.dateInput.fireBlurOnChange;
40
41
  const setDateValueOnDateSelection = setDateValueOnDateSelectionProp ?? ui.dateInput.setDateValueOnDateSelection;
41
42
  const effectiveTimeZone = "UTC";
42
43
  const formFieldProps = {
@@ -85,7 +86,7 @@ var DateTimePickerBase = (props) => {
85
86
  onChange?.(val_0);
86
87
  dialogState.setValue(val_0);
87
88
  calendarState.setFocusedDate(val_0 || today(effectiveTimeZone));
88
- debouncedBlur(val_0);
89
+ if (fireBlurOnChange) debouncedBlur(val_0);
89
90
  },
90
91
  shouldCloseOnSelect: false,
91
92
  granularity: "minute",
@@ -124,7 +125,7 @@ var DateTimePickerBase = (props) => {
124
125
  const newValue = dialogState.value;
125
126
  state.setValue(newValue);
126
127
  state.toggle();
127
- handleBlur(newValue);
128
+ if (fireBlurOnChange) handleBlur(newValue);
128
129
  };
129
130
  const onMonthYearChange = (selectedDate) => {
130
131
  if (!shouldUpdateDateOnMonthYearChange) return;
@@ -207,7 +208,8 @@ var DateTimePickerBase = (props) => {
207
208
  className: inputClassName,
208
209
  timeZone: effectiveTimeZone,
209
210
  isTimeOptional,
210
- format
211
+ format,
212
+ fireBlurOnChange
211
213
  }), (!disableDropdown || disableManualEntry) && /* @__PURE__ */ jsx(DateTimeDialog, {
212
214
  footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
213
215
  isDisabled,
@@ -14,6 +14,7 @@ interface TimePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<Ar
14
14
  placeholder?: string;
15
15
  inputClassName?: string;
16
16
  onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
17
+ fireBlurOnChange?: boolean;
17
18
  }
18
19
  export interface TimePickerProps extends Omit<TimePickerBaseProps, "value" | "onChange"> {
19
20
  value?: string | null;