@true-engineering/true-react-common-ui-kit 4.0.0-alpha23 → 4.0.0-alpha24

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-alpha23",
3
+ "version": "4.0.0-alpha24",
4
4
  "description": "True Engineering React UI Kit with theming support",
5
5
  "author": "True Engineering (https://trueengineering.ru)",
6
6
  "keywords": [
@@ -71,6 +71,27 @@ Default.args = {
71
71
  isRange: false,
72
72
  isClearable: true,
73
73
  shouldRenderPopperInBody: false,
74
+ popperPlacement: 'bottom-start',
75
+ };
76
+
77
+ Default.argTypes = {
78
+ popperPlacement: {
79
+ options: [
80
+ 'bottom-start',
81
+ 'bottom',
82
+ 'bottom-end',
83
+ 'top-start',
84
+ 'top',
85
+ 'top-end',
86
+ 'right-start',
87
+ 'right',
88
+ 'right-end',
89
+ 'left-start',
90
+ 'left',
91
+ 'left-end',
92
+ ],
93
+ control: 'select',
94
+ },
74
95
  };
75
96
 
76
97
  Default.parameters = {
@@ -8,6 +8,7 @@ import {
8
8
  isNotEmpty,
9
9
  isStringNotEmpty,
10
10
  } from '@true-engineering/true-react-platform-helpers';
11
+ import { offset } from '@floating-ui/react';
11
12
  import { addDataAttributes } from '../../helpers';
12
13
  import { useTweakStyles } from '../../hooks';
13
14
  import { ICommonProps } from '../../types';
@@ -70,8 +71,8 @@ export const DatePicker = forwardRef<ReactDatePicker, IDatePickerProps>(
70
71
  shouldCloseOnSelect,
71
72
  showPreviousMonths,
72
73
  preventOpenOnFocus,
73
- popperModifiers,
74
- popperPlacement,
74
+ popperModifiers = [],
75
+ popperPlacement = 'bottom-start',
75
76
  todayButton,
76
77
  highlightDates,
77
78
  calendarContainer,
@@ -264,7 +265,9 @@ export const DatePicker = forwardRef<ReactDatePicker, IDatePickerProps>(
264
265
  dayClassName={(v) => clsx(classes.day, dayClassName?.(v))}
265
266
  disabledKeyboardNavigation={disabledKeyboardNavigation}
266
267
  popperContainer={shouldRenderPopperInBody ? PopperContainer : undefined}
267
- popperModifiers={popperModifiers}
268
+ // Убираем дефолтный отступ в 10px из либы
269
+ // https://github.com/Hacker0x01/react-datepicker/blob/db67a58de2b05d2681bdf0a4977b606095d514c4/src/with_floating.tsx#L58
270
+ popperModifiers={[offset(-10), ...popperModifiers]}
268
271
  popperPlacement={popperPlacement}
269
272
  strictParsing={strictParsing}
270
273
  preventOpenOnFocus={preventOpenOnFocus}
@@ -38,7 +38,7 @@ export const clearButtonStyles = cloneDeep(innerTextButtonStyles);
38
38
  export const backButtonStyles = innerTextButtonStyles;
39
39
 
40
40
  const PICKER_TOP_MARGIN = 28;
41
- const PICKER_WITH_BUTTONS_TOP_MARGIN = 60;
41
+ const PICKER_WITH_BUTTONS_TOP_MARGIN = 56;
42
42
  const START_PICKER_LEFT_MARGIN = -20;
43
43
  const END_PICKER_LEFT_MARGIN = -170;
44
44