@true-engineering/true-react-common-ui-kit 4.0.0-alpha23 → 4.0.0-alpha25
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/dist/true-react-common-ui-kit.js +68 -54
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +68 -54
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/components/DatePicker/DatePicker.stories.tsx +21 -0
- package/src/components/DatePicker/DatePicker.tsx +6 -3
- package/src/components/FiltersPane/components/FilterWithDates/FilterWithDates.styles.ts +1 -1
- package/src/components/WithPopup/WithPopup.tsx +3 -5
package/package.json
CHANGED
|
@@ -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
|
-
|
|
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 =
|
|
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
|
|
|
@@ -121,10 +121,8 @@ export const WithPopup: FC<IWithPopupProps> = ({
|
|
|
121
121
|
|
|
122
122
|
const handleToggle = (isActive: boolean, event?: IWithPopupToggleEvent) => {
|
|
123
123
|
event?.stopPropagation();
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
setIsOpen(isActive);
|
|
127
|
-
}
|
|
124
|
+
onToggle?.(isActive, event);
|
|
125
|
+
setIsOpen(isActive);
|
|
128
126
|
};
|
|
129
127
|
|
|
130
128
|
const handleClose = (event?: IWithPopupToggleEvent) => {
|
|
@@ -132,7 +130,7 @@ export const WithPopup: FC<IWithPopupProps> = ({
|
|
|
132
130
|
};
|
|
133
131
|
|
|
134
132
|
const { refs, floatingStyles, context } = useFloating({
|
|
135
|
-
open: isOpen,
|
|
133
|
+
open: isOpen && !isDisabled,
|
|
136
134
|
middleware: [
|
|
137
135
|
offset(popupOffset),
|
|
138
136
|
canBeFlipped && flip({ fallbackAxisSideDirection: 'start' }),
|