@true-engineering/true-react-common-ui-kit 4.0.0-alpha19 → 4.0.0-alpha20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@true-engineering/true-react-common-ui-kit",
3
- "version": "4.0.0-alpha19",
3
+ "version": "4.0.0-alpha20",
4
4
  "description": "True Engineering React UI Kit with theming support",
5
5
  "author": "True Engineering (https://trueengineering.ru)",
6
6
  "keywords": [
@@ -42,17 +42,17 @@
42
42
  "types-check": "tsc --noEmit"
43
43
  },
44
44
  "dependencies": {
45
- "@floating-ui/react": "0.26.12",
45
+ "@floating-ui/react": "0.27.13",
46
46
  "@true-engineering/true-react-platform-helpers": "0.4.4",
47
47
  "clsx": "1.2.1",
48
48
  "country-flag-icons": "1.5.5",
49
- "date-fns": "2.29.3",
49
+ "date-fns": "4.1.0",
50
50
  "filesize": "10.1.1",
51
51
  "hex-to-rgba": "2.0.1",
52
52
  "jss": "10.10.0",
53
53
  "lodash-es": "4.17.21",
54
54
  "react": "18.2.0",
55
- "react-datepicker": "4.25.0",
55
+ "react-datepicker": "8.4.0",
56
56
  "react-dom": "18.2.0",
57
57
  "react-input-mask": "3.0.0-alpha.2",
58
58
  "react-jss": "10.10.0",
@@ -73,7 +73,6 @@
73
73
  "@trivago/prettier-plugin-sort-imports": "4.3.0",
74
74
  "@types/lodash-es": "4.17.11",
75
75
  "@types/react": "18.2.79",
76
- "@types/react-datepicker": "4.19.4",
77
76
  "@types/react-dom": "18.2.25",
78
77
  "@types/react-input-mask": "3.0.2",
79
78
  "@types/react-transition-group": "4.4.10",
@@ -1,5 +1,5 @@
1
1
  import { useState } from 'react';
2
- import ru from 'date-fns/locale/ru';
2
+ import { ru } from 'date-fns/locale';
3
3
  import { ComponentStory } from '@storybook/react';
4
4
  import { DatePicker } from './DatePicker';
5
5
 
@@ -52,6 +52,7 @@ const Template: ComponentStory<typeof DatePicker> = (args) => {
52
52
  selectedDate={date}
53
53
  startDate={startDate}
54
54
  endDate={endDate}
55
+ minDate={new Date()}
55
56
  onChangeDate={setDate}
56
57
  onChangeRange={(dates) => {
57
58
  setStartDate(dates?.[0] ?? null);
@@ -1,4 +1,4 @@
1
- import { ITweakStyles, createThemedStyles } from '../../theme';
1
+ import { createThemedStyles, ITweakStyles } from '../../theme';
2
2
  import { IDateInputStyles } from '../DateInput';
3
3
 
4
4
  export const useStyles = createThemedStyles('DatePicker', {
@@ -9,6 +9,8 @@ export const useStyles = createThemedStyles('DatePicker', {
9
9
 
10
10
  day: {},
11
11
 
12
+ dayInner: {},
13
+
12
14
  datepicker: {},
13
15
 
14
16
  popper: {
@@ -63,7 +63,6 @@ export const DatePicker = forwardRef<ReactDatePicker, IDatePickerProps>(
63
63
  isClearable,
64
64
  strictParsing,
65
65
  fixedHeight,
66
- excludeScrollbar,
67
66
  focusSelectedMonth,
68
67
  disabledKeyboardNavigation,
69
68
  shouldRenderPopperInBody = false,
@@ -158,6 +157,7 @@ export const DatePicker = forwardRef<ReactDatePicker, IDatePickerProps>(
158
157
  }
159
158
  };
160
159
 
160
+ // TODO: кажется это можно улучшить, т.к проблему пофиксили (https://github.com/Hacker0x01/react-datepicker/pull/5060)
161
161
  const handleChangeDateRangeInput = (value: string) => {
162
162
  const newStartDateValue = value.slice(0, 10);
163
163
  let newStart = parseDateValue(newStartDateValue);
@@ -254,7 +254,6 @@ export const DatePicker = forwardRef<ReactDatePicker, IDatePickerProps>(
254
254
  inline={isInline}
255
255
  disabled={isDisabled}
256
256
  fixedHeight={fixedHeight}
257
- excludeScrollbar={excludeScrollbar}
258
257
  showPreviousMonths={showPreviousMonths}
259
258
  focusSelectedMonth={focusSelectedMonth}
260
259
  monthsShown={monthsShown}
@@ -267,12 +266,12 @@ export const DatePicker = forwardRef<ReactDatePicker, IDatePickerProps>(
267
266
  popperContainer={shouldRenderPopperInBody ? PopperContainer : undefined}
268
267
  popperModifiers={popperModifiers}
269
268
  popperPlacement={popperPlacement}
270
- selectsRange={isRange}
271
269
  strictParsing={strictParsing}
272
270
  preventOpenOnFocus={preventOpenOnFocus}
273
271
  shouldCloseOnSelect={shouldCloseOnSelect}
274
272
  customInputRef={customInputRef}
275
273
  customInput={<CustomInput {...dateInputProps} />}
274
+ renderDayContents={(day) => <div className={classes.dayInner}>{day}</div>}
276
275
  renderCustomHeader={
277
276
  renderCustomHeader ??
278
277
  ((baseProps) => <DatePickerHeader {...baseProps} months={months} />)
@@ -304,6 +303,7 @@ export const DatePicker = forwardRef<ReactDatePicker, IDatePickerProps>(
304
303
  startDate: start,
305
304
  endDate: end,
306
305
  selected: start,
306
+ selectsRange: true,
307
307
  onBlur: handleDateRangeInputBlur,
308
308
  onChange: handleChangeRange,
309
309
  }
@@ -1,6 +1,6 @@
1
- import { FC, ReactElement, ReactNode } from 'react';
2
- import { Portal } from 'react-overlays';
1
+ import { FC, PropsWithChildren } from 'react';
2
+ import { FloatingPortal } from '@floating-ui/react';
3
3
 
4
- export const PopperContainer: FC<{ children: ReactNode }> = ({ children }) => (
5
- <Portal container={document.body}>{children as ReactElement}</Portal>
4
+ export const PopperContainer: FC<PropsWithChildren> = (props) => (
5
+ <FloatingPortal root={document.body} {...props} />
6
6
  );
@@ -1,4 +1,4 @@
1
- import { ReactDatePickerProps } from 'react-datepicker';
1
+ import { DatePickerProps } from 'react-datepicker';
2
2
  import { type Locale } from 'date-fns';
3
3
  import { type IDateInputProps } from '../DateInput';
4
4
 
@@ -7,7 +7,7 @@ export type IRange = [Date | null, Date | null] | null;
7
7
  export type IDatePickerLocale = 'ru' | 'en' | Locale;
8
8
 
9
9
  export type IDatePickerBaseProps = Pick<
10
- ReactDatePickerProps,
10
+ DatePickerProps,
11
11
  | 'startDate'
12
12
  | 'endDate'
13
13
  | 'minDate'
@@ -34,7 +34,8 @@ export type IDatePickerBaseProps = Pick<
34
34
  | 'strictParsing'
35
35
  | 'highlightDates'
36
36
  | 'fixedHeight'
37
- | 'excludeScrollbar'
37
+ | 'swapRange'
38
+ | 'onKeyDown'
38
39
  > &
39
40
  Omit<
40
41
  IDateInputProps,
@@ -48,4 +49,5 @@ export type IDatePickerBaseProps = Pick<
48
49
  | 'onChange'
49
50
  | 'onClick'
50
51
  | 'tweakStyles'
52
+ | 'onKeyDown'
51
53
  >;
@@ -1,7 +1,6 @@
1
1
  import { FC, useMemo, useRef, useState } from 'react';
2
2
  import { isAfter, isBefore } from 'date-fns';
3
- import enUS from 'date-fns/locale/en-US';
4
- import ru from 'date-fns/locale/ru';
3
+ import { enUS, ru } from 'date-fns/locale';
5
4
  import { getTestId, isNotEmpty } from '@true-engineering/true-react-platform-helpers';
6
5
  import { addDataAttributes } from '../../../../helpers';
7
6
  import { useTweakStyles } from '../../../../hooks';
@@ -133,7 +132,7 @@ export const FilterWithDates: FC<IFilterWithDatesProps> = ({
133
132
  <div className={classes.containerItem}>
134
133
  <DatePicker
135
134
  selectedDate={value?.from}
136
- maxDate={value?.to}
135
+ maxDate={value?.to ?? undefined}
137
136
  label={translates.from}
138
137
  months={translates.months}
139
138
  locale={dateLocale}
@@ -149,7 +148,7 @@ export const FilterWithDates: FC<IFilterWithDatesProps> = ({
149
148
  selectedDate={value?.to}
150
149
  label={translates.to}
151
150
  months={translates.months}
152
- minDate={value?.from}
151
+ minDate={value?.from ?? undefined}
153
152
  locale={dateLocale}
154
153
  onChangeDate={handleChangeTo}
155
154
  tweakStyles={tweakEndDatePickerStyles}
@@ -8,7 +8,6 @@ import type {
8
8
  ICloseButtonStyles,
9
9
  ICommonIcon,
10
10
  IComplexIcon,
11
- IWithMessagesStyles,
12
11
  IControlWrapperStyles,
13
12
  ICssBaselineStyles,
14
13
  IDateInputStyles,
@@ -63,6 +62,7 @@ import type {
63
62
  IThemedPreloaderStyles,
64
63
  IToasterStyles,
65
64
  ITooltipStyles,
65
+ IWithMessagesStyles,
66
66
  IWithPopupStyles,
67
67
  IWithTooltipStyles,
68
68
  } from '../components';