From 5d31008a6bdc3665a3c093d3c6070e9569729051 Mon Sep 17 00:00:00 2001 From: Radek Podrazky Date: Mon, 6 May 2024 16:17:34 +0200 Subject: [PATCH] fix(DatePicker): fix default import from external package --- .../BaseSingleDatePicker/SingleDatePicker.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/_internal/BaseSingleDatePicker/SingleDatePicker.tsx b/src/components/_internal/BaseSingleDatePicker/SingleDatePicker.tsx index 4cdf9d9a9..cafbefa70 100644 --- a/src/components/_internal/BaseSingleDatePicker/SingleDatePicker.tsx +++ b/src/components/_internal/BaseSingleDatePicker/SingleDatePicker.tsx @@ -2,13 +2,21 @@ import React, { useRef, useState } from 'react'; import PropTypes from 'prop-types'; import styled from 'styled-components'; import { noop } from 'ramda-adjunct'; -import DatePicker from 'react-datepicker'; +import ReactDatePicker from 'react-datepicker'; import { datePickerStyles, singleDatePickerStyles } from './styles'; import { SingleDatePickerProps } from './SingleDatePicker.types'; import { DatePickerCustomHeader } from './CustomHeader'; import { CLX_COMPONENT } from '../../../theme/constants'; +/** + * The imports in "react-datepicker" are strangely done and after migration to Vite + * the default import stopped working. This should point React to use the coorect import + */ +const DatePicker = + (ReactDatePicker as unknown as { default: typeof ReactDatePicker }).default ?? + ReactDatePicker; + export const StyledDatePicker = styled.div` ${datePickerStyles} ${singleDatePickerStyles}