@mtes-mct/monitor-ui 5.3.0 → 5.3.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ # [5.3.0](https://github.com/MTES-MCT/monitor-ui/compare/v5.2.2...v5.3.0) (2023-04-12)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **fields:** update value in MultiCheckbox on value prop change ([c9a11c8](https://github.com/MTES-MCT/monitor-ui/commit/c9a11c85c4b35f5df2979916588e0ab091ffd06f))
7
+ * **fields:** update value in MultiRadio on value prop change ([a230925](https://github.com/MTES-MCT/monitor-ui/commit/a230925361a54bad0251159600dba4c87965867b))
8
+
9
+
10
+ ### Features
11
+
12
+ * **fields:** add isErrorMessageHidden prop to fields ([f5d498d](https://github.com/MTES-MCT/monitor-ui/commit/f5d498da707133d5cb45105da5675f48b368664b))
13
+
1
14
  ## [5.2.1](https://github.com/MTES-MCT/monitor-ui/compare/v5.2.0...v5.2.1) (2023-04-11)
2
15
 
3
16
 
@@ -4,7 +4,6 @@ import type { DateTuple, DateInputRef } from './types';
4
4
  import type { Promisable } from 'type-fest';
5
5
  export type DateInputProps = Pick<NumberInputProps, 'onBack' | 'onPrevious' | 'onNext'> & {
6
6
  baseContainer: Document | HTMLDivElement | undefined;
7
- defaultValue?: DateTuple | undefined;
8
7
  disabled: boolean;
9
8
  isCompact: boolean;
10
9
  isEndDate?: boolean | undefined;
@@ -23,10 +22,10 @@ export type DateInputProps = Pick<NumberInputProps, 'onBack' | 'onPrevious' | 'o
23
22
  onClick: () => Promisable<void>;
24
23
  /** Called each time any date input receive a keyboard-input change whether the value is valid or not. */
25
24
  onInput: () => Promisable<void>;
25
+ value?: DateTuple | undefined;
26
26
  };
27
27
  export declare const DateInput: import("react").ForwardRefExoticComponent<Pick<NumberInputProps, "onBack" | "onNext" | "onPrevious"> & {
28
28
  baseContainer: Document | HTMLDivElement | undefined;
29
- defaultValue?: DateTuple | undefined;
30
29
  disabled: boolean;
31
30
  isCompact: boolean;
32
31
  isEndDate?: boolean | undefined;
@@ -45,4 +44,5 @@ export declare const DateInput: import("react").ForwardRefExoticComponent<Pick<N
45
44
  onClick: () => Promisable<void>;
46
45
  /** Called each time any date input receive a keyboard-input change whether the value is valid or not. */
47
46
  onInput: () => Promisable<void>;
47
+ value?: DateTuple | undefined;
48
48
  } & import("react").RefAttributes<DateInputRef>>;
@@ -1,6 +1,6 @@
1
1
  import type { InputHTMLAttributes } from 'react';
2
2
  import type { Promisable } from 'type-fest';
3
- export type NumberInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'maxLength' | 'onInput' | 'pattern' | 'type' | 'value'> & {
3
+ export type NumberInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'defaultValue' | 'maxLength' | 'onInput' | 'pattern' | 'type'> & {
4
4
  isLight: boolean;
5
5
  max: number;
6
6
  min: number;
@@ -16,7 +16,7 @@ export type NumberInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'maxL
16
16
  onPrevious?: (() => Promisable<void>) | undefined;
17
17
  size: number;
18
18
  };
19
- export declare const NumberInput: import("react").ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "pattern" | "value" | "onInput" | "type" | "maxLength"> & {
19
+ export declare const NumberInput: import("react").ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "pattern" | "defaultValue" | "onInput" | "type" | "maxLength"> & {
20
20
  isLight: boolean;
21
21
  max: number;
22
22
  min: number;
@@ -4,7 +4,6 @@ import type { TimeInputRef, TimeTuple } from './types';
4
4
  import type { Promisable } from 'type-fest';
5
5
  export type TimeInputProps = Pick<NumberInputProps, 'onBack' | 'onPrevious' | 'onNext'> & {
6
6
  baseContainer?: Document | HTMLDivElement | undefined;
7
- defaultValue?: TimeTuple | undefined;
8
7
  disabled: boolean;
9
8
  isCompact: boolean;
10
9
  isEndDate?: boolean | undefined;
@@ -18,10 +17,10 @@ export type TimeInputProps = Pick<NumberInputProps, 'onBack' | 'onPrevious' | 'o
18
17
  onInput: () => Promisable<void>;
19
18
  onNext?: (() => Promisable<void>) | undefined;
20
19
  onPrevious?: (() => Promisable<void>) | undefined;
20
+ value?: TimeTuple | undefined;
21
21
  };
22
22
  export declare const TimeInput: import("react").ForwardRefExoticComponent<Pick<NumberInputProps, "onBack" | "onNext" | "onPrevious"> & {
23
23
  baseContainer?: Document | HTMLDivElement | undefined;
24
- defaultValue?: TimeTuple | undefined;
25
24
  disabled: boolean;
26
25
  isCompact: boolean;
27
26
  isEndDate?: boolean | undefined;
@@ -35,4 +34,5 @@ export declare const TimeInput: import("react").ForwardRefExoticComponent<Pick<N
35
34
  onInput: () => Promisable<void>;
36
35
  onNext?: (() => Promisable<void>) | undefined;
37
36
  onPrevious?: (() => Promisable<void>) | undefined;
37
+ value?: TimeTuple | undefined;
38
38
  } & import("react").RefAttributes<TimeInputRef>>;
@@ -6,4 +6,5 @@ export declare function useFieldControl<T>(value: T, onChange: ((nextValue: T) =
6
6
  }): {
7
7
  controlledOnChange: (nextValue: T) => Promisable<void>;
8
8
  controlledValue: T | undefined;
9
+ setInternalValue: (nextValue: T) => Promisable<void>;
9
10
  };
package/index.js CHANGED
@@ -21252,12 +21252,6 @@ const getRangedTimeOptions = (minutesRange) => {
21252
21252
  };
21253
21253
  });
21254
21254
  };
21255
- function getTimeTupleFromUtcDate(utcDate) {
21256
- if (!utcDate) {
21257
- return undefined;
21258
- }
21259
- return [formatNumberAsDoubleDigit(utcDate.getHours()), formatNumberAsDoubleDigit(utcDate.getMinutes())];
21260
- }
21261
21255
  function getUtcDateTupleFromDayjs(dateAsDayjs) {
21262
21256
  if (!dateAsDayjs) {
21263
21257
  return undefined;
@@ -21315,6 +21309,7 @@ const Box$b = styled.div `
21315
21309
 
21316
21310
  .rs-picker-toggle {
21317
21311
  border: 0 !important;
21312
+ box-shadow: none;
21318
21313
  padding: 0;
21319
21314
 
21320
21315
  * {
@@ -21455,7 +21450,7 @@ const Box$b = styled.div `
21455
21450
  }
21456
21451
  `;
21457
21452
 
21458
- function NumberInputWithRef({ defaultValue, isLight, max, min, onBack, onClick, onFilled, onFocus, onFormatError, onInput, onNext, onPrevious, size, ...nativeProps }, ref) {
21453
+ function NumberInputWithRef({ isLight, max, min, onBack, onClick, onFilled, onFocus, onFormatError, onInput, onNext, onPrevious, size, value, ...nativeProps }, ref) {
21459
21454
  // eslint-disable-next-line no-null/no-null
21460
21455
  const inputRef = useRef(null);
21461
21456
  const placeholder = useMemo(() => '-'.repeat(size), [size]);
@@ -21480,11 +21475,10 @@ function NumberInputWithRef({ defaultValue, isLight, max, min, onBack, onClick,
21480
21475
  return;
21481
21476
  }
21482
21477
  onFormatError(false);
21483
- const { value } = inputRef.current;
21484
21478
  if (onInput) {
21485
- onInput(value);
21479
+ onInput(inputRef.current.value);
21486
21480
  }
21487
- if (value.length !== size) {
21481
+ if (inputRef.current.value.length !== size) {
21488
21482
  return;
21489
21483
  }
21490
21484
  const valueAsNumber = Number(inputRef.current.value);
@@ -21492,7 +21486,7 @@ function NumberInputWithRef({ defaultValue, isLight, max, min, onBack, onClick,
21492
21486
  onFormatError(true);
21493
21487
  return;
21494
21488
  }
21495
- if (onFilled && value.length === size) {
21489
+ if (onFilled && inputRef.current.value.length === size) {
21496
21490
  onFilled();
21497
21491
  }
21498
21492
  }, [max, min, onFilled, onFormatError, onInput, size]);
@@ -21523,7 +21517,7 @@ function NumberInputWithRef({ defaultValue, isLight, max, min, onBack, onClick,
21523
21517
  onBack();
21524
21518
  }
21525
21519
  }, [onBack, onNext, onPrevious]);
21526
- return (jsx(StyledNumberInput, { ref: inputRef, "$isLight": isLight, "$size": size, defaultValue: defaultValue, maxLength: size, onClick: handleClick, onFocus: handleFocus, onInput: handleInput, onKeyDown: handleKeyDown, pattern: "\\d*", placeholder: placeholder, type: "text", ...nativeProps }, String(defaultValue)));
21520
+ return (jsx(StyledNumberInput, { ref: inputRef, "$isLight": isLight, "$size": size, defaultValue: value, maxLength: size, onClick: handleClick, onFocus: handleFocus, onInput: handleInput, onKeyDown: handleKeyDown, pattern: "\\d*", placeholder: placeholder, type: "text", ...nativeProps }, String(value)));
21527
21521
  }
21528
21522
  const NumberInput$1 = forwardRef(NumberInputWithRef);
21529
21523
  const StyledNumberInput = styled.input `
@@ -21542,17 +21536,24 @@ const StyledNumberInput = styled.input `
21542
21536
  }
21543
21537
  `;
21544
21538
 
21545
- function DateInputWithRef({ baseContainer, defaultValue, disabled = false, isCompact, isEndDate = false, isForcedFocused, isLight, isRange = false, isStartDate = false, onBack, onChange, onClick, onInput, onNext, onPrevious }, ref) {
21539
+ function DateInputWithRef({ baseContainer, disabled = false, isCompact, isEndDate = false, isForcedFocused, isLight, isRange = false, isStartDate = false, onBack, onChange, onClick, onInput, onNext, onPrevious, value }, ref) {
21546
21540
  /* eslint-disable no-null/no-null */
21547
21541
  const boxRef = useRef(null);
21548
21542
  const dayInputRef = useRef(null);
21549
21543
  const monthInputRef = useRef(null);
21550
21544
  const yearInputRef = useRef(null);
21551
21545
  /* eslint-enable no-null/no-null */
21546
+ const lastValueBeforeFocusRef = useRef(value);
21552
21547
  const [hasFormatError, setHasFormatError] = useState(false);
21553
21548
  const [hasValidationError, setHasValidationError] = useState(false);
21554
21549
  const [isFocused, setIsFocused] = useState(false);
21555
21550
  const baseDocument = useMemo(() => (isHtmlElement(baseContainer) ? baseContainer.ownerDocument : window.document), [baseContainer]);
21551
+ const controlledValue = useMemo(() => {
21552
+ if (!isFocused) {
21553
+ lastValueBeforeFocusRef.current = value;
21554
+ }
21555
+ return lastValueBeforeFocusRef.current;
21556
+ }, [isFocused, value]);
21556
21557
  useImperativeHandle(ref, () => ({
21557
21558
  box: boxRef.current,
21558
21559
  contains: boxRef.current ? boxRef.current.contains.bind(boxRef.current) : () => false,
@@ -21610,7 +21611,7 @@ function DateInputWithRef({ baseContainer, defaultValue, disabled = false, isCom
21610
21611
  ];
21611
21612
  onChange(nextDateTuple, isFilled);
21612
21613
  }, [baseDocument, onChange]);
21613
- return (jsxs(Box$a, { ref: boxRef, "$hasError": hasFormatError || hasValidationError, "$isCompact": isCompact, "$isDisabled": disabled, "$isFocused": isForcedFocused || isFocused, "$isLight": isLight, children: [jsxs("div", { children: [isRange && isStartDate && jsx("span", { children: "Du " }), isRange && isEndDate && jsx("span", { children: "Au " }), jsx(NumberInput$1, { ref: dayInputRef, "aria-label": `Jour${isRange && isStartDate ? ' de début' : ''}${isRange && isEndDate ? ' de fin' : ''}`, defaultValue: defaultValue && formatNumberAsDoubleDigit(defaultValue[2]), disabled: disabled, isLight: isLight, max: 31, min: 1, onBack: onBack, onBlur: handleBlur, onClick: onClick, onFilled: submit, onFocus: handleFocus, onFormatError: handleFormatError, onInput: onInput, onNext: () => monthInputRef.current?.focus(), onPrevious: onPrevious, size: 2 }), "/", jsx(NumberInput$1, { ref: monthInputRef, "aria-label": `Mois${isRange && isStartDate ? ' de début' : ''}${isRange && isEndDate ? ' de fin' : ''}`, defaultValue: defaultValue && formatNumberAsDoubleDigit(defaultValue[1]), disabled: disabled, isLight: isLight, max: 12, min: 1, onBack: () => dayInputRef.current?.focus(), onBlur: handleBlur, onClick: onClick, onFilled: submit, onFocus: handleFocus, onFormatError: handleFormatError, onInput: onInput, onNext: () => yearInputRef.current?.focus(), onPrevious: () => dayInputRef.current?.focus(), size: 2 }), "/", jsx(NumberInput$1, { ref: yearInputRef, "aria-label": `Année${isRange && isStartDate ? ' de début' : ''}${isRange && isEndDate ? ' de fin' : ''}`, defaultValue: defaultValue && defaultValue[0], disabled: disabled, isLight: isLight, max: 2030, min: 2020, onBack: () => monthInputRef.current?.focus(), onBlur: handleBlur, onClick: onClick, onFilled: submit, onFocus: handleFocus, onFormatError: handleFormatError, onInput: onInput, onNext: onNext, onPrevious: () => monthInputRef.current?.focus(), size: 4 })] }), !isCompact && jsx(Calendar, {})] }));
21614
+ return (jsxs(Box$a, { ref: boxRef, "$hasError": hasFormatError || hasValidationError, "$isCompact": isCompact, "$isDisabled": disabled, "$isFocused": isForcedFocused || isFocused, "$isLight": isLight, children: [jsxs("div", { children: [isRange && isStartDate && jsx("span", { children: "Du " }), isRange && isEndDate && jsx("span", { children: "Au " }), jsx(NumberInput$1, { ref: dayInputRef, "aria-label": `Jour${isRange && isStartDate ? ' de début' : ''}${isRange && isEndDate ? ' de fin' : ''}`, disabled: disabled, isLight: isLight, max: 31, min: 1, onBack: onBack, onBlur: handleBlur, onClick: onClick, onFilled: submit, onFocus: handleFocus, onFormatError: handleFormatError, onInput: onInput, onNext: () => monthInputRef.current?.focus(), onPrevious: onPrevious, size: 2, value: controlledValue && controlledValue[2] }), "/", jsx(NumberInput$1, { ref: monthInputRef, "aria-label": `Mois${isRange && isStartDate ? ' de début' : ''}${isRange && isEndDate ? ' de fin' : ''}`, disabled: disabled, isLight: isLight, max: 12, min: 1, onBack: () => dayInputRef.current?.focus(), onBlur: handleBlur, onClick: onClick, onFilled: submit, onFocus: handleFocus, onFormatError: handleFormatError, onInput: onInput, onNext: () => yearInputRef.current?.focus(), onPrevious: () => dayInputRef.current?.focus(), size: 2, value: controlledValue && controlledValue[1] }), "/", jsx(NumberInput$1, { ref: yearInputRef, "aria-label": `Année${isRange && isStartDate ? ' de début' : ''}${isRange && isEndDate ? ' de fin' : ''}`, disabled: disabled, isLight: isLight, max: 2030, min: 2020, onBack: () => monthInputRef.current?.focus(), onBlur: handleBlur, onClick: onClick, onFilled: submit, onFocus: handleFocus, onFormatError: handleFormatError, onInput: onInput, onNext: onNext, onPrevious: () => monthInputRef.current?.focus(), size: 4, value: controlledValue && controlledValue[0] })] }), !isCompact && jsx(Calendar, {})] }));
21614
21615
  }
21615
21616
  const DateInput = forwardRef(DateInputWithRef);
21616
21617
  const Box$a = styled.div `
@@ -21736,18 +21737,19 @@ const Option = styled.div `
21736
21737
  }
21737
21738
  `;
21738
21739
 
21739
- function TimeInputWithRef({ baseContainer, defaultValue, disabled = false, isCompact, isEndDate = false, isLight, isStartDate = false, minutesRange = 15, onBack, onChange, onFocus, onInput, onNext, onPrevious }, ref) {
21740
+ function TimeInputWithRef({ baseContainer, disabled = false, isCompact, isEndDate = false, isLight, isStartDate = false, minutesRange = 15, onBack, onChange, onFocus, onInput, onNext, onPrevious, value }, ref) {
21740
21741
  /* eslint-disable no-null/no-null */
21741
21742
  const boxRef = useRef(null);
21742
21743
  const hourInputRef = useRef(null);
21743
21744
  const minuteInputRef = useRef(null);
21744
21745
  /* eslint-enable no-null/no-null */
21745
- const [controlledDefaultValue, setControlledDefaultValue] = useState(defaultValue);
21746
+ const [controlledValue, setControlledValue] = useState(value);
21746
21747
  const [hasFormatError, setHasFormatError] = useState(false);
21747
21748
  const [hasValidationError, setHasValidationError] = useState(false);
21748
21749
  const [isFocused, setIsFocused] = useState(false);
21749
21750
  const [isTimePickerOpen, setIsTimePickerOpen] = useState(false);
21750
21751
  const [timePickerFilter, setTimePickerFilter] = useState(/.*/);
21752
+ const previousValue = usePrevious(value);
21751
21753
  const baseDocument = useMemo(() => (isHtmlElement(baseContainer) ? baseContainer.ownerDocument : window.document), [baseContainer]);
21752
21754
  useImperativeHandle(ref, () => ({
21753
21755
  box: boxRef.current,
@@ -21794,7 +21796,7 @@ function TimeInputWithRef({ baseContainer, defaultValue, disabled = false, isCom
21794
21796
  }, [onInput]);
21795
21797
  const handleTimePickerChange = useCallback((nextTimeTuple) => {
21796
21798
  closeRangedTimePicker();
21797
- setControlledDefaultValue(nextTimeTuple);
21799
+ setControlledValue(nextTimeTuple);
21798
21800
  onChange(nextTimeTuple);
21799
21801
  }, [closeRangedTimePicker, onChange]);
21800
21802
  const openRangedTimePicker = useCallback(() => {
@@ -21819,7 +21821,13 @@ function TimeInputWithRef({ baseContainer, defaultValue, disabled = false, isCom
21819
21821
  onChange(nextTimeTuple);
21820
21822
  }, [baseDocument, closeRangedTimePicker, onChange]);
21821
21823
  useClickOutsideEffect(boxRef, closeRangedTimePicker, baseContainer);
21822
- return (jsxs(Box$8, { ref: boxRef, "$hasError": hasFormatError || hasValidationError, "$isCompact": isCompact, "$isDisabled": disabled, "$isFocused": isFocused, "$isLight": isLight, children: [jsxs(InputGroup, { children: [jsxs("div", { children: [jsx(NumberInput$1, { ref: hourInputRef, "aria-label": `Heure${isStartDate ? ' de début' : ''}${isEndDate ? ' de fin' : ''}`, defaultValue: controlledDefaultValue && controlledDefaultValue[0], disabled: disabled, isLight: isLight, max: 23, min: 0, onBack: handleBack, onBlur: handleBlur, onClick: openRangedTimePicker, onFilled: submit, onFocus: handleFocus, onFormatError: handleFormatError, onInput: handleHourInput, onNext: () => minuteInputRef.current?.focus(), onPrevious: onPrevious, size: 2 }), ":", jsx(NumberInput$1, { ref: minuteInputRef, "aria-label": `Minute${isStartDate ? ' de début' : ''}${isEndDate ? ' de fin' : ''}`, defaultValue: controlledDefaultValue && controlledDefaultValue[1], disabled: disabled, isLight: isLight, max: 59, min: 0, onBack: () => hourInputRef.current?.focus(), onBlur: handleBlur, onClick: openRangedTimePicker, onFilled: submit, onFocus: handleFocus, onFormatError: handleFormatError, onInput: onInput, onNext: onNext, onPrevious: () => hourInputRef.current?.focus(), size: 2 })] }), !isCompact && jsx(Clock, {})] }), isTimePickerOpen && (jsx(RangedTimePicker, { filter: timePickerFilter, minutesRange: minutesRange, onChange: handleTimePickerChange }))] }));
21824
+ useEffect(() => {
21825
+ if (lodashExports.isEqual(value, previousValue) || isFocused) {
21826
+ return;
21827
+ }
21828
+ setControlledValue(value);
21829
+ }, [isFocused, previousValue, value]);
21830
+ return (jsxs(Box$8, { ref: boxRef, "$hasError": hasFormatError || hasValidationError, "$isCompact": isCompact, "$isDisabled": disabled, "$isFocused": isFocused, "$isLight": isLight, children: [jsxs(InputGroup, { children: [jsxs("div", { children: [jsx(NumberInput$1, { ref: hourInputRef, "aria-label": `Heure${isStartDate ? ' de début' : ''}${isEndDate ? ' de fin' : ''}`, disabled: disabled, isLight: isLight, max: 23, min: 0, onBack: handleBack, onBlur: handleBlur, onClick: openRangedTimePicker, onFilled: submit, onFocus: handleFocus, onFormatError: handleFormatError, onInput: handleHourInput, onNext: () => minuteInputRef.current?.focus(), onPrevious: onPrevious, size: 2, value: controlledValue && controlledValue[0] }), ":", jsx(NumberInput$1, { ref: minuteInputRef, "aria-label": `Minute${isStartDate ? ' de début' : ''}${isEndDate ? ' de fin' : ''}`, disabled: disabled, isLight: isLight, max: 59, min: 0, onBack: () => hourInputRef.current?.focus(), onBlur: handleBlur, onClick: openRangedTimePicker, onFilled: submit, onFocus: handleFocus, onFormatError: handleFormatError, onInput: onInput, onNext: onNext, onPrevious: () => hourInputRef.current?.focus(), size: 2, value: controlledValue && controlledValue[1] })] }), !isCompact && jsx(Clock, {})] }), isTimePickerOpen && (jsx(RangedTimePicker, { filter: timePickerFilter, minutesRange: minutesRange, onChange: handleTimePickerChange }))] }));
21823
21831
  }
21824
21832
  const TimeInput = forwardRef(TimeInputWithRef);
21825
21833
  const Box$8 = styled.div `
@@ -21862,9 +21870,11 @@ function DatePicker({ baseContainer, className, defaultValue, disabled = false,
21862
21870
  const timeInputRef = useRef(null);
21863
21871
  /* eslint-enable no-null/no-null */
21864
21872
  const isCalendarPickerOpenRef = useRef(false);
21873
+ const hasMountedRef = useRef(false);
21865
21874
  const selectedUtcDateAsDayjsRef = useRef(defaultValue ? customDayjs(defaultValue) : undefined);
21866
21875
  const selectedUtcDateTupleRef = useRef(getUtcDateTupleFromDayjs(selectedUtcDateAsDayjsRef.current));
21867
21876
  const selectedUtcTimeTupleRef = useRef(getUtcTimeTupleFromDayjs(selectedUtcDateAsDayjsRef.current));
21877
+ const previousDefaultValue = usePrevious(defaultValue);
21868
21878
  const { forceUpdate } = useForceUpdate();
21869
21879
  const controlledError = useMemo(() => normalizeString(error), [error]);
21870
21880
  const defaultTimeTuple = useMemo(() => (isEndDate ? ['23', '59'] : ['00', '00']), [isEndDate]);
@@ -21975,7 +21985,23 @@ function DatePicker({ baseContainer, className, defaultValue, disabled = false,
21975
21985
  }, [forceUpdate]);
21976
21986
  useFieldUndefineEffect(disabled, onChange, handleDisable);
21977
21987
  useClickOutsideEffect(boxRef, closeCalendarPicker, baseContainer);
21978
- return (jsxs(Fieldset, { className: classNames('Field-DatePicker', className), disabled: disabled, isLegendHidden: isLabelHidden, legend: label, ...nativeProps, children: [jsxs(Box$7, { ref: boxRef, children: [jsx(Field$1, { children: jsx(DateInput, { ref: dateInputRef, baseContainer: baseContainer || undefined, defaultValue: selectedUtcDateTupleRef.current, disabled: disabled, isCompact: isCompact, isEndDate: isEndDate, isForcedFocused: isCalendarPickerOpenRef.current, isLight: isLight, onChange: handleDateInputChange, onClick: openCalendarPicker, onInput: handleDateOrTimeInputInput, onNext: handleDateInputNext }) }), withTime && (jsx(Field$1, { "$isTimeField": true, children: jsx(TimeInput, { ref: timeInputRef, baseContainer: baseContainer || undefined, defaultValue: selectedUtcTimeTupleRef.current, disabled: disabled, isCompact: isCompact, isLight: isLight, minutesRange: minutesRange, onBack: () => dateInputRef.current?.focus(true), onChange: handleTimeInputFilled, onFocus: closeCalendarPicker, onInput: handleDateOrTimeInputInput, onPrevious: () => dateInputRef.current?.focus(true) }, JSON.stringify(selectedUtcTimeTupleRef.current)) }))] }), !isErrorMessageHidden && hasError && jsx(FieldError, { children: controlledError }), jsx(CalendarPicker, { isHistorical: isHistorical, isOpen: isCalendarPickerOpenRef.current, onChange: handleCalendarPickerChange, value: calendarPickerDefaultValue })] }));
21988
+ useEffect(() => {
21989
+ if (!hasMountedRef.current) {
21990
+ hasMountedRef.current = true;
21991
+ return;
21992
+ }
21993
+ if ((defaultValue instanceof Date &&
21994
+ previousDefaultValue instanceof Date &&
21995
+ defaultValue.toISOString() === previousDefaultValue.toISOString()) ||
21996
+ defaultValue === previousDefaultValue) {
21997
+ return;
21998
+ }
21999
+ selectedUtcDateAsDayjsRef.current = defaultValue ? customDayjs(defaultValue) : undefined;
22000
+ selectedUtcDateTupleRef.current = getUtcDateTupleFromDayjs(selectedUtcDateAsDayjsRef.current);
22001
+ selectedUtcTimeTupleRef.current = getUtcTimeTupleFromDayjs(selectedUtcDateAsDayjsRef.current);
22002
+ forceUpdate();
22003
+ }, [defaultValue, forceUpdate, previousDefaultValue]);
22004
+ return (jsxs(Fieldset, { className: classNames('Field-DatePicker', className), disabled: disabled, isLegendHidden: isLabelHidden, legend: label, ...nativeProps, children: [jsxs(Box$7, { ref: boxRef, children: [jsx(Field$1, { children: jsx(DateInput, { ref: dateInputRef, baseContainer: baseContainer || undefined, disabled: disabled, isCompact: isCompact, isEndDate: isEndDate, isForcedFocused: isCalendarPickerOpenRef.current, isLight: isLight, onChange: handleDateInputChange, onClick: openCalendarPicker, onInput: handleDateOrTimeInputInput, onNext: handleDateInputNext, value: selectedUtcDateTupleRef.current }) }), withTime && (jsx(Field$1, { "$isTimeField": true, children: jsx(TimeInput, { ref: timeInputRef, baseContainer: baseContainer || undefined, disabled: disabled, isCompact: isCompact, isLight: isLight, minutesRange: minutesRange, onBack: () => dateInputRef.current?.focus(true), onChange: handleTimeInputFilled, onFocus: closeCalendarPicker, onInput: handleDateOrTimeInputInput, onPrevious: () => dateInputRef.current?.focus(true), value: selectedUtcTimeTupleRef.current }, JSON.stringify(selectedUtcTimeTupleRef.current)) }))] }), !isErrorMessageHidden && hasError && jsx(FieldError, { children: controlledError }), jsx(CalendarPicker, { isHistorical: isHistorical, isOpen: isCalendarPickerOpenRef.current, onChange: handleCalendarPickerChange, value: calendarPickerDefaultValue })] }));
21979
22005
  }
21980
22006
  const Box$7 = styled.div `
21981
22007
  * {
@@ -22052,6 +22078,7 @@ const Box$6 = styled.div `
22052
22078
  .rs-picker-toggle {
22053
22079
  border: 0 !important;
22054
22080
  padding: 0;
22081
+ box-shadow: none;
22055
22082
 
22056
22083
  * {
22057
22084
  display: none;
@@ -22212,13 +22239,15 @@ function DateRangePicker({ baseContainer, defaultValue, disabled = false, error,
22212
22239
  const endDateInputRef = useRef(null);
22213
22240
  const endTimeInputRef = useRef(null);
22214
22241
  /* eslint-enable no-null/no-null */
22242
+ const hasMountedRef = useRef(false);
22215
22243
  const isRangeCalendarPickerOpenRef = useRef(false);
22216
- const selectedStartUtcDateRef = useRef(defaultValue ? customDayjs(defaultValue[0]).toDate() : undefined);
22217
- const selectedEndUtcDateRef = useRef(defaultValue ? customDayjs(defaultValue[1]).toDate() : undefined);
22218
- const selectedStartDateTupleRef = useRef(getDateTupleFromUtcDate(selectedStartUtcDateRef.current));
22219
- const selectedEndDateTupleRef = useRef(getDateTupleFromUtcDate(selectedEndUtcDateRef.current));
22220
- const selectedStartTimeTupleRef = useRef(getTimeTupleFromUtcDate(selectedStartUtcDateRef.current));
22221
- const selectedEndTimeTupleRef = useRef(getTimeTupleFromUtcDate(selectedEndUtcDateRef.current));
22244
+ const selectedStartDateAsDayjsRef = useRef(defaultValue ? customDayjs(defaultValue[0]) : undefined);
22245
+ const selectedEndDateAsDayjsRef = useRef(defaultValue ? customDayjs(defaultValue[1]) : undefined);
22246
+ const selectedStartDateTupleRef = useRef(getUtcDateTupleFromDayjs(selectedStartDateAsDayjsRef.current));
22247
+ const selectedEndDateTupleRef = useRef(getUtcDateTupleFromDayjs(selectedEndDateAsDayjsRef.current));
22248
+ const selectedStartTimeTupleRef = useRef(getUtcTimeTupleFromDayjs(selectedStartDateAsDayjsRef.current));
22249
+ const selectedEndTimeTupleRef = useRef(getUtcTimeTupleFromDayjs(selectedEndDateAsDayjsRef.current));
22250
+ const previousDefaultValue = usePrevious(defaultValue);
22222
22251
  const { forceUpdate } = useForceUpdate();
22223
22252
  const controlledError = useMemo(() => normalizeString(error), [error]);
22224
22253
  const hasError = useMemo(() => Boolean(controlledError), [controlledError]);
@@ -22231,21 +22260,20 @@ function DateRangePicker({ baseContainer, defaultValue, disabled = false, error,
22231
22260
  // eslint-disable-next-line react-hooks/exhaustive-deps
22232
22261
  [selectedEndDateTupleRef.current, selectedStartDateTupleRef.current]);
22233
22262
  const submit = useCallback(() => {
22234
- if (!onChange || !selectedStartUtcDateRef.current || !selectedEndUtcDateRef.current) {
22263
+ if (!onChange || !selectedStartDateAsDayjsRef.current || !selectedEndDateAsDayjsRef.current) {
22235
22264
  return;
22236
22265
  }
22237
22266
  if (isStringDate) {
22238
- const utcizedStartDateAsString = selectedStartUtcDateRef.current.toISOString();
22239
- const utcizedEndDateAsString = selectedEndUtcDateRef.current.toISOString();
22240
- const nextDateAsStringRange = [utcizedStartDateAsString, utcizedEndDateAsString];
22241
- onChange(nextDateAsStringRange);
22242
- }
22243
- else {
22244
- const utcizedStartDate = selectedStartUtcDateRef.current;
22245
- const utcizedEndDate = selectedEndUtcDateRef.current;
22246
- const nextDateRange = [utcizedStartDate, utcizedEndDate];
22247
- onChange(nextDateRange);
22267
+ const startUtcDateAsString = selectedStartDateAsDayjsRef.current.utc().toISOString();
22268
+ const endUtcDateAsString = selectedEndDateAsDayjsRef.current.utc().toISOString();
22269
+ const nextUtcDateAsStringRange = [startUtcDateAsString, endUtcDateAsString];
22270
+ onChange(nextUtcDateAsStringRange);
22271
+ return;
22248
22272
  }
22273
+ const startUtcDate = selectedStartDateAsDayjsRef.current.toDate();
22274
+ const endUtcDate = selectedEndDateAsDayjsRef.current.toDate();
22275
+ const nextDateRange = [startUtcDate, endUtcDate];
22276
+ onChange(nextDateRange);
22249
22277
  }, [isStringDate, onChange]);
22250
22278
  const closeRangeCalendarPicker = useCallback(() => {
22251
22279
  isRangeCalendarPickerOpenRef.current = false;
@@ -22291,8 +22319,8 @@ function DateRangePicker({ baseContainer, defaultValue, disabled = false, error,
22291
22319
  if (!withTime || selectedStartTimeTupleRef.current) {
22292
22320
  // we must update the selected start date and call onChange()
22293
22321
  const startUtcTimeTuple = withTime && selectedStartTimeTupleRef.current ? selectedStartTimeTupleRef.current : ['00', '00'];
22294
- const nextStartDate = getUtcDateFromDateAndTimeTuple(nextDateTuple, startUtcTimeTuple);
22295
- selectedStartUtcDateRef.current = nextStartDate;
22322
+ const nextStartDateAsDayjs = getDayjsFromUtcDateAndTimeTuple(nextDateTuple, startUtcTimeTuple);
22323
+ selectedStartDateAsDayjsRef.current = nextStartDateAsDayjs;
22296
22324
  submit();
22297
22325
  }
22298
22326
  if (isFilled) {
@@ -22305,8 +22333,8 @@ function DateRangePicker({ baseContainer, defaultValue, disabled = false, error,
22305
22333
  if (!withTime || selectedEndTimeTupleRef.current) {
22306
22334
  // we must update the selected end date and call onChange()
22307
22335
  const endTimeTuple = (withTime ? selectedEndTimeTupleRef.current : ['23', '59']);
22308
- const nextEndDate = getUtcDateFromDateAndTimeTuple(nextDateTuple, endTimeTuple, true);
22309
- selectedEndUtcDateRef.current = nextEndDate;
22336
+ const nextEndDateAsDayjs = getDayjsFromUtcDateAndTimeTuple(nextDateTuple, endTimeTuple, true);
22337
+ selectedEndDateAsDayjsRef.current = nextEndDateAsDayjs;
22310
22338
  submit();
22311
22339
  }
22312
22340
  if (isFilled) {
@@ -22352,21 +22380,21 @@ function DateRangePicker({ baseContainer, defaultValue, disabled = false, error,
22352
22380
  // If this is a date picker without a time input,
22353
22381
  if (!withTime) {
22354
22382
  // we have to fix the start date at the beginning of the day
22355
- selectedStartUtcDateRef.current = getUtcDateFromDateAndTimeTuple(nextStartUtcDateTuple, ['00', '00']);
22383
+ selectedStartDateAsDayjsRef.current = getDayjsFromUtcDateAndTimeTuple(nextStartUtcDateTuple, ['00', '00']);
22356
22384
  // and the end date at the end of the day
22357
- selectedEndUtcDateRef.current = getUtcDateFromDateAndTimeTuple(nextEndUtcDateTuple, ['23', '59'], true);
22385
+ selectedEndDateAsDayjsRef.current = getDayjsFromUtcDateAndTimeTuple(nextEndUtcDateTuple, ['23', '59'], true);
22358
22386
  }
22359
22387
  // If this is a date picker with a time input,
22360
22388
  else {
22361
22389
  // we include the selected start time if it exists, set it at the beginning of the day if not
22362
- selectedStartUtcDateRef.current = getUtcDateFromDateAndTimeTuple(nextStartUtcDateTuple, selectedStartTimeTupleRef.current || ['00', '00']);
22390
+ selectedStartDateAsDayjsRef.current = getDayjsFromUtcDateAndTimeTuple(nextStartUtcDateTuple, selectedStartTimeTupleRef.current || ['00', '00']);
22363
22391
  // we include the selected end time if it exists, set it at the end of the day if not
22364
- selectedEndUtcDateRef.current = getUtcDateFromDateAndTimeTuple(nextEndUtcDateTuple, selectedEndTimeTupleRef.current || ['23', '59'], true);
22392
+ selectedEndDateAsDayjsRef.current = getDayjsFromUtcDateAndTimeTuple(nextEndUtcDateTuple, selectedEndTimeTupleRef.current || ['23', '59'], true);
22365
22393
  }
22366
22394
  selectedStartDateTupleRef.current = nextStartUtcDateTuple;
22367
- selectedStartTimeTupleRef.current = getTimeTupleFromUtcDate(selectedStartUtcDateRef.current);
22395
+ selectedStartTimeTupleRef.current = getUtcTimeTupleFromDayjs(selectedStartDateAsDayjsRef.current);
22368
22396
  selectedEndDateTupleRef.current = nextEndUtcDateTuple;
22369
- selectedEndTimeTupleRef.current = getTimeTupleFromUtcDate(selectedEndUtcDateRef.current);
22397
+ selectedEndTimeTupleRef.current = getUtcTimeTupleFromDayjs(selectedEndDateAsDayjsRef.current);
22370
22398
  closeRangeCalendarPicker();
22371
22399
  submit();
22372
22400
  }, [closeRangeCalendarPicker, submit, withTime]);
@@ -22378,8 +22406,8 @@ function DateRangePicker({ baseContainer, defaultValue, disabled = false, error,
22378
22406
  // If a start date has already been selected
22379
22407
  if (selectedStartDateTupleRef.current) {
22380
22408
  // we must update the selected start date accordingly and submit it
22381
- const nextStartDate = getUtcDateFromDateAndTimeTuple(selectedStartDateTupleRef.current, nextTimeTuple);
22382
- selectedStartUtcDateRef.current = nextStartDate;
22409
+ const nextStartDateAsDayjs = getDayjsFromUtcDateAndTimeTuple(selectedStartDateTupleRef.current, nextTimeTuple);
22410
+ selectedStartDateAsDayjsRef.current = nextStartDateAsDayjs;
22383
22411
  submit();
22384
22412
  }
22385
22413
  selectedStartTimeTupleRef.current = nextTimeTuple;
@@ -22389,8 +22417,8 @@ function DateRangePicker({ baseContainer, defaultValue, disabled = false, error,
22389
22417
  // If an end date has already been selected
22390
22418
  if (selectedEndDateTupleRef.current) {
22391
22419
  // we must update the selected end date accordingly and submit it
22392
- const nextEndDate = getUtcDateFromDateAndTimeTuple(selectedEndDateTupleRef.current, nextTimeTuple, true);
22393
- selectedEndUtcDateRef.current = nextEndDate;
22420
+ const nextEndDateAsDayjs = getDayjsFromUtcDateAndTimeTuple(selectedEndDateTupleRef.current, nextTimeTuple, true);
22421
+ selectedEndDateAsDayjsRef.current = nextEndDateAsDayjs;
22394
22422
  submit();
22395
22423
  }
22396
22424
  selectedEndTimeTupleRef.current = nextTimeTuple;
@@ -22403,7 +22431,31 @@ function DateRangePicker({ baseContainer, defaultValue, disabled = false, error,
22403
22431
  }, [forceUpdate]);
22404
22432
  useFieldUndefineEffect(disabled, onChange, handleDisable);
22405
22433
  useClickOutsideEffect([endDateInputRef, startDateInputRef], closeRangeCalendarPicker, baseContainer);
22406
- return (jsxs(Fieldset, { className: "Field-DateRangePicker", disabled: disabled, isLegendHidden: isLabelHidden, legend: label, ...nativeProps, children: [jsxs(Box$5, { isDisabled: disabled, children: [jsx(Field, { children: jsx(DateInput, { ref: startDateInputRef, baseContainer: baseContainer || undefined, defaultValue: selectedStartDateTupleRef.current, disabled: disabled, isCompact: isCompact, isForcedFocused: isRangeCalendarPickerOpenRef.current, isLight: isLight, isRange: true, isStartDate: true, onChange: (nextDateTuple, isFilled) => handleDateInputChange(DateRangePosition.START, nextDateTuple, isFilled), onClick: openRangeCalendarPicker, onInput: handleDateOrTimeInputInput, onNext: handleStartDateInputNext }) }), withTime && (jsx(Field, { isTimeField: true, children: jsx(TimeInput, { ref: startTimeInputRef, baseContainer: baseContainer || undefined, defaultValue: selectedStartTimeTupleRef.current, disabled: disabled, isCompact: isCompact, isLight: isLight, isStartDate: true, minutesRange: minutesRange, onBack: () => startDateInputRef.current?.focus(true), onChange: nextTimeTuple => handleTimeInputFilled(DateRangePosition.START, nextTimeTuple), onFocus: closeRangeCalendarPicker, onInput: handleDateOrTimeInputInput, onNext: () => endDateInputRef.current?.focus(), onPrevious: () => startDateInputRef.current?.focus(true) }) })), jsx(Field, { isEndDateField: true, children: jsx(DateInput, { ref: endDateInputRef, baseContainer: baseContainer || undefined, defaultValue: selectedEndDateTupleRef.current, disabled: disabled, isCompact: isCompact, isEndDate: true, isForcedFocused: isRangeCalendarPickerOpenRef.current, isLight: isLight, isRange: true, onBack: handleEndDateInputPrevious, onChange: (nextDateTuple, isFilled) => handleDateInputChange(DateRangePosition.END, nextDateTuple, isFilled), onClick: openRangeCalendarPicker, onInput: handleDateOrTimeInputInput, onNext: handleEndDateInputNext, onPrevious: handleEndDateInputPrevious }) }), withTime && (jsx(Field, { isTimeField: true, children: jsx(TimeInput, { ref: endTimeInputRef, baseContainer: baseContainer || undefined, defaultValue: selectedEndTimeTupleRef.current, disabled: disabled, isCompact: isCompact, isEndDate: true, isLight: isLight, minutesRange: minutesRange, onBack: () => endDateInputRef.current?.focus(true), onChange: nextTimeTuple => handleTimeInputFilled(DateRangePosition.END, nextTimeTuple), onFocus: closeRangeCalendarPicker, onInput: handleDateOrTimeInputInput, onPrevious: () => endDateInputRef.current?.focus(true) }) }))] }), !isErrorMessageHidden && hasError && jsx(FieldError, { children: controlledError }), jsx(RangeCalendarPicker, { defaultValue: rangeCalendarPickerDefaultValue, isHistorical: isHistorical, isOpen: isRangeCalendarPickerOpenRef.current, onChange: handleRangeCalendarPickerChange })] }));
22434
+ useEffect(() => {
22435
+ if (!hasMountedRef.current) {
22436
+ hasMountedRef.current = true;
22437
+ return;
22438
+ }
22439
+ if ((defaultValue &&
22440
+ previousDefaultValue &&
22441
+ defaultValue[0] instanceof Date &&
22442
+ defaultValue[1] instanceof Date &&
22443
+ previousDefaultValue[0] instanceof Date &&
22444
+ previousDefaultValue[1] instanceof Date &&
22445
+ defaultValue[0].toISOString() === previousDefaultValue[0].toISOString() &&
22446
+ defaultValue[1].toISOString() === previousDefaultValue[1].toISOString()) ||
22447
+ lodashExports.isEqual(defaultValue, previousDefaultValue)) {
22448
+ return;
22449
+ }
22450
+ selectedStartDateAsDayjsRef.current = defaultValue ? customDayjs(defaultValue[0]) : undefined;
22451
+ selectedEndDateAsDayjsRef.current = defaultValue ? customDayjs(defaultValue[1]) : undefined;
22452
+ selectedStartDateTupleRef.current = getUtcDateTupleFromDayjs(selectedStartDateAsDayjsRef.current);
22453
+ selectedEndDateTupleRef.current = getUtcDateTupleFromDayjs(selectedEndDateAsDayjsRef.current);
22454
+ selectedStartTimeTupleRef.current = getUtcTimeTupleFromDayjs(selectedStartDateAsDayjsRef.current);
22455
+ selectedEndTimeTupleRef.current = getUtcTimeTupleFromDayjs(selectedEndDateAsDayjsRef.current);
22456
+ forceUpdate();
22457
+ }, [defaultValue, forceUpdate, previousDefaultValue]);
22458
+ return (jsxs(Fieldset, { className: "Field-DateRangePicker", disabled: disabled, isLegendHidden: isLabelHidden, legend: label, ...nativeProps, children: [jsxs(Box$5, { isDisabled: disabled, children: [jsx(Field, { children: jsx(DateInput, { ref: startDateInputRef, baseContainer: baseContainer || undefined, disabled: disabled, isCompact: isCompact, isForcedFocused: isRangeCalendarPickerOpenRef.current, isLight: isLight, isRange: true, isStartDate: true, onChange: (nextDateTuple, isFilled) => handleDateInputChange(DateRangePosition.START, nextDateTuple, isFilled), onClick: openRangeCalendarPicker, onInput: handleDateOrTimeInputInput, onNext: handleStartDateInputNext, value: selectedStartDateTupleRef.current }) }), withTime && (jsx(Field, { isTimeField: true, children: jsx(TimeInput, { ref: startTimeInputRef, baseContainer: baseContainer || undefined, disabled: disabled, isCompact: isCompact, isLight: isLight, isStartDate: true, minutesRange: minutesRange, onBack: () => startDateInputRef.current?.focus(true), onChange: nextTimeTuple => handleTimeInputFilled(DateRangePosition.START, nextTimeTuple), onFocus: closeRangeCalendarPicker, onInput: handleDateOrTimeInputInput, onNext: () => endDateInputRef.current?.focus(), onPrevious: () => startDateInputRef.current?.focus(true), value: selectedStartTimeTupleRef.current }) })), jsx(Field, { isEndDateField: true, children: jsx(DateInput, { ref: endDateInputRef, baseContainer: baseContainer || undefined, disabled: disabled, isCompact: isCompact, isEndDate: true, isForcedFocused: isRangeCalendarPickerOpenRef.current, isLight: isLight, isRange: true, onBack: handleEndDateInputPrevious, onChange: (nextDateTuple, isFilled) => handleDateInputChange(DateRangePosition.END, nextDateTuple, isFilled), onClick: openRangeCalendarPicker, onInput: handleDateOrTimeInputInput, onNext: handleEndDateInputNext, onPrevious: handleEndDateInputPrevious, value: selectedEndDateTupleRef.current }) }), withTime && (jsx(Field, { isTimeField: true, children: jsx(TimeInput, { ref: endTimeInputRef, baseContainer: baseContainer || undefined, disabled: disabled, isCompact: isCompact, isEndDate: true, isLight: isLight, minutesRange: minutesRange, onBack: () => endDateInputRef.current?.focus(true), onChange: nextTimeTuple => handleTimeInputFilled(DateRangePosition.END, nextTimeTuple), onFocus: closeRangeCalendarPicker, onInput: handleDateOrTimeInputInput, onPrevious: () => endDateInputRef.current?.focus(true), value: selectedEndTimeTupleRef.current }) }))] }), !isErrorMessageHidden && hasError && jsx(FieldError, { children: controlledError }), jsx(RangeCalendarPicker, { defaultValue: rangeCalendarPickerDefaultValue, isHistorical: isHistorical, isOpen: isRangeCalendarPickerOpenRef.current, onChange: handleRangeCalendarPickerChange })] }));
22407
22459
  }
22408
22460
  const Box$5 = styled.div `
22409
22461
  * {
@@ -22448,6 +22500,10 @@ function useFieldControl(value, onChange, props) {
22448
22500
  onChange(nextValue);
22449
22501
  }
22450
22502
  }, [onChange]);
22503
+ const setInternalValue = useCallback((nextValue) => {
22504
+ internalValueRef.current = nextValue;
22505
+ forceUpdate();
22506
+ }, [forceUpdate]);
22451
22507
  // We update the `internalValue` each time the `value` prop is updated
22452
22508
  useEffect(() => {
22453
22509
  if (lodashExports.isEqual(value, previousValue)) {
@@ -22456,7 +22512,7 @@ function useFieldControl(value, onChange, props) {
22456
22512
  internalValueRef.current = value;
22457
22513
  forceUpdate();
22458
22514
  }, [forceUpdate, previousValue, value]);
22459
- return { controlledOnChange, controlledValue };
22515
+ return { controlledOnChange, controlledValue, setInternalValue };
22460
22516
  }
22461
22517
 
22462
22518
  function MultiCheckbox({ disabled = false, error, isErrorMessageHidden = false, isInline = false, isLabelHidden = false, isLight = false, isUndefinedWhenDisabled = false, label, name, onChange, options, value }) {
@@ -33207,20 +33263,16 @@ const UntypedDatePicker = DatePicker;
33207
33263
  function FormikDatePicker({ name, ...originalProps }) {
33208
33264
  const [field, meta, helpers] = useField(name);
33209
33265
  // eslint-disable-next-line react-hooks/exhaustive-deps
33210
- const defaultValue = useMemo(() => field.value, []);
33211
- // eslint-disable-next-line react-hooks/exhaustive-deps
33212
33266
  const handleChange = useMemo(() => helpers.setValue, []);
33213
- return jsx(UntypedDatePicker, { defaultValue: defaultValue, error: meta.error, onChange: handleChange, ...originalProps });
33267
+ return jsx(UntypedDatePicker, { defaultValue: field.value, error: meta.error, onChange: handleChange, ...originalProps });
33214
33268
  }
33215
33269
 
33216
33270
  const UntypedDateRangePicker = DateRangePicker;
33217
33271
  function FormikDateRangePicker({ name, ...originalProps }) {
33218
33272
  const [field, meta, helpers] = useField(name);
33219
33273
  // eslint-disable-next-line react-hooks/exhaustive-deps
33220
- const defaultValue = useMemo(() => field.value, []);
33221
- // eslint-disable-next-line react-hooks/exhaustive-deps
33222
33274
  const handleChange = useMemo(() => helpers.setValue, []);
33223
- return (jsx(UntypedDateRangePicker, { defaultValue: defaultValue, error: meta.error, onChange: handleChange, ...originalProps }));
33275
+ return (jsx(UntypedDateRangePicker, { defaultValue: field.value, error: meta.error, onChange: handleChange, ...originalProps }));
33224
33276
  }
33225
33277
 
33226
33278
  function FormikEffect({ onChange }) {